pub struct ClientFeeParams { /* private fields */ }Expand description
Client fee configuration for the Tycho Router.
When attached to EncodingOptions via EncodingOptions::with_client_fee, the router
charges a client fee on the swap output. The signature must be an EIP-712 signature by the
receiver over the ClientFee typed data — compute the hash with
ClientFeeParams::eip712_signing_hash.
Implementations§
Source§impl ClientFeeParams
impl ClientFeeParams
Sourcepub fn new(
bps: u16,
receiver: Bytes,
max_contribution: BigUint,
deadline: u64,
) -> Self
pub fn new( bps: u16, receiver: Bytes, max_contribution: BigUint, deadline: u64, ) -> Self
Create client fee params.
signature must be a 65-byte EIP-712 signature by receiver.
Sourcepub fn with_signature(self, signature: Bytes) -> Self
pub fn with_signature(self, signature: Bytes) -> Self
Set the EIP-712 signature.
Sourcepub fn eip712_signing_hash(
&self,
chain_id: u64,
router_address: &Bytes,
amount_in: &BigUint,
token_in: &Bytes,
token_out: &Bytes,
min_amount_out: &BigUint,
receiver: &Bytes,
swaps_hash: &[u8; 32],
) -> Result<[u8; 32], FyndError>
pub fn eip712_signing_hash( &self, chain_id: u64, router_address: &Bytes, amount_in: &BigUint, token_in: &Bytes, token_out: &Bytes, min_amount_out: &BigUint, receiver: &Bytes, swaps_hash: &[u8; 32], ) -> Result<[u8; 32], FyndError>
Compute the EIP-712 signing hash for the client fee params.
Pass the returned hash to the fee receiver’s signer, then supply the
65-byte result to ClientFeeParams::with_signature.
The hash covers all 10 ClientFee fields. The swap-specific inputs
(amount_in, token_in, token_out, min_amount_out, receiver,
swaps_hash) come from a prior unsigned quote request — see
FeeBreakdown and the swap_client_fee example for the two-step flow.
router_address: 20-byte address of the TychoRouter contract.amount_in: exact input amount from the order.token_in: 20-byte input token address.token_out: 20-byte output token address.min_amount_out: minimum output after fees — useFeeBreakdown::min_amount_received.receiver: 20-byte address receiving the swap output.swaps_hash: keccak256 of the encoded swaps bytes — useFeeBreakdown::swaps_hash.
Trait Implementations§
Source§impl Clone for ClientFeeParams
impl Clone for ClientFeeParams
Source§fn clone(&self) -> ClientFeeParams
fn clone(&self) -> ClientFeeParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for ClientFeeParams
impl RefUnwindSafe for ClientFeeParams
impl Send for ClientFeeParams
impl Sync for ClientFeeParams
impl Unpin for ClientFeeParams
impl UnsafeUnpin for ClientFeeParams
impl UnwindSafe for ClientFeeParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more