Skip to content

Commit

Permalink
Update mavis_ronin_base_trades.sql
Browse files Browse the repository at this point in the history
Made changes based on Rob's suggestions. Thanks Rob!
  • Loading branch information
peterrliem authored Dec 26, 2024
1 parent 5bf6195 commit fb01042
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ select
cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.erc') as double) as erc,
FROM_HEX(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.addr')) as nft_contract_address,
cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.id') as double) as nft_token_id,
cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.quantity') as double) as quantity,
case
when cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.quantity') as double) = 0 then 1
else cast(json_extract_scalar(replace(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')),'$.assets[0]'),'\\', ''),'$.quantity') as double)
end as quantity,
FROM_HEX(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')), '$.paymentToken')) as currency_address,
CAST(json_extract_scalar("order", '$.realPrice') AS DOUBLE) as price_raw,
CAST(json_extract_scalar(json_parse(json_extract_scalar("order", '$.info')), '$.baseUnitPrice') AS DOUBLE) as base_unit_price_raw,
FROM_HEX(json_extract_scalar("order", '$.refunder')) as refunder,
FROM_HEX(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[1].recipient')) as platform_address,
CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[1].ratio') AS DOUBLE) as platform_fee_amount_raw,
CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[1].value') AS DOUBLE) as platform_fee_amount_raw,
FROM_HEX(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[2].recipient')) as axie_treasury_address,
CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[2].ratio') AS DOUBLE) as axie_fee_raw,
CAST(json_extract_scalar(json_parse(cast(concat('[', array_join(receivedAllocs, ','), ']') as varchar)),'$[2].value') AS DOUBLE) as axie_fee_amount_raw,
Expand Down Expand Up @@ -66,8 +69,8 @@ base_trades as (
quantity as nft_amount,
seller,
buyer,
'' as trade_category,
'' as trade_type,
'buy' as trade_category,
'secondary' as trade_type,
price_raw,
currency_address as currency_contract,
contract_address as project_contract_address,
Expand All @@ -76,8 +79,8 @@ base_trades as (
platform_fee_amount_raw,
creator_royalty_address as royalty_fee_address,
creator_royalty_fee_amount_raw as royalty_fee_amount_raw,
-- axie_fee_amount_raw,
-- ronin_treasury_fee_amount_raw,
axie_fee_amount_raw,
ronin_treasury_fee_amount_raw,
evt_index as sub_tx_trade_id
FROM trade_details
)
Expand Down

0 comments on commit fb01042

Please sign in to comment.