Swap an exact amount of tokenIn for an exact amount of tokenOut
A limit swap will be executed by a solver when and if market pricing allows.
Warning
Signing a limitSwap with lower than market token output will allow a swap at a sub-optimal price.
Schema
Property | Required | Description |
---|---|---|
type | Yes | "limitSwap" |
id | Yes | An ID for the limit swap. Expects an integer greater than 0. |
owner | Yes | Address that will release input token and require output token. This also needs to be the address that sets approval allowance to the signer's account |
tokenIn | Yes | Address of the input token |
tokenOut | Yes | Address of the output token |
tokenInAmount | Yes | Amount of tokenIn allowed to be sent from the signer to the solver |
tokenOutAmount | Yes | Amount of tokenOut required to be paid to the signer by the solver |
Example
{
type: 'limitSwap',
id: 123456789,
owner: '0xD12598bc2260f803a157a970486cE5e711B8CB3B', // address that holds USDC and receives WETH
tokenIn: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
tokenOut: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
tokenInAmount: 7500_000000,
tokenOutAmount: 5_500000000000000000
}