diff --git a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_balancer_v2_method.sql b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_balancer_v2_method.sql index b645e6e8a0a..d1208bcdd44 100644 --- a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_balancer_v2_method.sql +++ b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_balancer_v2_method.sql @@ -137,38 +137,38 @@ WITH ) select call_block_time, - call_block_number, - call_tx_hash, - contract_address as project_contract_address, - call_trace_address, - case - when try_cast(srcToken as uint256) = uint256 '0' then '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' - else try_cast( - from_hex(regexp_replace(srcToken, '^(0x)?(00){12}')) as varchar - ) -- shrink hex to get address format (bytes20) - end as srcToken, - case - when try_cast(destToken as uint256) = uint256 '0' then '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' - else try_cast( - from_hex(regexp_replace(destToken, '^(0x)?(00){12}')) as varchar - ) -- shrink hex to get address format (bytes20) - end as destToken, - fromAmount, - toAmount, - try_cast( - JSON_EXTRACT_SCALAR(balancerData, '$.quotedAmount') as uint256 - ) AS quotedAmount, - output_receivedAmount, - JSON_EXTRACT_SCALAR(balancerData, '$.metadata') AS metadata, - try_cast( - from_hex(regexp_replace(beneficiary, '^(0x)?(00){12}')) as varchar - -- shrink hex to get address format (bytes20) - ) as beneficiary, - partnerAndFee, - output_partnerShare, - output_paraswapShare, - '{{ method }}' as method{% if inOrOut == 'out' %}, - output_spentAmount as spentAmount{% endif %} + call_block_number, + call_tx_hash, + contract_address as project_contract_address, + call_trace_address, + case + when try_cast(srcToken as uint256) = uint256 '0' then '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' + else try_cast( + from_hex(regexp_replace(srcToken, '^(0x)?(00){12}')) as varchar + ) -- shrink hex to get address format (bytes20) + end as srcToken, + case + when try_cast(destToken as uint256) = uint256 '0' then '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' + else try_cast( + from_hex(regexp_replace(destToken, '^(0x)?(00){12}')) as varchar + ) -- shrink hex to get address format (bytes20) + end as destToken, + fromAmount, + toAmount, + try_cast( + JSON_EXTRACT_SCALAR(balancerData, '$.quotedAmount') as uint256 + ) AS quotedAmount, + output_receivedAmount, + JSON_EXTRACT_SCALAR(balancerData, '$.metadata') AS metadata, + try_cast( + from_hex(regexp_replace(beneficiary, '^(0x)?(00){12}')) as varchar + -- shrink hex to get address format (bytes20) + ) as beneficiary, + partnerAndFee, + output_partnerShare, + output_paraswapShare, + '{{ method }}' as method{% if inOrOut == 'out' %}, + output_spentAmount as spentAmount{% endif %} from {{tableOuter}} {% endmacro %} diff --git a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_maker_psm_method.sql b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_maker_psm_method.sql deleted file mode 100644 index 200030dc251..00000000000 --- a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_maker_psm_method.sql +++ /dev/null @@ -1,48 +0,0 @@ -{% macro paraswap_v6_maker_psm_method(table_name ) %} - SELECT - call_block_time, - call_block_number, - call_tx_hash, - contract_address as project_contract_address, - call_trace_address, - JSON_EXTRACT_SCALAR(makerPSMData, '$.srcToken') as srcToken, - JSON_EXTRACT_SCALAR(makerPSMData, '$.destToken') as destToken, - try_cast( - JSON_EXTRACT_SCALAR(makerPSMData, '$.fromAmount') as uint256 - ) AS fromAmount, - try_cast( - JSON_EXTRACT_SCALAR(makerPSMData, '$.toAmount') as uint256 - ) AS toAmount, - try_cast( - JSON_EXTRACT_SCALAR(makerPSMData, '$.toAmount') as uint256 - ) AS quotedAmount, - output_receivedAmount, - JSON_EXTRACT_SCALAR(makerPSMData, '$.metadata') AS metadata, - concat( - '0x', - regexp_replace( - try_cast( - try_cast( - bitwise_and( - try_cast( - JSON_EXTRACT_SCALAR(makerPSMData, '$.beneficiaryDirectionApproveFlag') AS UINT256 - ), - varbinary_to_uint256 (0xffffffffffffffffffffffffffffffffffffffff) - ) as VARBINARY - ) as VARCHAR - ), - '^(0x)?(00){12}' -- shrink hex to get address format (bytes20) - ) - ) as beneficiary, - 0 as partnerAndFee, - 0 as output_partnerShare, - 0 as output_paraswapShare, - 'swapExactAmountInOutOnMakerPSM' as method - FROM - {{ table_name }} - WHERE - call_success = TRUE - {% if is_incremental() %} - AND {{ incremental_predicate('call_block_time') }} - {% endif %} -{% endmacro %} \ No newline at end of file diff --git a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_rfq_method.sql b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_rfq_method.sql deleted file mode 100644 index 119f436fc74..00000000000 --- a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_rfq_method.sql +++ /dev/null @@ -1,33 +0,0 @@ -{% macro paraswap_v6_rfq_method(table_name) %} - SELECT - call_block_time, - call_block_number, - call_tx_hash, - contract_address as project_contract_address, - call_trace_address, - JSON_EXTRACT_SCALAR(JSON_EXTRACT_SCALAR(orders[1], '$.order'), '$.makerAsset') as srcToken, - JSON_EXTRACT_SCALAR(JSON_EXTRACT_SCALAR(orders[1], '$.order'), '$.takerAsset') as destToken, - try_cast( - JSON_EXTRACT_SCALAR(data, '$.fromAmount') as uint256 - ) AS fromAmount, - try_cast( - JSON_EXTRACT_SCALAR(data, '$.toAmount') as uint256 - ) AS toAmount, - try_cast( - JSON_EXTRACT_SCALAR(data, '$.toAmount') as uint256 - ) AS quotedAmount, - output_receivedAmount, - JSON_EXTRACT_SCALAR(data, '$.metadata') AS metadata, - JSON_EXTRACT_SCALAR(data, '$.beneficiary') AS beneficiary, - 0 as partnerAndFee, - 0 as output_partnerShare, - 0 as output_paraswapShare, - 'swapOnAugustusRFQTryBatchFill' as method - FROM - {{ table_name }} - WHERE - call_success = TRUE - {% if is_incremental() %} - AND {{ incremental_predicate('call_block_time') }} - {% endif %} -{% endmacro %} \ No newline at end of file diff --git a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_trades_master.sql b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_trades_master.sql index 260606a0541..9f1b6821212 100644 --- a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_trades_master.sql +++ b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_trades_master.sql @@ -9,12 +9,6 @@ swapExactAmountInOnCurveV1 as ({{ paraswap_v6_uniswaplike_method( source(project + '_' + blockchain, contract_name + '_call_swapExactAmountInOnCurveV1'), 'swapExactAmountInOnCurveV1', 'curveV1Data') }}), swapExactAmountInOnCurveV2 as ({{ paraswap_v6_uniswaplike_method( source(project + '_' + blockchain, contract_name + '_call_swapExactAmountInOnCurveV2'), 'swapExactAmountInOnCurveV2', 'curveV2Data') }}), swapExactAmountInOnBalancerV2 as ({{ paraswap_v6_balancer_v2_method('swapExactAmountInOnBalancerV2_decoded', 'swapExactAmountInOnBalancerV2_raw', source(project + '_' + blockchain, contract_name + '_call_swapExactAmountInOnBalancerV2'), 'in', 'swapExactAmountInOnBalancerV2') }}) - -- TODO: should be possible to improve this conditional code - {% if contract_details['version'] == '6.2' %} - ,swapOnAugustusRFQTryBatchFill as ({{ paraswap_v6_rfq_method( source(project + '_' + blockchain, contract_name + '_call_swapOnAugustusRFQTryBatchFill')) }}) -- RFQ - not distinguishing between buy/sell - ,swapExactAmountInOutOnMakerPSM as ({{ paraswap_v6_maker_psm_method( source(project + '_' + blockchain, contract_name + '_call_swapExactAmountInOutOnMakerPSM')) }}) -- Maker PSM - not distinguishing between buy/sell - {% endif %} - select *, fromAmount as spentAmount, @@ -50,11 +44,6 @@ from * from swapExactAmountInOnBalancerV2 - -- TODO: should be possible to improve this conditional code - {% if contract_details['version'] == '6.2' %} - union select * from swapOnAugustusRFQTryBatchFill - union select * from swapExactAmountInOutOnMakerPSM - {% endif %} ) ), buy_trades as ( @@ -112,9 +101,9 @@ select '{{ contract_details['version'] }}' as version, call_block_time as blockTime, call_block_number as blockNumber, - call_tx_hash as call_tx_hash, + call_tx_hash as txHash, project_contract_address as projectContractAddress, - call_trace_address as call_trace_address, + call_trace_address as callTraceAddress, srcToken, destToken, fromAmount, @@ -159,12 +148,12 @@ select "version": "6.1", }, "AugustusV6_2": { - "version": "6.2", + "version": "6.2", } } %} - {% for contract_name, contract_details in contracts.items() %} - select * from ({{ paraswap_v6_trades_by_contract(blockchain, project, contract_name, contract_details) }}) + {% for contract_name, contract_details in contracts.items() %} + select * from ({{ paraswap_v6_trades_by_contract(blockchain, project, contract_name, contract_details) }}) {% if not loop.last %} union all {% endif %} diff --git a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_uniswaplike_method.sql b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_uniswaplike_method.sql index b7e6cda0f48..260bf0a3b9a 100644 --- a/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_uniswaplike_method.sql +++ b/dbt_subprojects/dex/macros/models/_project/paraswap/v6/paraswap_v6_uniswaplike_method.sql @@ -3,7 +3,7 @@ call_block_time, call_block_number, call_tx_hash, - contract_address as project_contract_address, + contract_address as project_contract_address, call_trace_address, JSON_EXTRACT_SCALAR({{ data_field }}, '$.srcToken') AS srcToken, JSON_EXTRACT_SCALAR({{ data_field }}, '$.destToken') AS destToken, diff --git a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/_schema.yml index 18f71f9ec1e..dc8ed4ecbc6 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/_schema.yml @@ -190,28 +190,24 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime + - name: blockTime description: "Block time" - name: blockNumber description: "Block number" - - &call_tx_hash - name: call_tx_hash + - name: txHash description: "Transaction hash" - name: projectContractAddress description: "Project contract address" - - &call_trace_address - name: call_trace_address + - name: callTraceAddress description: "Call trace address" - name: srcToken description: "Source token" @@ -230,7 +226,9 @@ models: - name: metadata description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side description: "Side" - name: feeCode diff --git a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql index a7ccb18154e..bfd1a30fdda 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades.sql @@ -38,8 +38,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_arbitrum_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql index 502fc389f43..58dfde98db8 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/arbitrum/paraswap_v6_arbitrum_trades_decoded.sql @@ -6,7 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/_schema.yml index 586cda62507..2b6a8ccbabb 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/_schema.yml @@ -188,28 +188,24 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime + - name: blockTime description: "Block time" - name: blockNumber description: "Block number" - - &call_tx_hash - name: call_tx_hash + - name: txHash description: "Transaction hash" - name: projectContractAddress description: "Project contract address" - - &call_trace_address - name: call_trace_address + - name: callTraceAddress description: "Call trace address" - name: srcToken description: "Source token" @@ -228,7 +224,9 @@ models: - name: metadata description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side description: "Side" - name: feeCode diff --git a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql index b8dc4e9a1d2..dee67adc0da 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades.sql @@ -37,8 +37,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_avalanche_c_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql index 8115c77340e..6f85f1482d3 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/avalanche_c/paraswap_v6_avalanche_c_trades_decoded.sql @@ -6,8 +6,8 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) -}} +}} {{ paraswap_v6_trades_master('avalanche_c', 'paraswap') }} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/paraswap/base/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/base/_schema.yml index d764e310694..dd4834a5a30 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/base/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/base/_schema.yml @@ -188,49 +188,47 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime - description: "Block time" + - name: blockTime + description: "Block time" - name: blockNumber - description: "Block number" - - &call_tx_hash - name: call_tx_hash - description: "Transaction hash" + description: "Block number" + - name: txHash + description: "Transaction hash" - name: projectContractAddress - description: "Project contract address" - - &call_trace_address - name: call_trace_address - description: "Call trace address" + description: "Project contract address" + - name: callTraceAddress + description: "Call trace address" - name: srcToken - description: "Source token" + description: "Source token" - name: destToken - description: "Destination token" + description: "Destination token" - name: fromAmount - description: "From amount" + description: "From amount" - name: spentAmount - description: "Spent amount" + description: "Spent amount" - name: toAmount - description: "To amount" + description: "To amount" - name: quotedAmount - description: "Quoted amount" + description: "Quoted amount" - name: receivedAmount - description: "Received amount" + description: "Received amount" - name: metadata - description: "Metadata" + description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side - description: "Side" + description: "Side" - name: feeCode description: "Fee code" - name: partnerShare diff --git a/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades.sql index fb2d1e7737d..632af0177e7 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades.sql @@ -38,8 +38,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_base_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql index f8d2ea8f24b..f4fb95eb4de 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/base/paraswap_v6_base_trades_decoded.sql @@ -6,7 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/bnb/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/bnb/_schema.yml index ccac9987e48..8976c5176c8 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/bnb/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/bnb/_schema.yml @@ -237,28 +237,24 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime + - name: blockTime description: "Block time" - name: blockNumber description: "Block number" - - &call_tx_hash - name: call_tx_hash + - name: txHash description: "Transaction hash" - name: projectContractAddress description: "Project contract address" - - &call_trace_address - name: call_trace_address + - name: callTraceAddress description: "Call trace address" - name: srcToken description: "Source token" @@ -277,7 +273,9 @@ models: - name: metadata description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side description: "Side" - name: feeCode diff --git a/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades.sql index b7e28be89a6..92d21b1b6ca 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades.sql @@ -38,8 +38,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_bnb_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql index 594d41c2743..04ae429a54c 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/bnb/paraswap_v6_bnb_trades_decoded.sql @@ -6,7 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/_schema.yml index 64bf575ed79..312e8c69a76 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/_schema.yml @@ -239,28 +239,24 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime + - name: blockTime description: "Block time" - name: blockNumber description: "Block number" - - &call_tx_hash - name: call_tx_hash + - name: txHash description: "Transaction hash" - name: projectContractAddress description: "Project contract address" - - &call_trace_address - name: call_trace_address + - name: callTraceAddress description: "Call trace address" - name: srcToken description: "Source token" @@ -279,7 +275,9 @@ models: - name: metadata description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side description: "Side" - name: feeCode @@ -297,4 +295,3 @@ models: - name: isTakeSurplus description: "Is take surplus" - \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades.sql index 59c98c9969b..b95d4a64c02 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades.sql @@ -38,8 +38,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_ethereum_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql index eb2a0849ccc..fc42cf01ee9 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/ethereum/paraswap_v6_ethereum_trades_decoded.sql @@ -6,7 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/fantom/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/fantom/_schema.yml index 41bbe0b3bf0..2f59e23cb7d 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/fantom/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/fantom/_schema.yml @@ -187,28 +187,24 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime + - name: blockTime description: "Block time" - name: blockNumber description: "Block number" - - &call_tx_hash - name: call_tx_hash + - name: txHash description: "Transaction hash" - name: projectContractAddress description: "Project contract address" - - &call_trace_address - name: call_trace_address + - name: callTraceAddress description: "Call trace address" - name: srcToken description: "Source token" @@ -227,7 +223,9 @@ models: - name: metadata description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side description: "Side" - name: feeCode diff --git a/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades.sql index 3cb32be1118..3a66431f73b 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades.sql @@ -38,8 +38,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_fantom_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql index ef3047c2ff0..8ffa125b0c8 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/fantom/paraswap_v6_fantom_trades_decoded.sql @@ -6,7 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/optimism/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/optimism/_schema.yml index 0ba43c39039..1e183cc4a0b 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/optimism/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/optimism/_schema.yml @@ -187,28 +187,24 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime + - name: blockTime description: "Block time" - name: blockNumber description: "Block number" - - &call_tx_hash - name: call_tx_hash + - name: txHash description: "Transaction hash" - name: projectContractAddress description: "Project contract address" - - &call_trace_address - name: call_trace_address + - name: callTraceAddress description: "Call trace address" - name: srcToken description: "Source token" @@ -227,7 +223,9 @@ models: - name: metadata description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side description: "Side" - name: feeCode diff --git a/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades.sql index 9d96d316f7b..4b3b47806b2 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades.sql @@ -38,8 +38,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_optimism_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql index f9fec8cccdb..37e7cf62b96 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/optimism/paraswap_v6_optimism_trades_decoded.sql @@ -6,7 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) }} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/polygon/_schema.yml b/dbt_subprojects/dex/models/_projects/paraswap/polygon/_schema.yml index 5f78e7ae1ba..c85ea613fbd 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/polygon/_schema.yml +++ b/dbt_subprojects/dex/models/_projects/paraswap/polygon/_schema.yml @@ -236,28 +236,24 @@ models: description: "Paraswap V6 trades decoded" tests: - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - call_tx_hash + combination_of_columns: + - block_date + - blockchain + - project + - version + - txHash - method - - call_trace_address + - callTraceAddress columns: - - *blockchain - - *project - - *version - - *block_date - - *method - - &blockTime - name: blockTime + - name: blockTime description: "Block time" - name: blockNumber description: "Block number" - - &call_tx_hash - name: call_tx_hash + - name: txHash description: "Transaction hash" - name: projectContractAddress description: "Project contract address" - - &call_trace_address - name: call_trace_address + - name: callTraceAddress description: "Call trace address" - name: srcToken description: "Source token" @@ -276,7 +272,9 @@ models: - name: metadata description: "Metadata" - name: beneficiary - description: "Beneficiary" + description: "Beneficiary" + - name: method + description: "Method" - name: side description: "Side" - name: feeCode diff --git a/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades.sql b/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades.sql index b5b6641b8c5..fb83b6705ca 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades.sql @@ -37,8 +37,8 @@ with dexs AS ( ELSE from_hex(srcToken) END AS token_sold_address, projectContractAddress as project_contract_address, - call_tx_hash as tx_hash, - call_trace_address AS trace_address, + txHash AS tx_hash, + callTraceAddress AS trace_address, CAST(-1 as integer) AS evt_index FROM {{ ref('paraswap_v6_polygon_trades_decoded') }} {% if is_incremental() %} diff --git a/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql b/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql index ee56d154a6b..1078feabb9f 100644 --- a/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql +++ b/dbt_subprojects/dex/models/_projects/paraswap/polygon/paraswap_v6_polygon_trades_decoded.sql @@ -6,7 +6,7 @@ file_format = 'delta', incremental_strategy = 'merge', incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.blockTime')], - unique_key = ['call_tx_hash', 'method', 'call_trace_address'] + unique_key = ['block_date', 'blockchain', 'project', 'version', 'txHash', 'method', 'callTraceAddress'] ) }} diff --git a/sources/paraswap/arbitrum/paraswap_arbitrum_sources.yml b/sources/paraswap/arbitrum/paraswap_arbitrum_sources.yml index c1d4155c875..3d1a6994e48 100644 --- a/sources/paraswap/arbitrum/paraswap_arbitrum_sources.yml +++ b/sources/paraswap/arbitrum/paraswap_arbitrum_sources.yml @@ -57,7 +57,3 @@ sources: loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file diff --git a/sources/paraswap/avalanche_c/paraswap_avalanche_c_sources.yml b/sources/paraswap/avalanche_c/paraswap_avalanche_c_sources.yml index 3c7d0270692..f631fca0279 100644 --- a/sources/paraswap/avalanche_c/paraswap_avalanche_c_sources.yml +++ b/sources/paraswap/avalanche_c/paraswap_avalanche_c_sources.yml @@ -65,7 +65,4 @@ sources: loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file + \ No newline at end of file diff --git a/sources/paraswap/base/paraswap_base_sources.yml b/sources/paraswap/base/paraswap_base_sources.yml index 52e60b20b0a..59a84bb28bd 100644 --- a/sources/paraswap/base/paraswap_base_sources.yml +++ b/sources/paraswap/base/paraswap_base_sources.yml @@ -57,7 +57,3 @@ sources: loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file diff --git a/sources/paraswap/bnb/paraswap_bnb_sources.yml b/sources/paraswap/bnb/paraswap_bnb_sources.yml index c8cf28b0d76..02094a796c8 100644 --- a/sources/paraswap/bnb/paraswap_bnb_sources.yml +++ b/sources/paraswap/bnb/paraswap_bnb_sources.yml @@ -69,7 +69,3 @@ sources: loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file diff --git a/sources/paraswap/ethereum/paraswap_ethereum_sources.yml b/sources/paraswap/ethereum/paraswap_ethereum_sources.yml index 71a7f1f563d..450ba02e9ea 100644 --- a/sources/paraswap/ethereum/paraswap_ethereum_sources.yml +++ b/sources/paraswap/ethereum/paraswap_ethereum_sources.yml @@ -98,8 +98,4 @@ sources: - name: AugustusV6_2_call_swapExactAmountOutOnUniswapV3 loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file + loaded_at_field: call_block_time \ No newline at end of file diff --git a/sources/paraswap/fantom/paraswap_fantom_sources.yml b/sources/paraswap/fantom/paraswap_fantom_sources.yml index 3f84167b090..2a72152b09c 100644 --- a/sources/paraswap/fantom/paraswap_fantom_sources.yml +++ b/sources/paraswap/fantom/paraswap_fantom_sources.yml @@ -65,7 +65,4 @@ sources: loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file + diff --git a/sources/paraswap/optimism/paraswap_optimism_sources.yml b/sources/paraswap/optimism/paraswap_optimism_sources.yml index 68c1df9567b..275b75b480c 100644 --- a/sources/paraswap/optimism/paraswap_optimism_sources.yml +++ b/sources/paraswap/optimism/paraswap_optimism_sources.yml @@ -57,7 +57,3 @@ sources: loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file diff --git a/sources/paraswap/polygon/paraswap_polygon_sources.yml b/sources/paraswap/polygon/paraswap_polygon_sources.yml index 48e0af6fd7b..07ddb47853b 100644 --- a/sources/paraswap/polygon/paraswap_polygon_sources.yml +++ b/sources/paraswap/polygon/paraswap_polygon_sources.yml @@ -68,8 +68,4 @@ sources: - name: AugustusV6_2_call_swapExactAmountOutOnUniswapV3 loaded_at_field: call_block_time - name: AugustusV6_2_call_swapExactAmountOutOnBalancerV2 - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapOnAugustusRFQTryBatchFill - loaded_at_field: call_block_time - - name: AugustusV6_2_call_swapExactAmountInOutOnMakerPSM - loaded_at_field: call_block_time \ No newline at end of file + loaded_at_field: call_block_time \ No newline at end of file