Swap tokenIn for tokenOut at market price
Market swaps use a Uniswap V3 TWAP value to determine the price of tokenIn
relative to tokenOut
.
Schema
Property | Required | Description |
---|---|---|
| Yes |
|
| 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 |
| Yes | Address of the input token |
| Yes | Address of the output token |
| Yes | Amount of |
| Yes | The fee that the signer is willing to pay for the swap, as a percentage of the total swap value. Expects a number from 0 to 100. The fee can be subtracted from the market output in order to determine the amount of |
| No | The TWAP interval to use in seconds. Default is 1000. |
| No | The TWAP fee pool to use. Expects a Uniswap FeeAmount. Default is 3000. |
Example
{
type: 'marketSwap',
owner: '0xD12598bc2260f803a157a970486cE5e711B8CB3B', // address that holds USDC and receives WETH
tokenIn: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
tokenOut: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
tokenInAmount: 7500_000000,
fee: 1.5
}