@gearbox-protocol/sdk 0.0.100 → 0.0.103
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/.eslintignore +4 -0
- package/.eslintrc.js +52 -0
- package/.husky/pre-push +4 -0
- package/lib/apy/convexAPY.d.ts +8 -0
- package/lib/apy/convexAPY.js +200 -0
- package/lib/apy/lidoAPY.d.ts +4 -0
- package/lib/apy/lidoAPY.js +103 -0
- package/lib/config.d.ts +1 -0
- package/lib/config.js +2 -1
- package/lib/contracts/contracts.d.ts +9 -4
- package/lib/contracts/contracts.js +52 -14
- package/lib/contracts/contractsRegister.js +16 -4
- package/lib/core/constants.d.ts +7 -1
- package/lib/core/constants.js +11 -5
- package/lib/core/creditAccount.d.ts +3 -1
- package/lib/core/creditAccount.js +33 -31
- package/lib/core/creditManager.d.ts +13 -2
- package/lib/core/creditManager.js +77 -33
- package/lib/core/creditSession.js +14 -3
- package/lib/core/errors.d.ts +10 -0
- package/lib/core/errors.js +16 -1
- package/lib/core/eventOrTx.d.ts +1 -1
- package/lib/core/events.d.ts +19 -19
- package/lib/core/events.js +32 -30
- package/lib/core/multicall.d.ts +1 -1
- package/lib/core/pool.d.ts +2 -2
- package/lib/core/pool.js +8 -12
- package/lib/core/price.d.ts +2 -0
- package/lib/core/price.js +14 -0
- package/lib/core/strategy.d.ts +36 -0
- package/lib/core/strategy.js +57 -0
- package/lib/core/tokenDistributor.js +1 -1
- package/lib/core/transactions.d.ts +18 -3
- package/lib/core/transactions.js +39 -3
- package/lib/index.d.ts +8 -3
- package/lib/index.js +9 -4
- package/lib/oracles/priceFeeds.js +1 -1
- package/lib/pathfinder/convexLP.d.ts +1 -1
- package/lib/pathfinder/convexLP.js +26 -29
- package/lib/pathfinder/curveLP.d.ts +1 -1
- package/lib/pathfinder/curveLP.js +5 -7
- package/lib/pathfinder/path.d.ts +1 -1
- package/lib/pathfinder/path.js +38 -42
- package/lib/pathfinder/trade.d.ts +1 -2
- package/lib/pathfinder/tradeTypes.d.ts +5 -5
- package/lib/pathfinder/yVault.d.ts +2 -2
- package/lib/pathfinder/yVault.js +22 -19
- package/lib/payload/creditAccount.d.ts +4 -26
- package/lib/payload/creditManager.d.ts +3 -25
- package/lib/payload/pool.d.ts +2 -17
- package/lib/payload/pool.js +0 -1
- package/lib/strategies/curve.d.ts +6 -60
- package/lib/strategies/curve.js +6 -0
- package/lib/strategies/uniswapV2.js +3 -19
- package/lib/strategies/uniswapV3.js +1 -1
- package/lib/strategies/yearn.js +15 -11
- package/lib/tokens/convex.d.ts +3 -3
- package/lib/tokens/curveLP.d.ts +2 -2
- package/lib/tokens/curveLP.js +1 -1
- package/lib/tokens/gear.d.ts +2 -2
- package/lib/tokens/gear.js +1 -1
- package/lib/tokens/normal.d.ts +1 -1
- package/lib/tokens/token.js +9 -9
- package/lib/tokens/tokenData.d.ts +3 -1
- package/lib/tokens/tokenData.js +10 -8
- package/lib/tokens/yearn.d.ts +3 -3
- package/lib/utils/errors.d.ts +6 -0
- package/lib/utils/errors.js +13 -0
- package/lib/utils/formatter.d.ts +2 -1
- package/lib/utils/formatter.js +23 -15
- package/lib/utils/loading.d.ts +2 -1
- package/lib/utils/loading.js +9 -13
- package/lib/utils/mappers.d.ts +2 -1
- package/lib/utils/mappers.js +13 -5
- package/lib/utils/multicall.js +4 -3
- package/lib/utils/network.js +2 -2
- package/lib/utils/repeater.js +12 -24
- package/lib/utils/types.d.ts +1 -0
- package/lib/utils/validate.js +1 -1
- package/package.json +26 -8
- package/src/apy/convexAPY.ts +250 -0
- package/src/apy/lidoAPY.ts +89 -0
- package/src/config.ts +2 -1
- package/src/contracts/contracts.ts +73 -19
- package/src/contracts/contractsRegister.ts +19 -4
- package/src/core/constants.ts +11 -4
- package/src/core/creditAccount.ts +69 -37
- package/src/core/creditManager.ts +256 -148
- package/src/core/creditOperation.ts +7 -7
- package/src/core/creditSession.ts +25 -5
- package/src/core/errors.ts +25 -0
- package/src/core/eventOrTx.ts +8 -5
- package/src/core/events.ts +978 -911
- package/src/core/history.ts +46 -46
- package/src/core/multicall.ts +1 -1
- package/src/core/operations.ts +6 -0
- package/src/core/pool.ts +75 -58
- package/src/core/price.ts +13 -0
- package/src/core/strategy.ts +134 -0
- package/src/core/tokenDistributor.ts +2 -2
- package/src/core/transactions.ts +427 -350
- package/src/index.ts +9 -4
- package/src/oracles/priceFeeds.ts +523 -523
- package/src/pathfinder/contracts.ts +15 -13
- package/src/pathfinder/convexLP.ts +29 -25
- package/src/pathfinder/curveLP.ts +57 -53
- package/src/pathfinder/path.ts +158 -150
- package/src/pathfinder/priority.ts +11 -11
- package/src/pathfinder/trade.ts +84 -77
- package/src/pathfinder/tradeTypes.ts +98 -94
- package/src/pathfinder/yVault.ts +79 -63
- package/src/payload/creditAccount.ts +4 -26
- package/src/payload/creditManager.ts +4 -26
- package/src/payload/pool.ts +2 -19
- package/src/payload/token.ts +3 -3
- package/src/strategies/convex.ts +217 -210
- package/src/strategies/creditFacade.ts +70 -53
- package/src/strategies/curve.ts +263 -194
- package/src/strategies/lido.ts +33 -37
- package/src/strategies/uniswapV2.ts +90 -112
- package/src/strategies/uniswapV3.ts +114 -91
- package/src/strategies/yearn.ts +58 -62
- package/src/tokens/connectors.ts +6 -6
- package/src/tokens/convex.ts +297 -296
- package/src/tokens/curveLP.ts +170 -165
- package/src/tokens/gear.ts +47 -45
- package/src/tokens/normal.ts +801 -802
- package/src/tokens/token.ts +19 -10
- package/src/tokens/tokenData.ts +19 -9
- package/src/tokens/tokenType.ts +11 -11
- package/src/tokens/yearn.ts +126 -124
- package/src/utils/errors.ts +11 -0
- package/src/utils/formatter.ts +26 -18
- package/src/utils/loading.ts +14 -6
- package/src/utils/mappers.ts +15 -6
- package/src/utils/multicall.ts +6 -9
- package/src/utils/network.ts +21 -21
- package/src/utils/repeater.ts +2 -2
- package/src/utils/types.ts +6 -2
- package/src/utils/validate.ts +1 -1
- package/lib/core/adapters.d.ts +0 -15
- package/lib/core/adapters.js +0 -19
- package/lib/core/contracts.d.ts +0 -67
- package/lib/core/contracts.js +0 -254
- package/lib/core/contractsRegister.d.ts +0 -2
- package/lib/core/contractsRegister.js +0 -58
- package/lib/core/creditCard.d.ts +0 -13
- package/lib/core/creditCard.js +0 -2
- package/lib/core/oracles.d.ts +0 -38
- package/lib/core/oracles.js +0 -12
- package/lib/core/priceFeeds.d.ts +0 -3
- package/lib/core/priceFeeds.js +0 -492
- package/lib/core/protocols.d.ts +0 -13
- package/lib/core/protocols.js +0 -39
- package/lib/core/swap.d.ts +0 -4
- package/lib/core/swap.js +0 -8
- package/lib/core/trade.d.ts +0 -35
- package/lib/core/trade.js +0 -62
- package/lib/core/tradeTypes.d.ts +0 -79
- package/lib/core/tradeTypes.js +0 -21
- package/lib/utils/events.d.ts +0 -2
- package/lib/utils/events.js +0 -13
- package/src/utils/events.ts +0 -10
package/src/strategies/curve.ts
CHANGED
|
@@ -1,229 +1,298 @@
|
|
|
1
1
|
import { BigNumberish } from "ethers";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
CurveV1AdapterBase__factory,
|
|
5
|
+
CurveV1Adapter2Assets__factory,
|
|
6
|
+
CurveV1Adapter3Assets__factory,
|
|
7
|
+
CurveV1Adapter4Assets__factory
|
|
8
8
|
} from "../types";
|
|
9
9
|
|
|
10
10
|
import { MultiCallStruct } from "../types/contracts/interfaces/ICreditFacade.sol/ICreditFacade";
|
|
11
11
|
|
|
12
12
|
export class CurveCalls {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
public static exchange(
|
|
14
|
+
i: BigNumberish,
|
|
15
|
+
j: BigNumberish,
|
|
16
|
+
dx: BigNumberish,
|
|
17
|
+
min_dy: BigNumberish
|
|
18
|
+
) {
|
|
19
|
+
return CurveV1AdapterBase__factory.createInterface().encodeFunctionData(
|
|
20
|
+
"exchange",
|
|
21
|
+
[i, j, dx, min_dy]
|
|
22
|
+
);
|
|
23
|
+
}
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
public static exchange_all(
|
|
26
|
+
i: BigNumberish,
|
|
27
|
+
j: BigNumberish,
|
|
28
|
+
rateMinRAY: BigNumberish
|
|
29
|
+
) {
|
|
30
|
+
return CurveV1AdapterBase__factory.createInterface().encodeFunctionData(
|
|
31
|
+
"exchange_all",
|
|
32
|
+
[i, j, rateMinRAY]
|
|
33
|
+
);
|
|
34
|
+
}
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
public static exchange_underlying(
|
|
37
|
+
i: BigNumberish,
|
|
38
|
+
j: BigNumberish,
|
|
39
|
+
dx: BigNumberish,
|
|
40
|
+
min_dy: BigNumberish
|
|
41
|
+
) {
|
|
42
|
+
return CurveV1AdapterBase__factory.createInterface().encodeFunctionData(
|
|
43
|
+
"exchange_underlying",
|
|
44
|
+
[i, j, dx, min_dy]
|
|
45
|
+
);
|
|
46
|
+
}
|
|
33
47
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
public static exchange_all_underlying(
|
|
49
|
+
i: BigNumberish,
|
|
50
|
+
j: BigNumberish,
|
|
51
|
+
rateMinRAY: BigNumberish
|
|
52
|
+
) {
|
|
53
|
+
return CurveV1AdapterBase__factory.createInterface().encodeFunctionData(
|
|
54
|
+
"exchange_all_underlying",
|
|
55
|
+
[i, j, rateMinRAY]
|
|
56
|
+
);
|
|
57
|
+
}
|
|
40
58
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
public static add_all_liquidity_one_coin(
|
|
60
|
+
i: BigNumberish,
|
|
61
|
+
rateMinRAY: BigNumberish
|
|
62
|
+
) {
|
|
63
|
+
return CurveV1AdapterBase__factory.createInterface().encodeFunctionData(
|
|
64
|
+
"add_all_liquidity_one_coin",
|
|
65
|
+
[i, rateMinRAY]
|
|
66
|
+
);
|
|
67
|
+
}
|
|
47
68
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
public static remove_liquidity_one_coin(
|
|
70
|
+
token_amount: BigNumberish,
|
|
71
|
+
i: BigNumberish,
|
|
72
|
+
min_amount: BigNumberish
|
|
73
|
+
) {
|
|
74
|
+
return CurveV1AdapterBase__factory.createInterface().encodeFunctionData(
|
|
75
|
+
"remove_liquidity_one_coin",
|
|
76
|
+
[token_amount, i, min_amount]
|
|
77
|
+
);
|
|
78
|
+
}
|
|
54
79
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
80
|
+
public static remove_all_liquidity_one_coin(
|
|
81
|
+
i: BigNumberish,
|
|
82
|
+
minRateRAY: BigNumberish
|
|
83
|
+
) {
|
|
84
|
+
return CurveV1AdapterBase__factory.createInterface().encodeFunctionData(
|
|
85
|
+
"remove_all_liquidity_one_coin",
|
|
86
|
+
[i, minRateRAY]
|
|
87
|
+
);
|
|
88
|
+
}
|
|
61
89
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
public static add_liquidity(
|
|
91
|
+
amounts:
|
|
92
|
+
| [BigNumberish, BigNumberish]
|
|
93
|
+
| [BigNumberish, BigNumberish, BigNumberish]
|
|
94
|
+
| [BigNumberish, BigNumberish, BigNumberish, BigNumberish],
|
|
95
|
+
min_mint_amount: BigNumberish
|
|
96
|
+
): string {
|
|
97
|
+
switch (amounts.length) {
|
|
98
|
+
case 2:
|
|
99
|
+
return CurveV1Adapter2Assets__factory.createInterface().encodeFunctionData(
|
|
100
|
+
"add_liquidity",
|
|
101
|
+
[amounts, min_mint_amount]
|
|
102
|
+
);
|
|
103
|
+
case 3:
|
|
104
|
+
return CurveV1Adapter3Assets__factory.createInterface().encodeFunctionData(
|
|
105
|
+
"add_liquidity",
|
|
106
|
+
[amounts, min_mint_amount]
|
|
107
|
+
);
|
|
108
|
+
case 4:
|
|
109
|
+
return CurveV1Adapter4Assets__factory.createInterface().encodeFunctionData(
|
|
110
|
+
"add_liquidity",
|
|
111
|
+
[amounts, min_mint_amount]
|
|
112
|
+
);
|
|
113
|
+
default:
|
|
114
|
+
throw new Error("Wrong calls number: add_liquidity");
|
|
85
115
|
}
|
|
116
|
+
}
|
|
86
117
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
public static remove_liquidity(
|
|
119
|
+
amount: BigNumberish,
|
|
120
|
+
min_amounts:
|
|
121
|
+
| [BigNumberish, BigNumberish]
|
|
122
|
+
| [BigNumberish, BigNumberish, BigNumberish]
|
|
123
|
+
| [BigNumberish, BigNumberish, BigNumberish, BigNumberish]
|
|
124
|
+
) {
|
|
125
|
+
switch (min_amounts.length) {
|
|
126
|
+
case 2:
|
|
127
|
+
return CurveV1Adapter2Assets__factory.createInterface().encodeFunctionData(
|
|
128
|
+
"remove_liquidity",
|
|
129
|
+
[amount, min_amounts]
|
|
130
|
+
);
|
|
131
|
+
case 3:
|
|
132
|
+
return CurveV1Adapter3Assets__factory.createInterface().encodeFunctionData(
|
|
133
|
+
"remove_liquidity",
|
|
134
|
+
[amount, min_amounts]
|
|
135
|
+
);
|
|
136
|
+
case 4:
|
|
137
|
+
return CurveV1Adapter4Assets__factory.createInterface().encodeFunctionData(
|
|
138
|
+
"remove_liquidity",
|
|
139
|
+
[amount, min_amounts]
|
|
140
|
+
);
|
|
141
|
+
default:
|
|
142
|
+
throw new Error("Wrong calls number: remove_liquidity");
|
|
110
143
|
}
|
|
144
|
+
}
|
|
111
145
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
146
|
+
public static remove_liquidity_imbalance(
|
|
147
|
+
amounts:
|
|
148
|
+
| [BigNumberish, BigNumberish]
|
|
149
|
+
| [BigNumberish, BigNumberish, BigNumberish]
|
|
150
|
+
| [BigNumberish, BigNumberish, BigNumberish, BigNumberish],
|
|
151
|
+
max_burn_amount: BigNumberish
|
|
152
|
+
) {
|
|
153
|
+
switch (amounts.length) {
|
|
154
|
+
case 2:
|
|
155
|
+
return CurveV1Adapter2Assets__factory.createInterface().encodeFunctionData(
|
|
156
|
+
"remove_liquidity_imbalance",
|
|
157
|
+
[amounts, max_burn_amount]
|
|
158
|
+
);
|
|
159
|
+
case 3:
|
|
160
|
+
return CurveV1Adapter3Assets__factory.createInterface().encodeFunctionData(
|
|
161
|
+
"remove_liquidity_imbalance",
|
|
162
|
+
[amounts, max_burn_amount]
|
|
163
|
+
);
|
|
164
|
+
case 4:
|
|
165
|
+
return CurveV1Adapter4Assets__factory.createInterface().encodeFunctionData(
|
|
166
|
+
"remove_liquidity_imbalance",
|
|
167
|
+
[amounts, max_burn_amount]
|
|
168
|
+
);
|
|
169
|
+
default:
|
|
170
|
+
throw new Error("Wrong calls number: remove_liquidity_imbalance");
|
|
135
171
|
}
|
|
172
|
+
}
|
|
136
173
|
}
|
|
137
174
|
|
|
138
175
|
export class CurveMulticaller {
|
|
139
|
-
|
|
176
|
+
private readonly _address: string;
|
|
140
177
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
178
|
+
constructor(address: string) {
|
|
179
|
+
this._address = address;
|
|
180
|
+
}
|
|
144
181
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
182
|
+
exchange(
|
|
183
|
+
i: BigNumberish,
|
|
184
|
+
j: BigNumberish,
|
|
185
|
+
dx: BigNumberish,
|
|
186
|
+
min_dy: BigNumberish
|
|
187
|
+
): MultiCallStruct {
|
|
188
|
+
return {
|
|
189
|
+
target: this._address,
|
|
190
|
+
callData: CurveCalls.exchange(i, j, dx, min_dy)
|
|
191
|
+
};
|
|
192
|
+
}
|
|
151
193
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
194
|
+
exchange_all(
|
|
195
|
+
i: BigNumberish,
|
|
196
|
+
j: BigNumberish,
|
|
197
|
+
rateMinRAY: BigNumberish
|
|
198
|
+
): MultiCallStruct {
|
|
199
|
+
return {
|
|
200
|
+
target: this._address,
|
|
201
|
+
callData: CurveCalls.exchange_all(i, j, rateMinRAY)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
158
204
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
205
|
+
exchange_underlying(
|
|
206
|
+
i: BigNumberish,
|
|
207
|
+
j: BigNumberish,
|
|
208
|
+
dx: BigNumberish,
|
|
209
|
+
min_dy: BigNumberish
|
|
210
|
+
): MultiCallStruct {
|
|
211
|
+
return {
|
|
212
|
+
target: this._address,
|
|
213
|
+
callData: CurveCalls.exchange_underlying(i, j, dx, min_dy)
|
|
214
|
+
};
|
|
215
|
+
}
|
|
165
216
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
217
|
+
exchange_all_underlying(
|
|
218
|
+
i: BigNumberish,
|
|
219
|
+
j: BigNumberish,
|
|
220
|
+
rateMinRAY: BigNumberish
|
|
221
|
+
): MultiCallStruct {
|
|
222
|
+
return {
|
|
223
|
+
target: this._address,
|
|
224
|
+
callData: CurveCalls.exchange_all_underlying(i, j, rateMinRAY)
|
|
225
|
+
};
|
|
226
|
+
}
|
|
172
227
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
228
|
+
add_all_liquidity_one_coin(
|
|
229
|
+
i: BigNumberish,
|
|
230
|
+
rateMinRAY: BigNumberish
|
|
231
|
+
): MultiCallStruct {
|
|
232
|
+
return {
|
|
233
|
+
target: this._address,
|
|
234
|
+
callData: CurveCalls.add_all_liquidity_one_coin(i, rateMinRAY)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
179
237
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
238
|
+
remove_liquidity_one_coin(
|
|
239
|
+
token_amount: BigNumberish,
|
|
240
|
+
i: BigNumberish,
|
|
241
|
+
min_amount: BigNumberish
|
|
242
|
+
) {
|
|
243
|
+
return {
|
|
244
|
+
target: this._address,
|
|
245
|
+
callData: CurveCalls.remove_liquidity_one_coin(
|
|
246
|
+
token_amount,
|
|
247
|
+
i,
|
|
248
|
+
min_amount
|
|
249
|
+
)
|
|
250
|
+
};
|
|
251
|
+
}
|
|
186
252
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
253
|
+
remove_all_liquidity_one_coin(i: BigNumberish, minRateRAY: BigNumberish) {
|
|
254
|
+
return {
|
|
255
|
+
target: this._address,
|
|
256
|
+
callData: CurveCalls.remove_all_liquidity_one_coin(i, minRateRAY)
|
|
257
|
+
};
|
|
258
|
+
}
|
|
193
259
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
260
|
+
add_liquidity(
|
|
261
|
+
amounts:
|
|
262
|
+
| [BigNumberish, BigNumberish]
|
|
263
|
+
| [BigNumberish, BigNumberish, BigNumberish]
|
|
264
|
+
| [BigNumberish, BigNumberish, BigNumberish, BigNumberish],
|
|
265
|
+
min_mint_amount: BigNumberish
|
|
266
|
+
): MultiCallStruct {
|
|
267
|
+
return {
|
|
268
|
+
target: this._address,
|
|
269
|
+
callData: CurveCalls.add_liquidity(amounts, min_mint_amount)
|
|
270
|
+
};
|
|
271
|
+
}
|
|
205
272
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
273
|
+
remove_liquidity(
|
|
274
|
+
amount: BigNumberish,
|
|
275
|
+
min_amounts:
|
|
276
|
+
| [BigNumberish, BigNumberish]
|
|
277
|
+
| [BigNumberish, BigNumberish, BigNumberish]
|
|
278
|
+
| [BigNumberish, BigNumberish, BigNumberish, BigNumberish]
|
|
279
|
+
): MultiCallStruct {
|
|
280
|
+
return {
|
|
281
|
+
target: this._address,
|
|
282
|
+
callData: CurveCalls.remove_liquidity(amount, min_amounts)
|
|
283
|
+
};
|
|
284
|
+
}
|
|
217
285
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
286
|
+
remove_liquidity_imbalance(
|
|
287
|
+
amounts:
|
|
288
|
+
| [BigNumberish, BigNumberish]
|
|
289
|
+
| [BigNumberish, BigNumberish, BigNumberish]
|
|
290
|
+
| [BigNumberish, BigNumberish, BigNumberish, BigNumberish],
|
|
291
|
+
max_burn_amount: BigNumberish
|
|
292
|
+
): MultiCallStruct {
|
|
293
|
+
return {
|
|
294
|
+
target: this._address,
|
|
295
|
+
callData: CurveCalls.remove_liquidity_imbalance(amounts, max_burn_amount)
|
|
296
|
+
};
|
|
297
|
+
}
|
|
229
298
|
}
|
package/src/strategies/lido.ts
CHANGED
|
@@ -1,46 +1,42 @@
|
|
|
1
|
-
import { BigNumberish } from "ethers"
|
|
1
|
+
import { BigNumberish } from "ethers";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
LidoV1Adapter__factory
|
|
6
|
-
} from "../types";
|
|
3
|
+
import { LidoV1Adapter__factory } from "../types";
|
|
7
4
|
|
|
8
5
|
import { MultiCallStruct } from "../types/contracts/interfaces/ICreditFacade.sol/ICreditFacade";
|
|
9
6
|
|
|
10
|
-
|
|
11
7
|
export class LidoCalls {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
public static submit(amount: BigNumberish) {
|
|
9
|
+
return LidoV1Adapter__factory.createInterface().encodeFunctionData(
|
|
10
|
+
"submit",
|
|
11
|
+
[amount]
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public static submitAll() {
|
|
16
|
+
return LidoV1Adapter__factory.createInterface().encodeFunctionData(
|
|
17
|
+
"submitAll"
|
|
18
|
+
);
|
|
19
|
+
}
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
export class LidoMulticaller {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
23
|
+
private readonly _address: string;
|
|
24
|
+
|
|
25
|
+
constructor(address: string) {
|
|
26
|
+
this._address = address;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
submit(amount: BigNumberish): MultiCallStruct {
|
|
30
|
+
return {
|
|
31
|
+
target: this._address,
|
|
32
|
+
callData: LidoCalls.submit(amount)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
submitAll(): MultiCallStruct {
|
|
37
|
+
return {
|
|
38
|
+
target: this._address,
|
|
39
|
+
callData: LidoCalls.submitAll()
|
|
40
|
+
};
|
|
41
|
+
}
|
|
46
42
|
}
|