/ Bancor v2 APR (d) @ashachaf
About queries and results
Dune Analytics lets you explore, create, and share Ethereum analytics. You can find an endless amount of great queries and dashboards on Dune.
We have decoded Ethereum smart contract data so you can do powerful analysis with simple SQL queries and visualise the query results into beautiful graphs.
Dune Analytics is free for everyone forever. If you want extra features like private queries, export your results and more check out our Pro plan.
SQL query results
SQL query
1with token_rate_update as (
2 select "_token1" as pool_token,
3 "_token2" as reserve_token,
4 "_rateN" as staked_balance,
5 "_rateD" as pool_token_supply,
6 rate.contract_address,
7 rate.evt_index as index,
8 rate.evt_block_time as block_time,
9 date_trunc('days', rate.evt_block_time) as time_period,
10 rate.evt_block_number as block_number
11 from bancornetwork."TokenRateUpdate_evt_TokenRateUpdate" rate
12 left join bancornetwork."Activation_evt_Activation" activation
13 on rate.contract_address = activation.contract_address
14 where activation."_type" = 2
15 and "_token1" not in (select contract_address from erc20.tokens)
16 and "_activated" = true
17),
18-- calculate price
19tru as (
20 select *,
21 (staked_balance / 10 ^ t.decimals ) / (pool_token_supply / 10 ^ 18) as price
22 from token_rate_update s
23 left join erc20.tokens t
24 on s.reserve_token = t.contract_address
25),...