@curvefi/api 2.68.32 → 2.68.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -1
- package/lib/interfaces.d.ts +1 -1
- package/lib/pools/PoolTemplate.d.ts +21 -5
- package/lib/pools/PoolTemplate.js +80 -0
- package/lib/pools/mixins/depositMixins.d.ts +13 -7
- package/lib/pools/mixins/depositMixins.js +70 -10
- package/lib/pools/mixins/depositWrappedMixins.d.ts +5 -2
- package/lib/pools/mixins/depositWrappedMixins.js +28 -4
- package/lib/pools/mixins/swapMixins.d.ts +9 -9
- package/lib/pools/mixins/swapWrappedMixins.d.ts +5 -5
- package/lib/pools/mixins/withdrawExpectedMixins.d.ts +4 -0
- package/lib/pools/mixins/withdrawExpectedMixins.js +22 -0
- package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +11 -5
- package/lib/pools/mixins/withdrawOneCoinMixins.js +70 -10
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +2 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +12 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +5 -2
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +28 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -983,13 +983,100 @@ import curve from "@curvefi/api";
|
|
|
983
983
|
})()
|
|
984
984
|
```
|
|
985
985
|
|
|
986
|
-
###
|
|
986
|
+
### BigInt methods
|
|
987
|
+
|
|
988
|
+
- `pool.swapExpectedBigInt(inputCoin, outputCoin, amount: bigint): Promise<bigint>`
|
|
989
|
+
- `pool.swapWrappedExpectedBigInt(inputCoin, outputCoin, amount: bigint): Promise<bigint>`
|
|
990
|
+
- `pool.depositExpectedBigInt(amounts: bigint[]): Promise<bigint>`
|
|
991
|
+
- `pool.depositWrappedExpectedBigInt(amounts: bigint[]): Promise<bigint>`
|
|
992
|
+
- `pool.withdrawExpectedBigInt(lpTokenAmount: bigint): Promise<bigint[]>`
|
|
993
|
+
- `pool.withdrawWrappedExpectedBigInt(lpTokenAmount: bigint): Promise<bigint[]>`
|
|
994
|
+
- `pool.withdrawOneCoinExpectedBigInt(lpTokenAmount: bigint, coin: string | number): Promise<bigint>`
|
|
995
|
+
- `pool.withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount: bigint, coin: string | number): Promise<bigint>`
|
|
996
|
+
|
|
997
|
+
### Getting method ABI metadata
|
|
987
998
|
```ts
|
|
988
999
|
(async () => {
|
|
989
1000
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
990
1001
|
|
|
991
1002
|
const pool = curve.getPool('mim');
|
|
992
1003
|
|
|
1004
|
+
// Get exact ABI information for deposit (underlying) without executing the transaction
|
|
1005
|
+
const depositInfo = await pool.abi.deposit();
|
|
1006
|
+
console.log(depositInfo);
|
|
1007
|
+
// {
|
|
1008
|
+
// address: '0xa79828df1850e8a3a3064576f380d90aecdd3359', // Contract address (zap or pool)
|
|
1009
|
+
// method: 'add_liquidity', // Method name
|
|
1010
|
+
// abi: {
|
|
1011
|
+
// type: 'function',
|
|
1012
|
+
// name: 'add_liquidity',
|
|
1013
|
+
// inputs: [
|
|
1014
|
+
// { name: '_pool', type: 'address' },
|
|
1015
|
+
// { name: '_deposit_amounts', type: 'uint256[4]' },
|
|
1016
|
+
// { name: '_min_mint_amount', type: 'uint256' }
|
|
1017
|
+
// ],
|
|
1018
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1019
|
+
// stateMutability: 'nonpayable'
|
|
1020
|
+
// }
|
|
1021
|
+
// }
|
|
1022
|
+
|
|
1023
|
+
// Get exact ABI information for deposit wrapped without executing the transaction
|
|
1024
|
+
const depositWrappedInfo = await pool.abi.depositWrapped();
|
|
1025
|
+
console.log(depositWrappedInfo);
|
|
1026
|
+
// {
|
|
1027
|
+
// address: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b', // Contract address (pool)
|
|
1028
|
+
// method: 'add_liquidity', // Method name
|
|
1029
|
+
// abi: {
|
|
1030
|
+
// type: 'function',
|
|
1031
|
+
// name: 'add_liquidity',
|
|
1032
|
+
// inputs: [
|
|
1033
|
+
// { name: 'amounts', type: 'uint256[2]' },
|
|
1034
|
+
// { name: 'min_mint_amount', type: 'uint256' }
|
|
1035
|
+
// ],
|
|
1036
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1037
|
+
// stateMutability: 'nonpayable'
|
|
1038
|
+
// }
|
|
1039
|
+
// }
|
|
1040
|
+
|
|
1041
|
+
// Get exact ABI information for withdrawOneCoin (underlying) without executing the transaction
|
|
1042
|
+
const withdrawOneCoinInfo = await pool.abi.withdrawOneCoin();
|
|
1043
|
+
console.log(withdrawOneCoinInfo);
|
|
1044
|
+
// {
|
|
1045
|
+
// address: '0xa79828df1850e8a3a3064576f380d90aecdd3359', // Contract address (zap or pool)
|
|
1046
|
+
// method: 'remove_liquidity_one_coin', // Method name
|
|
1047
|
+
// abi: {
|
|
1048
|
+
// type: 'function',
|
|
1049
|
+
// name: 'remove_liquidity_one_coin',
|
|
1050
|
+
// inputs: [
|
|
1051
|
+
// { name: '_pool', type: 'address' },
|
|
1052
|
+
// { name: '_burn_amount', type: 'uint256' },
|
|
1053
|
+
// { name: 'i', type: 'int128' },
|
|
1054
|
+
// { name: '_min_amount', type: 'uint256' }
|
|
1055
|
+
// ],
|
|
1056
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1057
|
+
// stateMutability: 'nonpayable'
|
|
1058
|
+
// }
|
|
1059
|
+
// }
|
|
1060
|
+
|
|
1061
|
+
// Get exact ABI information for withdrawOneCoin wrapped without executing the transaction
|
|
1062
|
+
const withdrawOneCoinWrappedInfo = await pool.abi.withdrawOneCoinWrapped();
|
|
1063
|
+
console.log(withdrawOneCoinWrappedInfo);
|
|
1064
|
+
// {
|
|
1065
|
+
// address: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b', // Contract address (pool)
|
|
1066
|
+
// method: 'remove_liquidity_one_coin', // Method name
|
|
1067
|
+
// abi: {
|
|
1068
|
+
// type: 'function',
|
|
1069
|
+
// name: 'remove_liquidity_one_coin',
|
|
1070
|
+
// inputs: [
|
|
1071
|
+
// { name: '_token_amount', type: 'uint256' },
|
|
1072
|
+
// { name: 'i', type: 'int128' },
|
|
1073
|
+
// { name: '_min_amount', type: 'uint256' }
|
|
1074
|
+
// ],
|
|
1075
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1076
|
+
// stateMutability: 'nonpayable'
|
|
1077
|
+
// }
|
|
1078
|
+
// }
|
|
1079
|
+
|
|
993
1080
|
// Get exact ABI information for swap (underlying) without executing the transaction
|
|
994
1081
|
const swapInfo = await pool.abi.swap();
|
|
995
1082
|
console.log(swapInfo);
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -349,7 +349,7 @@ export type AbiError = {
|
|
|
349
349
|
name: string;
|
|
350
350
|
};
|
|
351
351
|
export type Abi = (AbiConstructor | AbiError | AbiEvent | AbiFallback | AbiFunction | AbiReceive)[];
|
|
352
|
-
export interface
|
|
352
|
+
export interface IMethodInfo {
|
|
353
353
|
address: string;
|
|
354
354
|
method: string;
|
|
355
355
|
abi: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import memoize from "memoizee";
|
|
3
|
-
import { IDict, IProfit,
|
|
3
|
+
import { IDict, IProfit, IMethodInfo } from '../interfaces';
|
|
4
4
|
import { Curve } from "../curve.js";
|
|
5
5
|
import { CorePool } from "./subClasses/corePool.js";
|
|
6
6
|
import { StatsPool } from "./subClasses/statsPool.js";
|
|
@@ -37,8 +37,12 @@ export declare class PoolTemplate extends CorePool {
|
|
|
37
37
|
swapWrapped: (inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage: number) => Promise<number | number[]>;
|
|
38
38
|
};
|
|
39
39
|
abi: {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
deposit: () => Promise<IMethodInfo>;
|
|
41
|
+
depositWrapped: () => Promise<IMethodInfo>;
|
|
42
|
+
withdrawOneCoin: () => Promise<IMethodInfo>;
|
|
43
|
+
withdrawOneCoinWrapped: () => Promise<IMethodInfo>;
|
|
44
|
+
swap: () => Promise<IMethodInfo>;
|
|
45
|
+
swapWrapped: () => Promise<IMethodInfo>;
|
|
42
46
|
};
|
|
43
47
|
stats: StatsPool;
|
|
44
48
|
wallet: WalletPool;
|
|
@@ -49,10 +53,13 @@ export declare class PoolTemplate extends CorePool {
|
|
|
49
53
|
private _pureCalcLpTokenAmount;
|
|
50
54
|
_calcLpTokenAmount: ((_amounts: bigint[], isDeposit?: any, useUnderlying?: any) => Promise<bigint>) & memoize.Memoized<(_amounts: bigint[], isDeposit?: any, useUnderlying?: any) => Promise<bigint>>;
|
|
51
55
|
private calcLpTokenAmount;
|
|
56
|
+
private calcLpTokenAmountBigInt;
|
|
52
57
|
private calcLpTokenAmountWrapped;
|
|
58
|
+
private calcLpTokenAmountWrappedBigInt;
|
|
53
59
|
getSeedAmounts(amount1: number | string, useUnderlying?: boolean): Promise<string[]>;
|
|
54
60
|
depositBalancedAmounts(): Promise<string[]>;
|
|
55
61
|
depositExpected(amounts: (number | string)[]): Promise<string>;
|
|
62
|
+
depositExpectedBigInt(amounts: bigint[]): Promise<bigint>;
|
|
56
63
|
private _balancedAmountsWithSameValue;
|
|
57
64
|
depositBonus(amounts: (number | string)[]): Promise<string>;
|
|
58
65
|
depositIsApproved(amounts: (number | string)[]): Promise<boolean>;
|
|
@@ -60,14 +67,17 @@ export declare class PoolTemplate extends CorePool {
|
|
|
60
67
|
depositApprove(amounts: (number | string)[], isMax?: boolean): Promise<string[]>;
|
|
61
68
|
private depositEstimateGas;
|
|
62
69
|
deposit(amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
70
|
+
getDepositInfo(): Promise<IMethodInfo>;
|
|
63
71
|
depositWrappedBalancedAmounts(): Promise<string[]>;
|
|
64
72
|
depositWrappedExpected(amounts: (number | string)[]): Promise<string>;
|
|
73
|
+
depositWrappedExpectedBigInt(amounts: bigint[]): Promise<bigint>;
|
|
65
74
|
depositWrappedBonus(amounts: (number | string)[]): Promise<string>;
|
|
66
75
|
depositWrappedIsApproved(amounts: (number | string)[]): Promise<boolean>;
|
|
67
76
|
private depositWrappedApproveEstimateGas;
|
|
68
77
|
depositWrappedApprove(amounts: (number | string)[]): Promise<string[]>;
|
|
69
78
|
private depositWrappedEstimateGas;
|
|
70
79
|
depositWrapped(amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
80
|
+
getDepositWrappedInfo(): Promise<IMethodInfo>;
|
|
71
81
|
stakeIsApproved(lpTokenAmount: number | string): Promise<boolean>;
|
|
72
82
|
private stakeApproveEstimateGas;
|
|
73
83
|
stakeApprove(lpTokenAmount: number | string): Promise<string[]>;
|
|
@@ -118,12 +128,14 @@ export declare class PoolTemplate extends CorePool {
|
|
|
118
128
|
depositAndStakeWrapped(amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
119
129
|
private _depositAndStake;
|
|
120
130
|
withdrawExpected(lpTokenAmount: number | string): Promise<string[]>;
|
|
131
|
+
withdrawExpectedBigInt(lpTokenAmount: bigint): Promise<bigint[]>;
|
|
121
132
|
withdrawIsApproved(lpTokenAmount: number | string): Promise<boolean>;
|
|
122
133
|
private withdrawApproveEstimateGas;
|
|
123
134
|
withdrawApprove(lpTokenAmount: number | string): Promise<string[]>;
|
|
124
135
|
private withdrawEstimateGas;
|
|
125
136
|
withdraw(lpTokenAmount: number | string, slippage?: number): Promise<string>;
|
|
126
137
|
withdrawWrappedExpected(lpTokenAmount: number | string): Promise<string[]>;
|
|
138
|
+
withdrawWrappedExpectedBigInt(lpTokenAmount: bigint): Promise<bigint[]>;
|
|
127
139
|
private withdrawWrappedEstimateGas;
|
|
128
140
|
withdrawWrapped(lpTokenAmount: number | string, slippage?: number): Promise<string>;
|
|
129
141
|
withdrawImbalanceExpected(amounts: (number | string)[]): Promise<string>;
|
|
@@ -139,17 +151,21 @@ export declare class PoolTemplate extends CorePool {
|
|
|
139
151
|
withdrawImbalanceWrapped(amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
140
152
|
_withdrawOneCoinExpected(_lpTokenAmount: bigint, i: number): Promise<bigint>;
|
|
141
153
|
withdrawOneCoinExpected(lpTokenAmount: number | string, coin: string | number): Promise<string>;
|
|
154
|
+
withdrawOneCoinExpectedBigInt(lpTokenAmount: bigint, coin: string | number): Promise<bigint>;
|
|
142
155
|
withdrawOneCoinBonus(lpTokenAmount: number | string, coin: string | number): Promise<string>;
|
|
143
156
|
withdrawOneCoinIsApproved(lpTokenAmount: number | string): Promise<boolean>;
|
|
144
157
|
private withdrawOneCoinApproveEstimateGas;
|
|
145
158
|
withdrawOneCoinApprove(lpTokenAmount: number | string): Promise<string[]>;
|
|
146
159
|
private withdrawOneCoinEstimateGas;
|
|
147
160
|
withdrawOneCoin(lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
161
|
+
getWithdrawOneCoinInfo(): Promise<IMethodInfo>;
|
|
148
162
|
_withdrawOneCoinWrappedExpected(_lpTokenAmount: bigint, i: number): Promise<bigint>;
|
|
149
163
|
withdrawOneCoinWrappedExpected(lpTokenAmount: number | string, coin: string | number): Promise<string>;
|
|
164
|
+
withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount: bigint, coin: string | number): Promise<bigint>;
|
|
150
165
|
withdrawOneCoinWrappedBonus(lpTokenAmount: number | string, coin: string | number): Promise<string>;
|
|
151
166
|
private withdrawOneCoinWrappedEstimateGas;
|
|
152
167
|
withdrawOneCoinWrapped(lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
168
|
+
getWithdrawOneCoinWrappedInfo(): Promise<IMethodInfo>;
|
|
153
169
|
private _userLpTotalBalance;
|
|
154
170
|
userBalances(address?: string): Promise<string[]>;
|
|
155
171
|
userWrappedBalances(address?: string): Promise<string[]>;
|
|
@@ -181,7 +197,7 @@ export declare class PoolTemplate extends CorePool {
|
|
|
181
197
|
swapApprove(inputCoin: string | number, amount: number | string): Promise<string[]>;
|
|
182
198
|
private swapEstimateGas;
|
|
183
199
|
swap(inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
184
|
-
getSwapInfo(): Promise<
|
|
200
|
+
getSwapInfo(): Promise<IMethodInfo>;
|
|
185
201
|
_swapWrappedExpected(i: number, j: number, _amount: bigint): Promise<bigint>;
|
|
186
202
|
swapWrappedExpected(inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
|
|
187
203
|
swapWrappedExpectedBigInt(inputCoin: string | number, outputCoin: string | number, amount: bigint): Promise<bigint>;
|
|
@@ -191,7 +207,7 @@ export declare class PoolTemplate extends CorePool {
|
|
|
191
207
|
swapWrappedApprove(inputCoin: string | number, amount: number | string): Promise<string[]>;
|
|
192
208
|
private swapWrappedEstimateGas;
|
|
193
209
|
swapWrapped(inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
194
|
-
getSwapWrappedInfo(): Promise<
|
|
210
|
+
getSwapWrappedInfo(): Promise<IMethodInfo>;
|
|
195
211
|
gaugeOptimalDeposits: (...accounts: string[]) => Promise<IDict<string>>;
|
|
196
212
|
_getCoinIdx: (coin: string | number, useUnderlying?: boolean) => number;
|
|
197
213
|
_getRates: () => Promise<bigint[]>;
|
|
@@ -575,6 +575,10 @@ export class PoolTemplate extends CorePool {
|
|
|
575
575
|
swapWrapped: this.swapWrappedEstimateGas.bind(this),
|
|
576
576
|
};
|
|
577
577
|
this.abi = {
|
|
578
|
+
deposit: this.getDepositInfo.bind(this),
|
|
579
|
+
depositWrapped: this.getDepositWrappedInfo.bind(this),
|
|
580
|
+
withdrawOneCoin: this.getWithdrawOneCoinInfo.bind(this),
|
|
581
|
+
withdrawOneCoinWrapped: this.getWithdrawOneCoinWrappedInfo.bind(this),
|
|
578
582
|
swap: this.getSwapInfo.bind(this),
|
|
579
583
|
swapWrapped: this.getSwapWrappedInfo.bind(this),
|
|
580
584
|
};
|
|
@@ -617,6 +621,14 @@ export class PoolTemplate extends CorePool {
|
|
|
617
621
|
return this.curve.formatUnits(_expected);
|
|
618
622
|
});
|
|
619
623
|
}
|
|
624
|
+
calcLpTokenAmountBigInt(amounts_1) {
|
|
625
|
+
return __awaiter(this, arguments, void 0, function* (amounts, isDeposit = true) {
|
|
626
|
+
if (amounts.length !== this.underlyingCoinAddresses.length) {
|
|
627
|
+
throw Error(`${this.name} pool has ${this.underlyingCoinAddresses.length} coins (amounts provided for ${amounts.length})`);
|
|
628
|
+
}
|
|
629
|
+
return yield this._calcLpTokenAmount(amounts, isDeposit, true);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
620
632
|
calcLpTokenAmountWrapped(amounts_1) {
|
|
621
633
|
return __awaiter(this, arguments, void 0, function* (amounts, isDeposit = true) {
|
|
622
634
|
if (amounts.length !== this.wrappedCoinAddresses.length) {
|
|
@@ -630,6 +642,17 @@ export class PoolTemplate extends CorePool {
|
|
|
630
642
|
return this.curve.formatUnits(_expected);
|
|
631
643
|
});
|
|
632
644
|
}
|
|
645
|
+
calcLpTokenAmountWrappedBigInt(amounts_1) {
|
|
646
|
+
return __awaiter(this, arguments, void 0, function* (amounts, isDeposit = true) {
|
|
647
|
+
if (amounts.length !== this.wrappedCoinAddresses.length) {
|
|
648
|
+
throw Error(`${this.name} pool has ${this.wrappedCoinAddresses.length} coins (amounts provided for ${amounts.length})`);
|
|
649
|
+
}
|
|
650
|
+
if (this.isFake) {
|
|
651
|
+
throw Error(`${this.name} pool doesn't have this method`);
|
|
652
|
+
}
|
|
653
|
+
return yield this._calcLpTokenAmount(amounts, isDeposit, false);
|
|
654
|
+
});
|
|
655
|
+
}
|
|
633
656
|
// ---------------- DEPOSIT ----------------
|
|
634
657
|
getSeedAmounts(amount1_1) {
|
|
635
658
|
return __awaiter(this, arguments, void 0, function* (amount1, useUnderlying = false) {
|
|
@@ -685,6 +708,11 @@ export class PoolTemplate extends CorePool {
|
|
|
685
708
|
return yield this.calcLpTokenAmount(amounts);
|
|
686
709
|
});
|
|
687
710
|
}
|
|
711
|
+
depositExpectedBigInt(amounts) {
|
|
712
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
713
|
+
return yield this.calcLpTokenAmountBigInt(amounts);
|
|
714
|
+
});
|
|
715
|
+
}
|
|
688
716
|
// | balanced[i] / sum(balanced[j]) = balance[i] / sum(balance[j]) |
|
|
689
717
|
// | sum(pj * balanced[j]) = sum(aj * pj) |
|
|
690
718
|
//
|
|
@@ -770,6 +798,11 @@ export class PoolTemplate extends CorePool {
|
|
|
770
798
|
throw Error(`deposit method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
771
799
|
});
|
|
772
800
|
}
|
|
801
|
+
getDepositInfo() {
|
|
802
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
803
|
+
throw Error(`getDepositInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
804
|
+
});
|
|
805
|
+
}
|
|
773
806
|
// ---------------- DEPOSIT WRAPPED ----------------
|
|
774
807
|
depositWrappedBalancedAmounts() {
|
|
775
808
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -784,6 +817,14 @@ export class PoolTemplate extends CorePool {
|
|
|
784
817
|
return yield this.calcLpTokenAmountWrapped(amounts);
|
|
785
818
|
});
|
|
786
819
|
}
|
|
820
|
+
depositWrappedExpectedBigInt(amounts) {
|
|
821
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
822
|
+
if (this.isFake) {
|
|
823
|
+
throw Error(`depositWrappedExpectedBigInt method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
824
|
+
}
|
|
825
|
+
return yield this.calcLpTokenAmountWrappedBigInt(amounts);
|
|
826
|
+
});
|
|
827
|
+
}
|
|
787
828
|
depositWrappedBonus(amounts) {
|
|
788
829
|
return __awaiter(this, void 0, void 0, function* () {
|
|
789
830
|
const amountsBN = amounts.map(BN);
|
|
@@ -831,6 +872,11 @@ export class PoolTemplate extends CorePool {
|
|
|
831
872
|
throw Error(`depositWrapped method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
832
873
|
});
|
|
833
874
|
}
|
|
875
|
+
getDepositWrappedInfo() {
|
|
876
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
877
|
+
throw Error(`getDepositWrappedInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
878
|
+
});
|
|
879
|
+
}
|
|
834
880
|
// ---------------- STAKING ----------------
|
|
835
881
|
stakeIsApproved(lpTokenAmount) {
|
|
836
882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1275,6 +1321,12 @@ export class PoolTemplate extends CorePool {
|
|
|
1275
1321
|
throw Error(`withdrawExpected method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1276
1322
|
});
|
|
1277
1323
|
}
|
|
1324
|
+
// OVERRIDE
|
|
1325
|
+
withdrawExpectedBigInt(lpTokenAmount) {
|
|
1326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1327
|
+
throw Error(`withdrawExpectedBigInt method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1278
1330
|
withdrawIsApproved(lpTokenAmount) {
|
|
1279
1331
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1280
1332
|
if (!this.zap)
|
|
@@ -1316,6 +1368,12 @@ export class PoolTemplate extends CorePool {
|
|
|
1316
1368
|
});
|
|
1317
1369
|
}
|
|
1318
1370
|
// OVERRIDE
|
|
1371
|
+
withdrawWrappedExpectedBigInt(lpTokenAmount) {
|
|
1372
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1373
|
+
throw Error(`withdrawWrappedExpectedBigInt method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
// OVERRIDE
|
|
1319
1377
|
withdrawWrappedEstimateGas(lpTokenAmount) {
|
|
1320
1378
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1321
1379
|
throw Error(`withdrawWrapped method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
@@ -1462,6 +1520,12 @@ export class PoolTemplate extends CorePool {
|
|
|
1462
1520
|
return this.curve.formatUnits(_expected, this.underlyingDecimals[i]);
|
|
1463
1521
|
});
|
|
1464
1522
|
}
|
|
1523
|
+
withdrawOneCoinExpectedBigInt(lpTokenAmount, coin) {
|
|
1524
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1525
|
+
const i = this._getCoinIdx(coin);
|
|
1526
|
+
return yield this._withdrawOneCoinExpected(lpTokenAmount, i);
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1465
1529
|
withdrawOneCoinBonus(lpTokenAmount, coin) {
|
|
1466
1530
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1467
1531
|
let pricesBN = [];
|
|
@@ -1530,6 +1594,11 @@ export class PoolTemplate extends CorePool {
|
|
|
1530
1594
|
throw Error(`withdrawOneCoin method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1531
1595
|
});
|
|
1532
1596
|
}
|
|
1597
|
+
getWithdrawOneCoinInfo() {
|
|
1598
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1599
|
+
throw Error(`getWithdrawOneCoinInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1533
1602
|
// ---------------- WITHDRAW ONE COIN WRAPPED ----------------
|
|
1534
1603
|
// OVERRIDE
|
|
1535
1604
|
_withdrawOneCoinWrappedExpected(_lpTokenAmount, i) {
|
|
@@ -1545,6 +1614,12 @@ export class PoolTemplate extends CorePool {
|
|
|
1545
1614
|
return this.curve.formatUnits(_expected, this.wrappedDecimals[i]);
|
|
1546
1615
|
});
|
|
1547
1616
|
}
|
|
1617
|
+
// OVERRIDE
|
|
1618
|
+
withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount, coin) {
|
|
1619
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1620
|
+
throw Error(`withdrawOneCoinWrappedExpectedBigInt method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1548
1623
|
withdrawOneCoinWrappedBonus(lpTokenAmount, coin) {
|
|
1549
1624
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1550
1625
|
const prices = yield this._wrappedPrices();
|
|
@@ -1568,6 +1643,11 @@ export class PoolTemplate extends CorePool {
|
|
|
1568
1643
|
throw Error(`withdrawOneCoinWrapped method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1569
1644
|
});
|
|
1570
1645
|
}
|
|
1646
|
+
getWithdrawOneCoinWrappedInfo() {
|
|
1647
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1648
|
+
throw Error(`getWithdrawOneCoinWrappedInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1571
1651
|
// ---------------- USER BALANCES, BASE PROFIT AND SHARE ----------------
|
|
1572
1652
|
_userLpTotalBalance(address) {
|
|
1573
1653
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const depositMetaFactoryMixin: {
|
|
3
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
-
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<
|
|
5
|
-
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string
|
|
4
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
5
|
+
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number>;
|
|
6
|
+
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
7
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const depositCryptoMetaFactoryMixin: {
|
|
8
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
10
12
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
13
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
12
15
|
export declare const depositZapMixin: {
|
|
13
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
16
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
14
17
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
15
18
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
19
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
16
20
|
};
|
|
17
21
|
export declare const depositLendingOrCryptoMixin: {
|
|
18
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
22
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
19
23
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
20
24
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
25
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
21
26
|
};
|
|
22
27
|
export declare const depositPlainMixin: {
|
|
23
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
28
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
24
29
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
25
30
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
31
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
26
32
|
};
|
|
@@ -36,13 +36,20 @@ function _depositMinAmount(_amounts_1) {
|
|
|
36
36
|
}
|
|
37
37
|
export const depositMetaFactoryMixin = {
|
|
38
38
|
_deposit(_amounts_1, slippage_1) {
|
|
39
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
39
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
40
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
41
|
+
if (getInfo) {
|
|
42
|
+
return {
|
|
43
|
+
address: this.zap,
|
|
44
|
+
method: 'add_liquidity',
|
|
45
|
+
abi: contract.add_liquidity.fragment,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
40
48
|
if (!estimateGas)
|
|
41
49
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.zap);
|
|
42
50
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
43
51
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
44
52
|
const value = _amounts[ethIndex] || parseUnits("0");
|
|
45
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
46
53
|
const gas = yield contract.add_liquidity.estimateGas(this.address, _amounts, _minMintAmount, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
47
54
|
if (estimateGas)
|
|
48
55
|
return smartNumber(gas);
|
|
@@ -62,16 +69,28 @@ export const depositMetaFactoryMixin = {
|
|
|
62
69
|
return yield depositMetaFactoryMixin._deposit.call(this, _amounts, slippage);
|
|
63
70
|
});
|
|
64
71
|
},
|
|
72
|
+
getDepositInfo() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return yield depositMetaFactoryMixin._deposit.call(this, [], 0, false, true);
|
|
75
|
+
});
|
|
76
|
+
},
|
|
65
77
|
};
|
|
66
78
|
export const depositCryptoMetaFactoryMixin = {
|
|
67
79
|
_deposit(_amounts_1, slippage_1) {
|
|
68
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
80
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
81
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
82
|
+
if (getInfo) {
|
|
83
|
+
return {
|
|
84
|
+
address: this.zap,
|
|
85
|
+
method: 'add_liquidity',
|
|
86
|
+
abi: contract.add_liquidity.fragment,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
69
89
|
if (!estimateGas)
|
|
70
90
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.zap);
|
|
71
91
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
72
92
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
73
93
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
74
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
75
94
|
const gas = yield contract.add_liquidity.estimateGas(this.address, _amounts, _minMintAmount, true, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
76
95
|
if (estimateGas)
|
|
77
96
|
return smartNumber(gas);
|
|
@@ -91,16 +110,28 @@ export const depositCryptoMetaFactoryMixin = {
|
|
|
91
110
|
return yield depositCryptoMetaFactoryMixin._deposit.call(this, _amounts, slippage);
|
|
92
111
|
});
|
|
93
112
|
},
|
|
113
|
+
getDepositInfo() {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
return yield depositCryptoMetaFactoryMixin._deposit.call(this, [], 0, false, true);
|
|
116
|
+
});
|
|
117
|
+
},
|
|
94
118
|
};
|
|
95
119
|
export const depositZapMixin = {
|
|
96
120
|
_deposit(_amounts_1, slippage_1) {
|
|
97
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
121
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
122
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
123
|
+
if (getInfo) {
|
|
124
|
+
return {
|
|
125
|
+
address: this.zap,
|
|
126
|
+
method: 'add_liquidity',
|
|
127
|
+
abi: contract.add_liquidity.fragment,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
98
130
|
if (!estimateGas)
|
|
99
131
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.zap);
|
|
100
132
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
101
133
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
102
134
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
103
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
104
135
|
const args = [_amounts, _minMintAmount];
|
|
105
136
|
if (`add_liquidity(uint256[${this.underlyingCoinAddresses.length}],uint256,bool)` in contract)
|
|
106
137
|
args.push(true);
|
|
@@ -123,16 +154,28 @@ export const depositZapMixin = {
|
|
|
123
154
|
return yield depositZapMixin._deposit.call(this, _amounts, slippage);
|
|
124
155
|
});
|
|
125
156
|
},
|
|
157
|
+
getDepositInfo() {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
return yield depositZapMixin._deposit.call(this, [], 0, false, true);
|
|
160
|
+
});
|
|
161
|
+
},
|
|
126
162
|
};
|
|
127
163
|
export const depositLendingOrCryptoMixin = {
|
|
128
164
|
_deposit(_amounts_1, slippage_1) {
|
|
129
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
165
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
166
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
167
|
+
if (getInfo) {
|
|
168
|
+
return {
|
|
169
|
+
address: this.address,
|
|
170
|
+
method: 'add_liquidity',
|
|
171
|
+
abi: contract.add_liquidity.fragment,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
130
174
|
if (!estimateGas)
|
|
131
175
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.address);
|
|
132
176
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
133
177
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
134
178
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
135
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
136
179
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, true, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
137
180
|
if (estimateGas)
|
|
138
181
|
return smartNumber(gas);
|
|
@@ -152,16 +195,28 @@ export const depositLendingOrCryptoMixin = {
|
|
|
152
195
|
return yield depositLendingOrCryptoMixin._deposit.call(this, _amounts, slippage);
|
|
153
196
|
});
|
|
154
197
|
},
|
|
198
|
+
getDepositInfo() {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
return yield depositLendingOrCryptoMixin._deposit.call(this, [], 0, false, true);
|
|
201
|
+
});
|
|
202
|
+
},
|
|
155
203
|
};
|
|
156
204
|
export const depositPlainMixin = {
|
|
157
205
|
_deposit(_amounts_1, slippage_1) {
|
|
158
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
206
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
207
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
208
|
+
if (getInfo) {
|
|
209
|
+
return {
|
|
210
|
+
address: this.address,
|
|
211
|
+
method: 'add_liquidity',
|
|
212
|
+
abi: contract.add_liquidity.fragment,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
159
215
|
if (!estimateGas)
|
|
160
216
|
yield _ensureAllowance.call(this.curve, this.wrappedCoinAddresses, _amounts, this.address);
|
|
161
217
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
162
218
|
const ethIndex = this.curve.getEthIndex(this.wrappedCoinAddresses);
|
|
163
219
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
164
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
165
220
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
166
221
|
if (estimateGas)
|
|
167
222
|
return smartNumber(gas);
|
|
@@ -181,4 +236,9 @@ export const depositPlainMixin = {
|
|
|
181
236
|
return yield depositPlainMixin._deposit.call(this, _amounts, slippage);
|
|
182
237
|
});
|
|
183
238
|
},
|
|
239
|
+
getDepositInfo() {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
+
return yield depositPlainMixin._deposit.call(this, [], 0, false, true);
|
|
242
|
+
});
|
|
243
|
+
},
|
|
184
244
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const depositWrapped2argsMixin: {
|
|
3
|
-
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
4
5
|
depositWrappedEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number>;
|
|
5
6
|
depositWrapped(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
7
|
+
getDepositWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const depositWrapped3argsMixin: {
|
|
8
|
-
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
depositWrappedEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number>;
|
|
10
12
|
depositWrapped(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
13
|
+
getDepositWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
@@ -39,13 +39,20 @@ function _depositWrappedMinAmount(_amounts_1) {
|
|
|
39
39
|
}
|
|
40
40
|
export const depositWrapped2argsMixin = {
|
|
41
41
|
_depositWrapped(_amounts_1, slippage_1) {
|
|
42
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
42
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
43
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
44
|
+
if (getInfo) {
|
|
45
|
+
return {
|
|
46
|
+
address: this.address,
|
|
47
|
+
method: 'add_liquidity',
|
|
48
|
+
abi: contract.add_liquidity.fragment,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
43
51
|
if (!estimateGas)
|
|
44
52
|
yield _ensureAllowance.call(this.curve, this.wrappedCoinAddresses, _amounts, this.address);
|
|
45
53
|
const _minMintAmount = yield _depositWrappedMinAmount.call(this, _amounts, slippage);
|
|
46
54
|
const ethIndex = this.curve.getEthIndex(this.wrappedCoinAddresses);
|
|
47
55
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
48
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
49
56
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
50
57
|
if (estimateGas)
|
|
51
58
|
return smartNumber(gas);
|
|
@@ -65,16 +72,28 @@ export const depositWrapped2argsMixin = {
|
|
|
65
72
|
return yield depositWrapped2argsMixin._depositWrapped.call(this, _amounts, slippage);
|
|
66
73
|
});
|
|
67
74
|
},
|
|
75
|
+
getDepositWrappedInfo() {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return yield depositWrapped2argsMixin._depositWrapped.call(this, [], 0, false, true);
|
|
78
|
+
});
|
|
79
|
+
},
|
|
68
80
|
};
|
|
69
81
|
export const depositWrapped3argsMixin = {
|
|
70
82
|
_depositWrapped(_amounts_1, slippage_1) {
|
|
71
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
83
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
84
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
85
|
+
if (getInfo) {
|
|
86
|
+
return {
|
|
87
|
+
address: this.address,
|
|
88
|
+
method: 'add_liquidity',
|
|
89
|
+
abi: contract.add_liquidity.fragment,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
72
92
|
if (!estimateGas)
|
|
73
93
|
yield _ensureAllowance.call(this.curve, this.wrappedCoinAddresses, _amounts, this.address);
|
|
74
94
|
const _minMintAmount = yield _depositWrappedMinAmount.call(this, _amounts, slippage);
|
|
75
95
|
const ethIndex = this.curve.getEthIndex(this.wrappedCoinAddresses);
|
|
76
96
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
77
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
78
97
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, false, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
79
98
|
if (estimateGas)
|
|
80
99
|
return smartNumber(gas);
|
|
@@ -94,4 +113,9 @@ export const depositWrapped3argsMixin = {
|
|
|
94
113
|
return yield depositWrapped3argsMixin._depositWrapped.call(this, _amounts, slippage);
|
|
95
114
|
});
|
|
96
115
|
},
|
|
116
|
+
getDepositWrappedInfo() {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
return yield depositWrapped3argsMixin._depositWrapped.call(this, [], 0, false, true);
|
|
119
|
+
});
|
|
120
|
+
},
|
|
97
121
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
import {
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
3
3
|
export declare const swapTricrypto2Mixin: {
|
|
4
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
4
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
5
5
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
6
6
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
7
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
7
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
8
8
|
};
|
|
9
9
|
export declare const swapMetaFactoryMixin: {
|
|
10
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
10
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
11
11
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
12
12
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
13
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
13
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
14
14
|
};
|
|
15
15
|
export declare const swapCryptoMetaFactoryMixin: {
|
|
16
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
16
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
17
17
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
18
18
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
19
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
19
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
20
20
|
};
|
|
21
21
|
export declare const swapMixin: {
|
|
22
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
22
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
23
23
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
24
24
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
25
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
25
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
26
26
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
import {
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
3
3
|
export declare const swapWrappedTricrypto2Mixin: {
|
|
4
|
-
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
4
|
+
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
5
5
|
swapWrappedEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
6
6
|
swapWrapped(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
7
|
-
getSwapWrappedInfo(this: PoolTemplate): Promise<
|
|
7
|
+
getSwapWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
8
8
|
};
|
|
9
9
|
export declare const swapWrappedMixin: {
|
|
10
|
-
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
10
|
+
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
11
11
|
swapWrappedEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
12
12
|
swapWrapped(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
13
|
-
getSwapWrappedInfo(this: PoolTemplate): Promise<
|
|
13
|
+
getSwapWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
14
14
|
};
|
|
15
15
|
export declare const swapWrappedExpectedAndApproveMixin: {
|
|
16
16
|
swapWrappedExpected(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
2
|
export declare const withdrawExpectedMixin: {
|
|
3
3
|
withdrawExpected(this: PoolTemplate, lpTokenAmount: number | string): Promise<string[]>;
|
|
4
|
+
withdrawExpectedBigInt(this: PoolTemplate, lpTokenAmount: bigint): Promise<bigint[]>;
|
|
4
5
|
};
|
|
5
6
|
export declare const withdrawExpectedLendingOrCryptoMixin: {
|
|
6
7
|
withdrawExpected(this: PoolTemplate, lpTokenAmount: number | string): Promise<string[]>;
|
|
8
|
+
withdrawExpectedBigInt(this: PoolTemplate, lpTokenAmount: bigint): Promise<bigint[]>;
|
|
7
9
|
};
|
|
8
10
|
export declare const withdrawExpectedMetaMixin: {
|
|
9
11
|
withdrawExpected(this: PoolTemplate, lpTokenAmount: number | string): Promise<string[]>;
|
|
12
|
+
withdrawExpectedBigInt(this: PoolTemplate, lpTokenAmount: bigint): Promise<bigint[]>;
|
|
10
13
|
};
|
|
11
14
|
export declare const withdrawWrappedExpectedMixin: {
|
|
12
15
|
withdrawWrappedExpected(this: PoolTemplate, lpTokenAmount: number | string): Promise<string[]>;
|
|
16
|
+
withdrawWrappedExpectedBigInt(this: PoolTemplate, lpTokenAmount: bigint): Promise<bigint[]>;
|
|
13
17
|
};
|
|
@@ -18,6 +18,11 @@ export const withdrawExpectedMixin = {
|
|
|
18
18
|
return _expected.map((amount, i) => formatUnits(amount, this.underlyingDecimals[i]));
|
|
19
19
|
});
|
|
20
20
|
},
|
|
21
|
+
withdrawExpectedBigInt(lpTokenAmount) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return yield _calcExpectedAmounts.call(this, lpTokenAmount);
|
|
24
|
+
});
|
|
25
|
+
},
|
|
21
26
|
};
|
|
22
27
|
export const withdrawExpectedLendingOrCryptoMixin = {
|
|
23
28
|
withdrawExpected(lpTokenAmount) {
|
|
@@ -29,6 +34,13 @@ export const withdrawExpectedLendingOrCryptoMixin = {
|
|
|
29
34
|
return _expected.map((amount, i) => formatUnits(amount, this.underlyingDecimals[i]));
|
|
30
35
|
});
|
|
31
36
|
},
|
|
37
|
+
withdrawExpectedBigInt(lpTokenAmount) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const _expectedAmounts = yield _calcExpectedAmounts.call(this, lpTokenAmount);
|
|
40
|
+
const _rates = yield this._getRates();
|
|
41
|
+
return _expectedAmounts.map((_amount, i) => _amount * _rates[i] / parseUnits(String(Math.pow(10, 18)), 0));
|
|
42
|
+
});
|
|
43
|
+
},
|
|
32
44
|
};
|
|
33
45
|
export const withdrawExpectedMetaMixin = {
|
|
34
46
|
withdrawExpected(lpTokenAmount) {
|
|
@@ -38,6 +50,11 @@ export const withdrawExpectedMetaMixin = {
|
|
|
38
50
|
return _expected.map((amount, i) => formatUnits(amount, this.underlyingDecimals[i]));
|
|
39
51
|
});
|
|
40
52
|
},
|
|
53
|
+
withdrawExpectedBigInt(lpTokenAmount) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
return yield _calcExpectedUnderlyingAmountsMeta.call(this, lpTokenAmount);
|
|
56
|
+
});
|
|
57
|
+
},
|
|
41
58
|
};
|
|
42
59
|
export const withdrawWrappedExpectedMixin = {
|
|
43
60
|
withdrawWrappedExpected(lpTokenAmount) {
|
|
@@ -47,4 +64,9 @@ export const withdrawWrappedExpectedMixin = {
|
|
|
47
64
|
return _expected.map((amount, i) => formatUnits(amount, this.wrappedDecimals[i]));
|
|
48
65
|
});
|
|
49
66
|
},
|
|
67
|
+
withdrawWrappedExpectedBigInt(lpTokenAmount) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
return yield _calcExpectedAmounts.call(this, lpTokenAmount);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
50
72
|
};
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const withdrawOneCoinMetaFactoryMixin: {
|
|
3
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
4
5
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
5
6
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
7
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const withdrawOneCoinCryptoMetaFactoryMixin: {
|
|
8
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
10
12
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
13
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
12
15
|
export declare const withdrawOneCoinZapMixin: {
|
|
13
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
16
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
14
17
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
15
18
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
19
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
16
20
|
};
|
|
17
21
|
export declare const withdrawOneCoinLendingOrCryptoMixin: {
|
|
18
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
22
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
19
23
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
20
24
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
25
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
21
26
|
};
|
|
22
27
|
export declare const withdrawOneCoinPlainMixin: {
|
|
23
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
28
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
24
29
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
25
30
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
31
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
26
32
|
};
|
|
@@ -33,11 +33,18 @@ function _withdrawOneCoinMinAmount(_lpTokenAmount_1, i_1) {
|
|
|
33
33
|
}
|
|
34
34
|
export const withdrawOneCoinMetaFactoryMixin = {
|
|
35
35
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
36
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
36
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
37
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
38
|
+
if (getInfo) {
|
|
39
|
+
return {
|
|
40
|
+
address: this.zap,
|
|
41
|
+
method: 'remove_liquidity_one_coin',
|
|
42
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
37
45
|
if (!estimateGas)
|
|
38
46
|
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
39
47
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
40
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
41
48
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
42
49
|
if (estimateGas)
|
|
43
50
|
return smartNumber(gas);
|
|
@@ -57,14 +64,26 @@ export const withdrawOneCoinMetaFactoryMixin = {
|
|
|
57
64
|
return yield withdrawOneCoinMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
58
65
|
});
|
|
59
66
|
},
|
|
67
|
+
getWithdrawOneCoinInfo() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
return yield withdrawOneCoinMetaFactoryMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
60
72
|
};
|
|
61
73
|
export const withdrawOneCoinCryptoMetaFactoryMixin = {
|
|
62
74
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
63
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
75
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
76
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
77
|
+
if (getInfo) {
|
|
78
|
+
return {
|
|
79
|
+
address: this.zap,
|
|
80
|
+
method: 'remove_liquidity_one_coin',
|
|
81
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
64
84
|
if (!estimateGas)
|
|
65
85
|
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
66
86
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
67
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
68
87
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, true, this.curve.constantOptions);
|
|
69
88
|
if (estimateGas)
|
|
70
89
|
return smartNumber(gas);
|
|
@@ -84,14 +103,26 @@ export const withdrawOneCoinCryptoMetaFactoryMixin = {
|
|
|
84
103
|
return yield withdrawOneCoinCryptoMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
85
104
|
});
|
|
86
105
|
},
|
|
106
|
+
getWithdrawOneCoinInfo() {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
return yield withdrawOneCoinCryptoMetaFactoryMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
109
|
+
});
|
|
110
|
+
},
|
|
87
111
|
};
|
|
88
112
|
export const withdrawOneCoinZapMixin = {
|
|
89
113
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
90
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
114
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
115
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
116
|
+
if (getInfo) {
|
|
117
|
+
return {
|
|
118
|
+
address: this.zap,
|
|
119
|
+
method: 'remove_liquidity_one_coin',
|
|
120
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
91
123
|
if (!estimateGas)
|
|
92
124
|
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
93
125
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
94
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
95
126
|
const args = [_lpTokenAmount, i, _minAmount];
|
|
96
127
|
if (`remove_liquidity_one_coin(uint256,uint256,uint256,bool)` in contract)
|
|
97
128
|
args.push(true);
|
|
@@ -114,12 +145,24 @@ export const withdrawOneCoinZapMixin = {
|
|
|
114
145
|
return yield withdrawOneCoinZapMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
115
146
|
});
|
|
116
147
|
},
|
|
148
|
+
getWithdrawOneCoinInfo() {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
return yield withdrawOneCoinZapMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
151
|
+
});
|
|
152
|
+
},
|
|
117
153
|
};
|
|
118
154
|
export const withdrawOneCoinLendingOrCryptoMixin = {
|
|
119
155
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
120
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
121
|
-
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
156
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
122
157
|
const contract = this.curve.contracts[this.address].contract;
|
|
158
|
+
if (getInfo) {
|
|
159
|
+
return {
|
|
160
|
+
address: this.address,
|
|
161
|
+
method: 'remove_liquidity_one_coin',
|
|
162
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
123
166
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, true, this.curve.constantOptions);
|
|
124
167
|
if (estimateGas)
|
|
125
168
|
return smartNumber(gas);
|
|
@@ -139,12 +182,24 @@ export const withdrawOneCoinLendingOrCryptoMixin = {
|
|
|
139
182
|
return yield withdrawOneCoinLendingOrCryptoMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
140
183
|
});
|
|
141
184
|
},
|
|
185
|
+
getWithdrawOneCoinInfo() {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
return yield withdrawOneCoinLendingOrCryptoMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
188
|
+
});
|
|
189
|
+
},
|
|
142
190
|
};
|
|
143
191
|
export const withdrawOneCoinPlainMixin = {
|
|
144
192
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
145
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
146
|
-
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
193
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
147
194
|
const contract = this.curve.contracts[this.address].contract;
|
|
195
|
+
if (getInfo) {
|
|
196
|
+
return {
|
|
197
|
+
address: this.address,
|
|
198
|
+
method: 'remove_liquidity_one_coin',
|
|
199
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
148
203
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
149
204
|
if (estimateGas)
|
|
150
205
|
return smartNumber(gas);
|
|
@@ -164,4 +219,9 @@ export const withdrawOneCoinPlainMixin = {
|
|
|
164
219
|
return yield withdrawOneCoinPlainMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
165
220
|
});
|
|
166
221
|
},
|
|
222
|
+
getWithdrawOneCoinInfo() {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
return yield withdrawOneCoinPlainMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
225
|
+
});
|
|
226
|
+
},
|
|
167
227
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
2
|
export declare const withdrawOneCoinWrappedExpected2argsMixin: {
|
|
3
3
|
_withdrawOneCoinWrappedExpected(this: PoolTemplate, _lpTokenAmount: bigint, i: number): Promise<bigint>;
|
|
4
|
+
withdrawOneCoinWrappedExpectedBigInt(this: PoolTemplate, lpTokenAmount: bigint, coin: string | number): Promise<bigint>;
|
|
4
5
|
};
|
|
5
6
|
export declare const withdrawOneCoinWrappedExpected3argsMixin: {
|
|
6
7
|
_withdrawOneCoinWrappedExpected(this: PoolTemplate, _lpTokenAmount: bigint, i: number): Promise<bigint>;
|
|
8
|
+
withdrawOneCoinWrappedExpectedBigInt(this: PoolTemplate, lpTokenAmount: bigint, coin: string | number): Promise<bigint>;
|
|
7
9
|
};
|
|
@@ -14,6 +14,12 @@ export const withdrawOneCoinWrappedExpected2argsMixin = {
|
|
|
14
14
|
return yield contract.calc_withdraw_one_coin(_lpTokenAmount, i, this.curve.constantOptions);
|
|
15
15
|
});
|
|
16
16
|
},
|
|
17
|
+
withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount, coin) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const i = this._getCoinIdx(coin, false);
|
|
20
|
+
return yield this._withdrawOneCoinWrappedExpected(lpTokenAmount, i);
|
|
21
|
+
});
|
|
22
|
+
},
|
|
17
23
|
};
|
|
18
24
|
export const withdrawOneCoinWrappedExpected3argsMixin = {
|
|
19
25
|
_withdrawOneCoinWrappedExpected(_lpTokenAmount, i) {
|
|
@@ -22,4 +28,10 @@ export const withdrawOneCoinWrappedExpected3argsMixin = {
|
|
|
22
28
|
return yield contract.calc_withdraw_one_coin(_lpTokenAmount, i, false, this.curve.constantOptions);
|
|
23
29
|
});
|
|
24
30
|
},
|
|
31
|
+
withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount, coin) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const i = this._getCoinIdx(coin, false);
|
|
34
|
+
return yield this._withdrawOneCoinWrappedExpected(lpTokenAmount, i);
|
|
35
|
+
});
|
|
36
|
+
},
|
|
25
37
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const withdrawOneCoinWrappedLendingOrCryptoMixin: {
|
|
3
|
-
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
4
5
|
withdrawOneCoinWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number>;
|
|
5
6
|
withdrawOneCoinWrapped(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
7
|
+
getWithdrawOneCoinWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const withdrawOneCoinWrappedMixin: {
|
|
8
|
-
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
withdrawOneCoinWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number>;
|
|
10
12
|
withdrawOneCoinWrapped(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
13
|
+
getWithdrawOneCoinWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
@@ -29,9 +29,16 @@ function _withdrawOneCoinWrappedMinAmount(_lpTokenAmount_1, i_1) {
|
|
|
29
29
|
}
|
|
30
30
|
export const withdrawOneCoinWrappedLendingOrCryptoMixin = {
|
|
31
31
|
_withdrawOneCoinWrapped(_lpTokenAmount_1, i_1, slippage_1) {
|
|
32
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
33
|
-
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
34
33
|
const contract = this.curve.contracts[this.address].contract;
|
|
34
|
+
if (getInfo) {
|
|
35
|
+
return {
|
|
36
|
+
address: this.address,
|
|
37
|
+
method: 'remove_liquidity_one_coin',
|
|
38
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
35
42
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, false, this.curve.constantOptions);
|
|
36
43
|
if (estimateGas)
|
|
37
44
|
return smartNumber(gas);
|
|
@@ -51,12 +58,24 @@ export const withdrawOneCoinWrappedLendingOrCryptoMixin = {
|
|
|
51
58
|
return yield withdrawOneCoinWrappedLendingOrCryptoMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, slippage);
|
|
52
59
|
});
|
|
53
60
|
},
|
|
61
|
+
getWithdrawOneCoinWrappedInfo() {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return yield withdrawOneCoinWrappedLendingOrCryptoMixin._withdrawOneCoinWrapped.call(this, BigInt(0), 0, 0, false, true);
|
|
64
|
+
});
|
|
65
|
+
},
|
|
54
66
|
};
|
|
55
67
|
export const withdrawOneCoinWrappedMixin = {
|
|
56
68
|
_withdrawOneCoinWrapped(_lpTokenAmount_1, i_1, slippage_1) {
|
|
57
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
58
|
-
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
69
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
59
70
|
const contract = this.curve.contracts[this.address].contract;
|
|
71
|
+
if (getInfo) {
|
|
72
|
+
return {
|
|
73
|
+
address: this.address,
|
|
74
|
+
method: 'remove_liquidity_one_coin',
|
|
75
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
60
79
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
61
80
|
if (estimateGas)
|
|
62
81
|
return smartNumber(gas);
|
|
@@ -76,4 +95,9 @@ export const withdrawOneCoinWrappedMixin = {
|
|
|
76
95
|
return yield withdrawOneCoinWrappedMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, slippage);
|
|
77
96
|
});
|
|
78
97
|
},
|
|
98
|
+
getWithdrawOneCoinWrappedInfo() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
return yield withdrawOneCoinWrappedMixin._withdrawOneCoinWrapped.call(this, BigInt(0), 0, 0, false, true);
|
|
101
|
+
});
|
|
102
|
+
},
|
|
79
103
|
};
|