How to Read Data
Lens contract is all you need.
Last updated
Lens contract is all you need.
Last updated
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 :
0xaA18cDb16a4DD88a59f4c2f45b5c91d009549e06
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.
You could see the original source code at the repo.
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.
For example you could query,
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.
Pool's TVL, coverage ratio of wombat pools (difference between minted LPTokens and reserves), TokenA/B in specific pool from 'PoolData'
Stake position of specific user (using functions like queryGauge(), userBalances())
Get relevant Token struct in bytes32 to build parameters for other functions.