KaskoazulRef Finance TVL
    Updated 2022-08-08
    with raw as (
    select t.block_timestamp,
    t.tx_hash,
    t.tx_signer,
    t.tx,
    f.args,
    f.method_name,
    r.receipt_outcome_id as outcome
    from near.core.fact_transactions t
    join near.core.fact_actions_events_function_call f
    on t.tx_hash = f.tx_hash
    join near.core.fact_receipts r
    on t.tx_hash = r.tx_hash
    where tx_receiver = 'v2.ref-finance.near'
    ),

    add_liquidity as (
    select block_timestamp,
    tx_hash,
    tx_signer,
    tx,
    try_parse_json (args) as pargs,
    to_decimal (pargs:amounts[0]) as token_1,
    to_decimal (pargs:amounts[1]) as token_2,
    pargs:pool_id as pool_id
    from raw
    where method_name = 'add_liquidity'
    and pool_id = 79
    ),

    remove_liquidity as (
    select block_timestamp,
    tx_hash,
    tx_signer,
    tx,
    try_parse_json (args) as pargs,
    Run a query to Download Data