diff --git a/data/seeds__blocto_teleport_labels.csv b/data/seeds__blocto_teleport_labels.csv new file mode 100644 index 0000000..d061ed9 --- /dev/null +++ b/data/seeds__blocto_teleport_labels.csv @@ -0,0 +1,9 @@ +teleport_contract,blockchain +A.04ee69443dedf0e4.TeleportCustody,Ethereum +A.0ac14a822e54cc4e.TeleportCustodyBSC,BSC +A.0ac14a822e54cc4e.TeleportCustodySolana,Solana +A.475755d2c9dccc3a.TeleportedSportiumToken,Ethereum +A.bd7e596b12e277df.TeleportCustody,Ethereum +A.c2fa71c36fd5b840.TeleportCustodyBSC,BSC +A.cfdd90d4a00f7b5b.TeleportedTetherToken,Ethereum +A.aad831d03d67904c.TeleportCustodyEthereum,Ethereum \ No newline at end of file diff --git a/data/seeds__celer_chain_ids.csv b/data/seeds__celer_chain_ids.csv new file mode 100644 index 0000000..9e88b15 --- /dev/null +++ b/data/seeds__celer_chain_ids.csv @@ -0,0 +1,10 @@ +chain_id,blockchain +1,Ethereum +56,BSC +137,Polygon +250,Fantom +1284,Moonbeam +2222,Kava +9001,Evmos +43114,Avalanche +12340001,Flow \ No newline at end of file diff --git a/models/silver/silver__bridge_blocto.sql b/models/silver/silver__bridge_blocto.sql index acb3e83..00f8ba7 100644 --- a/models/silver/silver__bridge_blocto.sql +++ b/models/silver/silver__bridge_blocto.sql @@ -121,7 +121,7 @@ blocto_inbound AS ( WHERE d.rn = 1 ), -teleports_out_withdraw AS ( +teleports_out_withdraw_non_fiat AS ( SELECT tx_id, event_contract, @@ -139,6 +139,44 @@ teleports_out_withdraw AS ( teleport_direction = 0 ) AND event_index = 0 + AND event_contract != 'A.b19436aae4d94622.FiatToken' +), +teleports_out_withdraw_fiat AS ( + SELECT + tx_id, + event_contract, + event_data :amount :: DOUBLE AS amount_withdraw, + event_data :from :: STRING AS from_withdraw + FROM + events + WHERE + tx_id IN ( + SELECT + tx_id + FROM + teleport_events + WHERE + teleport_direction = 0 + ) + AND event_index = 1 + AND event_contract = 'A.b19436aae4d94622.FiatToken' +), +teleports_out_withdraw AS ( + SELECT + tx_id, + event_contract, + amount_withdraw, + from_withdraw + FROM + teleports_out_withdraw_non_fiat + UNION + SELECT + tx_id, + event_contract, + amount_withdraw, + from_withdraw + FROM + teleports_out_withdraw_fiat ), teleports_out AS ( SELECT @@ -223,32 +261,10 @@ tbl_union AS ( ), tele_labels AS ( SELECT - 'A.04ee69443dedf0e4.TeleportCustody' AS teleport_contract, - 'Ethereum' AS blockchain - UNION - SELECT - 'A.0ac14a822e54cc4e.TeleportCustodyBSC' AS teleport_contract, - 'BSC' AS blockchain - UNION - SELECT - 'A.0ac14a822e54cc4e.TeleportCustodySolana' AS teleport_contract, - 'Solana' AS blockchain - UNION - SELECT - 'A.475755d2c9dccc3a.TeleportedSportiumToken' AS teleport_contract, - 'Ethereum' AS blockchain - UNION - SELECT - 'A.bd7e596b12e277df.TeleportCustody' AS teleport_contract, - 'Ethereum' AS blockchain - UNION - SELECT - 'A.c2fa71c36fd5b840.TeleportCustodyBSC' AS teleport_contract, - 'BSC' AS blockchain - UNION - SELECT - 'A.cfdd90d4a00f7b5b.TeleportedTetherToken' AS teleport_contract, - 'Ethereum' AS blockchain + teleport_contract, + blockchain + FROM + {{ ref('seeds__blocto_teleport_labels') }} ), FINAL AS ( SELECT diff --git a/models/silver/silver__bridge_celer.sql b/models/silver/silver__bridge_celer.sql index 2b31a63..280e149 100644 --- a/models/silver/silver__bridge_celer.sql +++ b/models/silver/silver__bridge_celer.sql @@ -131,36 +131,10 @@ tbl_union AS ( ), chain_ids AS ( SELECT - 1 AS chain_id, - 'Ethereum' AS blockchain - UNION - SELECT - 56 AS chain_id, - 'BSC' AS blockchain - UNION - SELECT - 137 AS chain_id, - 'Polygon' AS blockchain - UNION - SELECT - 250 AS chain_id, - 'Fantom' AS blockchain - UNION - SELECT - 2222 AS chain_id, - 'Kava' AS blockchain - UNION - SELECT - 9001 AS chain_id, - 'Evmos' AS blockchain - UNION - SELECT - 43114 AS chain_id, - 'Avalanche' AS blockchain - UNION - SELECT - 12340001 AS chain_id, - 'Flow' AS blockchain + chain_id, + blockchain + FROM + {{ ref('seeds__celer_chain_ids') }} ), FINAL AS ( SELECT