Mrftinew-red copy copy
Updated 2025-01-11
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 new-red copy @ https://flipsidecrypto.xyz/studio/queries/7af1b032-c729-4743-9c1c-8695359ab349
-- forked from new-red @ https://flipsidecrypto.xyz/studio/queries/9a0035cc-a36b-48f2-9c8a-8dd19210876c
with usertbl AS
(
with database as --honeyswap mint txs+details
(
with tbl as (
select *
from berachain.testnet.fact_event_logs
where origin_to_address = '0xad1782b2a7020631249031618fb1bd09cd926b31'--honeyswap
and contract_address = '0xad1782b2a7020631249031618fb1bd09cd926b31'
and tx_succeeded = 'TRUE'
and ORIGIN_FUNCTION_SIGNATURE = '0x0d4d1513' --mint txs
)
SELECT
block_timestamp,
tx_hash,
'0x' || SUBSTR(PARSE_JSON(TOPICS)[2]::string, -40) AS user_address,
'0x' || SUBSTR(PARSE_JSON(TOPICS)[3]::string, -40) AS token_address,
utils.udf_hex_to_int(SUBSTRING(DATA, 67, 128))/pow (10,18) AS honey_amount,
case
when token_address = lower ('0x806ef538b228844c73e8e692adcfa8eb2fcf729c') then utils.udf_hex_to_int(SUBSTRING(DATA, 3, 64))/pow (10,18)
when token_address = lower ('0xd6D83aF58a19Cd14eF3CF6fe848C9A4d21e5727c') then utils.udf_hex_to_int(SUBSTRING(DATA, 3, 64))/pow (10,6)
when token_address = lower ('0x05D0dD5135E3eF3aDE32a9eF9Cb06e8D37A6795D') then utils.udf_hex_to_int(SUBSTRING(DATA, 3, 64))/pow (10,6)
end as token_amount,
token_amount-honey_amount as token_vault_amount,
case
when token_address = lower ('0x806ef538b228844c73e8e692adcfa8eb2fcf729c') then 'DAI'
when token_address = lower ('0xd6D83aF58a19Cd14eF3CF6fe848C9A4d21e5727c') then 'USDC'
when token_address = lower ('0x05D0dD5135E3eF3aDE32a9eF9Cb06e8D37A6795D') then 'USDT'
end as token,
from tbl
)
SELECT
Auto-refreshes every 12 hours
QueryRunArchived: QueryRun has been archived