@curvefi/api 2.66.30 → 2.67.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/lib/boosting.d.ts +33 -32
- package/lib/boosting.js +320 -252
- package/lib/cached.d.ts +4 -3
- package/lib/cached.js +63 -19
- package/lib/constants/coins/hyperliquid.d.ts +2 -0
- package/lib/constants/coins/hyperliquid.js +5 -0
- package/lib/constants/coins/index.d.ts +2 -1
- package/lib/constants/coins/index.js +2 -1
- package/lib/constants/factory/crypto.d.ts +5 -0
- package/lib/constants/factory/crypto.js +8 -0
- package/lib/constants/factory/stable.js +3 -0
- package/lib/constants/network_constants.js +37 -11
- package/lib/constants/pools/hyperliquid.d.ts +2 -0
- package/lib/constants/pools/hyperliquid.js +2 -0
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +2 -1
- package/lib/constants/utils.d.ts +14 -1
- package/lib/constants/utils.js +21 -6
- package/lib/constants/volumeNetworks.js +1 -1
- package/lib/curve.d.ts +5 -5
- package/lib/curve.js +21 -38
- package/lib/dao.d.ts +32 -31
- package/lib/dao.js +420 -350
- package/lib/external-api.d.ts +1 -1
- package/lib/external-api.js +2 -2
- package/lib/factory/common.d.ts +2 -1
- package/lib/factory/common.js +1 -1
- package/lib/factory/deploy.d.ts +46 -45
- package/lib/factory/deploy.js +630 -551
- package/lib/factory/factory-api.d.ts +3 -2
- package/lib/factory/factory-api.js +22 -23
- package/lib/factory/factory-crypto.d.ts +1 -1
- package/lib/factory/factory-crypto.js +12 -15
- package/lib/factory/factory-tricrypto.d.ts +1 -1
- package/lib/factory/factory-tricrypto.js +14 -15
- package/lib/factory/factory-twocrypto.d.ts +1 -1
- package/lib/factory/factory-twocrypto.js +12 -13
- package/lib/factory/factory.d.ts +4 -3
- package/lib/factory/factory.js +21 -24
- package/lib/index.d.ts +413 -104
- package/lib/index.js +253 -257
- package/lib/interfaces.d.ts +2 -0
- package/lib/pools/PoolTemplate.d.ts +13 -12
- package/lib/pools/PoolTemplate.js +279 -285
- package/lib/pools/mixins/common.js +2 -2
- package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +12 -4
- package/lib/pools/mixins/depositBalancedAmountsMixins.js +1 -15
- package/lib/pools/mixins/depositMixins.d.ts +25 -5
- package/lib/pools/mixins/depositMixins.js +38 -76
- package/lib/pools/mixins/depositWrappedMixins.d.ts +10 -2
- package/lib/pools/mixins/depositWrappedMixins.js +17 -33
- package/lib/pools/mixins/poolBalancesMixin.d.ts +6 -2
- package/lib/pools/mixins/poolBalancesMixin.js +3 -5
- package/lib/pools/mixins/swapMixins.d.ts +20 -4
- package/lib/pools/mixins/swapMixins.js +36 -70
- package/lib/pools/mixins/swapWrappedMixins.d.ts +19 -4
- package/lib/pools/mixins/swapWrappedMixins.js +32 -60
- package/lib/pools/mixins/withdrawExpectedMixins.d.ts +12 -4
- package/lib/pools/mixins/withdrawExpectedMixins.js +6 -11
- package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +20 -4
- package/lib/pools/mixins/withdrawImbalanceMixins.js +26 -53
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +10 -2
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +12 -27
- package/lib/pools/mixins/withdrawMixins.d.ts +25 -5
- package/lib/pools/mixins/withdrawMixins.js +33 -67
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +12 -4
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +8 -13
- package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +25 -5
- package/lib/pools/mixins/withdrawOneCoinMixins.js +32 -66
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +6 -2
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +4 -7
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +10 -2
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +13 -29
- package/lib/pools/mixins/withdrawWrappedMixins.d.ts +10 -2
- package/lib/pools/mixins/withdrawWrappedMixins.js +14 -28
- package/lib/pools/poolConstructor.d.ts +2 -1
- package/lib/pools/poolConstructor.js +27 -28
- package/lib/pools/subClasses/corePool.d.ts +4 -1
- package/lib/pools/subClasses/corePool.js +5 -7
- package/lib/pools/subClasses/gaugePool.d.ts +5 -3
- package/lib/pools/subClasses/gaugePool.js +19 -18
- package/lib/pools/subClasses/statsPool.d.ts +2 -0
- package/lib/pools/subClasses/statsPool.js +22 -10
- package/lib/pools/subClasses/walletPool.d.ts +2 -1
- package/lib/pools/subClasses/walletPool.js +6 -6
- package/lib/pools/utils.d.ts +7 -6
- package/lib/pools/utils.js +316 -297
- package/lib/route-graph.worker.d.ts +2 -2
- package/lib/route-graph.worker.js +4 -6
- package/lib/router.d.ts +12 -11
- package/lib/router.js +331 -295
- package/lib/utils.d.ts +34 -33
- package/lib/utils.js +483 -435
- package/package.json +2 -2
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
export declare const withdrawOneCoinMetaFactoryMixin:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export declare const withdrawOneCoinMetaFactoryMixin: {
|
|
3
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
5
|
+
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
export declare const withdrawOneCoinCryptoMetaFactoryMixin: {
|
|
8
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
9
|
+
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
10
|
+
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
11
|
+
};
|
|
12
|
+
export declare const withdrawOneCoinZapMixin: {
|
|
13
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
14
|
+
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
15
|
+
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
16
|
+
};
|
|
17
|
+
export declare const withdrawOneCoinLendingOrCryptoMixin: {
|
|
18
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
19
|
+
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
20
|
+
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
21
|
+
};
|
|
22
|
+
export declare const withdrawOneCoinPlainMixin: {
|
|
23
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
24
|
+
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
25
|
+
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
26
|
+
};
|
|
@@ -7,21 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { _ensureAllowance, fromBN, hasAllowance, toBN, parseUnits, mulBy1_3, smartNumber, DIGas } from '../../utils.js';
|
|
12
|
-
// @ts-ignore
|
|
10
|
+
import { _ensureAllowance, DIGas, fromBN, hasAllowance, mulBy1_3, parseUnits, smartNumber, toBN } from '../../utils.js';
|
|
13
11
|
function _withdrawOneCoinCheck(lpTokenAmount_1, coin_1) {
|
|
14
12
|
return __awaiter(this, arguments, void 0, function* (lpTokenAmount, coin, estimateGas = false) {
|
|
15
13
|
const lpTokenBalance = (yield this.wallet.lpTokenBalances())['lpToken'];
|
|
16
14
|
if (Number(lpTokenBalance) < Number(lpTokenAmount)) {
|
|
17
15
|
throw Error(`Not enough LP tokens. Actual: ${lpTokenBalance}, required: ${lpTokenAmount}`);
|
|
18
16
|
}
|
|
19
|
-
if (estimateGas && this.zap && !(yield hasAllowance([this.lpToken], [lpTokenAmount], curve.signerAddress, this.zap))) {
|
|
17
|
+
if (estimateGas && this.zap && !(yield hasAllowance.call(this.curve, [this.lpToken], [lpTokenAmount], this.curve.signerAddress, this.zap))) {
|
|
20
18
|
throw Error("Token allowance is needed to estimate gas");
|
|
21
19
|
}
|
|
22
20
|
if (!estimateGas)
|
|
23
|
-
yield curve.updateFeeData();
|
|
24
|
-
// @ts-ignore
|
|
21
|
+
yield this.curve.updateFeeData();
|
|
25
22
|
const i = this._getCoinIdx(coin);
|
|
26
23
|
const _lpTokenAmount = parseUnits(lpTokenAmount);
|
|
27
24
|
return [_lpTokenAmount, i];
|
|
@@ -29,173 +26,142 @@ function _withdrawOneCoinCheck(lpTokenAmount_1, coin_1) {
|
|
|
29
26
|
}
|
|
30
27
|
function _withdrawOneCoinMinAmount(_lpTokenAmount_1, i_1) {
|
|
31
28
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage = 0.5) {
|
|
32
|
-
// @ts-ignore
|
|
33
29
|
const _expectedLpTokenAmount = yield this._withdrawOneCoinExpected(_lpTokenAmount, i);
|
|
34
30
|
const minAmountBN = toBN(_expectedLpTokenAmount).times(100 - slippage).div(100);
|
|
35
31
|
return fromBN(minAmountBN);
|
|
36
32
|
});
|
|
37
33
|
}
|
|
38
|
-
// @ts-ignore
|
|
39
34
|
export const withdrawOneCoinMetaFactoryMixin = {
|
|
40
|
-
// @ts-ignore
|
|
41
35
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
42
36
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
43
37
|
if (!estimateGas)
|
|
44
|
-
yield _ensureAllowance([this.lpToken], [_lpTokenAmount], this.zap);
|
|
38
|
+
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
45
39
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
46
|
-
const contract = curve.contracts[this.zap].contract;
|
|
47
|
-
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, curve.constantOptions);
|
|
40
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
41
|
+
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
48
42
|
if (estimateGas)
|
|
49
43
|
return smartNumber(gas);
|
|
50
44
|
const gasLimit = mulBy1_3(DIGas(gas));
|
|
51
|
-
return (yield contract.remove_liquidity_one_coin(this.address, _lpTokenAmount, i, _minAmount, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
45
|
+
return (yield contract.remove_liquidity_one_coin(this.address, _lpTokenAmount, i, _minAmount, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
52
46
|
});
|
|
53
47
|
},
|
|
54
48
|
withdrawOneCoinEstimateGas(lpTokenAmount, coin) {
|
|
55
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
// @ts-ignore
|
|
57
50
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true);
|
|
58
|
-
|
|
59
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true);
|
|
51
|
+
return yield withdrawOneCoinMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, 0.1, true);
|
|
60
52
|
});
|
|
61
53
|
},
|
|
62
54
|
withdrawOneCoin(lpTokenAmount, coin, slippage) {
|
|
63
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
// @ts-ignore
|
|
65
56
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin);
|
|
66
|
-
|
|
67
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, slippage);
|
|
57
|
+
return yield withdrawOneCoinMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
68
58
|
});
|
|
69
59
|
},
|
|
70
60
|
};
|
|
71
|
-
// @ts-ignore
|
|
72
61
|
export const withdrawOneCoinCryptoMetaFactoryMixin = {
|
|
73
|
-
// @ts-ignore
|
|
74
62
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
75
63
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
76
64
|
if (!estimateGas)
|
|
77
|
-
yield _ensureAllowance([this.lpToken], [_lpTokenAmount], this.zap);
|
|
65
|
+
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
78
66
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
79
|
-
const contract = curve.contracts[this.zap].contract;
|
|
80
|
-
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, true, curve.constantOptions);
|
|
67
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
68
|
+
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, true, this.curve.constantOptions);
|
|
81
69
|
if (estimateGas)
|
|
82
70
|
return smartNumber(gas);
|
|
83
71
|
const gasLimit = mulBy1_3(DIGas(gas));
|
|
84
|
-
return (yield contract.remove_liquidity_one_coin(this.address, _lpTokenAmount, i, _minAmount, true, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
72
|
+
return (yield contract.remove_liquidity_one_coin(this.address, _lpTokenAmount, i, _minAmount, true, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
85
73
|
});
|
|
86
74
|
},
|
|
87
75
|
withdrawOneCoinEstimateGas(lpTokenAmount, coin) {
|
|
88
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
// @ts-ignore
|
|
90
77
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true);
|
|
91
|
-
|
|
92
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true);
|
|
78
|
+
return yield withdrawOneCoinCryptoMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, 0.1, true);
|
|
93
79
|
});
|
|
94
80
|
},
|
|
95
81
|
withdrawOneCoin(lpTokenAmount, coin, slippage) {
|
|
96
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
// @ts-ignore
|
|
98
83
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin);
|
|
99
|
-
|
|
100
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, slippage);
|
|
84
|
+
return yield withdrawOneCoinCryptoMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
101
85
|
});
|
|
102
86
|
},
|
|
103
87
|
};
|
|
104
|
-
// @ts-ignore
|
|
105
88
|
export const withdrawOneCoinZapMixin = {
|
|
106
|
-
// @ts-ignore
|
|
107
89
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
108
90
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
109
91
|
if (!estimateGas)
|
|
110
|
-
yield _ensureAllowance([this.lpToken], [_lpTokenAmount], this.zap);
|
|
92
|
+
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
111
93
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
112
|
-
const contract = curve.contracts[this.zap].contract;
|
|
94
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
113
95
|
const args = [_lpTokenAmount, i, _minAmount];
|
|
114
96
|
if (`remove_liquidity_one_coin(uint256,uint256,uint256,bool)` in contract)
|
|
115
97
|
args.push(true);
|
|
116
|
-
const gas = yield contract.remove_liquidity_one_coin.estimateGas(...args, curve.constantOptions);
|
|
98
|
+
const gas = yield contract.remove_liquidity_one_coin.estimateGas(...args, this.curve.constantOptions);
|
|
117
99
|
if (estimateGas)
|
|
118
100
|
return smartNumber(gas);
|
|
119
101
|
const gasLimit = mulBy1_3(DIGas(gas));
|
|
120
|
-
return (yield contract.remove_liquidity_one_coin(...args, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
102
|
+
return (yield contract.remove_liquidity_one_coin(...args, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
121
103
|
});
|
|
122
104
|
},
|
|
123
105
|
withdrawOneCoinEstimateGas(lpTokenAmount, coin) {
|
|
124
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
// @ts-ignore
|
|
126
107
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true);
|
|
127
|
-
|
|
128
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true);
|
|
108
|
+
return yield withdrawOneCoinZapMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, 0.1, true);
|
|
129
109
|
});
|
|
130
110
|
},
|
|
131
111
|
withdrawOneCoin(lpTokenAmount, coin, slippage) {
|
|
132
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
// @ts-ignore
|
|
134
113
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin);
|
|
135
|
-
|
|
136
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, slippage);
|
|
114
|
+
return yield withdrawOneCoinZapMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
137
115
|
});
|
|
138
116
|
},
|
|
139
117
|
};
|
|
140
|
-
// @ts-ignore
|
|
141
118
|
export const withdrawOneCoinLendingOrCryptoMixin = {
|
|
142
|
-
// @ts-ignore
|
|
143
119
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
144
120
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
145
121
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
146
|
-
const contract = curve.contracts[this.address].contract;
|
|
147
|
-
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, true, curve.constantOptions);
|
|
122
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
123
|
+
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, true, this.curve.constantOptions);
|
|
148
124
|
if (estimateGas)
|
|
149
125
|
return smartNumber(gas);
|
|
150
|
-
const gasLimit = curve.chainId === 137 && this.id === 'ren' ? DIGas(gas) * curve.parseUnits("160", 0) / curve.parseUnits("100", 0) : mulBy1_3(DIGas(gas));
|
|
151
|
-
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, true, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
126
|
+
const gasLimit = this.curve.chainId === 137 && this.id === 'ren' ? DIGas(gas) * this.curve.parseUnits("160", 0) / this.curve.parseUnits("100", 0) : mulBy1_3(DIGas(gas));
|
|
127
|
+
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, true, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
152
128
|
});
|
|
153
129
|
},
|
|
154
130
|
withdrawOneCoinEstimateGas(lpTokenAmount, coin) {
|
|
155
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
// @ts-ignore
|
|
157
132
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true);
|
|
158
|
-
|
|
159
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true);
|
|
133
|
+
return yield withdrawOneCoinLendingOrCryptoMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, 0.1, true);
|
|
160
134
|
});
|
|
161
135
|
},
|
|
162
136
|
withdrawOneCoin(lpTokenAmount, coin, slippage) {
|
|
163
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
// @ts-ignore
|
|
165
138
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin);
|
|
166
|
-
|
|
167
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, slippage);
|
|
139
|
+
return yield withdrawOneCoinLendingOrCryptoMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
168
140
|
});
|
|
169
141
|
},
|
|
170
142
|
};
|
|
171
|
-
// @ts-ignore
|
|
172
143
|
export const withdrawOneCoinPlainMixin = {
|
|
173
|
-
// @ts-ignore
|
|
174
144
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
175
145
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
176
146
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
177
|
-
const contract = curve.contracts[this.address].contract;
|
|
178
|
-
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, curve.constantOptions);
|
|
147
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
148
|
+
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
179
149
|
if (estimateGas)
|
|
180
150
|
return smartNumber(gas);
|
|
181
151
|
const gasLimit = mulBy1_3(DIGas(gas));
|
|
182
|
-
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
152
|
+
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
183
153
|
});
|
|
184
154
|
},
|
|
185
155
|
withdrawOneCoinEstimateGas(lpTokenAmount, coin) {
|
|
186
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
// @ts-ignore
|
|
188
157
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true);
|
|
189
|
-
|
|
190
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true);
|
|
158
|
+
return yield withdrawOneCoinPlainMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, 0.1, true);
|
|
191
159
|
});
|
|
192
160
|
},
|
|
193
161
|
withdrawOneCoin(lpTokenAmount, coin, slippage) {
|
|
194
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
// @ts-ignore
|
|
196
163
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinCheck.call(this, lpTokenAmount, coin);
|
|
197
|
-
|
|
198
|
-
return yield this._withdrawOneCoin(_lpTokenAmount, i, slippage);
|
|
164
|
+
return yield withdrawOneCoinPlainMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
199
165
|
});
|
|
200
166
|
},
|
|
201
167
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
export declare const withdrawOneCoinWrappedExpected2argsMixin:
|
|
3
|
-
|
|
2
|
+
export declare const withdrawOneCoinWrappedExpected2argsMixin: {
|
|
3
|
+
_withdrawOneCoinWrappedExpected(this: PoolTemplate, _lpTokenAmount: bigint, i: number): Promise<bigint>;
|
|
4
|
+
};
|
|
5
|
+
export declare const withdrawOneCoinWrappedExpected3argsMixin: {
|
|
6
|
+
_withdrawOneCoinWrappedExpected(this: PoolTemplate, _lpTokenAmount: bigint, i: number): Promise<bigint>;
|
|
7
|
+
};
|
|
@@ -7,22 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { curve } from "../../curve.js";
|
|
11
|
-
// @ts-ignore
|
|
12
10
|
export const withdrawOneCoinWrappedExpected2argsMixin = {
|
|
13
11
|
_withdrawOneCoinWrappedExpected(_lpTokenAmount, i) {
|
|
14
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
const contract = curve.contracts[this.address].contract;
|
|
16
|
-
return yield contract.calc_withdraw_one_coin(_lpTokenAmount, i, curve.constantOptions);
|
|
13
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
14
|
+
return yield contract.calc_withdraw_one_coin(_lpTokenAmount, i, this.curve.constantOptions);
|
|
17
15
|
});
|
|
18
16
|
},
|
|
19
17
|
};
|
|
20
|
-
// @ts-ignore
|
|
21
18
|
export const withdrawOneCoinWrappedExpected3argsMixin = {
|
|
22
19
|
_withdrawOneCoinWrappedExpected(_lpTokenAmount, i) {
|
|
23
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const contract = curve.contracts[this.address].contract;
|
|
25
|
-
return yield contract.calc_withdraw_one_coin(_lpTokenAmount, i, false, curve.constantOptions);
|
|
21
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
22
|
+
return yield contract.calc_withdraw_one_coin(_lpTokenAmount, i, false, this.curve.constantOptions);
|
|
26
23
|
});
|
|
27
24
|
},
|
|
28
25
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
export declare const withdrawOneCoinWrappedLendingOrCryptoMixin:
|
|
3
|
-
|
|
2
|
+
export declare const withdrawOneCoinWrappedLendingOrCryptoMixin: {
|
|
3
|
+
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
withdrawOneCoinWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number>;
|
|
5
|
+
withdrawOneCoinWrapped(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
export declare const withdrawOneCoinWrappedMixin: {
|
|
8
|
+
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
9
|
+
withdrawOneCoinWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number>;
|
|
10
|
+
withdrawOneCoinWrapped(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
11
|
+
};
|
|
@@ -7,17 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { fromBN, toBN, parseUnits, mulBy1_3, smartNumber, DIGas } from '../../utils.js';
|
|
12
|
-
// @ts-ignore
|
|
10
|
+
import { DIGas, fromBN, mulBy1_3, parseUnits, smartNumber, toBN } from '../../utils.js';
|
|
13
11
|
function _withdrawOneCoinWrappedCheck(lpTokenAmount, coin) {
|
|
14
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
13
|
const lpTokenBalance = (yield this.wallet.lpTokenBalances())['lpToken'];
|
|
16
14
|
if (Number(lpTokenBalance) < Number(lpTokenAmount)) {
|
|
17
15
|
throw Error(`Not enough LP tokens. Actual: ${lpTokenBalance}, required: ${lpTokenAmount}`);
|
|
18
16
|
}
|
|
19
|
-
yield curve.updateFeeData();
|
|
20
|
-
// @ts-ignore
|
|
17
|
+
yield this.curve.updateFeeData();
|
|
21
18
|
const i = this._getCoinIdx(coin, false);
|
|
22
19
|
const _lpTokenAmount = parseUnits(lpTokenAmount);
|
|
23
20
|
return [_lpTokenAmount, i];
|
|
@@ -25,71 +22,58 @@ function _withdrawOneCoinWrappedCheck(lpTokenAmount, coin) {
|
|
|
25
22
|
}
|
|
26
23
|
function _withdrawOneCoinWrappedMinAmount(_lpTokenAmount_1, i_1) {
|
|
27
24
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage = 0.5) {
|
|
28
|
-
// @ts-ignore
|
|
29
25
|
const _expectedLpTokenAmount = yield this._withdrawOneCoinWrappedExpected(_lpTokenAmount, i);
|
|
30
26
|
const minAmountBN = toBN(_expectedLpTokenAmount).times(100 - slippage).div(100);
|
|
31
27
|
return fromBN(minAmountBN);
|
|
32
28
|
});
|
|
33
29
|
}
|
|
34
|
-
// @ts-ignore
|
|
35
30
|
export const withdrawOneCoinWrappedLendingOrCryptoMixin = {
|
|
36
|
-
// @ts-ignore
|
|
37
31
|
_withdrawOneCoinWrapped(_lpTokenAmount_1, i_1, slippage_1) {
|
|
38
32
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
39
33
|
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
40
|
-
const contract = curve.contracts[this.address].contract;
|
|
41
|
-
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, false, curve.constantOptions);
|
|
34
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
35
|
+
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, false, this.curve.constantOptions);
|
|
42
36
|
if (estimateGas)
|
|
43
37
|
return smartNumber(gas);
|
|
44
|
-
const gasLimit = curve.chainId === 137 && this.id === 'ren' ? DIGas(gas) * curve.parseUnits("160", 0) / curve.parseUnits("100", 0) : mulBy1_3(DIGas(gas));
|
|
45
|
-
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, false, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
38
|
+
const gasLimit = this.curve.chainId === 137 && this.id === 'ren' ? DIGas(gas) * this.curve.parseUnits("160", 0) / this.curve.parseUnits("100", 0) : mulBy1_3(DIGas(gas));
|
|
39
|
+
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, false, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
46
40
|
});
|
|
47
41
|
},
|
|
48
42
|
withdrawOneCoinWrappedEstimateGas(lpTokenAmount, coin) {
|
|
49
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
// @ts-ignore
|
|
51
44
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin);
|
|
52
|
-
|
|
53
|
-
return yield this._withdrawOneCoinWrapped(_lpTokenAmount, i, 0.1, true);
|
|
45
|
+
return yield withdrawOneCoinWrappedLendingOrCryptoMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, 0.1, true);
|
|
54
46
|
});
|
|
55
47
|
},
|
|
56
48
|
withdrawOneCoinWrapped(lpTokenAmount, coin, slippage) {
|
|
57
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
// @ts-ignore
|
|
59
50
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin);
|
|
60
|
-
|
|
61
|
-
return yield this._withdrawOneCoinWrapped(_lpTokenAmount, i, slippage);
|
|
51
|
+
return yield withdrawOneCoinWrappedLendingOrCryptoMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, slippage);
|
|
62
52
|
});
|
|
63
53
|
},
|
|
64
54
|
};
|
|
65
|
-
// @ts-ignore
|
|
66
55
|
export const withdrawOneCoinWrappedMixin = {
|
|
67
|
-
// @ts-ignore
|
|
68
56
|
_withdrawOneCoinWrapped(_lpTokenAmount_1, i_1, slippage_1) {
|
|
69
57
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
70
58
|
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
71
|
-
const contract = curve.contracts[this.address].contract;
|
|
72
|
-
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, curve.constantOptions);
|
|
59
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
60
|
+
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
73
61
|
if (estimateGas)
|
|
74
62
|
return smartNumber(gas);
|
|
75
63
|
const gasLimit = mulBy1_3(DIGas(gas));
|
|
76
|
-
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
64
|
+
return (yield contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
77
65
|
});
|
|
78
66
|
},
|
|
79
67
|
withdrawOneCoinWrappedEstimateGas(lpTokenAmount, coin) {
|
|
80
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
// @ts-ignore
|
|
82
69
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin);
|
|
83
|
-
|
|
84
|
-
return yield this._withdrawOneCoinWrapped(_lpTokenAmount, i, 0.1, true);
|
|
70
|
+
return yield withdrawOneCoinWrappedMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, 0.1, true);
|
|
85
71
|
});
|
|
86
72
|
},
|
|
87
73
|
withdrawOneCoinWrapped(lpTokenAmount, coin, slippage) {
|
|
88
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
// @ts-ignore
|
|
90
75
|
const [_lpTokenAmount, i] = yield _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin);
|
|
91
|
-
|
|
92
|
-
return yield this._withdrawOneCoinWrapped(_lpTokenAmount, i, slippage);
|
|
76
|
+
return yield withdrawOneCoinWrappedMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, slippage);
|
|
93
77
|
});
|
|
94
78
|
},
|
|
95
79
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
export declare const withdrawWrapped2argsMixin:
|
|
3
|
-
|
|
2
|
+
export declare const withdrawWrapped2argsMixin: {
|
|
3
|
+
_withdrawWrapped(this: PoolTemplate, _lpTokenAmount: bigint, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
withdrawWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string): Promise<number>;
|
|
5
|
+
withdrawWrapped(this: PoolTemplate, lpTokenAmount: number | string, slippage?: number): Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
export declare const withdrawWrapped3argsMixin: {
|
|
8
|
+
_withdrawWrapped(this: PoolTemplate, _lpTokenAmount: bigint, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
9
|
+
withdrawWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string): Promise<number>;
|
|
10
|
+
withdrawWrapped(this: PoolTemplate, lpTokenAmount: number | string, slippage?: number): Promise<string>;
|
|
11
|
+
};
|
|
@@ -7,86 +7,72 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { fromBN, toBN, parseUnits, mulBy1_3, smartNumber, DIGas } from '../../utils.js';
|
|
12
|
-
// @ts-ignore
|
|
10
|
+
import { DIGas, fromBN, mulBy1_3, parseUnits, smartNumber, toBN } from '../../utils.js';
|
|
13
11
|
function _withdrawWrappedCheck(lpTokenAmount) {
|
|
14
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
13
|
const lpTokenBalance = (yield this.wallet.lpTokenBalances())['lpToken'];
|
|
16
14
|
if (Number(lpTokenBalance) < Number(lpTokenAmount)) {
|
|
17
15
|
throw Error(`Not enough LP tokens. Actual: ${lpTokenBalance}, required: ${lpTokenAmount}`);
|
|
18
16
|
}
|
|
19
|
-
yield curve.updateFeeData();
|
|
17
|
+
yield this.curve.updateFeeData();
|
|
20
18
|
return parseUnits(lpTokenAmount);
|
|
21
19
|
});
|
|
22
20
|
}
|
|
23
21
|
function _withdrawWrappedMinAmounts(_lpTokenAmount_1) {
|
|
24
22
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, slippage = 0.5) {
|
|
25
|
-
const expectedAmounts = yield this.withdrawWrappedExpected(curve.formatUnits(_lpTokenAmount));
|
|
26
|
-
const _expectedAmounts = expectedAmounts.map((a, i) => curve.parseUnits(a, this.wrappedDecimals[i]));
|
|
23
|
+
const expectedAmounts = yield this.withdrawWrappedExpected(this.curve.formatUnits(_lpTokenAmount));
|
|
24
|
+
const _expectedAmounts = expectedAmounts.map((a, i) => this.curve.parseUnits(a, this.wrappedDecimals[i]));
|
|
27
25
|
const minRecvAmountsBN = _expectedAmounts.map((_a, i) => toBN(_a, this.wrappedDecimals[i]).times(100 - slippage).div(100));
|
|
28
26
|
return minRecvAmountsBN.map((a, i) => fromBN(a, this.wrappedDecimals[i]));
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
|
-
// @ts-ignore
|
|
32
29
|
export const withdrawWrapped2argsMixin = {
|
|
33
|
-
// @ts-ignore
|
|
34
30
|
_withdrawWrapped(_lpTokenAmount_1, slippage_1) {
|
|
35
31
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, slippage, estimateGas = false) {
|
|
36
32
|
const _minAmounts = yield _withdrawWrappedMinAmounts.call(this, _lpTokenAmount, slippage);
|
|
37
|
-
const contract = curve.contracts[this.address].contract;
|
|
38
|
-
const gas = yield contract.remove_liquidity.estimateGas(_lpTokenAmount, _minAmounts, curve.constantOptions);
|
|
33
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
34
|
+
const gas = yield contract.remove_liquidity.estimateGas(_lpTokenAmount, _minAmounts, this.curve.constantOptions);
|
|
39
35
|
if (estimateGas)
|
|
40
36
|
return smartNumber(gas);
|
|
41
37
|
const gasLimit = mulBy1_3(DIGas(gas));
|
|
42
|
-
return (yield contract.remove_liquidity(_lpTokenAmount, _minAmounts, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
38
|
+
return (yield contract.remove_liquidity(_lpTokenAmount, _minAmounts, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
43
39
|
});
|
|
44
40
|
},
|
|
45
41
|
withdrawWrappedEstimateGas(lpTokenAmount) {
|
|
46
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
// @ts-ignore
|
|
48
43
|
const _lpTokenAmount = yield _withdrawWrappedCheck.call(this, lpTokenAmount);
|
|
49
|
-
|
|
50
|
-
return yield this._withdrawWrapped(_lpTokenAmount, 0.1, true);
|
|
44
|
+
return yield withdrawWrapped2argsMixin._withdrawWrapped.call(this, _lpTokenAmount, 0.1, true);
|
|
51
45
|
});
|
|
52
46
|
},
|
|
53
47
|
withdrawWrapped(lpTokenAmount, slippage) {
|
|
54
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
// @ts-ignore
|
|
56
49
|
const _lpTokenAmount = yield _withdrawWrappedCheck.call(this, lpTokenAmount);
|
|
57
|
-
|
|
58
|
-
return yield this._withdrawWrapped(_lpTokenAmount, slippage);
|
|
50
|
+
return yield withdrawWrapped2argsMixin._withdrawWrapped.call(this, _lpTokenAmount, slippage);
|
|
59
51
|
});
|
|
60
52
|
},
|
|
61
53
|
};
|
|
62
|
-
// @ts-ignore
|
|
63
54
|
export const withdrawWrapped3argsMixin = {
|
|
64
|
-
// @ts-ignore
|
|
65
55
|
_withdrawWrapped(_lpTokenAmount_1, slippage_1) {
|
|
66
56
|
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, slippage, estimateGas = false) {
|
|
67
57
|
const _minAmounts = yield _withdrawWrappedMinAmounts.call(this, _lpTokenAmount, slippage);
|
|
68
|
-
const contract = curve.contracts[this.address].contract;
|
|
69
|
-
const gas = yield contract.remove_liquidity.estimateGas(_lpTokenAmount, _minAmounts, false, curve.constantOptions);
|
|
58
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
59
|
+
const gas = yield contract.remove_liquidity.estimateGas(_lpTokenAmount, _minAmounts, false, this.curve.constantOptions);
|
|
70
60
|
if (estimateGas)
|
|
71
61
|
return smartNumber(gas);
|
|
72
62
|
const gasLimit = mulBy1_3(DIGas(gas));
|
|
73
|
-
return (yield contract.remove_liquidity(_lpTokenAmount, _minAmounts, false, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
|
63
|
+
return (yield contract.remove_liquidity(_lpTokenAmount, _minAmounts, false, Object.assign(Object.assign({}, this.curve.options), { gasLimit }))).hash;
|
|
74
64
|
});
|
|
75
65
|
},
|
|
76
66
|
withdrawWrappedEstimateGas(lpTokenAmount) {
|
|
77
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
// @ts-ignore
|
|
79
68
|
const _lpTokenAmount = yield _withdrawWrappedCheck.call(this, lpTokenAmount);
|
|
80
|
-
|
|
81
|
-
return yield this._withdrawWrapped(_lpTokenAmount, 0.1, true);
|
|
69
|
+
return yield withdrawWrapped3argsMixin._withdrawWrapped.call(this, _lpTokenAmount, 0.1, true);
|
|
82
70
|
});
|
|
83
71
|
},
|
|
84
72
|
withdrawWrapped(lpTokenAmount, slippage) {
|
|
85
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
// @ts-ignore
|
|
87
74
|
const _lpTokenAmount = yield _withdrawWrappedCheck.call(this, lpTokenAmount);
|
|
88
|
-
|
|
89
|
-
return yield this._withdrawWrapped(_lpTokenAmount, slippage);
|
|
75
|
+
return yield withdrawWrapped3argsMixin._withdrawWrapped.call(this, _lpTokenAmount, slippage);
|
|
90
76
|
});
|
|
91
77
|
},
|
|
92
78
|
};
|