@curvefi/api 2.30.1 → 2.31.1
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.js +137 -402
- package/lib/constants/abis/avaxcrypto/swap.json +1195 -0
- package/lib/constants/abis/avaxcrypto/zap.json +250 -0
- package/lib/constants/aliases.d.ts +11 -11
- package/lib/constants/aliases.js +12 -15
- package/lib/constants/coins/arbitrum.js +6 -9
- package/lib/constants/coins/aurora.js +6 -9
- package/lib/constants/coins/avalanche.js +12 -10
- package/lib/constants/coins/celo.js +6 -9
- package/lib/constants/coins/ethereum.js +10 -13
- package/lib/constants/coins/fantom.js +8 -11
- package/lib/constants/coins/kava.js +6 -9
- package/lib/constants/coins/moonbeam.js +6 -9
- package/lib/constants/coins/optimism.js +6 -9
- package/lib/constants/coins/polygon.js +7 -10
- package/lib/constants/coins/xdai.js +6 -9
- package/lib/constants/pools/arbitrum.d.ts +2 -4
- package/lib/constants/pools/arbitrum.js +22 -28
- package/lib/constants/pools/aurora.d.ts +2 -4
- package/lib/constants/pools/aurora.js +6 -12
- package/lib/constants/pools/avalanche.d.ts +2 -4
- package/lib/constants/pools/avalanche.js +51 -22
- package/lib/constants/pools/celo.d.ts +2 -4
- package/lib/constants/pools/celo.js +2 -5
- package/lib/constants/pools/ethereum.js +247 -253
- package/lib/constants/pools/fantom.d.ts +2 -4
- package/lib/constants/pools/fantom.js +28 -34
- package/lib/constants/pools/index.d.ts +11 -11
- package/lib/constants/pools/index.js +12 -25
- package/lib/constants/pools/kava.d.ts +2 -4
- package/lib/constants/pools/kava.js +2 -5
- package/lib/constants/pools/moonbeam.d.ts +2 -4
- package/lib/constants/pools/moonbeam.js +6 -12
- package/lib/constants/pools/optimism.d.ts +2 -4
- package/lib/constants/pools/optimism.js +9 -15
- package/lib/constants/pools/polygon.d.ts +2 -4
- package/lib/constants/pools/polygon.js +23 -28
- package/lib/constants/pools/xdai.d.ts +2 -4
- package/lib/constants/pools/xdai.js +25 -30
- package/lib/constants/utils.js +20 -29
- package/lib/curve.d.ts +9 -7
- package/lib/curve.js +397 -615
- package/lib/external-api.d.ts +1 -1
- package/lib/external-api.js +47 -140
- package/lib/factory/common.js +6 -10
- package/lib/factory/constants-crypto.js +48 -54
- package/lib/factory/constants.js +274 -280
- package/lib/factory/deploy.d.ts +8 -8
- package/lib/factory/deploy.js +177 -347
- package/lib/factory/factory-api.js +195 -278
- package/lib/factory/factory-crypto.js +170 -323
- package/lib/factory/factory.js +195 -350
- package/lib/index.d.ts +24 -25
- package/lib/index.js +87 -143
- package/lib/interfaces.d.ts +6 -5
- package/lib/interfaces.js +1 -2
- package/lib/pools/PoolTemplate.d.ts +1 -0
- package/lib/pools/PoolTemplate.js +1516 -2928
- package/lib/pools/index.d.ts +2 -2
- package/lib/pools/index.js +3 -7
- package/lib/pools/mixins/common.d.ts +3 -4
- package/lib/pools/mixins/common.js +23 -102
- package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +1 -1
- package/lib/pools/mixins/depositBalancedAmountsMixins.js +50 -139
- package/lib/pools/mixins/depositMixins.d.ts +1 -1
- package/lib/pools/mixins/depositMixins.js +145 -405
- package/lib/pools/mixins/depositWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/depositWrappedMixins.js +72 -227
- package/lib/pools/mixins/poolBalancesMixin.d.ts +1 -2
- package/lib/pools/mixins/poolBalancesMixin.js +25 -131
- package/lib/pools/mixins/swapMixins.d.ts +1 -1
- package/lib/pools/mixins/swapMixins.js +127 -353
- package/lib/pools/mixins/swapWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/swapWrappedMixins.js +90 -276
- package/lib/pools/mixins/withdrawExpectedMixins.d.ts +1 -2
- package/lib/pools/mixins/withdrawExpectedMixins.js +26 -154
- package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawImbalanceMixins.js +99 -321
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +53 -192
- package/lib/pools/mixins/withdrawMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawMixins.js +124 -378
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +17 -92
- package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinMixins.js +125 -378
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +9 -66
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +55 -190
- package/lib/pools/mixins/withdrawWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawWrappedMixins.js +52 -191
- package/lib/pools/poolConstructor.d.ts +1 -1
- package/lib/pools/poolConstructor.js +79 -109
- package/lib/pools/utils.js +298 -500
- package/lib/router.d.ts +2 -2
- package/lib/router.js +406 -650
- package/lib/utils.d.ts +9 -9
- package/lib/utils.js +377 -731
- package/package.json +8 -8
|
@@ -1,241 +1,211 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var poolBalancesMixin_1 = require("./mixins/poolBalancesMixin");
|
|
22
|
-
var depositBalancedAmountsMixins_1 = require("./mixins/depositBalancedAmountsMixins");
|
|
23
|
-
var depositMixins_1 = require("./mixins/depositMixins");
|
|
24
|
-
var depositWrappedMixins_1 = require("./mixins/depositWrappedMixins");
|
|
25
|
-
var withdrawExpectedMixins_1 = require("./mixins/withdrawExpectedMixins");
|
|
26
|
-
var withdrawMixins_1 = require("./mixins/withdrawMixins");
|
|
27
|
-
var withdrawWrappedMixins_1 = require("./mixins/withdrawWrappedMixins");
|
|
28
|
-
var withdrawImbalanceMixins_1 = require("./mixins/withdrawImbalanceMixins");
|
|
29
|
-
var withdrawImbalanceWrappedMixins_1 = require("./mixins/withdrawImbalanceWrappedMixins");
|
|
30
|
-
var withdrawOneCoinExpectedMixins_1 = require("./mixins/withdrawOneCoinExpectedMixins");
|
|
31
|
-
var withdrawOneCoinMixins_1 = require("./mixins/withdrawOneCoinMixins");
|
|
32
|
-
var withdrawOneCoinWrappedExpectedMixins_1 = require("./mixins/withdrawOneCoinWrappedExpectedMixins");
|
|
33
|
-
var withdrawOneCoinWrappedMixins_1 = require("./mixins/withdrawOneCoinWrappedMixins");
|
|
34
|
-
var swapMixins_1 = require("./mixins/swapMixins");
|
|
35
|
-
var swapWrappedMixins_1 = require("./mixins/swapWrappedMixins");
|
|
36
|
-
var getPool = function (poolId) {
|
|
37
|
-
var poolDummy = new PoolTemplate_1.PoolTemplate(poolId);
|
|
38
|
-
var Pool = /** @class */ (function (_super) {
|
|
39
|
-
__extends(Pool, _super);
|
|
40
|
-
function Pool() {
|
|
41
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
42
|
-
}
|
|
43
|
-
return Pool;
|
|
44
|
-
}(PoolTemplate_1.PoolTemplate));
|
|
45
|
-
// statsBalances
|
|
46
|
-
if (poolDummy.isFake || (curve_1.curve.chainId === 100 && poolDummy.id === "tricrypto")) { // 100 is xDAI
|
|
47
|
-
Object.assign(Pool.prototype, poolBalancesMixin_1.poolBalancesAtricrypto3Mixin);
|
|
1
|
+
import { curve } from "../curve.js";
|
|
2
|
+
import { PoolTemplate } from "./PoolTemplate.js";
|
|
3
|
+
import { poolBalancesMetaMixin, poolBalancesLendingMixin } from "./mixins/poolBalancesMixin.js";
|
|
4
|
+
import { depositBalancedAmountsMixin, depositBalancedAmountsCryptoMixin, depositWrappedBalancedAmountsMixin, depositWrappedBalancedAmountsCryptoMixin } from "./mixins/depositBalancedAmountsMixins.js";
|
|
5
|
+
import { depositMetaFactoryMixin, depositCryptoMetaFactoryMixin, depositZapMixin, depositLendingOrCryptoMixin, depositPlainMixin } from "./mixins/depositMixins.js";
|
|
6
|
+
import { depositWrapped2argsMixin, depositWrapped3argsMixin } from "./mixins/depositWrappedMixins.js";
|
|
7
|
+
import { withdrawExpectedMixin, withdrawExpectedLendingOrCryptoMixin, withdrawExpectedMetaMixin, withdrawWrappedExpectedMixin } from "./mixins/withdrawExpectedMixins.js";
|
|
8
|
+
import { withdrawMetaFactoryMixin, withdrawCryptoMetaFactoryMixin, withdrawZapMixin, withdrawLendingOrCryptoMixin, withdrawPlainMixin } from "./mixins/withdrawMixins.js";
|
|
9
|
+
import { withdrawWrapped2argsMixin, withdrawWrapped3argsMixin } from "./mixins/withdrawWrappedMixins.js";
|
|
10
|
+
import { withdrawImbalanceMetaFactoryMixin, withdrawImbalanceZapMixin, withdrawImbalanceLendingMixin, withdrawImbalancePlainMixin } from "./mixins/withdrawImbalanceMixins.js";
|
|
11
|
+
import { withdrawImbalanceWrapped2argsMixin, withdrawImbalanceWrapped3argsMixin } from "./mixins/withdrawImbalanceWrappedMixins.js";
|
|
12
|
+
import { withdrawOneCoinExpectedMetaFactoryMixin, withdrawOneCoinExpectedZapMixin, withdrawOneCoinExpected3argsMixin, withdrawOneCoinExpected2argsMixin } from "./mixins/withdrawOneCoinExpectedMixins.js";
|
|
13
|
+
import { withdrawOneCoinMetaFactoryMixin, withdrawOneCoinCryptoMetaFactoryMixin, withdrawOneCoinZapMixin, withdrawOneCoinLendingOrCryptoMixin, withdrawOneCoinPlainMixin } from "./mixins/withdrawOneCoinMixins.js";
|
|
14
|
+
import { withdrawOneCoinWrappedExpected2argsMixin, withdrawOneCoinWrappedExpected3argsMixin } from "./mixins/withdrawOneCoinWrappedExpectedMixins.js";
|
|
15
|
+
import { withdrawOneCoinWrappedLendingOrCryptoMixin, withdrawOneCoinWrappedMixin } from "./mixins/withdrawOneCoinWrappedMixins.js";
|
|
16
|
+
import { swapTricrypto2Mixin, swapMetaFactoryMixin, swapCryptoMetaFactoryMixin, swapMixin } from "./mixins/swapMixins.js";
|
|
17
|
+
import { swapWrappedExpectedAndApproveMixin, swapWrappedTricrypto2Mixin, swapWrappedMixin } from "./mixins/swapWrappedMixins.js";
|
|
18
|
+
export const getPool = (poolId) => {
|
|
19
|
+
const poolDummy = new PoolTemplate(poolId);
|
|
20
|
+
class Pool extends PoolTemplate {
|
|
48
21
|
}
|
|
49
|
-
|
|
50
|
-
|
|
22
|
+
// statsBalances
|
|
23
|
+
if (poolDummy.isMeta) {
|
|
24
|
+
Object.assign(Pool.prototype, poolBalancesMetaMixin);
|
|
51
25
|
}
|
|
52
|
-
else if (poolDummy.useLending.reduce(
|
|
53
|
-
Object.assign(Pool.prototype,
|
|
26
|
+
else if (poolDummy.useLending.reduce((x, y) => x || y)) {
|
|
27
|
+
Object.assign(Pool.prototype, poolBalancesLendingMixin);
|
|
54
28
|
}
|
|
55
29
|
// depositBalancedAmounts
|
|
56
30
|
if (poolDummy.isCrypto) {
|
|
57
|
-
Object.assign(Pool.prototype,
|
|
31
|
+
Object.assign(Pool.prototype, depositBalancedAmountsCryptoMixin);
|
|
58
32
|
}
|
|
59
33
|
else {
|
|
60
|
-
Object.assign(Pool.prototype,
|
|
34
|
+
Object.assign(Pool.prototype, depositBalancedAmountsMixin);
|
|
61
35
|
}
|
|
62
36
|
// depositWrappedBalancedAmounts
|
|
63
37
|
if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
64
38
|
if (poolDummy.isCrypto) {
|
|
65
|
-
Object.assign(Pool.prototype,
|
|
39
|
+
Object.assign(Pool.prototype, depositWrappedBalancedAmountsCryptoMixin);
|
|
66
40
|
}
|
|
67
41
|
else {
|
|
68
|
-
Object.assign(Pool.prototype,
|
|
42
|
+
Object.assign(Pool.prototype, depositWrappedBalancedAmountsMixin);
|
|
69
43
|
}
|
|
70
44
|
}
|
|
71
45
|
// deposit and depositEstimateGas
|
|
72
46
|
if (poolDummy.isMetaFactory) {
|
|
73
47
|
if (poolDummy.isCrypto) {
|
|
74
|
-
Object.assign(Pool.prototype,
|
|
48
|
+
Object.assign(Pool.prototype, depositCryptoMetaFactoryMixin);
|
|
75
49
|
}
|
|
76
50
|
else {
|
|
77
|
-
Object.assign(Pool.prototype,
|
|
51
|
+
Object.assign(Pool.prototype, depositMetaFactoryMixin);
|
|
78
52
|
}
|
|
79
53
|
}
|
|
80
54
|
else if (poolDummy.zap && poolId !== 'susd') {
|
|
81
|
-
Object.assign(Pool.prototype,
|
|
55
|
+
Object.assign(Pool.prototype, depositZapMixin);
|
|
82
56
|
}
|
|
83
57
|
else if (poolDummy.isLending || (poolDummy.isCrypto && !poolDummy.isPlain)) {
|
|
84
|
-
Object.assign(Pool.prototype,
|
|
58
|
+
Object.assign(Pool.prototype, depositLendingOrCryptoMixin);
|
|
85
59
|
}
|
|
86
60
|
else {
|
|
87
|
-
Object.assign(Pool.prototype,
|
|
61
|
+
Object.assign(Pool.prototype, depositPlainMixin);
|
|
88
62
|
}
|
|
89
63
|
// depositWrapped and depositWrappedEstimateGas
|
|
90
64
|
if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
91
65
|
if (((poolDummy.isLending || poolDummy.isCrypto) && !poolDummy.zap) || (poolDummy.isCrypto && poolDummy.isMetaFactory)) {
|
|
92
|
-
Object.assign(Pool.prototype,
|
|
66
|
+
Object.assign(Pool.prototype, depositWrapped3argsMixin);
|
|
93
67
|
}
|
|
94
68
|
else {
|
|
95
|
-
Object.assign(Pool.prototype,
|
|
69
|
+
Object.assign(Pool.prototype, depositWrapped2argsMixin);
|
|
96
70
|
}
|
|
97
71
|
}
|
|
98
72
|
// withdrawExpected
|
|
99
|
-
if (poolDummy.
|
|
100
|
-
Object.assign(Pool.prototype,
|
|
101
|
-
}
|
|
102
|
-
else if (poolDummy.isMeta) {
|
|
103
|
-
Object.assign(Pool.prototype, withdrawExpectedMixins_1.withdrawExpectedMetaMixin);
|
|
73
|
+
if (poolDummy.isMeta) {
|
|
74
|
+
Object.assign(Pool.prototype, withdrawExpectedMetaMixin);
|
|
104
75
|
}
|
|
105
76
|
else if (poolDummy.isLending || (poolDummy.isCrypto && !poolDummy.isPlain)) {
|
|
106
|
-
Object.assign(Pool.prototype,
|
|
77
|
+
Object.assign(Pool.prototype, withdrawExpectedLendingOrCryptoMixin);
|
|
107
78
|
}
|
|
108
79
|
else {
|
|
109
|
-
Object.assign(Pool.prototype,
|
|
80
|
+
Object.assign(Pool.prototype, withdrawExpectedMixin);
|
|
110
81
|
}
|
|
111
82
|
// withdraw and withdrawEstimateGas
|
|
112
83
|
if (poolDummy.isMetaFactory) {
|
|
113
84
|
if (poolDummy.isCrypto) {
|
|
114
|
-
Object.assign(Pool.prototype,
|
|
85
|
+
Object.assign(Pool.prototype, withdrawCryptoMetaFactoryMixin);
|
|
115
86
|
}
|
|
116
87
|
else {
|
|
117
|
-
Object.assign(Pool.prototype,
|
|
88
|
+
Object.assign(Pool.prototype, withdrawMetaFactoryMixin);
|
|
118
89
|
}
|
|
119
90
|
}
|
|
120
91
|
else if (poolDummy.zap && poolId !== 'susd') {
|
|
121
|
-
Object.assign(Pool.prototype,
|
|
92
|
+
Object.assign(Pool.prototype, withdrawZapMixin);
|
|
122
93
|
}
|
|
123
94
|
else if (poolDummy.isLending || (poolDummy.isCrypto && !poolDummy.isPlain)) {
|
|
124
|
-
Object.assign(Pool.prototype,
|
|
95
|
+
Object.assign(Pool.prototype, withdrawLendingOrCryptoMixin);
|
|
125
96
|
}
|
|
126
97
|
else {
|
|
127
|
-
Object.assign(Pool.prototype,
|
|
98
|
+
Object.assign(Pool.prototype, withdrawPlainMixin);
|
|
128
99
|
}
|
|
129
100
|
// withdrawWrapped and withdrawWrappedEstimateGas
|
|
130
101
|
if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
131
102
|
if (((poolDummy.isLending || poolDummy.isCrypto) && !poolDummy.zap) || (poolDummy.isCrypto && poolDummy.isMetaFactory)) {
|
|
132
|
-
Object.assign(Pool.prototype,
|
|
133
|
-
Object.assign(Pool.prototype,
|
|
103
|
+
Object.assign(Pool.prototype, withdrawWrapped3argsMixin);
|
|
104
|
+
Object.assign(Pool.prototype, withdrawWrappedExpectedMixin);
|
|
134
105
|
}
|
|
135
106
|
else {
|
|
136
|
-
Object.assign(Pool.prototype,
|
|
137
|
-
Object.assign(Pool.prototype,
|
|
107
|
+
Object.assign(Pool.prototype, withdrawWrapped2argsMixin);
|
|
108
|
+
Object.assign(Pool.prototype, withdrawWrappedExpectedMixin);
|
|
138
109
|
}
|
|
139
110
|
}
|
|
140
111
|
// withdrawImbalance and withdrawImbalanceEstimateGas
|
|
141
112
|
if (!poolDummy.isCrypto) {
|
|
142
113
|
if (poolDummy.isMetaFactory) {
|
|
143
|
-
Object.assign(Pool.prototype,
|
|
114
|
+
Object.assign(Pool.prototype, withdrawImbalanceMetaFactoryMixin);
|
|
144
115
|
}
|
|
145
116
|
else if (poolDummy.zap && poolId !== 'susd') {
|
|
146
|
-
Object.assign(Pool.prototype,
|
|
117
|
+
Object.assign(Pool.prototype, withdrawImbalanceZapMixin);
|
|
147
118
|
}
|
|
148
119
|
else if (poolDummy.isLending) {
|
|
149
|
-
Object.assign(Pool.prototype,
|
|
120
|
+
Object.assign(Pool.prototype, withdrawImbalanceLendingMixin);
|
|
150
121
|
}
|
|
151
122
|
else {
|
|
152
|
-
Object.assign(Pool.prototype,
|
|
123
|
+
Object.assign(Pool.prototype, withdrawImbalancePlainMixin);
|
|
153
124
|
}
|
|
154
125
|
}
|
|
155
126
|
// withdrawImbalanceWrapped and withdrawImbalanceWrappedEstimateGas
|
|
156
127
|
if (!poolDummy.isCrypto) {
|
|
157
128
|
if (poolDummy.isLending && !poolDummy.zap) {
|
|
158
|
-
Object.assign(Pool.prototype,
|
|
129
|
+
Object.assign(Pool.prototype, withdrawImbalanceWrapped3argsMixin);
|
|
159
130
|
}
|
|
160
131
|
else if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
161
|
-
Object.assign(Pool.prototype,
|
|
132
|
+
Object.assign(Pool.prototype, withdrawImbalanceWrapped2argsMixin);
|
|
162
133
|
}
|
|
163
134
|
}
|
|
164
135
|
// withdrawOneCoinExpected
|
|
165
136
|
if (poolDummy.isMetaFactory) {
|
|
166
|
-
Object.assign(Pool.prototype,
|
|
137
|
+
Object.assign(Pool.prototype, withdrawOneCoinExpectedMetaFactoryMixin);
|
|
167
138
|
}
|
|
168
139
|
else if ((!poolDummy.isCrypto && poolDummy.zap) || poolDummy.isMeta) { // including susd
|
|
169
|
-
Object.assign(Pool.prototype,
|
|
140
|
+
Object.assign(Pool.prototype, withdrawOneCoinExpectedZapMixin);
|
|
170
141
|
}
|
|
171
142
|
else if (poolId === 'ib') {
|
|
172
|
-
Object.assign(Pool.prototype,
|
|
143
|
+
Object.assign(Pool.prototype, withdrawOneCoinExpected3argsMixin);
|
|
173
144
|
}
|
|
174
145
|
else {
|
|
175
|
-
Object.assign(Pool.prototype,
|
|
146
|
+
Object.assign(Pool.prototype, withdrawOneCoinExpected2argsMixin);
|
|
176
147
|
}
|
|
177
148
|
// withdrawOneCoin and withdrawOneCoinEstimateGas
|
|
178
149
|
if (poolDummy.isMetaFactory) {
|
|
179
150
|
if (poolDummy.isCrypto) {
|
|
180
|
-
Object.assign(Pool.prototype,
|
|
151
|
+
Object.assign(Pool.prototype, withdrawOneCoinCryptoMetaFactoryMixin);
|
|
181
152
|
}
|
|
182
153
|
else {
|
|
183
|
-
Object.assign(Pool.prototype,
|
|
154
|
+
Object.assign(Pool.prototype, withdrawOneCoinMetaFactoryMixin);
|
|
184
155
|
}
|
|
185
156
|
}
|
|
186
157
|
else if (poolDummy.zap) { // including susd
|
|
187
|
-
Object.assign(Pool.prototype,
|
|
158
|
+
Object.assign(Pool.prototype, withdrawOneCoinZapMixin);
|
|
188
159
|
}
|
|
189
160
|
else if (poolDummy.isLending || (poolDummy.isCrypto && !poolDummy.isPlain)) {
|
|
190
|
-
Object.assign(Pool.prototype,
|
|
161
|
+
Object.assign(Pool.prototype, withdrawOneCoinLendingOrCryptoMixin);
|
|
191
162
|
}
|
|
192
163
|
else {
|
|
193
|
-
Object.assign(Pool.prototype,
|
|
164
|
+
Object.assign(Pool.prototype, withdrawOneCoinPlainMixin);
|
|
194
165
|
}
|
|
195
166
|
// withdrawOneCoinWrappedExpected
|
|
196
167
|
if (!poolDummy.isPlain && !poolDummy.isFake && !(poolDummy.isLending && poolDummy.zap)) {
|
|
197
168
|
if (poolId === "ib") {
|
|
198
|
-
Object.assign(Pool.prototype,
|
|
169
|
+
Object.assign(Pool.prototype, withdrawOneCoinWrappedExpected3argsMixin);
|
|
199
170
|
}
|
|
200
171
|
else {
|
|
201
|
-
Object.assign(Pool.prototype,
|
|
172
|
+
Object.assign(Pool.prototype, withdrawOneCoinWrappedExpected2argsMixin);
|
|
202
173
|
}
|
|
203
174
|
}
|
|
204
175
|
// withdrawOneCoinWrapped and withdrawOneCoinWrappedEstimateGas
|
|
205
176
|
if (!poolDummy.isPlain && !poolDummy.isFake && !(poolDummy.isLending && poolDummy.zap)) {
|
|
206
177
|
if (((poolDummy.isLending || poolDummy.isCrypto) && !poolDummy.zap) || (poolDummy.isCrypto && poolDummy.isMetaFactory)) {
|
|
207
|
-
Object.assign(Pool.prototype,
|
|
178
|
+
Object.assign(Pool.prototype, withdrawOneCoinWrappedLendingOrCryptoMixin);
|
|
208
179
|
}
|
|
209
180
|
else {
|
|
210
|
-
Object.assign(Pool.prototype,
|
|
181
|
+
Object.assign(Pool.prototype, withdrawOneCoinWrappedMixin);
|
|
211
182
|
}
|
|
212
183
|
}
|
|
213
184
|
// swap and swapEstimateGas
|
|
214
|
-
if ('exchange(uint256,uint256,uint256,uint256,bool)' in
|
|
215
|
-
!(
|
|
216
|
-
Object.assign(Pool.prototype,
|
|
185
|
+
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve.contracts[poolDummy.address].contract &&
|
|
186
|
+
!(curve.chainId === 100 && poolDummy.id === "tricrypto")) { // tricrypto2 (eth), tricrypto (arbitrum), avaxcrypto (avalanche); 100 is xDAI
|
|
187
|
+
Object.assign(Pool.prototype, swapTricrypto2Mixin);
|
|
217
188
|
}
|
|
218
|
-
else if (poolDummy.isMetaFactory && (
|
|
189
|
+
else if (poolDummy.isMetaFactory && (getPool(poolDummy.basePool).isLending || getPool(poolDummy.basePool).isFake || poolDummy.isCrypto)) {
|
|
219
190
|
if (poolDummy.isCrypto) {
|
|
220
|
-
Object.assign(Pool.prototype,
|
|
191
|
+
Object.assign(Pool.prototype, swapCryptoMetaFactoryMixin);
|
|
221
192
|
}
|
|
222
193
|
else {
|
|
223
|
-
Object.assign(Pool.prototype,
|
|
194
|
+
Object.assign(Pool.prototype, swapMetaFactoryMixin);
|
|
224
195
|
}
|
|
225
196
|
}
|
|
226
197
|
else {
|
|
227
|
-
Object.assign(Pool.prototype,
|
|
198
|
+
Object.assign(Pool.prototype, swapMixin);
|
|
228
199
|
}
|
|
229
200
|
// swapWrapped and swapWrappedEstimateGas
|
|
230
201
|
if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
231
|
-
Object.assign(Pool.prototype,
|
|
232
|
-
if ('exchange(uint256,uint256,uint256,uint256,bool)' in
|
|
233
|
-
Object.assign(Pool.prototype,
|
|
202
|
+
Object.assign(Pool.prototype, swapWrappedExpectedAndApproveMixin);
|
|
203
|
+
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve.contracts[poolDummy.address].contract) { // tricrypto2 (eth), tricrypto (arbitrum)
|
|
204
|
+
Object.assign(Pool.prototype, swapWrappedTricrypto2Mixin);
|
|
234
205
|
}
|
|
235
206
|
else {
|
|
236
|
-
Object.assign(Pool.prototype,
|
|
207
|
+
Object.assign(Pool.prototype, swapWrappedMixin);
|
|
237
208
|
}
|
|
238
209
|
}
|
|
239
210
|
return new Pool(poolId);
|
|
240
211
|
};
|
|
241
|
-
exports.getPool = getPool;
|