freemartianTWO_CLP_BTC_ETH
Updated 2023-03-17
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
›
⌄
-- SELECT * FROM polygon.core.fact_token_transfers
-- WHERE tx_hash = '0xbb1eff09df913031f043fc3aeb1563d11ef0f5ebbdae1196d00ae445893ffb8e'
with join_tx AS (
SELECT tx_hash
FROM polygon.core.fact_token_transfers
WHERE from_address = '0x0000000000000000000000000000000000000000'
AND contract_address = '0xfa9ee04a5545d8e0a26b30f5ca5cbecd75ea645f'
AND origin_function_signature = '0xb95cac28'
),
exit_tx AS (
SELECT tx_hash
FROM polygon.core.fact_token_transfers
WHERE to_address = '0x0000000000000000000000000000000000000000'
AND contract_address = '0xfa9ee04a5545d8e0a26b30f5ca5cbecd75ea645f'
AND origin_function_signature = '0x8bdb3913'
),
pool_join AS (
SELECT
CASE
when contract_address = '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619' then sum(raw_amount)/pow(10,18)
when contract_address = '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' then sum(raw_amount)/pow(10,8)
end AS TWO_CLP_BTC_ETH_stake_amount,
CASE
when contract_address = '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619' then 'ETH'
when contract_address = '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' then 'BTC'
end AS Asset
FROM polygon.core.fact_token_transfers
WHERE tx_hash IN (select tx_hash from join_tx)
AND contract_address IN (
'0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
'0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6')
AND to_address = '0xba12222222228d8ba445958a75a0704d566bf2c8'
Run a query to Download Data