Yousefi_1994BendDAO total borrow and repay
    Updated 2022-09-07
    with bend_repay as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as borrower,
    ((ethereum.public.udf_hex_to_int(substr(data, 3 + 1 * 64, 64)))::float) / 1e18 as amount,
    ethereum.public.udf_hex_to_int(substr(data, 3 + 2 * 64, 64)) as nft_token_id,
    ethereum.public.udf_hex_to_int(substr(data, 3 + 3 * 64, 64)) as loan_id
    from ethereum.core.fact_event_logs
    where contract_address = '0x70b97a0da65c15dfb0ffa02aee6fa36e507c2762'
    and topics[0] = '0x50e03867c1178391f204f7bf0eb2f52d5167dc65a99a9650a95abe55d17be17e'
    and contract_name is null
    and event_name is null
    and event_inputs is null
    ),
    bend_borrow as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as borrower,
    ((ethereum.public.udf_hex_to_int(substr(data, 3 + 1 * 64, 64)))::float) / 1e18 as amount,
    ethereum.public.udf_hex_to_int(substr(data, 3 + 2 * 64, 64)) as nft_asset,
    ethereum.public.udf_hex_to_int(substr(data, 3 + 3 * 64, 64)) as nft_token_id,
    ethereum.public.udf_hex_to_int(substr(data, 3 + 4 * 64, 64)) as borrow_rate,
    ethereum.public.udf_hex_to_int(substr(data, 3 + 5 * 64, 64)) as loan_id
    from ethereum.core.fact_event_logs
    where contract_address = '0x70b97a0da65c15dfb0ffa02aee6fa36e507c2762'
    and topics[0] = '0xcfb3a669117d9dc90f0d3521228dc9fe67c5102dde205ef16fe9a1f81be698d5'
    and contract_name is null
    and event_name is null
    and event_inputs is null
    ),
    total_bend_borrow as (
    select
    'Borrower' as "Type",
    sum(amount) as "Amount",
    Run a query to Download Data