feyikemi2024-05-25 02:09 PM
Updated 2024-05-25
999
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
A AS (
SELECT
'polygon' AS chain,
origin_from_address AS user,
from_address AS contract,
to_address AS pool,
amount AS amount,
contract_address,
block_timestamp
FROM
polygon.core.ez_token_transfers
WHERE
contract_address = LOWER('0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7') -- $GHST Token Contract Address
UNION ALL
SELECT
'polygon' AS chain,
origin_to_address AS user,
to_address AS contract,
from_address AS pool,
0 - amount AS amount,
contract_address,
block_timestamp
FROM
polygon.core.ez_token_transfers
WHERE
contract_address = LOWER('0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7') -- $GHST Token Contract Address
),
-- Stake
B AS (
SELECT
DATE_TRUNC('day', block_timestamp) AS time,
'Manual stake' AS action,
SUM(amount) AS stake,
SUM(CASE WHEN amount > 0 THEN amount END) AS stake_in,
QueryRunArchived: QueryRun has been archived