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 {:name :paraswap
:full-name "ParaSwap" :full-name "ParaSwap"
:color :blue :color :blue
:contract-address "0xdef171fe48cf0115b1d80b88dc8eab59176fee57" :contract-address "0x6a000f20005980200259b80c5102003040001068"
:terms-and-conditions-url "https://files.paraswap.io/tos_v4.pdf"}) :terms-and-conditions-url "https://files.paraswap.io/tos_v4.pdf"})
(def ^:const swap-providers (def ^:const swap-providers
{:paraswap swap-provider-paraswap}) {:paraswap swap-provider-paraswap})

View File

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

View File

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