boomer77LEVANA s
    Updated 2021-12-20
    with transfer_nfts AS (
    select block_timestamp,
    tx_id,
    event_attributes:action::string as action,
    event_attributes:token_id::string as tokenid,
    event_attributes:recipient::string as owner
    from terra.msg_events
    where event_type = 'wasm'
    and tx_status = 'SUCCEEDED'
    and action = 'transfer_nft'
    and (event_attributes:contract_address::string = 'terra1chrdxaef0y2feynkpq63mve0sqeg09acjnp55v'
    or event_attributes:order:order:maker_asset:info:nft:contract_addr = 'terra1chrdxaef0y2feynkpq63mve0sqeg09acjnp55v'
    or event_attributes:order:order:taker_asset:info:nft:contract_addr = 'terra1chrdxaef0y2feynkpq63mve0sqeg09acjnp55v'))
    ,
    orders_nfts AS (
    select block_timestamp,
    tx_id,
    event_attributes:action::string as action,
    nvl(event_attributes:order:order:maker_asset:info:nft:token_id::string,
    event_attributes:order:order:taker_asset:info:nft:token_id::string) as tokenid,
    nvl(event_attributes:recipient::string,event_attributes:sender::string) as owner
    from terra.msg_events
    where event_type = 'wasm'
    and tx_status = 'SUCCEEDED'
    and (action = 'execute_orders')
    and (event_attributes:contract_address::string = 'terra1chrdxaef0y2feynkpq63mve0sqeg09acjnp55v'
    or event_attributes:order:order:maker_asset:info:nft:contract_addr = 'terra1chrdxaef0y2feynkpq63mve0sqeg09acjnp55v'
    or event_attributes:order:order:taker_asset:info:nft:contract_addr = 'terra1chrdxaef0y2feynkpq63mve0sqeg09acjnp55v'))
    ,
    KW_sendnft AS (
    select block_timestamp,
    tx_id,
    'string' AS action,
    msg_value:execute_msg:send_nft:token_id::string AS tokenid,
    Run a query to Download Data