Skip to content
Dune Analytics

@ashachaf / Bancor v2 APR (h) old

Bancor v2 APR (h) old

Loading
 

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

Loading
 

SQL query

1with view_smart_tokens as (
2    select distinct smart_token
3    from bancornetwork."view_add_convertible_token"
4),
5token_rate_update as (
6    select "_token1" as pool_token, 
7           "_token2" as reserve_token, 
8           "_rateN" as staked_balance,
9           "_rateD" as pool_token_supply,
10           rate.contract_address,
11           rate.evt_index as index,
12           rate.evt_block_time as block_time,
13           date_trunc('hours', rate.evt_block_time) as time_period,
14           rate.evt_block_number as block_number 
15    from bancornetwork."TokenRateUpdate_evt_TokenRateUpdate" rate
16    left join bancornetwork."Activation_evt_Activation" activation
17        on rate.contract_address = activation.contract_address
18    where activation."_type" = 2
19        and "_token1" in (select smart_token from view_smart_tokens)
20),
21-- calculate price
22tru as (
23    select *,
24           (staked_balance / 10 ^ t.decimals ) / (pool_token_supply / 10 ^ 18) as price
25    from token_rate_update s...