Read Function

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. ABI file :

struct BribeData {
    Token[] tokens;
    uint256[] rates;
    uint256[] userClaimable;
    uint256[] userRates;
}


struct GaugeData {
    address gauge;
    PoolData poolData;
    bool killed;
    uint256 totalVotes;
    uint256 userVotes;
    uint256 userClaimable;
    uint256 emissionRate;
    uint256 userEmissionRate;
    uint256 stakedValueInHubToken;
    uint256 userStakedValueInHubToken;
    uint256 averageInterestRatePerSecond;
    uint256 userInterestRatePerSecond;
    Token[] stakeableTokens;
    uint256[] stakedAmounts;
    uint256[] userStakedAmounts;
    Token[] underlyingTokens;
    uint256[] stakedUnderlying;
    uint256[] userUnderlying;
    BribeData[] bribes;
}

struct PoolData {
    address pool;
    string poolType;
    // lp tokens
    Token[] lpTokens;
    uint256[] mintedLPTokens;
    // tokens constituting the lp token
    Token[] listedTokens;
    uint256[] reserves;
    int256 logYield;
    bytes poolParams;
}

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.

  • 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 to get details about Gauge and Pools

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)
//use canonicalPools2,canonicalPoolLength2 function to fetch pools from v1 factory
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)
userAddress)

Last updated