From 4257294c60d6a56c2377f3004bac1ba4859d2fa8 Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Wed, 24 Jul 2024 13:25:43 -0300 Subject: [PATCH] feat(wallet): upgrade paraswap api to v6.2 Closes #15755 --- .../main/wallet_section/activity/entry.nim | 4 ++-- src/app_service/common/wallet_constants.nim | 1 + .../Wallet/popups/swap/SwapApproveCapModal.qml | 2 +- ui/app/AppLayouts/Wallet/stores/RootStore.qml | 17 ++++++++++++----- ui/imports/utils/Constants.qml | 5 +++-- vendor/status-go | 2 +- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/app/modules/main/wallet_section/activity/entry.nim b/src/app/modules/main/wallet_section/activity/entry.nim index f1f8970e65..c49e663bf9 100644 --- a/src/app/modules/main/wallet_section/activity/entry.nim +++ b/src/app/modules/main/wallet_section/activity/entry.nim @@ -333,7 +333,7 @@ QtObject: # All Approvals triggered from the app will be to perform a swap on Paraswap proc getApprovalSpender*(self: ActivityEntry): string {.slot.} = if self.isMultiTransaction() and self.metadata.activityType == backend.ActivityType.Approve: - return PARASWAP_V5_APPROVE_CONTRACT_ADDRESS + return PARASWAP_V6_2_CONTRACT_ADDRESS return "" QtProperty[string] approvalSpender: @@ -346,7 +346,7 @@ QtObject: if self.isMultiTransaction() and self.metadata.activityType == backend.ActivityType.Swap and 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 "" QtProperty[string] interactedContractAddress: diff --git a/src/app_service/common/wallet_constants.nim b/src/app_service/common/wallet_constants.nim index 340f791434..217a1efacc 100644 --- a/src/app_service/common/wallet_constants.nim +++ b/src/app_service/common/wallet_constants.nim @@ -12,3 +12,4 @@ const 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_V6_2_CONTRACT_ADDRESS* = "0x6a000f20005980200259b80c5102003040001068" # Same address for all supported chains diff --git a/ui/app/AppLayouts/Wallet/popups/swap/SwapApproveCapModal.qml b/ui/app/AppLayouts/Wallet/popups/swap/SwapApproveCapModal.qml index e87343fe17..296903a017 100644 --- a/ui/app/AppLayouts/Wallet/popups/swap/SwapApproveCapModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/swap/SwapApproveCapModal.qml @@ -45,7 +45,7 @@ SignTransactionModalBase { property string serviceProviderHostname: Constants.swap.paraswapHostname property string serviceProviderTandCUrl: Constants.swap.paraswapTermsAndConditionUrl 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 title: qsTr("Approve spending cap") diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml index f3bb39ae6d..239c02fba6 100644 --- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml @@ -568,16 +568,23 @@ QtObject { // TODO: https://github.com/status-im/status-desktop/issues/15329 // Get DApp data from the backend function getDappDetails(chainId, contractAddress) { - console.log("getDappDetails", chainId, contractAddress) switch (contractAddress) { - case Constants.swap.paraswapApproveContractAddress: - case Constants.swap.paraswapSwapContractAddress: + case Constants.swap.paraswapV5ApproveContractAddress: + case Constants.swap.paraswapV5SwapContractAddress: return { "icon": Style.png("swap/%1".arg(Constants.swap.paraswapIcon)), "url": Constants.swap.paraswapHostname, "name": Constants.swap.paraswapName, - "approvalContractAddress": Constants.swap.paraswapContractAddress, - "swapContractAddress": Constants.swap.paraswapContractAddress, + "approvalContractAddress": Constants.swap.paraswapV5ApproveContractAddress, + "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 diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml index d2226d7311..66e52b9e61 100644 --- a/ui/imports/utils/Constants.qml +++ b/ui/imports/utils/Constants.qml @@ -1439,8 +1439,9 @@ QtObject { readonly property string paraswapIcon: "paraswap" readonly property string paraswapHostname: "app.paraswap.io" readonly property string paraswapUrl: "https://www.paraswap.io/" - readonly property string paraswapApproveContractAddress: "0x216B4B4Ba9F3e719726886d34a177484278Bfcae" - readonly property string paraswapSwapContractAddress: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57" + readonly property string paraswapV5ApproveContractAddress: "0x216B4B4Ba9F3e719726886d34a177484278Bfcae" + readonly property string paraswapV5SwapContractAddress: "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57" + readonly property string paraswapV6_2ContractAddress: "0x6a000f20005980200259b80c5102003040001068" readonly property string paraswapTermsAndConditionUrl: "https://files.paraswap.io/tos_v4.pdf" // TOOD #15874: Unify with WalletUtils router error code handling diff --git a/vendor/status-go b/vendor/status-go index 9b9a91f654..0809c0b156 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 9b9a91f654dbfb9a0e4b46964ed766c6bbbe45d0 +Subproject commit 0809c0b156f93c694854009da5357a80db96c834