Comment on page
How to Read Data
Lens contract is all you need.
Instead of collecting and calculating addresses here and there to get the data you need, you can look up everything in one place : Lens.
zksyncEra Lens : 0xf55150000aac457eCC88b34dA9291e3F6E7DB165
Linea Lens :
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.
//functions you could use
//type 'Token' here is byte32. look 'How to interact with Velocore' 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 modified 9d ago