fix(wallet)_: Paraswap contract address (#21635)

This commit fixes ParaSwap contract address displayed on the setting approval cap for a token.

Since we get the approval contract address in the swap proposal, we take that as higher precedence over the hardcoded value in the constants file

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2024-11-19 17:52:57 +05:30 committed by GitHub
parent e6f290c06a
commit a1e3bb3bd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 7 deletions

View File

@ -605,7 +605,7 @@
{:name :paraswap
:full-name "ParaSwap"
:color :blue
:contract-address "0xdef171fe48cf0115b1d80b88dc8eab59176fee57"
:contract-address "0x6a000f20005980200259b80c5102003040001068"
:terms-and-conditions-url "https://files.paraswap.io/tos_v4.pdf"})
(def ^:const swap-providers
{:paraswap swap-provider-paraswap})

View File

@ -148,10 +148,12 @@
(defn- spender-contract-section
[]
(let [theme (quo.theme/use-theme)
network (rf/sub [:wallet/swap-network])
provider (rf/sub [:wallet/swap-proposal-provider])
network-chain-id (:chain-id network)]
(let [theme (quo.theme/use-theme)
network (rf/sub [:wallet/swap-network])
provider (rf/sub [:wallet/swap-proposal-provider])
spender-contract-address (or (rf/sub [:wallet/swap-proposal-approval-contract-address])
(:contract-address provider))
network-chain-id (:chain-id network)]
[rn/view {:style style/summary-section-container}
[quo/text
{:size :paragraph-2
@ -164,10 +166,10 @@
{:type :token-contract
:option-icon :i/options
:on-option-press #(on-option-press {:chain-id network-chain-id
:contract-address (:contract-address provider)})
:contract-address spender-contract-address})
:unlimited-icon? false
:label (:full-name provider)
:description (address-utils/get-short-wallet-address (:contract-address provider))
:description (address-utils/get-short-wallet-address spender-contract-address)
:avatar-props {:image (resources/get-network (:name provider))}}])]))
(defn- data-item

View File

@ -227,6 +227,11 @@
:<- [:wallet/swap-proposal]
:-> :approval-required)
(rf/reg-sub
:wallet/swap-proposal-approval-contract-address
:<- [:wallet/swap-proposal]
:-> :approval-contract-address)
(rf/reg-sub
:wallet/swap-proposal-approval-amount-required
:<- [:wallet/swap-proposal]