maybeyonasanchor_test
    Updated 2021-08-18
    with borrows as (
    select
    block_id as block,
    block_timestamp as time,
    tx_id,
    msg_value:sender::string as sender,
    msg_value:execute_msg:borrow_stable:borrow_amount as amount,
    'borrow' as event,
    -msg_value:execute_msg:borrow_stable:borrow_amount as vector
    from terra.msgs
    where
    msg_value:contract = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s'
    and msg_value:execute_msg:borrow_stable is not null
    and tx_status='SUCCEEDED'
    ),
    deposits as(
    select
    block_id as block,
    block_timestamp as time,
    tx_id,
    msg_value:sender::string as sender,
    msg_value:coins[0]:amount as amount,
    'deposit' as event,
    msg_value:coins[0]:amount as vector
    from terra.msgs
    where
    msg_value:contract = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s'
    and msg_value:execute_msg like '%deposit%'
    and tx_status='SUCCEEDED'
    ),
    repays as(
    select
    block_id as block,
    block_timestamp as time,
    tx_id,
    msg_value:sender::string as sender,
    Run a query to Download Data