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

PropertyRequiredDescription
typeYes"price"
priceYesA 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
operatorYesCan be gt(greater than) or lt(less than)
tokenAYesAddress of the first token in the pair
tokenBYesAddress of the second token in the pair
twapIntervalNoThe TWAP interval to use in seconds. Default is 1000.
twapFeePoolNoThe 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
}