maybeyonasaave-dash-repay-fees
Updated 2021-09-15
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with aaveRepays as (
select block_timestamp, tx_id, repayed_tokens, repayed_usd, payer, token_price, symbol, aave_token
from aave.repayments
where aave_version = 'Aave V2'
),
repayFee as(
select tx_id, event_inputs:amount0 as fee, tx_from_address as payer, contract_address
from ethereum.events_emitted
where event_name = 'Mint' and event_removed = FALSE
),
aaveFees as(
select
block_timestamp,
a.tx_id,
repayed_tokens,
repayed_usd,
a.payer,
token_price,
symbol,
fee
from aaveRepays a
join repayFee f on a.tx_id = f.tx_id and aave_token = contract_address
),
noNullerc20Deci as(
select symbol,decimals from ethereum.token_prices_hourly
where decimals is not null
),
erc20Deci as(
select symbol,min(decimals) as decimals
from noNullerc20Deci
group by symbol
),
aaveEvents as(
select
block_timestamp,
tx_id,
Run a query to Download Data