feat(wallet): upgrade paraswap api to v6.2

Closes #15755
This commit is contained in:
Dario Gabriel Lipicar 2024-07-24 13:25:43 -03:00 committed by dlipicar
parent 087c3c6088
commit 4257294c60
6 changed files with 20 additions and 11 deletions

View File

@ -333,7 +333,7 @@ QtObject:
# All Approvals triggered from the app will be to perform a swap on Paraswap # All Approvals triggered from the app will be to perform a swap on Paraswap
proc getApprovalSpender*(self: ActivityEntry): string {.slot.} = proc getApprovalSpender*(self: ActivityEntry): string {.slot.} =
if self.isMultiTransaction() and self.metadata.activityType == backend.ActivityType.Approve: if self.isMultiTransaction() and self.metadata.activityType == backend.ActivityType.Approve:
return PARASWAP_V5_APPROVE_CONTRACT_ADDRESS return PARASWAP_V6_2_CONTRACT_ADDRESS
return "" return ""
QtProperty[string] approvalSpender: QtProperty[string] approvalSpender:
@ -346,7 +346,7 @@ QtObject:
if self.isMultiTransaction() and if self.isMultiTransaction() and
self.metadata.activityType == backend.ActivityType.Swap and self.metadata.activityType == backend.ActivityType.Swap and
self.getChainIdIn() == 0: # Differentiate between Swaps triggered from the app and external detected Swaps self.getChainIdIn() == 0: # Differentiate between Swaps triggered from the app and external detected Swaps
return PARASWAP_V5_SWAP_CONTRACT_ADDRESS return PARASWAP_V6_2_CONTRACT_ADDRESS
return "" return ""
QtProperty[string] interactedContractAddress: QtProperty[string] interactedContractAddress:

View File

@ -12,3 +12,4 @@ const
PARASWAP_V5_APPROVE_CONTRACT_ADDRESS* = "0x216B4B4Ba9F3e719726886d34a177484278Bfcae" # Same address for all supported chains PARASWAP_V5_APPROVE_CONTRACT_ADDRESS* = "0x216B4B4Ba9F3e719726886d34a177484278Bfcae" # Same address for all supported chains
PARASWAP_V5_SWAP_CONTRACT_ADDRESS* = "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57" # Same address for all supported chains PARASWAP_V5_SWAP_CONTRACT_ADDRESS* = "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57" # Same address for all supported chains
PARASWAP_V6_2_CONTRACT_ADDRESS* = "0x6a000f20005980200259b80c5102003040001068" # Same address for all supported chains

View File

@ -45,7 +45,7 @@ SignTransactionModalBase {
property string serviceProviderHostname: Constants.swap.paraswapHostname property string serviceProviderHostname: Constants.swap.paraswapHostname
property string serviceProviderTandCUrl: Constants.swap.paraswapTermsAndConditionUrl property string serviceProviderTandCUrl: Constants.swap.paraswapTermsAndConditionUrl
property string serviceProviderURL: Constants.swap.paraswapUrl // TODO https://github.com/status-im/status-desktop/issues/15329 property string serviceProviderURL: Constants.swap.paraswapUrl // TODO https://github.com/status-im/status-desktop/issues/15329
property string serviceProviderContractAddress: Constants.swap.paraswapApproveContractAddress property string serviceProviderContractAddress: Constants.swap.paraswapV6_2ContractAddress
property string serviceProviderIcon: Style.png("swap/%1".arg(Constants.swap.paraswapIcon)) // FIXME svg property string serviceProviderIcon: Style.png("swap/%1".arg(Constants.swap.paraswapIcon)) // FIXME svg
title: qsTr("Approve spending cap") title: qsTr("Approve spending cap")

View File

@ -568,16 +568,23 @@ QtObject {
// TODO: https://github.com/status-im/status-desktop/issues/15329 // TODO: https://github.com/status-im/status-desktop/issues/15329
// Get DApp data from the backend // Get DApp data from the backend
function getDappDetails(chainId, contractAddress) { function getDappDetails(chainId, contractAddress) {
console.log("getDappDetails", chainId, contractAddress)
switch (contractAddress) { switch (contractAddress) {
case Constants.swap.paraswapApproveContractAddress: case Constants.swap.paraswapV5ApproveContractAddress:
case Constants.swap.paraswapSwapContractAddress: case Constants.swap.paraswapV5SwapContractAddress:
return { return {
"icon": Style.png("swap/%1".arg(Constants.swap.paraswapIcon)), "icon": Style.png("swap/%1".arg(Constants.swap.paraswapIcon)),
"url": Constants.swap.paraswapHostname, "url": Constants.swap.paraswapHostname,
"name": Constants.swap.paraswapName, "name": Constants.swap.paraswapName,
"approvalContractAddress": Constants.swap.paraswapContractAddress, "approvalContractAddress": Constants.swap.paraswapV5ApproveContractAddress,
"swapContractAddress": Constants.swap.paraswapContractAddress, "swapContractAddress": Constants.swap.paraswapV5SwapContractAddress,
}
case Constants.swap.paraswapV6_2ContractAddress:
return {
"icon": Style.png("swap/%1".arg(Constants.swap.paraswapIcon)),
"url": Constants.swap.paraswapUrl,
"name": Constants.swap.paraswapName,
"approvalContractAddress": Constants.swap.paraswapV6_2ContractAddress,
"swapContractAddress": Constants.swap.paraswapV6_2ContractAddress,
} }
} }
return undefined return undefined

View File

@ -1439,8 +1439,9 @@ QtObject {
readonly property string paraswapIcon: "paraswap" readonly property string paraswapIcon: "paraswap"
readonly property string paraswapHostname: "app.paraswap.io" readonly property string paraswapHostname: "app.paraswap.io"
readonly property string paraswapUrl: "https://www.paraswap.io/" readonly property string paraswapUrl: "https://www.paraswap.io/"
readonly property string paraswapApproveContractAddress: "0x216B4B4Ba9F3e719726886d34a177484278Bfcae" readonly property string paraswapV5ApproveContractAddress: "0x216B4B4Ba9F3e719726886d34a177484278Bfcae"
readonly property string paraswapSwapContractAddress: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57" readonly property string paraswapV5SwapContractAddress: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57"
readonly property string paraswapV6_2ContractAddress: "0x6a000f20005980200259b80c5102003040001068"
readonly property string paraswapTermsAndConditionUrl: "https://files.paraswap.io/tos_v4.pdf" readonly property string paraswapTermsAndConditionUrl: "https://files.paraswap.io/tos_v4.pdf"
// TOOD #15874: Unify with WalletUtils router error code handling // TOOD #15874: Unify with WalletUtils router error code handling

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 9b9a91f654dbfb9a0e4b46964ed766c6bbbe45d0 Subproject commit 0809c0b156f93c694854009da5357a80db96c834