Skip to content

Commit

Permalink
Excludes possible negative tvls because of issues with ERC20/ETH tran…
Browse files Browse the repository at this point in the history
…sfers
  • Loading branch information
PoloX2021 committed Nov 6, 2024
1 parent 7bb4668 commit dd0dccc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
-- Input: blockchain
select r.contract_address,
sum(amount_usd) as volume,
365*greatest(0,sum(amount_usd*fee/tvl)) as apr,
365*sum(amount_usd*fee/tvl) as apr,
avg(fee) as fee,
avg(tvl) as tvl
from "query_4232976(blockchain='{{blockchain}}')" r
left join curve.trades t
on r.contract_address = t.project_contract_address
and r.tx_hash = t.tx_hash
where t.block_time>=date_add('day', -1, now())
-- This test avoids any possible issue with reconstructing the reserves of the pool
and tvl >0
group by r.contract_address

union
Expand Down

0 comments on commit dd0dccc

Please sign in to comment.