Write Functions

There is the implementation of a single function named execute() that consolidates all actions like Swap, Liquidity, Vote, Bribe, and Reward claim into one convenient transaction. This design makes it straightforward and user-friendly.

For users who are not accustomed to this approach, we have included additional functions compatible with the commonly used Solidly router interface. These functions allow you to specify Token A/B and choose between Volatile or Stable pairs for swaps and adding liquidity, utilizing familiar commands.

For more advanced actions or to optimize gas costs by combining multiple actions in a single transaction, the execute() function is available and is also integrated into our frontend interface. Comprehensive instructions for its usage are provided at the end of the document.

ABI file :

48KB
Open

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.

function pairFor(address tokenA, address tokenB, bool stable) public view returns (address pair);

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

struct route {
       address from;
       address to;
       bool stable;
   }
function getAmountsOut(uint256 amountIn, route[] memory routes) external returns (uint256[] memory amounts);
  • 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.

3. Execute Swap

  1. Add Liquidity

  1. Remove Liquidity