0xHaM-dEcho Protocol Over Time Final
    Updated 2024-12-06
    with echoRepayEventTb as (
    SELECT
    BLOCK_TIMESTAMP,
    TX_HASH,
    SENDER as user,
    PAYLOAD,
    split(split(PAYLOAD:function, '::')[2], '_')[0] as function,
    PAYLOAD:arguments[1]/1e6 as amt,
    split(PAYLOAD:type_arguments[0], '::')[2]::string as asset,
    PAYLOAD:type_arguments[0]::string as TOKEN_ADDRESS,
    FROM aptos.core.fact_transactions
    WHERE PAYLOAD_FUNCTION ilike '%0xeab7ea4d635b6b6add79d5045c4a45d8148d88287b1cfa1c3b6a4b56f46839ed%'
    AND SUCCESS = TRUE
    AND PAYLOAD_FUNCTION ilike ('%repay_simple')
    AND asset::string ilike ANY ('%USDT%', '%USDC%')
    )
    ,
    echoBorrowEventTb as (
    SELECT
    BLOCK_TIMESTAMP,
    TX_HASH,
    SENDER as user,
    PAYLOAD,
    split(split(PAYLOAD:function, '::')[2], '_')[0] as function,
    PAYLOAD:arguments[2]/1e6 as amt,
    split(PAYLOAD:type_arguments[0], '::')[2]::string as asset,
    PAYLOAD:type_arguments[0]::string as TOKEN_ADDRESS,
    FROM aptos.core.fact_transactions
    WHERE PAYLOAD_FUNCTION ilike '%0xeab7ea4d635b6b6add79d5045c4a45d8148d88287b1cfa1c3b6a4b56f46839ed%'
    AND SUCCESS = TRUE
    -- AND function in ('borrow')
    AND PAYLOAD_FUNCTION ilike ('%borrow_simple')
    AND asset::string ilike ANY ('%USDT%', '%USDC%')
    )
    ,
    echoBorrowEvent as (
    QueryRunArchived: QueryRun has been archived