flyingfishRemoveLiquidityPerps Events copy
Updated 2024-03-26
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 AddLiquidity Perps Events @ https://flipsidecrypto.xyz/edit/queries/236c0d98-8f84-4e61-a7d7-9f91d0ac5ee1
/*
addLiquidity
inner_evt_hex_2: 1bb299ba2fc48c2d
RemoveLiquidity
inner_evt_hex_2: 8dc7b67b9f5ed766
*/
select
value
-- , instruction:data as ins_data
-- , utils.udf_base58_to_hex(ins_data) as hex_data
-- , substr(hex_data, 3, 16) as evt_hex
, utils.udf_base58_to_hex(value:data) as hex_data
, substr(hex_data, 3, 16) as inner_evt_hex
, substr(hex_data, 3 + 16, 16) as inner_evt_hex_2
, utils.udf_hex_to_base58('0x' || substr(hex_data, 3 + 16 + 16, 64)) as custody_key
, utils.udf_hex_to_base58('0x' || substr(hex_data, 3 + 16 + 16 + 64, 64)) as pool_key
--, substr(hex_data, 3 + 16 + 16 + 64 + 64, 16) AS step1
, utils.udf_hex_to_int(to_char(reverse(to_binary(substr(hex_data, 3 + 16 + 16 + 64 + 64, 16))))) AS lp_amount_in -- Amount of JLP Burned
, utils.udf_hex_to_int(to_char(reverse(to_binary(substr(hex_data, 3 + 16 + 16 + 64 + 64 + 16, 16))))) AS remove_amount_usd
, utils.udf_hex_to_int(to_char(reverse(to_binary(substr(hex_data, 3 + 16 + 16 + 64 + 64 + 16 + 16, 16))))) AS fee_bps
, utils.udf_hex_to_int(to_char(reverse(to_binary(substr(hex_data, 3 + 16 + 16 + 64 + 64 + 16 + 16 + 16 , 16))))) AS remove_token_amount
, utils.udf_hex_to_int(to_char(reverse(to_binary(substr(hex_data, 3 + 16 + 16 + 64 + 64 + 16 + 16 + 16 + 16, 16))))) AS token_amount_after_fee
, utils.udf_hex_to_int(to_char(reverse(to_binary(substr(hex_data, 3 + 16 + 16 + 64 + 64 + 16 + 16 + 16 + 16 + 16, 32))))) AS post_pool_amount_usd
, b.instruction
, b.inner_instruction
, b.block_timestamp
, b.block_id
, b.tx_id
from solana.core.fact_events b
QueryRunArchived: QueryRun has been archived