@curvefi/api 2.61.6 → 2.61.8
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/lib/pools/PoolTemplate.d.ts +2 -20
- package/lib/pools/PoolTemplate.js +93 -317
- package/lib/pools/gaugePool.d.ts +41 -0
- package/lib/pools/gaugePool.js +281 -0
- package/lib/pools/utils.js +21 -21
- package/package.json +1 -1
|
@@ -59,6 +59,7 @@ import { _getAllGaugesFormatted, _getPoolsFromApi } from '../external-api.js';
|
|
|
59
59
|
import { _getCoinAddresses, _getBalances, _prepareAddresses, _ensureAllowance, _getUsdRate, hasAllowance, ensureAllowance, ensureAllowanceEstimateGas, BN, toBN, toStringFromBN, parseUnits, getEthIndex, fromBN, _cutZeros, _setContracts, _get_small_x, _get_price_impact, checkNumber, _getCrvApyFromApi, _getRewardsFromApi, mulBy1_3, smartNumber, DIGas, _getAddress, isMethodExist, getVolumeApiController, } from '../utils.js';
|
|
60
60
|
import { curve } from "../curve.js";
|
|
61
61
|
import ERC20Abi from '../constants/abis/ERC20.json' assert { type: 'json' };
|
|
62
|
+
import { GaugePool } from "./gaugePool.js";
|
|
62
63
|
var DAY = 86400;
|
|
63
64
|
var WEEK = 7 * DAY;
|
|
64
65
|
var MONTH = 30 * DAY;
|
|
@@ -270,7 +271,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
270
271
|
if (Number(totalLiquidityUSD) === 0)
|
|
271
272
|
return [2 /*return*/, [0, 0]];
|
|
272
273
|
if (!(curve.chainId !== 1)) return [3 /*break*/, 5];
|
|
273
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
274
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
274
275
|
lpTokenContract = curve.contracts[this.lpToken].multicallContract;
|
|
275
276
|
crvContract = curve.contracts[curve.constants.ALIASES.crv].contract;
|
|
276
277
|
currentWeek = Math.floor(Date.now() / 1000 / WEEK);
|
|
@@ -283,19 +284,19 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
283
284
|
_d = (_f.sent()).map(function (value) { return toBN(value); }), inflationRateBN = _d[0], workingSupplyBN = _d[1], totalSupplyBN = _d[2];
|
|
284
285
|
if (!inflationRateBN.eq(0)) return [3 /*break*/, 4];
|
|
285
286
|
_c = toBN;
|
|
286
|
-
return [4 /*yield*/, crvContract.balanceOf(this.gauge, curve.constantOptions)];
|
|
287
|
+
return [4 /*yield*/, crvContract.balanceOf(this.gauge.address, curve.constantOptions)];
|
|
287
288
|
case 3:
|
|
288
289
|
inflationRateBN = _c.apply(void 0, [_f.sent()]).div(WEEK);
|
|
289
290
|
_f.label = 4;
|
|
290
291
|
case 4: return [3 /*break*/, 7];
|
|
291
292
|
case 5:
|
|
292
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
293
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
293
294
|
lpTokenContract = curve.contracts[this.lpToken].multicallContract;
|
|
294
295
|
gaugeControllerContract = curve.contracts[curve.constants.ALIASES.gauge_controller].multicallContract;
|
|
295
296
|
weightBN = void 0;
|
|
296
297
|
return [4 /*yield*/, curve.multicallProvider.all([
|
|
297
298
|
gaugeContract.inflation_rate(),
|
|
298
|
-
gaugeControllerContract.gauge_relative_weight(this.gauge),
|
|
299
|
+
gaugeControllerContract.gauge_relative_weight(this.gauge.address),
|
|
299
300
|
gaugeContract.working_supply(),
|
|
300
301
|
lpTokenContract.totalSupply(),
|
|
301
302
|
])];
|
|
@@ -334,7 +335,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
334
335
|
return [4 /*yield*/, _getCrvApyFromApi()];
|
|
335
336
|
case 1:
|
|
336
337
|
crvAPYs = _d.sent();
|
|
337
|
-
poolCrvApy = (_c = crvAPYs[this.gauge]) !== null && _c !== void 0 ? _c : [0, 0];
|
|
338
|
+
poolCrvApy = (_c = crvAPYs[this.gauge.address]) !== null && _c !== void 0 ? _c : [0, 0];
|
|
338
339
|
return [2 /*return*/, [poolCrvApy[0], poolCrvApy[1]]];
|
|
339
340
|
case 2: return [4 /*yield*/, this._calcTokenApy()];
|
|
340
341
|
case 3: return [2 /*return*/, _d.sent()];
|
|
@@ -349,16 +350,16 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
349
350
|
return __generator(this, function (_d) {
|
|
350
351
|
switch (_d.label) {
|
|
351
352
|
case 0:
|
|
352
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
353
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS)
|
|
353
354
|
return [2 /*return*/, []];
|
|
354
355
|
isDisabledChain = [1313161554].includes(curve.chainId);
|
|
355
356
|
if (!(useApi && !isDisabledChain)) return [3 /*break*/, 2];
|
|
356
357
|
return [4 /*yield*/, _getRewardsFromApi()];
|
|
357
358
|
case 1:
|
|
358
359
|
rewards = _d.sent();
|
|
359
|
-
if (!rewards[this.gauge])
|
|
360
|
+
if (!rewards[this.gauge.address])
|
|
360
361
|
return [2 /*return*/, []];
|
|
361
|
-
return [2 /*return*/, rewards[this.gauge].map(function (r) { return ({ gaugeAddress: r.gaugeAddress, tokenAddress: r.tokenAddress, symbol: r.symbol, apy: r.apy }); })];
|
|
362
|
+
return [2 /*return*/, rewards[this.gauge.address].map(function (r) { return ({ gaugeAddress: r.gaugeAddress, tokenAddress: r.tokenAddress, symbol: r.symbol, apy: r.apy }); })];
|
|
362
363
|
case 2:
|
|
363
364
|
apy = [];
|
|
364
365
|
return [4 /*yield*/, this.rewardTokens(false)];
|
|
@@ -369,9 +370,9 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
369
370
|
case 4:
|
|
370
371
|
if (!(_i < rewardTokens_1.length)) return [3 /*break*/, 9];
|
|
371
372
|
rewardToken = rewardTokens_1[_i];
|
|
372
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
373
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
373
374
|
lpTokenContract = curve.contracts[this.lpToken].multicallContract;
|
|
374
|
-
rewardContract = curve.contracts[this.sRewardContract || this.gauge].multicallContract;
|
|
375
|
+
rewardContract = curve.contracts[this.sRewardContract || this.gauge.address].multicallContract;
|
|
375
376
|
return [4 /*yield*/, this.statsTotalLiquidity()];
|
|
376
377
|
case 5:
|
|
377
378
|
totalLiquidityUSD = _d.sent();
|
|
@@ -393,7 +394,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
393
394
|
inflationBN.times(31536000).times(rewardRate).div(stakedSupplyBN).times(totalSupplyBN).div(Number(totalLiquidityUSD)) :
|
|
394
395
|
BN(0);
|
|
395
396
|
apy.push({
|
|
396
|
-
gaugeAddress: this.gauge,
|
|
397
|
+
gaugeAddress: this.gauge.address,
|
|
397
398
|
tokenAddress: rewardToken.token,
|
|
398
399
|
symbol: rewardToken.symbol,
|
|
399
400
|
apy: baseApy.times(100).toNumber(),
|
|
@@ -509,7 +510,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
509
510
|
if (!address)
|
|
510
511
|
throw Error("Need to connect wallet or pass address into args");
|
|
511
512
|
if (!(curve.chainId !== 1)) return [3 /*break*/, 4];
|
|
512
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
513
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
513
514
|
crvContract = curve.contracts[curve.constants.ALIASES.crv].contract;
|
|
514
515
|
currentWeek = Math.floor(Date.now() / 1000 / WEEK);
|
|
515
516
|
return [4 /*yield*/, curve.multicallProvider.all([
|
|
@@ -521,18 +522,18 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
521
522
|
_d = (_f.sent()).map(function (value) { return toBN(value); }), inflationRateBN = _d[0], workingBalanceBN = _d[1], workingSupplyBN = _d[2];
|
|
522
523
|
if (!inflationRateBN.eq(0)) return [3 /*break*/, 3];
|
|
523
524
|
_c = toBN;
|
|
524
|
-
return [4 /*yield*/, crvContract.balanceOf(this.gauge, curve.constantOptions)];
|
|
525
|
+
return [4 /*yield*/, crvContract.balanceOf(this.gauge.address, curve.constantOptions)];
|
|
525
526
|
case 2:
|
|
526
527
|
inflationRateBN = _c.apply(void 0, [_f.sent()]).div(WEEK);
|
|
527
528
|
_f.label = 3;
|
|
528
529
|
case 3: return [3 /*break*/, 6];
|
|
529
530
|
case 4:
|
|
530
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
531
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
531
532
|
gaugeControllerContract = curve.contracts[curve.constants.ALIASES.gauge_controller].multicallContract;
|
|
532
533
|
weightBN = void 0;
|
|
533
534
|
return [4 /*yield*/, curve.multicallProvider.all([
|
|
534
535
|
gaugeContract.inflation_rate(),
|
|
535
|
-
gaugeControllerContract.gauge_relative_weight(this.gauge),
|
|
536
|
+
gaugeControllerContract.gauge_relative_weight(this.gauge.address),
|
|
536
537
|
gaugeContract.working_balances(address),
|
|
537
538
|
gaugeContract.working_supply(),
|
|
538
539
|
])];
|
|
@@ -577,12 +578,12 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
577
578
|
return __generator(this, function (_d) {
|
|
578
579
|
switch (_d.label) {
|
|
579
580
|
case 0:
|
|
580
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
581
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS)
|
|
581
582
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
582
583
|
if (this.rewardsOnly())
|
|
583
584
|
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use stats.rewardsApy instead"));
|
|
584
585
|
address = _getAddress(address);
|
|
585
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
586
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
586
587
|
return [4 /*yield*/, curve.multicallProvider.all([
|
|
587
588
|
gaugeContract.working_balances(address),
|
|
588
589
|
gaugeContract.balanceOf(address),
|
|
@@ -605,7 +606,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
605
606
|
switch (_d.label) {
|
|
606
607
|
case 0:
|
|
607
608
|
veContractMulticall = curve.contracts[curve.constants.ALIASES.voting_escrow].multicallContract;
|
|
608
|
-
gaugeContractMulticall = curve.contracts[this.gauge].multicallContract;
|
|
609
|
+
gaugeContractMulticall = curve.contracts[this.gauge.address].multicallContract;
|
|
609
610
|
calls = [
|
|
610
611
|
veContractMulticall.balanceOf(address),
|
|
611
612
|
veContractMulticall.totalSupply(),
|
|
@@ -713,7 +714,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
713
714
|
return __generator(this, function (_f) {
|
|
714
715
|
switch (_f.label) {
|
|
715
716
|
case 0:
|
|
716
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
717
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS)
|
|
717
718
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
718
719
|
if (addresses.length == 1 && Array.isArray(addresses[0]))
|
|
719
720
|
addresses = addresses[0];
|
|
@@ -722,7 +723,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
722
723
|
if (addresses.length === 0)
|
|
723
724
|
throw Error("Need to connect wallet or pass addresses into args");
|
|
724
725
|
votingEscrowContract = curve.contracts[curve.constants.ALIASES.voting_escrow].multicallContract;
|
|
725
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
726
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
726
727
|
contractCalls = [votingEscrowContract.totalSupply(), gaugeContract.totalSupply()];
|
|
727
728
|
addresses.forEach(function (account) {
|
|
728
729
|
contractCalls.push(votingEscrowContract.balanceOf(account));
|
|
@@ -754,19 +755,19 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
754
755
|
return __generator(this, function (_f) {
|
|
755
756
|
switch (_f.label) {
|
|
756
757
|
case 0:
|
|
757
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
758
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS)
|
|
758
759
|
return [2 /*return*/, []];
|
|
759
760
|
if (!useApi) return [3 /*break*/, 2];
|
|
760
761
|
return [4 /*yield*/, _getRewardsFromApi()];
|
|
761
762
|
case 1:
|
|
762
763
|
rewards = _f.sent();
|
|
763
|
-
if (!rewards[this.gauge])
|
|
764
|
+
if (!rewards[this.gauge.address])
|
|
764
765
|
return [2 /*return*/, []];
|
|
765
|
-
rewards[this.gauge].forEach(function (r) { return _setContracts(r.tokenAddress, ERC20Abi); });
|
|
766
|
-
return [2 /*return*/, rewards[this.gauge].map(function (r) { return ({ token: r.tokenAddress, symbol: r.symbol, decimals: Number(r.decimals) }); })];
|
|
766
|
+
rewards[this.gauge.address].forEach(function (r) { return _setContracts(r.tokenAddress, ERC20Abi); });
|
|
767
|
+
return [2 /*return*/, rewards[this.gauge.address].map(function (r) { return ({ token: r.tokenAddress, symbol: r.symbol, decimals: Number(r.decimals) }); })];
|
|
767
768
|
case 2:
|
|
768
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
769
|
-
gaugeMulticallContract = curve.contracts[this.gauge].multicallContract;
|
|
769
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
770
|
+
gaugeMulticallContract = curve.contracts[this.gauge.address].multicallContract;
|
|
770
771
|
if (!("reward_tokens(uint256)" in gaugeContract)) return [3 /*break*/, 7];
|
|
771
772
|
rewardCount = 8;
|
|
772
773
|
if (!("reward_count()" in gaugeContract)) return [3 /*break*/, 4];
|
|
@@ -835,7 +836,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
835
836
|
return __generator(this, function (_f) {
|
|
836
837
|
switch (_f.label) {
|
|
837
838
|
case 0:
|
|
838
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
839
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS)
|
|
839
840
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
840
841
|
address = address || curve.signerAddress;
|
|
841
842
|
if (!address)
|
|
@@ -843,9 +844,9 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
843
844
|
return [4 /*yield*/, this.rewardTokens()];
|
|
844
845
|
case 1:
|
|
845
846
|
rewardTokens = _f.sent();
|
|
846
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
847
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
847
848
|
result = [];
|
|
848
|
-
if (!('reward_data(address)' in curve.contracts[this.gauge].contract)) return [3 /*break*/, 7];
|
|
849
|
+
if (!('reward_data(address)' in curve.contracts[this.gauge.address].contract)) return [3 /*break*/, 7];
|
|
849
850
|
calls = [gaugeContract.balanceOf(address), gaugeContract.totalSupply()];
|
|
850
851
|
for (_i = 0, rewardTokens_2 = rewardTokens; _i < rewardTokens_2.length; _i++) {
|
|
851
852
|
rewardToken = rewardTokens_2[_i];
|
|
@@ -949,13 +950,13 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
949
950
|
return __generator(this, function (_j) {
|
|
950
951
|
switch (_j.label) {
|
|
951
952
|
case 0:
|
|
952
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
953
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS)
|
|
953
954
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
954
955
|
if (accounts.length == 1 && Array.isArray(accounts[0]))
|
|
955
956
|
accounts = accounts[0];
|
|
956
957
|
votingEscrowContract = curve.contracts[curve.constants.ALIASES.voting_escrow].multicallContract;
|
|
957
958
|
lpTokenContract = curve.contracts[this.lpToken].multicallContract;
|
|
958
|
-
gaugeContract = curve.contracts[this.gauge].multicallContract;
|
|
959
|
+
gaugeContract = curve.contracts[this.gauge.address].multicallContract;
|
|
959
960
|
contractCalls = [votingEscrowContract.totalSupply(), gaugeContract.totalSupply()];
|
|
960
961
|
accounts.forEach(function (account) {
|
|
961
962
|
contractCalls.push(votingEscrowContract.balanceOf(account), lpTokenContract.balanceOf(account), gaugeContract.balanceOf(account));
|
|
@@ -1156,7 +1157,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1156
1157
|
this.referenceAsset = poolData.reference_asset;
|
|
1157
1158
|
this.address = poolData.swap_address;
|
|
1158
1159
|
this.lpToken = poolData.token_address;
|
|
1159
|
-
this.gauge = poolData.gauge_address;
|
|
1160
|
+
this.gauge = new GaugePool(poolData.gauge_address, poolData.name);
|
|
1160
1161
|
this.zap = poolData.deposit_address || null;
|
|
1161
1162
|
this.sRewardContract = poolData.sCurveRewards_address || null;
|
|
1162
1163
|
this.rewardContract = poolData.reward_contract || null;
|
|
@@ -1182,23 +1183,16 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1182
1183
|
this.inApi = (_d = poolData.in_api) !== null && _d !== void 0 ? _d : false;
|
|
1183
1184
|
this.isGaugeKilled = this.getIsGaugeKilled.bind(this);
|
|
1184
1185
|
this.gaugeStatus = this.getGaugeStatus.bind(this);
|
|
1185
|
-
this.gaugeManager = this.getGaugeManager.bind(this);
|
|
1186
|
-
this.gaugeDistributors = this.getGaugeDistributors.bind(this);
|
|
1187
|
-
this.gaugeVersion = this.getGaugeVersion.bind(this);
|
|
1188
|
-
this.addReward = this.addReward.bind(this);
|
|
1189
1186
|
this.estimateGas = {
|
|
1190
1187
|
depositApprove: this.depositApproveEstimateGas.bind(this),
|
|
1191
1188
|
deposit: this.depositEstimateGas.bind(this),
|
|
1192
1189
|
depositWrappedApprove: this.depositWrappedApproveEstimateGas.bind(this),
|
|
1193
|
-
depositReward: this.depositRewardEstimateGas.bind(this),
|
|
1194
1190
|
depositWrapped: this.depositWrappedEstimateGas.bind(this),
|
|
1195
|
-
depositRewardApprove: this.depositRewardApproveEstimateGas.bind(this),
|
|
1196
1191
|
stakeApprove: this.stakeApproveEstimateGas.bind(this),
|
|
1197
1192
|
stake: this.stakeEstimateGas.bind(this),
|
|
1198
1193
|
unstake: this.unstakeEstimateGas.bind(this),
|
|
1199
1194
|
claimCrv: this.claimCrvEstimateGas.bind(this),
|
|
1200
1195
|
claimRewards: this.claimRewardsEstimateGas.bind(this),
|
|
1201
|
-
addReward: this.addRewardEstimateGas.bind(this),
|
|
1202
1196
|
depositAndStakeApprove: this.depositAndStakeApproveEstimateGas.bind(this),
|
|
1203
1197
|
depositAndStake: this.depositAndStakeEstimateGas.bind(this),
|
|
1204
1198
|
depositAndStakeWrappedApprove: this.depositAndStakeWrappedApproveEstimateGas.bind(this),
|
|
@@ -1274,9 +1268,9 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1274
1268
|
PoolTemplate.prototype.rewardsOnly = function () {
|
|
1275
1269
|
if (curve.chainId === 2222 || curve.chainId === 324)
|
|
1276
1270
|
return true; // TODO remove this for Kava and ZkSync
|
|
1277
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS)
|
|
1271
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS)
|
|
1278
1272
|
throw Error("".concat(this.name, " doesn't have gauge"));
|
|
1279
|
-
var gaugeContract = curve.contracts[this.gauge].contract;
|
|
1273
|
+
var gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
1280
1274
|
return !('inflation_rate()' in gaugeContract || 'inflation_rate(uint256)' in gaugeContract);
|
|
1281
1275
|
};
|
|
1282
1276
|
PoolTemplate.prototype.statsWrappedBalances = function () {
|
|
@@ -1681,10 +1675,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1681
1675
|
return __generator(this, function (_c) {
|
|
1682
1676
|
switch (_c.label) {
|
|
1683
1677
|
case 0:
|
|
1684
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1678
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1685
1679
|
throw Error("stakeIsApproved method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1686
1680
|
}
|
|
1687
|
-
return [4 /*yield*/, hasAllowance([this.lpToken], [lpTokenAmount], curve.signerAddress, this.gauge)];
|
|
1681
|
+
return [4 /*yield*/, hasAllowance([this.lpToken], [lpTokenAmount], curve.signerAddress, this.gauge.address)];
|
|
1688
1682
|
case 1: return [2 /*return*/, _c.sent()];
|
|
1689
1683
|
}
|
|
1690
1684
|
});
|
|
@@ -1695,10 +1689,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1695
1689
|
return __generator(this, function (_c) {
|
|
1696
1690
|
switch (_c.label) {
|
|
1697
1691
|
case 0:
|
|
1698
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1692
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1699
1693
|
throw Error("stakeApproveEstimateGas method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1700
1694
|
}
|
|
1701
|
-
return [4 /*yield*/, ensureAllowanceEstimateGas([this.lpToken], [lpTokenAmount], this.gauge)];
|
|
1695
|
+
return [4 /*yield*/, ensureAllowanceEstimateGas([this.lpToken], [lpTokenAmount], this.gauge.address)];
|
|
1702
1696
|
case 1: return [2 /*return*/, _c.sent()];
|
|
1703
1697
|
}
|
|
1704
1698
|
});
|
|
@@ -1709,10 +1703,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1709
1703
|
return __generator(this, function (_c) {
|
|
1710
1704
|
switch (_c.label) {
|
|
1711
1705
|
case 0:
|
|
1712
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1706
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1713
1707
|
throw Error("stakeApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1714
1708
|
}
|
|
1715
|
-
return [4 /*yield*/, ensureAllowance([this.lpToken], [lpTokenAmount], this.gauge)];
|
|
1709
|
+
return [4 /*yield*/, ensureAllowance([this.lpToken], [lpTokenAmount], this.gauge.address)];
|
|
1716
1710
|
case 1: return [2 /*return*/, _c.sent()];
|
|
1717
1711
|
}
|
|
1718
1712
|
});
|
|
@@ -1724,12 +1718,12 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1724
1718
|
return __generator(this, function (_d) {
|
|
1725
1719
|
switch (_d.label) {
|
|
1726
1720
|
case 0:
|
|
1727
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1721
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1728
1722
|
throw Error("stakeEstimateGas method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1729
1723
|
}
|
|
1730
1724
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
1731
1725
|
_c = smartNumber;
|
|
1732
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.deposit.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1726
|
+
return [4 /*yield*/, curve.contracts[this.gauge.address].contract.deposit.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1733
1727
|
case 1: return [2 /*return*/, _c.apply(void 0, [_d.sent()])];
|
|
1734
1728
|
}
|
|
1735
1729
|
});
|
|
@@ -1741,11 +1735,11 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1741
1735
|
return __generator(this, function (_e) {
|
|
1742
1736
|
switch (_e.label) {
|
|
1743
1737
|
case 0:
|
|
1744
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1738
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1745
1739
|
throw Error("stake method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1746
1740
|
}
|
|
1747
1741
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
1748
|
-
return [4 /*yield*/, _ensureAllowance([this.lpToken], [_lpTokenAmount], this.gauge)];
|
|
1742
|
+
return [4 /*yield*/, _ensureAllowance([this.lpToken], [_lpTokenAmount], this.gauge.address)];
|
|
1749
1743
|
case 1:
|
|
1750
1744
|
_e.sent();
|
|
1751
1745
|
return [4 /*yield*/, curve.updateFeeData()];
|
|
@@ -1753,10 +1747,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1753
1747
|
_e.sent();
|
|
1754
1748
|
_c = mulBy1_3;
|
|
1755
1749
|
_d = DIGas;
|
|
1756
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.deposit.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1750
|
+
return [4 /*yield*/, curve.contracts[this.gauge.address].contract.deposit.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1757
1751
|
case 3:
|
|
1758
1752
|
gasLimit = _c.apply(void 0, [_d.apply(void 0, [_e.sent()])]);
|
|
1759
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.deposit(_lpTokenAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1753
|
+
return [4 /*yield*/, curve.contracts[this.gauge.address].contract.deposit(_lpTokenAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1760
1754
|
case 4: return [2 /*return*/, (_e.sent()).hash];
|
|
1761
1755
|
}
|
|
1762
1756
|
});
|
|
@@ -1768,12 +1762,12 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1768
1762
|
return __generator(this, function (_d) {
|
|
1769
1763
|
switch (_d.label) {
|
|
1770
1764
|
case 0:
|
|
1771
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1765
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1772
1766
|
throw Error("unstakeEstimateGas method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1773
1767
|
}
|
|
1774
1768
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
1775
1769
|
_c = smartNumber;
|
|
1776
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.withdraw.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1770
|
+
return [4 /*yield*/, curve.contracts[this.gauge.address].contract.withdraw.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1777
1771
|
case 1: return [2 /*return*/, _c.apply(void 0, [_d.sent()])];
|
|
1778
1772
|
}
|
|
1779
1773
|
});
|
|
@@ -1785,7 +1779,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1785
1779
|
return __generator(this, function (_d) {
|
|
1786
1780
|
switch (_d.label) {
|
|
1787
1781
|
case 0:
|
|
1788
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1782
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1789
1783
|
throw Error("unstake method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1790
1784
|
}
|
|
1791
1785
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
@@ -1793,10 +1787,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1793
1787
|
case 1:
|
|
1794
1788
|
_d.sent();
|
|
1795
1789
|
_c = DIGas;
|
|
1796
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.withdraw.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1790
|
+
return [4 /*yield*/, curve.contracts[this.gauge.address].contract.withdraw.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1797
1791
|
case 2:
|
|
1798
1792
|
gasLimit = _c.apply(void 0, [(_d.sent())]) * curve.parseUnits("200", 0) / curve.parseUnits("100", 0);
|
|
1799
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.withdraw(_lpTokenAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1793
|
+
return [4 /*yield*/, curve.contracts[this.gauge.address].contract.withdraw(_lpTokenAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1800
1794
|
case 3: return [2 /*return*/, (_d.sent()).hash];
|
|
1801
1795
|
}
|
|
1802
1796
|
});
|
|
@@ -1815,7 +1809,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1815
1809
|
if (!address)
|
|
1816
1810
|
throw Error("Need to connect wallet or pass address into args");
|
|
1817
1811
|
_d = (_c = curve).formatUnits;
|
|
1818
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.claimable_tokens(address, curve.constantOptions)];
|
|
1812
|
+
return [4 /*yield*/, curve.contracts[this.gauge.address].contract.claimable_tokens(address, curve.constantOptions)];
|
|
1819
1813
|
case 1: return [2 /*return*/, _d.apply(_c, [_e.sent()])];
|
|
1820
1814
|
}
|
|
1821
1815
|
});
|
|
@@ -1831,11 +1825,11 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1831
1825
|
throw Error("".concat(this.name, " has Rewards-Only Gauge. Use claimRewards instead"));
|
|
1832
1826
|
if (!(curve.chainId === 1)) return [3 /*break*/, 2];
|
|
1833
1827
|
_c = Number;
|
|
1834
|
-
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.minter].contract.mint.estimateGas(this.gauge, curve.constantOptions)];
|
|
1828
|
+
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.minter].contract.mint.estimateGas(this.gauge.address, curve.constantOptions)];
|
|
1835
1829
|
case 1: return [2 /*return*/, _c.apply(void 0, [_e.sent()])];
|
|
1836
1830
|
case 2:
|
|
1837
1831
|
_d = smartNumber;
|
|
1838
|
-
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.gauge_factory].contract.mint.estimateGas(this.gauge, curve.constantOptions)];
|
|
1832
|
+
return [4 /*yield*/, curve.contracts[curve.constants.ALIASES.gauge_factory].contract.mint.estimateGas(this.gauge.address, curve.constantOptions)];
|
|
1839
1833
|
case 3: return [2 /*return*/, _d.apply(void 0, [_e.sent()])];
|
|
1840
1834
|
}
|
|
1841
1835
|
});
|
|
@@ -1855,10 +1849,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1855
1849
|
_e.sent();
|
|
1856
1850
|
_c = mulBy1_3;
|
|
1857
1851
|
_d = DIGas;
|
|
1858
|
-
return [4 /*yield*/, contract.mint.estimateGas(this.gauge, curve.constantOptions)];
|
|
1852
|
+
return [4 /*yield*/, contract.mint.estimateGas(this.gauge.address, curve.constantOptions)];
|
|
1859
1853
|
case 2:
|
|
1860
1854
|
gasLimit = _c.apply(void 0, [_d.apply(void 0, [_e.sent()])]);
|
|
1861
|
-
return [4 /*yield*/, contract.mint(this.gauge, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1855
|
+
return [4 /*yield*/, contract.mint(this.gauge.address, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1862
1856
|
case 3: return [2 /*return*/, (_e.sent()).hash];
|
|
1863
1857
|
}
|
|
1864
1858
|
});
|
|
@@ -1872,13 +1866,13 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1872
1866
|
return __generator(this, function (_c) {
|
|
1873
1867
|
switch (_c.label) {
|
|
1874
1868
|
case 0:
|
|
1875
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1869
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1876
1870
|
throw Error("claimableRewards method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1877
1871
|
}
|
|
1878
1872
|
address = address || curve.signerAddress;
|
|
1879
1873
|
if (!address)
|
|
1880
1874
|
throw Error("Need to connect wallet or pass address into args");
|
|
1881
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
1875
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
1882
1876
|
return [4 /*yield*/, this.rewardTokens()];
|
|
1883
1877
|
case 1:
|
|
1884
1878
|
rewardTokens = _c.sent();
|
|
@@ -1928,10 +1922,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1928
1922
|
return __generator(this, function (_d) {
|
|
1929
1923
|
switch (_d.label) {
|
|
1930
1924
|
case 0:
|
|
1931
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1925
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1932
1926
|
throw Error("claimRewards method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1933
1927
|
}
|
|
1934
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
1928
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
1935
1929
|
if (!("claim_rewards()" in gaugeContract))
|
|
1936
1930
|
throw Error("".concat(this.name, " pool doesn't have such method"));
|
|
1937
1931
|
_c = smartNumber;
|
|
@@ -1947,10 +1941,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1947
1941
|
return __generator(this, function (_e) {
|
|
1948
1942
|
switch (_e.label) {
|
|
1949
1943
|
case 0:
|
|
1950
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1944
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1951
1945
|
throw Error("claimRewards method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1952
1946
|
}
|
|
1953
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
1947
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
1954
1948
|
if (!("claim_rewards()" in gaugeContract))
|
|
1955
1949
|
throw Error("".concat(this.name, " pool doesn't have such method"));
|
|
1956
1950
|
return [4 /*yield*/, curve.updateFeeData()];
|
|
@@ -1973,7 +1967,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1973
1967
|
return __generator(this, function (_c) {
|
|
1974
1968
|
switch (_c.label) {
|
|
1975
1969
|
case 0:
|
|
1976
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1970
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1977
1971
|
throw Error("depositAndStakeExpected method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1978
1972
|
}
|
|
1979
1973
|
return [4 /*yield*/, this.depositExpected(amounts)];
|
|
@@ -1987,7 +1981,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1987
1981
|
return __generator(this, function (_c) {
|
|
1988
1982
|
switch (_c.label) {
|
|
1989
1983
|
case 0:
|
|
1990
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1984
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
1991
1985
|
throw Error("depositAndStakeBonus method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1992
1986
|
}
|
|
1993
1987
|
return [4 /*yield*/, this.depositBonus(amounts)];
|
|
@@ -2002,13 +1996,13 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2002
1996
|
return __generator(this, function (_c) {
|
|
2003
1997
|
switch (_c.label) {
|
|
2004
1998
|
case 0:
|
|
2005
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1999
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2006
2000
|
throw Error("depositAndStakeIsApproved method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2007
2001
|
}
|
|
2008
2002
|
return [4 /*yield*/, hasAllowance(this.underlyingCoinAddresses, amounts, curve.signerAddress, curve.constants.ALIASES.deposit_and_stake)];
|
|
2009
2003
|
case 1:
|
|
2010
2004
|
coinsAllowance = _c.sent();
|
|
2011
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
2005
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
2012
2006
|
if (!('approved_to_deposit' in gaugeContract)) return [3 /*break*/, 3];
|
|
2013
2007
|
return [4 /*yield*/, gaugeContract.approved_to_deposit(curve.constants.ALIASES.deposit_and_stake, curve.signerAddress, curve.constantOptions)];
|
|
2014
2008
|
case 2:
|
|
@@ -2025,13 +2019,13 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2025
2019
|
return __generator(this, function (_d) {
|
|
2026
2020
|
switch (_d.label) {
|
|
2027
2021
|
case 0:
|
|
2028
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2022
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2029
2023
|
throw Error("depositAndStakeApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2030
2024
|
}
|
|
2031
2025
|
return [4 /*yield*/, ensureAllowanceEstimateGas(this.underlyingCoinAddresses, amounts, curve.constants.ALIASES.deposit_and_stake)];
|
|
2032
2026
|
case 1:
|
|
2033
2027
|
approveCoinsGas = _d.sent();
|
|
2034
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
2028
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
2035
2029
|
if (!('approved_to_deposit' in gaugeContract)) return [3 /*break*/, 4];
|
|
2036
2030
|
return [4 /*yield*/, gaugeContract.approved_to_deposit(curve.constants.ALIASES.deposit_and_stake, curve.signerAddress, curve.constantOptions)];
|
|
2037
2031
|
case 2:
|
|
@@ -2059,13 +2053,13 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2059
2053
|
return __generator(this, function (_d) {
|
|
2060
2054
|
switch (_d.label) {
|
|
2061
2055
|
case 0:
|
|
2062
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2056
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2063
2057
|
throw Error("depositAndStakeApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2064
2058
|
}
|
|
2065
2059
|
return [4 /*yield*/, ensureAllowance(this.underlyingCoinAddresses, amounts, curve.constants.ALIASES.deposit_and_stake)];
|
|
2066
2060
|
case 1:
|
|
2067
2061
|
approveCoinsTx = _d.sent();
|
|
2068
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
2062
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
2069
2063
|
if (!('approved_to_deposit' in gaugeContract)) return [3 /*break*/, 5];
|
|
2070
2064
|
return [4 /*yield*/, gaugeContract.approved_to_deposit(curve.constants.ALIASES.deposit_and_stake, curve.signerAddress, curve.constantOptions)];
|
|
2071
2065
|
case 2:
|
|
@@ -2089,7 +2083,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2089
2083
|
return __generator(this, function (_c) {
|
|
2090
2084
|
switch (_c.label) {
|
|
2091
2085
|
case 0:
|
|
2092
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2086
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2093
2087
|
throw Error("depositAndStake method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2094
2088
|
}
|
|
2095
2089
|
return [4 /*yield*/, this._depositAndStake(amounts, 1, true, true)];
|
|
@@ -2104,7 +2098,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2104
2098
|
return __generator(this, function (_c) {
|
|
2105
2099
|
switch (_c.label) {
|
|
2106
2100
|
case 0:
|
|
2107
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2101
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2108
2102
|
throw Error("depositAndStake method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2109
2103
|
}
|
|
2110
2104
|
return [4 /*yield*/, this._depositAndStake(amounts, slippage, true, false)];
|
|
@@ -2119,7 +2113,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2119
2113
|
return __generator(this, function (_c) {
|
|
2120
2114
|
switch (_c.label) {
|
|
2121
2115
|
case 0:
|
|
2122
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2116
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2123
2117
|
throw Error("depositAndStakeWrappedExpected method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2124
2118
|
}
|
|
2125
2119
|
if (this.isPlain || this.isFake)
|
|
@@ -2135,7 +2129,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2135
2129
|
return __generator(this, function (_c) {
|
|
2136
2130
|
switch (_c.label) {
|
|
2137
2131
|
case 0:
|
|
2138
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2132
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2139
2133
|
throw Error("depositAndStakeWrappedBonus method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2140
2134
|
}
|
|
2141
2135
|
if (this.isPlain || this.isFake)
|
|
@@ -2152,7 +2146,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2152
2146
|
return __generator(this, function (_c) {
|
|
2153
2147
|
switch (_c.label) {
|
|
2154
2148
|
case 0:
|
|
2155
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2149
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2156
2150
|
throw Error("depositAndStakeWrappedIsApproved method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2157
2151
|
}
|
|
2158
2152
|
if (this.isPlain || this.isFake)
|
|
@@ -2160,7 +2154,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2160
2154
|
return [4 /*yield*/, hasAllowance(this.wrappedCoinAddresses, amounts, curve.signerAddress, curve.constants.ALIASES.deposit_and_stake)];
|
|
2161
2155
|
case 1:
|
|
2162
2156
|
coinsAllowance = _c.sent();
|
|
2163
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
2157
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
2164
2158
|
if (!('approved_to_deposit' in gaugeContract)) return [3 /*break*/, 3];
|
|
2165
2159
|
return [4 /*yield*/, gaugeContract.approved_to_deposit(curve.constants.ALIASES.deposit_and_stake, curve.signerAddress, curve.constantOptions)];
|
|
2166
2160
|
case 2:
|
|
@@ -2177,7 +2171,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2177
2171
|
return __generator(this, function (_d) {
|
|
2178
2172
|
switch (_d.label) {
|
|
2179
2173
|
case 0:
|
|
2180
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2174
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2181
2175
|
throw Error("depositAndStakeWrappedApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2182
2176
|
}
|
|
2183
2177
|
if (this.isPlain || this.isFake)
|
|
@@ -2185,7 +2179,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2185
2179
|
return [4 /*yield*/, ensureAllowanceEstimateGas(this.wrappedCoinAddresses, amounts, curve.constants.ALIASES.deposit_and_stake)];
|
|
2186
2180
|
case 1:
|
|
2187
2181
|
approveCoinsGas = _d.sent();
|
|
2188
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
2182
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
2189
2183
|
if (!('approved_to_deposit' in gaugeContract)) return [3 /*break*/, 4];
|
|
2190
2184
|
return [4 /*yield*/, gaugeContract.approved_to_deposit(curve.constants.ALIASES.deposit_and_stake, curve.signerAddress, curve.constantOptions)];
|
|
2191
2185
|
case 2:
|
|
@@ -2213,7 +2207,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2213
2207
|
return __generator(this, function (_d) {
|
|
2214
2208
|
switch (_d.label) {
|
|
2215
2209
|
case 0:
|
|
2216
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2210
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2217
2211
|
throw Error("depositAndStakeWrappedApprove method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2218
2212
|
}
|
|
2219
2213
|
if (this.isPlain || this.isFake)
|
|
@@ -2221,7 +2215,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2221
2215
|
return [4 /*yield*/, ensureAllowance(this.wrappedCoinAddresses, amounts, curve.constants.ALIASES.deposit_and_stake)];
|
|
2222
2216
|
case 1:
|
|
2223
2217
|
approveCoinsTx = _d.sent();
|
|
2224
|
-
gaugeContract = curve.contracts[this.gauge].contract;
|
|
2218
|
+
gaugeContract = curve.contracts[this.gauge.address].contract;
|
|
2225
2219
|
if (!('approved_to_deposit' in gaugeContract)) return [3 /*break*/, 5];
|
|
2226
2220
|
return [4 /*yield*/, gaugeContract.approved_to_deposit(curve.constants.ALIASES.deposit_and_stake, curve.signerAddress, curve.constantOptions)];
|
|
2227
2221
|
case 2:
|
|
@@ -2245,7 +2239,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2245
2239
|
return __generator(this, function (_c) {
|
|
2246
2240
|
switch (_c.label) {
|
|
2247
2241
|
case 0:
|
|
2248
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2242
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2249
2243
|
throw Error("depositAndStakeWrapped method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2250
2244
|
}
|
|
2251
2245
|
if (this.isPlain || this.isFake)
|
|
@@ -2262,7 +2256,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2262
2256
|
return __generator(this, function (_c) {
|
|
2263
2257
|
switch (_c.label) {
|
|
2264
2258
|
case 0:
|
|
2265
|
-
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
2259
|
+
if (this.gauge.address === curve.constants.ZERO_ADDRESS) {
|
|
2266
2260
|
throw Error("depositAndStakeWrapped method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
2267
2261
|
}
|
|
2268
2262
|
if (this.isPlain || this.isFake)
|
|
@@ -2351,7 +2345,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2351
2345
|
_minMintAmount = fromBN(minAmountBN);
|
|
2352
2346
|
ethIndex = getEthIndex(coinAddresses);
|
|
2353
2347
|
value = _amounts[ethIndex] || curve.parseUnits("0");
|
|
2354
|
-
return [4 /*yield*/, contract.deposit_and_stake.estimateGas(depositAddress, this.lpToken, this.gauge, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, (!this.isCrypto && this.isNg && this.isPlain) || (isUnderlying && this.isMeta && (new PoolTemplate(this.basePool)).isNg), this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.constantOptions), { value: value }))];
|
|
2348
|
+
return [4 /*yield*/, contract.deposit_and_stake.estimateGas(depositAddress, this.lpToken, this.gauge.address, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, (!this.isCrypto && this.isNg && this.isPlain) || (isUnderlying && this.isMeta && (new PoolTemplate(this.basePool)).isNg), this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.constantOptions), { value: value }))];
|
|
2355
2349
|
case 17:
|
|
2356
2350
|
_gas = (_q.sent());
|
|
2357
2351
|
if (estimateGas)
|
|
@@ -2360,7 +2354,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2360
2354
|
case 18:
|
|
2361
2355
|
_q.sent();
|
|
2362
2356
|
gasLimit = DIGas(_gas) * curve.parseUnits("200", 0) / curve.parseUnits("100", 0);
|
|
2363
|
-
return [4 /*yield*/, contract.deposit_and_stake(depositAddress, this.lpToken, this.gauge, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, (!this.isCrypto && this.isNg && this.isPlain) || (isUnderlying && this.isMeta && (new PoolTemplate(this.basePool)).isNg), this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.options), { gasLimit: gasLimit, value: value }))];
|
|
2357
|
+
return [4 /*yield*/, contract.deposit_and_stake(depositAddress, this.lpToken, this.gauge.address, coins.length, coinAddresses, _amounts, _minMintAmount, useUnderlying, (!this.isCrypto && this.isNg && this.isPlain) || (isUnderlying && this.isMeta && (new PoolTemplate(this.basePool)).isNg), this.isMetaFactory && isUnderlying ? this.address : curve.constants.ZERO_ADDRESS, __assign(__assign({}, curve.options), { gasLimit: gasLimit, value: value }))];
|
|
2364
2358
|
case 19: return [2 /*return*/, (_q.sent()).hash];
|
|
2365
2359
|
}
|
|
2366
2360
|
});
|
|
@@ -2842,10 +2836,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2842
2836
|
return __generator(this, function (_c) {
|
|
2843
2837
|
switch (_c.label) {
|
|
2844
2838
|
case 0:
|
|
2845
|
-
if (!(this.gauge === curve.constants.ZERO_ADDRESS)) return [3 /*break*/, 2];
|
|
2839
|
+
if (!(this.gauge.address === curve.constants.ZERO_ADDRESS)) return [3 /*break*/, 2];
|
|
2846
2840
|
return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray(['lpToken'], this.underlyingCoinAddresses, true), this.wrappedCoinAddresses, true), __spreadArray(__spreadArray([this.lpToken], this.underlyingCoinAddresses, true), this.wrappedCoinAddresses, true)], addresses, false))];
|
|
2847
2841
|
case 1: return [2 /*return*/, _c.sent()];
|
|
2848
|
-
case 2: return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray(['lpToken', 'gauge'], this.underlyingCoinAddresses, true), this.wrappedCoinAddresses, true), __spreadArray(__spreadArray([this.lpToken, this.gauge], this.underlyingCoinAddresses, true), this.wrappedCoinAddresses, true)], addresses, false))];
|
|
2842
|
+
case 2: return [4 /*yield*/, this._balances.apply(this, __spreadArray([__spreadArray(__spreadArray(['lpToken', 'gauge'], this.underlyingCoinAddresses, true), this.wrappedCoinAddresses, true), __spreadArray(__spreadArray([this.lpToken, this.gauge.address], this.underlyingCoinAddresses, true), this.wrappedCoinAddresses, true)], addresses, false))];
|
|
2849
2843
|
case 3: return [2 /*return*/, _c.sent()];
|
|
2850
2844
|
}
|
|
2851
2845
|
});
|
|
@@ -2860,10 +2854,10 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
2860
2854
|
return __generator(this, function (_c) {
|
|
2861
2855
|
switch (_c.label) {
|
|
2862
2856
|
case 0:
|
|
2863
|
-
if (!(this.gauge === curve.constants.ZERO_ADDRESS)) return [3 /*break*/, 2];
|
|
2857
|
+
if (!(this.gauge.address === curve.constants.ZERO_ADDRESS)) return [3 /*break*/, 2];
|
|
2864
2858
|
return [4 /*yield*/, this._balances.apply(this, __spreadArray([['lpToken'], [this.lpToken]], addresses, false))];
|
|
2865
2859
|
case 1: return [2 /*return*/, _c.sent()];
|
|
2866
|
-
case 2: return [4 /*yield*/, this._balances.apply(this, __spreadArray([['lpToken', 'gauge'], [this.lpToken, this.gauge]], addresses, false))];
|
|
2860
|
+
case 2: return [4 /*yield*/, this._balances.apply(this, __spreadArray([['lpToken', 'gauge'], [this.lpToken, this.gauge.address]], addresses, false))];
|
|
2867
2861
|
case 3: return [2 /*return*/, _c.sent()];
|
|
2868
2862
|
}
|
|
2869
2863
|
});
|
|
@@ -3025,7 +3019,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
3025
3019
|
return __generator(this, function (_f) {
|
|
3026
3020
|
switch (_f.label) {
|
|
3027
3021
|
case 0:
|
|
3028
|
-
withGauge = this.gauge !== curve.constants.ZERO_ADDRESS;
|
|
3022
|
+
withGauge = this.gauge.address !== curve.constants.ZERO_ADDRESS;
|
|
3029
3023
|
address = address || curve.signerAddress;
|
|
3030
3024
|
if (!address)
|
|
3031
3025
|
throw Error("Need to connect wallet or pass address into args");
|
|
@@ -3038,7 +3032,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
3038
3032
|
if (!withGauge) return [3 /*break*/, 3];
|
|
3039
3033
|
return [4 /*yield*/, curve.multicallProvider.all([
|
|
3040
3034
|
curve.contracts[this.lpToken].multicallContract.totalSupply(),
|
|
3041
|
-
curve.contracts[this.gauge].multicallContract.totalSupply(),
|
|
3035
|
+
curve.contracts[this.gauge.address].multicallContract.totalSupply(),
|
|
3042
3036
|
])];
|
|
3043
3037
|
case 2:
|
|
3044
3038
|
_e = (_f.sent()).map(function (_supply) { return curve.formatUnits(_supply); }), totalLp = _e[0], gaugeLp = _e[1];
|
|
@@ -3373,225 +3367,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
3373
3367
|
case 0: return [4 /*yield*/, _getAllGaugesFormatted()];
|
|
3374
3368
|
case 1:
|
|
3375
3369
|
gaugeData = _c.sent();
|
|
3376
|
-
return [2 /*return*/, gaugeData[this.gauge] ? gaugeData[this.gauge].gaugeStatus : null];
|
|
3377
|
-
}
|
|
3378
|
-
});
|
|
3379
|
-
});
|
|
3380
|
-
};
|
|
3381
|
-
PoolTemplate.prototype._addReward = function (_reward_token, _distributor, estimateGas) {
|
|
3382
|
-
if (estimateGas === void 0) { estimateGas = false; }
|
|
3383
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3384
|
-
var gas, gasLimit;
|
|
3385
|
-
return __generator(this, function (_c) {
|
|
3386
|
-
switch (_c.label) {
|
|
3387
|
-
case 0:
|
|
3388
|
-
if (!(this.gauge !== curve.constants.ZERO_ADDRESS && this.gauge)) return [3 /*break*/, 3];
|
|
3389
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.add_reward.estimateGas(_reward_token, _distributor, __assign({}, curve.constantOptions))];
|
|
3390
|
-
case 1:
|
|
3391
|
-
gas = _c.sent();
|
|
3392
|
-
if (estimateGas)
|
|
3393
|
-
return [2 /*return*/, smartNumber(gas)];
|
|
3394
|
-
gasLimit = mulBy1_3(DIGas(gas));
|
|
3395
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.add_reward(_reward_token, _distributor, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
3396
|
-
case 2: return [2 /*return*/, (_c.sent()).hash];
|
|
3397
|
-
case 3: throw Error("Pool ".concat(this.name, " does not have gauge"));
|
|
3398
|
-
}
|
|
3399
|
-
});
|
|
3400
|
-
});
|
|
3401
|
-
};
|
|
3402
|
-
PoolTemplate.prototype.addRewardEstimateGas = function (rewardToken, distributor) {
|
|
3403
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3404
|
-
return __generator(this, function (_c) {
|
|
3405
|
-
switch (_c.label) {
|
|
3406
|
-
case 0: return [4 /*yield*/, this._addReward(rewardToken, distributor, true)];
|
|
3407
|
-
case 1:
|
|
3408
|
-
// @ts-ignore
|
|
3409
|
-
return [2 /*return*/, _c.sent()];
|
|
3410
|
-
}
|
|
3411
|
-
});
|
|
3412
|
-
});
|
|
3413
|
-
};
|
|
3414
|
-
PoolTemplate.prototype.addReward = function (rewardToken, distributor) {
|
|
3415
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3416
|
-
return __generator(this, function (_c) {
|
|
3417
|
-
switch (_c.label) {
|
|
3418
|
-
case 0: return [4 /*yield*/, this._addReward(rewardToken, distributor)];
|
|
3419
|
-
case 1:
|
|
3420
|
-
// @ts-ignore
|
|
3421
|
-
return [2 /*return*/, _c.sent()];
|
|
3422
|
-
}
|
|
3423
|
-
});
|
|
3424
|
-
});
|
|
3425
|
-
};
|
|
3426
|
-
PoolTemplate.prototype.getGaugeManager = function () {
|
|
3427
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3428
|
-
var e_4;
|
|
3429
|
-
return __generator(this, function (_c) {
|
|
3430
|
-
switch (_c.label) {
|
|
3431
|
-
case 0:
|
|
3432
|
-
if (!(!this.gauge || this.gauge === curve.constants.ZERO_ADDRESS)) return [3 /*break*/, 1];
|
|
3433
|
-
return [2 /*return*/, curve.constants.ZERO_ADDRESS];
|
|
3434
|
-
case 1:
|
|
3435
|
-
_c.trys.push([1, 3, , 4]);
|
|
3436
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.manager()];
|
|
3437
|
-
case 2: return [2 /*return*/, _c.sent()];
|
|
3438
|
-
case 3:
|
|
3439
|
-
e_4 = _c.sent();
|
|
3440
|
-
return [2 /*return*/, curve.constants.ZERO_ADDRESS];
|
|
3441
|
-
case 4: return [2 /*return*/];
|
|
3442
|
-
}
|
|
3443
|
-
});
|
|
3444
|
-
});
|
|
3445
|
-
};
|
|
3446
|
-
PoolTemplate.prototype.getGaugeVersion = function () {
|
|
3447
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3448
|
-
var e_5;
|
|
3449
|
-
return __generator(this, function (_c) {
|
|
3450
|
-
switch (_c.label) {
|
|
3451
|
-
case 0:
|
|
3452
|
-
if (!(!this.gauge || this.gauge === curve.constants.ZERO_ADDRESS)) return [3 /*break*/, 1];
|
|
3453
|
-
return [2 /*return*/, null];
|
|
3454
|
-
case 1:
|
|
3455
|
-
_c.trys.push([1, 3, , 4]);
|
|
3456
|
-
return [4 /*yield*/, curve.contracts[this.gauge].contract.version()];
|
|
3457
|
-
case 2: return [2 /*return*/, _c.sent()];
|
|
3458
|
-
case 3:
|
|
3459
|
-
e_5 = _c.sent();
|
|
3460
|
-
return [2 /*return*/, null];
|
|
3461
|
-
case 4: return [2 /*return*/];
|
|
3462
|
-
}
|
|
3463
|
-
});
|
|
3464
|
-
});
|
|
3465
|
-
};
|
|
3466
|
-
PoolTemplate.prototype.isDepositRewardAvailable = function () {
|
|
3467
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3468
|
-
var versionsWithDepositReward, version;
|
|
3469
|
-
return __generator(this, function (_c) {
|
|
3470
|
-
switch (_c.label) {
|
|
3471
|
-
case 0:
|
|
3472
|
-
versionsWithDepositReward = ['v6.1.0'];
|
|
3473
|
-
return [4 /*yield*/, this.getGaugeVersion()];
|
|
3474
|
-
case 1:
|
|
3475
|
-
version = _c.sent();
|
|
3476
|
-
return [2 /*return*/, version ? versionsWithDepositReward.includes(version) : Boolean(version)];
|
|
3477
|
-
}
|
|
3478
|
-
});
|
|
3479
|
-
});
|
|
3480
|
-
};
|
|
3481
|
-
PoolTemplate.prototype.getGaugeDistributors = function () {
|
|
3482
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3483
|
-
var gaugeContract, gaugeMulticallContract, rewardCount, _c, _d, _e, calls, i, rewardTokens, i, rewardData, gaugeDistributors, i;
|
|
3484
|
-
return __generator(this, function (_f) {
|
|
3485
|
-
switch (_f.label) {
|
|
3486
|
-
case 0: return [4 /*yield*/, curve.contracts[this.gauge].contract];
|
|
3487
|
-
case 1:
|
|
3488
|
-
gaugeContract = _f.sent();
|
|
3489
|
-
return [4 /*yield*/, curve.contracts[this.gauge].multicallContract];
|
|
3490
|
-
case 2:
|
|
3491
|
-
gaugeMulticallContract = _f.sent();
|
|
3492
|
-
_c = Number;
|
|
3493
|
-
_e = (_d = curve).formatUnits;
|
|
3494
|
-
return [4 /*yield*/, gaugeContract.reward_count(curve.constantOptions)];
|
|
3495
|
-
case 3:
|
|
3496
|
-
rewardCount = _c.apply(void 0, [_e.apply(_d, [_f.sent(), 0])]);
|
|
3497
|
-
calls = [];
|
|
3498
|
-
for (i = 0; i < rewardCount; i++) {
|
|
3499
|
-
calls.push(gaugeMulticallContract.reward_tokens(i));
|
|
3500
|
-
}
|
|
3501
|
-
return [4 /*yield*/, curve.multicallProvider.all(calls)];
|
|
3502
|
-
case 4:
|
|
3503
|
-
rewardTokens = _f.sent();
|
|
3504
|
-
for (i = 0; i < rewardCount; i++) {
|
|
3505
|
-
calls.push(gaugeMulticallContract.reward_data(rewardTokens[i]));
|
|
3506
|
-
}
|
|
3507
|
-
return [4 /*yield*/, curve.multicallProvider.all(calls)];
|
|
3508
|
-
case 5:
|
|
3509
|
-
rewardData = _f.sent();
|
|
3510
|
-
gaugeDistributors = {};
|
|
3511
|
-
for (i = 0; i < rewardCount; i++) {
|
|
3512
|
-
gaugeDistributors[rewardTokens[i]] = rewardData[i];
|
|
3513
|
-
}
|
|
3514
|
-
return [2 /*return*/, gaugeDistributors];
|
|
3515
|
-
}
|
|
3516
|
-
});
|
|
3517
|
-
});
|
|
3518
|
-
};
|
|
3519
|
-
PoolTemplate.prototype.depositRewardIsApproved = function (rewardToken, amount) {
|
|
3520
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3521
|
-
return __generator(this, function (_c) {
|
|
3522
|
-
switch (_c.label) {
|
|
3523
|
-
case 0: return [4 /*yield*/, hasAllowance([rewardToken], [amount], curve.signerAddress, this.gauge)];
|
|
3524
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
3525
|
-
}
|
|
3526
|
-
});
|
|
3527
|
-
});
|
|
3528
|
-
};
|
|
3529
|
-
PoolTemplate.prototype.depositRewardApproveEstimateGas = function (rewardToken, amount) {
|
|
3530
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3531
|
-
return __generator(this, function (_c) {
|
|
3532
|
-
switch (_c.label) {
|
|
3533
|
-
case 0: return [4 /*yield*/, ensureAllowanceEstimateGas([rewardToken], [amount], this.gauge)];
|
|
3534
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
3535
|
-
}
|
|
3536
|
-
});
|
|
3537
|
-
});
|
|
3538
|
-
};
|
|
3539
|
-
PoolTemplate.prototype.depositRewardApprove = function (rewardToken, amount) {
|
|
3540
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3541
|
-
return __generator(this, function (_c) {
|
|
3542
|
-
switch (_c.label) {
|
|
3543
|
-
case 0: return [4 /*yield*/, ensureAllowance([rewardToken], [amount], this.gauge)];
|
|
3544
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
3545
|
-
}
|
|
3546
|
-
});
|
|
3547
|
-
});
|
|
3548
|
-
};
|
|
3549
|
-
PoolTemplate.prototype._depositReward = function (rewardToken, amount, epoch, estimateGas) {
|
|
3550
|
-
if (estimateGas === void 0) { estimateGas = false; }
|
|
3551
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3552
|
-
var contract, gas, gasLimit;
|
|
3553
|
-
return __generator(this, function (_c) {
|
|
3554
|
-
switch (_c.label) {
|
|
3555
|
-
case 0:
|
|
3556
|
-
if (!!estimateGas) return [3 /*break*/, 2];
|
|
3557
|
-
return [4 /*yield*/, ensureAllowance([rewardToken], [amount], this.gauge)];
|
|
3558
|
-
case 1:
|
|
3559
|
-
_c.sent();
|
|
3560
|
-
_c.label = 2;
|
|
3561
|
-
case 2:
|
|
3562
|
-
contract = curve.contracts[this.gauge].contract;
|
|
3563
|
-
return [4 /*yield*/, contract.deposit_reward_token.estimateGas(rewardToken, amount, __assign({}, curve.constantOptions))];
|
|
3564
|
-
case 3:
|
|
3565
|
-
gas = _c.sent();
|
|
3566
|
-
if (estimateGas)
|
|
3567
|
-
return [2 /*return*/, smartNumber(gas)];
|
|
3568
|
-
gasLimit = mulBy1_3(DIGas(gas));
|
|
3569
|
-
return [4 /*yield*/, contract.deposit_reward_token(rewardToken, amount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
3570
|
-
case 4: return [2 /*return*/, (_c.sent()).hash];
|
|
3571
|
-
}
|
|
3572
|
-
});
|
|
3573
|
-
});
|
|
3574
|
-
};
|
|
3575
|
-
PoolTemplate.prototype.depositRewardEstimateGas = function (rewardToken, amount, epoch) {
|
|
3576
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3577
|
-
return __generator(this, function (_c) {
|
|
3578
|
-
switch (_c.label) {
|
|
3579
|
-
case 0: return [4 /*yield*/, this._depositReward(rewardToken, amount, epoch, true)];
|
|
3580
|
-
case 1:
|
|
3581
|
-
// @ts-ignore
|
|
3582
|
-
return [2 /*return*/, _c.sent()];
|
|
3583
|
-
}
|
|
3584
|
-
});
|
|
3585
|
-
});
|
|
3586
|
-
};
|
|
3587
|
-
PoolTemplate.prototype.depositReward = function (rewardToken, amount, epoch) {
|
|
3588
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3589
|
-
return __generator(this, function (_c) {
|
|
3590
|
-
switch (_c.label) {
|
|
3591
|
-
case 0: return [4 /*yield*/, this._depositReward(rewardToken, amount, epoch)];
|
|
3592
|
-
case 1:
|
|
3593
|
-
// @ts-ignore
|
|
3594
|
-
return [2 /*return*/, _c.sent()];
|
|
3370
|
+
return [2 /*return*/, gaugeData[this.gauge.address] ? gaugeData[this.gauge.address].gaugeStatus : null];
|
|
3595
3371
|
}
|
|
3596
3372
|
});
|
|
3597
3373
|
});
|
|
@@ -3604,7 +3380,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
3604
3380
|
case 0: return [4 /*yield*/, _getAllGaugesFormatted()];
|
|
3605
3381
|
case 1:
|
|
3606
3382
|
gaugeData = _c.sent();
|
|
3607
|
-
return [2 /*return*/, gaugeData[this.gauge] ? gaugeData[this.gauge].is_killed : false];
|
|
3383
|
+
return [2 /*return*/, gaugeData[this.gauge.address] ? gaugeData[this.gauge.address].is_killed : false];
|
|
3608
3384
|
}
|
|
3609
3385
|
});
|
|
3610
3386
|
});
|