Read Functions

Instead of collecting and calculating addresses here and there to get the data you need, you can look up everything in one place : Lens.

ABI file : [Repo here]

There are 3 return struct types : Bribe / Gauge / Pool

These are all you need to get user balances, calculate Apr, pool info, etc. We also use this Lens contract for our frontend.

As you can see, except for 2 functions marked as 'view', all of them are not view functions.

So you should call them as staticCall to get the result returned.

  • Even though we're not using "wombat style stable pools" but instead utilizing Curve's stable pair, we've retained the original function name for maintenance reasons. In this context, "Canonical pool" refers to volatile pools, and "Wombat pool" refers to stable pools.

  • LogYield data on PoolData struct refers to LP's apr of growing due to accumulated swap fees. You could calculate the APR like this : APR(%) = 2^(logYield * 86400 * 365 / 1e18) * 100

//functions you could use

//type 'Token' here is byte32. look 'Execute() section' for the details
function spotPrice(ISwap swap, Token base, Token quote, uint256 baseAmount) public returns (uint256)
function spotPrice(Token base, Token quote, uint256 amount) public returns (uint256)
function spotPrice(Token quote, Token[] memory tok, uint256[] memory amount) public returns (uint256)
function userBalances(address user, Token[] calldata ts) public view returns (uint256[] memory balances)
function wombatGauges(address user) external returns (GaugeData[] memory gaugeDataArray)
function canonicalPools(address user, uint256 begin, uint256 maxLength)
        external returns (GaugeData[] memory gaugeDataArray)
function canonicalPoolLength() external returns (uint256)
function queryGauge(address gauge, address user) external returns (GaugeData memory poolData)
function getPoolBalance(address pool, Token t) external view returns (uint256)
function queryPool(address pool) external returns (PoolData memory ret)
function emissionRate(IGauge gauge) external returns (uint256)

For example you could query,

  1. Total votes, APR(Average interest Rate per second), staked TVL, Emission rate from 'GaugeData'. Use various functions above to get gauge data. *There are too many variable pools and can cause errors depending on the RPC limit when querying at once, so we have prepared a canonicalPools function with pagenation. Wombat pools are usually few, so querying with wombatGauges() shouldn't cause errors.

  2. Pool's TVL, coverage ratio of wombat pools (difference between minted LPTokens and reserves), TokenA/B in specific pool from 'PoolData'

  3. Stake position of specific user (using functions like queryGauge(), userBalances())

  4. Get relevant Token struct in bytes32 to build parameters for other functions.

Last updated