Query swap

Query swap on WOOFi

Base
Base

Reads onchain state

Reads the amount WOOFi would pay right now for an exact input. The pool answers at the price its market maker posts to the Wooracle, less the posted spread and a slippage that grows with the size of the trade, and reverts where the oracle is stale or the trade passes the pool's limits. Reach for it to set a swap floor from the live quote with a slippage haircut, to compare WOOFi against a routed swap, or to gate a trade on a minimum rate with a predicate.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

USDC to WETH on WOO Fi

woofi
math
3actions
  1. 1·Query swap

    First, the plug reads what WOOFi would currently pay to swap 100 USDC into WETH, capturing the live quote.

  2. 2·Multiply then divide

    Taking that quoted amount, it multiplies by 995 and divides by 1000 rounding down, which sets a floor at 99.5 percent of the quote and leaves room for slippage.

  3. 3·Swap

    Finally, it swaps 100 USDC for WETH at WOOFi's oracle price, requiring at least the computed floor so the trade reverts if the output falls short.

Get amount received for to
Calculate times divided by rounded
Swap for at least
  • USDC to WETH on WOO Fi

    woofi
    math

More on WOOFi · 1