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 :

42KB
Open
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

Last updated