greyswanDefault rate copy
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 e1d42c94-0200-4ff7-bb07-ec8e769bca5c
with events as (
select * from solana.core.fact_events
where program_id = 'A66HabVL3DzNzeJgcHYtRRNW1ZRMKwBfrdSR4kLsZ9DJ'
and succeeded = 'True'
and block_id > {{DEPLOY_BLOCK}}
),
stopLiquidations as (
SELECT
instructions[0].accounts[0] as loan,
-- 'stop' as liq_type,
date_trunc('month', block_timestamp) as block_timestamp
from solana.core.fact_transactions as txs
where txs.block_id > {{DEPLOY_BLOCK}}
and txs.tx_id in (SELECT tx_id from events)
and txs.log_messages[1] = 'Program log: Instruction: StopLiquidationRafflesByAdmin'
),
redeems as (
SELECT
instructions[0].accounts[1] as loan,
-- 'redeem' as liq_type,
date_trunc('month', block_timestamp) as block_timestamp
from solana.core.fact_transactions as txs
where txs.block_id > {{DEPLOY_BLOCK}}
and txs.tx_id in (SELECT tx_id from events)
and txs.log_messages[1] = 'Program log: Instruction: RedeemWinningLotTicket'
),
liquidations as (
select
DISTINCT loan as loan, block_timestamp
from (
SELECT * from stopLiquidations
Run a query to Download Data