SwapIntent
Overview
The SwapIntent
allows users to express the desire to swap one input asset to exactly one of the specified output assets.
For each asset prices are determined via a dutch auction. The start and end amounts are supplied by the user and the price decreases linearly based on the fill or initiation time of the order.
At this time the settling mechanism takes no explicit fee but there is an implicit fee taken by the solver equal to the price difference between the input and output asset.
A valid SwapIntent
must be signed by the swapper address. To allow gasless execution, the signed struct should be a Permit2
permit where the SwapIntent
is included as a witness.
Message Format
Messages largely match what is in the intentpool specification. The SwapIntent
has the following fields:
swapper
, the address of the original issuernonce
, a nonce provided for preventing replayinitiateAfter
is the block number of the origin chain for when the intent is valid to be initiated. This can only be 0 if an auction is not being run.initiateDeadline
is the block number of the origin chain for when the intent ceases to be valid. This can only be 0 if an auction is not being run.finalizeDeadline
is the block number of the origin chain after initialization that the swap must finalize by.
The Item
data structure is used for specifying other parameters of the auction:
It specifies the chain and token by the chainId
and token
contract address, as well as the amountStart
and amountEnd
of the action. Note: a SwapIntent
cannot have two Item
with different amountStart
and amountEnd
, one item must have these values be the same (i.e., either the auction is over what the swapper provides, or what the swapper receives, but not both).
Last updated