@curvefi/api 2.24.4 → 2.25.0
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.
- package/README.md +11 -2
- package/lib/constants/abis/eure/swap.json +1201 -0
- package/lib/constants/abis/eure/zap.json +268 -0
- package/lib/constants/pools/xdai.js +32 -0
- package/lib/pools/PoolTemplate.d.ts +1 -0
- package/lib/pools/PoolTemplate.js +38 -10
- package/lib/router.js +10 -2
- package/package.json +1 -1
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"name": "pool",
|
|
6
|
+
"type": "address"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"name": "base_pool",
|
|
10
|
+
"type": "address"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"outputs": [],
|
|
14
|
+
"stateMutability": "nonpayable",
|
|
15
|
+
"type": "constructor",
|
|
16
|
+
"name": "constructor"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"inputs": [
|
|
20
|
+
{
|
|
21
|
+
"name": "i",
|
|
22
|
+
"type": "uint256"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"name": "coins",
|
|
26
|
+
"outputs": [
|
|
27
|
+
{
|
|
28
|
+
"name": "",
|
|
29
|
+
"type": "address"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"stateMutability": "view",
|
|
33
|
+
"type": "function"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"inputs": [
|
|
37
|
+
{
|
|
38
|
+
"name": "i",
|
|
39
|
+
"type": "uint256"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"name": "underlying_coins",
|
|
43
|
+
"outputs": [
|
|
44
|
+
{
|
|
45
|
+
"name": "",
|
|
46
|
+
"type": "address"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"stateMutability": "view",
|
|
50
|
+
"type": "function"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"inputs": [],
|
|
54
|
+
"name": "pool",
|
|
55
|
+
"outputs": [
|
|
56
|
+
{
|
|
57
|
+
"name": "",
|
|
58
|
+
"type": "address"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"stateMutability": "view",
|
|
62
|
+
"type": "function"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"inputs": [],
|
|
66
|
+
"name": "base_pool",
|
|
67
|
+
"outputs": [
|
|
68
|
+
{
|
|
69
|
+
"name": "",
|
|
70
|
+
"type": "address"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"stateMutability": "view",
|
|
74
|
+
"type": "function"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"inputs": [],
|
|
78
|
+
"name": "token",
|
|
79
|
+
"outputs": [
|
|
80
|
+
{
|
|
81
|
+
"name": "",
|
|
82
|
+
"type": "address"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"stateMutability": "view",
|
|
86
|
+
"type": "function"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"inputs": [],
|
|
90
|
+
"name": "price_oracle",
|
|
91
|
+
"outputs": [
|
|
92
|
+
{
|
|
93
|
+
"name": "",
|
|
94
|
+
"type": "uint256"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"stateMutability": "view",
|
|
98
|
+
"type": "function"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [],
|
|
102
|
+
"name": "price_scale",
|
|
103
|
+
"outputs": [
|
|
104
|
+
{
|
|
105
|
+
"name": "",
|
|
106
|
+
"type": "uint256"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"stateMutability": "view",
|
|
110
|
+
"type": "function"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"inputs": [],
|
|
114
|
+
"name": "lp_price",
|
|
115
|
+
"outputs": [
|
|
116
|
+
{
|
|
117
|
+
"name": "",
|
|
118
|
+
"type": "uint256"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"stateMutability": "view",
|
|
122
|
+
"type": "function"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"inputs": [
|
|
126
|
+
{
|
|
127
|
+
"name": "_amounts",
|
|
128
|
+
"type": "uint256[4]"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "_min_mint_amount",
|
|
132
|
+
"type": "uint256"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"name": "add_liquidity",
|
|
136
|
+
"outputs": [],
|
|
137
|
+
"stateMutability": "nonpayable",
|
|
138
|
+
"type": "function"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"inputs": [
|
|
142
|
+
{
|
|
143
|
+
"name": "i",
|
|
144
|
+
"type": "uint256"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "j",
|
|
148
|
+
"type": "uint256"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "_dx",
|
|
152
|
+
"type": "uint256"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "_min_dy",
|
|
156
|
+
"type": "uint256"
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"name": "exchange_underlying",
|
|
160
|
+
"outputs": [
|
|
161
|
+
{
|
|
162
|
+
"name": "",
|
|
163
|
+
"type": "uint256"
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"stateMutability": "nonpayable",
|
|
167
|
+
"type": "function"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"inputs": [
|
|
171
|
+
{
|
|
172
|
+
"name": "_amount",
|
|
173
|
+
"type": "uint256"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "_min_amounts",
|
|
177
|
+
"type": "uint256[4]"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"name": "remove_liquidity",
|
|
181
|
+
"outputs": [],
|
|
182
|
+
"stateMutability": "nonpayable",
|
|
183
|
+
"type": "function"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"inputs": [
|
|
187
|
+
{
|
|
188
|
+
"name": "_token_amount",
|
|
189
|
+
"type": "uint256"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "i",
|
|
193
|
+
"type": "uint256"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "_min_amount",
|
|
197
|
+
"type": "uint256"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"name": "remove_liquidity_one_coin",
|
|
201
|
+
"outputs": [],
|
|
202
|
+
"stateMutability": "nonpayable",
|
|
203
|
+
"type": "function"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"inputs": [
|
|
207
|
+
{
|
|
208
|
+
"name": "i",
|
|
209
|
+
"type": "uint256"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "j",
|
|
213
|
+
"type": "uint256"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "_dx",
|
|
217
|
+
"type": "uint256"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"name": "get_dy_underlying",
|
|
221
|
+
"outputs": [
|
|
222
|
+
{
|
|
223
|
+
"name": "",
|
|
224
|
+
"type": "uint256"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"stateMutability": "view",
|
|
228
|
+
"type": "function"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"inputs": [
|
|
232
|
+
{
|
|
233
|
+
"name": "_amounts",
|
|
234
|
+
"type": "uint256[4]"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"name": "calc_token_amount",
|
|
238
|
+
"outputs": [
|
|
239
|
+
{
|
|
240
|
+
"name": "",
|
|
241
|
+
"type": "uint256"
|
|
242
|
+
}
|
|
243
|
+
],
|
|
244
|
+
"stateMutability": "view",
|
|
245
|
+
"type": "function"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"inputs": [
|
|
249
|
+
{
|
|
250
|
+
"name": "token_amount",
|
|
251
|
+
"type": "uint256"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"name": "i",
|
|
255
|
+
"type": "uint256"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"name": "calc_withdraw_one_coin",
|
|
259
|
+
"outputs": [
|
|
260
|
+
{
|
|
261
|
+
"name": "",
|
|
262
|
+
"type": "uint256"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"stateMutability": "view",
|
|
266
|
+
"type": "function"
|
|
267
|
+
}
|
|
268
|
+
]
|
|
@@ -9,6 +9,8 @@ var swap_json_2 = __importDefault(require("../abis/rai/swap.json"));
|
|
|
9
9
|
var deposit_json_1 = __importDefault(require("../abis/rai/deposit.json"));
|
|
10
10
|
var swap_json_3 = __importDefault(require("../abis/tricrypto-xdai/swap.json"));
|
|
11
11
|
var zap_json_1 = __importDefault(require("../abis/tricrypto-xdai/zap.json"));
|
|
12
|
+
var swap_json_4 = __importDefault(require("../abis/eure/swap.json"));
|
|
13
|
+
var zap_json_2 = __importDefault(require("../abis/eure/zap.json"));
|
|
12
14
|
var gauge_rewards_only_json_1 = __importDefault(require("../abis/gauge_rewards_only.json"));
|
|
13
15
|
var gauge_child_json_1 = __importDefault(require("../abis/gauge_child.json"));
|
|
14
16
|
var streamer_json_1 = __importDefault(require("../abis/streamer.json"));
|
|
@@ -103,4 +105,34 @@ exports.POOLS_DATA_XDAI = (0, utils_1.lowerCasePoolDataAddresses)({
|
|
|
103
105
|
gauge_abi: gauge_rewards_only_json_1.default,
|
|
104
106
|
deposit_abi: zap_json_1.default,
|
|
105
107
|
},
|
|
108
|
+
eure: {
|
|
109
|
+
name: "eure",
|
|
110
|
+
full_name: "eure",
|
|
111
|
+
symbol: "eure",
|
|
112
|
+
reference_asset: 'CRYPTO',
|
|
113
|
+
swap_address: '0x0F6565DF9a25aA057Ddc65Dbc78804087665764B',
|
|
114
|
+
token_address: '0x5A6dBE2c3746aB927c214D751cBb36f1512F6100',
|
|
115
|
+
gauge_address: '0x0000000000000000000000000000000000000000',
|
|
116
|
+
deposit_address: '0x3D1a8cc1894340c3E60e0f7D7A10b9efB490dC74',
|
|
117
|
+
is_meta: true,
|
|
118
|
+
is_crypto: true,
|
|
119
|
+
base_pool: '3pool',
|
|
120
|
+
underlying_coins: ['EURe', 'DAI', 'USDC', 'USDT'],
|
|
121
|
+
wrapped_coins: ['EURe', '3Crv'],
|
|
122
|
+
underlying_coin_addresses: [
|
|
123
|
+
'0xcB444e90D8198415266c6a2724b7900fb12FC56E',
|
|
124
|
+
'0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
|
|
125
|
+
'0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83',
|
|
126
|
+
'0x4ECaBa5870353805a9F068101A40E0f32ed605C6',
|
|
127
|
+
],
|
|
128
|
+
wrapped_coin_addresses: [
|
|
129
|
+
'0xcB444e90D8198415266c6a2724b7900fb12FC56E',
|
|
130
|
+
'0x1337BedC9D22ecbe766dF105c9623922A27963EC',
|
|
131
|
+
],
|
|
132
|
+
underlying_decimals: [18, 18, 6, 6],
|
|
133
|
+
wrapped_decimals: [18, 18],
|
|
134
|
+
swap_abi: swap_json_4.default,
|
|
135
|
+
gauge_abi: gauge_rewards_only_json_1.default,
|
|
136
|
+
deposit_abi: zap_json_2.default,
|
|
137
|
+
},
|
|
106
138
|
});
|
|
@@ -102,6 +102,7 @@ export declare class PoolTemplate {
|
|
|
102
102
|
private _calcLpTokenAmount;
|
|
103
103
|
private calcLpTokenAmount;
|
|
104
104
|
private calcLpTokenAmountWrapped;
|
|
105
|
+
metaUnderlyingSeedAmounts(amount1: number | string): string[];
|
|
105
106
|
cryptoSeedAmounts(amount1: number | string): Promise<string[]>;
|
|
106
107
|
depositBalancedAmounts(): Promise<string[]>;
|
|
107
108
|
depositExpected(amounts: (number | string)[]): Promise<string>;
|
|
@@ -282,7 +282,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
282
282
|
this.statsTokenApy = function (useApi) {
|
|
283
283
|
if (useApi === void 0) { useApi = true; }
|
|
284
284
|
return __awaiter(_this, void 0, void 0, function () {
|
|
285
|
-
var dontUseApi, crvAPYs, poolCrvApy, totalLiquidityUSD, inflationRateBN, workingSupplyBN, totalSupplyBN, gaugeContract, lpTokenContract, crvContract, currentWeek, _c, gaugeContract, lpTokenContract, gaugeControllerContract, weightBN, rateBN, crvPrice, baseApyBN, boostedApyBN;
|
|
285
|
+
var isDisabledChain, dontUseApi, crvAPYs, poolCrvApy, totalLiquidityUSD, inflationRateBN, workingSupplyBN, totalSupplyBN, gaugeContract, lpTokenContract, crvContract, currentWeek, _c, gaugeContract, lpTokenContract, gaugeControllerContract, weightBN, rateBN, crvPrice, baseApyBN, boostedApyBN;
|
|
286
286
|
var _d, _e;
|
|
287
287
|
var _f;
|
|
288
288
|
return __generator(this, function (_g) {
|
|
@@ -290,7 +290,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
290
290
|
case 0:
|
|
291
291
|
if (this.rewardsOnly())
|
|
292
292
|
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use stats.rewardsApy instead"));
|
|
293
|
-
|
|
293
|
+
isDisabledChain = [1284, 2222, 42220, 1313161554].includes(curve_1.curve.chainId);
|
|
294
|
+
dontUseApi = (curve_1.curve.chainId === 250 && this.id === 'factory-v2-42') || (curve_1.curve.chainId === 42161 && this.id === 'ren') || isDisabledChain;
|
|
294
295
|
if (!(useApi && !dontUseApi)) return [3 /*break*/, 2];
|
|
295
296
|
return [4 /*yield*/, (0, utils_1._getCrvApyFromApi)()];
|
|
296
297
|
case 1:
|
|
@@ -353,13 +354,14 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
353
354
|
this.statsRewardsApy = function (useApi) {
|
|
354
355
|
if (useApi === void 0) { useApi = true; }
|
|
355
356
|
return __awaiter(_this, void 0, void 0, function () {
|
|
356
|
-
var dontUseApi, rewards, apy, rewardTokens, _i, rewardTokens_1, rewardToken, contract, totalLiquidityUSD, rewardRate, rewardData, periodFinish, inflation, baseApy;
|
|
357
|
+
var isDisabledChain, dontUseApi, rewards, apy, rewardTokens, _i, rewardTokens_1, rewardToken, contract, totalLiquidityUSD, rewardRate, rewardData, periodFinish, inflation, baseApy;
|
|
357
358
|
return __generator(this, function (_c) {
|
|
358
359
|
switch (_c.label) {
|
|
359
360
|
case 0:
|
|
360
361
|
if (this.gauge === ethers_1.ethers.constants.AddressZero)
|
|
361
362
|
return [2 /*return*/, []];
|
|
362
|
-
|
|
363
|
+
isDisabledChain = [1284, 2222, 42220, 1313161554].includes(curve_1.curve.chainId);
|
|
364
|
+
dontUseApi = (curve_1.curve.chainId === 10 && this.id === 'factory-v2-0') || (curve_1.curve.chainId === 1284 && this.id === 'factory-v2-14') || isDisabledChain;
|
|
363
365
|
if (!(curve_1.curve.chainId === 1 || (useApi && !dontUseApi))) return [3 /*break*/, 2];
|
|
364
366
|
return [4 /*yield*/, (0, utils_1._getRewardsFromApi)()];
|
|
365
367
|
case 1:
|
|
@@ -409,7 +411,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
409
411
|
if (isDeposit === void 0) { isDeposit = true; }
|
|
410
412
|
if (useUnderlying === void 0) { useUnderlying = true; }
|
|
411
413
|
return __awaiter(_this, void 0, void 0, function () {
|
|
412
|
-
var _rates, e_2, lpContract, _lpTotalSupply, decimals_1, amounts, seedAmounts_1, N_coins, decimals_2, calcContractAddress, calcContract, poolContract, lpContract, calls, res, _c, _totalSupply, _fee, _lpTokenAmount, balances, _d, totalSupplyBN, feeBN, lpTokenAmountBN, balancesBN, amountsBN, feesBN, i, _fees, _lpTokenFee, e_3, lpContract, _lpTotalSupply, decimals_3, amounts_1, _amounts18Decimals;
|
|
414
|
+
var _rates, e_2, lpContract, _lpTotalSupply, decimals_1, amounts, seedAmounts_1, N_coins, decimals_2, calcContractAddress, calcContract, poolContract, lpContract, calls, res, _c, _totalSupply, _fee, _lpTokenAmount, balances, _d, totalSupplyBN, feeBN, lpTokenAmountBN, balancesBN, amountsBN, feesBN, i, _fees, _lpTokenFee, e_3, lpContract, _lpTotalSupply, decimals_3, amounts_1, seedAmounts_2, _amounts18Decimals;
|
|
413
415
|
return __generator(this, function (_e) {
|
|
414
416
|
switch (_e.label) {
|
|
415
417
|
case 0:
|
|
@@ -451,7 +453,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
451
453
|
});
|
|
452
454
|
return [2 /*return*/, (0, utils_1.parseUnits)(Math.sqrt(Number(amounts[0]) * Number(amounts[1])))];
|
|
453
455
|
case 8:
|
|
454
|
-
_e.trys.push([8, 11, ,
|
|
456
|
+
_e.trys.push([8, 11, , 16]);
|
|
455
457
|
N_coins = this.isMeta && useUnderlying ? this.underlyingCoins.length : this.wrappedCoins.length;
|
|
456
458
|
decimals_2 = this.isMeta && useUnderlying ? this.underlyingDecimals : this.wrappedDecimals;
|
|
457
459
|
calcContractAddress = this.isMeta && useUnderlying ? this.zap : this.address;
|
|
@@ -507,15 +509,27 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
507
509
|
throw e_3; // Already seeded
|
|
508
510
|
decimals_3 = useUnderlying ? this.underlyingDecimals : this.wrappedDecimals;
|
|
509
511
|
amounts_1 = _amounts.map(function (_a, i) { return ethers_1.ethers.utils.formatUnits(_a, decimals_3[i]); });
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
512
|
+
if (!(this.isMeta && useUnderlying)) return [3 /*break*/, 14];
|
|
513
|
+
return [4 /*yield*/, this.metaUnderlyingSeedAmounts(amounts_1[0])];
|
|
514
|
+
case 13:
|
|
515
|
+
seedAmounts_2 = _e.sent();
|
|
516
|
+
amounts_1.forEach(function (a, i) {
|
|
517
|
+
if (!(0, utils_1.BN)(a).eq((0, utils_1.BN)(seedAmounts_2[i])))
|
|
518
|
+
throw Error("Amounts must be = ".concat(seedAmounts_2));
|
|
513
519
|
});
|
|
520
|
+
return [3 /*break*/, 15];
|
|
521
|
+
case 14:
|
|
514
522
|
if (_amounts[0].lte(0))
|
|
515
523
|
throw Error("Initial deposit amounts must be >0");
|
|
524
|
+
amounts_1.forEach(function (a) {
|
|
525
|
+
if (a !== amounts_1[0])
|
|
526
|
+
throw Error("Initial deposit amounts must be equal");
|
|
527
|
+
});
|
|
528
|
+
_e.label = 15;
|
|
529
|
+
case 15:
|
|
516
530
|
_amounts18Decimals = amounts_1.map(function (a) { return (0, utils_1.parseUnits)(a); });
|
|
517
531
|
return [2 /*return*/, _amounts18Decimals.reduce(function (_a, _b) { return _a.add(_b); })];
|
|
518
|
-
case
|
|
532
|
+
case 16: return [2 /*return*/];
|
|
519
533
|
}
|
|
520
534
|
});
|
|
521
535
|
});
|
|
@@ -1270,6 +1284,20 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1270
1284
|
});
|
|
1271
1285
|
};
|
|
1272
1286
|
// ---------------- DEPOSIT ----------------
|
|
1287
|
+
PoolTemplate.prototype.metaUnderlyingSeedAmounts = function (amount1) {
|
|
1288
|
+
if (this.isCrypto)
|
|
1289
|
+
throw Error("Use cryptoSeedAmounts method for ".concat(this.name, " pool"));
|
|
1290
|
+
if (!this.isMeta)
|
|
1291
|
+
throw Error("metaUnderlyingSeedAmounts method exists only for meta stable pools");
|
|
1292
|
+
var amount1BN = (0, utils_1.BN)(amount1);
|
|
1293
|
+
if (amount1BN.lte(0))
|
|
1294
|
+
throw Error("Initial deposit amounts must be > 0");
|
|
1295
|
+
var amounts = [(0, utils_1._cutZeros)(amount1BN.toFixed(this.underlyingDecimals[0]))];
|
|
1296
|
+
for (var i = 1; i < this.underlyingDecimals.length; i++) {
|
|
1297
|
+
amounts.push(amount1BN.div(this.underlyingDecimals.length - 1).toFixed(this.underlyingDecimals[i]));
|
|
1298
|
+
}
|
|
1299
|
+
return amounts;
|
|
1300
|
+
};
|
|
1273
1301
|
PoolTemplate.prototype.cryptoSeedAmounts = function (amount1) {
|
|
1274
1302
|
return __awaiter(this, void 0, void 0, function () {
|
|
1275
1303
|
var decimals, amount1BN, priceScaleBN, _c;
|
package/lib/router.js
CHANGED
|
@@ -876,7 +876,7 @@ var swap = function (inputCoin, outputCoin, amount, slippage) {
|
|
|
876
876
|
};
|
|
877
877
|
exports.swap = swap;
|
|
878
878
|
var getSwappedAmount = function (tx, outputCoin) { return __awaiter(void 0, void 0, void 0, function () {
|
|
879
|
-
var outputCoinAddress, outputCoinDecimals, txInfo, res;
|
|
879
|
+
var outputCoinAddress, outputCoinDecimals, txInfo, res, i;
|
|
880
880
|
return __generator(this, function (_a) {
|
|
881
881
|
switch (_a.label) {
|
|
882
882
|
case 0:
|
|
@@ -885,7 +885,15 @@ var getSwappedAmount = function (tx, outputCoin) { return __awaiter(void 0, void
|
|
|
885
885
|
return [4 /*yield*/, tx.wait()];
|
|
886
886
|
case 1:
|
|
887
887
|
txInfo = _a.sent();
|
|
888
|
-
|
|
888
|
+
for (i = 1; i <= txInfo.logs.length; i++) {
|
|
889
|
+
try {
|
|
890
|
+
res = ethers_1.ethers.utils.defaultAbiCoder.decode(['address[9]', 'uint256[3][4]', 'address[4]', 'uint256', 'uint256'], ethers_1.ethers.utils.hexDataSlice(txInfo.logs[txInfo.logs.length - i].data, 0));
|
|
891
|
+
break;
|
|
892
|
+
}
|
|
893
|
+
catch (err) { }
|
|
894
|
+
}
|
|
895
|
+
if (res === undefined)
|
|
896
|
+
return [2 /*return*/, '0'];
|
|
889
897
|
return [2 /*return*/, ethers_1.ethers.utils.formatUnits(res[res.length - 1], outputCoinDecimals)];
|
|
890
898
|
}
|
|
891
899
|
});
|