diff --git a/models/_sector/labels/_schema.yml b/daily_spellbook/models/_sector/labels/_schema.yml similarity index 100% rename from models/_sector/labels/_schema.yml rename to daily_spellbook/models/_sector/labels/_schema.yml diff --git a/models/_sector/labels/labels_counterparty_activity_daily.sql b/daily_spellbook/models/_sector/labels/labels_counterparty_activity_daily.sql similarity index 96% rename from models/_sector/labels/labels_counterparty_activity_daily.sql rename to daily_spellbook/models/_sector/labels/labels_counterparty_activity_daily.sql index 64b1af94dae..8d587aca128 100644 --- a/models/_sector/labels/labels_counterparty_activity_daily.sql +++ b/daily_spellbook/models/_sector/labels/labels_counterparty_activity_daily.sql @@ -23,7 +23,7 @@ select ,count(*) as transfers_in ,sum(amount_usd) as usd_in from {{source('labels','owner_addresses')}} l -inner join {{ref('tokens_transfers')}} t +inner join {{source('tokens', 'transfers')}} t on t.blockchain = l.blockchain and "to" = l.address and amount_usd < pow(10,12) @@ -45,7 +45,7 @@ select ,count(*) as transfers_out ,sum(amount_usd) as usd_out from {{source('labels','owner_addresses')}} l -inner join {{ref('tokens_transfers')}} t +inner join {{source('tokens', 'transfers')}} t on t.blockchain = l.blockchain and "from" = l.address and amount_usd < pow(10,12) diff --git a/models/_sector/labels/labels_transfer_summary.sql b/daily_spellbook/models/_sector/labels/labels_transfer_summary.sql similarity index 95% rename from models/_sector/labels/labels_transfer_summary.sql rename to daily_spellbook/models/_sector/labels/labels_transfer_summary.sql index dde70b2c244..c55f9297951 100644 --- a/models/_sector/labels/labels_transfer_summary.sql +++ b/daily_spellbook/models/_sector/labels/labels_transfer_summary.sql @@ -22,7 +22,7 @@ select ,max_by(tx_hash, block_time) as last_tx_hash ,max(block_time) as last_block_time from {{source('labels','owner_addresses')}} l -inner join {{ref('tokens_transfers')}} t +inner join {{source('tokens', 'transfers')}} t on t.blockchain = l.blockchain and "to" = l.address and amount_usd < pow(10,12) @@ -40,7 +40,7 @@ select ,max_by(tx_hash, block_time) as last_tx_hash ,max(block_time) as last_block_time from {{source('labels','owner_addresses')}} l -inner join {{ref('tokens_transfers')}} t +inner join {{source('tokens', 'transfers')}} t on t.blockchain = l.blockchain and "from" = l.address and amount_usd < pow(10,12) diff --git a/models/_sector/labels/labels_transfer_summary_daily.sql b/daily_spellbook/models/_sector/labels/labels_transfer_summary_daily.sql similarity index 95% rename from models/_sector/labels/labels_transfer_summary_daily.sql rename to daily_spellbook/models/_sector/labels/labels_transfer_summary_daily.sql index 994626efac8..b0d4d05a755 100644 --- a/models/_sector/labels/labels_transfer_summary_daily.sql +++ b/daily_spellbook/models/_sector/labels/labels_transfer_summary_daily.sql @@ -22,7 +22,7 @@ select ,count(*) as transfers_in ,sum(amount_usd) as usd_in from {{source('labels','owner_addresses')}} l -inner join {{ref('tokens_transfers')}} t +inner join {{source('tokens', 'transfers')}} t on t.blockchain = l.blockchain and "to" = l.address and amount_usd < pow(10,12) @@ -40,7 +40,7 @@ select ,count(*) as transfers_out ,sum(amount_usd) as usd_out from {{source('labels','owner_addresses')}} l -inner join {{ref('tokens_transfers')}} t +inner join {{source('tokens', 'transfers')}} t on t.blockchain = l.blockchain and "from" = l.address and amount_usd < pow(10,12) diff --git a/dex/macros/models/_project/oneinch/AR/oneinch_ar_cfg_contracts_macro.sql b/dex/macros/models/_project/oneinch/AR/oneinch_ar_cfg_contracts_macro.sql new file mode 100644 index 00000000000..0580f02afea --- /dev/null +++ b/dex/macros/models/_project/oneinch/AR/oneinch_ar_cfg_contracts_macro.sql @@ -0,0 +1,213 @@ +{% macro oneinch_ar_cfg_contracts_macro() %} + +{% + set samples = { + "aggregate": { + "src_token_address": "fromToken", + "dst_token_address": "toToken", + "src_token_amount": "tokensAmount", + "dst_token_amount": "output_returnAmount", + "dst_token_amount_min": "minTokensAmount", + "router_type": "generic", + }, + "swap": { + "kit": "cast(json_parse(desc) as map(varchar, varchar))", + "src_token_address": "from_hex(kit['srcToken'])", + "dst_token_address": "from_hex(kit['dstToken'])", + "src_receiver": "from_hex(kit['srcReceiver'])", + "dst_receiver": "from_hex(kit['dstReceiver'])", + "src_token_amount": "cast(kit['amount'] as uint256)", + "dst_token_amount": "output_returnAmount", + "dst_token_amount_min": "cast(kit['minReturnAmount'] as uint256)", + "router_type": "generic", + }, + "unoswap v3-v5": { + "pools": "pools", + "src_token_amount": "amount", + "dst_token_amount": "output_returnAmount", + "dst_token_amount_min": "minReturn", + "direction_mask": "bytearray_to_uint256(rpad(0x80, 32, 0x00))", + "unwrap_mask": "bytearray_to_uint256(rpad(0x40, 32, 0x00))", + "router_type": "unoswap", + }, + "unoswap v6": { + "src_token_address": "substr(cast(token as varbinary), 13)", + "src_token_amount": "amount", + "dst_token_amount": "output_returnAmount", + "dst_token_amount_min": "minReturn", + "pool_type_mask": "bytearray_to_uint256(rpad(0xe0000000, 32, 0x00))", + "pool_type_offset": "253", + "direction_mask": "bytearray_to_uint256(rpad(0x00800000, 32, 0x00))", + "unwrap_mask": "bytearray_to_uint256(rpad(0x10000000, 32, 0x00))", + "src_token_mask": "bytearray_to_uint256(rpad(0x000000ff, 32, 0x00))", + "src_token_offset": "224", + "dst_token_mask": "bytearray_to_uint256(rpad(0x0000ff00, 32, 0x00))", + "dst_token_offset": "232", + "router_type": "unoswap", + }, + "clipper": { + "src_token_address": "srcToken", + "dst_token_address": "dstToken", + "src_token_amount": "inputAmount", + "dst_token_amount": "output_returnAmount", + "router_type": "clipper", + }, + } +%} + +-- EVENTS CONFIG +{% + set contracts = { + "ExchangeV1": { + "version": "0.1", + "blockchains": ["ethereum"], + "start": "2019-06-03", + "end": "2020-09-18", + "methods": { + "aggregate": samples["aggregate"], + }, + }, + "ExchangeV2": { + "version": "0.2", + "blockchains": ["ethereum"], + "start": "2019-06-10", + "end": "2020-09-18", + "methods": { + "aggregate": samples["aggregate"], + }, + }, + "ExchangeV3": { + "version": "0.3", + "blockchains": ["ethereum"], + "start": "2019-06-18", + "end": "2020-09-18", + "methods": { + "aggregate": samples["aggregate"], + }, + }, + "ExchangeV4": { + "version": "0.4", + "blockchains": ["ethereum"], + "start": "2019-07-18", + "end": "2020-09-18", + "methods": { + "aggregate": samples["aggregate"], + }, + }, + "ExchangeV5": { + "version": "0.5", + "blockchains": ["ethereum"], + "start": "2019-07-18", + "end": "2020-09-18", + "methods": { + "aggregate": samples["aggregate"], + }, + }, + "ExchangeV6": { + "version": "0.6", + "blockchains": ["ethereum"], + "start": "2019-07-19", + "end": "2020-09-18", + "methods": { + "aggregate": samples["aggregate"], + }, + }, + "ExchangeV7": { + "version": "0.7", + "blockchains": ["ethereum"], + "start": "2019-09-17", + "end": "2019-09-29", + "methods": { + "swap": dict(samples["aggregate"], src_token_amount="fromTokenAmount", dst_token_amount_min="minReturnAmount"), + }, + }, + "AggregationRouterV1": { + "version": "1", + "blockchains": ["ethereum"], + "start": "2019-09-28", + "methods": { + "swap": dict(samples["aggregate"], src_token_amount="fromTokenAmount", dst_token_amount_min="minReturnAmount"), + }, + }, + "AggregationRouterV2": { + "version": "2", + "blockchains": ["ethereum", "bnb"], + "start": "2020-11-04", + "methods": { + "swap": samples["swap"], + "discountedSwap": samples["swap"], + }, + }, + "AggregationRouterV3": { + "version": "3", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "optimism"], + "start": "2021-03-14", + "methods": { + "swap": samples["swap"], + "discountedSwap": samples["swap"], + "unoswap": dict(samples["unoswap v3-v5"], blockchains=["ethereum","bnb","polygon","arbitrum"], src_token_address="srcToken", pools="transform(_0, x -> bytearray_to_uint256(x))"), + "unoswapWithPermit": dict(samples["unoswap v3-v5"], blockchains=["ethereum","bnb","polygon","arbitrum"], src_token_address="srcToken", pools="transform(pools, x -> bytearray_to_uint256(x))"), + }, + }, + "AggregationRouterV4": { + "version": "4", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "optimism", "avalanche_c", "gnosis", "fantom"], + "start": "2021-11-05", + "methods": { + "swap": samples["swap"], + "discountedSwap": dict(samples["swap"], blockchains=["bnb", "polygon"]), + "clipperSwap": dict(samples["clipper"], src_token_amount="amount", dst_token_amount_min="minReturn", blockchains=["ethereum"]), + "clipperSwapTo": dict(samples["clipper"], src_token_amount="amount", dst_token_amount_min="minReturn", blockchains=["ethereum"], dst_receiver="recipient"), + "clipperSwapToWithPermit": dict(samples["clipper"], src_token_amount="amount", dst_token_amount_min="minReturn", blockchains=["ethereum"], dst_receiver="recipient"), + "unoswap": dict(samples["unoswap v3-v5"], src_token_address="srcToken", pools="transform(pools, x -> bytearray_to_uint256(x))"), + "unoswapWithPermit": dict(samples["unoswap v3-v5"], src_token_address="srcToken", pools="transform(pools, x -> bytearray_to_uint256(x))"), + "uniswapV3Swap": dict(samples["unoswap v3-v5"], unwrap_mask="bytearray_to_uint256(rpad(0x20, 32, 0x00))"), + "uniswapV3SwapTo": dict(samples["unoswap v3-v5"], dst_receiver="recipient", unwrap_mask="bytearray_to_uint256(rpad(0x20, 32, 0x00))"), + "uniswapV3SwapToWithPermit": dict(samples["unoswap v3-v5"], dst_receiver="recipient", unwrap_mask="bytearray_to_uint256(rpad(0x20, 32, 0x00))"), + }, + }, + "AggregationRouterV5": { + "version": "5", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "optimism", "avalanche_c", "gnosis", "fantom", "base", "zksync"], + "start": "2022-11-04", + "methods": { + "swap": samples["swap"], + "clipperSwap": samples["clipper"], + "clipperSwapTo": dict(samples["clipper"], dst_receiver="recipient"), + "clipperSwapToWithPermit": dict(samples["clipper"], dst_receiver="recipient"), + "unoswap": dict(samples["unoswap v3-v5"], src_token_address="srcToken"), + "unoswapTo": dict(samples["unoswap v3-v5"], src_token_address="srcToken", dst_receiver="recipient"), + "unoswapToWithPermit": dict(samples["unoswap v3-v5"], src_token_address="srcToken", dst_receiver="recipient"), + "uniswapV3Swap": dict(samples["unoswap v3-v5"], unwrap_mask="bytearray_to_uint256(rpad(0x20, 32, 0x00))"), + "uniswapV3SwapTo": dict(samples["unoswap v3-v5"], dst_receiver="recipient", unwrap_mask="bytearray_to_uint256(rpad(0x20, 32, 0x00))"), + "uniswapV3SwapToWithPermit": dict(samples["unoswap v3-v5"], dst_receiver="recipient", unwrap_mask="bytearray_to_uint256(rpad(0x20, 32, 0x00))"), + }, + }, + "AggregationRouterV6": { + "version": "6", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "optimism", "avalanche_c", "gnosis", "fantom", "base", "zksync"], + "start": "2024-02-12", + "methods": { + "swap": dict(samples["swap"], src_token_amount="output_spentAmount"), + "clipperSwap": dict(samples["clipper"], src_token_address="substr(cast(srcToken as varbinary), 13)", blockchains=["ethereum","bnb","polygon","arbitrum","optimism","avalanche_c","gnosis","fantom","base"]), + "clipperSwapTo": dict(samples["clipper"], src_token_address="substr(cast(srcToken as varbinary), 13)", blockchains=["ethereum","bnb","polygon","arbitrum","optimism","avalanche_c","gnosis","fantom","base"], dst_receiver="recipient"), + "ethUnoswap": dict(samples["unoswap v6"], src_token_address=native, src_token_amount="call_value", pools="array[dex]"), + "ethUnoswap2": dict(samples["unoswap v6"], src_token_address=native, src_token_amount="call_value", pools="array[dex,dex2]"), + "ethUnoswap3": dict(samples["unoswap v6"], src_token_address=native, src_token_amount="call_value", pools="array[dex,dex2,dex3]"), + "ethUnoswapTo": dict(samples["unoswap v6"], src_token_address=native, src_token_amount="call_value", dst_receiver='substr(cast("to" as varbinary), 13)', pools="array[dex]"), + "ethUnoswapTo2": dict(samples["unoswap v6"], src_token_address=native, src_token_amount="call_value", dst_receiver='substr(cast("to" as varbinary), 13)', pools="array[dex,dex2]"), + "ethUnoswapTo3": dict(samples["unoswap v6"], src_token_address=native, src_token_amount="call_value", dst_receiver='substr(cast("to" as varbinary), 13)', pools="array[dex,dex2,dex3]"), + "unoswap": dict(samples["unoswap v6"], pools="array[dex]"), + "unoswap2": dict(samples["unoswap v6"], pools="array[dex,dex2]"), + "unoswap3": dict(samples["unoswap v6"], pools="array[dex,dex2,dex3]"), + "unoswapTo": dict(samples["unoswap v6"], dst_receiver='substr(cast("to" as varbinary), 13)', pools="array[dex]"), + "unoswapTo2": dict(samples["unoswap v6"], dst_receiver='substr(cast("to" as varbinary), 13)', pools="array[dex,dex2]"), + "unoswapTo3": dict(samples["unoswap v6"], dst_receiver='substr(cast("to" as varbinary), 13)', pools="array[dex,dex2,dex3]"), + }, + }, + } +%} + +{{ return(contracts) }} + +{% endmacro %} \ No newline at end of file diff --git a/macros/models/_project/oneinch/AR/oneinch_ar_handle_generic.sql b/dex/macros/models/_project/oneinch/AR/oneinch_ar_handle_generic.sql similarity index 100% rename from macros/models/_project/oneinch/AR/oneinch_ar_handle_generic.sql rename to dex/macros/models/_project/oneinch/AR/oneinch_ar_handle_generic.sql diff --git a/macros/models/_project/oneinch/AR/oneinch_ar_handle_unoswap.sql b/dex/macros/models/_project/oneinch/AR/oneinch_ar_handle_unoswap.sql similarity index 100% rename from macros/models/_project/oneinch/AR/oneinch_ar_handle_unoswap.sql rename to dex/macros/models/_project/oneinch/AR/oneinch_ar_handle_unoswap.sql diff --git a/macros/models/_project/oneinch/AR/oneinch_ar_macro.sql b/dex/macros/models/_project/oneinch/AR/oneinch_ar_macro.sql similarity index 100% rename from macros/models/_project/oneinch/AR/oneinch_ar_macro.sql rename to dex/macros/models/_project/oneinch/AR/oneinch_ar_macro.sql diff --git a/dex/macros/models/_project/oneinch/AR/oneinch_ar_raw_traces_macro.sql b/dex/macros/models/_project/oneinch/AR/oneinch_ar_raw_traces_macro.sql new file mode 100644 index 00000000000..dea86f05bdf --- /dev/null +++ b/dex/macros/models/_project/oneinch/AR/oneinch_ar_raw_traces_macro.sql @@ -0,0 +1,55 @@ +{% macro oneinch_ar_raw_traces_macro( + blockchain + , date_from = '2019-06-01' +)%} + +with decoded_calls as ( + {% for contract, contract_data in oneinch_ar_cfg_contracts_macro().items() if blockchain in contract_data.blockchains %} + {% set outer_loop = loop %} + {% for method, method_data in contract_data.methods.items() if blockchain in method_data.get('blockchains', contract_data.blockchains) %} -- method-level blockchains override contract-level blockchains + select call_tx_hash as tx_hash, call_block_number as block_number, call_trace_address as trace_address, date(call_block_time) as block_date from {{ source('oneinch_' + blockchain, contract + '_call_' + method) }} + {% if is_incremental() %} + where {{ incremental_predicate('call_block_time') }} + {% else %} + where call_block_time >= greatest(timestamp '{{ contract_data['start'] }}', timestamp '{{date_from}}') + {% endif %} + {% if not outer_loop.last or not loop.last %} + union all + {% endif %} + {% endfor %} + {% endfor %} +) + +, traces as ( + select + block_number + , block_time + , tx_hash + , tx_success + , "from" + , "to" + , trace_address + , success + , substr(input, 1, 4) as selector + , gas_used + , call_type + , error + , input + , value + , length(input) as input_length + , output + , block_date + from {{ source(blockchain, 'traces') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} +) + + +select * from traces +join decoded_calls using(tx_hash, block_number, trace_address, block_date) + +{% endmacro %} diff --git a/dex/macros/models/_project/oneinch/LOP/oneinch_lop_cfg_contracts_macro.sql b/dex/macros/models/_project/oneinch/LOP/oneinch_lop_cfg_contracts_macro.sql new file mode 100644 index 00000000000..fb8bd2407d6 --- /dev/null +++ b/dex/macros/models/_project/oneinch/LOP/oneinch_lop_cfg_contracts_macro.sql @@ -0,0 +1,119 @@ +{% macro oneinch_lop_cfg_contracts_macro() %} + +-- METHODS SAMPLES +{% + set samples = { + "v2": { + "maker": "from_hex(order_map['maker'])", + "maker_asset": "from_hex(order_map['makerAsset'])", + "taker_asset": "from_hex(order_map['takerAsset'])", + "making_amount": "output_0", + "taking_amount": "output_1", + }, + "v4": { + "maker": "substr(cast(cast(order_map['maker'] as uint256) as varbinary), 13)", + "receiver": "substr(cast(cast(order_map['receiver'] as uint256) as varbinary), 13)", + "maker_asset": "substr(cast(cast(order_map['makerAsset'] as uint256) as varbinary), 13)", + "taker_asset": "substr(cast(cast(order_map['takerAsset'] as uint256) as varbinary), 13)", + "making_amount": "output_0", + "taking_amount": "output_1", + "order_hash": "output_2", + "order_remains": "varbinary_concat(0x01, substr(cast(cast(order_map['salt'] as uint256) as varbinary), 1, 4))", + "maker_traits": "cast(cast(order_map['makerTraits'] as uint256) as varbinary)", + "partial_bit": "1", + "multiple_bit": "2", + } + } +%} +-- partial_bit & multiple_bit: the number of the bit on the left starting from 1 to 256 in 32 bytes in MakerTraits struct +-- [the number of the bit] = 256 - [solidity offset (~ PARTIAL_FILLS & ~ MULTIPLE_FILLS)] + +-- CONTRACTS CONFIG +{% + set contracts = { + "LimitOrderProtocolV1": { + "version": "1", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "optimism"], + "start": "2021-06-03", + "methods": { + "fillOrder": dict(samples["v2"], maker="substr(from_hex(order_map['makerAssetData']), 4 + 12 + 1, 20)"), + "fillOrderRFQ": dict( + samples["v2"], + maker= "substr(from_hex(order_map['makerAssetData']), 4 + 12 + 1, 20)", + making_amount="bytearray_to_uint256(substr(from_hex(order_map['makerAssetData']), 4 + 32*2 + 1, 32))", + taking_amount="bytearray_to_uint256(substr(from_hex(order_map['takerAssetData']), 4 + 32*2 + 1, 32))", + ), + }, + }, + "LimitOrderProtocolV2": { + "version": "2", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "avalanche_c", "gnosis", "optimism"], + "start": "2021-11-26", + "methods": { + "fillOrder": samples["v2"], + "fillOrderTo": dict(samples["v2"], receiver="from_hex(order_map['receiver'])"), + "fillOrderToWithPermit": dict(samples["v2"], receiver="from_hex(order_map['receiver'])"), + "fillOrderRFQ": samples["v2"], + "fillOrderRFQTo": samples["v2"], + "fillOrderRFQToWithPermit": samples["v2"], + }, + }, + "AggregationRouterV4": { + "version": "2", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "avalanche_c", "gnosis", "optimism", "fantom"], + "start": "2021-11-05", + "methods": { + "fillOrderRFQ": samples["v2"], + "fillOrderRFQTo": samples["v2"], + "fillOrderRFQToWithPermit": samples["v2"], + }, + }, + "AggregationRouterV5": { + "version": "3", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "avalanche_c", "gnosis", "optimism", "fantom", "base", "zksync"], + "start": "2022-11-04", + "methods": { + "fillOrder": dict(samples["v2"], order_hash="output_2"), + "fillOrderTo": dict( + samples["v2"], + order = '"order_"', + making_amount = "output_actualMakingAmount", + taking_amount = "output_actualTakingAmount", + order_hash = "output_orderHash", + receiver = "from_hex(order_map['receiver'])", + ), + "fillOrderToWithPermit": dict(samples["v2"], order_hash="output_2", receiver="from_hex(order_map['receiver'])"), + "fillOrderRFQ": dict(samples["v2"], order_hash="output_2"), + "fillOrderRFQTo": dict( + samples["v2"], + making_amount = "output_filledMakingAmount", + taking_amount = "output_filledTakingAmount", + order_hash = "output_orderHash", + ), + "fillOrderRFQToWithPermit": dict(samples["v2"], order_hash="output_2"), + "fillOrderRFQCompact": dict( + samples["v2"], + making_amount = "output_filledMakingAmount", + taking_amount = "output_filledTakingAmount", + order_hash = "output_orderHash", + ), + }, + }, + "AggregationRouterV6": { + "version": "4", + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "avalanche_c", "gnosis", "optimism", "fantom", "base"], + "start": "2024-02-12", + "methods": { + "fillOrder": samples["v4"], + "fillOrderArgs": dict(samples["v4"], args="args"), + "fillContractOrder": samples["v4"], + "fillContractOrderArgs": samples["v4"], + }, + }, + } +%} + + +{{ return(contracts) }} + +{% endmacro %} \ No newline at end of file diff --git a/dex/macros/models/_project/oneinch/LOP/oneinch_lop_raw_traces_macro.sql b/dex/macros/models/_project/oneinch/LOP/oneinch_lop_raw_traces_macro.sql new file mode 100644 index 00000000000..0e5667d171b --- /dev/null +++ b/dex/macros/models/_project/oneinch/LOP/oneinch_lop_raw_traces_macro.sql @@ -0,0 +1,55 @@ +{% macro oneinch_lop_raw_traces_macro( + blockchain + , date_from = '2021-06-03' +)%} + +with decoded_calls as ( + {% for contract, contract_data in oneinch_lop_cfg_contracts_macro().items() if blockchain in contract_data.blockchains %} + {% set outer_loop = loop %} + {% for method, method_data in contract_data.methods.items() if blockchain in method_data.get('blockchains', contract_data.blockchains) %} -- method-level blockchains override contract-level blockchains + select call_tx_hash as tx_hash, call_block_number as block_number, call_trace_address as trace_address, date(call_block_time) as block_date from {{ source('oneinch_' + blockchain, contract + '_call_' + method) }} + {% if is_incremental() %} + where {{ incremental_predicate('call_block_time') }} + {% else %} + where call_block_time >= greatest(timestamp '{{ contract_data['start'] }}', timestamp '{{date_from}}') + {% endif %} + {% if not outer_loop.last or not loop.last %} + union all + {% endif %} + {% endfor %} + {% endfor %} +) + +, traces as ( + select + block_number + , block_time + , tx_hash + , tx_success + , "from" + , "to" + , trace_address + , success + , substr(input, 1, 4) as selector + , gas_used + , call_type + , error + , input + , value + , length(input) as input_length + , output + , block_date + from {{ source(blockchain, 'traces') }} + where + {% if is_incremental() %} + {{ incremental_predicate('block_time') }} + {% else %} + block_time >= timestamp '{{date_from}}' + {% endif %} +) + + +select * from traces +join decoded_calls using(tx_hash, block_number, trace_address, block_date) + +{% endmacro %} diff --git a/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql b/dex/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql similarity index 100% rename from macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql rename to dex/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql diff --git a/macros/models/_project/oneinch/_meta/oneinch_exposed_blockchains_list.sql b/dex/macros/models/_project/oneinch/_meta/oneinch_exposed_blockchains_list.sql similarity index 100% rename from macros/models/_project/oneinch/_meta/oneinch_exposed_blockchains_list.sql rename to dex/macros/models/_project/oneinch/_meta/oneinch_exposed_blockchains_list.sql diff --git a/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql b/dex/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql similarity index 100% rename from macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql rename to dex/macros/models/_project/oneinch/_meta/oneinch_mapped_contracts_macro.sql diff --git a/macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql b/dex/macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql similarity index 100% rename from macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql rename to dex/macros/models/_project/oneinch/_meta/oneinch_mapped_methods.sql diff --git a/macros/models/_project/oneinch/oneinch_call_transfers_macro.sql b/dex/macros/models/_project/oneinch/oneinch_call_transfers_macro.sql similarity index 100% rename from macros/models/_project/oneinch/oneinch_call_transfers_macro.sql rename to dex/macros/models/_project/oneinch/oneinch_call_transfers_macro.sql diff --git a/macros/models/_project/oneinch/oneinch_calls_macro.sql b/dex/macros/models/_project/oneinch/oneinch_calls_macro.sql similarity index 100% rename from macros/models/_project/oneinch/oneinch_calls_macro.sql rename to dex/macros/models/_project/oneinch/oneinch_calls_macro.sql diff --git a/macros/models/_project/oneinch/oneinch_lop_macro.sql b/dex/macros/models/_project/oneinch/oneinch_lop_macro.sql similarity index 100% rename from macros/models/_project/oneinch/oneinch_lop_macro.sql rename to dex/macros/models/_project/oneinch/oneinch_lop_macro.sql diff --git a/macros/models/_project/oneinch/oneinch_parsed_transfers_from_calls_macro.sql b/dex/macros/models/_project/oneinch/oneinch_parsed_transfers_from_calls_macro.sql similarity index 100% rename from macros/models/_project/oneinch/oneinch_parsed_transfers_from_calls_macro.sql rename to dex/macros/models/_project/oneinch/oneinch_parsed_transfers_from_calls_macro.sql diff --git a/macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_events_macro.sql b/dex/macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_events_macro.sql similarity index 100% rename from macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_events_macro.sql rename to dex/macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_events_macro.sql diff --git a/macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_methods_macro.sql b/dex/macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_methods_macro.sql similarity index 100% rename from macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_methods_macro.sql rename to dex/macros/models/_project/oneinch/project/cfg/oneinch_project_orders_cfg_methods_macro.sql diff --git a/macros/models/_project/oneinch/project/oneinch_project_calls_macro.sql b/dex/macros/models/_project/oneinch/project/oneinch_project_calls_macro.sql similarity index 100% rename from macros/models/_project/oneinch/project/oneinch_project_calls_macro.sql rename to dex/macros/models/_project/oneinch/project/oneinch_project_calls_macro.sql diff --git a/macros/models/_project/oneinch/project/oneinch_project_orders_macro.sql b/dex/macros/models/_project/oneinch/project/oneinch_project_orders_macro.sql similarity index 100% rename from macros/models/_project/oneinch/project/oneinch_project_orders_macro.sql rename to dex/macros/models/_project/oneinch/project/oneinch_project_orders_macro.sql diff --git a/macros/models/_project/oneinch/project/oneinch_project_orders_raw_logs_macro.sql b/dex/macros/models/_project/oneinch/project/oneinch_project_orders_raw_logs_macro.sql similarity index 100% rename from macros/models/_project/oneinch/project/oneinch_project_orders_raw_logs_macro.sql rename to dex/macros/models/_project/oneinch/project/oneinch_project_orders_raw_logs_macro.sql diff --git a/macros/models/_project/oneinch/project/oneinch_project_orders_raw_traces_macro.sql b/dex/macros/models/_project/oneinch/project/oneinch_project_orders_raw_traces_macro.sql similarity index 100% rename from macros/models/_project/oneinch/project/oneinch_project_orders_raw_traces_macro.sql rename to dex/macros/models/_project/oneinch/project/oneinch_project_orders_raw_traces_macro.sql diff --git a/macros/models/_project/oneinch/project/oneinch_project_swaps_macro.sql b/dex/macros/models/_project/oneinch/project/oneinch_project_swaps_macro.sql similarity index 100% rename from macros/models/_project/oneinch/project/oneinch_project_swaps_macro.sql rename to dex/macros/models/_project/oneinch/project/oneinch_project_swaps_macro.sql diff --git a/dex/models/_projects/curvefi/ethereum/_schema.yml b/dex/models/_projects/curvefi/ethereum/_schema.yml index e3ccf87d2e7..3d776f0086e 100644 --- a/dex/models/_projects/curvefi/ethereum/_schema.yml +++ b/dex/models/_projects/curvefi/ethereum/_schema.yml @@ -70,7 +70,7 @@ models: meta: blockchain: ethereum project: curvefi - contributors: [agaperste, yulesa, ilemi] + contributors: [agaperste, yulesa, ilemi, viniabussafi] config: tags: ["ethereum", "curvefi", "view_pools", "view"] description: > diff --git a/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_view_pools.sql b/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_view_pools.sql index d398ad52dc0..31a7c57ca4a 100644 --- a/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_view_pools.sql +++ b/dex/models/_projects/curvefi/ethereum/curvefi_ethereum_view_pools.sql @@ -6,7 +6,7 @@ post_hook='{{ expose_spells(\'["ethereum"]\', "project", "curvefi", - \'["yulesa", "agaperste", "ilemi"]\') }}' + \'["yulesa", "agaperste", "ilemi", "viniabussafi"]\') }}' ) }} @@ -217,9 +217,41 @@ v1_stableswap as ( ) }} dp ON p.call_block_time = dp.evt_block_time AND p.call_tx_hash = dp.evt_tx_hash -) +), + +v1_stableswap_ng as ( + SELECT + 'Factory V1 Stableswap Plain NG' AS version, + dp._name AS name, + dp._symbol AS symbol, + dp.output_0 AS pool_address, + dp._A AS A, + dp._fee AS mid_fee, + dp._fee AS out_fee, + dp.output_0 AS token_address, + dp.output_0 AS deposit_contract, + p.coins[1] AS coin0, + p.coins[2] AS coin1, + COALESCE(try(p.coins[3]),CAST(NULL as varbinary)) as coin2, + COALESCE(try(p.coins[4]),CAST(NULL as varbinary)) as coin3, + CAST(NULL as varbinary) AS undercoin0, + CAST(NULL as varbinary) AS undercoin1, + CAST(NULL as varbinary) AS undercoin2, + CAST(NULL as varbinary) AS undercoin3 + FROM + {{ source( + 'curvefi_ethereum', + 'CurveStableswapFactoryNG_evt_PlainPoolDeployed' + ) }} as p + LEFT JOIN {{ source( + 'curvefi_ethereum', + 'CurveStableswapFactoryNG_call_deploy_plain_pool' + ) }} dp + ON dp.call_block_time = p.evt_block_time + AND dp.call_tx_hash = p.evt_tx_hash +), -, v1_pools_deployed AS ( +v1_pools_deployed AS ( SELECT version, name, @@ -282,6 +314,27 @@ v1_stableswap as ( undercoin3 FROM v1_stableswap + UNION ALL + SELECT + version, + name, + symbol, + pool_address, + A, + mid_fee, + out_fee, + token_address, + deposit_contract, + coin0, + coin1, + coin2, + coin3, + undercoin0, + undercoin1, + undercoin2, + undercoin3 + FROM + v1_stableswap_ng ), ---------------------------------------------------------------- V2 Pools ---------------------------------------------------------------- v2_pools_deployed AS ( diff --git a/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_ar_raw_traces.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_ar_raw_traces.sql new file mode 100644 index 00000000000..4e057128c66 --- /dev/null +++ b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'arbitrum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_lop_raw_traces.sql b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_lop_raw_traces.sql new file mode 100644 index 00000000000..d72642d91db --- /dev/null +++ b/dex/models/_projects/oneinch/arbitrum/oneinch_arbitrum_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'arbitrum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_ar_raw_traces.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_ar_raw_traces.sql new file mode 100644 index 00000000000..1fc8df967e6 --- /dev/null +++ b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'avalanche_c' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_lop_raw_traces.sql b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_lop_raw_traces.sql new file mode 100644 index 00000000000..ab6678560c3 --- /dev/null +++ b/dex/models/_projects/oneinch/avalanche_c/oneinch_avalanche_c_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'avalanche_c' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/base/oneinch_base_ar_raw_traces.sql b/dex/models/_projects/oneinch/base/oneinch_base_ar_raw_traces.sql new file mode 100644 index 00000000000..9d33ba381b2 --- /dev/null +++ b/dex/models/_projects/oneinch/base/oneinch_base_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'base' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/base/oneinch_base_lop_raw_traces.sql b/dex/models/_projects/oneinch/base/oneinch_base_lop_raw_traces.sql new file mode 100644 index 00000000000..77722c0a205 --- /dev/null +++ b/dex/models/_projects/oneinch/base/oneinch_base_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'base' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/bnb/oneinch_bnb_ar_raw_traces.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_ar_raw_traces.sql new file mode 100644 index 00000000000..eee54e8d557 --- /dev/null +++ b/dex/models/_projects/oneinch/bnb/oneinch_bnb_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'bnb' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/bnb/oneinch_bnb_lop_raw_traces.sql b/dex/models/_projects/oneinch/bnb/oneinch_bnb_lop_raw_traces.sql new file mode 100644 index 00000000000..007d7d09682 --- /dev/null +++ b/dex/models/_projects/oneinch/bnb/oneinch_bnb_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'bnb' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_ar_raw_traces.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_ar_raw_traces.sql new file mode 100644 index 00000000000..fa8aefb54a0 --- /dev/null +++ b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'ethereum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_lop_raw_traces.sql b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_lop_raw_traces.sql new file mode 100644 index 00000000000..a38e0e1ecfa --- /dev/null +++ b/dex/models/_projects/oneinch/ethereum/oneinch_ethereum_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'ethereum' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/fantom/oneinch_fantom_ar_raw_traces.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_ar_raw_traces.sql new file mode 100644 index 00000000000..04f01f6d9b6 --- /dev/null +++ b/dex/models/_projects/oneinch/fantom/oneinch_fantom_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'fantom' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/fantom/oneinch_fantom_lop_raw_traces.sql b/dex/models/_projects/oneinch/fantom/oneinch_fantom_lop_raw_traces.sql new file mode 100644 index 00000000000..076d785ec6b --- /dev/null +++ b/dex/models/_projects/oneinch/fantom/oneinch_fantom_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'fantom' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_ar_raw_traces.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_ar_raw_traces.sql new file mode 100644 index 00000000000..dfb714c48a4 --- /dev/null +++ b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'gnosis' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_lop_raw_traces.sql b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_lop_raw_traces.sql new file mode 100644 index 00000000000..e409b9f6909 --- /dev/null +++ b/dex/models/_projects/oneinch/gnosis/oneinch_gnosis_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'gnosis' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/optimism/oneinch_optimism_ar_raw_traces.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_ar_raw_traces.sql new file mode 100644 index 00000000000..50075932627 --- /dev/null +++ b/dex/models/_projects/oneinch/optimism/oneinch_optimism_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'optimism' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/optimism/oneinch_optimism_lop_raw_traces.sql b/dex/models/_projects/oneinch/optimism/oneinch_optimism_lop_raw_traces.sql new file mode 100644 index 00000000000..84ae1797ac9 --- /dev/null +++ b/dex/models/_projects/oneinch/optimism/oneinch_optimism_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'optimism' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/polygon/oneinch_polygon_ar_raw_traces.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_ar_raw_traces.sql new file mode 100644 index 00000000000..d6ff1755542 --- /dev/null +++ b/dex/models/_projects/oneinch/polygon/oneinch_polygon_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'polygon' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/polygon/oneinch_polygon_lop_raw_traces.sql b/dex/models/_projects/oneinch/polygon/oneinch_polygon_lop_raw_traces.sql new file mode 100644 index 00000000000..aad3483796f --- /dev/null +++ b/dex/models/_projects/oneinch/polygon/oneinch_polygon_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'polygon' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/zksync/oneinch_zksync_ar_raw_traces.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_ar_raw_traces.sql new file mode 100644 index 00000000000..f3a54916c59 --- /dev/null +++ b/dex/models/_projects/oneinch/zksync/oneinch_zksync_ar_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'zksync' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'ar_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_ar_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/oneinch/zksync/oneinch_zksync_lop_raw_traces.sql b/dex/models/_projects/oneinch/zksync/oneinch_zksync_lop_raw_traces.sql new file mode 100644 index 00000000000..cbcc04701dd --- /dev/null +++ b/dex/models/_projects/oneinch/zksync/oneinch_zksync_lop_raw_traces.sql @@ -0,0 +1,24 @@ +{% set blockchain = 'zksync' %} + + + +{{ + config( + schema = 'oneinch_' + blockchain, + alias = 'lop_raw_traces', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['tx_hash', 'trace_address', 'block_date'] + ) +}} + + + +{{ + oneinch_lop_raw_traces_macro( + blockchain = blockchain + ) +}} diff --git a/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills.sql b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills.sql index a8d101a01e2..814f58dca9c 100644 --- a/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills.sql +++ b/dex/models/_projects/zeroex/ethereum/zeroex_ethereum_api_fills.sql @@ -17,14 +17,19 @@ -- Test Query here: https://dune.com/queries/1330551 WITH zeroex_tx AS ( SELECT tx_hash, - max(affiliate_address) as affiliate_address + block_time as block_time, + max(affiliate_address) as affiliate_address, + max(is_gasless) as is_gasless FROM ( SELECT v3.evt_tx_hash AS tx_hash, CASE WHEN takerAddress = 0x63305728359c088a52b0b0eeec235db4d31a67fc THEN takerAddress ELSE NULL - END AS affiliate_address + END AS affiliate_address, + null as is_gasless, + evt_block_time as block_time + FROM {{ source('zeroex_v3_ethereum', 'Exchange_evt_Fill') }} v3 WHERE ( -- nuo v3.takerAddress = 0x63305728359c088a52b0b0eeec235db4d31a67fc @@ -51,7 +56,9 @@ WITH zeroex_tx AS ( WHEN bytearray_position(INPUT, 0xfbc019a7) <> 0 THEN SUBSTRING(INPUT FROM (bytearray_position(INPUT, 0xfbc019a7 ) + 16) FOR 20) - END AS affiliate_address + END AS affiliate_address, + case when (varbinary_position(input,0x3d8d4082) <> 0 or varbinary_position(input,0x4f948110) <> 0 ) then 1 end as is_gasless, + block_time FROM {{ source('ethereum', 'traces') }} tr WHERE tr.to IN ( -- exchange contract @@ -75,7 +82,7 @@ WITH zeroex_tx AS ( AND block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} ) temp - group by tx_hash + group by tx_hash, block_time ), v3_fills_no_bridge AS ( @@ -93,9 +100,10 @@ v3_fills_no_bridge AS ( 'Fill' AS type, COALESCE(zeroex_tx.affiliate_address, fills.feeRecipientAddress) AS affiliate_address, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - (fills.feeRecipientAddress = 0x86003b044f70dac0abc80ac8957305b6370893ed) AS matcha_limit_order_flag + (fills.feeRecipientAddress = 0x86003b044f70dac0abc80ac8957305b6370893ed) AS matcha_limit_order_flag, + is_gasless FROM {{ source('zeroex_v3_ethereum', 'Exchange_evt_Fill') }} fills - LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash + INNER JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash and fills.evt_block_time = zeroex_tx.block_time WHERE (bytearray_substring(makerAssetData, 1, 4) <> 0xdc1600f3) AND (zeroex_tx.tx_hash IS NOT NULL OR fills.feeRecipientAddress = 0x86003b044f70dac0abc80ac8957305b6370893ed) @@ -123,9 +131,10 @@ v4_rfq_fills_no_bridge AS ( 'RfqOrderFilled' AS type, zeroex_tx.affiliate_address AS affiliate_address, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_RfqOrderFilled') }} fills - LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash + LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash and fills.evt_block_time = zeroex_tx.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('evt_block_time') }} @@ -151,9 +160,10 @@ v4_limit_fills_no_bridge AS ( (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, (fills.feeRecipient in (0x9b858be6e3047d88820f439b240deac2418a2551,0x86003b044f70dac0abc80ac8957305b6370893ed,0x5bc2419a087666148bfbe1361ae6c06d240c6131)) - AS matcha_limit_order_flag + AS matcha_limit_order_flag, + is_gasless FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_LimitOrderFilled') }} fills - LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash + LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash and fills.evt_block_time = zeroex_tx.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('evt_block_time') }} @@ -169,7 +179,7 @@ otc_fills AS ( fills.contract_address, fills.evt_block_time AS block_time, fills.maker AS maker, - fills.taker AS taker, + 0xdef1c0ded9bec7f1a1670819833240f027b25eff AS taker, fills.takerToken AS taker_token, fills.makerToken AS maker_token, cast(fills.takerTokenFilledAmount as int256) AS taker_token_amount_raw, @@ -177,9 +187,10 @@ otc_fills AS ( 'OtcOrderFilled' AS type, zeroex_tx.affiliate_address AS affiliate_address, (zeroex_tx.tx_hash IS NOT NULL) AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_OtcOrderFilled') }} fills - LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash + LEFT JOIN zeroex_tx ON zeroex_tx.tx_hash = fills.evt_tx_hash and fills.evt_block_time = zeroex_tx.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('evt_block_time') }} @@ -194,7 +205,7 @@ ERC20BridgeTransfer AS ( logs.tx_hash, INDEX AS evt_index, logs.contract_address, - block_time AS block_time, + logs.block_time AS block_time, bytearray_substring(DATA, 141, 20) AS maker, bytearray_substring(DATA, 173, 20) AS taker, bytearray_substring(DATA, 13, 20) AS taker_token, @@ -204,16 +215,17 @@ ERC20BridgeTransfer AS ( 'ERC20BridgeTransfer' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('ethereum', 'logs') }} logs - JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash + JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash and logs.block_time = zeroex_tx.block_time WHERE topic0 = 0x349fc08071558d8e3aa92dec9396e4e9f2dfecd6bb9065759d1932e7da43b8a9 {% if is_incremental() %} - AND {{ incremental_predicate('block_time') }} + AND {{ incremental_predicate('logs.block_time') }} {% endif %} {% if not is_incremental() %} - AND block_time >= cast('{{zeroex_v3_start_date}}' as date) + AND logs.block_time >= cast('{{zeroex_v3_start_date}}' as date) {% endif %} ), @@ -222,7 +234,7 @@ BridgeFill AS ( logs.tx_hash, INDEX AS evt_index, logs.contract_address, - block_time AS block_time, + logs.block_time AS block_time, bytearray_substring(DATA, 13, 20) AS maker, 0xdef1c0ded9bec7f1a1670819833240f027b25eff AS taker, bytearray_substring(DATA, 45, 20) AS taker_token, @@ -232,17 +244,18 @@ BridgeFill AS ( 'BridgeFill' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('ethereum', 'logs') }} logs - JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash + JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash and logs.block_time = zeroex_tx.block_time WHERE topic0 = 0xff3bc5e46464411f331d1b093e1587d2d1aa667f5618f98a95afc4132709d3a9 AND contract_address = 0x22f9dcf4647084d6c31b2765f6910cd85c178c18 {% if is_incremental() %} - AND {{ incremental_predicate('block_time') }} + AND {{ incremental_predicate('logs.block_time') }} {% endif %} {% if not is_incremental() %} - AND block_time >= cast('{{zeroex_v4_start_date}}' as date) + AND logs.block_time >= cast('{{zeroex_v4_start_date}}' as date) {% endif %} ), NewBridgeFill AS ( @@ -250,7 +263,7 @@ NewBridgeFill AS ( logs.tx_hash, INDEX AS evt_index, logs.contract_address, - block_time AS block_time, + logs.block_time AS block_time, bytearray_substring(DATA, 13, 20) AS maker, 0xdef1c0ded9bec7f1a1670819833240f027b25eff AS taker, bytearray_substring(DATA, 45, 20) AS taker_token, @@ -260,17 +273,18 @@ NewBridgeFill AS ( 'NewBridgeFill' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('ethereum' ,'logs') }} logs - JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash + JOIN zeroex_tx ON zeroex_tx.tx_hash = logs.tx_hash and logs.block_time = zeroex_tx.block_time WHERE topic0 = 0xe59e71a14fe90157eedc866c4f8c767d3943d6b6b2e8cd64dddcc92ab4c55af8 AND contract_address = 0x22f9dcf4647084d6c31b2765f6910cd85c178c18 {% if is_incremental() %} - AND {{ incremental_predicate('block_time') }} + AND {{ incremental_predicate('logs.block_time') }} {% endif %} {% if not is_incremental() %} - AND block_time >= cast('{{zeroex_v4_start_date}}' as date) + AND logs.block_time >= cast('{{zeroex_v4_start_date}}' as date) {% endif %} ), direct_PLP AS ( @@ -288,9 +302,10 @@ direct_PLP AS ( 'LiquidityProviderSwap' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('zeroex_ethereum', 'ExchangeProxy_evt_LiquidityProviderSwap') }} plp - JOIN zeroex_tx ON zeroex_tx.tx_hash = plp.evt_tx_hash + JOIN zeroex_tx ON zeroex_tx.tx_hash = plp.evt_tx_hash and plp.evt_block_time = zeroex_tx.block_time {% if is_incremental() %} WHERE {{ incremental_predicate('evt_block_time') }} @@ -307,7 +322,7 @@ direct_uniswapv2 AS ( swap.contract_address, swap.evt_block_time AS block_time, swap.contract_address AS maker, - LAST_VALUE(swap.to) OVER ( PARTITION BY swap.evt_tx_hash ORDER BY swap.evt_index) AS taker, + 0xdef1c0ded9bec7f1a1670819833240f027b25eff as taker, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token0 ELSE pair.token1 END AS taker_token, CASE WHEN swap.amount0In > swap.amount0Out THEN pair.token1 ELSE pair.token0 END AS maker_token, CASE WHEN swap.amount0In > swap.amount0Out THEN @@ -319,10 +334,11 @@ direct_uniswapv2 AS ( 'Uniswap V2 Direct' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('uniswap_v2_ethereum', 'Pair_evt_Swap') }} swap LEFT JOIN {{ source('uniswap_v2_ethereum', 'Factory_evt_PairCreated') }} pair ON pair.pair = swap.contract_address - JOIN zeroex_tx ON zeroex_tx.tx_hash = swap.evt_tx_hash + JOIN zeroex_tx ON zeroex_tx.tx_hash = swap.evt_tx_hash and swap.evt_block_time = zeroex_tx.block_time WHERE sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} @@ -353,10 +369,11 @@ direct_sushiswap AS ( 'Sushiswap Direct' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('sushi_ethereum', 'Pair_evt_Swap') }} swap LEFT JOIN {{ source('sushi_ethereum', 'Factory_evt_PairCreated') }} pair ON pair.pair = swap.contract_address - JOIN zeroex_tx ON zeroex_tx.tx_hash = swap.evt_tx_hash + JOIN zeroex_tx ON zeroex_tx.tx_hash = swap.evt_tx_hash and swap.evt_block_time = zeroex_tx.block_time WHERE sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} @@ -373,7 +390,7 @@ direct_uniswapv3 AS ( swap.contract_address, swap.evt_block_time AS block_time, swap.contract_address AS maker, - LAST_VALUE(swap.recipient) OVER (PARTITION BY swap.evt_tx_hash ORDER BY swap.evt_index) AS taker, + 0xdef1c0ded9bec7f1a1670819833240f027b25eff as taker, CASE WHEN amount0 < cast(0 as int256) THEN pair.token1 ELSE pair.token0 END AS taker_token, CASE WHEN amount0 < cast(0 as int256) THEN pair.token0 ELSE pair.token1 END AS maker_token, CASE WHEN amount0 < cast(0 as int256) THEN ABS(swap.amount1) ELSE ABS(swap.amount0) END AS taker_token_amount_raw, @@ -381,10 +398,11 @@ direct_uniswapv3 AS ( 'Uniswap V3 Direct' AS type, zeroex_tx.affiliate_address AS affiliate_address, TRUE AS swap_flag, - FALSE AS matcha_limit_order_flag + FALSE AS matcha_limit_order_flag, + is_gasless FROM {{ source('uniswap_v3_ethereum', 'Pair_evt_Swap') }} swap LEFT JOIN {{ source('uniswap_v3_ethereum', 'Factory_evt_PoolCreated') }} pair ON pair.pool = swap.contract_address - JOIN zeroex_tx ON zeroex_tx.tx_hash = swap.evt_tx_hash + JOIN zeroex_tx ON zeroex_tx.tx_hash = swap.evt_tx_hash and swap.evt_block_time = zeroex_tx.block_time WHERE sender = 0xdef1c0ded9bec7f1a1670819833240f027b25eff {% if is_incremental() %} @@ -429,10 +447,14 @@ SELECT cast(date_trunc('day', all_tx.block_time) AS date) AS block_date, cast(date_trunc('month', all_tx.block_time) AS date) AS block_month, maker, - CASE + CASE + when is_gasless = 1 and varbinary_position (data, 0x3a46c4e1) <> 0 then varbinary_substring(data,81,20) + when is_gasless = 1 and varbinary_position (data, 0xa98fcbf1) <> 0 then varbinary_substring(data,81,20) + when is_gasless = 1 and varbinary_position (data, 0x3d8d4082) <> 0 then varbinary_substring(data,177,20) + WHEN taker = 0xdef1c0ded9bec7f1a1670819833240f027b25eff THEN tx."from" ELSE taker - END AS taker, -- fix the user masked by ProxyContract issue + END AS taker, -- fix the user masked by ProxyContract issue taker_token, ts.symbol AS taker_symbol, maker_token, @@ -458,7 +480,7 @@ SELECT tx.to AS tx_to, 'ethereum' AS blockchain FROM all_tx -INNER JOIN {{ source('ethereum', 'transactions')}} tx ON all_tx.tx_hash = tx.hash +INNER JOIN {{ source('ethereum', 'transactions')}} tx ON all_tx.tx_hash = tx.hash and all_tx.block_time = tx.block_time {% if is_incremental() %} AND {{ incremental_predicate('tx.block_time') }} diff --git a/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv b/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv index e312657462f..d417857f25e 100644 --- a/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv +++ b/dex/seeds/_project/zeroex/ethereum/zeroex_ethereum_api_fills_sample.csv @@ -1,6 +1,6 @@ tx_hash,block_number,evt_index,contract_address,block_time,maker,taker,taker_token,taker_symbol,maker_token,maker_symbol,token_pair,taker_token_amount,taker_token_amount_raw,maker_token_amount,maker_token_amount_raw,type,affiliate_address,swap_flag,matcha_limit_order_flag,volume_usd,tx_from,tx_to 0x4ad0da0192cf45284124b5a480fafed17f89e5474412dedf03cac86bfab980db,16068182,101,0x1d42064fc4beb5f8aaf85f4617ae8b3b5b8bd801,2022-11-28 11:27,0x1d42064fc4beb5f8aaf85f4617ae8b3b5b8bd801,0xd3a8813e58d29e4b9c126bd80ebae12a415b3e55,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,0x1f9840a85d5af5bf1d1762f925bdaddc4201f984,UNI,UNI-WETH,7.52817337639159,7.52817337639159E18,1667.3526432935869,1.667352643293587E21,Uniswap V3 Direct,0x720c9244473dfc596547c1f7b6261c7112a3dad4,true,false,8831.60131478003,0xd3a8813e58d29e4b9c126bd80ebae12a415b3e55,0xdef1c0ded9bec7f1a1670819833240f027b25eff -0xa845cd2100974c5ce76c1cca48cfedfda34be5492c94be7966df349e20c48603,16067759,200,0x60594a405d53811d3bc4766596efd80fd545a270,2022-11-28 10:02,0x60594a405d53811d3bc4766596efd80fd545a270,0x22af4edbea3de885dda8f0a0653e6209e44e5b84,0x6b175474e89094c44da98b954eedeac495271d0f,DAI,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,DAI-WETH,1022.852454202423,1.022852454202423E21,0.8755322100479512,8.755322100479512E17,Uniswap V3 Direct,0x76eb574eff49fb64de6f7f2854952b05b5e24624,true,false,1027.4808251017732,0xbb3e845803cdc3cd05f2bacfce6a4234e8be1c6d,0x22af4edbea3de885dda8f0a0653e6209e44e5b84 +0xa845cd2100974c5ce76c1cca48cfedfda34be5492c94be7966df349e20c48603,16067759,200,0x60594a405d53811d3bc4766596efd80fd545a270,2022-11-28 10:02,0x60594a405d53811d3bc4766596efd80fd545a270,0xbb3e845803cdc3cd05f2bacfce6a4234e8be1c6d,0x6b175474e89094c44da98b954eedeac495271d0f,DAI,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,DAI-WETH,1022.852454202423,1.022852454202423E21,0.8755322100479512,8.755322100479512E17,Uniswap V3 Direct,0x76eb574eff49fb64de6f7f2854952b05b5e24624,true,false,1027.4808251017732,0xbb3e845803cdc3cd05f2bacfce6a4234e8be1c6d,0x22af4edbea3de885dda8f0a0653e6209e44e5b84 0xef33a60d5597181c3dcf000a03f3ba45b346c8f1aae58f2ef5f250e09ed2ae51,16069382,57,0x9b3df8eae6e1ed1b931086852860d3c6375d7ae6,2022-11-28 15:28,0x9b3df8eae6e1ed1b931086852860d3c6375d7ae6,0xd54e4f8a55247487dd7c8c59f14ee5c0c2889477,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,0x9506d37f70eb4c3d79c398d326c871abbf10521d,MLT,MLT-WETH,1,1.0E18,11485.020981534948,1.1485020981534948E22,Uniswap V2 Direct,0x1000000000000000000000000000000000000011,true,false,1164.85,0xd54e4f8a55247487dd7c8c59f14ee5c0c2889477,0xdef1c0ded9bec7f1a1670819833240f027b25eff -0x9d6b701fa7f755f4955ebf6f93f0799eb0ddd8ea623990abe22547fb36a35127,16069834,262,0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc,2022-11-28 16:58,0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc,0xf7d31825946e7fd99ef07212d34b9dad84c396b7,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,USDC,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,USDC-WETH,1000,1.0E9,0.8449085166929248,8.449085166929248E17,Uniswap V2 Direct,0x86003b044f70dac0abc80ac8957305b6370893ed,true,false,987.1657636485124,0x0c55b13cec1df9a2acac90d16e80105fc3207344,0xdef1c0ded9bec7f1a1670819833240f027b25eff -0x3da1c0eff23744e81455262c5504fe8f706b8808c48892ca54878379f4a6417e,16070077,92,0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852,2022-11-28 17:47,0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852,0xd9999f7f26af362207807be9d78daf2c9caacda2,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,0xdac17f958d2ee523a2206206994597c13d831ec7,USDT,USDT-WETH,0.015967335297063744,1.5967335297063744E16,18.757089,1.8757089E7,Uniswap V2 Direct,0x382ffce2287252f930e1c8dc9328dac5bf282ba1,true,false,18.713628824787,0xb9d8bdba0f6149beb3f479a2628947836ef387bc,0xe66b31678d6c16e9ebf358268a790b763c133750 \ No newline at end of file +0x9d6b701fa7f755f4955ebf6f93f0799eb0ddd8ea623990abe22547fb36a35127,16069834,262,0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc,2022-11-28 16:58,0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc,0x0c55b13cec1df9a2acac90d16e80105fc3207344,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,USDC,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,USDC-WETH,1000,1.0E9,0.8449085166929248,8.449085166929248E17,Uniswap V2 Direct,0x86003b044f70dac0abc80ac8957305b6370893ed,true,false,987.1657636485124,0x0c55b13cec1df9a2acac90d16e80105fc3207344,0xdef1c0ded9bec7f1a1670819833240f027b25eff +0x3da1c0eff23744e81455262c5504fe8f706b8808c48892ca54878379f4a6417e,16070077,92,0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852,2022-11-28 17:47,0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852,0xb9d8bdba0f6149beb3f479a2628947836ef387bc,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,WETH,0xdac17f958d2ee523a2206206994597c13d831ec7,USDT,USDT-WETH,0.015967335297063744,1.5967335297063744E16,18.757089,1.8757089E7,Uniswap V2 Direct,0x382ffce2287252f930e1c8dc9328dac5bf282ba1,true,false,18.713628824787,0xb9d8bdba0f6149beb3f479a2628947836ef387bc,0xe66b31678d6c16e9ebf358268a790b763c133750 \ No newline at end of file diff --git a/models/_sector/referral/rewards/referral_rewards.sql b/models/_sector/referral/rewards/referral_rewards.sql index 3c20c9a4db5..a5de9089ef1 100644 --- a/models/_sector/referral/rewards/referral_rewards.sql +++ b/models/_sector/referral/rewards/referral_rewards.sql @@ -1,5 +1,4 @@ {{ config( - tags = ['prod_exclude'], schema = 'referral', alias = 'rewards', partition_by = ['blockchain','project','block_month'], diff --git a/models/_sector/tokens/blast/_schema.yml b/models/_sector/tokens/blast/_schema.yml new file mode 100644 index 00000000000..6e80a23498b --- /dev/null +++ b/models/_sector/tokens/blast/_schema.yml @@ -0,0 +1,106 @@ +version: 2 + +models: + - name: tokens_blast_base_transfers + meta: + blockchain: blast + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'blast'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: amount_raw + description: "The raw amount of the transfer" + + - name: tokens_blast_transfers + meta: + blockchain: blast + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'blast'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: symbol + description: "The token symbol transferred" + - name: amount_raw + description: "The raw amount of the transfer" + - name: amount + description: "The formatted amount of the transfer" + - name: price_usd + description: "The USD price used to calculate the amount_usd" + - name: amount_usd + description: "The USD amount of the transfer" \ No newline at end of file diff --git a/models/_sector/tokens/blast/tokens_blast_base_transfers.sql b/models/_sector/tokens/blast/tokens_blast_base_transfers.sql new file mode 100644 index 00000000000..c25bd007405 --- /dev/null +++ b/models/_sector/tokens/blast/tokens_blast_base_transfers.sql @@ -0,0 +1,20 @@ +{{config( + schema = 'tokens_blast', + alias = 'base_transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['block_date','unique_key'], +) +}} + +{{transfers_base( + blockchain='blast', + traces = source('blast','traces'), + transactions = source('blast','transactions'), + erc20_transfers = source('erc20_blast','evt_transfer'), + native_contract_address = null +) +}} diff --git a/models/_sector/tokens/blast/tokens_blast_transfers.sql b/models/_sector/tokens/blast/tokens_blast_transfers.sql new file mode 100644 index 00000000000..0f85fc3bf16 --- /dev/null +++ b/models/_sector/tokens/blast/tokens_blast_transfers.sql @@ -0,0 +1,26 @@ +{{config( + schema = 'tokens_blast', + alias = 'transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date','unique_key'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], + post_hook='{{ expose_spells(\'["blast"]\', + "sector", + "tokens", + \'["aalan3", "jeff-dude", "hildobby"]\') }}' +) +}} + +{{ + transfers_enrich( + base_transfers = ref('tokens_blast_base_transfers') + , tokens_erc20_model = source('tokens', 'erc20') + , prices_model = source('prices', 'usd') + , evms_info_model = ref('evms_info') + , transfers_start_date = '2020-04-22' + , blockchain = 'blast' + ) +}} \ No newline at end of file diff --git a/models/_sector/tokens/mantle/_schema.yml b/models/_sector/tokens/mantle/_schema.yml new file mode 100644 index 00000000000..3abf40f6f1f --- /dev/null +++ b/models/_sector/tokens/mantle/_schema.yml @@ -0,0 +1,106 @@ +version: 2 + +models: + - name: tokens_mantle_base_transfers + meta: + blockchain: mantle + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'mantle'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: amount_raw + description: "The raw amount of the transfer" + + - name: tokens_mantle_transfers + meta: + blockchain: mantle + sector: tokens + contributors: aalan3, jeff-dude, hildobby + config: + tags: ['tokens','transfers', 'mantle'] + description: > + Token transfers + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - unique_key + columns: + - name: unique_key + description: "Surrogate key to identify unique row" + - name: blockchain + description: "The blockchain of the transfers" + - name: block_date + description: "The date of the block" + - name: block_time + description: "The time of the block" + - name: block_number + description: "The block number" + - name: tx_hash + description: "The transaction hash" + - name: evt_index + description: "The log event index of the transfer if any" + - name: trace_address + description: "The trace address of the transfer if any" + - name: token_standard + description: "The token standard of the transfer" + - name: tx_from + description: "The transaction sender" + - name: tx_to + description: "The transaction receiver" + - name: tx_index + description: "The transaction index" + - name: from + description: "The sender of the transfer" + - name: to + description: "The receiver of the transfer" + - name: contract_address + description: "The contract address of the transfer" + - name: symbol + description: "The token symbol transferred" + - name: amount_raw + description: "The raw amount of the transfer" + - name: amount + description: "The formatted amount of the transfer" + - name: price_usd + description: "The USD price used to calculate the amount_usd" + - name: amount_usd + description: "The USD amount of the transfer" \ No newline at end of file diff --git a/models/_sector/tokens/mantle/tokens_mantle_base_transfers.sql b/models/_sector/tokens/mantle/tokens_mantle_base_transfers.sql new file mode 100644 index 00000000000..37ec8818a7f --- /dev/null +++ b/models/_sector/tokens/mantle/tokens_mantle_base_transfers.sql @@ -0,0 +1,20 @@ +{{config( + schema = 'tokens_mantle', + alias = 'base_transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + unique_key = ['block_date','unique_key'], +) +}} + +{{transfers_base( + blockchain='mantle', + traces = source('mantle','traces'), + transactions = source('mantle','transactions'), + erc20_transfers = source('erc20_mantle','evt_transfer'), + native_contract_address = null +) +}} diff --git a/models/_sector/tokens/mantle/tokens_mantle_transfers.sql b/models/_sector/tokens/mantle/tokens_mantle_transfers.sql new file mode 100644 index 00000000000..00313a8e899 --- /dev/null +++ b/models/_sector/tokens/mantle/tokens_mantle_transfers.sql @@ -0,0 +1,26 @@ +{{config( + schema = 'tokens_mantle', + alias = 'transfers', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date','unique_key'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], + post_hook='{{ expose_spells(\'["mantle"]\', + "sector", + "tokens", + \'["aalan3", "jeff-dude", "hildobby"]\') }}' +) +}} + +{{ + transfers_enrich( + base_transfers = ref('tokens_mantle_base_transfers') + , tokens_erc20_model = source('tokens', 'erc20') + , prices_model = source('prices', 'usd') + , evms_info_model = ref('evms_info') + , transfers_start_date = '2020-04-22' + , blockchain = 'mantle' + ) +}} \ No newline at end of file diff --git a/models/_sector/tokens/tokens_transfers.sql b/models/_sector/tokens/tokens_transfers.sql index 31b48c395b9..d5e32baeead 100644 --- a/models/_sector/tokens/tokens_transfers.sql +++ b/models/_sector/tokens/tokens_transfers.sql @@ -20,6 +20,8 @@ ,'scroll' ,'zkevm' ,'linea' + ,'mantle' + ,'blast' ] %} SELECT * diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_batches.sql b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_batches.sql new file mode 100644 index 00000000000..24679ceaacb --- /dev/null +++ b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_batches.sql @@ -0,0 +1,125 @@ +{{ config( + schema = 'cow_protocol_arbitrum', + alias = 'batches', + materialized='incremental', + partition_by = ['block_date'], + unique_key = ['tx_hash'], + on_schema_change='sync_all_columns', + file_format ='delta', + incremental_strategy='merge', + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], + post_hook='{{ expose_spells(blockchains = \'["arbitrum"]\', + spell_type = "project", + spell_name = "cow_protocol", + contributors = \'["olgafetisova"]\') }}' + ) +}} + +WITH +-- Find the PoC Query here: https://dune.com/queries/3840594 +solver_activation_events AS ( + SELECT + solver, + evt_block_number, + evt_index, + TRUE AS activated + FROM {{ source('gnosis_protocol_v2_arbitrum', 'GPv2AllowListAuthentication_evt_SolverAdded') }} + UNION + SELECT + solver, + evt_block_number, + evt_index, + FALSE AS activated + FROM {{ source('gnosis_protocol_v2_arbitrum', 'GPv2AllowListAuthentication_evt_SolverRemoved') }} + ), + ranked_solver_events as ( + select + rank() over (partition by solver order by evt_block_number desc, evt_index desc) as rk, + solver, + evt_block_number, + evt_index, + activated as active + from solver_activation_events +), +registered_solvers as ( + select solver as address, active + from ranked_solver_events + where rk = 1 +), +batch_counts as ( + select try_cast(date_trunc('day', s.evt_block_time) as date) as block_date, + s.evt_block_time, + s.evt_tx_hash, + solver, + sum( + case + when selector != 0x2e1a7d4d -- unwrap + and selector != 0x095ea7b3 -- approval + then 1 + else 0 + end) as dex_swaps, + sum(case when selector = 0x2e1a7d4d then 1 else 0 end) as unwraps, + sum(case when selector = 0x095ea7b3 then 1 else 0 end) as token_approvals + from {{ source('gnosis_protocol_v2_arbitrum', 'GPv2Settlement_evt_Settlement') }} s + left outer join {{ source('gnosis_protocol_v2_arbitrum', 'GPv2Settlement_evt_Interaction') }} i + on i.evt_tx_hash = s.evt_tx_hash + {% if is_incremental() %} + AND {{ incremental_predicate('i.evt_block_time') }} + {% endif %} + join registered_solvers + on solver = address + {% if is_incremental() %} + WHERE {{ incremental_predicate('s.evt_block_time') }} + {% endif %} + group by s.evt_tx_hash, solver, s.evt_block_time +), + +batch_values as ( + select + tx_hash, + count(*) as num_trades, + sum(usd_value) as batch_value, + sum(fee_usd) as fee_value, + price as eth_price + from {{ source('cow_protocol_arbitrum', 'trades') }} + left outer join {{ source('prices', 'usd') }} as p + on p.contract_address = 0x82af49447d8a07e3bd95bd0d56f35241523fbab1 + {% if is_incremental() %} + and {{ incremental_predicate('minute') }} + {% endif %} + and p.minute = date_trunc('minute', block_time) + and blockchain = 'arbitrum' + {% if is_incremental() %} + WHERE {{ incremental_predicate('block_time') }} + {% endif %} + group by tx_hash, price +), + +combined_batch_info as ( + select + b.block_date, + evt_block_time as block_time, + num_trades, + dex_swaps, + batch_value, + solver as solver_address, + evt_tx_hash as tx_hash, + gas_price, + gas_used, + ((gas_price / pow(10, 9)) * gas_used * eth_price) / pow(10, 9) as tx_cost_usd, + fee_value, + 2 * bytearray_length(data) / 1024 as call_data_size, + unwraps, + token_approvals + from batch_counts b + join batch_values t + on b.evt_tx_hash = t.tx_hash + inner join {{ source('arbitrum', 'transactions') }} tx + on evt_tx_hash = hash + {% if is_incremental() %} + AND {{ incremental_predicate('tx.block_time') }} + {% endif %} + where num_trades > 0 --! Exclude Withdraw Batches +) + +select * from combined_batch_info diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml new file mode 100644 index 00000000000..76c8f085855 --- /dev/null +++ b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_schema.yml @@ -0,0 +1,25 @@ +version: 2 + +models: + - name: cow_protocol_arbitrum_solvers + meta: + blockchain: arbitrum + project: cow_protocol + contributors: olgafetisova + config: + tags: ['arbitrum_chain','cow_protocol','solver'] + description: > + CoW Protocol solvers list on Arbitrum Chain + + - name: cow_protocol_arbitrum_batches + meta: + blockchain: arbitrum + project: cow_protocol + contributors: olgafetisova + config: + tags: ['arbitrum','cow_protocol','trades', 'dex', 'aggregator', 'auction'] + description: > + CoW Protocol enriched batches table on Arbitrum Chain + tests: + - unique: + column_name: tx_hash diff --git a/models/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql new file mode 100644 index 00000000000..a4a8febe677 --- /dev/null +++ b/models/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql @@ -0,0 +1,72 @@ +{{ config( + schema = 'cow_protocol_arbitrum', + alias='solvers', + post_hook='{{ expose_spells(blockchains = \'["arbitrum"]\', + spell_type = "project", + spell_name = "cow_protocol", + contributors = \'["olgafetisova"]\') }}' +)}} + +-- Find the PoC Query here: https://dune.com/queries/3840597 +WITH +-- Aggregate the solver added and removed events into a single table +-- with true/false for adds/removes respectively +solver_activation_events as ( + select solver, evt_block_number, evt_index, True as activated + from {{ source('gnosis_protocol_v2_arbitrum', 'GPv2AllowListAuthentication_evt_SolverAdded') }} + union + select solver, evt_block_number, evt_index, False as activated + from {{ source('gnosis_protocol_v2_arbitrum', 'GPv2AllowListAuthentication_evt_SolverRemoved') }} +), +-- Sorting by (evt_block_number, evt_index) allows us to pick the most recent activation status of each unique solver +ranked_solver_events as ( + select + rank() over (partition by solver order by evt_block_number desc, evt_index desc) as rk, + solver, + evt_block_number, + evt_index, + activated as active + from solver_activation_events +), +registered_solvers as ( + select solver, active + from ranked_solver_events + where rk = 1 +), +-- Manually inserting environment and name for each "known" solver +known_solver_metadata (address, environment, name) as ( + SELECT * + FROM (VALUES + (0xA70892d1Af41aBD2F648FEC74Ea2c17e56Ac3B9A, 'prod', 'Naive'), + (0xba36CEfb45d1CdD2Ae30a899C432c5081E095Ff8, 'prod', 'Baseline'), + (0xF017C6F66D68d11AF00FD243494E3fa0EBf44C66, 'prod', 'Quasimodo'), + (0x001088C88be46346ED99856dcfA3a00Da7AAf212, 'prod', '1Inch'), + (0xc46Ac109FDe084192BE59C24C3680D818763b0fd, 'prod', 'ParaSwap'), + (0xD31E0CE8154Da6b8086d961eB3068Ef74C4322b6, 'prod', '0x'), + (0xAa224676d096B6Fc257F8C386C67d9e96e53AD59, 'prod', 'BalancerSOR'), + (0x5932b2c05172aAfE097CE0Fbd27d18a7d5A45eE1, 'prod', 'Furucombo'), + (0x3A485742Bd85e660e72dE0f49cC27AD7a62911B5, 'prod', 'SeaSolver'), + (0x059aefdF9d9F47def37cF7066DA83fEB91fDd089, 'prod', 'Barter'), + (0x40798d2261f8b7F11BFa73623c99C876844dD05A, 'prod', 'OpenOcean'), + (0x0648548f891E1356f197070D009704e574182bfB, 'prod', 'Rizzolver'), + (0x20dC1014E946Cf511Ee535D908eC9a1d75Dd66ce, 'barn', 'Naive'), + (0x2e6822f4Ab355E386d1A4fd34947ACE0F6f344a7, 'barn', 'Baseline'), + (0x03a65D265E0613326ca23f5E6A1a99Ab2F12600B, 'barn', 'Quasimodo'), + (0xee10E8D38150BEe3b0B32c41b74821d6e7Da485A, 'barn', '1Inch'), + (0x9C803d345615aDe1e5ae07A789968403fAc9171a, 'barn', 'ParaSwap'), + (0x69433b336952e84Db44EF40b16B338F139B8baA1, 'barn', '0x'), + (0xCED55FC88186f672105712fe177374cce4861FDF, 'barn', 'BalancerSOR'), + (0xE376a730037D8B495864FD5ed6373BE89643cD06, 'barn', 'Furucombo'), + (0x2633bd8e5FDf7C72Aca1d291CA11bdB717A6aa3d, 'barn', 'SeaSolver'), + (0x7B0211286d8Dfdb717f4A2E5Fa5131eD911097e1, 'barn', 'Barter'), + (0xc8371B2898FBaEeAe658f9FaeE8ddeDA24e37012, 'barn', 'OpenOcean'), + (0x2aeC288B42C99D2e8e984c5C324FB069f7705186, 'barn', 'Rizzolver') + ) as _ +) +-- Combining the metadata with current activation status for final table +select solver as address, + case when environment is not null then environment else 'new' end as environment, + case when name is not null then name else 'Uncatalogued' end as name, + active +from registered_solvers + left outer join known_solver_metadata on solver = address; diff --git a/models/cow_protocol/cow_protocol_batches.sql b/models/cow_protocol/cow_protocol_batches.sql index e563ce5a6f9..5a13b752fa1 100644 --- a/models/cow_protocol/cow_protocol_batches.sql +++ b/models/cow_protocol/cow_protocol_batches.sql @@ -4,7 +4,7 @@ post_hook='{{ expose_spells(\'["ethereum", "gnosis"]\', "project", "cow_protocol", - \'["bh2smith", "gentrexha"]\') }}' + \'["bh2smith", "gentrexha", "olgafetisova"]\') }}' ) }} SELECT * @@ -51,4 +51,26 @@ FROM unwraps, token_approvals FROM {{ ref('cow_protocol_gnosis_batches') }} -) \ No newline at end of file + + UNION ALL + + SELECT + 'arbitrum' AS blockchain, + 'cow_protocol' AS project, + '1' AS version, + block_date, + block_time, + num_trades, + dex_swaps, + batch_value, + solver_address, + tx_hash, + gas_price, + gas_used, + tx_cost_usd, + fee_value, + call_data_size, + unwraps, + token_approvals + FROM {{ ref('cow_protocol_arbitrum_batches') }} +) diff --git a/models/evms/evms_info.sql b/models/evms/evms_info.sql index a85cf05f6f5..4ba0278925e 100644 --- a/models/evms/evms_info.sql +++ b/models/evms/evms_info.sql @@ -8,43 +8,46 @@ \'["hildobby"]\') }}') }} -SELECT chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability +SELECT chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement FROM (VALUES - (1, 'ethereum', 'Ethereum', 'Layer 1', NULL, 'ETH', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 'https://etherscan.io/', timestamp '2015-07-30 15:26', NULL, NULL) - , (43114, 'avalanche_c', 'Avalanche C-Chain', 'Layer 1', NULL, 'AVAX', 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7, 'https://snowtrace.io/', timestamp '2020-09-23 11:02', NULL, NULL) - , (42161, 'arbitrum', 'Arbitrum One', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x82af49447d8a07e3bd95bd0d56f35241523fbab1, 'https://arbiscan.io/', timestamp '2021-05-29 00:35', 'Arbitrum', 'Ethereum Blobs') - , (10, 'optimism', 'OP Mainnet', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.optimism.io/', timestamp '2021-11-11 21:16', 'OP Stack', 'Ethereum Blobs') - , (100, 'gnosis', 'Gnosis', 'Layer 1', NULL, 'xDAI', 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d, 'https://gnosisscan.io/', timestamp '2018-10-08 18:43', NULL, NULL) - , (137, 'polygon', 'Polygon PoS', 'Layer 1', NULL, 'MATIC', 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270, 'https://polygonscan.com/', timestamp '2020-05-30 16:30', NULL, NULL) - , (250, 'fantom', 'Fantom', 'Layer 1', NULL, 'FTM', 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83, 'https://ftmscan.com/', timestamp '2019-12-27 03:56', NULL, NULL) - , (56, 'bnb', 'BNB', 'Layer 1', NULL, 'BNB', 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c, 'https://bscscan.com/', timestamp '2020-08-29 03:24', NULL, NULL) - , (5, 'goerli', 'Goerli', 'Testnet', NULL, 'GTH', 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6, 'https://goerli.etherscan.io/', timestamp '2015-07-30 03:26', NULL, NULL) - , (42220, 'celo', 'Celo', 'Layer 1', NULL, 'CELO', 0x471EcE3750Da237f93B8E339c536989b8978a438, 'https://celoscan.io/', timestamp '2020-04-22 16:00', NULL, NULL) - , (8453, 'base', 'Base', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://basescan.org/', timestamp '2023-06-15 00:35', 'OP Stack', 'Ethereum Blobs') - , (7777777, 'zora', 'ZORA', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.zora.energy/', timestamp '2023-06-14 00:03', 'OP Stack', 'Ethereum Blobs') - , (534352, 'scroll', 'Scroll', 'Layer 2', 'ZK Rollup', 'ETH', 0x5300000000000000000000000000000000000004, 'https://scrollscan.com/', timestamp '2023-10-10 06:00', 'Scroll', 'Ethereum Blobs') - , (424, 'pgn', 'Public Goods Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.publicgoods.network/', timestamp '2023-07-11 22:18', 'OP Stack', 'Ethereum') - , (324, 'zksync', 'zkSync Era', 'Layer 2', 'ZK Rollup', 'ETH', 0x5aea5775959fbc2557cc8789bc1bf90a239d9a91, 'https://explorer.zksync.io/', timestamp '2023-02-14 15:22', 'zkSync', 'Ethereum Blobs') - , (1101, 'zkevm', 'Polygon zkEVM', 'Layer 2', 'ZK Rollup', 'ETH', 0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9, 'https://zkevm.polygonscan.com/', timestamp '2023-03-24 05:30', 'Polygon', 'Ethereum') - , (1088, 'metis_andromeda', 'Metis Andromeda', NULL, NULL, NULL, NULL, 'https://andromeda-explorer.metis.io/', timestamp '2021-11-18 22:19', 'Optimistic Virtual Machine', 'Ethereum') - , (5000, 'mantle', 'Mantle', 'Layer 2', 'Optimistic Rollup', 'MNT', NULL, 'https://explorer.mantle.xyz/', timestamp '2023-07-02 18:21', 'Optimistic Virtual Machine', 'Ethereum') - , (59144, 'linea', 'Linea', 'Layer 2', 'ZK Rollup', 'ETH', 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f, 'https://lineascan.build/', timestamp '2023-07-06 13:15', NULL, 'Ethereum Blobs') - , (42170, 'arbitrum_nova', 'Arbitrum Nova', 'Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://nova-explorer.arbitrum.io/', timestamp '2022-06-25 04:01', 'Arbitrum', 'Ethereum') - , (288, 'boba', 'Boba Network', 'Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://bobascan.com/', timestamp '2021-10-28 05:03', 'Optimistic Virtual Machine', 'Ethereum') - , (7700, 'canto', 'Canto', 'Layer 2', NULL, 'ETH', NULL, 'https://evm.explorer.canto.io/', timestamp '2022-07-26 19:27', NULL, 'Ethereum') - , (420, 'optimism_goerli', 'Optimism Goerli', 'Testnet', 'Optimistic Rollup', 'GTH', 0x4200000000000000000000000000000000000006, 'https://optimism-goerli.blockscout.com/', timestamp '2022-06-09 16:55', 'OP Stack', 'goerli') - , (1313161554, 'aurora', 'Aurora', 'Layer 2', NULL, 'ETH', 0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB, 'https://explorer.aurora.dev/', timestamp '2020-07-21 21:50:11', NULL, NULL) - , (8217, 'klaytn', 'Klaytn', 'Layer 1', NULL, 'KLAY', 0xe4f05a66ec68b54a58b17c22107b02e0232cc817, 'https://scope.klaytn.com/', timestamp '2019-06-25 13:41:14', NULL, NULL) - , (34443, 'mode', 'Mode', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.mode.network/', timestamp '2023-11-16 20:46:23', 'OP Stack', 'Ethereum Blobs') - , (291, 'orderly', 'Orderly Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.orderly.network/', timestamp '2023-10-06 16:03:49', 'OP Stack', 'Ethereum') - , (957, 'lyra', 'Lyra', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.lyra.finance/', cast(NULL AS timestamp), 'OP Stack', 'Ethereum') - , (169, 'manta_pacific', 'Manta Pacific', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://pacific-explorer.manta.network/', timestamp '2023-09-09 02:45:59', 'OP Stack', 'Celestia') - , (204, 'opbnb', 'opBNB', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://opbnbscan.com/', timestamp '2023-08-11 11:35:24', 'OP Stack', 'BNB') - , (255, 'kroma', 'Kroma', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://blockscout.kroma.network/', timestamp '2023-09-04 22:19:49', 'OP Stack', 'Ethereum') - , (116, 'debank', 'DeBank', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.debank.com/', cast(NULL AS timestamp), 'OP Stack', NULL) - , (570, 'rollux', 'Rollux', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.rollux.com/', timestamp '2023-06-21 07:34:01', 'OP Stack', 'Bitcoin') - , (666666666, 'degen', 'DEGEN', 'Layer 3', 'Optimistic Rollup', 'DEGEN', NULL, 'https://explorer.degen.tips/', timestamp '2024-03-10 17:18:59', 'Arbitrum Orbit', 'AnyTrust') - , (1750, 'metal', 'Metal', 'Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://explorer.metall2.com/', timestamp '2024-03-27 19:18:35', 'OP Stack', 'Ethereum Blobs') - , (81457, 'blast', 'Blast', 'Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://blastscan.io/', timestamp '2024-02-24 09:23:35', NULL, 'Ethereum') - , (168587773, 'blast_sepolia', 'Blast Sepolia', 'Testnet Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://testnet.blastscan.io/', timestamp '2024-01-08 04:04:48', NULL, 'Sepolia') - ) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability) + (1, 'ethereum', 'Ethereum', 'Layer 1', NULL, 'ETH', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 'https://etherscan.io/', timestamp '2015-07-30 15:26', NULL, NULL, NULL) + , (43114, 'avalanche_c', 'Avalanche C-Chain', 'Layer 1', NULL, 'AVAX', 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7, 'https://snowtrace.io/', timestamp '2020-09-23 11:02', NULL, NULL, NULL) + , (42161, 'arbitrum', 'Arbitrum One', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x82af49447d8a07e3bd95bd0d56f35241523fbab1, 'https://arbiscan.io/', timestamp '2021-05-29 00:35', 'Arbitrum', 'Ethereum Blobs', 'Ethereum') + , (10, 'optimism', 'OP Mainnet', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.optimism.io/', timestamp '2021-11-11 21:16', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (100, 'gnosis', 'Gnosis', 'Layer 1', NULL, 'xDAI', 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d, 'https://gnosisscan.io/', timestamp '2018-10-08 18:43', NULL, NULL, NULL) + , (137, 'polygon', 'Polygon PoS', 'Layer 1', NULL, 'MATIC', 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270, 'https://polygonscan.com/', timestamp '2020-05-30 16:30', NULL, NULL, NULL) + , (250, 'fantom', 'Fantom', 'Layer 1', NULL, 'FTM', 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83, 'https://ftmscan.com/', timestamp '2019-12-27 03:56', NULL, NULL, NULL) + , (56, 'bnb', 'BNB', 'Layer 1', NULL, 'BNB', 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c, 'https://bscscan.com/', timestamp '2020-08-29 03:24', NULL, NULL, NULL) + , (5, 'goerli', 'Goerli', 'Testnet', NULL, 'tETH', 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6, 'https://goerli.etherscan.io/', timestamp '2015-07-30 03:26', NULL, NULL, NULL) + , (42220, 'celo', 'Celo', 'Layer 1', NULL, 'CELO', 0x471EcE3750Da237f93B8E339c536989b8978a438, 'https://celoscan.io/', timestamp '2020-04-22 16:00', NULL, NULL, NULL) + , (8453, 'base', 'Base', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://basescan.org/', timestamp '2023-06-15 00:35', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (7777777, 'zora', 'ZORA', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.zora.energy/', timestamp '2023-06-14 00:03', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (534352, 'scroll', 'Scroll', 'Layer 2', 'ZK Rollup', 'ETH', 0x5300000000000000000000000000000000000004, 'https://scrollscan.com/', timestamp '2023-10-10 06:00', 'Scroll', 'Ethereum Blobs', 'Ethereum') + , (424, 'pgn', 'Public Goods Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.publicgoods.network/', timestamp '2023-07-11 22:18', 'OP Stack', 'Ethereum', 'Ethereum') + , (324, 'zksync', 'zkSync Era', 'Layer 2', 'ZK Rollup', 'ETH', 0x5aea5775959fbc2557cc8789bc1bf90a239d9a91, 'https://explorer.zksync.io/', timestamp '2023-02-14 15:22', 'zkSync', 'Ethereum Blobs', 'Ethereum') + , (1101, 'zkevm', 'Polygon zkEVM', 'Layer 2', 'ZK Rollup', 'ETH', 0x4f9a0e7fd2bf6067db6994cf12e4495df938e6e9, 'https://zkevm.polygonscan.com/', timestamp '2023-03-24 05:30', 'Polygon', 'Ethereum', 'Ethereum') + , (1088, 'metis_andromeda', 'Metis Andromeda', NULL, NULL, NULL, NULL, 'https://andromeda-explorer.metis.io/', timestamp '2021-11-18 22:19', 'Optimistic Virtual Machine', 'Ethereum', 'Ethereum') + , (5000, 'mantle', 'Mantle', 'Layer 2', 'Optimistic Rollup', 'MNT', NULL, 'https://explorer.mantle.xyz/', timestamp '2023-07-02 18:21', 'Optimistic Virtual Machine', 'Ethereum', 'Ethereum') + , (59144, 'linea', 'Linea', 'Layer 2', 'ZK Rollup', 'ETH', 0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f, 'https://lineascan.build/', timestamp '2023-07-06 13:15', NULL, 'Ethereum Blobs', 'Ethereum') + , (42170, 'arbitrum_nova', 'Arbitrum Nova', 'Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://nova-explorer.arbitrum.io/', timestamp '2022-06-25 04:01', 'Arbitrum', 'Ethereum', 'Ethereum') + , (288, 'boba', 'Boba Network', 'Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://bobascan.com/', timestamp '2021-10-28 05:03', 'Optimistic Virtual Machine', 'Ethereum', 'Ethereum') + , (7700, 'canto', 'Canto', 'Layer 2', NULL, 'ETH', NULL, 'https://evm.explorer.canto.io/', timestamp '2022-07-26 19:27', NULL, 'Ethereum', 'Ethereum') + , (420, 'optimism_goerli', 'Optimism Goerli', 'Testnet', 'Optimistic Rollup', 'GTH', 0x4200000000000000000000000000000000000006, 'https://optimism-goerli.blockscout.com/', timestamp '2022-06-09 16:55', 'OP Stack', 'Goerli', 'Goerli') + , (1313161554, 'aurora', 'Aurora', 'Layer 2', NULL, 'ETH', 0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB, 'https://explorer.aurora.dev/', timestamp '2020-07-21 21:50:11', NULL, NULL, NULL) + , (8217, 'klaytn', 'Klaytn', 'Layer 1', NULL, 'KLAY', 0xe4f05a66ec68b54a58b17c22107b02e0232cc817, 'https://scope.klaytn.com/', timestamp '2019-06-25 13:41:14', NULL, NULL, NULL) + , (34443, 'mode', 'Mode', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.mode.network/', timestamp '2023-11-16 20:46:23', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (291, 'orderly', 'Orderly Network', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.orderly.network/', timestamp '2023-10-06 16:03:49', 'OP Stack', 'Ethereum', 'Ethereum') + , (957, 'lyra', 'Lyra', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.lyra.finance/', cast(NULL AS timestamp), 'OP Stack', 'Ethereum', 'Ethereum') + , (169, 'manta_pacific', 'Manta Pacific', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://pacific-explorer.manta.network/', timestamp '2023-09-09 02:45:59', 'OP Stack', 'Celestia', 'Ethereum') + , (204, 'opbnb', 'opBNB', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://opbnbscan.com/', timestamp '2023-08-11 11:35:24', 'OP Stack', 'BNB', 'BNB') + , (255, 'kroma', 'Kroma', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://blockscout.kroma.network/', timestamp '2023-09-04 22:19:49', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (116, 'debank', 'DeBank', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.debank.com/', cast(NULL AS timestamp), 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (570, 'rollux', 'Rollux', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.rollux.com/', timestamp '2023-06-21 07:34:01', 'OP Stack', 'Bitcoin', 'Bitcoin') + , (666666666, 'degen', 'DEGEN', 'Layer 3', 'Optimistic Rollup', 'DEGEN', 0xeb54dacb4c2ccb64f8074eceea33b5ebb38e5387, 'https://explorer.degen.tips/', timestamp '2024-03-10 17:18:59', 'Arbitrum Orbit', 'AnyTrust', 'Base') + , (1750, 'metal', 'Metal', 'Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://explorer.metall2.com/', timestamp '2024-03-27 19:18:35', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (81457, 'blast', 'Blast', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4300000000000000000000000000000000000004, 'https://blastscan.io/', timestamp '2024-02-24 09:23:35', NULL, 'Ethereum Blobs', 'Ethereum') + , (168587773, 'blast_sepolia', 'Blast Sepolia', 'Testnet Layer 2', 'Optimistic Rollup', 'ETH', NULL, 'https://testnet.blastscan.io/', timestamp '2024-01-08 04:04:48', NULL, 'Sepolia', 'Sepolia') + , (60808, 'bob', 'BOB', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.gobob.xyz/', timestamp '2024-04-11 20:59:47', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + , (11155111, 'sepolia', 'Sepolia', 'Testnet', 'Testnet', 'tETH', 0x7b79995e5f793a07bc00c21412e50ecae098e7f9, 'https://sepolia.etherscan.io/', timestamp '2015-07-30 15:26:13', NULL, NULL, NULL) + , (167000, 'taiko', 'Taiko', 'Layer 2', 'Optimistic Rollup', 'ETH', 0xa51894664a773981c6c112c43ce576f315d5b1b6, 'https://taikoscan.network/', timestamp '2024-03-29 07:39:12', 'OP Stack', 'Ethereum Blobs', 'Ethereum') + ) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement) diff --git a/models/evms/evms_schema.yml b/models/evms/evms_schema.yml index 132393f4430..dc2a20ed015 100644 --- a/models/evms/evms_schema.yml +++ b/models/evms/evms_schema.yml @@ -507,6 +507,8 @@ models: description: "Codebase used" - name: data_availability description: "Chain where proofs are submitted to" + - name: settlement + description: "Chain that is being settled on" - name: evms_non_app_method_ids meta: diff --git a/models/prices/arbitrum/prices_arbitrum_tokens.sql b/models/prices/arbitrum/prices_arbitrum_tokens.sql index 1b410ff857b..a854adb8d9c 100644 --- a/models/prices/arbitrum/prices_arbitrum_tokens.sql +++ b/models/prices/arbitrum/prices_arbitrum_tokens.sql @@ -197,6 +197,6 @@ FROM ('gyd-gyro-dollar','arbitrum','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), ('a51-a51-finance','arbitrum','A51',0xb3f13b0c61d65d67d7d6215d70c89533ee567a91, 18), ('oseth-stakewise-staked-eth','arbitrum','osETH',0xf7d4e7273e5015c96728a6b02f31c505ee184603, 18), - -- ('sliz-solidlizard-dex-token','arbitrum','SLIZ',0x463913D3a3D3D291667D53B8325c598Eb88D3B0e, 18), -- Inactive + ('sliz-solidlizard-dex-token','arbitrum','SLIZ',0x463913D3a3D3D291667D53B8325c598Eb88D3B0e, 18), ('vrtx-vertex-protocol', 'arbitrum', 'VRTX', 0x95146881b86b3ee99e63705ec87afe29fcc044d9, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/models/prices/ethereum/prices_ethereum_tokens.sql b/models/prices/ethereum/prices_ethereum_tokens.sql index d50fd72b669..c41abd38377 100644 --- a/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1794,7 +1794,8 @@ FROM ('portal2-portal-coin', 'ethereum', 'PORTAL', 0x1bbe973bef3a977fc51cbed703e8ffdefe001fed, 18), ('dough-l3t-h1m-c00k', 'ethereum', 'DOUGH', 0xFc116eA24F002F600e363bdce4b91715fe5e0392, 9), ('giv-giv', 'ethereum', 'GIV', 0x900db999074d9277c5da2a43f252d74366230da0, 18), - ('zro-layerzero', 'ethereum', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18) + ('zro-layerzero', 'ethereum', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18), + ('quartz-sandclock', 'ethereum', 'QUARTZ', 0xba8a621b4a54e61c442f5ec623687e2a942225ef, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) where contract_address not in ( -- bad price feeds diff --git a/models/prices/linea/prices_linea_tokens.sql b/models/prices/linea/prices_linea_tokens.sql index a342688ab41..7049b7bddc3 100644 --- a/models/prices/linea/prices_linea_tokens.sql +++ b/models/prices/linea/prices_linea_tokens.sql @@ -24,4 +24,6 @@ FROM ,('uni-uniswap', 'linea', 'UNI', 0x636B22bC471c955A8DB60f28D4795066a8201fa3, 18) ,('link-chainlink', 'linea', 'LINK', 0x5B16228B94b68C7cE33AF2ACc5663eBdE4dCFA2d, 18) ,('dai-dai', 'linea', 'DAI', 0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5, 18) + ,('m-btc-merlins-seal-btc', 'linea', 'M-BTC',0xe4D584ae9b753e549cAE66200A6475d2f00705f7, 18) + ,('solvbtc-solv-protocol-solvbtc', 'linea', 'solvBTC', 0x5FFcE65A40f6d3de5332766ffF6A28BF491C868c, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/models/prices/scroll/prices_scroll_tokens.sql b/models/prices/scroll/prices_scroll_tokens.sql index 59bc18c1779..7bdeb7794a9 100644 --- a/models/prices/scroll/prices_scroll_tokens.sql +++ b/models/prices/scroll/prices_scroll_tokens.sql @@ -22,6 +22,13 @@ FROM ('izi-izumi-finance', 'scroll', 'iZi', 0x60D01EC2D5E98Ac51C8B4cF84DfCCE98D527c747, 18), ('lusd-liquity-usd', 'scroll', 'LUSD', 0xeDEAbc3A1e7D21fE835FFA6f83a710c70BB1a051, 18), ('wsteth-wrapped-liquid-staked-ether-20', 'scroll', 'wstETH', 0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32, 18), - ('reth-rocket-pool-eth', 'scroll', 'rETH', 0x53878B874283351D26d206FA512aEcE1Bef6C0dD, 18) - + ('reth-rocket-pool-eth', 'scroll', 'rETH', 0x53878B874283351D26d206FA512aEcE1Bef6C0dD, 18), + ('dai-dai', 'scroll', 'DAI', 0xca77eb3fefe3725dc33bccb54edefc3d9f764f97, 18), + ('stone-stakestone-ether', 'scroll', 'STONE', 0x80137510979822322193fc997d400d5a6c747bf7, 18), + ('sis-symbiosis-finance', 'scroll', 'SIS', 0x1467b62a6ae5cdcb10a6a8173cfe187dd2c5a136, 18), + ('rseth-rseth', 'scroll', 'wrsETH ', 0xa25b25548b4c98b0c7d3d27dca5d5ca743d68b7f, 18), + ('iusd-izumi-bond-usd', 'scroll', 'iUSD ', 0x0a3bb08b3a15a19b4de82f8acfc862606fb69a2d, 18), + ('pxeth-pirex-ether', 'scroll', 'pxETH ', 0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb, 18), + ('frxeth-frax-ether', 'scroll', 'frxETH ', 0xecc68d0451e20292406967fe7c04280e5238ac7d, 18), + ('solvbtc-solv-protocol-solvbtc', 'scroll', 'SolvBTC ', 0x3ba89d490ab1c0c9cc2313385b30710e838370a4, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/nft/models/_sector/aggregators/_schema.yml b/nft/models/_sector/aggregators/_schema.yml index edb74faacd0..eb906076b4a 100644 --- a/nft/models/_sector/aggregators/_schema.yml +++ b/nft/models/_sector/aggregators/_schema.yml @@ -3,7 +3,7 @@ version: 2 models: - name: nft_aggregators meta: - blockchain: arbitrum, avalanche_c, bnb, celo, ethereum, optimism, polygon + blockchain: arbitrum, avalanche_c, base, blast, bnb, celo, ethereum, linea, mantle, optimism, polygon, scroll, zksync sector: nft contributors: hildobby, tomfutago, chuxin, 0xRob, soispoke config: diff --git a/nft/models/_sector/aggregators/chains/nft_arbitrum_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_arbitrum_aggregators.sql index dbee6ea3b99..f9906c7703f 100644 --- a/nft/models/_sector/aggregators/chains/nft_arbitrum_aggregators.sql +++ b/nft/models/_sector/aggregators/chains/nft_arbitrum_aggregators.sql @@ -12,4 +12,5 @@ FROM VALUES (0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad, 'Uniswap') -- Uniswap's Universal Router 3 , (0xc2c862322e9c97d6244a3506655da95f05246fd8, 'Reservoir') -- Reservoir v6.0.1 + , (0x1e0e556b7f310c320ba22b5dec0a0755c1c9854b, 'Element') -- Element Swap 2 ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_avalanche_c_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_avalanche_c_aggregators.sql index b702c9224c5..9f937550831 100644 --- a/nft/models/_sector/aggregators/chains/nft_avalanche_c_aggregators.sql +++ b/nft/models/_sector/aggregators/chains/nft_avalanche_c_aggregators.sql @@ -11,4 +11,5 @@ FROM ( VALUES (0x37ad2bd1e4f1c0109133e07955488491233c9372, 'Element') -- Element NFT Marketplace Aggregator + , (0x917ef4f231cbd0972a10ec3453f40762c488e6fa, 'Element') -- Element Swap 2 ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_base_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_base_aggregators.sql new file mode 100644 index 00000000000..23b4df6579c --- /dev/null +++ b/nft/models/_sector/aggregators/chains/nft_base_aggregators.sql @@ -0,0 +1,14 @@ +{{config( + + schema = 'nft_base', + alias = 'aggregators' +)}} + +SELECT + contract_address, + name +FROM + ( + VALUES + (0x66950320086664429c69735318724ae24ec0d835, 'Element') -- Element Swap 2 + ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_blast_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_blast_aggregators.sql new file mode 100644 index 00000000000..77f6a097bc7 --- /dev/null +++ b/nft/models/_sector/aggregators/chains/nft_blast_aggregators.sql @@ -0,0 +1,14 @@ +{{config( + + schema = 'nft_blast', + alias = 'aggregators' +)}} + +SELECT + contract_address, + name +FROM + ( + VALUES + (0xe29799ca0b98ba41343a4ea52fe15ed7d5e05662, 'Element') -- Element Swap 2 + ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_bnb_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_bnb_aggregators.sql index 46bb70ab88d..1f263fa97f8 100644 --- a/nft/models/_sector/aggregators/chains/nft_bnb_aggregators.sql +++ b/nft/models/_sector/aggregators/chains/nft_bnb_aggregators.sql @@ -11,6 +11,7 @@ FROM ( VALUES (0x56085ea9c43dea3c994c304c53b9915bff132d20, 'Element') -- Element NFT Marketplace Aggregator + , (0x46a03313fa8ef8ac8798f502bb38d35e5e1acbfc, 'Element') -- Element Swap 2 , (0x48939e2b2549710df8b7d9085207279a8f0fe3e5, 'Oxalus') -- Oxalus NFT Aggregator , (0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad, 'Uniswap') -- Uniswap's Universal Router , (0xc2c862322e9c97d6244a3506655da95f05246fd8, 'Reservoir') -- Reservoir v6.0.1 diff --git a/nft/models/_sector/aggregators/chains/nft_linea_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_linea_aggregators.sql new file mode 100644 index 00000000000..dfbc4b9b867 --- /dev/null +++ b/nft/models/_sector/aggregators/chains/nft_linea_aggregators.sql @@ -0,0 +1,14 @@ +{{config( + + schema = 'nft_linea', + alias = 'aggregators' +)}} + +SELECT + contract_address, + name +FROM + ( + VALUES + (0x42c759a719c228050901299b88fd316c3a050617, 'Element') -- Element Swap 2 + ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_mantle_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_mantle_aggregators.sql new file mode 100644 index 00000000000..8f84fc09551 --- /dev/null +++ b/nft/models/_sector/aggregators/chains/nft_mantle_aggregators.sql @@ -0,0 +1,14 @@ +{{config( + + schema = 'nft_mantle', + alias = 'aggregators' +)}} + +SELECT + contract_address, + name +FROM + ( + VALUES + (0x9f47921d360aee0651a4f1ed2c4892b4923f9e52, 'Element') -- Element Swap 2 + ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_optimism_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_optimism_aggregators.sql index 930fe0db702..8c60eb9d389 100644 --- a/nft/models/_sector/aggregators/chains/nft_optimism_aggregators.sql +++ b/nft/models/_sector/aggregators/chains/nft_optimism_aggregators.sql @@ -14,4 +14,5 @@ FROM , (0x92D932aBBC7885999c4347880Eb069F854982eDD, 'okx') --okx , (0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad, 'Uniswap') -- Uniswap's Universal Router 3 , (0xc2c862322e9c97d6244a3506655da95f05246fd8, 'Reservoir') -- Reservoir v6.0.1 + , (0xc9605a76b0370e148b4a510757685949f13248c7, 'Element') -- Element Swap 2 ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_polygon_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_polygon_aggregators.sql index 631877165ab..437080ed59d 100644 --- a/nft/models/_sector/aggregators/chains/nft_polygon_aggregators.sql +++ b/nft/models/_sector/aggregators/chains/nft_polygon_aggregators.sql @@ -11,7 +11,7 @@ FROM ( VALUES (0xb3e808e102ac4be070ee3daac70672ffc7c1adca, 'Element') -- Element NFT Marketplace Aggregator - , (0x84efdf0052bf79f2cd3a2369a5d62322923512af, 'Element') -- Element Swap 2 + , (0x25956fd0a5fe281d921b1bb3499fc8d5efea6201, 'Element') -- Element Swap 2 , (0x5e06c349a4a1b8dde8da31e0f167d1cb1d99967c, 'Dew') -- Dew , (0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad, 'Uniswap') -- Uniswap's Universal Router 3 , (0xfbf4c42bb3981e6d5b85ad340d7f0213db7b132c, 'BitKeep') -- BitKeep diff --git a/nft/models/_sector/aggregators/chains/nft_scroll_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_scroll_aggregators.sql new file mode 100644 index 00000000000..7fa3b2c1bf1 --- /dev/null +++ b/nft/models/_sector/aggregators/chains/nft_scroll_aggregators.sql @@ -0,0 +1,14 @@ +{{config( + + schema = 'nft_scroll', + alias = 'aggregators' +)}} + +SELECT + contract_address, + name +FROM + ( + VALUES + (0x217efe077801387d125fe98e1b61cdda4d1364d2, 'Element') -- Element Swap 2 + ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/chains/nft_zksync_aggregators.sql b/nft/models/_sector/aggregators/chains/nft_zksync_aggregators.sql new file mode 100644 index 00000000000..72c65142178 --- /dev/null +++ b/nft/models/_sector/aggregators/chains/nft_zksync_aggregators.sql @@ -0,0 +1,14 @@ +{{config( + + schema = 'nft_zksync', + alias = 'aggregators' +)}} + +SELECT + contract_address, + name +FROM + ( + VALUES + (0x7868a55b638ed298370c16f83fa32b26664726ab, 'Element') -- Element Swap 2 + ) AS temp_table (contract_address, name) diff --git a/nft/models/_sector/aggregators/nft_aggregators.sql b/nft/models/_sector/aggregators/nft_aggregators.sql index 7ad75479b46..cdd122bb469 100644 --- a/nft/models/_sector/aggregators/nft_aggregators.sql +++ b/nft/models/_sector/aggregators/nft_aggregators.sql @@ -2,22 +2,37 @@ schema = 'nft', alias = 'aggregators', - post_hook='{{ expose_spells(\'["avalanche_c","bnb","ethereum","polygon","optimism","celo"]\', + post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","blast","bnb","celo","ethereum","linea","mantle","optimism","polygon","scroll","zksync"]\', "sector", "nft", \'["soispoke","hildobby", "chuxin"]\') }}') }} -SELECT 'avalanche_c' as blockchain, * FROM {{ ref('nft_avalanche_c_aggregators') }} -UNION ALL -SELECT 'bnb' as blockchain, * FROM {{ ref('nft_bnb_aggregators') }} -UNION ALL -SELECT 'ethereum' as blockchain, * FROM {{ ref('nft_ethereum_aggregators') }} -UNION ALL -SELECT 'polygon' as blockchain, * FROM {{ ref('nft_polygon_aggregators') }} -UNION ALL -SELECT 'optimism' as blockchain, * FROM {{ ref('nft_optimism_aggregators') }} -UNION ALL -SELECT 'arbitrum' as blockchain, * FROM {{ ref('nft_arbitrum_aggregators') }} -UNION ALL -SELECT 'celo' as blockchain, * FROM {{ ref('nft_celo_aggregators') }} + +{% set aggregator_models = [ + ('arbitrum', ref('nft_arbitrum_aggregators')) + , ('avalanche_c', ref('nft_avalanche_c_aggregators')) + , ('base', ref('nft_base_aggregators')) + , ('blast', ref('nft_blast_aggregators')) + , ('bnb', ref('nft_bnb_aggregators')) + , ('celo', ref('nft_celo_aggregators')) + , ('ethereum', ref('nft_ethereum_aggregators')) + , ('linea', ref('nft_linea_aggregators')) + , ('mantle', ref('nft_mantle_aggregators')) + , ('optimism', ref('nft_optimism_aggregators')) + , ('polygon', ref('nft_polygon_aggregators')) + , ('scroll', ref('nft_scroll_aggregators')) + , ('zksync', ref('nft_zksync_aggregators')) +] %} + +SELECT * FROM ( +{% for aggregator_model in aggregator_models %} + SELECT '{{ aggregator_model[0] }}' AS blockchain + , contract_address + , "name" + FROM {{ aggregator_model[1] }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) \ No newline at end of file diff --git a/nft/models/_sector/trades/chains/blast/nft_blast_base_trades.sql b/nft/models/_sector/trades/chains/blast/nft_blast_base_trades.sql index a2f658caf11..d3e05f2e0f7 100644 --- a/nft/models/_sector/trades/chains/blast/nft_blast_base_trades.sql +++ b/nft/models/_sector/trades/chains/blast/nft_blast_base_trades.sql @@ -9,6 +9,7 @@ {% set nft_models = [ ref('fantasy_blast_base_trades') , ref('blur_blast_base_trades') + , ref('opensea_v4_blast_base_trades') ] %} diff --git a/nft/models/_sector/trades/chains/blast/platforms/_schema.yml b/nft/models/_sector/trades/chains/blast/platforms/_schema.yml index 44a07d83177..e0c7ac25b8c 100644 --- a/nft/models/_sector/trades/chains/blast/platforms/_schema.yml +++ b/nft/models/_sector/trades/chains/blast/platforms/_schema.yml @@ -28,3 +28,17 @@ models: - check_columns_nft_base_trades - dbt_utils.unique_combination_of_columns: combination_of_columns: ['block_number','tx_hash','sub_tx_trade_id'] + + - name: opensea_v4_blast_base_trades + meta: + blockchain: blast + sector: nft + project: opensea + contributors: hildobby + config: + tags: ['blast', 'nft', 'trades', 'opensea'] + description: "OpenSea on blast base trades" + tests: + - check_columns_nft_base_trades + - dbt_utils.unique_combination_of_columns: + combination_of_columns: ['block_number','tx_hash','sub_tx_trade_id'] diff --git a/nft/models/_sector/trades/chains/blast/platforms/opensea_v4_blast_base_trades.sql b/nft/models/_sector/trades/chains/blast/platforms/opensea_v4_blast_base_trades.sql new file mode 100644 index 00000000000..de15f99c99f --- /dev/null +++ b/nft/models/_sector/trades/chains/blast/platforms/opensea_v4_blast_base_trades.sql @@ -0,0 +1,35 @@ +{{ config( + schema = 'opensea_v4_blast', + alias = 'base_trades', + + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_hash', 'sub_tx_trade_id'] + ) +}} + +WITH fee_wallets as ( + select wallet_address, wallet_name from ( + values (0x0000a26b00c1f0df003000390027140000faa719,'opensea') + ) as foo(wallet_address, wallet_name) +) + +, trades as ( + {{ seaport_v4_trades( + blockchain = 'blast' + ,source_transactions = source('blast','transactions') + ,Seaport_evt_OrderFulfilled = source('seaport_blast','Seaport_evt_OrderFulfilled') + ,Seaport_evt_OrdersMatched = source('seaport_blast','Seaport_evt_OrdersMatched') + ,fee_wallet_list_cte = 'fee_wallets' + ,start_date = '2024-03-21' + ,native_currency_contract = '0x4200000000000000000000000000000000000006' + ) + }} +) + +select * +from trades +where ( fee_wallet_name = 'opensea' + or right_hash = 0x360c6ebe + ) \ No newline at end of file diff --git a/nft/models/_sector/wash_trades/_schema.yml b/nft/models/_sector/wash_trades/_schema.yml index f3e665fd1c1..73a0c85d719 100644 --- a/nft/models/_sector/wash_trades/_schema.yml +++ b/nft/models/_sector/wash_trades/_schema.yml @@ -3,7 +3,7 @@ version: 2 models: - name: nft_wash_trades meta: - blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, optimism, polygon, zksync, base, scroll, zora, blast + blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, optimism, polygon, zksync, base, scroll, zora, blast, fantom sector: nft contributors: hildobby config: diff --git a/nft/models/_sector/wash_trades/chains/nft_fantom_wash_trades.sql b/nft/models/_sector/wash_trades/chains/nft_fantom_wash_trades.sql new file mode 100644 index 00000000000..388cedb18da --- /dev/null +++ b/nft/models/_sector/wash_trades/chains/nft_fantom_wash_trades.sql @@ -0,0 +1,17 @@ +{{ config( + + schema = 'nft_fantom', + alias='wash_trades', + partition_by=['block_month'], + materialized='incremental', + file_format = 'delta', + incremental_strategy = 'merge', + incremental_predicates = ['DBT_INTERNAL_DEST.block_time >= date_trunc(\'day\', now() - interval \'7\' day)'], + unique_key = ['unique_trade_id'] +) +}} + +{{nft_wash_trades( + blockchain='fantom', + first_funded_by= source('addresses_events_fantom', 'first_funded_by') +)}} diff --git a/nft/models/_sector/wash_trades/nft_wash_trades.sql b/nft/models/_sector/wash_trades/nft_wash_trades.sql index effb7054849..006e7776712 100644 --- a/nft/models/_sector/wash_trades/nft_wash_trades.sql +++ b/nft/models/_sector/wash_trades/nft_wash_trades.sql @@ -2,7 +2,7 @@ alias = 'wash_trades', schema = 'nft', - post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "bnb", "ethereum", "gnosis", "optimism", "polygon", "celo", "zksync", "base", "scroll", "zora", "blast"]\', + post_hook='{{ expose_spells(\'["arbitrum", "avalanche_c", "bnb", "ethereum", "gnosis", "optimism", "polygon", "celo", "zksync", "base", "scroll", "zora", "blast", "fantom"]\', "sector", "nft", \'["hildobby"]\') }}') @@ -22,6 +22,7 @@ , ref('nft_scroll_wash_trades') , ref('nft_zora_wash_trades') , ref('nft_blast_wash_trades') +, ref('nft_fantom_wash_trades') ] %} SELECT * diff --git a/nft/models/nft_metrics/nft_marketplaces_info.sql b/nft/models/nft_metrics/nft_marketplaces_info.sql index 6d8a698e56d..c3f78a0f679 100644 --- a/nft/models/nft_metrics/nft_marketplaces_info.sql +++ b/nft/models/nft_metrics/nft_marketplaces_info.sql @@ -73,4 +73,7 @@ FROM (VALUES , ('joepegs', 'Joepegs', 'Direct', 'joepegsnft') , ('alienswap', 'AlienSwap', 'Direct & Aggregator', 'AlienSwap_NFT') , ('mintsquare', 'Mint Square', 'Direct', 'MintSquareNFT') + , ('fantasy', 'Fantasy', 'Direct', 'fantasy_top_') + , ('chikn', 'Chikn', 'Direct', 'chikn_nft') + , ('eesee', 'eesee', 'Direct', 'eesee_io') ) AS temp_table (project, name, marketplace_type, x_username) \ No newline at end of file diff --git a/scripts/token_checker.py b/scripts/token_checker.py index 1a454e47f0c..8f97946cd1f 100644 --- a/scripts/token_checker.py +++ b/scripts/token_checker.py @@ -26,7 +26,9 @@ def __init__(self): "zksync": "zksync-zksync", "zora": "eth-ethereum", "mantle": "mnt-mantle", - "blast": "blast-blast" + "blast": "blast-blast", + "linea": "eth-ethereum", + "scroll": "eth-ethereum" } self.tokens_by_id = self.get_tokens() self.contracts_by_chain = self.get_contracts() diff --git a/solana/models/_sector/nft/nft_solana_old_trades.sql b/solana/models/_sector/nft/nft_solana_old_trades.sql index 9cc7d9221b0..d25d7858ad1 100644 --- a/solana/models/_sector/nft/nft_solana_old_trades.sql +++ b/solana/models/_sector/nft/nft_solana_old_trades.sql @@ -9,7 +9,6 @@ -- while we refactor more marketplace models, they should be removed here and added to the chain specific base_trades unions. {% set nft_models = [ ref('magiceden_solana_events') -,ref('opensea_solana_events') ] %} diff --git a/sources/_subprojects/dex/_sources.yml b/sources/_subprojects/dex/_sources.yml index 270dc948654..7882e594e4d 100644 --- a/sources/_subprojects/dex/_sources.yml +++ b/sources/_subprojects/dex/_sources.yml @@ -63,5 +63,8 @@ sources: tables: - name: trades - name: cow_protocol_gnosis + tables: + - name: trades + - name: cow_protocol_arbitrum tables: - name: trades \ No newline at end of file diff --git a/sources/_subprojects/spellbook/_sources.yml b/sources/_subprojects/spellbook/_sources.yml index b0da7f55ad3..8e891f3cd40 100644 --- a/sources/_subprojects/spellbook/_sources.yml +++ b/sources/_subprojects/spellbook/_sources.yml @@ -44,6 +44,9 @@ sources: - name: addresses_events_blast tables: - name: first_funded_by + - name: addresses_events_fantom + tables: + - name: first_funded_by - name: bridge_optimism tables: - name: standard_bridge_flows @@ -93,3 +96,6 @@ sources: - name: balancer tables: - name: bpt_prices + - name: tokens + tables: + - name: transfers diff --git a/sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml b/sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml index 421803f0864..67125d445b6 100644 --- a/sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml +++ b/sources/cow_protocol/arbitrum/cow_protocol_arbitrum_sources.yml @@ -4,21 +4,15 @@ sources: - name: gnosis_protocol_v2_arbitrum description: "Arbitrum Chain decoded tables related to CoW Protocol contract" tables: - - name: GPv2Settlement_evt_Trade - description: "Trade events emitted by GPv2Settlement" + - name: GPv2AllowListAuthentication_evt_SolverAdded + description: "GPv2AllowListAuthentication list of events when a Solver was added" columns: - - &feeAmount - name: feeAmount - description: "Amount (in sell token) in atoms of the trade fee" - - &buyAmount - name: buyAmount - description: "Amount (in atoms) of the buyToken bought" - - &buyToken - name: buyToken - description: "Contract address of token obtained in trade" + - &solver + name: solver + description: "Solver wallet address" - &contract_address name: contract_address - description: "Ethereum address of contract emitting the event" + description: "Arbitrum address of contract emitting the event" - &evt_block_number name: evt_block_number description: "Block number which processed the unique transaction hash" @@ -33,6 +27,32 @@ sources: description: "Primary key of the transaction" tests: - not_null + - name: GPv2AllowListAuthentication_evt_SolverRemoved + description: "GPv2AllowListAuthentication list of events when a solver was removed" + columns: + - *solver + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - name: GPv2Settlement_evt_Trade + description: "Trade events emitted by GPv2Settlement" + columns: + - &feeAmount + name: feeAmount + description: "Amount (in sell token) in atoms of the trade fee" + - &buyAmount + name: buyAmount + description: "Amount (in atoms) of the buyToken bought" + - &buyToken + name: buyToken + description: "Contract address of token obtained in trade. 0xeee...ee represents native asset ETH" + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash - &orderUid name: orderUid description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events." @@ -76,3 +96,29 @@ sources: - &trades name: trades description: "An array of order data for the trades being executed" + - name: GPv2Settlement_evt_Settlement + description: "Settlement events emitted by GPv2Settlement" + columns: + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - *solver + - name: GPv2Settlement_evt_Interaction + description: "Contract Interaction events emitted by GPv2Settlement" + columns: + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - &selector + name: selector + description: Method ID of the contract being interacted with + - &target + name: target + description: Target contract address of the interaction + - &value + name: value + description: ETH amount (in WEI) being passed into contract interaction diff --git a/sources/curvefi/ethereum/curvefi_ethereum_sources.yml b/sources/curvefi/ethereum/curvefi_ethereum_sources.yml index a5e1bfb8cf8..feeb60a7dc2 100644 --- a/sources/curvefi/ethereum/curvefi_ethereum_sources.yml +++ b/sources/curvefi/ethereum/curvefi_ethereum_sources.yml @@ -79,6 +79,10 @@ sources: loaded_at_field: call_block_time - name: crvUSD_StableswapFactory_call_deploy_metapool loaded_at_field: evt_block_time + - name: CurveStableswapFactoryNG_evt_PlainPoolDeployed + loaded_at_field: call_block_time + - name: CurveStableswapFactoryNG_call_deploy_plain_pool + loaded_at_field: call_block_time - name: curvefi_v2_ethereum description: "decoded events and function calls for curve.fi v2 on ethereum" freshness: # default freshness diff --git a/sources/seaport/blast/seaport_blast_sources.yml b/sources/seaport/blast/seaport_blast_sources.yml new file mode 100644 index 00000000000..8fda3f56598 --- /dev/null +++ b/sources/seaport/blast/seaport_blast_sources.yml @@ -0,0 +1,25 @@ +version: 2 + +sources: + - name: seaport_blast + freshness: + warn_after: { count: 24, period: hour } + tables: + - name: Seaport_evt_OrderFulfilled + loaded_at_field: evt_block_time + - name: Seaport_evt_OrdersMatched + loaded_at_field: evt_block_time + - name: Seaport_call_fulfillAvailableAdvancedOrders + loaded_at_field: call_block_time + - name: Seaport_call_fulfillOrder + loaded_at_field: call_block_time + - name: Seaport_call_fulfillBasicOrder + loaded_at_field: call_block_time + - name: Seaport_call_matchAdvancedOrders + loaded_at_field: call_block_time + - name: Seaport_call_fulfillAdvancedOrder + loaded_at_field: call_block_time + - name: Seaport_call_fulfillAvailableOrders + loaded_at_field: call_block_time + - name: Seaport_call_matchOrders + loaded_at_field: call_block_time diff --git a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql index 54e2d88a771..11ffa71df8c 100644 --- a/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql +++ b/tokens/models/tokens/arbitrum/tokens_arbitrum_erc20.sql @@ -82,4 +82,5 @@ FROM (VALUES , (0xD460f305B150Bc70b063E806815B50BebE9F21b1, 'APRTo', 18) , (0x577fd586c9e6ba7f2e85e025d5824dbe19896656, 'SYNO', 18) , (0x6985884c4392d348587b19cb9eaaf157f13271cd, 'ZRO', 18) + , (0xa7997f0ec9fa54e89659229fb26537b6a725b798, 'PAL', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/tokens/models/tokens/base/tokens_base_erc20.sql b/tokens/models/tokens/base/tokens_base_erc20.sql index 330eebf97b7..29fa27288bd 100644 --- a/tokens/models/tokens/base/tokens_base_erc20.sql +++ b/tokens/models/tokens/base/tokens_base_erc20.sql @@ -239,4 +239,5 @@ FROM (VALUES , (0x96419929d7949D6A801A6909c145C8EEf6A40431, 'SPEC', 18) , (0x7ab8ea5ef610f979e1c59fbd9da9284672e5a136, 'KABOSU', 18) , (0xd722e55c1d9d9fa0021a5215cbb904b92b3dc5d4, 'RDNT', 18) + , (0x224114c444e3c3d936532fe08351648700570909, 'PAL', 18) ) AS temp_table (contract_address, symbol, decimals)