Allows solvers to execute a segment transaction based on a token pair price
The price condition uses a Uniswap V3 TWAP value to determine the price of Token A relative to Token B.
Schema
Property | Required | Description |
---|---|---|
type | Yes | "price" |
price | Yes | A price value. Expects a positive floating point number. This should be a price for the market pair tokenA/tokenB where tokenA is the base token and tokenB is the quote token. For example, a WETH/USDC price would be 1502.75 , and a USDC/WETH price would be 0.000665 |
operator | Yes | Can be gt (greater than) or lt (less than) |
tokenA | Yes | Address of the first token in the pair |
tokenB | Yes | Address of the second token in the pair |
twapInterval | No | The TWAP interval to use in seconds. Default is 1000. |
twapFeePool | No | The TWAP fee pool to use. Expects a Uniswap FeeAmount. Default is 3000. |
Examples
// for WETH/USDC
{
type: 'price',
operator: 'lt',
tokenA: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
tokenB: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
price: 1502.75
}
// for USDC/WETH
{
type: 'price',
operator: 'lt',
tokenA: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
tokenB: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH
price: 0.000665
}