winnie-fsDelta Prime borrow apr copy
Updated 2024-06-28
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
›
⌄
-- forked from cloudr3n / Delta Prime borrow apr @ https://flipsidecrypto.xyz/cloudr3n/q/KS3VzKDSawIw/delta-prime-borrow-apr
select
date_trunc({{Time_Interval}},day) as day,
avg(updatedRate) as apr,
contract_address,
case when contract_address in ('0x637fdb03d95b36bb25b6b44964b4725482546a08','0x8f0848b329ad310abadd7f85c3c0cfeceb0a78fd') then 'BTC'
when contract_address in ('0x66b8ad391b2d37e60b5b9ec7f96686e9efedb2cb','0x796dbe7adc72158f08b0b79e20caa4293d32132f') then 'ETH'
when contract_address in ('0x646afd5fff39962672bbbfac80106f0f9d8ff9fe','0x5f6847cac849d67acfe2da9ccaff3df11f9e1e9f') then 'USDt'
when contract_address in ('0x93a0f1d983ae56ab19fe72961842e9e576830e80','0x58da820738d3bc3583566ecfc5660b176ac446a6') then 'USDC'
when contract_address in ('0x7201e8cb96ff5bdfa69377f2f29a21027ff7dbb1','0xab764b1e960e346a7f5c8cc92d5750d0f0782ad2') then 'AVAX'
end as token,
type
FROM
(
select
date(block_timestamp) as day,
decoded_log:updatedRate * pow(10, -18) * 100 as updatedRate,
case
when contract_address in (
'0x637fdb03d95b36bb25b6b44964b4725482546a08',
'0x796dbe7adc72158f08b0b79e20caa4293d32132f',
'0x5f6847cac849d67acfe2da9ccaff3df11f9e1e9f',
'0x58da820738d3bc3583566ecfc5660b176ac446a6',
'0xab764b1e960e346a7f5c8cc92d5750d0f0782ad2'
) then 'Deposit'
when contract_address in (
'0x8f0848b329ad310abadd7f85c3c0cfeceb0a78fd',
'0x66b8ad391b2d37e60b5b9ec7f96686e9efedb2cb',
'0x646afd5fff39962672bbbfac80106f0f9d8ff9fe',
'0x93a0f1d983ae56ab19fe72961842e9e576830e80',
'0x7201e8cb96ff5bdfa69377f2f29a21027ff7dbb1'
) then 'Borrow'
end as
type,
contract_address
QueryRunArchived: QueryRun has been archived