Skip to content
Dune Analytics

@Brecht / Loopring Protocol Fees

SQL query

1--DROP FUNCTION dune_user_generated.decodeFloat;
2--DROP FUNCTION dune_user_generated.process;
3DROP TYPE dune_user_generated.trade_struct;
4
5CREATE TYPE dune_user_generated.trade_struct AS (
6    block_timestamp timestamptz,
7    tokenA integer,
8    fillA double precision,
9    tokenB integer,
10    fillB double precision,
11    accountA integer,
12    accountB integer, 
13    protocolFeeTakerBips double precision,
14    protocolFeeMakerBips double precision
15);
16
17CREATE OR REPLACE FUNCTION dune_user_generated.decodeFloat(data bytea) RETURNS double precision AS $$
18DECLARE
19exponent integer;
20mantissa integer;
21value integer;
22BEGIN
23value = get_byte(data, 0) * 65536 + get_byte(data, 1) * 256 + get_byte(data, 2);
24exponent = value / 524288;
25mantissa = value - (exponent * 524288);...

SQL query results

Loading