Sandeshall repay
    Updated 2022-09-07
    with repay as
    (
    select block_timestamp,tx_hash,origin_function_signature,origin_from_address as usr,
    event_index,
    concat('0x',substr(topics[2],27,40)) as nft,
    tokenflow_eth.hextoint(concat('0x',substr(data,27+64,40)))/1e18 as amount,
    concat('0x',substr(topics[1],27,40)) as currency,
    tokenflow_eth.hextoint(concat('0x',substr(data,27+64+64,40))) as token_id,
    tokenflow_eth.hextoint(concat('0x',substr(data,27+64+64+64,40))) as loan_id
    from ethereum.core.fact_event_logs
    where topics[0]='0x50e03867c1178391f204f7bf0eb2f52d5167dc65a99a9650a95abe55d17be17e'
    and origin_function_signature in ('0x89cbe656','0x5a953999','0x633d2a19','0x7f185c1e')
    and origin_to_address in ('0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88',lower('0xeD01f8A737813F0bDA2D4340d191DBF8c2Cbcf30'))
    )
    select sum(amount) from repay
    -- group by 1 order by 2 desc

    Run a query to Download Data