Skip to content

Commit

Permalink
Revert "add paraswap v6.2 methods: swapOnAugustusRFQTryBatchFill, swa…
Browse files Browse the repository at this point in the history
…pExactAm… (duneanalytics#6420)" (duneanalytics#6504)

This reverts commit 9830038.
  • Loading branch information
jeff-dude authored Aug 5, 2024
1 parent fd4edd7 commit c2a9c31
Show file tree
Hide file tree
Showing 37 changed files with 185 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 13 additions & 15 deletions dbt_subprojects/dex/models/_projects/paraswap/arbitrum/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']
)
}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Loading

0 comments on commit c2a9c31

Please sign in to comment.