Swap / Quote / Pair Address
Pair(=Gauge) address, getting a quote, executing a swap easily
Last updated
Pair(=Gauge) address, getting a quote, executing a swap easily
Last updated
Like always, the only contract you need to interact is the Vault contract.
Implementation contracts and ABI : Vault
ABI :
Facet Overview : Louper
SwapHelperFacet1(Swap/Quote) : Scan link
SwapHelperFacet2(Liquidity) : Scan link
1. Getting pair address for two tokens.
Pool itself is a Gauge.
We DON'T USE WETH. Use address(0) as token address to find native ETH pairs.
address(0) could be returned when the corresponding pair isn't created yet.
2. Quote swap
Note that it is not a 'view' but in a form of 'write function'. so that you should query with staticCall() to get the result, not just call().
Use address(0) for ETH pairs instead of WETH address
*We support int128 instead of uint256 internally because we accommodate negative calculations. However, there's no need to use negative values in a regular swap, and for interface compatibility, we will accept inputs as uint256 and then convert them internally. Please be aware that inputs exceeding int128 will cause a revert.
3. Execute Swap
We support all these 3 interface for the swap.
Again, We DON'T USE WETH. Use address(0) as token address to use route including native ETH pairs.
Example code
*To speed up the search, liquidity size below $100 is excluded from the path search in our swap Frontend. So if you want to test swap with a mock token in our frontend, please create an LP of at least 100($50+50) before swapping.