Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge Models: Clean up Bridge Transfers #678

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions models/projects/across/raw/ez_across_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,22 @@
}}


select *
from {{ref('fact_across_transfers')}}

select
version
, contract_address
, block_timestamp
, event_index
, t3.chain as source_chain
, depositor as source_address
, tx_hash as destination_tx_hash

, t2.chain as destination_chain
, recipient as destination_address
, destination_token_symbol
, destination_token
, amount
from {{ref('fact_across_transfers')}} t1
left join {{ref('chain_ids')}} t2 on t1.destination_chain_id = t2.id
left join {{ref('chain_ids')}} t3 on t1.origin_chain_id = t3.id
limit 10
11 changes: 10 additions & 1 deletion models/projects/arbitrum/raw/ez_arbitrum_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@
}}


select *
select
block_timestamp,
tx_hash as ethereum_tx_hash,
event_index,
depositor as source_address,
recipient as destination_address,
amount,
token_address as ethereum_token_address,
source_chain,
destination_chain
from {{ref('fact_arbitrum_one_bridge_transfers')}}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@
}}


select *
select
block_timestamp,
tx_hash as ethereum_tx_hash,
event_index,
depositor as source_address,
recipient as destination_address,
amount,
token_address as ethereum_token_address,
source_chain,
destination_chain
from {{ref('fact_avalanche_bridge_transfers')}}
11 changes: 10 additions & 1 deletion models/projects/base/raw/ez_base_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@
}}


select *
select
block_timestamp,
tx_hash as ethereum_tx_hash,
event_index,
depositor as source_address,
recipient as destination_address,
amount,
token_address as ethereum_token_address,
source_chain,
destination_chain
from {{ref('fact_base_bridge_transfers')}}
18 changes: 16 additions & 2 deletions models/projects/cctp/raw/ez_cctp_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,19 @@
}}


select *
from {{ref('fact_cctp_transfers')}}
select
block_timestamp,
block_number,
tx_hash as source_tx_hash,
nonce as source_nonce,
contract_address as source_contract_address,
sender as source_address,
c1.chain as source_chain,
burn_token as source_token_address,
reciepient as destination_address,
c2.chain as destination_chain,
amount,
amount_usd,
from {{ref('fact_cctp_transfers')}} t
left join {{ref('cctp_chain_ids')}} c1 on t.source_domain_id = c1.chain_id
left join {{ref('cctp_chain_ids')}} c2 on t.destination_domain_id = c2.chain_id
11 changes: 10 additions & 1 deletion models/projects/optimism/raw/ez_optimism_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@
}}


select *
select
block_timestamp,
tx_hash as ethereum_tx_hash,
event_index,
depositor as source_address,
recipient as destination_address,
amount,
token_address as ethereum_token_address,
source_chain,
destination_chain
from {{ref('fact_optimism_bridge_transfers')}}
11 changes: 10 additions & 1 deletion models/projects/polygon/raw/ez_polygon_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@
}}


select *
select
block_timestamp,
tx_hash as ethereum_tx_hash,
event_index,
depositor as source_address,
recipient as destination_address,
amount,
token_address as ethereum_token_address,
source_chain,
destination_chain
from {{ref('fact_polygon_pos_bridge_transfers')}}
11 changes: 10 additions & 1 deletion models/projects/starknet/raw/ez_starknet_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@
}}


select *
select
block_timestamp,
tx_hash as ethereum_tx_hash,
event_index,
depositor as source_address,
recipient as destination_address,
amount,
token_address as ethereum_token_address,
source_chain,
destination_chain
from {{ref('fact_starknet_bridge_transfers')}}
20 changes: 18 additions & 2 deletions models/projects/synapse/raw/ez_synapse_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,21 @@
}}


select *
from {{ref('fact_synapse_transfers')}}
select
s.chain as origin_chain
, origin_tx_hash
, origin_block_timestamp
, depositor as source_address
, origin_token_address
, origin_token_symbol
, origin_token_amount
, d.chain as destiantion_chain
, destination_tx_hash
, destination_block_timestamp
, recipient as destination_address
, destination_token_address
, destination_token_symbol
, destination_token_amount
from {{ref('fact_synapse_transfers')}}
left join {{ref('chain_ids')}} d on destination_chain_id = d.id
left join {{ref('chain_ids')}} s on origin_chain_id = s.id
18 changes: 15 additions & 3 deletions models/projects/wormhole/raw/ez_wormhole_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
)
}}


select *
from {{ref('fact_wormhole_transfers')}}
select
t.id as wormhole_txn_hash
, timestamp
, date_trunc('day', timestamp) as date
, c1.chain as source_chain
, c2.chain as destination_chain
, from_address as source_address
, to_address as destiantion_address
, symbol as token_symbol
, token_address
, amount
, amount_usd
from {{ref('fact_wormhole_transfers')}} t
inner join {{ref('wormhole_chain_ids')}} c1 on t.from_chain = c1.id
inner join {{ref('wormhole_chain_ids')}} c2 on t.to_chain = c2.id
11 changes: 10 additions & 1 deletion models/projects/zksync/raw/ez_zksync_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@
}}


select *
select
block_timestamp,
tx_hash as ethereum_tx_hash,
event_index,
depositor as source_address,
recipient as destination_address,
amount,
token_address as ethereum_token_address,
source_chain,
destination_chain
from {{ref('fact_zksync_era_bridge_transfers')}}
9 changes: 9 additions & 0 deletions seeds/cctp_chain_ids.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
chain_id,chain
0,ethereum
1,avalanche
2,optimism
3,arbitrum
4,noble
5,solana
6,base
7,polygon
26 changes: 26 additions & 0 deletions seeds/chain_ids.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
id,chain
1,ethereum
10,optimism
137,polygon
288,boba
42161,arbitrum
8453,base
324,zksync
59144,linea
1313161554,aurora
250,fantom
1088,metis
1284,moonbeam
8217,klaytn
43114,avalanche
1285,moonriver
7700,canto
2000,dogechain
53935,dfk
1666600000,harmony
56,bsc
25,cronos
81457,blast
534352,scroll
34443,mode
1135,lisk
47 changes: 47 additions & 0 deletions seeds/wormhole_chain_ids.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
id,chain
1,solana
2,ethereum
3,terra
4,bsc
5,polygon
6,avalanche
7,oasis
8,algorand
9,aurora
10,fantom
11,karura
12,acala
13,klaytn
14,celo
15,near
16,moonbeam
17,neon
18,terra2
19,injective
20,osmosis
21,sui
22,aptos
23,arbitrum
24,optimism
25,gnosis
26,pythnet
28,xpla
30,base
32,sei
33,rootstock
34,scroll
35,mantle
36,blast
37,xlayer
38,linea
39,berachain
40,seievm
4000,cosmoshub
4001,evmos
4002,kujira
4003,neutron
4004,celestia
4005,stargaze
4006,seda
4007,dymension
4008,provenance
Loading