Skip to content

Commit ae98012

Browse files
authored
Zero values can be send via Status (Sepolia) network (#22632)
* 0 values can be send via Status (Sepolia) network status-im/status-go@41a1d4b...658d142 * bump version
1 parent cd6ec30 commit ae98012

File tree

5 files changed

+21
-25
lines changed

5 files changed

+21
-25
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.34.0
1+
2.34.1

src/status_im/contexts/wallet/common/utils/networks.cljs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns status-im.contexts.wallet.common.utils.networks
22
(:require
33
[clojure.string :as string]
4+
[status-im.contexts.wallet.networks.config :as networks.config]
45
[utils.money :as money]
56
[utils.number]))
67

@@ -14,11 +15,22 @@
1415
networks))))
1516
set))
1617

18+
(defn balance-is-sufficient-to-use-chain
19+
"Status network can operate with zero balance, for other networks we check if balance is greater than zero"
20+
[[chain-id {:keys [raw-balance]}]]
21+
(if (= chain-id networks.config/status-sepolia-chain-id)
22+
true
23+
(money/above-zero? raw-balance)))
24+
25+
(defn filter-out-chains-with-insufficient-balance
26+
[balances-per-chain]
27+
(filter balance-is-sufficient-to-use-chain balances-per-chain))
28+
1729
(defn network-list-with-positive-balance
1830
"Same as `network-list`, but only returns the networks that have a positive token balance"
1931
[{:keys [balances-per-chain] :as token} networks]
2032
(as-> balances-per-chain $
21-
(filter #(-> % second :raw-balance money/above-zero?) $)
33+
(filter-out-chains-with-insufficient-balance $)
2234
(assoc token :balances-per-chain $)
2335
(network-list $ networks)))
2436

src/status_im/contexts/wallet/data_store.cljs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@
235235

236236
(defn new->old-route-path
237237
[new-path]
238-
(tap> {:new-path (-> new-path
239-
(dissoc :to-chain)
240-
(dissoc :from-chain))})
241238
(let [to-bignumber (fn [k] (-> new-path k money/bignumber))]
242239
{:approval-fee (to-bignumber :approval-fee)
243240
:approval-l-1-fee (to-bignumber :approval-l-1-fee)
@@ -307,7 +304,7 @@
307304
amount-in :amount-in}]
308305
(let [bonder-fees (utils.money/token->unit bonder-fees token-decimals)
309306
amount-to-bridge (utils.money/token->unit amount-in token-decimals)]
310-
(> amount-to-bridge bonder-fees)))
307+
(>= amount-to-bridge bonder-fees)))
311308

312309
(defn- remove-multichain-routes
313310
[routes]

src/status_im/contexts/wallet/send/input_amount/view.cljs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,9 @@
7171
:else (rf/dispatch [:wallet/stop-and-clean-suggested-routes])))
7272

7373
(defn- insufficient-asset-amount?
74-
[{:keys [token-symbol native-token input-state limit-exceeded? enough-assets?]}]
75-
(let [native-token-selected? (= token-symbol (:symbol native-token))
76-
zero-owned-native-token? (money/equal-to (:total-balance native-token) 0)
77-
input-at-max-owned-amount? (money/equal-to
78-
(controlled-input/value-bn input-state)
79-
(controlled-input/upper-limit-bn input-state))
80-
exceeded-input? (if native-token-selected?
81-
input-at-max-owned-amount?
82-
zero-owned-native-token?)]
83-
(or exceeded-input?
84-
limit-exceeded?
85-
(false? enough-assets?))))
74+
[{:keys [limit-exceeded? enough-assets?]}]
75+
(or limit-exceeded?
76+
(false? enough-assets?)))
8677

8778
(defn view
8879
;; crypto-decimals, limit-crypto and initial-crypto-currency? args are needed
@@ -135,7 +126,6 @@
135126
(money/crypto->fiat token-balance conversion-rate)))
136127
input-value (controlled-input/input-value input-state)
137128
valid-input? (not (or (controlled-input/empty-value? input-state)
138-
(controlled-input/zero-or-negative-value? input-state)
139129
(controlled-input/input-error input-state)))
140130
amount-in-crypto (if crypto-currency?
141131
input-value
@@ -151,9 +141,6 @@
151141
limit-exceeded? (controlled-input/upper-limit-exceeded? input-state)
152142
not-enough-asset? (insufficient-asset-amount?
153143
{:enough-assets? enough-assets?
154-
:token-symbol token-symbol
155-
:native-token native-token
156-
:input-state input-state
157144
:limit-exceeded? limit-exceeded?})
158145
should-try-again? (and (not limit-exceeded?)
159146
no-routes-found?

status-go-version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
44
"owner": "status-im",
55
"repo": "status-go",
6-
"version": "v10.29.3",
7-
"commit-sha1": "ccefc04f132f76ee4f4a2f56ec3b739d0e32356b",
8-
"src-sha256": "1yh0wsgkmpyn8xyrm1zm5ivli4hnzix27a1c6y0rppslfc04533n"
6+
"version": "v10.29.4",
7+
"commit-sha1": "658d142d1664c87b9610e7ee8babf79827bc3a20",
8+
"src-sha256": "1zcgrcfmy9qr5k558r66lh8wg4ma36zcgjgcmf1vzz7wablk9k2d"
99
}

0 commit comments

Comments
 (0)