Skip to content

Commit

Permalink
add/bridge-updates-op (#224)
Browse files Browse the repository at this point in the history
* updates for native

* docs

* symbol for axelar

* bridge dst chain seed
  • Loading branch information
drethereum authored Jan 4, 2024
1 parent 28a7897 commit adbabc5
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 22 deletions.
3 changes: 2 additions & 1 deletion data/silver_bridge__meson_chain_id_seed.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ Sui,0x0310
Terra,0x014a
Thorchain,0x03a3
Tron,0x00c3
zkSync Era,0x0324
zkSync Era,0x0324
zkFair,0xa70e
98 changes: 98 additions & 0 deletions data/silver_bridge__standard_dst_chain_seed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
destination_chain,standard_destination_chain
acala,acala
algorand,algorand
aptos,aptos
arbitrum,arbitrum
arbitrum nova,arbitrum nova
arbitrum one,arbitrum
archway,archway
astar,astar
aurora,aurora
aurora mainnet,aurora
avalanche,avalanche
avalanche c-chain,avalanche
base,base
bnb,bsc
bnb chain,bsc
bnb smart chain mainnet,bsc
boba bnb mainnet,boba
boba network,boba
bsc,bsc
canto,canto
carbon,carbon
celo,celo
celo mainnet,celo
coinweb,coinweb
conflux,conflux
conflux espace,conflux
crab network,crab
crescent,crescent
cronos mainnet,cronos
crypto chain,crypto
dfk chain,dfk
dogechain mainnet,dogechain
eos,eos
ethereum,ethereum
ethereum mainnet,ethereum
evmos,evmos
fantom,fantom
fantom opera,fantom
filecoin,filecoin
fuse,fuse
gnosis,gnosis
harmony mainnet shard 0,harmony
huobi eco chain mainnet,huobi eco
injective,injective
juno,juno
karura,karura
kava,kava
klaytn,klaytn
klaytn mainnet cypress,klaytn
kujira,kujira
linea,linea
manta,manta
mantle,mantle
metis,metis
metis andromeda mainnet,metis
moonbeam,moonbeam
moonriver,moonriver
nautilus,nautilus
near,near
neutron,neutron
oasis,oasis
okxchain mainnet,okxchain
ontology mainnet,ontology
op mainnet,optimism
opbnb,opbnb
optimism,optimism
osmosis,osmosis
polygon,polygon
polygon mainnet,polygon
polygon pos,polygon
polygon zkevm,polygon zkevm
ronin,ronin
scroll,scroll
secret-snip,secret
sei,sei
skale europa,skale europa
skale nebula,skale nebula
solana,solana
stargaze,stargaze
starknet,starknet
sui,sui
telos evm mainnet,telos
terra,terra
terra-2,terra2
terra2,terra2
tezos,tezos
tron,tron
umee,umee
waves,waves
xpla,xpla
xrpl,xrpl
zkfair,zkfair
zksync era,zksync era
zksync era mainnet,zksync era
zksync lite,zksync lite
zora,zora
zzz,zzz
2 changes: 1 addition & 1 deletion models/doc_descriptions/bridge/evm_bridge_activity.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% docs evm_bridge_table_doc %}

A convenience table that aggregates bridge activity from event_logs, traces and transfers, including bridge deposits and transfers sent from the following protocols: ACROSS, AXELAR, CELER, CBRIDGE, HOP, MESON, MULTICHAIN, NATIVE, STARGATE, SYMBIOSIS, SYNAPSE, WORMHOLE along with other helpful columns, including an amount USD where available. Note, this table only includes records for the protocols listed above with live, onchain bridge activity and may not represent the complete bridging picture.
A convenience table that aggregates bridge activity from event_logs, traces and transfers, including bridge deposits and transfers sent from the following protocols: ACROSS, AXELAR, CELER, CBRIDGE, HOP, MESON, MULTICHAIN, STARGATE, SYMBIOSIS, SYNAPSE, WORMHOLE along with other helpful columns, including an amount USD where available. Note, this table only includes records for the protocols listed above with live, onchain bridge activity and may not represent the complete bridging picture.

{% enddocs %}

Expand Down
8 changes: 7 additions & 1 deletion models/gold/defi/defi__ez_bridge_activity.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ SELECT
sender,
receiver,
destination_chain_receiver,
destination_chain,
COALESCE(
standard_destination_chain,
b.destination_chain
) AS destination_chain,
destination_chain_id,
token_address,
token_symbol,
Expand All @@ -47,3 +50,6 @@ SELECT
) AS modified_timestamp
FROM
{{ ref('silver_bridge__complete_bridge_activity') }}
b
LEFT JOIN {{ ref('silver_bridge__standard_dst_chain_seed') }} C
ON b.destination_chain = C.destination_chain
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ native_transfers AS (
tx.from_address AS origin_from_address,
tx.to_address AS origin_to_address,
tx.origin_function_signature,
et.eth_from_address,
et.eth_to_address,
et.from_address,
et.to_address,
amount_precise_raw,
identifier,
_call_id,
et._inserted_timestamp
FROM
{{ ref('core__ez_eth_transfers') }}
{{ ref('silver__native_transfers') }}
et
INNER JOIN {{ ref('silver__transactions') }}
tx
ON et.block_number = tx.block_number
AND et.tx_hash = tx.tx_hash
WHERE
et.eth_to_address = '0x25ab3efd52e6470681ce037cd546dc60726948d3'
et.to_address = '0x25ab3efd52e6470681ce037cd546dc60726948d3'

{% if is_incremental() %}
AND et._inserted_timestamp >= (
Expand Down Expand Up @@ -101,9 +101,9 @@ all_transfers AS (
tx_hash,
NULL AS event_index,
NULL AS event_name,
eth_to_address AS bridge_address,
eth_from_address AS sender,
eth_to_address AS receiver,
to_address AS bridge_address,
from_address AS sender,
to_address AS receiver,
amount_precise_raw AS amount_unadj,
'0x4200000000000000000000000000000000000006' AS token_address,
{{ dbt_utils.generate_surrogate_key(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ WITH across AS (
destination_chain_id :: STRING AS destination_chain_id,
NULL AS destination_chain,
token_address,
NULL AS token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
Expand Down Expand Up @@ -61,6 +62,7 @@ axelar AS (
NULL AS destination_chain_id,
destination_chain,
token_address,
token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
Expand Down Expand Up @@ -96,6 +98,7 @@ celer_cbridge AS (
destination_chain_id :: STRING AS destination_chain_id,
NULL AS destination_chain,
token_address,
NULL AS token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
Expand Down Expand Up @@ -131,6 +134,7 @@ hop AS (
destination_chain_id :: STRING AS destination_chain_id,
NULL AS destination_chain,
token_address,
NULL AS token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
Expand Down Expand Up @@ -166,6 +170,7 @@ meson AS (
destination_chain_id :: STRING AS destination_chain_id,
destination_chain,
token_address,
NULL AS token_symbol,
amount_unadj,
_id,
_inserted_timestamp
Expand Down Expand Up @@ -201,6 +206,7 @@ multichain AS (
destination_chain_id :: STRING AS destination_chain_id,
NULL AS destination_chain,
token_address,
NULL AS token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
Expand Down Expand Up @@ -236,6 +242,7 @@ stargate AS (
destination_chain_id :: STRING AS destination_chain_id,
destination_chain,
token_address,
NULL AS token_symbol,
amount_unadj,
_log_id AS _id,
_inserted_timestamp
Expand Down Expand Up @@ -271,6 +278,7 @@ symbiosis AS (
destination_chain_id :: STRING AS destination_chain_id,
NULL AS destination_chain,
token_address,
NULL AS token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
Expand All @@ -287,7 +295,7 @@ WHERE
)
{% endif %}
),
synapse_tr AS (
synapse_tb AS (
SELECT
block_number,
block_timestamp,
Expand All @@ -299,18 +307,19 @@ synapse_tr AS (
bridge_address,
event_name,
platform,
'v1-td' AS version,
'v1-tb' AS version,
sender,
receiver,
destination_chain_receiver,
destination_chain_id :: STRING AS destination_chain_id,
NULL AS destination_chain,
token_address,
NULL AS token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
FROM
{{ ref('silver_bridge__synapse_tokenredeem') }}
{{ ref('silver_bridge__synapse_token_bridge') }}

{% if is_incremental() %}
WHERE
Expand All @@ -322,7 +331,7 @@ WHERE
)
{% endif %}
),
synapse_trs AS (
synapse_tbs AS (
SELECT
block_number,
block_timestamp,
Expand All @@ -334,18 +343,19 @@ synapse_trs AS (
bridge_address,
event_name,
platform,
'v1-tds' AS version,
'v1-tbs' AS version,
sender,
receiver,
destination_chain_receiver,
destination_chain_id :: STRING AS destination_chain_id,
NULL AS destination_chain,
token_address,
NULL AS token_symbol,
amount AS amount_unadj,
_log_id AS _id,
_inserted_timestamp
FROM
{{ ref('silver_bridge__synapse_tokenredeemandswap') }}
{{ ref('silver_bridge__synapse_tokenbridgeandswap') }}

{% if is_incremental() %}
WHERE
Expand Down Expand Up @@ -376,6 +386,7 @@ wormhole AS (
destination_chain_id :: STRING AS destination_chain_id,
destination_chain,
token_address,
NULL AS token_symbol,
amount_unadj,
_id,
_inserted_timestamp
Expand Down Expand Up @@ -436,12 +447,12 @@ all_protocols AS (
SELECT
*
FROM
synapse_tr
synapse_tb
UNION ALL
SELECT
*
FROM
synapse_trs
synapse_tbs
UNION ALL
SELECT
*
Expand Down Expand Up @@ -485,7 +496,13 @@ FINAL AS (
)
END AS destination_chain,
b.token_address,
C.token_symbol AS token_symbol,
CASE
WHEN platform = 'axelar' THEN COALESCE(
C.token_symbol,
b.token_symbol
)
ELSE C.token_symbol
END AS token_symbol,
C.token_decimals AS token_decimals,
amount_unadj,
CASE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ WITH base_evt AS (
FROM
{{ ref('silver__decoded_logs') }}
WHERE
topics [0] :: STRING = '0xdc5bad4651c5fbe9977a696aadc65996c468cde1448dd468ec0d83bf61c4b57c'
topics [0] :: STRING IN (
'0xdc5bad4651c5fbe9977a696aadc65996c468cde1448dd468ec0d83bf61c4b57c',
--redeem
'0xda5273705dbef4bf1b902a131c2eac086b7e1476a8ab0cb4da08af1fe1bd8e3b' --deposit
)
AND contract_address = '0xaf41a65f786339e7911f4acdad6bd49426f2dc6b'
AND origin_to_address IS NOT NULL

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
models:
- name: silver_bridge__synapse_tokenredeem
- name: silver_bridge__synapse_token_bridge
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
models:
- name: silver_bridge__synapse_tokenredeemandswap
- name: silver_bridge__synapse_tokenbridgeandswap
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
Expand Down

0 comments on commit adbabc5

Please sign in to comment.