@gearbox-protocol/sdk 11.1.2 → 11.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,11 +26,11 @@ class PriceFeedAnswerMap extends import_utils.AddressMap {
|
|
|
26
26
|
price(token) {
|
|
27
27
|
const answer = this.get(token);
|
|
28
28
|
if (!answer) {
|
|
29
|
-
throw new Error(`no answer found`);
|
|
29
|
+
throw new Error(`no answer found for token ${token}`);
|
|
30
30
|
}
|
|
31
31
|
const { success, price } = answer;
|
|
32
32
|
if (!success) {
|
|
33
|
-
throw new Error(`answer is not successful`);
|
|
33
|
+
throw new Error(`answer (${price}) is not successful for token ${token}`);
|
|
34
34
|
}
|
|
35
35
|
return price;
|
|
36
36
|
}
|
|
@@ -33,7 +33,11 @@ function isDust(opts) {
|
|
|
33
33
|
try {
|
|
34
34
|
balanceUSD = priceOracle.convertToUSD(token, balance);
|
|
35
35
|
} catch {
|
|
36
|
-
|
|
36
|
+
try {
|
|
37
|
+
balanceUSD = priceOracle.convertToUSD(token, balance, true);
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
return balanceUSD < minBalanceUSD;
|
|
39
43
|
}
|
|
@@ -3,11 +3,11 @@ class PriceFeedAnswerMap extends AddressMap {
|
|
|
3
3
|
price(token) {
|
|
4
4
|
const answer = this.get(token);
|
|
5
5
|
if (!answer) {
|
|
6
|
-
throw new Error(`no answer found`);
|
|
6
|
+
throw new Error(`no answer found for token ${token}`);
|
|
7
7
|
}
|
|
8
8
|
const { success, price } = answer;
|
|
9
9
|
if (!success) {
|
|
10
|
-
throw new Error(`answer is not successful`);
|
|
10
|
+
throw new Error(`answer (${price}) is not successful for token ${token}`);
|
|
11
11
|
}
|
|
12
12
|
return price;
|
|
13
13
|
}
|
|
@@ -10,7 +10,11 @@ function isDust(opts) {
|
|
|
10
10
|
try {
|
|
11
11
|
balanceUSD = priceOracle.convertToUSD(token, balance);
|
|
12
12
|
} catch {
|
|
13
|
-
|
|
13
|
+
try {
|
|
14
|
+
balanceUSD = priceOracle.convertToUSD(token, balance, true);
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
return balanceUSD < minBalanceUSD;
|
|
16
20
|
}
|