@enzymefinance/testutils 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -0
- package/dist/declarations/src/assertions.d.ts +4 -0
- package/dist/declarations/src/deployment.d.ts +81 -0
- package/dist/declarations/src/helpers.d.ts +2 -0
- package/dist/declarations/src/index.d.ts +5 -0
- package/dist/declarations/src/scaffolding/assets.d.ts +12 -0
- package/dist/declarations/src/scaffolding/chainlink.d.ts +3 -0
- package/dist/declarations/src/scaffolding/common.d.ts +6 -0
- package/dist/declarations/src/scaffolding/core.d.ts +19 -0
- package/dist/declarations/src/scaffolding/extensions/common.d.ts +11 -0
- package/dist/declarations/src/scaffolding/extensions/fees.d.ts +14 -0
- package/dist/declarations/src/scaffolding/extensions/index.d.ts +4 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/aave.d.ts +19 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/alpha.d.ts +36 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/compound.d.ts +27 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/curve.d.ts +331 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/idle.d.ts +57 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/index.d.ts +14 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/kyber.d.ts +23 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/mock.d.ts +32 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/paraSwapV4.d.ts +22 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/synthetix.d.ts +25 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/trackedAssets.d.ts +17 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV2.d.ts +46 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/uniswapV3.d.ts +15 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/yearn.d.ts +22 -0
- package/dist/declarations/src/scaffolding/extensions/integrations/zeroExV2.d.ts +12 -0
- package/dist/declarations/src/scaffolding/extensions/policies.d.ts +15 -0
- package/dist/declarations/src/scaffolding/index.d.ts +9 -0
- package/dist/declarations/src/scaffolding/peripheral/index.d.ts +1 -0
- package/dist/declarations/src/scaffolding/peripheral/sharesRequestors.d.ts +19 -0
- package/dist/declarations/src/scaffolding/setup.d.ts +46 -0
- package/dist/declarations/src/scaffolding/shares.d.ts +30 -0
- package/dist/declarations/src/scaffolding/vaultCalls.d.ts +17 -0
- package/dist/declarations/src/whales.d.ts +43 -0
- package/dist/enzymefinance-testutils.browser.cjs.js +3160 -0
- package/dist/enzymefinance-testutils.browser.esm.js +3045 -0
- package/dist/enzymefinance-testutils.cjs.d.ts +1 -0
- package/dist/enzymefinance-testutils.cjs.dev.js +3160 -0
- package/dist/enzymefinance-testutils.cjs.js +7 -0
- package/dist/enzymefinance-testutils.cjs.prod.js +3160 -0
- package/dist/enzymefinance-testutils.esm.js +3045 -0
- package/package.json +18 -0
- package/src/assertions.ts +20 -0
- package/src/deployment.ts +169 -0
- package/src/helpers.ts +6 -0
- package/src/index.ts +5 -0
- package/src/scaffolding/assets.ts +39 -0
- package/src/scaffolding/chainlink.ts +8 -0
- package/src/scaffolding/common.ts +6 -0
- package/src/scaffolding/core.ts +77 -0
- package/src/scaffolding/extensions/common.ts +30 -0
- package/src/scaffolding/extensions/fees.ts +87 -0
- package/src/scaffolding/extensions/index.ts +4 -0
- package/src/scaffolding/extensions/integrations/aave.ts +80 -0
- package/src/scaffolding/extensions/integrations/alpha.ts +119 -0
- package/src/scaffolding/extensions/integrations/compound.ts +97 -0
- package/src/scaffolding/extensions/integrations/curve.ts +1207 -0
- package/src/scaffolding/extensions/integrations/idle.ts +215 -0
- package/src/scaffolding/extensions/integrations/index.ts +14 -0
- package/src/scaffolding/extensions/integrations/kyber.ts +69 -0
- package/src/scaffolding/extensions/integrations/mock.ts +118 -0
- package/src/scaffolding/extensions/integrations/paraSwapV4.ts +65 -0
- package/src/scaffolding/extensions/integrations/synthetix.ts +97 -0
- package/src/scaffolding/extensions/integrations/trackedAssets.ts +66 -0
- package/src/scaffolding/extensions/integrations/uniswapV2.ts +171 -0
- package/src/scaffolding/extensions/integrations/uniswapV3.ts +56 -0
- package/src/scaffolding/extensions/integrations/yearn.ts +81 -0
- package/src/scaffolding/extensions/integrations/zeroExV2.ts +45 -0
- package/src/scaffolding/extensions/policies.ts +85 -0
- package/src/scaffolding/index.ts +9 -0
- package/src/scaffolding/peripheral/index.ts +1 -0
- package/src/scaffolding/peripheral/sharesRequestors.ts +53 -0
- package/src/scaffolding/setup.ts +135 -0
- package/src/scaffolding/shares.ts +63 -0
- package/src/scaffolding/vaultCalls.ts +58 -0
- package/src/types.d.ts +1 -0
- package/src/whales.ts +63 -0
- package/tsconfig.json +4 -0
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./declarations/src/index";
|
@@ -0,0 +1,3160 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
6
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
7
|
+
var protocol = require('@enzymefinance/protocol');
|
8
|
+
var ethers = require('ethers');
|
9
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
10
|
+
var ethers$1 = require('@enzymefinance/ethers');
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
12
|
+
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
14
|
+
|
15
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
|
16
|
+
|
17
|
+
function getNamedSigner(_x) {
|
18
|
+
return _getNamedSigner.apply(this, arguments);
|
19
|
+
}
|
20
|
+
|
21
|
+
function _getNamedSigner() {
|
22
|
+
_getNamedSigner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(name) {
|
23
|
+
var accounts;
|
24
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
25
|
+
while (1) {
|
26
|
+
switch (_context.prev = _context.next) {
|
27
|
+
case 0:
|
28
|
+
_context.next = 2;
|
29
|
+
return hre.getNamedAccounts();
|
30
|
+
|
31
|
+
case 2:
|
32
|
+
accounts = _context.sent;
|
33
|
+
|
34
|
+
if (accounts[name]) {
|
35
|
+
_context.next = 5;
|
36
|
+
break;
|
37
|
+
}
|
38
|
+
|
39
|
+
throw new Error("Missing account with name ".concat(name));
|
40
|
+
|
41
|
+
case 5:
|
42
|
+
return _context.abrupt("return", provider.getSignerWithAddress(accounts[name]));
|
43
|
+
|
44
|
+
case 6:
|
45
|
+
case "end":
|
46
|
+
return _context.stop();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}, _callee);
|
50
|
+
}));
|
51
|
+
return _getNamedSigner.apply(this, arguments);
|
52
|
+
}
|
53
|
+
|
54
|
+
function getUnnamedSigners() {
|
55
|
+
return _getUnnamedSigners.apply(this, arguments);
|
56
|
+
}
|
57
|
+
|
58
|
+
function _getUnnamedSigners() {
|
59
|
+
_getUnnamedSigners = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
60
|
+
var accounts;
|
61
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
62
|
+
while (1) {
|
63
|
+
switch (_context2.prev = _context2.next) {
|
64
|
+
case 0:
|
65
|
+
_context2.next = 2;
|
66
|
+
return hre.getUnnamedAccounts();
|
67
|
+
|
68
|
+
case 2:
|
69
|
+
accounts = _context2.sent;
|
70
|
+
return _context2.abrupt("return", Promise.all(accounts.map(function (account) {
|
71
|
+
return provider.getSignerWithAddress(account);
|
72
|
+
})));
|
73
|
+
|
74
|
+
case 4:
|
75
|
+
case "end":
|
76
|
+
return _context2.stop();
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}, _callee2);
|
80
|
+
}));
|
81
|
+
return _getUnnamedSigners.apply(this, arguments);
|
82
|
+
}
|
83
|
+
|
84
|
+
function deployProtocolFixture() {
|
85
|
+
return _deployProtocolFixture.apply(this, arguments);
|
86
|
+
}
|
87
|
+
|
88
|
+
function _deployProtocolFixture() {
|
89
|
+
_deployProtocolFixture = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
90
|
+
var fixture, deployer, accounts, config, deployment;
|
91
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
92
|
+
while (1) {
|
93
|
+
switch (_context3.prev = _context3.next) {
|
94
|
+
case 0:
|
95
|
+
_context3.next = 2;
|
96
|
+
return hre.deployments.fixture();
|
97
|
+
|
98
|
+
case 2:
|
99
|
+
fixture = _context3.sent;
|
100
|
+
_context3.next = 5;
|
101
|
+
return getNamedSigner('deployer');
|
102
|
+
|
103
|
+
case 5:
|
104
|
+
deployer = _context3.sent;
|
105
|
+
_context3.next = 8;
|
106
|
+
return getUnnamedSigners();
|
107
|
+
|
108
|
+
case 8:
|
109
|
+
accounts = _context3.sent;
|
110
|
+
config = fixture['Config'].linkedData; // prettier-ignore
|
111
|
+
|
112
|
+
deployment = {
|
113
|
+
dispatcher: new protocol.Dispatcher(fixture['Dispatcher'].address, deployer),
|
114
|
+
vaultLib: new protocol.VaultLib(fixture['VaultLib'].address, deployer),
|
115
|
+
fundDeployer: new protocol.FundDeployer(fixture['FundDeployer'].address, deployer),
|
116
|
+
policyManager: new protocol.PolicyManager(fixture['PolicyManager'].address, deployer),
|
117
|
+
aavePriceFeed: new protocol.AavePriceFeed(fixture['AavePriceFeed'].address, deployer),
|
118
|
+
alphaHomoraV1PriceFeed: new protocol.AlphaHomoraV1PriceFeed(fixture['AlphaHomoraV1PriceFeed'].address, deployer),
|
119
|
+
chainlinkPriceFeed: new protocol.ChainlinkPriceFeed(fixture['ChainlinkPriceFeed'].address, deployer),
|
120
|
+
compoundPriceFeed: new protocol.CompoundPriceFeed(fixture['CompoundPriceFeed'].address, deployer),
|
121
|
+
curvePriceFeed: new protocol.CurvePriceFeed(fixture['CurvePriceFeed'].address, deployer),
|
122
|
+
idlePriceFeed: new protocol.IdlePriceFeed(fixture['IdlePriceFeed'].address, deployer),
|
123
|
+
lidoStethPriceFeed: new protocol.LidoStethPriceFeed(fixture['LidoStethPriceFeed'].address, deployer),
|
124
|
+
revertingPriceFeed: new protocol.RevertingPriceFeed(fixture['RevertingPriceFeed'].address, deployer),
|
125
|
+
synthetixPriceFeed: new protocol.SynthetixPriceFeed(fixture['SynthetixPriceFeed'].address, deployer),
|
126
|
+
stakehoundEthPriceFeed: new protocol.StakehoundEthPriceFeed(fixture['StakehoundEthPriceFeed'].address, deployer),
|
127
|
+
wdgldPriceFeed: new protocol.WdgldPriceFeed(fixture['WdgldPriceFeed'].address, deployer),
|
128
|
+
yearnVaultV2PriceFeed: new protocol.YearnVaultV2PriceFeed(fixture['YearnVaultV2PriceFeed'].address, deployer),
|
129
|
+
aggregatedDerivativePriceFeed: new protocol.AggregatedDerivativePriceFeed(fixture['AggregatedDerivativePriceFeed'].address, deployer),
|
130
|
+
valueInterpreter: new protocol.ValueInterpreter(fixture['ValueInterpreter'].address, deployer),
|
131
|
+
uniswapV2PoolPriceFeed: new protocol.UniswapV2PoolPriceFeed(fixture['UniswapV2PoolPriceFeed'].address, deployer),
|
132
|
+
integrationManager: new protocol.IntegrationManager(fixture['IntegrationManager'].address, deployer),
|
133
|
+
curveLiquidityAaveAdapter: new protocol.CurveLiquidityAaveAdapter(fixture['CurveLiquidityAaveAdapter'].address, deployer),
|
134
|
+
curveLiquidityEursAdapter: new protocol.CurveLiquidityEursAdapter(fixture['CurveLiquidityEursAdapter'].address, deployer),
|
135
|
+
curveLiquiditySethAdapter: new protocol.CurveLiquiditySethAdapter(fixture['CurveLiquiditySethAdapter'].address, deployer),
|
136
|
+
curveLiquidityStethAdapter: new protocol.CurveLiquidityStethAdapter(fixture['CurveLiquidityStethAdapter'].address, deployer),
|
137
|
+
aaveAdapter: new protocol.AaveAdapter(fixture['AaveAdapter'].address, deployer),
|
138
|
+
alphaHomoraV1Adapter: new protocol.AlphaHomoraV1Adapter(fixture['AlphaHomoraV1Adapter'].address, deployer),
|
139
|
+
idleAdapter: new protocol.IdleAdapter(fixture['IdleAdapter'].address, deployer),
|
140
|
+
paraSwapV4Adapter: new protocol.ParaSwapV4Adapter(fixture['ParaSwapV4Adapter'].address, deployer),
|
141
|
+
synthetixAdapter: new protocol.SynthetixAdapter(fixture['SynthetixAdapter'].address, deployer),
|
142
|
+
yearnVaultV2Adapter: new protocol.YearnVaultV2Adapter(fixture['YearnVaultV2Adapter'].address, deployer),
|
143
|
+
zeroExV2Adapter: new protocol.ZeroExV2Adapter(fixture['ZeroExV2Adapter'].address, deployer),
|
144
|
+
compoundAdapter: new protocol.CompoundAdapter(fixture['CompoundAdapter'].address, deployer),
|
145
|
+
uniswapV2Adapter: new protocol.UniswapV2Adapter(fixture['UniswapV2Adapter'].address, deployer),
|
146
|
+
trackedAssetsAdapter: new protocol.TrackedAssetsAdapter(fixture['TrackedAssetsAdapter'].address, deployer),
|
147
|
+
uniswapV3Adapter: new protocol.UniswapV3Adapter(fixture['UniswapV3Adapter'].address, deployer),
|
148
|
+
curveExchangeAdapter: new protocol.CurveExchangeAdapter(fixture['CurveExchangeAdapter'].address, deployer),
|
149
|
+
kyberAdapter: new protocol.KyberAdapter(fixture['KyberAdapter'].address, deployer),
|
150
|
+
feeManager: new protocol.FeeManager(fixture['FeeManager'].address, deployer),
|
151
|
+
comptrollerLib: new protocol.ComptrollerLib(fixture['ComptrollerLib'].address, deployer),
|
152
|
+
entranceRateBurnFee: new protocol.EntranceRateBurnFee(fixture['EntranceRateBurnFee'].address, deployer),
|
153
|
+
entranceRateDirectFee: new protocol.EntranceRateDirectFee(fixture['EntranceRateDirectFee'].address, deployer),
|
154
|
+
managementFee: new protocol.ManagementFee(fixture['ManagementFee'].address, deployer),
|
155
|
+
performanceFee: new protocol.PerformanceFee(fixture['PerformanceFee'].address, deployer),
|
156
|
+
authUserExecutedSharesRequestorLib: new protocol.AuthUserExecutedSharesRequestorLib(fixture['AuthUserExecutedSharesRequestorLib'].address, deployer),
|
157
|
+
authUserExecutedSharesRequestorFactory: new protocol.AuthUserExecutedSharesRequestorFactory(fixture['AuthUserExecutedSharesRequestorFactory'].address, deployer),
|
158
|
+
fundActionsWrapper: new protocol.FundActionsWrapper(fixture['FundActionsWrapper'].address, deployer),
|
159
|
+
adapterBlacklist: new protocol.AdapterBlacklist(fixture['AdapterBlacklist'].address, deployer),
|
160
|
+
adapterWhitelist: new protocol.AdapterWhitelist(fixture['AdapterWhitelist'].address, deployer),
|
161
|
+
assetBlacklist: new protocol.AssetBlacklist(fixture['AssetBlacklist'].address, deployer),
|
162
|
+
assetWhitelist: new protocol.AssetWhitelist(fixture['AssetWhitelist'].address, deployer),
|
163
|
+
buySharesCallerWhitelist: new protocol.BuySharesCallerWhitelist(fixture['BuySharesCallerWhitelist'].address, deployer),
|
164
|
+
maxConcentration: new protocol.MaxConcentration(fixture['MaxConcentration'].address, deployer),
|
165
|
+
minMaxInvestment: new protocol.MinMaxInvestment(fixture['MinMaxInvestment'].address, deployer),
|
166
|
+
investorWhitelist: new protocol.InvestorWhitelist(fixture['InvestorWhitelist'].address, deployer),
|
167
|
+
guaranteedRedemption: new protocol.GuaranteedRedemption(fixture['GuaranteedRedemption'].address, deployer)
|
168
|
+
};
|
169
|
+
return _context3.abrupt("return", {
|
170
|
+
deployer: deployer,
|
171
|
+
deployment: deployment,
|
172
|
+
accounts: accounts,
|
173
|
+
config: config
|
174
|
+
});
|
175
|
+
|
176
|
+
case 12:
|
177
|
+
case "end":
|
178
|
+
return _context3.stop();
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}, _callee3);
|
182
|
+
}));
|
183
|
+
return _deployProtocolFixture.apply(this, arguments);
|
184
|
+
}
|
185
|
+
|
186
|
+
// TODO: Remove this.
|
187
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
188
|
+
function defaultTestDeployment(_x2) {
|
189
|
+
return _defaultTestDeployment.apply(this, arguments);
|
190
|
+
}
|
191
|
+
|
192
|
+
function _defaultTestDeployment() {
|
193
|
+
_defaultTestDeployment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(_) {
|
194
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
195
|
+
while (1) {
|
196
|
+
switch (_context4.prev = _context4.next) {
|
197
|
+
case 0:
|
198
|
+
throw new Error('Removed');
|
199
|
+
|
200
|
+
case 1:
|
201
|
+
case "end":
|
202
|
+
return _context4.stop();
|
203
|
+
}
|
204
|
+
}
|
205
|
+
}, _callee4);
|
206
|
+
}));
|
207
|
+
return _defaultTestDeployment.apply(this, arguments);
|
208
|
+
}
|
209
|
+
|
210
|
+
function addTrackedAssets(_x) {
|
211
|
+
return _addTrackedAssets.apply(this, arguments);
|
212
|
+
}
|
213
|
+
|
214
|
+
function _addTrackedAssets() {
|
215
|
+
_addTrackedAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
216
|
+
var comptrollerProxy, integrationManager, fundOwner, trackedAssetsAdapter, incomingAssets, args, callArgs, addTrackedAssetsTx;
|
217
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
218
|
+
while (1) {
|
219
|
+
switch (_context.prev = _context.next) {
|
220
|
+
case 0:
|
221
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, trackedAssetsAdapter = _ref.trackedAssetsAdapter, incomingAssets = _ref.incomingAssets;
|
222
|
+
args = protocol.addTrackedAssetsArgs(incomingAssets);
|
223
|
+
callArgs = protocol.callOnIntegrationArgs({
|
224
|
+
adapter: trackedAssetsAdapter,
|
225
|
+
selector: protocol.addTrackedAssetsSelector,
|
226
|
+
encodedCallArgs: args
|
227
|
+
});
|
228
|
+
addTrackedAssetsTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
229
|
+
_context.next = 6;
|
230
|
+
return expect(addTrackedAssetsTx).resolves.toBeReceipt();
|
231
|
+
|
232
|
+
case 6:
|
233
|
+
return _context.abrupt("return", addTrackedAssetsTx);
|
234
|
+
|
235
|
+
case 7:
|
236
|
+
case "end":
|
237
|
+
return _context.stop();
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}, _callee);
|
241
|
+
}));
|
242
|
+
return _addTrackedAssets.apply(this, arguments);
|
243
|
+
}
|
244
|
+
|
245
|
+
function removeTrackedAssets(_x2) {
|
246
|
+
return _removeTrackedAssets.apply(this, arguments);
|
247
|
+
}
|
248
|
+
|
249
|
+
function _removeTrackedAssets() {
|
250
|
+
_removeTrackedAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
251
|
+
var comptrollerProxy, integrationManager, fundOwner, trackedAssetsAdapter, spendAssets, callArgs;
|
252
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
253
|
+
while (1) {
|
254
|
+
switch (_context2.prev = _context2.next) {
|
255
|
+
case 0:
|
256
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, trackedAssetsAdapter = _ref2.trackedAssetsAdapter, spendAssets = _ref2.spendAssets;
|
257
|
+
callArgs = protocol.callOnIntegrationArgs({
|
258
|
+
adapter: trackedAssetsAdapter,
|
259
|
+
selector: protocol.removeTrackedAssetsSelector,
|
260
|
+
encodedCallArgs: protocol.removeTrackedAssetsArgs(spendAssets)
|
261
|
+
});
|
262
|
+
return _context2.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
263
|
+
|
264
|
+
case 3:
|
265
|
+
case "end":
|
266
|
+
return _context2.stop();
|
267
|
+
}
|
268
|
+
}
|
269
|
+
}, _callee2);
|
270
|
+
}));
|
271
|
+
return _removeTrackedAssets.apply(this, arguments);
|
272
|
+
}
|
273
|
+
|
274
|
+
function addNewAssetsToFund(_x) {
|
275
|
+
return _addNewAssetsToFund.apply(this, arguments);
|
276
|
+
}
|
277
|
+
|
278
|
+
function _addNewAssetsToFund() {
|
279
|
+
_addNewAssetsToFund = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
280
|
+
var fundOwner, comptrollerProxy, vaultProxy, integrationManager, trackedAssetsAdapter, assets, _ref$amounts, amounts, i;
|
281
|
+
|
282
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
283
|
+
while (1) {
|
284
|
+
switch (_context.prev = _context.next) {
|
285
|
+
case 0:
|
286
|
+
fundOwner = _ref.fundOwner, comptrollerProxy = _ref.comptrollerProxy, vaultProxy = _ref.vaultProxy, integrationManager = _ref.integrationManager, trackedAssetsAdapter = _ref.trackedAssetsAdapter, assets = _ref.assets, _ref$amounts = _ref.amounts, amounts = _ref$amounts === void 0 ? new Array(assets.length).fill(1) : _ref$amounts;
|
287
|
+
_context.t0 = _regeneratorRuntime__default['default'].keys(assets);
|
288
|
+
|
289
|
+
case 2:
|
290
|
+
if ((_context.t1 = _context.t0()).done) {
|
291
|
+
_context.next = 8;
|
292
|
+
break;
|
293
|
+
}
|
294
|
+
|
295
|
+
i = _context.t1.value;
|
296
|
+
_context.next = 6;
|
297
|
+
return assets[i].transfer(vaultProxy, amounts[i]);
|
298
|
+
|
299
|
+
case 6:
|
300
|
+
_context.next = 2;
|
301
|
+
break;
|
302
|
+
|
303
|
+
case 8:
|
304
|
+
return _context.abrupt("return", addTrackedAssets({
|
305
|
+
comptrollerProxy: comptrollerProxy,
|
306
|
+
integrationManager: integrationManager,
|
307
|
+
fundOwner: fundOwner,
|
308
|
+
trackedAssetsAdapter: trackedAssetsAdapter,
|
309
|
+
incomingAssets: assets
|
310
|
+
}));
|
311
|
+
|
312
|
+
case 9:
|
313
|
+
case "end":
|
314
|
+
return _context.stop();
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}, _callee);
|
318
|
+
}));
|
319
|
+
return _addNewAssetsToFund.apply(this, arguments);
|
320
|
+
}
|
321
|
+
|
322
|
+
function updateChainlinkAggregator(_x, _x2) {
|
323
|
+
return _updateChainlinkAggregator.apply(this, arguments);
|
324
|
+
}
|
325
|
+
|
326
|
+
function _updateChainlinkAggregator() {
|
327
|
+
_updateChainlinkAggregator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(aggregator, price) {
|
328
|
+
var answer, block;
|
329
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
330
|
+
while (1) {
|
331
|
+
switch (_context.prev = _context.next) {
|
332
|
+
case 0:
|
333
|
+
if (!(price !== null && price !== void 0)) {
|
334
|
+
_context.next = 4;
|
335
|
+
break;
|
336
|
+
}
|
337
|
+
|
338
|
+
_context.t0 = price;
|
339
|
+
_context.next = 7;
|
340
|
+
break;
|
341
|
+
|
342
|
+
case 4:
|
343
|
+
_context.next = 6;
|
344
|
+
return aggregator.latestAnswer();
|
345
|
+
|
346
|
+
case 6:
|
347
|
+
_context.t0 = _context.sent;
|
348
|
+
|
349
|
+
case 7:
|
350
|
+
answer = _context.t0;
|
351
|
+
_context.next = 10;
|
352
|
+
return aggregator.provider.getBlock('latest');
|
353
|
+
|
354
|
+
case 10:
|
355
|
+
block = _context.sent;
|
356
|
+
_context.next = 13;
|
357
|
+
return aggregator.setLatestAnswer(answer, block.timestamp);
|
358
|
+
|
359
|
+
case 13:
|
360
|
+
case "end":
|
361
|
+
return _context.stop();
|
362
|
+
}
|
363
|
+
}
|
364
|
+
}, _callee);
|
365
|
+
}));
|
366
|
+
return _updateChainlinkAggregator.apply(this, arguments);
|
367
|
+
}
|
368
|
+
|
369
|
+
function getAssetBalances(_x) {
|
370
|
+
return _getAssetBalances.apply(this, arguments);
|
371
|
+
}
|
372
|
+
|
373
|
+
function _getAssetBalances() {
|
374
|
+
_getAssetBalances = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
375
|
+
var account, assets;
|
376
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
377
|
+
while (1) {
|
378
|
+
switch (_context.prev = _context.next) {
|
379
|
+
case 0:
|
380
|
+
account = _ref.account, assets = _ref.assets;
|
381
|
+
return _context.abrupt("return", Promise.all(assets.map(function (asset) {
|
382
|
+
return asset.balanceOf(account);
|
383
|
+
})));
|
384
|
+
|
385
|
+
case 2:
|
386
|
+
case "end":
|
387
|
+
return _context.stop();
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}, _callee);
|
391
|
+
}));
|
392
|
+
return _getAssetBalances.apply(this, arguments);
|
393
|
+
}
|
394
|
+
|
395
|
+
function createFundDeployer(_x) {
|
396
|
+
return _createFundDeployer.apply(this, arguments);
|
397
|
+
}
|
398
|
+
|
399
|
+
function _createFundDeployer() {
|
400
|
+
_createFundDeployer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
401
|
+
var deployer, chainlinkPriceFeed, dispatcher, feeManager, integrationManager, policyManager, synthetixAddressResolverAddress, synthetixPriceFeed, valueInterpreter, vaultLib, _ref$vaultCallContrac, vaultCallContracts, _ref$vaultCallSelecto, vaultCallSelectors, _ref$setOnDispatcher, setOnDispatcher, _ref$setReleaseStatus, setReleaseStatusLive, nextFundDeployer, nextComptrollerLib;
|
402
|
+
|
403
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
404
|
+
while (1) {
|
405
|
+
switch (_context.prev = _context.next) {
|
406
|
+
case 0:
|
407
|
+
deployer = _ref.deployer, chainlinkPriceFeed = _ref.chainlinkPriceFeed, dispatcher = _ref.dispatcher, feeManager = _ref.feeManager, integrationManager = _ref.integrationManager, policyManager = _ref.policyManager, synthetixAddressResolverAddress = _ref.synthetixAddressResolverAddress, synthetixPriceFeed = _ref.synthetixPriceFeed, valueInterpreter = _ref.valueInterpreter, vaultLib = _ref.vaultLib, _ref$vaultCallContrac = _ref.vaultCallContracts, vaultCallContracts = _ref$vaultCallContrac === void 0 ? [] : _ref$vaultCallContrac, _ref$vaultCallSelecto = _ref.vaultCallSelectors, vaultCallSelectors = _ref$vaultCallSelecto === void 0 ? [] : _ref$vaultCallSelecto, _ref$setOnDispatcher = _ref.setOnDispatcher, setOnDispatcher = _ref$setOnDispatcher === void 0 ? true : _ref$setOnDispatcher, _ref$setReleaseStatus = _ref.setReleaseStatusLive, setReleaseStatusLive = _ref$setReleaseStatus === void 0 ? true : _ref$setReleaseStatus;
|
408
|
+
_context.next = 3;
|
409
|
+
return protocol.FundDeployer.deploy(deployer, dispatcher, vaultLib, vaultCallContracts, vaultCallSelectors);
|
410
|
+
|
411
|
+
case 3:
|
412
|
+
nextFundDeployer = _context.sent;
|
413
|
+
_context.next = 6;
|
414
|
+
return protocol.ComptrollerLib.deploy(deployer, dispatcher, nextFundDeployer, valueInterpreter, feeManager, integrationManager, policyManager, chainlinkPriceFeed, synthetixPriceFeed, synthetixAddressResolverAddress);
|
415
|
+
|
416
|
+
case 6:
|
417
|
+
nextComptrollerLib = _context.sent;
|
418
|
+
_context.next = 9;
|
419
|
+
return nextFundDeployer.setComptrollerLib(nextComptrollerLib);
|
420
|
+
|
421
|
+
case 9:
|
422
|
+
if (!setReleaseStatusLive) {
|
423
|
+
_context.next = 12;
|
424
|
+
break;
|
425
|
+
}
|
426
|
+
|
427
|
+
_context.next = 12;
|
428
|
+
return nextFundDeployer.setReleaseStatus(protocol.ReleaseStatusTypes.Live);
|
429
|
+
|
430
|
+
case 12:
|
431
|
+
if (!setOnDispatcher) {
|
432
|
+
_context.next = 15;
|
433
|
+
break;
|
434
|
+
}
|
435
|
+
|
436
|
+
_context.next = 15;
|
437
|
+
return dispatcher.setCurrentFundDeployer(nextFundDeployer);
|
438
|
+
|
439
|
+
case 15:
|
440
|
+
return _context.abrupt("return", nextFundDeployer);
|
441
|
+
|
442
|
+
case 16:
|
443
|
+
case "end":
|
444
|
+
return _context.stop();
|
445
|
+
}
|
446
|
+
}
|
447
|
+
}, _callee);
|
448
|
+
}));
|
449
|
+
return _createFundDeployer.apply(this, arguments);
|
450
|
+
}
|
451
|
+
|
452
|
+
function callOnExtension(_x) {
|
453
|
+
return _callOnExtension.apply(this, arguments);
|
454
|
+
}
|
455
|
+
|
456
|
+
function _callOnExtension() {
|
457
|
+
_callOnExtension = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
458
|
+
var comptrollerProxy, extension, actionId, _ref$callArgs, callArgs, signer, callOnExtensionTx;
|
459
|
+
|
460
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
461
|
+
while (1) {
|
462
|
+
switch (_context.prev = _context.next) {
|
463
|
+
case 0:
|
464
|
+
comptrollerProxy = _ref.comptrollerProxy, extension = _ref.extension, actionId = _ref.actionId, _ref$callArgs = _ref.callArgs, callArgs = _ref$callArgs === void 0 ? '0x' : _ref$callArgs, signer = _ref.signer;
|
465
|
+
|
466
|
+
if (signer) {
|
467
|
+
callOnExtensionTx = comptrollerProxy.connect(signer).callOnExtension(extension, actionId, callArgs);
|
468
|
+
} else {
|
469
|
+
callOnExtensionTx = comptrollerProxy.callOnExtension(extension, actionId, callArgs);
|
470
|
+
}
|
471
|
+
|
472
|
+
_context.next = 4;
|
473
|
+
return expect(callOnExtensionTx).resolves.toBeReceipt();
|
474
|
+
|
475
|
+
case 4:
|
476
|
+
return _context.abrupt("return", callOnExtensionTx);
|
477
|
+
|
478
|
+
case 5:
|
479
|
+
case "end":
|
480
|
+
return _context.stop();
|
481
|
+
}
|
482
|
+
}
|
483
|
+
}, _callee);
|
484
|
+
}));
|
485
|
+
return _callOnExtension.apply(this, arguments);
|
486
|
+
}
|
487
|
+
|
488
|
+
function generateFeeManagerConfigWithMockFees(_x) {
|
489
|
+
return _generateFeeManagerConfigWithMockFees.apply(this, arguments);
|
490
|
+
}
|
491
|
+
|
492
|
+
function _generateFeeManagerConfigWithMockFees() {
|
493
|
+
_generateFeeManagerConfigWithMockFees = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
494
|
+
var deployer, feeManager, fees, feeManagerSettingsData;
|
495
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
496
|
+
while (1) {
|
497
|
+
switch (_context.prev = _context.next) {
|
498
|
+
case 0:
|
499
|
+
deployer = _ref.deployer, feeManager = _ref.feeManager;
|
500
|
+
_context.next = 3;
|
501
|
+
return generateRegisteredMockFees({
|
502
|
+
deployer: deployer,
|
503
|
+
feeManager: feeManager
|
504
|
+
});
|
505
|
+
|
506
|
+
case 3:
|
507
|
+
fees = _context.sent;
|
508
|
+
feeManagerSettingsData = [ethers.utils.randomBytes(10), '0x', ethers.utils.randomBytes(2)];
|
509
|
+
return _context.abrupt("return", protocol.feeManagerConfigArgs({
|
510
|
+
fees: Object.values(fees),
|
511
|
+
settings: feeManagerSettingsData
|
512
|
+
}));
|
513
|
+
|
514
|
+
case 6:
|
515
|
+
case "end":
|
516
|
+
return _context.stop();
|
517
|
+
}
|
518
|
+
}
|
519
|
+
}, _callee);
|
520
|
+
}));
|
521
|
+
return _generateFeeManagerConfigWithMockFees.apply(this, arguments);
|
522
|
+
}
|
523
|
+
|
524
|
+
function generateRegisteredMockFees(_x2) {
|
525
|
+
return _generateRegisteredMockFees.apply(this, arguments);
|
526
|
+
}
|
527
|
+
|
528
|
+
function _generateRegisteredMockFees() {
|
529
|
+
_generateRegisteredMockFees = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
530
|
+
var deployer, feeManager, mockContinuousFeeSettleOnly, mockContinuousFeeWithGavAndUpdates, mockPostBuySharesFee;
|
531
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
532
|
+
while (1) {
|
533
|
+
switch (_context2.prev = _context2.next) {
|
534
|
+
case 0:
|
535
|
+
deployer = _ref2.deployer, feeManager = _ref2.feeManager;
|
536
|
+
_context2.next = 3;
|
537
|
+
return protocol.IFee.mock(deployer);
|
538
|
+
|
539
|
+
case 3:
|
540
|
+
mockContinuousFeeSettleOnly = _context2.sent;
|
541
|
+
_context2.next = 6;
|
542
|
+
return protocol.IFee.mock(deployer);
|
543
|
+
|
544
|
+
case 6:
|
545
|
+
mockContinuousFeeWithGavAndUpdates = _context2.sent;
|
546
|
+
_context2.next = 9;
|
547
|
+
return protocol.IFee.mock(deployer);
|
548
|
+
|
549
|
+
case 9:
|
550
|
+
mockPostBuySharesFee = _context2.sent;
|
551
|
+
_context2.next = 12;
|
552
|
+
return Promise.all([// Continuous fee the mimics ManagementFee
|
553
|
+
mockContinuousFeeSettleOnly.identifier.returns("MOCK_CONTINUOUS_1"), mockContinuousFeeSettleOnly.settle.returns(protocol.FeeSettlementType.None, ethers.constants.AddressZero, 0), mockContinuousFeeSettleOnly.payout.returns(false), mockContinuousFeeSettleOnly.addFundSettings.returns(undefined), mockContinuousFeeSettleOnly.activateForFund.returns(undefined), mockContinuousFeeSettleOnly.update.returns(undefined), mockContinuousFeeSettleOnly.implementedHooks.returns([protocol.FeeHook.Continuous, protocol.FeeHook.PreBuyShares, protocol.FeeHook.PreRedeemShares], [], false, false), // Continuous fee the mimics PerformanceFee
|
554
|
+
mockContinuousFeeWithGavAndUpdates.identifier.returns("MOCK_CONTINUOUS_2"), mockContinuousFeeWithGavAndUpdates.settle.returns(protocol.FeeSettlementType.None, ethers.constants.AddressZero, 0), mockContinuousFeeWithGavAndUpdates.payout.returns(false), mockContinuousFeeWithGavAndUpdates.addFundSettings.returns(undefined), mockContinuousFeeWithGavAndUpdates.activateForFund.returns(undefined), mockContinuousFeeWithGavAndUpdates.update.returns(undefined), mockContinuousFeeWithGavAndUpdates.implementedHooks.returns([protocol.FeeHook.Continuous, protocol.FeeHook.PreBuyShares, protocol.FeeHook.PreRedeemShares], [protocol.FeeHook.Continuous, protocol.FeeHook.PostBuyShares, protocol.FeeHook.PreRedeemShares], true, true), // PostBuyShares fee
|
555
|
+
mockPostBuySharesFee.identifier.returns("MOCK_POST_BUY_SHARES"), mockPostBuySharesFee.settle.returns(protocol.FeeSettlementType.None, ethers.constants.AddressZero, 0), mockPostBuySharesFee.payout.returns(false), mockPostBuySharesFee.addFundSettings.returns(undefined), mockPostBuySharesFee.activateForFund.returns(undefined), mockPostBuySharesFee.update.returns(undefined), mockPostBuySharesFee.implementedHooks.returns([protocol.FeeHook.PostBuyShares], [], false, false)]);
|
556
|
+
|
557
|
+
case 12:
|
558
|
+
_context2.next = 14;
|
559
|
+
return feeManager.registerFees([mockContinuousFeeSettleOnly, mockContinuousFeeWithGavAndUpdates, mockPostBuySharesFee]);
|
560
|
+
|
561
|
+
case 14:
|
562
|
+
return _context2.abrupt("return", {
|
563
|
+
mockContinuousFeeSettleOnly: mockContinuousFeeSettleOnly,
|
564
|
+
mockContinuousFeeWithGavAndUpdates: mockContinuousFeeWithGavAndUpdates,
|
565
|
+
mockPostBuySharesFee: mockPostBuySharesFee
|
566
|
+
});
|
567
|
+
|
568
|
+
case 15:
|
569
|
+
case "end":
|
570
|
+
return _context2.stop();
|
571
|
+
}
|
572
|
+
}
|
573
|
+
}, _callee2);
|
574
|
+
}));
|
575
|
+
return _generateRegisteredMockFees.apply(this, arguments);
|
576
|
+
}
|
577
|
+
|
578
|
+
function aaveLend(_x) {
|
579
|
+
return _aaveLend.apply(this, arguments);
|
580
|
+
}
|
581
|
+
|
582
|
+
function _aaveLend() {
|
583
|
+
_aaveLend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
584
|
+
var comptrollerProxy, integrationManager, fundOwner, aaveAdapter, aToken, _ref$amount, amount, lendArgs, callArgs, lendTx;
|
585
|
+
|
586
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
587
|
+
while (1) {
|
588
|
+
switch (_context.prev = _context.next) {
|
589
|
+
case 0:
|
590
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, aaveAdapter = _ref.aaveAdapter, aToken = _ref.aToken, _ref$amount = _ref.amount, amount = _ref$amount === void 0 ? ethers.utils.parseEther('1') : _ref$amount;
|
591
|
+
lendArgs = protocol.aaveLendArgs({
|
592
|
+
aToken: aToken,
|
593
|
+
amount: amount
|
594
|
+
});
|
595
|
+
callArgs = protocol.callOnIntegrationArgs({
|
596
|
+
adapter: aaveAdapter,
|
597
|
+
selector: protocol.lendSelector,
|
598
|
+
encodedCallArgs: lendArgs
|
599
|
+
});
|
600
|
+
lendTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
601
|
+
return _context.abrupt("return", lendTx);
|
602
|
+
|
603
|
+
case 5:
|
604
|
+
case "end":
|
605
|
+
return _context.stop();
|
606
|
+
}
|
607
|
+
}
|
608
|
+
}, _callee);
|
609
|
+
}));
|
610
|
+
return _aaveLend.apply(this, arguments);
|
611
|
+
}
|
612
|
+
|
613
|
+
function aaveRedeem(_x2) {
|
614
|
+
return _aaveRedeem.apply(this, arguments);
|
615
|
+
}
|
616
|
+
|
617
|
+
function _aaveRedeem() {
|
618
|
+
_aaveRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
619
|
+
var comptrollerProxy, integrationManager, fundOwner, aaveAdapter, aToken, _ref2$amount, amount, redeemArgs, callArgs, redeemTx;
|
620
|
+
|
621
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
622
|
+
while (1) {
|
623
|
+
switch (_context2.prev = _context2.next) {
|
624
|
+
case 0:
|
625
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, aaveAdapter = _ref2.aaveAdapter, aToken = _ref2.aToken, _ref2$amount = _ref2.amount, amount = _ref2$amount === void 0 ? ethers.utils.parseEther('1') : _ref2$amount;
|
626
|
+
redeemArgs = protocol.aaveRedeemArgs({
|
627
|
+
aToken: aToken,
|
628
|
+
amount: amount
|
629
|
+
});
|
630
|
+
callArgs = protocol.callOnIntegrationArgs({
|
631
|
+
adapter: aaveAdapter,
|
632
|
+
selector: protocol.redeemSelector,
|
633
|
+
encodedCallArgs: redeemArgs
|
634
|
+
});
|
635
|
+
redeemTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
636
|
+
return _context2.abrupt("return", redeemTx);
|
637
|
+
|
638
|
+
case 5:
|
639
|
+
case "end":
|
640
|
+
return _context2.stop();
|
641
|
+
}
|
642
|
+
}
|
643
|
+
}, _callee2);
|
644
|
+
}));
|
645
|
+
return _aaveRedeem.apply(this, arguments);
|
646
|
+
}
|
647
|
+
|
648
|
+
var _templateObject$4, _templateObject2$1;
|
649
|
+
var AlphaHomoraV1BankConfig = ethers$1.contract()(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n function getReservePoolBps() view returns (uint256)\n"])));
|
650
|
+
var AlphaHomoraV1Bank = ethers$1.contract()(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n function config() view returns (address)\n function glbDebtVal() view returns (uint256)\n function pendingInterest(uint256) view returns (uint256)\n function reservePool() view returns (uint256)\n function totalEth() view returns (uint256)\n"])));
|
651
|
+
function alphaHomoraV1Lend(_x) {
|
652
|
+
return _alphaHomoraV1Lend.apply(this, arguments);
|
653
|
+
}
|
654
|
+
|
655
|
+
function _alphaHomoraV1Lend() {
|
656
|
+
_alphaHomoraV1Lend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
657
|
+
var comptrollerProxy, integrationManager, fundOwner, alphaHomoraV1Adapter, _ref$wethAmount, wethAmount, _ref$minibethAmount, minibethAmount, lendArgs, callArgs;
|
658
|
+
|
659
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
660
|
+
while (1) {
|
661
|
+
switch (_context.prev = _context.next) {
|
662
|
+
case 0:
|
663
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, alphaHomoraV1Adapter = _ref.alphaHomoraV1Adapter, _ref$wethAmount = _ref.wethAmount, wethAmount = _ref$wethAmount === void 0 ? ethers.utils.parseEther('1') : _ref$wethAmount, _ref$minibethAmount = _ref.minibethAmount, minibethAmount = _ref$minibethAmount === void 0 ? 1 : _ref$minibethAmount;
|
664
|
+
lendArgs = protocol.alphaHomoraV1LendArgs({
|
665
|
+
outgoingWethAmount: wethAmount,
|
666
|
+
minIncomingIbethAmount: minibethAmount
|
667
|
+
});
|
668
|
+
callArgs = protocol.callOnIntegrationArgs({
|
669
|
+
adapter: alphaHomoraV1Adapter,
|
670
|
+
selector: protocol.lendSelector,
|
671
|
+
encodedCallArgs: lendArgs
|
672
|
+
});
|
673
|
+
return _context.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
674
|
+
|
675
|
+
case 4:
|
676
|
+
case "end":
|
677
|
+
return _context.stop();
|
678
|
+
}
|
679
|
+
}
|
680
|
+
}, _callee);
|
681
|
+
}));
|
682
|
+
return _alphaHomoraV1Lend.apply(this, arguments);
|
683
|
+
}
|
684
|
+
|
685
|
+
function alphaHomoraV1Redeem(_x2) {
|
686
|
+
return _alphaHomoraV1Redeem.apply(this, arguments);
|
687
|
+
}
|
688
|
+
|
689
|
+
function _alphaHomoraV1Redeem() {
|
690
|
+
_alphaHomoraV1Redeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
691
|
+
var comptrollerProxy, integrationManager, fundOwner, alphaHomoraV1Adapter, _ref2$ibethAmount, ibethAmount, _ref2$minWethAmount, minWethAmount, redeemArgs, callArgs;
|
692
|
+
|
693
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
694
|
+
while (1) {
|
695
|
+
switch (_context2.prev = _context2.next) {
|
696
|
+
case 0:
|
697
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, alphaHomoraV1Adapter = _ref2.alphaHomoraV1Adapter, _ref2$ibethAmount = _ref2.ibethAmount, ibethAmount = _ref2$ibethAmount === void 0 ? ethers.utils.parseEther('1') : _ref2$ibethAmount, _ref2$minWethAmount = _ref2.minWethAmount, minWethAmount = _ref2$minWethAmount === void 0 ? 1 : _ref2$minWethAmount;
|
698
|
+
redeemArgs = protocol.alphaHomoraV1RedeemArgs({
|
699
|
+
outgoingIbethAmount: ibethAmount,
|
700
|
+
minIncomingWethAmount: minWethAmount
|
701
|
+
});
|
702
|
+
callArgs = protocol.callOnIntegrationArgs({
|
703
|
+
adapter: alphaHomoraV1Adapter,
|
704
|
+
selector: protocol.redeemSelector,
|
705
|
+
encodedCallArgs: redeemArgs
|
706
|
+
});
|
707
|
+
return _context2.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
708
|
+
|
709
|
+
case 4:
|
710
|
+
case "end":
|
711
|
+
return _context2.stop();
|
712
|
+
}
|
713
|
+
}
|
714
|
+
}, _callee2);
|
715
|
+
}));
|
716
|
+
return _alphaHomoraV1Redeem.apply(this, arguments);
|
717
|
+
}
|
718
|
+
|
719
|
+
function calcAlphaBankLiveTotalEth(_x3) {
|
720
|
+
return _calcAlphaBankLiveTotalEth.apply(this, arguments);
|
721
|
+
}
|
722
|
+
|
723
|
+
function _calcAlphaBankLiveTotalEth() {
|
724
|
+
_calcAlphaBankLiveTotalEth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
725
|
+
var provider, alphaHomoraBank, pendingInterest, glbDebtVal, bankConfig, toReserveAmount, reservePool, bankEthBalance;
|
726
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
727
|
+
while (1) {
|
728
|
+
switch (_context3.prev = _context3.next) {
|
729
|
+
case 0:
|
730
|
+
provider = _ref3.provider, alphaHomoraBank = _ref3.alphaHomoraBank;
|
731
|
+
_context3.next = 3;
|
732
|
+
return alphaHomoraBank.pendingInterest(0);
|
733
|
+
|
734
|
+
case 3:
|
735
|
+
pendingInterest = _context3.sent;
|
736
|
+
_context3.next = 6;
|
737
|
+
return alphaHomoraBank.glbDebtVal();
|
738
|
+
|
739
|
+
case 6:
|
740
|
+
glbDebtVal = _context3.sent.add(pendingInterest);
|
741
|
+
_context3.t0 = AlphaHomoraV1BankConfig;
|
742
|
+
_context3.next = 10;
|
743
|
+
return alphaHomoraBank.config();
|
744
|
+
|
745
|
+
case 10:
|
746
|
+
_context3.t1 = _context3.sent;
|
747
|
+
_context3.t2 = provider;
|
748
|
+
bankConfig = new _context3.t0(_context3.t1, _context3.t2);
|
749
|
+
_context3.t3 = pendingInterest;
|
750
|
+
_context3.next = 16;
|
751
|
+
return bankConfig.getReservePoolBps();
|
752
|
+
|
753
|
+
case 16:
|
754
|
+
_context3.t4 = _context3.sent;
|
755
|
+
toReserveAmount = _context3.t3.mul.call(_context3.t3, _context3.t4).div(10000);
|
756
|
+
_context3.next = 20;
|
757
|
+
return alphaHomoraBank.reservePool();
|
758
|
+
|
759
|
+
case 20:
|
760
|
+
reservePool = _context3.sent.add(toReserveAmount);
|
761
|
+
_context3.next = 23;
|
762
|
+
return provider.getBalance(alphaHomoraBank.address);
|
763
|
+
|
764
|
+
case 23:
|
765
|
+
bankEthBalance = _context3.sent;
|
766
|
+
return _context3.abrupt("return", bankEthBalance.add(glbDebtVal).sub(reservePool));
|
767
|
+
|
768
|
+
case 25:
|
769
|
+
case "end":
|
770
|
+
return _context3.stop();
|
771
|
+
}
|
772
|
+
}
|
773
|
+
}, _callee3);
|
774
|
+
}));
|
775
|
+
return _calcAlphaBankLiveTotalEth.apply(this, arguments);
|
776
|
+
}
|
777
|
+
|
778
|
+
var _templateObject$3;
|
779
|
+
|
780
|
+
var ICompoundComptroller = ethers$1.contract()(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n function claimComp(address)\n "])));
|
781
|
+
function compoundLend(_x) {
|
782
|
+
return _compoundLend.apply(this, arguments);
|
783
|
+
}
|
784
|
+
|
785
|
+
function _compoundLend() {
|
786
|
+
_compoundLend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
787
|
+
var comptrollerProxy, integrationManager, fundOwner, compoundAdapter, cToken, _ref$tokenAmount, tokenAmount, _ref$cTokenAmount, cTokenAmount, lendArgs, callArgs, lendTx;
|
788
|
+
|
789
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
790
|
+
while (1) {
|
791
|
+
switch (_context.prev = _context.next) {
|
792
|
+
case 0:
|
793
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, compoundAdapter = _ref.compoundAdapter, cToken = _ref.cToken, _ref$tokenAmount = _ref.tokenAmount, tokenAmount = _ref$tokenAmount === void 0 ? ethers.utils.parseEther('1') : _ref$tokenAmount, _ref$cTokenAmount = _ref.cTokenAmount, cTokenAmount = _ref$cTokenAmount === void 0 ? ethers.utils.parseEther('1') : _ref$cTokenAmount;
|
794
|
+
_context.next = 3;
|
795
|
+
return protocol.compoundArgs({
|
796
|
+
cToken: ethers$1.resolveAddress(cToken),
|
797
|
+
outgoingAssetAmount: tokenAmount,
|
798
|
+
minIncomingAssetAmount: cTokenAmount
|
799
|
+
});
|
800
|
+
|
801
|
+
case 3:
|
802
|
+
lendArgs = _context.sent;
|
803
|
+
callArgs = protocol.callOnIntegrationArgs({
|
804
|
+
adapter: compoundAdapter,
|
805
|
+
selector: protocol.lendSelector,
|
806
|
+
encodedCallArgs: lendArgs
|
807
|
+
});
|
808
|
+
lendTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
809
|
+
return _context.abrupt("return", lendTx);
|
810
|
+
|
811
|
+
case 7:
|
812
|
+
case "end":
|
813
|
+
return _context.stop();
|
814
|
+
}
|
815
|
+
}
|
816
|
+
}, _callee);
|
817
|
+
}));
|
818
|
+
return _compoundLend.apply(this, arguments);
|
819
|
+
}
|
820
|
+
|
821
|
+
function compoundRedeem(_x2) {
|
822
|
+
return _compoundRedeem.apply(this, arguments);
|
823
|
+
}
|
824
|
+
|
825
|
+
function _compoundRedeem() {
|
826
|
+
_compoundRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
827
|
+
var comptrollerProxy, integrationManager, fundOwner, compoundAdapter, cToken, _ref2$tokenAmount, tokenAmount, _ref2$cTokenAmount, cTokenAmount, redeemArgs, callArgs, redeemTx;
|
828
|
+
|
829
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
830
|
+
while (1) {
|
831
|
+
switch (_context2.prev = _context2.next) {
|
832
|
+
case 0:
|
833
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, compoundAdapter = _ref2.compoundAdapter, cToken = _ref2.cToken, _ref2$tokenAmount = _ref2.tokenAmount, tokenAmount = _ref2$tokenAmount === void 0 ? ethers.utils.parseEther('1') : _ref2$tokenAmount, _ref2$cTokenAmount = _ref2.cTokenAmount, cTokenAmount = _ref2$cTokenAmount === void 0 ? ethers.utils.parseEther('1') : _ref2$cTokenAmount;
|
834
|
+
_context2.next = 3;
|
835
|
+
return protocol.compoundArgs({
|
836
|
+
cToken: ethers$1.resolveAddress(cToken),
|
837
|
+
outgoingAssetAmount: cTokenAmount,
|
838
|
+
minIncomingAssetAmount: tokenAmount
|
839
|
+
});
|
840
|
+
|
841
|
+
case 3:
|
842
|
+
redeemArgs = _context2.sent;
|
843
|
+
_context2.next = 6;
|
844
|
+
return protocol.callOnIntegrationArgs({
|
845
|
+
adapter: compoundAdapter,
|
846
|
+
selector: protocol.redeemSelector,
|
847
|
+
encodedCallArgs: redeemArgs
|
848
|
+
});
|
849
|
+
|
850
|
+
case 6:
|
851
|
+
callArgs = _context2.sent;
|
852
|
+
redeemTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
853
|
+
return _context2.abrupt("return", redeemTx);
|
854
|
+
|
855
|
+
case 9:
|
856
|
+
case "end":
|
857
|
+
return _context2.stop();
|
858
|
+
}
|
859
|
+
}
|
860
|
+
}, _callee2);
|
861
|
+
}));
|
862
|
+
return _compoundRedeem.apply(this, arguments);
|
863
|
+
}
|
864
|
+
|
865
|
+
var _templateObject$2, _templateObject2, _templateObject3;
|
866
|
+
var CurveLiquidityGaugeV2 = ethers$1.contract()(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n function claim_rewards(address)\n function integrate_fraction(address) view returns (uint256)\n"]))); // prettier-ignore
|
867
|
+
|
868
|
+
var CurveSwaps = ethers$1.contract()(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n function get_best_rate(address _from, address to, uint256 amount) view returns (address bestPool, uint256 amountReceived)\n"])));
|
869
|
+
var CurveMinter = ethers$1.contract()(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n function mint_for(address,address)\n"])));
|
870
|
+
function curveApproveAssets(_x) {
|
871
|
+
return _curveApproveAssets.apply(this, arguments);
|
872
|
+
} // exchanges
|
873
|
+
|
874
|
+
function _curveApproveAssets() {
|
875
|
+
_curveApproveAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
876
|
+
var comptrollerProxy, integrationManager, fundOwner, adapter, assets, _ref$amounts, amounts, callArgs;
|
877
|
+
|
878
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
879
|
+
while (1) {
|
880
|
+
switch (_context.prev = _context.next) {
|
881
|
+
case 0:
|
882
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, adapter = _ref.adapter, assets = _ref.assets, _ref$amounts = _ref.amounts, amounts = _ref$amounts === void 0 ? new Array(assets.length).fill(ethers.constants.MaxUint256) : _ref$amounts;
|
883
|
+
callArgs = protocol.callOnIntegrationArgs({
|
884
|
+
adapter: adapter,
|
885
|
+
selector: protocol.approveAssetsSelector,
|
886
|
+
encodedCallArgs: protocol.curveApproveAssetsArgs({
|
887
|
+
assets: assets,
|
888
|
+
amounts: amounts
|
889
|
+
})
|
890
|
+
});
|
891
|
+
return _context.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
892
|
+
|
893
|
+
case 3:
|
894
|
+
case "end":
|
895
|
+
return _context.stop();
|
896
|
+
}
|
897
|
+
}
|
898
|
+
}, _callee);
|
899
|
+
}));
|
900
|
+
return _curveApproveAssets.apply(this, arguments);
|
901
|
+
}
|
902
|
+
|
903
|
+
function curveTakeOrder(_x2) {
|
904
|
+
return _curveTakeOrder.apply(this, arguments);
|
905
|
+
} // aave pool
|
906
|
+
|
907
|
+
function _curveTakeOrder() {
|
908
|
+
_curveTakeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
909
|
+
var comptrollerProxy, integrationManager, fundOwner, curveExchangeAdapter, pool, outgoingAsset, _ref2$outgoingAssetAm, outgoingAssetAmount, incomingAsset, _ref2$minIncomingAsse, minIncomingAssetAmount, takeOrderArgs, callArgs;
|
910
|
+
|
911
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
912
|
+
while (1) {
|
913
|
+
switch (_context2.prev = _context2.next) {
|
914
|
+
case 0:
|
915
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, curveExchangeAdapter = _ref2.curveExchangeAdapter, pool = _ref2.pool, outgoingAsset = _ref2.outgoingAsset, _ref2$outgoingAssetAm = _ref2.outgoingAssetAmount, outgoingAssetAmount = _ref2$outgoingAssetAm === void 0 ? ethers.utils.parseEther('1') : _ref2$outgoingAssetAm, incomingAsset = _ref2.incomingAsset, _ref2$minIncomingAsse = _ref2.minIncomingAssetAmount, minIncomingAssetAmount = _ref2$minIncomingAsse === void 0 ? ethers.utils.parseEther('1') : _ref2$minIncomingAsse;
|
916
|
+
takeOrderArgs = protocol.curveTakeOrderArgs({
|
917
|
+
pool: pool,
|
918
|
+
outgoingAsset: outgoingAsset,
|
919
|
+
outgoingAssetAmount: outgoingAssetAmount,
|
920
|
+
incomingAsset: incomingAsset,
|
921
|
+
minIncomingAssetAmount: minIncomingAssetAmount
|
922
|
+
});
|
923
|
+
callArgs = protocol.callOnIntegrationArgs({
|
924
|
+
adapter: curveExchangeAdapter,
|
925
|
+
selector: protocol.takeOrderSelector,
|
926
|
+
encodedCallArgs: takeOrderArgs
|
927
|
+
});
|
928
|
+
return _context2.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
929
|
+
|
930
|
+
case 4:
|
931
|
+
case "end":
|
932
|
+
return _context2.stop();
|
933
|
+
}
|
934
|
+
}
|
935
|
+
}, _callee2);
|
936
|
+
}));
|
937
|
+
return _curveTakeOrder.apply(this, arguments);
|
938
|
+
}
|
939
|
+
|
940
|
+
function curveAaveClaimRewards(_ref3) {
|
941
|
+
var comptrollerProxy = _ref3.comptrollerProxy,
|
942
|
+
integrationManager = _ref3.integrationManager,
|
943
|
+
fundOwner = _ref3.fundOwner,
|
944
|
+
curveLiquidityAaveAdapter = _ref3.curveLiquidityAaveAdapter;
|
945
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
946
|
+
adapter: curveLiquidityAaveAdapter,
|
947
|
+
selector: protocol.claimRewardsSelector,
|
948
|
+
encodedCallArgs: ethers.constants.HashZero
|
949
|
+
});
|
950
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
951
|
+
}
|
952
|
+
function curveAaveClaimRewardsAndReinvest(_ref4) {
|
953
|
+
var comptrollerProxy = _ref4.comptrollerProxy,
|
954
|
+
integrationManager = _ref4.integrationManager,
|
955
|
+
fundOwner = _ref4.fundOwner,
|
956
|
+
curveLiquidityAaveAdapter = _ref4.curveLiquidityAaveAdapter,
|
957
|
+
useFullBalances = _ref4.useFullBalances,
|
958
|
+
_ref4$minIncomingLiqu = _ref4.minIncomingLiquidityGaugeTokenAmount,
|
959
|
+
minIncomingLiquidityGaugeTokenAmount = _ref4$minIncomingLiqu === void 0 ? ethers.BigNumber.from(1) : _ref4$minIncomingLiqu,
|
960
|
+
_ref4$intermediaryUnd = _ref4.intermediaryUnderlyingAssetIndex,
|
961
|
+
intermediaryUnderlyingAssetIndex = _ref4$intermediaryUnd === void 0 ? protocol.CurveAavePoolAssetIndex.AaveDai : _ref4$intermediaryUnd;
|
962
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
963
|
+
adapter: curveLiquidityAaveAdapter,
|
964
|
+
selector: protocol.claimRewardsAndReinvestSelector,
|
965
|
+
encodedCallArgs: protocol.curveAaveClaimRewardsAndReinvestArgs({
|
966
|
+
useFullBalances: useFullBalances,
|
967
|
+
minIncomingLiquidityGaugeTokenAmount: minIncomingLiquidityGaugeTokenAmount,
|
968
|
+
intermediaryUnderlyingAssetIndex: intermediaryUnderlyingAssetIndex
|
969
|
+
})
|
970
|
+
});
|
971
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
972
|
+
}
|
973
|
+
function curveAaveClaimRewardsAndSwap(_ref5) {
|
974
|
+
var comptrollerProxy = _ref5.comptrollerProxy,
|
975
|
+
integrationManager = _ref5.integrationManager,
|
976
|
+
fundOwner = _ref5.fundOwner,
|
977
|
+
curveLiquidityAaveAdapter = _ref5.curveLiquidityAaveAdapter,
|
978
|
+
useFullBalances = _ref5.useFullBalances,
|
979
|
+
incomingAsset = _ref5.incomingAsset,
|
980
|
+
_ref5$minIncomingAsse = _ref5.minIncomingAssetAmount,
|
981
|
+
minIncomingAssetAmount = _ref5$minIncomingAsse === void 0 ? ethers.BigNumber.from(1) : _ref5$minIncomingAsse;
|
982
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
983
|
+
adapter: curveLiquidityAaveAdapter,
|
984
|
+
selector: protocol.claimRewardsAndSwapSelector,
|
985
|
+
encodedCallArgs: protocol.curveAaveClaimRewardsAndSwapArgs({
|
986
|
+
useFullBalances: useFullBalances,
|
987
|
+
incomingAsset: incomingAsset,
|
988
|
+
minIncomingAssetAmount: minIncomingAssetAmount
|
989
|
+
})
|
990
|
+
});
|
991
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
992
|
+
}
|
993
|
+
function curveAaveLend(_ref6) {
|
994
|
+
var comptrollerProxy = _ref6.comptrollerProxy,
|
995
|
+
integrationManager = _ref6.integrationManager,
|
996
|
+
fundOwner = _ref6.fundOwner,
|
997
|
+
curveLiquidityAaveAdapter = _ref6.curveLiquidityAaveAdapter,
|
998
|
+
_ref6$outgoingAaveDai = _ref6.outgoingAaveDaiAmount,
|
999
|
+
outgoingAaveDaiAmount = _ref6$outgoingAaveDai === void 0 ? ethers.BigNumber.from(0) : _ref6$outgoingAaveDai,
|
1000
|
+
_ref6$outgoingAaveUsd = _ref6.outgoingAaveUsdcAmount,
|
1001
|
+
outgoingAaveUsdcAmount = _ref6$outgoingAaveUsd === void 0 ? ethers.BigNumber.from(0) : _ref6$outgoingAaveUsd,
|
1002
|
+
_ref6$outgoingAaveUsd2 = _ref6.outgoingAaveUsdtAmount,
|
1003
|
+
outgoingAaveUsdtAmount = _ref6$outgoingAaveUsd2 === void 0 ? ethers.BigNumber.from(0) : _ref6$outgoingAaveUsd2,
|
1004
|
+
_ref6$minIncomingLPTo = _ref6.minIncomingLPTokenAmount,
|
1005
|
+
minIncomingLPTokenAmount = _ref6$minIncomingLPTo === void 0 ? ethers.BigNumber.from(1) : _ref6$minIncomingLPTo,
|
1006
|
+
_ref6$useUnderlyings = _ref6.useUnderlyings,
|
1007
|
+
useUnderlyings = _ref6$useUnderlyings === void 0 ? false : _ref6$useUnderlyings;
|
1008
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1009
|
+
adapter: curveLiquidityAaveAdapter,
|
1010
|
+
selector: protocol.lendSelector,
|
1011
|
+
encodedCallArgs: protocol.curveAaveLendArgs({
|
1012
|
+
outgoingAaveDaiAmount: outgoingAaveDaiAmount,
|
1013
|
+
outgoingAaveUsdcAmount: outgoingAaveUsdcAmount,
|
1014
|
+
outgoingAaveUsdtAmount: outgoingAaveUsdtAmount,
|
1015
|
+
minIncomingLPTokenAmount: minIncomingLPTokenAmount,
|
1016
|
+
useUnderlyings: useUnderlyings
|
1017
|
+
})
|
1018
|
+
});
|
1019
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1020
|
+
}
|
1021
|
+
function curveAaveLendAndStake(_ref7) {
|
1022
|
+
var comptrollerProxy = _ref7.comptrollerProxy,
|
1023
|
+
integrationManager = _ref7.integrationManager,
|
1024
|
+
fundOwner = _ref7.fundOwner,
|
1025
|
+
curveLiquidityAaveAdapter = _ref7.curveLiquidityAaveAdapter,
|
1026
|
+
_ref7$outgoingAaveDai = _ref7.outgoingAaveDaiAmount,
|
1027
|
+
outgoingAaveDaiAmount = _ref7$outgoingAaveDai === void 0 ? ethers.BigNumber.from(0) : _ref7$outgoingAaveDai,
|
1028
|
+
_ref7$outgoingAaveUsd = _ref7.outgoingAaveUsdcAmount,
|
1029
|
+
outgoingAaveUsdcAmount = _ref7$outgoingAaveUsd === void 0 ? ethers.BigNumber.from(0) : _ref7$outgoingAaveUsd,
|
1030
|
+
_ref7$outgoingAaveUsd2 = _ref7.outgoingAaveUsdtAmount,
|
1031
|
+
outgoingAaveUsdtAmount = _ref7$outgoingAaveUsd2 === void 0 ? ethers.BigNumber.from(0) : _ref7$outgoingAaveUsd2,
|
1032
|
+
_ref7$minIncomingLiqu = _ref7.minIncomingLiquidityGaugeTokenAmount,
|
1033
|
+
minIncomingLiquidityGaugeTokenAmount = _ref7$minIncomingLiqu === void 0 ? ethers.BigNumber.from(1) : _ref7$minIncomingLiqu,
|
1034
|
+
_ref7$useUnderlyings = _ref7.useUnderlyings,
|
1035
|
+
useUnderlyings = _ref7$useUnderlyings === void 0 ? false : _ref7$useUnderlyings;
|
1036
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1037
|
+
adapter: curveLiquidityAaveAdapter,
|
1038
|
+
selector: protocol.lendAndStakeSelector,
|
1039
|
+
encodedCallArgs: protocol.curveAaveLendAndStakeArgs({
|
1040
|
+
outgoingAaveDaiAmount: outgoingAaveDaiAmount,
|
1041
|
+
outgoingAaveUsdcAmount: outgoingAaveUsdcAmount,
|
1042
|
+
outgoingAaveUsdtAmount: outgoingAaveUsdtAmount,
|
1043
|
+
minIncomingLiquidityGaugeTokenAmount: minIncomingLiquidityGaugeTokenAmount,
|
1044
|
+
useUnderlyings: useUnderlyings
|
1045
|
+
})
|
1046
|
+
});
|
1047
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1048
|
+
}
|
1049
|
+
function curveAaveRedeem(_ref8) {
|
1050
|
+
var comptrollerProxy = _ref8.comptrollerProxy,
|
1051
|
+
integrationManager = _ref8.integrationManager,
|
1052
|
+
fundOwner = _ref8.fundOwner,
|
1053
|
+
curveLiquidityAaveAdapter = _ref8.curveLiquidityAaveAdapter,
|
1054
|
+
outgoingLPTokenAmount = _ref8.outgoingLPTokenAmount,
|
1055
|
+
_ref8$minIncomingAave = _ref8.minIncomingAaveDaiAmount,
|
1056
|
+
minIncomingAaveDaiAmount = _ref8$minIncomingAave === void 0 ? ethers.BigNumber.from(1) : _ref8$minIncomingAave,
|
1057
|
+
_ref8$minIncomingAave2 = _ref8.minIncomingAaveUsdcAmount,
|
1058
|
+
minIncomingAaveUsdcAmount = _ref8$minIncomingAave2 === void 0 ? ethers.BigNumber.from(1) : _ref8$minIncomingAave2,
|
1059
|
+
_ref8$minIncomingAave3 = _ref8.minIncomingAaveUsdtAmount,
|
1060
|
+
minIncomingAaveUsdtAmount = _ref8$minIncomingAave3 === void 0 ? ethers.BigNumber.from(1) : _ref8$minIncomingAave3,
|
1061
|
+
_ref8$receiveSingleAs = _ref8.receiveSingleAsset,
|
1062
|
+
receiveSingleAsset = _ref8$receiveSingleAs === void 0 ? false : _ref8$receiveSingleAs,
|
1063
|
+
_ref8$useUnderlyings = _ref8.useUnderlyings,
|
1064
|
+
useUnderlyings = _ref8$useUnderlyings === void 0 ? false : _ref8$useUnderlyings;
|
1065
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1066
|
+
adapter: curveLiquidityAaveAdapter,
|
1067
|
+
selector: protocol.redeemSelector,
|
1068
|
+
encodedCallArgs: protocol.curveAaveRedeemArgs({
|
1069
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount,
|
1070
|
+
minIncomingAaveDaiAmount: minIncomingAaveDaiAmount,
|
1071
|
+
minIncomingAaveUsdcAmount: minIncomingAaveUsdcAmount,
|
1072
|
+
minIncomingAaveUsdtAmount: minIncomingAaveUsdtAmount,
|
1073
|
+
receiveSingleAsset: receiveSingleAsset,
|
1074
|
+
useUnderlyings: useUnderlyings
|
1075
|
+
})
|
1076
|
+
});
|
1077
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1078
|
+
}
|
1079
|
+
function curveAaveStake(_ref9) {
|
1080
|
+
var comptrollerProxy = _ref9.comptrollerProxy,
|
1081
|
+
integrationManager = _ref9.integrationManager,
|
1082
|
+
fundOwner = _ref9.fundOwner,
|
1083
|
+
curveLiquidityAaveAdapter = _ref9.curveLiquidityAaveAdapter,
|
1084
|
+
outgoingLPTokenAmount = _ref9.outgoingLPTokenAmount;
|
1085
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1086
|
+
adapter: curveLiquidityAaveAdapter,
|
1087
|
+
selector: protocol.stakeSelector,
|
1088
|
+
encodedCallArgs: protocol.curveAaveStakeArgs({
|
1089
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount
|
1090
|
+
})
|
1091
|
+
});
|
1092
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1093
|
+
}
|
1094
|
+
function curveAaveUnstakeAndRedeem(_ref10) {
|
1095
|
+
var comptrollerProxy = _ref10.comptrollerProxy,
|
1096
|
+
integrationManager = _ref10.integrationManager,
|
1097
|
+
fundOwner = _ref10.fundOwner,
|
1098
|
+
curveLiquidityAaveAdapter = _ref10.curveLiquidityAaveAdapter,
|
1099
|
+
outgoingLiquidityGaugeTokenAmount = _ref10.outgoingLiquidityGaugeTokenAmount,
|
1100
|
+
_ref10$minIncomingAav = _ref10.minIncomingAaveDaiAmount,
|
1101
|
+
minIncomingAaveDaiAmount = _ref10$minIncomingAav === void 0 ? ethers.BigNumber.from(1) : _ref10$minIncomingAav,
|
1102
|
+
_ref10$minIncomingAav2 = _ref10.minIncomingAaveUsdcAmount,
|
1103
|
+
minIncomingAaveUsdcAmount = _ref10$minIncomingAav2 === void 0 ? ethers.BigNumber.from(1) : _ref10$minIncomingAav2,
|
1104
|
+
_ref10$minIncomingAav3 = _ref10.minIncomingAaveUsdtAmount,
|
1105
|
+
minIncomingAaveUsdtAmount = _ref10$minIncomingAav3 === void 0 ? ethers.BigNumber.from(1) : _ref10$minIncomingAav3,
|
1106
|
+
_ref10$receiveSingleA = _ref10.receiveSingleAsset,
|
1107
|
+
receiveSingleAsset = _ref10$receiveSingleA === void 0 ? false : _ref10$receiveSingleA,
|
1108
|
+
_ref10$useUnderlyings = _ref10.useUnderlyings,
|
1109
|
+
useUnderlyings = _ref10$useUnderlyings === void 0 ? false : _ref10$useUnderlyings;
|
1110
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1111
|
+
adapter: curveLiquidityAaveAdapter,
|
1112
|
+
selector: protocol.unstakeAndRedeemSelector,
|
1113
|
+
encodedCallArgs: protocol.curveAaveUnstakeAndRedeemArgs({
|
1114
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount,
|
1115
|
+
minIncomingAaveDaiAmount: minIncomingAaveDaiAmount,
|
1116
|
+
minIncomingAaveUsdcAmount: minIncomingAaveUsdcAmount,
|
1117
|
+
minIncomingAaveUsdtAmount: minIncomingAaveUsdtAmount,
|
1118
|
+
receiveSingleAsset: receiveSingleAsset,
|
1119
|
+
useUnderlyings: useUnderlyings
|
1120
|
+
})
|
1121
|
+
});
|
1122
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1123
|
+
}
|
1124
|
+
function curveAaveUnstake(_ref11) {
|
1125
|
+
var comptrollerProxy = _ref11.comptrollerProxy,
|
1126
|
+
integrationManager = _ref11.integrationManager,
|
1127
|
+
fundOwner = _ref11.fundOwner,
|
1128
|
+
curveLiquidityAaveAdapter = _ref11.curveLiquidityAaveAdapter,
|
1129
|
+
outgoingLiquidityGaugeTokenAmount = _ref11.outgoingLiquidityGaugeTokenAmount;
|
1130
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1131
|
+
adapter: curveLiquidityAaveAdapter,
|
1132
|
+
selector: protocol.unstakeSelector,
|
1133
|
+
encodedCallArgs: protocol.curveAaveUnstakeArgs({
|
1134
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount
|
1135
|
+
})
|
1136
|
+
});
|
1137
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1138
|
+
} // eurs pool
|
1139
|
+
|
1140
|
+
function curveEursClaimRewards(_ref12) {
|
1141
|
+
var comptrollerProxy = _ref12.comptrollerProxy,
|
1142
|
+
integrationManager = _ref12.integrationManager,
|
1143
|
+
fundOwner = _ref12.fundOwner,
|
1144
|
+
curveLiquidityEursAdapter = _ref12.curveLiquidityEursAdapter;
|
1145
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1146
|
+
adapter: curveLiquidityEursAdapter,
|
1147
|
+
selector: protocol.claimRewardsSelector,
|
1148
|
+
encodedCallArgs: ethers.constants.HashZero
|
1149
|
+
});
|
1150
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1151
|
+
}
|
1152
|
+
function curveEursLend(_ref13) {
|
1153
|
+
var comptrollerProxy = _ref13.comptrollerProxy,
|
1154
|
+
integrationManager = _ref13.integrationManager,
|
1155
|
+
fundOwner = _ref13.fundOwner,
|
1156
|
+
curveLiquidityEursAdapter = _ref13.curveLiquidityEursAdapter,
|
1157
|
+
outgoingEursAmount = _ref13.outgoingEursAmount,
|
1158
|
+
outgoingSeurAmount = _ref13.outgoingSeurAmount,
|
1159
|
+
minIncomingLPTokenAmount = _ref13.minIncomingLPTokenAmount;
|
1160
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1161
|
+
adapter: curveLiquidityEursAdapter,
|
1162
|
+
selector: protocol.lendSelector,
|
1163
|
+
encodedCallArgs: protocol.curveEursLendArgs({
|
1164
|
+
outgoingEursAmount: outgoingEursAmount,
|
1165
|
+
outgoingSeurAmount: outgoingSeurAmount,
|
1166
|
+
minIncomingLPTokenAmount: minIncomingLPTokenAmount
|
1167
|
+
})
|
1168
|
+
});
|
1169
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1170
|
+
}
|
1171
|
+
function curveEursLendAndStake(_ref14) {
|
1172
|
+
var comptrollerProxy = _ref14.comptrollerProxy,
|
1173
|
+
integrationManager = _ref14.integrationManager,
|
1174
|
+
fundOwner = _ref14.fundOwner,
|
1175
|
+
curveLiquidityEursAdapter = _ref14.curveLiquidityEursAdapter,
|
1176
|
+
outgoingEursAmount = _ref14.outgoingEursAmount,
|
1177
|
+
outgoingSeurAmount = _ref14.outgoingSeurAmount,
|
1178
|
+
minIncomingLiquidityGaugeTokenAmount = _ref14.minIncomingLiquidityGaugeTokenAmount;
|
1179
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1180
|
+
adapter: curveLiquidityEursAdapter,
|
1181
|
+
selector: protocol.lendAndStakeSelector,
|
1182
|
+
encodedCallArgs: protocol.curveEursLendAndStakeArgs({
|
1183
|
+
outgoingEursAmount: outgoingEursAmount,
|
1184
|
+
outgoingSeurAmount: outgoingSeurAmount,
|
1185
|
+
minIncomingLiquidityGaugeTokenAmount: minIncomingLiquidityGaugeTokenAmount
|
1186
|
+
})
|
1187
|
+
});
|
1188
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1189
|
+
}
|
1190
|
+
function curveEursRedeem(_ref15) {
|
1191
|
+
var comptrollerProxy = _ref15.comptrollerProxy,
|
1192
|
+
integrationManager = _ref15.integrationManager,
|
1193
|
+
fundOwner = _ref15.fundOwner,
|
1194
|
+
curveLiquidityEursAdapter = _ref15.curveLiquidityEursAdapter,
|
1195
|
+
outgoingLPTokenAmount = _ref15.outgoingLPTokenAmount,
|
1196
|
+
minIncomingEursAmount = _ref15.minIncomingEursAmount,
|
1197
|
+
minIncomingSeurAmount = _ref15.minIncomingSeurAmount,
|
1198
|
+
receiveSingleAsset = _ref15.receiveSingleAsset;
|
1199
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1200
|
+
adapter: curveLiquidityEursAdapter,
|
1201
|
+
selector: protocol.redeemSelector,
|
1202
|
+
encodedCallArgs: protocol.curveEursRedeemArgs({
|
1203
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount,
|
1204
|
+
minIncomingEursAmount: minIncomingEursAmount,
|
1205
|
+
minIncomingSeurAmount: minIncomingSeurAmount,
|
1206
|
+
receiveSingleAsset: receiveSingleAsset
|
1207
|
+
})
|
1208
|
+
});
|
1209
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1210
|
+
}
|
1211
|
+
function curveEursStake(_ref16) {
|
1212
|
+
var comptrollerProxy = _ref16.comptrollerProxy,
|
1213
|
+
integrationManager = _ref16.integrationManager,
|
1214
|
+
fundOwner = _ref16.fundOwner,
|
1215
|
+
curveLiquidityEursAdapter = _ref16.curveLiquidityEursAdapter,
|
1216
|
+
outgoingLPTokenAmount = _ref16.outgoingLPTokenAmount;
|
1217
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1218
|
+
adapter: curveLiquidityEursAdapter,
|
1219
|
+
selector: protocol.stakeSelector,
|
1220
|
+
encodedCallArgs: protocol.curveEursStakeArgs({
|
1221
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount
|
1222
|
+
})
|
1223
|
+
});
|
1224
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1225
|
+
}
|
1226
|
+
function curveEursUnstakeAndRedeem(_ref17) {
|
1227
|
+
var comptrollerProxy = _ref17.comptrollerProxy,
|
1228
|
+
integrationManager = _ref17.integrationManager,
|
1229
|
+
fundOwner = _ref17.fundOwner,
|
1230
|
+
curveLiquidityEursAdapter = _ref17.curveLiquidityEursAdapter,
|
1231
|
+
outgoingLiquidityGaugeTokenAmount = _ref17.outgoingLiquidityGaugeTokenAmount,
|
1232
|
+
minIncomingEursAmount = _ref17.minIncomingEursAmount,
|
1233
|
+
minIncomingSeurAmount = _ref17.minIncomingSeurAmount,
|
1234
|
+
receiveSingleAsset = _ref17.receiveSingleAsset;
|
1235
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1236
|
+
adapter: curveLiquidityEursAdapter,
|
1237
|
+
selector: protocol.unstakeAndRedeemSelector,
|
1238
|
+
encodedCallArgs: protocol.curveEursUnstakeAndRedeemArgs({
|
1239
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount,
|
1240
|
+
minIncomingEursAmount: minIncomingEursAmount,
|
1241
|
+
minIncomingSeurAmount: minIncomingSeurAmount,
|
1242
|
+
receiveSingleAsset: receiveSingleAsset
|
1243
|
+
})
|
1244
|
+
});
|
1245
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1246
|
+
}
|
1247
|
+
function curveEursUnstake(_ref18) {
|
1248
|
+
var comptrollerProxy = _ref18.comptrollerProxy,
|
1249
|
+
integrationManager = _ref18.integrationManager,
|
1250
|
+
fundOwner = _ref18.fundOwner,
|
1251
|
+
curveLiquidityEursAdapter = _ref18.curveLiquidityEursAdapter,
|
1252
|
+
outgoingLiquidityGaugeTokenAmount = _ref18.outgoingLiquidityGaugeTokenAmount;
|
1253
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1254
|
+
adapter: curveLiquidityEursAdapter,
|
1255
|
+
selector: protocol.unstakeSelector,
|
1256
|
+
encodedCallArgs: protocol.curveEursUnstakeArgs({
|
1257
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount
|
1258
|
+
})
|
1259
|
+
});
|
1260
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1261
|
+
} // sETH pool
|
1262
|
+
|
1263
|
+
function curveSethClaimRewards(_ref19) {
|
1264
|
+
var comptrollerProxy = _ref19.comptrollerProxy,
|
1265
|
+
integrationManager = _ref19.integrationManager,
|
1266
|
+
fundOwner = _ref19.fundOwner,
|
1267
|
+
curveLiquiditySethAdapter = _ref19.curveLiquiditySethAdapter;
|
1268
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1269
|
+
adapter: curveLiquiditySethAdapter,
|
1270
|
+
selector: protocol.claimRewardsSelector,
|
1271
|
+
encodedCallArgs: ethers.constants.HashZero
|
1272
|
+
});
|
1273
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1274
|
+
}
|
1275
|
+
function curveSethClaimRewardsAndReinvest(_ref20) {
|
1276
|
+
var comptrollerProxy = _ref20.comptrollerProxy,
|
1277
|
+
integrationManager = _ref20.integrationManager,
|
1278
|
+
fundOwner = _ref20.fundOwner,
|
1279
|
+
curveLiquiditySethAdapter = _ref20.curveLiquiditySethAdapter,
|
1280
|
+
useFullBalances = _ref20.useFullBalances,
|
1281
|
+
_ref20$minIncomingLiq = _ref20.minIncomingLiquidityGaugeTokenAmount,
|
1282
|
+
minIncomingLiquidityGaugeTokenAmount = _ref20$minIncomingLiq === void 0 ? ethers.BigNumber.from(1) : _ref20$minIncomingLiq;
|
1283
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1284
|
+
adapter: curveLiquiditySethAdapter,
|
1285
|
+
selector: protocol.claimRewardsAndReinvestSelector,
|
1286
|
+
encodedCallArgs: protocol.curveSethClaimRewardsAndReinvestArgs({
|
1287
|
+
useFullBalances: useFullBalances,
|
1288
|
+
minIncomingLiquidityGaugeTokenAmount: minIncomingLiquidityGaugeTokenAmount
|
1289
|
+
})
|
1290
|
+
});
|
1291
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1292
|
+
}
|
1293
|
+
function curveSethClaimRewardsAndSwap(_ref21) {
|
1294
|
+
var comptrollerProxy = _ref21.comptrollerProxy,
|
1295
|
+
integrationManager = _ref21.integrationManager,
|
1296
|
+
fundOwner = _ref21.fundOwner,
|
1297
|
+
curveLiquiditySethAdapter = _ref21.curveLiquiditySethAdapter,
|
1298
|
+
useFullBalances = _ref21.useFullBalances,
|
1299
|
+
incomingAsset = _ref21.incomingAsset,
|
1300
|
+
_ref21$minIncomingAss = _ref21.minIncomingAssetAmount,
|
1301
|
+
minIncomingAssetAmount = _ref21$minIncomingAss === void 0 ? ethers.BigNumber.from(1) : _ref21$minIncomingAss;
|
1302
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1303
|
+
adapter: curveLiquiditySethAdapter,
|
1304
|
+
selector: protocol.claimRewardsAndSwapSelector,
|
1305
|
+
encodedCallArgs: protocol.curveSethClaimRewardsAndSwapArgs({
|
1306
|
+
useFullBalances: useFullBalances,
|
1307
|
+
incomingAsset: incomingAsset,
|
1308
|
+
minIncomingAssetAmount: minIncomingAssetAmount
|
1309
|
+
})
|
1310
|
+
});
|
1311
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1312
|
+
}
|
1313
|
+
function curveSethLend(_ref22) {
|
1314
|
+
var comptrollerProxy = _ref22.comptrollerProxy,
|
1315
|
+
integrationManager = _ref22.integrationManager,
|
1316
|
+
fundOwner = _ref22.fundOwner,
|
1317
|
+
curveLiquiditySethAdapter = _ref22.curveLiquiditySethAdapter,
|
1318
|
+
outgoingWethAmount = _ref22.outgoingWethAmount,
|
1319
|
+
outgoingSethAmount = _ref22.outgoingSethAmount,
|
1320
|
+
minIncomingLPTokenAmount = _ref22.minIncomingLPTokenAmount;
|
1321
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1322
|
+
adapter: curveLiquiditySethAdapter,
|
1323
|
+
selector: protocol.lendSelector,
|
1324
|
+
encodedCallArgs: protocol.curveSethLendArgs({
|
1325
|
+
outgoingWethAmount: outgoingWethAmount,
|
1326
|
+
outgoingSethAmount: outgoingSethAmount,
|
1327
|
+
minIncomingLPTokenAmount: minIncomingLPTokenAmount
|
1328
|
+
})
|
1329
|
+
});
|
1330
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1331
|
+
}
|
1332
|
+
function curveSethLendAndStake(_ref23) {
|
1333
|
+
var comptrollerProxy = _ref23.comptrollerProxy,
|
1334
|
+
integrationManager = _ref23.integrationManager,
|
1335
|
+
fundOwner = _ref23.fundOwner,
|
1336
|
+
curveLiquiditySethAdapter = _ref23.curveLiquiditySethAdapter,
|
1337
|
+
outgoingWethAmount = _ref23.outgoingWethAmount,
|
1338
|
+
outgoingSethAmount = _ref23.outgoingSethAmount,
|
1339
|
+
minIncomingLiquidityGaugeTokenAmount = _ref23.minIncomingLiquidityGaugeTokenAmount;
|
1340
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1341
|
+
adapter: curveLiquiditySethAdapter,
|
1342
|
+
selector: protocol.lendAndStakeSelector,
|
1343
|
+
encodedCallArgs: protocol.curveSethLendAndStakeArgs({
|
1344
|
+
outgoingWethAmount: outgoingWethAmount,
|
1345
|
+
outgoingSethAmount: outgoingSethAmount,
|
1346
|
+
minIncomingLiquidityGaugeTokenAmount: minIncomingLiquidityGaugeTokenAmount
|
1347
|
+
})
|
1348
|
+
});
|
1349
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1350
|
+
}
|
1351
|
+
function curveSethRedeem(_ref24) {
|
1352
|
+
var comptrollerProxy = _ref24.comptrollerProxy,
|
1353
|
+
integrationManager = _ref24.integrationManager,
|
1354
|
+
fundOwner = _ref24.fundOwner,
|
1355
|
+
curveLiquiditySethAdapter = _ref24.curveLiquiditySethAdapter,
|
1356
|
+
outgoingLPTokenAmount = _ref24.outgoingLPTokenAmount,
|
1357
|
+
minIncomingWethAmount = _ref24.minIncomingWethAmount,
|
1358
|
+
minIncomingSethAmount = _ref24.minIncomingSethAmount,
|
1359
|
+
receiveSingleAsset = _ref24.receiveSingleAsset;
|
1360
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1361
|
+
adapter: curveLiquiditySethAdapter,
|
1362
|
+
selector: protocol.redeemSelector,
|
1363
|
+
encodedCallArgs: protocol.curveSethRedeemArgs({
|
1364
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount,
|
1365
|
+
minIncomingWethAmount: minIncomingWethAmount,
|
1366
|
+
minIncomingSethAmount: minIncomingSethAmount,
|
1367
|
+
receiveSingleAsset: receiveSingleAsset
|
1368
|
+
})
|
1369
|
+
});
|
1370
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1371
|
+
}
|
1372
|
+
function curveSethStake(_ref25) {
|
1373
|
+
var comptrollerProxy = _ref25.comptrollerProxy,
|
1374
|
+
integrationManager = _ref25.integrationManager,
|
1375
|
+
fundOwner = _ref25.fundOwner,
|
1376
|
+
curveLiquiditySethAdapter = _ref25.curveLiquiditySethAdapter,
|
1377
|
+
outgoingLPTokenAmount = _ref25.outgoingLPTokenAmount;
|
1378
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1379
|
+
adapter: curveLiquiditySethAdapter,
|
1380
|
+
selector: protocol.stakeSelector,
|
1381
|
+
encodedCallArgs: protocol.curveSethStakeArgs({
|
1382
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount
|
1383
|
+
})
|
1384
|
+
});
|
1385
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1386
|
+
}
|
1387
|
+
function curveSethUnstakeAndRedeem(_ref26) {
|
1388
|
+
var comptrollerProxy = _ref26.comptrollerProxy,
|
1389
|
+
integrationManager = _ref26.integrationManager,
|
1390
|
+
fundOwner = _ref26.fundOwner,
|
1391
|
+
curveLiquiditySethAdapter = _ref26.curveLiquiditySethAdapter,
|
1392
|
+
outgoingLiquidityGaugeTokenAmount = _ref26.outgoingLiquidityGaugeTokenAmount,
|
1393
|
+
minIncomingWethAmount = _ref26.minIncomingWethAmount,
|
1394
|
+
minIncomingSethAmount = _ref26.minIncomingSethAmount,
|
1395
|
+
receiveSingleAsset = _ref26.receiveSingleAsset;
|
1396
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1397
|
+
adapter: curveLiquiditySethAdapter,
|
1398
|
+
selector: protocol.unstakeAndRedeemSelector,
|
1399
|
+
encodedCallArgs: protocol.curveSethUnstakeAndRedeemArgs({
|
1400
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount,
|
1401
|
+
minIncomingWethAmount: minIncomingWethAmount,
|
1402
|
+
minIncomingSethAmount: minIncomingSethAmount,
|
1403
|
+
receiveSingleAsset: receiveSingleAsset
|
1404
|
+
})
|
1405
|
+
});
|
1406
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1407
|
+
}
|
1408
|
+
function curveSethUnstake(_ref27) {
|
1409
|
+
var comptrollerProxy = _ref27.comptrollerProxy,
|
1410
|
+
integrationManager = _ref27.integrationManager,
|
1411
|
+
fundOwner = _ref27.fundOwner,
|
1412
|
+
curveLiquiditySethAdapter = _ref27.curveLiquiditySethAdapter,
|
1413
|
+
outgoingLiquidityGaugeTokenAmount = _ref27.outgoingLiquidityGaugeTokenAmount;
|
1414
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1415
|
+
adapter: curveLiquiditySethAdapter,
|
1416
|
+
selector: protocol.unstakeSelector,
|
1417
|
+
encodedCallArgs: protocol.curveSethUnstakeArgs({
|
1418
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount
|
1419
|
+
})
|
1420
|
+
});
|
1421
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1422
|
+
} // stETH pool
|
1423
|
+
|
1424
|
+
function curveStethClaimRewards(_ref28) {
|
1425
|
+
var comptrollerProxy = _ref28.comptrollerProxy,
|
1426
|
+
integrationManager = _ref28.integrationManager,
|
1427
|
+
fundOwner = _ref28.fundOwner,
|
1428
|
+
curveLiquidityStethAdapter = _ref28.curveLiquidityStethAdapter;
|
1429
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1430
|
+
adapter: curveLiquidityStethAdapter,
|
1431
|
+
selector: protocol.claimRewardsSelector,
|
1432
|
+
encodedCallArgs: ethers.constants.HashZero
|
1433
|
+
});
|
1434
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1435
|
+
}
|
1436
|
+
function curveStethClaimRewardsAndReinvest(_ref29) {
|
1437
|
+
var comptrollerProxy = _ref29.comptrollerProxy,
|
1438
|
+
integrationManager = _ref29.integrationManager,
|
1439
|
+
fundOwner = _ref29.fundOwner,
|
1440
|
+
curveLiquidityStethAdapter = _ref29.curveLiquidityStethAdapter,
|
1441
|
+
useFullBalances = _ref29.useFullBalances,
|
1442
|
+
_ref29$minIncomingLiq = _ref29.minIncomingLiquidityGaugeTokenAmount,
|
1443
|
+
minIncomingLiquidityGaugeTokenAmount = _ref29$minIncomingLiq === void 0 ? ethers.BigNumber.from(1) : _ref29$minIncomingLiq;
|
1444
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1445
|
+
adapter: curveLiquidityStethAdapter,
|
1446
|
+
selector: protocol.claimRewardsAndReinvestSelector,
|
1447
|
+
encodedCallArgs: protocol.curveStethClaimRewardsAndReinvestArgs({
|
1448
|
+
useFullBalances: useFullBalances,
|
1449
|
+
minIncomingLiquidityGaugeTokenAmount: minIncomingLiquidityGaugeTokenAmount
|
1450
|
+
})
|
1451
|
+
});
|
1452
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1453
|
+
}
|
1454
|
+
function curveStethClaimRewardsAndSwap(_ref30) {
|
1455
|
+
var comptrollerProxy = _ref30.comptrollerProxy,
|
1456
|
+
integrationManager = _ref30.integrationManager,
|
1457
|
+
fundOwner = _ref30.fundOwner,
|
1458
|
+
curveLiquidityStethAdapter = _ref30.curveLiquidityStethAdapter,
|
1459
|
+
useFullBalances = _ref30.useFullBalances,
|
1460
|
+
incomingAsset = _ref30.incomingAsset,
|
1461
|
+
_ref30$minIncomingAss = _ref30.minIncomingAssetAmount,
|
1462
|
+
minIncomingAssetAmount = _ref30$minIncomingAss === void 0 ? ethers.BigNumber.from(1) : _ref30$minIncomingAss;
|
1463
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1464
|
+
adapter: curveLiquidityStethAdapter,
|
1465
|
+
selector: protocol.claimRewardsAndSwapSelector,
|
1466
|
+
encodedCallArgs: protocol.curveStethClaimRewardsAndSwapArgs({
|
1467
|
+
useFullBalances: useFullBalances,
|
1468
|
+
incomingAsset: incomingAsset,
|
1469
|
+
minIncomingAssetAmount: minIncomingAssetAmount
|
1470
|
+
})
|
1471
|
+
});
|
1472
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1473
|
+
}
|
1474
|
+
function curveStethLend(_ref31) {
|
1475
|
+
var comptrollerProxy = _ref31.comptrollerProxy,
|
1476
|
+
integrationManager = _ref31.integrationManager,
|
1477
|
+
fundOwner = _ref31.fundOwner,
|
1478
|
+
curveLiquidityStethAdapter = _ref31.curveLiquidityStethAdapter,
|
1479
|
+
outgoingWethAmount = _ref31.outgoingWethAmount,
|
1480
|
+
outgoingStethAmount = _ref31.outgoingStethAmount,
|
1481
|
+
minIncomingLPTokenAmount = _ref31.minIncomingLPTokenAmount;
|
1482
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1483
|
+
adapter: curveLiquidityStethAdapter,
|
1484
|
+
selector: protocol.lendSelector,
|
1485
|
+
encodedCallArgs: protocol.curveStethLendArgs({
|
1486
|
+
outgoingWethAmount: outgoingWethAmount,
|
1487
|
+
outgoingStethAmount: outgoingStethAmount,
|
1488
|
+
minIncomingLPTokenAmount: minIncomingLPTokenAmount
|
1489
|
+
})
|
1490
|
+
});
|
1491
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1492
|
+
}
|
1493
|
+
function curveStethLendAndStake(_ref32) {
|
1494
|
+
var comptrollerProxy = _ref32.comptrollerProxy,
|
1495
|
+
integrationManager = _ref32.integrationManager,
|
1496
|
+
fundOwner = _ref32.fundOwner,
|
1497
|
+
curveLiquidityStethAdapter = _ref32.curveLiquidityStethAdapter,
|
1498
|
+
outgoingWethAmount = _ref32.outgoingWethAmount,
|
1499
|
+
outgoingStethAmount = _ref32.outgoingStethAmount,
|
1500
|
+
minIncomingLiquidityGaugeTokenAmount = _ref32.minIncomingLiquidityGaugeTokenAmount;
|
1501
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1502
|
+
adapter: curveLiquidityStethAdapter,
|
1503
|
+
selector: protocol.lendAndStakeSelector,
|
1504
|
+
encodedCallArgs: protocol.curveStethLendAndStakeArgs({
|
1505
|
+
outgoingWethAmount: outgoingWethAmount,
|
1506
|
+
outgoingStethAmount: outgoingStethAmount,
|
1507
|
+
minIncomingLiquidityGaugeTokenAmount: minIncomingLiquidityGaugeTokenAmount
|
1508
|
+
})
|
1509
|
+
});
|
1510
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1511
|
+
}
|
1512
|
+
function curveStethRedeem(_ref33) {
|
1513
|
+
var comptrollerProxy = _ref33.comptrollerProxy,
|
1514
|
+
integrationManager = _ref33.integrationManager,
|
1515
|
+
fundOwner = _ref33.fundOwner,
|
1516
|
+
curveLiquidityStethAdapter = _ref33.curveLiquidityStethAdapter,
|
1517
|
+
outgoingLPTokenAmount = _ref33.outgoingLPTokenAmount,
|
1518
|
+
minIncomingWethAmount = _ref33.minIncomingWethAmount,
|
1519
|
+
minIncomingStethAmount = _ref33.minIncomingStethAmount,
|
1520
|
+
receiveSingleAsset = _ref33.receiveSingleAsset;
|
1521
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1522
|
+
adapter: curveLiquidityStethAdapter,
|
1523
|
+
selector: protocol.redeemSelector,
|
1524
|
+
encodedCallArgs: protocol.curveStethRedeemArgs({
|
1525
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount,
|
1526
|
+
minIncomingWethAmount: minIncomingWethAmount,
|
1527
|
+
minIncomingStethAmount: minIncomingStethAmount,
|
1528
|
+
receiveSingleAsset: receiveSingleAsset
|
1529
|
+
})
|
1530
|
+
});
|
1531
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1532
|
+
}
|
1533
|
+
function curveStethStake(_ref34) {
|
1534
|
+
var comptrollerProxy = _ref34.comptrollerProxy,
|
1535
|
+
integrationManager = _ref34.integrationManager,
|
1536
|
+
fundOwner = _ref34.fundOwner,
|
1537
|
+
curveLiquidityStethAdapter = _ref34.curveLiquidityStethAdapter,
|
1538
|
+
outgoingLPTokenAmount = _ref34.outgoingLPTokenAmount;
|
1539
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1540
|
+
adapter: curveLiquidityStethAdapter,
|
1541
|
+
selector: protocol.stakeSelector,
|
1542
|
+
encodedCallArgs: protocol.curveStethStakeArgs({
|
1543
|
+
outgoingLPTokenAmount: outgoingLPTokenAmount
|
1544
|
+
})
|
1545
|
+
});
|
1546
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1547
|
+
}
|
1548
|
+
function curveStethUnstakeAndRedeem(_ref35) {
|
1549
|
+
var comptrollerProxy = _ref35.comptrollerProxy,
|
1550
|
+
integrationManager = _ref35.integrationManager,
|
1551
|
+
fundOwner = _ref35.fundOwner,
|
1552
|
+
curveLiquidityStethAdapter = _ref35.curveLiquidityStethAdapter,
|
1553
|
+
outgoingLiquidityGaugeTokenAmount = _ref35.outgoingLiquidityGaugeTokenAmount,
|
1554
|
+
minIncomingWethAmount = _ref35.minIncomingWethAmount,
|
1555
|
+
minIncomingStethAmount = _ref35.minIncomingStethAmount,
|
1556
|
+
receiveSingleAsset = _ref35.receiveSingleAsset;
|
1557
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1558
|
+
adapter: curveLiquidityStethAdapter,
|
1559
|
+
selector: protocol.unstakeAndRedeemSelector,
|
1560
|
+
encodedCallArgs: protocol.curveStethUnstakeAndRedeemArgs({
|
1561
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount,
|
1562
|
+
minIncomingWethAmount: minIncomingWethAmount,
|
1563
|
+
minIncomingStethAmount: minIncomingStethAmount,
|
1564
|
+
receiveSingleAsset: receiveSingleAsset
|
1565
|
+
})
|
1566
|
+
});
|
1567
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1568
|
+
}
|
1569
|
+
function curveStethUnstake(_ref36) {
|
1570
|
+
var comptrollerProxy = _ref36.comptrollerProxy,
|
1571
|
+
integrationManager = _ref36.integrationManager,
|
1572
|
+
fundOwner = _ref36.fundOwner,
|
1573
|
+
curveLiquidityStethAdapter = _ref36.curveLiquidityStethAdapter,
|
1574
|
+
outgoingLiquidityGaugeTokenAmount = _ref36.outgoingLiquidityGaugeTokenAmount;
|
1575
|
+
var callArgs = protocol.callOnIntegrationArgs({
|
1576
|
+
adapter: curveLiquidityStethAdapter,
|
1577
|
+
selector: protocol.unstakeSelector,
|
1578
|
+
encodedCallArgs: protocol.curveStethUnstakeArgs({
|
1579
|
+
outgoingLiquidityGaugeTokenAmount: outgoingLiquidityGaugeTokenAmount
|
1580
|
+
})
|
1581
|
+
});
|
1582
|
+
return comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
function idleApproveAssets(_x) {
|
1586
|
+
return _idleApproveAssets.apply(this, arguments);
|
1587
|
+
}
|
1588
|
+
|
1589
|
+
function _idleApproveAssets() {
|
1590
|
+
_idleApproveAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
1591
|
+
var comptrollerProxy, integrationManager, fundOwner, idleAdapter, idleToken, assets, amounts, callArgs;
|
1592
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
1593
|
+
while (1) {
|
1594
|
+
switch (_context.prev = _context.next) {
|
1595
|
+
case 0:
|
1596
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, idleAdapter = _ref.idleAdapter, idleToken = _ref.idleToken, assets = _ref.assets, amounts = _ref.amounts;
|
1597
|
+
callArgs = protocol.callOnIntegrationArgs({
|
1598
|
+
adapter: idleAdapter,
|
1599
|
+
selector: protocol.approveAssetsSelector,
|
1600
|
+
encodedCallArgs: protocol.idleApproveAssetsArgs({
|
1601
|
+
idleToken: idleToken,
|
1602
|
+
assets: assets,
|
1603
|
+
amounts: amounts
|
1604
|
+
})
|
1605
|
+
});
|
1606
|
+
return _context.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
1607
|
+
|
1608
|
+
case 3:
|
1609
|
+
case "end":
|
1610
|
+
return _context.stop();
|
1611
|
+
}
|
1612
|
+
}
|
1613
|
+
}, _callee);
|
1614
|
+
}));
|
1615
|
+
return _idleApproveAssets.apply(this, arguments);
|
1616
|
+
}
|
1617
|
+
|
1618
|
+
function idleClaimRewards(_x2) {
|
1619
|
+
return _idleClaimRewards.apply(this, arguments);
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
function _idleClaimRewards() {
|
1623
|
+
_idleClaimRewards = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
1624
|
+
var comptrollerProxy, integrationManager, fundOwner, idleAdapter, idleToken, callArgs;
|
1625
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
1626
|
+
while (1) {
|
1627
|
+
switch (_context2.prev = _context2.next) {
|
1628
|
+
case 0:
|
1629
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, idleAdapter = _ref2.idleAdapter, idleToken = _ref2.idleToken;
|
1630
|
+
_context2.t0 = protocol.callOnIntegrationArgs;
|
1631
|
+
_context2.t1 = idleAdapter;
|
1632
|
+
_context2.t2 = protocol.claimRewardsSelector;
|
1633
|
+
_context2.t3 = protocol.idleClaimRewardsArgs;
|
1634
|
+
_context2.next = 7;
|
1635
|
+
return comptrollerProxy.getVaultProxy();
|
1636
|
+
|
1637
|
+
case 7:
|
1638
|
+
_context2.t4 = _context2.sent;
|
1639
|
+
_context2.t5 = idleToken;
|
1640
|
+
_context2.t6 = {
|
1641
|
+
vaultProxy: _context2.t4,
|
1642
|
+
idleToken: _context2.t5
|
1643
|
+
};
|
1644
|
+
_context2.t7 = (0, _context2.t3)(_context2.t6);
|
1645
|
+
_context2.t8 = {
|
1646
|
+
adapter: _context2.t1,
|
1647
|
+
selector: _context2.t2,
|
1648
|
+
encodedCallArgs: _context2.t7
|
1649
|
+
};
|
1650
|
+
callArgs = (0, _context2.t0)(_context2.t8);
|
1651
|
+
return _context2.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
1652
|
+
|
1653
|
+
case 14:
|
1654
|
+
case "end":
|
1655
|
+
return _context2.stop();
|
1656
|
+
}
|
1657
|
+
}
|
1658
|
+
}, _callee2);
|
1659
|
+
}));
|
1660
|
+
return _idleClaimRewards.apply(this, arguments);
|
1661
|
+
}
|
1662
|
+
|
1663
|
+
function idleClaimRewardsAndReinvest(_x3) {
|
1664
|
+
return _idleClaimRewardsAndReinvest.apply(this, arguments);
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
function _idleClaimRewardsAndReinvest() {
|
1668
|
+
_idleClaimRewardsAndReinvest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
1669
|
+
var comptrollerProxy, integrationManager, fundOwner, idleAdapter, idleToken, _ref3$minIncomingIdle, minIncomingIdleTokenAmount, useFullBalances, callArgs;
|
1670
|
+
|
1671
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
1672
|
+
while (1) {
|
1673
|
+
switch (_context3.prev = _context3.next) {
|
1674
|
+
case 0:
|
1675
|
+
comptrollerProxy = _ref3.comptrollerProxy, integrationManager = _ref3.integrationManager, fundOwner = _ref3.fundOwner, idleAdapter = _ref3.idleAdapter, idleToken = _ref3.idleToken, _ref3$minIncomingIdle = _ref3.minIncomingIdleTokenAmount, minIncomingIdleTokenAmount = _ref3$minIncomingIdle === void 0 ? ethers.BigNumber.from(1) : _ref3$minIncomingIdle, useFullBalances = _ref3.useFullBalances;
|
1676
|
+
_context3.t0 = protocol.callOnIntegrationArgs;
|
1677
|
+
_context3.t1 = idleAdapter;
|
1678
|
+
_context3.t2 = protocol.claimRewardsAndReinvestSelector;
|
1679
|
+
_context3.t3 = protocol.idleClaimRewardsAndReinvestArgs;
|
1680
|
+
_context3.next = 7;
|
1681
|
+
return comptrollerProxy.getVaultProxy();
|
1682
|
+
|
1683
|
+
case 7:
|
1684
|
+
_context3.t4 = _context3.sent;
|
1685
|
+
_context3.t5 = idleToken;
|
1686
|
+
_context3.t6 = minIncomingIdleTokenAmount;
|
1687
|
+
_context3.t7 = useFullBalances;
|
1688
|
+
_context3.t8 = {
|
1689
|
+
vaultProxy: _context3.t4,
|
1690
|
+
idleToken: _context3.t5,
|
1691
|
+
minIncomingIdleTokenAmount: _context3.t6,
|
1692
|
+
useFullBalances: _context3.t7
|
1693
|
+
};
|
1694
|
+
_context3.t9 = (0, _context3.t3)(_context3.t8);
|
1695
|
+
_context3.t10 = {
|
1696
|
+
adapter: _context3.t1,
|
1697
|
+
selector: _context3.t2,
|
1698
|
+
encodedCallArgs: _context3.t9
|
1699
|
+
};
|
1700
|
+
callArgs = (0, _context3.t0)(_context3.t10);
|
1701
|
+
return _context3.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
1702
|
+
|
1703
|
+
case 16:
|
1704
|
+
case "end":
|
1705
|
+
return _context3.stop();
|
1706
|
+
}
|
1707
|
+
}
|
1708
|
+
}, _callee3);
|
1709
|
+
}));
|
1710
|
+
return _idleClaimRewardsAndReinvest.apply(this, arguments);
|
1711
|
+
}
|
1712
|
+
|
1713
|
+
function idleClaimRewardsAndSwap(_x4) {
|
1714
|
+
return _idleClaimRewardsAndSwap.apply(this, arguments);
|
1715
|
+
}
|
1716
|
+
|
1717
|
+
function _idleClaimRewardsAndSwap() {
|
1718
|
+
_idleClaimRewardsAndSwap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(_ref4) {
|
1719
|
+
var comptrollerProxy, integrationManager, fundOwner, idleAdapter, idleToken, incomingAsset, _ref4$minIncomingAsse, minIncomingAssetAmount, useFullBalances, callArgs;
|
1720
|
+
|
1721
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
1722
|
+
while (1) {
|
1723
|
+
switch (_context4.prev = _context4.next) {
|
1724
|
+
case 0:
|
1725
|
+
comptrollerProxy = _ref4.comptrollerProxy, integrationManager = _ref4.integrationManager, fundOwner = _ref4.fundOwner, idleAdapter = _ref4.idleAdapter, idleToken = _ref4.idleToken, incomingAsset = _ref4.incomingAsset, _ref4$minIncomingAsse = _ref4.minIncomingAssetAmount, minIncomingAssetAmount = _ref4$minIncomingAsse === void 0 ? ethers.BigNumber.from(1) : _ref4$minIncomingAsse, useFullBalances = _ref4.useFullBalances;
|
1726
|
+
_context4.t0 = protocol.callOnIntegrationArgs;
|
1727
|
+
_context4.t1 = idleAdapter;
|
1728
|
+
_context4.t2 = protocol.claimRewardsAndSwapSelector;
|
1729
|
+
_context4.t3 = protocol.idleClaimRewardsAndSwapArgs;
|
1730
|
+
_context4.next = 7;
|
1731
|
+
return comptrollerProxy.getVaultProxy();
|
1732
|
+
|
1733
|
+
case 7:
|
1734
|
+
_context4.t4 = _context4.sent;
|
1735
|
+
_context4.t5 = idleToken;
|
1736
|
+
_context4.t6 = incomingAsset;
|
1737
|
+
_context4.t7 = minIncomingAssetAmount;
|
1738
|
+
_context4.t8 = useFullBalances;
|
1739
|
+
_context4.t9 = {
|
1740
|
+
vaultProxy: _context4.t4,
|
1741
|
+
idleToken: _context4.t5,
|
1742
|
+
incomingAsset: _context4.t6,
|
1743
|
+
minIncomingAssetAmount: _context4.t7,
|
1744
|
+
useFullBalances: _context4.t8
|
1745
|
+
};
|
1746
|
+
_context4.t10 = (0, _context4.t3)(_context4.t9);
|
1747
|
+
_context4.t11 = {
|
1748
|
+
adapter: _context4.t1,
|
1749
|
+
selector: _context4.t2,
|
1750
|
+
encodedCallArgs: _context4.t10
|
1751
|
+
};
|
1752
|
+
callArgs = (0, _context4.t0)(_context4.t11);
|
1753
|
+
return _context4.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
1754
|
+
|
1755
|
+
case 17:
|
1756
|
+
case "end":
|
1757
|
+
return _context4.stop();
|
1758
|
+
}
|
1759
|
+
}
|
1760
|
+
}, _callee4);
|
1761
|
+
}));
|
1762
|
+
return _idleClaimRewardsAndSwap.apply(this, arguments);
|
1763
|
+
}
|
1764
|
+
|
1765
|
+
function idleLend(_x5) {
|
1766
|
+
return _idleLend.apply(this, arguments);
|
1767
|
+
}
|
1768
|
+
|
1769
|
+
function _idleLend() {
|
1770
|
+
_idleLend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(_ref5) {
|
1771
|
+
var comptrollerProxy, integrationManager, fundOwner, idleAdapter, idleToken, outgoingUnderlyingAmount, _ref5$minIncomingIdle, minIncomingIdleTokenAmount, callArgs;
|
1772
|
+
|
1773
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
1774
|
+
while (1) {
|
1775
|
+
switch (_context5.prev = _context5.next) {
|
1776
|
+
case 0:
|
1777
|
+
comptrollerProxy = _ref5.comptrollerProxy, integrationManager = _ref5.integrationManager, fundOwner = _ref5.fundOwner, idleAdapter = _ref5.idleAdapter, idleToken = _ref5.idleToken, outgoingUnderlyingAmount = _ref5.outgoingUnderlyingAmount, _ref5$minIncomingIdle = _ref5.minIncomingIdleTokenAmount, minIncomingIdleTokenAmount = _ref5$minIncomingIdle === void 0 ? ethers.BigNumber.from(1) : _ref5$minIncomingIdle;
|
1778
|
+
callArgs = protocol.callOnIntegrationArgs({
|
1779
|
+
adapter: idleAdapter,
|
1780
|
+
selector: protocol.lendSelector,
|
1781
|
+
encodedCallArgs: protocol.idleLendArgs({
|
1782
|
+
idleToken: idleToken,
|
1783
|
+
outgoingUnderlyingAmount: outgoingUnderlyingAmount,
|
1784
|
+
minIncomingIdleTokenAmount: minIncomingIdleTokenAmount
|
1785
|
+
})
|
1786
|
+
});
|
1787
|
+
return _context5.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
1788
|
+
|
1789
|
+
case 3:
|
1790
|
+
case "end":
|
1791
|
+
return _context5.stop();
|
1792
|
+
}
|
1793
|
+
}
|
1794
|
+
}, _callee5);
|
1795
|
+
}));
|
1796
|
+
return _idleLend.apply(this, arguments);
|
1797
|
+
}
|
1798
|
+
|
1799
|
+
function idleRedeem(_x6) {
|
1800
|
+
return _idleRedeem.apply(this, arguments);
|
1801
|
+
}
|
1802
|
+
|
1803
|
+
function _idleRedeem() {
|
1804
|
+
_idleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee6(_ref6) {
|
1805
|
+
var comptrollerProxy, integrationManager, fundOwner, idleAdapter, idleToken, outgoingIdleTokenAmount, _ref6$minIncomingUnde, minIncomingUnderlyingAmount, callArgs;
|
1806
|
+
|
1807
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee6$(_context6) {
|
1808
|
+
while (1) {
|
1809
|
+
switch (_context6.prev = _context6.next) {
|
1810
|
+
case 0:
|
1811
|
+
comptrollerProxy = _ref6.comptrollerProxy, integrationManager = _ref6.integrationManager, fundOwner = _ref6.fundOwner, idleAdapter = _ref6.idleAdapter, idleToken = _ref6.idleToken, outgoingIdleTokenAmount = _ref6.outgoingIdleTokenAmount, _ref6$minIncomingUnde = _ref6.minIncomingUnderlyingAmount, minIncomingUnderlyingAmount = _ref6$minIncomingUnde === void 0 ? ethers.BigNumber.from(1) : _ref6$minIncomingUnde;
|
1812
|
+
callArgs = protocol.callOnIntegrationArgs({
|
1813
|
+
adapter: idleAdapter,
|
1814
|
+
selector: protocol.redeemSelector,
|
1815
|
+
encodedCallArgs: protocol.idleRedeemArgs({
|
1816
|
+
idleToken: idleToken,
|
1817
|
+
outgoingIdleTokenAmount: outgoingIdleTokenAmount,
|
1818
|
+
minIncomingUnderlyingAmount: minIncomingUnderlyingAmount
|
1819
|
+
})
|
1820
|
+
});
|
1821
|
+
return _context6.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
1822
|
+
|
1823
|
+
case 3:
|
1824
|
+
case "end":
|
1825
|
+
return _context6.stop();
|
1826
|
+
}
|
1827
|
+
}
|
1828
|
+
}, _callee6);
|
1829
|
+
}));
|
1830
|
+
return _idleRedeem.apply(this, arguments);
|
1831
|
+
}
|
1832
|
+
|
1833
|
+
var _templateObject$1;
|
1834
|
+
|
1835
|
+
var KyberNetworkProxy = ethers$1.contract()(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n function getExpectedRate(address src, address dest, uint256 srcQty) view returns (uint256 expectedRate, uint256 worstRate)\n"])));
|
1836
|
+
function kyberTakeOrder(_x) {
|
1837
|
+
return _kyberTakeOrder.apply(this, arguments);
|
1838
|
+
}
|
1839
|
+
|
1840
|
+
function _kyberTakeOrder() {
|
1841
|
+
_kyberTakeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
1842
|
+
var comptrollerProxy, vaultProxy, integrationManager, fundOwner, kyberAdapter, outgoingAsset, _ref$outgoingAssetAmo, outgoingAssetAmount, incomingAsset, _ref$minIncomingAsset, minIncomingAssetAmount, _ref$seedFund, seedFund, takeOrderArgs, callArgs;
|
1843
|
+
|
1844
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
1845
|
+
while (1) {
|
1846
|
+
switch (_context.prev = _context.next) {
|
1847
|
+
case 0:
|
1848
|
+
comptrollerProxy = _ref.comptrollerProxy, vaultProxy = _ref.vaultProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, kyberAdapter = _ref.kyberAdapter, outgoingAsset = _ref.outgoingAsset, _ref$outgoingAssetAmo = _ref.outgoingAssetAmount, outgoingAssetAmount = _ref$outgoingAssetAmo === void 0 ? ethers.utils.parseEther('1') : _ref$outgoingAssetAmo, incomingAsset = _ref.incomingAsset, _ref$minIncomingAsset = _ref.minIncomingAssetAmount, minIncomingAssetAmount = _ref$minIncomingAsset === void 0 ? ethers.utils.parseEther('1') : _ref$minIncomingAsset, _ref$seedFund = _ref.seedFund, seedFund = _ref$seedFund === void 0 ? false : _ref$seedFund;
|
1849
|
+
|
1850
|
+
if (!seedFund) {
|
1851
|
+
_context.next = 4;
|
1852
|
+
break;
|
1853
|
+
}
|
1854
|
+
|
1855
|
+
_context.next = 4;
|
1856
|
+
return outgoingAsset.transfer(vaultProxy, outgoingAssetAmount);
|
1857
|
+
|
1858
|
+
case 4:
|
1859
|
+
takeOrderArgs = protocol.kyberTakeOrderArgs({
|
1860
|
+
incomingAsset: incomingAsset,
|
1861
|
+
minIncomingAssetAmount: minIncomingAssetAmount,
|
1862
|
+
outgoingAsset: outgoingAsset,
|
1863
|
+
outgoingAssetAmount: outgoingAssetAmount
|
1864
|
+
});
|
1865
|
+
callArgs = protocol.callOnIntegrationArgs({
|
1866
|
+
adapter: kyberAdapter,
|
1867
|
+
selector: protocol.takeOrderSelector,
|
1868
|
+
encodedCallArgs: takeOrderArgs
|
1869
|
+
});
|
1870
|
+
return _context.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
1871
|
+
|
1872
|
+
case 7:
|
1873
|
+
case "end":
|
1874
|
+
return _context.stop();
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
}, _callee);
|
1878
|
+
}));
|
1879
|
+
return _kyberTakeOrder.apply(this, arguments);
|
1880
|
+
}
|
1881
|
+
|
1882
|
+
var mockGenericRemoveOnlySelector = protocol.sighash(ethers.utils.FunctionFragment.fromString('removeOnly(address,bytes,bytes)'));
|
1883
|
+
var mockGenericSwapASelector = protocol.sighash(ethers.utils.FunctionFragment.fromString('swapA(address,bytes,bytes)'));
|
1884
|
+
var mockGenericSwapBSelector = protocol.sighash(ethers.utils.FunctionFragment.fromString('swapB(address,bytes,bytes)'));
|
1885
|
+
var mockGenericSwapDirectFromVaultSelector = protocol.sighash(ethers.utils.FunctionFragment.fromString('swapDirectFromVault(address,bytes,bytes)'));
|
1886
|
+
var mockGenericSwapViaApprovalSelector = protocol.sighash(ethers.utils.FunctionFragment.fromString('swapViaApproval(address,bytes,bytes)'));
|
1887
|
+
function mockGenericSwapArgs(_ref) {
|
1888
|
+
var _ref$spendAssets = _ref.spendAssets,
|
1889
|
+
spendAssets = _ref$spendAssets === void 0 ? [] : _ref$spendAssets,
|
1890
|
+
_ref$actualSpendAsset = _ref.actualSpendAssetAmounts,
|
1891
|
+
actualSpendAssetAmounts = _ref$actualSpendAsset === void 0 ? [] : _ref$actualSpendAsset,
|
1892
|
+
_ref$maxSpendAssetAmo = _ref.maxSpendAssetAmounts,
|
1893
|
+
maxSpendAssetAmounts = _ref$maxSpendAssetAmo === void 0 ? actualSpendAssetAmounts : _ref$maxSpendAssetAmo,
|
1894
|
+
_ref$incomingAssets = _ref.incomingAssets,
|
1895
|
+
incomingAssets = _ref$incomingAssets === void 0 ? [] : _ref$incomingAssets,
|
1896
|
+
_ref$actualIncomingAs = _ref.actualIncomingAssetAmounts,
|
1897
|
+
actualIncomingAssetAmounts = _ref$actualIncomingAs === void 0 ? [] : _ref$actualIncomingAs,
|
1898
|
+
_ref$minIncomingAsset = _ref.minIncomingAssetAmounts,
|
1899
|
+
minIncomingAssetAmounts = _ref$minIncomingAsset === void 0 ? actualIncomingAssetAmounts : _ref$minIncomingAsset;
|
1900
|
+
return protocol.encodeArgs(['address[]', 'uint256[]', 'uint256[]', 'address[]', 'uint256[]', 'uint256[]'], [spendAssets, maxSpendAssetAmounts, actualSpendAssetAmounts, incomingAssets, minIncomingAssetAmounts, actualIncomingAssetAmounts]);
|
1901
|
+
}
|
1902
|
+
function mockGenericSwap(_x) {
|
1903
|
+
return _mockGenericSwap.apply(this, arguments);
|
1904
|
+
}
|
1905
|
+
|
1906
|
+
function _mockGenericSwap() {
|
1907
|
+
_mockGenericSwap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref2) {
|
1908
|
+
var comptrollerProxy, vaultProxy, integrationManager, fundOwner, mockGenericAdapter, _ref2$selector, selector, _ref2$spendAssets, spendAssets, _ref2$actualSpendAsse, actualSpendAssetAmounts, _ref2$maxSpendAssetAm, maxSpendAssetAmounts, _ref2$incomingAssets, incomingAssets, _ref2$actualIncomingA, actualIncomingAssetAmounts, _ref2$minIncomingAsse, minIncomingAssetAmounts, _ref2$seedFund, seedFund, key, swapArgs, callArgs, swapTx;
|
1909
|
+
|
1910
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
1911
|
+
while (1) {
|
1912
|
+
switch (_context.prev = _context.next) {
|
1913
|
+
case 0:
|
1914
|
+
comptrollerProxy = _ref2.comptrollerProxy, vaultProxy = _ref2.vaultProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, mockGenericAdapter = _ref2.mockGenericAdapter, _ref2$selector = _ref2.selector, selector = _ref2$selector === void 0 ? mockGenericSwapASelector : _ref2$selector, _ref2$spendAssets = _ref2.spendAssets, spendAssets = _ref2$spendAssets === void 0 ? [] : _ref2$spendAssets, _ref2$actualSpendAsse = _ref2.actualSpendAssetAmounts, actualSpendAssetAmounts = _ref2$actualSpendAsse === void 0 ? [] : _ref2$actualSpendAsse, _ref2$maxSpendAssetAm = _ref2.maxSpendAssetAmounts, maxSpendAssetAmounts = _ref2$maxSpendAssetAm === void 0 ? actualSpendAssetAmounts : _ref2$maxSpendAssetAm, _ref2$incomingAssets = _ref2.incomingAssets, incomingAssets = _ref2$incomingAssets === void 0 ? [] : _ref2$incomingAssets, _ref2$actualIncomingA = _ref2.actualIncomingAssetAmounts, actualIncomingAssetAmounts = _ref2$actualIncomingA === void 0 ? [] : _ref2$actualIncomingA, _ref2$minIncomingAsse = _ref2.minIncomingAssetAmounts, minIncomingAssetAmounts = _ref2$minIncomingAsse === void 0 ? actualIncomingAssetAmounts : _ref2$minIncomingAsse, _ref2$seedFund = _ref2.seedFund, seedFund = _ref2$seedFund === void 0 ? false : _ref2$seedFund;
|
1915
|
+
|
1916
|
+
if (!seedFund) {
|
1917
|
+
_context.next = 9;
|
1918
|
+
break;
|
1919
|
+
}
|
1920
|
+
|
1921
|
+
_context.t0 = _regeneratorRuntime__default['default'].keys(spendAssets);
|
1922
|
+
|
1923
|
+
case 3:
|
1924
|
+
if ((_context.t1 = _context.t0()).done) {
|
1925
|
+
_context.next = 9;
|
1926
|
+
break;
|
1927
|
+
}
|
1928
|
+
|
1929
|
+
key = _context.t1.value;
|
1930
|
+
_context.next = 7;
|
1931
|
+
return spendAssets[key].transfer(vaultProxy, maxSpendAssetAmounts[key]);
|
1932
|
+
|
1933
|
+
case 7:
|
1934
|
+
_context.next = 3;
|
1935
|
+
break;
|
1936
|
+
|
1937
|
+
case 9:
|
1938
|
+
swapArgs = mockGenericSwapArgs({
|
1939
|
+
spendAssets: spendAssets,
|
1940
|
+
maxSpendAssetAmounts: maxSpendAssetAmounts,
|
1941
|
+
actualSpendAssetAmounts: actualSpendAssetAmounts,
|
1942
|
+
incomingAssets: incomingAssets,
|
1943
|
+
minIncomingAssetAmounts: minIncomingAssetAmounts,
|
1944
|
+
actualIncomingAssetAmounts: actualIncomingAssetAmounts
|
1945
|
+
});
|
1946
|
+
callArgs = protocol.callOnIntegrationArgs({
|
1947
|
+
adapter: mockGenericAdapter,
|
1948
|
+
selector: selector,
|
1949
|
+
encodedCallArgs: swapArgs
|
1950
|
+
});
|
1951
|
+
swapTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
1952
|
+
_context.next = 14;
|
1953
|
+
return expect(swapTx).resolves.toBeReceipt();
|
1954
|
+
|
1955
|
+
case 14:
|
1956
|
+
return _context.abrupt("return", swapTx);
|
1957
|
+
|
1958
|
+
case 15:
|
1959
|
+
case "end":
|
1960
|
+
return _context.stop();
|
1961
|
+
}
|
1962
|
+
}
|
1963
|
+
}, _callee);
|
1964
|
+
}));
|
1965
|
+
return _mockGenericSwap.apply(this, arguments);
|
1966
|
+
}
|
1967
|
+
|
1968
|
+
function paraSwapV4GenerateDummyPaths(_ref) {
|
1969
|
+
var toTokens = _ref.toTokens;
|
1970
|
+
return toTokens.map(function (toToken) {
|
1971
|
+
return {
|
1972
|
+
to: toToken,
|
1973
|
+
totalNetworkFee: 0,
|
1974
|
+
// Not supported in our protocol
|
1975
|
+
routes: [] // Can ignore this param in the dummy
|
1976
|
+
|
1977
|
+
};
|
1978
|
+
});
|
1979
|
+
}
|
1980
|
+
function paraSwapV4TakeOrder(_x) {
|
1981
|
+
return _paraSwapV4TakeOrder.apply(this, arguments);
|
1982
|
+
}
|
1983
|
+
|
1984
|
+
function _paraSwapV4TakeOrder() {
|
1985
|
+
_paraSwapV4TakeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref2) {
|
1986
|
+
var comptrollerProxy, integrationManager, fundOwner, paraSwapV4Adapter, outgoingAsset, _ref2$outgoingAssetAm, outgoingAssetAmount, _ref2$minIncomingAsse, minIncomingAssetAmount, _ref2$expectedIncomin, expectedIncomingAssetAmount, paths, takeOrderArgs, callArgs;
|
1987
|
+
|
1988
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
1989
|
+
while (1) {
|
1990
|
+
switch (_context.prev = _context.next) {
|
1991
|
+
case 0:
|
1992
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, paraSwapV4Adapter = _ref2.paraSwapV4Adapter, outgoingAsset = _ref2.outgoingAsset, _ref2$outgoingAssetAm = _ref2.outgoingAssetAmount, outgoingAssetAmount = _ref2$outgoingAssetAm === void 0 ? ethers.utils.parseEther('1') : _ref2$outgoingAssetAm, _ref2$minIncomingAsse = _ref2.minIncomingAssetAmount, minIncomingAssetAmount = _ref2$minIncomingAsse === void 0 ? 1 : _ref2$minIncomingAsse, _ref2$expectedIncomin = _ref2.expectedIncomingAssetAmount, expectedIncomingAssetAmount = _ref2$expectedIncomin === void 0 ? minIncomingAssetAmount : _ref2$expectedIncomin, paths = _ref2.paths;
|
1993
|
+
takeOrderArgs = protocol.paraSwapV4TakeOrderArgs({
|
1994
|
+
minIncomingAssetAmount: minIncomingAssetAmount,
|
1995
|
+
expectedIncomingAssetAmount: expectedIncomingAssetAmount,
|
1996
|
+
outgoingAsset: outgoingAsset,
|
1997
|
+
outgoingAssetAmount: outgoingAssetAmount,
|
1998
|
+
paths: paths
|
1999
|
+
});
|
2000
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2001
|
+
adapter: paraSwapV4Adapter,
|
2002
|
+
selector: protocol.takeOrderSelector,
|
2003
|
+
encodedCallArgs: takeOrderArgs
|
2004
|
+
});
|
2005
|
+
return _context.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
2006
|
+
|
2007
|
+
case 4:
|
2008
|
+
case "end":
|
2009
|
+
return _context.stop();
|
2010
|
+
}
|
2011
|
+
}
|
2012
|
+
}, _callee);
|
2013
|
+
}));
|
2014
|
+
return _paraSwapV4TakeOrder.apply(this, arguments);
|
2015
|
+
}
|
2016
|
+
|
2017
|
+
function synthetixAssignExchangeDelegate(_x) {
|
2018
|
+
return _synthetixAssignExchangeDelegate.apply(this, arguments);
|
2019
|
+
}
|
2020
|
+
|
2021
|
+
function _synthetixAssignExchangeDelegate() {
|
2022
|
+
_synthetixAssignExchangeDelegate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2023
|
+
var comptrollerProxy, addressResolver, fundOwner, delegate, delegateApprovals;
|
2024
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2025
|
+
while (1) {
|
2026
|
+
switch (_context.prev = _context.next) {
|
2027
|
+
case 0:
|
2028
|
+
comptrollerProxy = _ref.comptrollerProxy, addressResolver = _ref.addressResolver, fundOwner = _ref.fundOwner, delegate = _ref.delegate;
|
2029
|
+
_context.next = 3;
|
2030
|
+
return synthetixResolveAddress({
|
2031
|
+
addressResolver: addressResolver,
|
2032
|
+
name: 'DelegateApprovals'
|
2033
|
+
});
|
2034
|
+
|
2035
|
+
case 3:
|
2036
|
+
delegateApprovals = _context.sent;
|
2037
|
+
_context.next = 6;
|
2038
|
+
return comptrollerProxy.connect(fundOwner).vaultCallOnContract(delegateApprovals, protocol.synthetixAssignExchangeDelegateSelector, protocol.encodeArgs(['address'], [delegate]));
|
2039
|
+
|
2040
|
+
case 6:
|
2041
|
+
case "end":
|
2042
|
+
return _context.stop();
|
2043
|
+
}
|
2044
|
+
}
|
2045
|
+
}, _callee);
|
2046
|
+
}));
|
2047
|
+
return _synthetixAssignExchangeDelegate.apply(this, arguments);
|
2048
|
+
}
|
2049
|
+
|
2050
|
+
function synthetixResolveAddress(_x2) {
|
2051
|
+
return _synthetixResolveAddress.apply(this, arguments);
|
2052
|
+
}
|
2053
|
+
|
2054
|
+
function _synthetixResolveAddress() {
|
2055
|
+
_synthetixResolveAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
2056
|
+
var addressResolver, name;
|
2057
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2058
|
+
while (1) {
|
2059
|
+
switch (_context2.prev = _context2.next) {
|
2060
|
+
case 0:
|
2061
|
+
addressResolver = _ref2.addressResolver, name = _ref2.name;
|
2062
|
+
return _context2.abrupt("return", addressResolver.requireAndGetAddress(ethers.utils.formatBytes32String(name), "Missing ".concat(name)));
|
2063
|
+
|
2064
|
+
case 2:
|
2065
|
+
case "end":
|
2066
|
+
return _context2.stop();
|
2067
|
+
}
|
2068
|
+
}
|
2069
|
+
}, _callee2);
|
2070
|
+
}));
|
2071
|
+
return _synthetixResolveAddress.apply(this, arguments);
|
2072
|
+
}
|
2073
|
+
|
2074
|
+
function synthetixTakeOrder(_x3) {
|
2075
|
+
return _synthetixTakeOrder.apply(this, arguments);
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
function _synthetixTakeOrder() {
|
2079
|
+
_synthetixTakeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
2080
|
+
var comptrollerProxy, vaultProxy, integrationManager, fundOwner, synthetixAdapter, outgoingAsset, _ref3$outgoingAssetAm, outgoingAssetAmount, incomingAsset, _ref3$minIncomingAsse, minIncomingAssetAmount, _ref3$seedFund, seedFund, takeOrderArgs, callArgs;
|
2081
|
+
|
2082
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
2083
|
+
while (1) {
|
2084
|
+
switch (_context3.prev = _context3.next) {
|
2085
|
+
case 0:
|
2086
|
+
comptrollerProxy = _ref3.comptrollerProxy, vaultProxy = _ref3.vaultProxy, integrationManager = _ref3.integrationManager, fundOwner = _ref3.fundOwner, synthetixAdapter = _ref3.synthetixAdapter, outgoingAsset = _ref3.outgoingAsset, _ref3$outgoingAssetAm = _ref3.outgoingAssetAmount, outgoingAssetAmount = _ref3$outgoingAssetAm === void 0 ? ethers.utils.parseEther('1') : _ref3$outgoingAssetAm, incomingAsset = _ref3.incomingAsset, _ref3$minIncomingAsse = _ref3.minIncomingAssetAmount, minIncomingAssetAmount = _ref3$minIncomingAsse === void 0 ? ethers.utils.parseEther('1') : _ref3$minIncomingAsse, _ref3$seedFund = _ref3.seedFund, seedFund = _ref3$seedFund === void 0 ? false : _ref3$seedFund;
|
2087
|
+
|
2088
|
+
if (!seedFund) {
|
2089
|
+
_context3.next = 4;
|
2090
|
+
break;
|
2091
|
+
}
|
2092
|
+
|
2093
|
+
_context3.next = 4;
|
2094
|
+
return outgoingAsset.transfer(vaultProxy, outgoingAssetAmount);
|
2095
|
+
|
2096
|
+
case 4:
|
2097
|
+
takeOrderArgs = protocol.synthetixTakeOrderArgs({
|
2098
|
+
incomingAsset: incomingAsset,
|
2099
|
+
minIncomingAssetAmount: minIncomingAssetAmount,
|
2100
|
+
outgoingAsset: outgoingAsset,
|
2101
|
+
outgoingAssetAmount: outgoingAssetAmount
|
2102
|
+
});
|
2103
|
+
_context3.next = 7;
|
2104
|
+
return protocol.callOnIntegrationArgs({
|
2105
|
+
adapter: synthetixAdapter,
|
2106
|
+
selector: protocol.takeOrderSelector,
|
2107
|
+
encodedCallArgs: takeOrderArgs
|
2108
|
+
});
|
2109
|
+
|
2110
|
+
case 7:
|
2111
|
+
callArgs = _context3.sent;
|
2112
|
+
return _context3.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
2113
|
+
|
2114
|
+
case 9:
|
2115
|
+
case "end":
|
2116
|
+
return _context3.stop();
|
2117
|
+
}
|
2118
|
+
}
|
2119
|
+
}, _callee3);
|
2120
|
+
}));
|
2121
|
+
return _synthetixTakeOrder.apply(this, arguments);
|
2122
|
+
}
|
2123
|
+
|
2124
|
+
var _templateObject;
|
2125
|
+
var UniswapV2Factory = ethers$1.contract()(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n function createPair(address,address) returns (address)\n function getPair(address,address) view returns (address)\n"])));
|
2126
|
+
function uniswapV2Lend(_x) {
|
2127
|
+
return _uniswapV2Lend.apply(this, arguments);
|
2128
|
+
}
|
2129
|
+
|
2130
|
+
function _uniswapV2Lend() {
|
2131
|
+
_uniswapV2Lend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2132
|
+
var comptrollerProxy, vaultProxy, integrationManager, fundOwner, uniswapV2Adapter, tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin, minPoolTokenAmount, _ref$seedFund, seedFund, lendArgs, callArgs, lendTx;
|
2133
|
+
|
2134
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2135
|
+
while (1) {
|
2136
|
+
switch (_context.prev = _context.next) {
|
2137
|
+
case 0:
|
2138
|
+
comptrollerProxy = _ref.comptrollerProxy, vaultProxy = _ref.vaultProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, uniswapV2Adapter = _ref.uniswapV2Adapter, tokenA = _ref.tokenA, tokenB = _ref.tokenB, amountADesired = _ref.amountADesired, amountBDesired = _ref.amountBDesired, amountAMin = _ref.amountAMin, amountBMin = _ref.amountBMin, minPoolTokenAmount = _ref.minPoolTokenAmount, _ref$seedFund = _ref.seedFund, seedFund = _ref$seedFund === void 0 ? false : _ref$seedFund;
|
2139
|
+
|
2140
|
+
if (!seedFund) {
|
2141
|
+
_context.next = 6;
|
2142
|
+
break;
|
2143
|
+
}
|
2144
|
+
|
2145
|
+
_context.next = 4;
|
2146
|
+
return tokenA.transfer(vaultProxy, amountADesired);
|
2147
|
+
|
2148
|
+
case 4:
|
2149
|
+
_context.next = 6;
|
2150
|
+
return tokenB.transfer(vaultProxy, amountBDesired);
|
2151
|
+
|
2152
|
+
case 6:
|
2153
|
+
lendArgs = protocol.uniswapV2LendArgs({
|
2154
|
+
tokenA: tokenA,
|
2155
|
+
tokenB: tokenB,
|
2156
|
+
amountADesired: amountADesired,
|
2157
|
+
amountBDesired: amountBDesired,
|
2158
|
+
amountAMin: amountAMin,
|
2159
|
+
amountBMin: amountBMin,
|
2160
|
+
minPoolTokenAmount: minPoolTokenAmount
|
2161
|
+
});
|
2162
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2163
|
+
adapter: uniswapV2Adapter,
|
2164
|
+
selector: protocol.lendSelector,
|
2165
|
+
encodedCallArgs: lendArgs
|
2166
|
+
});
|
2167
|
+
lendTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
2168
|
+
_context.next = 11;
|
2169
|
+
return expect(lendTx).resolves.toBeReceipt();
|
2170
|
+
|
2171
|
+
case 11:
|
2172
|
+
return _context.abrupt("return", lendTx);
|
2173
|
+
|
2174
|
+
case 12:
|
2175
|
+
case "end":
|
2176
|
+
return _context.stop();
|
2177
|
+
}
|
2178
|
+
}
|
2179
|
+
}, _callee);
|
2180
|
+
}));
|
2181
|
+
return _uniswapV2Lend.apply(this, arguments);
|
2182
|
+
}
|
2183
|
+
|
2184
|
+
function uniswapV2Redeem(_x2) {
|
2185
|
+
return _uniswapV2Redeem.apply(this, arguments);
|
2186
|
+
}
|
2187
|
+
|
2188
|
+
function _uniswapV2Redeem() {
|
2189
|
+
_uniswapV2Redeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
2190
|
+
var comptrollerProxy, integrationManager, fundOwner, uniswapV2Adapter, poolTokenAmount, tokenA, tokenB, amountAMin, amountBMin, redeemArgs, callArgs, redeemTx;
|
2191
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2192
|
+
while (1) {
|
2193
|
+
switch (_context2.prev = _context2.next) {
|
2194
|
+
case 0:
|
2195
|
+
comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, fundOwner = _ref2.fundOwner, uniswapV2Adapter = _ref2.uniswapV2Adapter, poolTokenAmount = _ref2.poolTokenAmount, tokenA = _ref2.tokenA, tokenB = _ref2.tokenB, amountAMin = _ref2.amountAMin, amountBMin = _ref2.amountBMin;
|
2196
|
+
redeemArgs = protocol.uniswapV2RedeemArgs({
|
2197
|
+
poolTokenAmount: poolTokenAmount,
|
2198
|
+
tokenA: tokenA,
|
2199
|
+
tokenB: tokenB,
|
2200
|
+
amountAMin: amountAMin,
|
2201
|
+
amountBMin: amountBMin
|
2202
|
+
});
|
2203
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2204
|
+
adapter: uniswapV2Adapter,
|
2205
|
+
selector: protocol.redeemSelector,
|
2206
|
+
encodedCallArgs: redeemArgs
|
2207
|
+
});
|
2208
|
+
redeemTx = comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs);
|
2209
|
+
_context2.next = 6;
|
2210
|
+
return expect(redeemTx).resolves.toBeReceipt();
|
2211
|
+
|
2212
|
+
case 6:
|
2213
|
+
return _context2.abrupt("return", redeemTx);
|
2214
|
+
|
2215
|
+
case 7:
|
2216
|
+
case "end":
|
2217
|
+
return _context2.stop();
|
2218
|
+
}
|
2219
|
+
}
|
2220
|
+
}, _callee2);
|
2221
|
+
}));
|
2222
|
+
return _uniswapV2Redeem.apply(this, arguments);
|
2223
|
+
}
|
2224
|
+
|
2225
|
+
function uniswapV2TakeOrder(_x3) {
|
2226
|
+
return _uniswapV2TakeOrder.apply(this, arguments);
|
2227
|
+
}
|
2228
|
+
|
2229
|
+
function _uniswapV2TakeOrder() {
|
2230
|
+
_uniswapV2TakeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
2231
|
+
var comptrollerProxy, vaultProxy, integrationManager, fundOwner, uniswapV2Adapter, path, outgoingAssetAmount, minIncomingAssetAmount, _ref3$seedFund, seedFund, takeOrderArgs, callArgs;
|
2232
|
+
|
2233
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
2234
|
+
while (1) {
|
2235
|
+
switch (_context3.prev = _context3.next) {
|
2236
|
+
case 0:
|
2237
|
+
comptrollerProxy = _ref3.comptrollerProxy, vaultProxy = _ref3.vaultProxy, integrationManager = _ref3.integrationManager, fundOwner = _ref3.fundOwner, uniswapV2Adapter = _ref3.uniswapV2Adapter, path = _ref3.path, outgoingAssetAmount = _ref3.outgoingAssetAmount, minIncomingAssetAmount = _ref3.minIncomingAssetAmount, _ref3$seedFund = _ref3.seedFund, seedFund = _ref3$seedFund === void 0 ? false : _ref3$seedFund;
|
2238
|
+
|
2239
|
+
if (!seedFund) {
|
2240
|
+
_context3.next = 4;
|
2241
|
+
break;
|
2242
|
+
}
|
2243
|
+
|
2244
|
+
_context3.next = 4;
|
2245
|
+
return path[0].transfer(vaultProxy, outgoingAssetAmount);
|
2246
|
+
|
2247
|
+
case 4:
|
2248
|
+
takeOrderArgs = protocol.uniswapV2TakeOrderArgs({
|
2249
|
+
path: path,
|
2250
|
+
outgoingAssetAmount: outgoingAssetAmount,
|
2251
|
+
minIncomingAssetAmount: minIncomingAssetAmount
|
2252
|
+
});
|
2253
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2254
|
+
adapter: uniswapV2Adapter,
|
2255
|
+
selector: protocol.takeOrderSelector,
|
2256
|
+
encodedCallArgs: takeOrderArgs
|
2257
|
+
});
|
2258
|
+
return _context3.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
2259
|
+
|
2260
|
+
case 7:
|
2261
|
+
case "end":
|
2262
|
+
return _context3.stop();
|
2263
|
+
}
|
2264
|
+
}
|
2265
|
+
}, _callee3);
|
2266
|
+
}));
|
2267
|
+
return _uniswapV2TakeOrder.apply(this, arguments);
|
2268
|
+
}
|
2269
|
+
|
2270
|
+
function uniswapV3TakeOrder(_x) {
|
2271
|
+
return _uniswapV3TakeOrder.apply(this, arguments);
|
2272
|
+
}
|
2273
|
+
|
2274
|
+
function _uniswapV3TakeOrder() {
|
2275
|
+
_uniswapV3TakeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2276
|
+
var comptrollerProxy, integrationManager, fundOwner, uniswapV3Adapter, pathAddresses, pathFees, outgoingAssetAmount, _ref$minIncomingAsset, minIncomingAssetAmount, _ref$seedFund, seedFund, takeOrderArgs, callArgs;
|
2277
|
+
|
2278
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2279
|
+
while (1) {
|
2280
|
+
switch (_context.prev = _context.next) {
|
2281
|
+
case 0:
|
2282
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, uniswapV3Adapter = _ref.uniswapV3Adapter, pathAddresses = _ref.pathAddresses, pathFees = _ref.pathFees, outgoingAssetAmount = _ref.outgoingAssetAmount, _ref$minIncomingAsset = _ref.minIncomingAssetAmount, minIncomingAssetAmount = _ref$minIncomingAsset === void 0 ? 1 : _ref$minIncomingAsset, _ref$seedFund = _ref.seedFund, seedFund = _ref$seedFund === void 0 ? false : _ref$seedFund;
|
2283
|
+
|
2284
|
+
if (!seedFund) {
|
2285
|
+
_context.next = 9;
|
2286
|
+
break;
|
2287
|
+
}
|
2288
|
+
|
2289
|
+
_context.t0 = pathAddresses[0];
|
2290
|
+
_context.next = 5;
|
2291
|
+
return comptrollerProxy.getVaultProxy();
|
2292
|
+
|
2293
|
+
case 5:
|
2294
|
+
_context.t1 = _context.sent;
|
2295
|
+
_context.t2 = outgoingAssetAmount;
|
2296
|
+
_context.next = 9;
|
2297
|
+
return _context.t0.transfer.call(_context.t0, _context.t1, _context.t2);
|
2298
|
+
|
2299
|
+
case 9:
|
2300
|
+
takeOrderArgs = protocol.uniswapV3TakeOrderArgs({
|
2301
|
+
pathAddresses: pathAddresses,
|
2302
|
+
pathFees: pathFees,
|
2303
|
+
outgoingAssetAmount: outgoingAssetAmount,
|
2304
|
+
minIncomingAssetAmount: minIncomingAssetAmount
|
2305
|
+
});
|
2306
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2307
|
+
adapter: uniswapV3Adapter,
|
2308
|
+
selector: protocol.takeOrderSelector,
|
2309
|
+
encodedCallArgs: takeOrderArgs
|
2310
|
+
});
|
2311
|
+
return _context.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
2312
|
+
|
2313
|
+
case 12:
|
2314
|
+
case "end":
|
2315
|
+
return _context.stop();
|
2316
|
+
}
|
2317
|
+
}
|
2318
|
+
}, _callee);
|
2319
|
+
}));
|
2320
|
+
return _uniswapV3TakeOrder.apply(this, arguments);
|
2321
|
+
}
|
2322
|
+
|
2323
|
+
function yearnVaultV2Lend(_x) {
|
2324
|
+
return _yearnVaultV2Lend.apply(this, arguments);
|
2325
|
+
}
|
2326
|
+
|
2327
|
+
function _yearnVaultV2Lend() {
|
2328
|
+
_yearnVaultV2Lend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2329
|
+
var signer, comptrollerProxy, integrationManager, yearnVaultV2Adapter, yVault, outgoingUnderlyingAmount, _ref$minIncomingYVaul, minIncomingYVaultSharesAmount, callArgs;
|
2330
|
+
|
2331
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2332
|
+
while (1) {
|
2333
|
+
switch (_context.prev = _context.next) {
|
2334
|
+
case 0:
|
2335
|
+
signer = _ref.signer, comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, yearnVaultV2Adapter = _ref.yearnVaultV2Adapter, yVault = _ref.yVault, outgoingUnderlyingAmount = _ref.outgoingUnderlyingAmount, _ref$minIncomingYVaul = _ref.minIncomingYVaultSharesAmount, minIncomingYVaultSharesAmount = _ref$minIncomingYVaul === void 0 ? ethers.BigNumber.from(1) : _ref$minIncomingYVaul;
|
2336
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2337
|
+
adapter: yearnVaultV2Adapter,
|
2338
|
+
selector: protocol.lendSelector,
|
2339
|
+
encodedCallArgs: protocol.yearnVaultV2LendArgs({
|
2340
|
+
yVault: yVault,
|
2341
|
+
outgoingUnderlyingAmount: outgoingUnderlyingAmount,
|
2342
|
+
minIncomingYVaultSharesAmount: minIncomingYVaultSharesAmount
|
2343
|
+
})
|
2344
|
+
});
|
2345
|
+
return _context.abrupt("return", comptrollerProxy.connect(signer).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
2346
|
+
|
2347
|
+
case 3:
|
2348
|
+
case "end":
|
2349
|
+
return _context.stop();
|
2350
|
+
}
|
2351
|
+
}
|
2352
|
+
}, _callee);
|
2353
|
+
}));
|
2354
|
+
return _yearnVaultV2Lend.apply(this, arguments);
|
2355
|
+
}
|
2356
|
+
|
2357
|
+
function yearnVaultV2Redeem(_x2) {
|
2358
|
+
return _yearnVaultV2Redeem.apply(this, arguments);
|
2359
|
+
}
|
2360
|
+
|
2361
|
+
function _yearnVaultV2Redeem() {
|
2362
|
+
_yearnVaultV2Redeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
2363
|
+
var signer, comptrollerProxy, integrationManager, yearnVaultV2Adapter, yVault, maxOutgoingYVaultSharesAmount, _ref2$minIncomingUnde, minIncomingUnderlyingAmount, _ref2$slippageToleran, slippageToleranceBps, callArgs;
|
2364
|
+
|
2365
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2366
|
+
while (1) {
|
2367
|
+
switch (_context2.prev = _context2.next) {
|
2368
|
+
case 0:
|
2369
|
+
signer = _ref2.signer, comptrollerProxy = _ref2.comptrollerProxy, integrationManager = _ref2.integrationManager, yearnVaultV2Adapter = _ref2.yearnVaultV2Adapter, yVault = _ref2.yVault, maxOutgoingYVaultSharesAmount = _ref2.maxOutgoingYVaultSharesAmount, _ref2$minIncomingUnde = _ref2.minIncomingUnderlyingAmount, minIncomingUnderlyingAmount = _ref2$minIncomingUnde === void 0 ? ethers.BigNumber.from(1) : _ref2$minIncomingUnde, _ref2$slippageToleran = _ref2.slippageToleranceBps, slippageToleranceBps = _ref2$slippageToleran === void 0 ? 1 : _ref2$slippageToleran;
|
2370
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2371
|
+
adapter: yearnVaultV2Adapter,
|
2372
|
+
selector: protocol.redeemSelector,
|
2373
|
+
encodedCallArgs: protocol.yearnVaultV2RedeemArgs({
|
2374
|
+
yVault: yVault,
|
2375
|
+
maxOutgoingYVaultSharesAmount: maxOutgoingYVaultSharesAmount,
|
2376
|
+
minIncomingUnderlyingAmount: minIncomingUnderlyingAmount,
|
2377
|
+
slippageToleranceBps: slippageToleranceBps
|
2378
|
+
})
|
2379
|
+
});
|
2380
|
+
return _context2.abrupt("return", comptrollerProxy.connect(signer).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
2381
|
+
|
2382
|
+
case 3:
|
2383
|
+
case "end":
|
2384
|
+
return _context2.stop();
|
2385
|
+
}
|
2386
|
+
}
|
2387
|
+
}, _callee2);
|
2388
|
+
}));
|
2389
|
+
return _yearnVaultV2Redeem.apply(this, arguments);
|
2390
|
+
}
|
2391
|
+
|
2392
|
+
function zeroExV2TakeOrder(_x) {
|
2393
|
+
return _zeroExV2TakeOrder.apply(this, arguments);
|
2394
|
+
}
|
2395
|
+
|
2396
|
+
function _zeroExV2TakeOrder() {
|
2397
|
+
_zeroExV2TakeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2398
|
+
var comptrollerProxy, integrationManager, fundOwner, zeroExV2Adapter, signedOrder, takerAssetFillAmount, takeOrderArgs, callArgs;
|
2399
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2400
|
+
while (1) {
|
2401
|
+
switch (_context.prev = _context.next) {
|
2402
|
+
case 0:
|
2403
|
+
comptrollerProxy = _ref.comptrollerProxy, integrationManager = _ref.integrationManager, fundOwner = _ref.fundOwner, zeroExV2Adapter = _ref.zeroExV2Adapter, signedOrder = _ref.signedOrder, takerAssetFillAmount = _ref.takerAssetFillAmount;
|
2404
|
+
takeOrderArgs = protocol.zeroExV2TakeOrderArgs({
|
2405
|
+
signedOrder: signedOrder,
|
2406
|
+
takerAssetFillAmount: takerAssetFillAmount
|
2407
|
+
});
|
2408
|
+
callArgs = protocol.callOnIntegrationArgs({
|
2409
|
+
adapter: zeroExV2Adapter,
|
2410
|
+
selector: protocol.takeOrderSelector,
|
2411
|
+
encodedCallArgs: takeOrderArgs
|
2412
|
+
});
|
2413
|
+
return _context.abrupt("return", comptrollerProxy.connect(fundOwner).callOnExtension(integrationManager, protocol.IntegrationManagerActionId.CallOnIntegration, callArgs));
|
2414
|
+
|
2415
|
+
case 4:
|
2416
|
+
case "end":
|
2417
|
+
return _context.stop();
|
2418
|
+
}
|
2419
|
+
}
|
2420
|
+
}, _callee);
|
2421
|
+
}));
|
2422
|
+
return _zeroExV2TakeOrder.apply(this, arguments);
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
function generatePolicyManagerConfigWithMockPolicies(_x) {
|
2426
|
+
return _generatePolicyManagerConfigWithMockPolicies.apply(this, arguments);
|
2427
|
+
}
|
2428
|
+
|
2429
|
+
function _generatePolicyManagerConfigWithMockPolicies() {
|
2430
|
+
_generatePolicyManagerConfigWithMockPolicies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2431
|
+
var deployer, policyManager, policies, policiesSettingsData;
|
2432
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2433
|
+
while (1) {
|
2434
|
+
switch (_context.prev = _context.next) {
|
2435
|
+
case 0:
|
2436
|
+
deployer = _ref.deployer, policyManager = _ref.policyManager;
|
2437
|
+
_context.next = 3;
|
2438
|
+
return generateRegisteredMockPolicies({
|
2439
|
+
deployer: deployer,
|
2440
|
+
policyManager: policyManager
|
2441
|
+
});
|
2442
|
+
|
2443
|
+
case 3:
|
2444
|
+
policies = _context.sent;
|
2445
|
+
policiesSettingsData = [ethers.utils.randomBytes(10), ethers.constants.HashZero, ethers.constants.HashZero, ethers.utils.randomBytes(2)];
|
2446
|
+
return _context.abrupt("return", protocol.policyManagerConfigArgs({
|
2447
|
+
policies: Object.values(policies),
|
2448
|
+
settings: policiesSettingsData
|
2449
|
+
}));
|
2450
|
+
|
2451
|
+
case 6:
|
2452
|
+
case "end":
|
2453
|
+
return _context.stop();
|
2454
|
+
}
|
2455
|
+
}
|
2456
|
+
}, _callee);
|
2457
|
+
}));
|
2458
|
+
return _generatePolicyManagerConfigWithMockPolicies.apply(this, arguments);
|
2459
|
+
}
|
2460
|
+
|
2461
|
+
function generateRegisteredMockPolicies(_x2) {
|
2462
|
+
return _generateRegisteredMockPolicies.apply(this, arguments);
|
2463
|
+
}
|
2464
|
+
|
2465
|
+
function _generateRegisteredMockPolicies() {
|
2466
|
+
_generateRegisteredMockPolicies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
2467
|
+
var deployer, policyManager, mockPreBuySharesPolicy, mockPostBuySharesPolicy, mockPreCoIPolicy, mockPostCoIPolicy;
|
2468
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2469
|
+
while (1) {
|
2470
|
+
switch (_context2.prev = _context2.next) {
|
2471
|
+
case 0:
|
2472
|
+
deployer = _ref2.deployer, policyManager = _ref2.policyManager;
|
2473
|
+
_context2.next = 3;
|
2474
|
+
return protocol.IPolicy.mock(deployer);
|
2475
|
+
|
2476
|
+
case 3:
|
2477
|
+
mockPreBuySharesPolicy = _context2.sent;
|
2478
|
+
_context2.next = 6;
|
2479
|
+
return protocol.IPolicy.mock(deployer);
|
2480
|
+
|
2481
|
+
case 6:
|
2482
|
+
mockPostBuySharesPolicy = _context2.sent;
|
2483
|
+
_context2.next = 9;
|
2484
|
+
return protocol.IPolicy.mock(deployer);
|
2485
|
+
|
2486
|
+
case 9:
|
2487
|
+
mockPreCoIPolicy = _context2.sent;
|
2488
|
+
_context2.next = 12;
|
2489
|
+
return protocol.IPolicy.mock(deployer);
|
2490
|
+
|
2491
|
+
case 12:
|
2492
|
+
mockPostCoIPolicy = _context2.sent;
|
2493
|
+
_context2.next = 15;
|
2494
|
+
return Promise.all([// PreBuyShares
|
2495
|
+
mockPreBuySharesPolicy.identifier.returns("MOCK_PRE_BUY_SHARES"), mockPreBuySharesPolicy.addFundSettings.returns(undefined), mockPreBuySharesPolicy.activateForFund.returns(undefined), mockPreBuySharesPolicy.validateRule.returns(true), mockPreBuySharesPolicy.implementedHooks.returns([protocol.PolicyHook.PreBuyShares]), mockPreBuySharesPolicy.updateFundSettings.returns(undefined), // PostBuyShares
|
2496
|
+
mockPostBuySharesPolicy.identifier.returns("MOCK_POST_BUY_SHARES"), mockPostBuySharesPolicy.addFundSettings.returns(undefined), mockPostBuySharesPolicy.activateForFund.returns(undefined), mockPostBuySharesPolicy.validateRule.returns(true), mockPostBuySharesPolicy.implementedHooks.returns([protocol.PolicyHook.PostBuyShares]), mockPostBuySharesPolicy.updateFundSettings.returns(undefined), // PreCallOnIntegration
|
2497
|
+
mockPreCoIPolicy.identifier.returns("MOCK_PRE_CALL_ON_INTEGRATION"), mockPreCoIPolicy.addFundSettings.returns(undefined), mockPreCoIPolicy.activateForFund.returns(undefined), mockPreCoIPolicy.validateRule.returns(true), mockPreCoIPolicy.implementedHooks.returns([protocol.PolicyHook.PreCallOnIntegration]), mockPreCoIPolicy.updateFundSettings.returns(undefined), // PostCallOnIntegration
|
2498
|
+
mockPostCoIPolicy.identifier.returns("MOCK_POST_CALL_ON_INTEGRATION"), mockPostCoIPolicy.addFundSettings.returns(undefined), mockPostCoIPolicy.activateForFund.returns(undefined), mockPostCoIPolicy.validateRule.returns(true), mockPostCoIPolicy.implementedHooks.returns([protocol.PolicyHook.PostCallOnIntegration]), mockPostCoIPolicy.updateFundSettings.returns(undefined)]);
|
2499
|
+
|
2500
|
+
case 15:
|
2501
|
+
_context2.next = 17;
|
2502
|
+
return policyManager.registerPolicies([mockPreBuySharesPolicy, mockPostBuySharesPolicy, mockPreCoIPolicy, mockPostCoIPolicy]);
|
2503
|
+
|
2504
|
+
case 17:
|
2505
|
+
return _context2.abrupt("return", {
|
2506
|
+
mockPreBuySharesPolicy: mockPreBuySharesPolicy,
|
2507
|
+
mockPostBuySharesPolicy: mockPostBuySharesPolicy,
|
2508
|
+
mockPreCoIPolicy: mockPreCoIPolicy,
|
2509
|
+
mockPostCoIPolicy: mockPostCoIPolicy
|
2510
|
+
});
|
2511
|
+
|
2512
|
+
case 18:
|
2513
|
+
case "end":
|
2514
|
+
return _context2.stop();
|
2515
|
+
}
|
2516
|
+
}
|
2517
|
+
}, _callee2);
|
2518
|
+
}));
|
2519
|
+
return _generateRegisteredMockPolicies.apply(this, arguments);
|
2520
|
+
}
|
2521
|
+
|
2522
|
+
function assertEvent(receipt, event, match) {
|
2523
|
+
var _events$shift;
|
2524
|
+
|
2525
|
+
var events = ethers$1.extractEvent(receipt, event);
|
2526
|
+
expect(events.length).toBe(1);
|
2527
|
+
expect(receipt).toHaveEmittedWith(event, match);
|
2528
|
+
var args = (_events$shift = events.shift()) === null || _events$shift === void 0 ? void 0 : _events$shift.args;
|
2529
|
+
return args;
|
2530
|
+
}
|
2531
|
+
function assertNoEvent(receipt, event) {
|
2532
|
+
var events = ethers$1.extractEvent(receipt, event);
|
2533
|
+
expect(events.length).toBe(0);
|
2534
|
+
}
|
2535
|
+
|
2536
|
+
function createAuthUserExecutedSharesRequestorProxy(_x) {
|
2537
|
+
return _createAuthUserExecutedSharesRequestorProxy.apply(this, arguments);
|
2538
|
+
}
|
2539
|
+
|
2540
|
+
function _createAuthUserExecutedSharesRequestorProxy() {
|
2541
|
+
_createAuthUserExecutedSharesRequestorProxy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2542
|
+
var signer, authUserExecutedSharesRequestorFactory, comptrollerProxy, receipt, sharesRequestorProxyDeployedArgs;
|
2543
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2544
|
+
while (1) {
|
2545
|
+
switch (_context.prev = _context.next) {
|
2546
|
+
case 0:
|
2547
|
+
signer = _ref.signer, authUserExecutedSharesRequestorFactory = _ref.authUserExecutedSharesRequestorFactory, comptrollerProxy = _ref.comptrollerProxy;
|
2548
|
+
_context.next = 3;
|
2549
|
+
return authUserExecutedSharesRequestorFactory.connect(signer).deploySharesRequestorProxy(comptrollerProxy);
|
2550
|
+
|
2551
|
+
case 3:
|
2552
|
+
receipt = _context.sent;
|
2553
|
+
sharesRequestorProxyDeployedArgs = assertEvent(receipt, 'SharesRequestorProxyDeployed', {
|
2554
|
+
comptrollerProxy: comptrollerProxy,
|
2555
|
+
sharesRequestorProxy: expect.any(String)
|
2556
|
+
});
|
2557
|
+
return _context.abrupt("return", {
|
2558
|
+
authUserExecutedSharesRequestorProxy: new protocol.AuthUserExecutedSharesRequestorLib(sharesRequestorProxyDeployedArgs.sharesRequestorProxy, signer),
|
2559
|
+
receipt: receipt
|
2560
|
+
});
|
2561
|
+
|
2562
|
+
case 6:
|
2563
|
+
case "end":
|
2564
|
+
return _context.stop();
|
2565
|
+
}
|
2566
|
+
}
|
2567
|
+
}, _callee);
|
2568
|
+
}));
|
2569
|
+
return _createAuthUserExecutedSharesRequestorProxy.apply(this, arguments);
|
2570
|
+
}
|
2571
|
+
|
2572
|
+
function createAuthUserExecutedSharesRequest(_x2) {
|
2573
|
+
return _createAuthUserExecutedSharesRequest.apply(this, arguments);
|
2574
|
+
}
|
2575
|
+
|
2576
|
+
function _createAuthUserExecutedSharesRequest() {
|
2577
|
+
_createAuthUserExecutedSharesRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
2578
|
+
var buyer, authUserExecutedSharesRequestorProxy, denominationAsset, _ref2$investmentAmoun, investmentAmount, _ref2$minSharesQuanti, minSharesQuantity;
|
2579
|
+
|
2580
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2581
|
+
while (1) {
|
2582
|
+
switch (_context2.prev = _context2.next) {
|
2583
|
+
case 0:
|
2584
|
+
buyer = _ref2.buyer, authUserExecutedSharesRequestorProxy = _ref2.authUserExecutedSharesRequestorProxy, denominationAsset = _ref2.denominationAsset, _ref2$investmentAmoun = _ref2.investmentAmount, investmentAmount = _ref2$investmentAmoun === void 0 ? ethers.utils.parseEther('1') : _ref2$investmentAmoun, _ref2$minSharesQuanti = _ref2.minSharesQuantity, minSharesQuantity = _ref2$minSharesQuanti === void 0 ? investmentAmount : _ref2$minSharesQuanti;
|
2585
|
+
_context2.next = 3;
|
2586
|
+
return denominationAsset.connect(buyer).approve(authUserExecutedSharesRequestorProxy, investmentAmount);
|
2587
|
+
|
2588
|
+
case 3:
|
2589
|
+
return _context2.abrupt("return", authUserExecutedSharesRequestorProxy.connect(buyer).createRequest(investmentAmount, minSharesQuantity));
|
2590
|
+
|
2591
|
+
case 4:
|
2592
|
+
case "end":
|
2593
|
+
return _context2.stop();
|
2594
|
+
}
|
2595
|
+
}
|
2596
|
+
}, _callee2);
|
2597
|
+
}));
|
2598
|
+
return _createAuthUserExecutedSharesRequest.apply(this, arguments);
|
2599
|
+
}
|
2600
|
+
|
2601
|
+
function buyShares(_x) {
|
2602
|
+
return _buyShares.apply(this, arguments);
|
2603
|
+
}
|
2604
|
+
|
2605
|
+
function _buyShares() {
|
2606
|
+
_buyShares = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2607
|
+
var comptrollerProxy, signer, buyers, denominationAsset, _ref$investmentAmount, investmentAmounts, _ref$minSharesAmounts, minSharesAmounts, totalInvestmentAmount, callerDenominationAsset, callerComptrollerProxy;
|
2608
|
+
|
2609
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2610
|
+
while (1) {
|
2611
|
+
switch (_context.prev = _context.next) {
|
2612
|
+
case 0:
|
2613
|
+
comptrollerProxy = _ref.comptrollerProxy, signer = _ref.signer, buyers = _ref.buyers, denominationAsset = _ref.denominationAsset, _ref$investmentAmount = _ref.investmentAmounts, investmentAmounts = _ref$investmentAmount === void 0 ? new Array(buyers.length).fill(ethers.utils.parseEther('1')) : _ref$investmentAmount, _ref$minSharesAmounts = _ref.minSharesAmounts, minSharesAmounts = _ref$minSharesAmounts === void 0 ? investmentAmounts : _ref$minSharesAmounts;
|
2614
|
+
totalInvestmentAmount = investmentAmounts.reduce(function (total, amount) {
|
2615
|
+
return total.add(amount);
|
2616
|
+
}, ethers.constants.Zero);
|
2617
|
+
callerDenominationAsset = denominationAsset.connect(signer);
|
2618
|
+
_context.next = 5;
|
2619
|
+
return callerDenominationAsset.approve(comptrollerProxy, totalInvestmentAmount);
|
2620
|
+
|
2621
|
+
case 5:
|
2622
|
+
callerComptrollerProxy = comptrollerProxy.connect(signer);
|
2623
|
+
return _context.abrupt("return", callerComptrollerProxy.buyShares(buyers, investmentAmounts, minSharesAmounts));
|
2624
|
+
|
2625
|
+
case 7:
|
2626
|
+
case "end":
|
2627
|
+
return _context.stop();
|
2628
|
+
}
|
2629
|
+
}
|
2630
|
+
}, _callee);
|
2631
|
+
}));
|
2632
|
+
return _buyShares.apply(this, arguments);
|
2633
|
+
}
|
2634
|
+
|
2635
|
+
function redeemShares(_x2) {
|
2636
|
+
return _redeemShares.apply(this, arguments);
|
2637
|
+
}
|
2638
|
+
|
2639
|
+
function _redeemShares() {
|
2640
|
+
_redeemShares = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
2641
|
+
var comptrollerProxy, signer, quantity, _ref2$additionalAsset, additionalAssets, _ref2$assetsToSkip, assetsToSkip;
|
2642
|
+
|
2643
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2644
|
+
while (1) {
|
2645
|
+
switch (_context2.prev = _context2.next) {
|
2646
|
+
case 0:
|
2647
|
+
comptrollerProxy = _ref2.comptrollerProxy, signer = _ref2.signer, quantity = _ref2.quantity, _ref2$additionalAsset = _ref2.additionalAssets, additionalAssets = _ref2$additionalAsset === void 0 ? [] : _ref2$additionalAsset, _ref2$assetsToSkip = _ref2.assetsToSkip, assetsToSkip = _ref2$assetsToSkip === void 0 ? [] : _ref2$assetsToSkip;
|
2648
|
+
|
2649
|
+
if (!(quantity == undefined)) {
|
2650
|
+
_context2.next = 7;
|
2651
|
+
break;
|
2652
|
+
}
|
2653
|
+
|
2654
|
+
if (!(additionalAssets.length > 0 || assetsToSkip.length > 0)) {
|
2655
|
+
_context2.next = 4;
|
2656
|
+
break;
|
2657
|
+
}
|
2658
|
+
|
2659
|
+
throw 'Must specify shares quantity if specifying additional assets or assets to skip';
|
2660
|
+
|
2661
|
+
case 4:
|
2662
|
+
return _context2.abrupt("return", comptrollerProxy.connect(signer).redeemShares());
|
2663
|
+
|
2664
|
+
case 7:
|
2665
|
+
return _context2.abrupt("return", comptrollerProxy.connect(signer).redeemSharesDetailed(quantity, additionalAssets, assetsToSkip));
|
2666
|
+
|
2667
|
+
case 8:
|
2668
|
+
case "end":
|
2669
|
+
return _context2.stop();
|
2670
|
+
}
|
2671
|
+
}
|
2672
|
+
}, _callee2);
|
2673
|
+
}));
|
2674
|
+
return _redeemShares.apply(this, arguments);
|
2675
|
+
}
|
2676
|
+
|
2677
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2678
|
+
|
2679
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2680
|
+
function createComptrollerProxy(_x) {
|
2681
|
+
return _createComptrollerProxy.apply(this, arguments);
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
function _createComptrollerProxy() {
|
2685
|
+
_createComptrollerProxy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(_ref) {
|
2686
|
+
var signer, comptrollerLib, denominationAsset, _ref$sharesActionTime, sharesActionTimelock, constructData, comptrollerProxyContract;
|
2687
|
+
|
2688
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2689
|
+
while (1) {
|
2690
|
+
switch (_context.prev = _context.next) {
|
2691
|
+
case 0:
|
2692
|
+
signer = _ref.signer, comptrollerLib = _ref.comptrollerLib, denominationAsset = _ref.denominationAsset, _ref$sharesActionTime = _ref.sharesActionTimelock, sharesActionTimelock = _ref$sharesActionTime === void 0 ? 0 : _ref$sharesActionTime;
|
2693
|
+
constructData = protocol.encodeFunctionData(comptrollerLib.init.fragment, [denominationAsset, sharesActionTimelock]);
|
2694
|
+
_context.next = 4;
|
2695
|
+
return protocol.ComptrollerProxy.deploy(signer, constructData, comptrollerLib);
|
2696
|
+
|
2697
|
+
case 4:
|
2698
|
+
comptrollerProxyContract = _context.sent;
|
2699
|
+
return _context.abrupt("return", {
|
2700
|
+
comptrollerProxy: new protocol.ComptrollerLib(comptrollerProxyContract, signer),
|
2701
|
+
receipt: comptrollerProxyContract.deployment
|
2702
|
+
});
|
2703
|
+
|
2704
|
+
case 6:
|
2705
|
+
case "end":
|
2706
|
+
return _context.stop();
|
2707
|
+
}
|
2708
|
+
}
|
2709
|
+
}, _callee);
|
2710
|
+
}));
|
2711
|
+
return _createComptrollerProxy.apply(this, arguments);
|
2712
|
+
}
|
2713
|
+
|
2714
|
+
function createMigratedFundConfig(_x2) {
|
2715
|
+
return _createMigratedFundConfig.apply(this, arguments);
|
2716
|
+
} // TODO: should we pass in the fundOwner as a signer also so we can connect comptroller proxy and vault proxy to that acct instead?
|
2717
|
+
|
2718
|
+
function _createMigratedFundConfig() {
|
2719
|
+
_createMigratedFundConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(_ref2) {
|
2720
|
+
var signer, fundDeployer, denominationAsset, _ref2$sharesActionTim, sharesActionTimelock, _ref2$feeManagerConfi, feeManagerConfigData, _ref2$policyManagerCo, policyManagerConfigData, receipt, comptrollerDeployedArgs;
|
2721
|
+
|
2722
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2723
|
+
while (1) {
|
2724
|
+
switch (_context2.prev = _context2.next) {
|
2725
|
+
case 0:
|
2726
|
+
signer = _ref2.signer, fundDeployer = _ref2.fundDeployer, denominationAsset = _ref2.denominationAsset, _ref2$sharesActionTim = _ref2.sharesActionTimelock, sharesActionTimelock = _ref2$sharesActionTim === void 0 ? 0 : _ref2$sharesActionTim, _ref2$feeManagerConfi = _ref2.feeManagerConfigData, feeManagerConfigData = _ref2$feeManagerConfi === void 0 ? '0x' : _ref2$feeManagerConfi, _ref2$policyManagerCo = _ref2.policyManagerConfigData, policyManagerConfigData = _ref2$policyManagerCo === void 0 ? '0x' : _ref2$policyManagerCo;
|
2727
|
+
_context2.next = 3;
|
2728
|
+
return fundDeployer.connect(signer).createMigratedFundConfig(denominationAsset, sharesActionTimelock, feeManagerConfigData, policyManagerConfigData);
|
2729
|
+
|
2730
|
+
case 3:
|
2731
|
+
receipt = _context2.sent;
|
2732
|
+
comptrollerDeployedArgs = assertEvent(receipt, 'ComptrollerProxyDeployed', {
|
2733
|
+
creator: signer,
|
2734
|
+
comptrollerProxy: expect.any(String),
|
2735
|
+
denominationAsset: denominationAsset,
|
2736
|
+
sharesActionTimelock: ethers.BigNumber.from(sharesActionTimelock),
|
2737
|
+
feeManagerConfigData: ethers.utils.hexlify(feeManagerConfigData),
|
2738
|
+
policyManagerConfigData: ethers.utils.hexlify(policyManagerConfigData),
|
2739
|
+
forMigration: true
|
2740
|
+
});
|
2741
|
+
return _context2.abrupt("return", {
|
2742
|
+
receipt: receipt,
|
2743
|
+
comptrollerProxy: new protocol.ComptrollerLib(comptrollerDeployedArgs.comptrollerProxy, signer)
|
2744
|
+
});
|
2745
|
+
|
2746
|
+
case 6:
|
2747
|
+
case "end":
|
2748
|
+
return _context2.stop();
|
2749
|
+
}
|
2750
|
+
}
|
2751
|
+
}, _callee2);
|
2752
|
+
}));
|
2753
|
+
return _createMigratedFundConfig.apply(this, arguments);
|
2754
|
+
}
|
2755
|
+
|
2756
|
+
function createNewFund(_x3) {
|
2757
|
+
return _createNewFund.apply(this, arguments);
|
2758
|
+
}
|
2759
|
+
|
2760
|
+
function _createNewFund() {
|
2761
|
+
_createNewFund = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
2762
|
+
var signer, fundDeployer, denominationAsset, _ref3$sharesActionTim, sharesActionTimelock, _ref3$fundOwner, fundOwner, _ref3$fundName, fundName, _ref3$feeManagerConfi, feeManagerConfig, _ref3$policyManagerCo, policyManagerConfig, investment, receipt, comptrollerDeployedArgs, comptrollerProxy, newFundDeployedArgs, vaultProxy;
|
2763
|
+
|
2764
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
2765
|
+
while (1) {
|
2766
|
+
switch (_context3.prev = _context3.next) {
|
2767
|
+
case 0:
|
2768
|
+
signer = _ref3.signer, fundDeployer = _ref3.fundDeployer, denominationAsset = _ref3.denominationAsset, _ref3$sharesActionTim = _ref3.sharesActionTimelock, sharesActionTimelock = _ref3$sharesActionTim === void 0 ? 0 : _ref3$sharesActionTim, _ref3$fundOwner = _ref3.fundOwner, fundOwner = _ref3$fundOwner === void 0 ? ethers$1.randomAddress() : _ref3$fundOwner, _ref3$fundName = _ref3.fundName, fundName = _ref3$fundName === void 0 ? 'My Fund' : _ref3$fundName, _ref3$feeManagerConfi = _ref3.feeManagerConfig, feeManagerConfig = _ref3$feeManagerConfi === void 0 ? '0x' : _ref3$feeManagerConfi, _ref3$policyManagerCo = _ref3.policyManagerConfig, policyManagerConfig = _ref3$policyManagerCo === void 0 ? '0x' : _ref3$policyManagerCo, investment = _ref3.investment;
|
2769
|
+
_context3.next = 3;
|
2770
|
+
return fundDeployer.connect(signer).createNewFund(fundOwner, fundName, denominationAsset, sharesActionTimelock, feeManagerConfig, policyManagerConfig);
|
2771
|
+
|
2772
|
+
case 3:
|
2773
|
+
receipt = _context3.sent;
|
2774
|
+
comptrollerDeployedArgs = assertEvent(receipt, 'ComptrollerProxyDeployed', {
|
2775
|
+
creator: signer,
|
2776
|
+
comptrollerProxy: expect.any(String),
|
2777
|
+
denominationAsset: denominationAsset,
|
2778
|
+
sharesActionTimelock: ethers.BigNumber.from(sharesActionTimelock),
|
2779
|
+
feeManagerConfigData: ethers.utils.hexlify(feeManagerConfig),
|
2780
|
+
policyManagerConfigData: ethers.utils.hexlify(policyManagerConfig),
|
2781
|
+
forMigration: false
|
2782
|
+
});
|
2783
|
+
comptrollerProxy = new protocol.ComptrollerLib(comptrollerDeployedArgs.comptrollerProxy, signer);
|
2784
|
+
newFundDeployedArgs = assertEvent(receipt, 'NewFundCreated', {
|
2785
|
+
creator: signer,
|
2786
|
+
comptrollerProxy: comptrollerProxy,
|
2787
|
+
vaultProxy: expect.any(String),
|
2788
|
+
fundOwner: fundOwner,
|
2789
|
+
fundName: fundName,
|
2790
|
+
denominationAsset: denominationAsset,
|
2791
|
+
sharesActionTimelock: ethers.BigNumber.from(sharesActionTimelock),
|
2792
|
+
feeManagerConfigData: ethers.utils.hexlify(feeManagerConfig),
|
2793
|
+
policyManagerConfigData: ethers.utils.hexlify(policyManagerConfig)
|
2794
|
+
});
|
2795
|
+
vaultProxy = new protocol.VaultLib(newFundDeployedArgs.vaultProxy, signer);
|
2796
|
+
|
2797
|
+
if (!(investment != null)) {
|
2798
|
+
_context3.next = 11;
|
2799
|
+
break;
|
2800
|
+
}
|
2801
|
+
|
2802
|
+
_context3.next = 11;
|
2803
|
+
return buyShares(_objectSpread$1({
|
2804
|
+
comptrollerProxy: comptrollerProxy,
|
2805
|
+
denominationAsset: denominationAsset
|
2806
|
+
}, investment));
|
2807
|
+
|
2808
|
+
case 11:
|
2809
|
+
return _context3.abrupt("return", {
|
2810
|
+
comptrollerProxy: comptrollerProxy,
|
2811
|
+
receipt: receipt,
|
2812
|
+
vaultProxy: vaultProxy
|
2813
|
+
});
|
2814
|
+
|
2815
|
+
case 12:
|
2816
|
+
case "end":
|
2817
|
+
return _context3.stop();
|
2818
|
+
}
|
2819
|
+
}
|
2820
|
+
}, _callee3);
|
2821
|
+
}));
|
2822
|
+
return _createNewFund.apply(this, arguments);
|
2823
|
+
}
|
2824
|
+
|
2825
|
+
function vaultCallCurveMinterMint(_ref) {
|
2826
|
+
var comptrollerProxy = _ref.comptrollerProxy,
|
2827
|
+
minter = _ref.minter,
|
2828
|
+
gauge = _ref.gauge;
|
2829
|
+
return comptrollerProxy.vaultCallOnContract(minter, protocol.curveMinterMintSelector, protocol.encodeArgs(['address'], [gauge]));
|
2830
|
+
}
|
2831
|
+
function vaultCallCurveMinterMintMany(_ref2) {
|
2832
|
+
var comptrollerProxy = _ref2.comptrollerProxy,
|
2833
|
+
minter = _ref2.minter,
|
2834
|
+
gauges = _ref2.gauges;
|
2835
|
+
var gaugesFormatted = new Array(8).fill(ethers.constants.AddressZero);
|
2836
|
+
|
2837
|
+
for (var i in gauges) {
|
2838
|
+
gaugesFormatted[i] = gauges[i];
|
2839
|
+
}
|
2840
|
+
|
2841
|
+
return comptrollerProxy.vaultCallOnContract(minter, protocol.curveMinterMintManySelector, protocol.encodeArgs(['address[8]'], [gaugesFormatted]));
|
2842
|
+
}
|
2843
|
+
function vaultCallCurveMinterToggleApproveMint(_ref3) {
|
2844
|
+
var comptrollerProxy = _ref3.comptrollerProxy,
|
2845
|
+
minter = _ref3.minter,
|
2846
|
+
account = _ref3.account;
|
2847
|
+
return comptrollerProxy.vaultCallOnContract(minter, protocol.curveMinterToggleApproveMintSelector, protocol.encodeArgs(['address'], [account]));
|
2848
|
+
}
|
2849
|
+
|
2850
|
+
function transactionTimestamp(_x) {
|
2851
|
+
return _transactionTimestamp.apply(this, arguments);
|
2852
|
+
}
|
2853
|
+
|
2854
|
+
function _transactionTimestamp() {
|
2855
|
+
_transactionTimestamp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(receipt) {
|
2856
|
+
var block;
|
2857
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2858
|
+
while (1) {
|
2859
|
+
switch (_context.prev = _context.next) {
|
2860
|
+
case 0:
|
2861
|
+
_context.next = 2;
|
2862
|
+
return provider.getBlock(receipt.blockNumber);
|
2863
|
+
|
2864
|
+
case 2:
|
2865
|
+
block = _context.sent;
|
2866
|
+
return _context.abrupt("return", block.timestamp);
|
2867
|
+
|
2868
|
+
case 4:
|
2869
|
+
case "end":
|
2870
|
+
return _context.stop();
|
2871
|
+
}
|
2872
|
+
}
|
2873
|
+
}, _callee);
|
2874
|
+
}));
|
2875
|
+
return _transactionTimestamp.apply(this, arguments);
|
2876
|
+
}
|
2877
|
+
|
2878
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2879
|
+
|
2880
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2881
|
+
var whales = {
|
2882
|
+
adai: '0x62e41b1185023bcc14a465d350e1dde341557925',
|
2883
|
+
ausdc: '0x3ddfa8ec3052539b6c9549f12cea2c295cff5296',
|
2884
|
+
bat: '0x12274c71304bc0e6b38a56b94d2949b118feb838',
|
2885
|
+
bnb: '0xbe0eb53f46cd790cd13851d5eff43d12404d33e8',
|
2886
|
+
bnt: '0xbe0eb53f46cd790cd13851d5eff43d12404d33e8',
|
2887
|
+
comp: '0xC89b6f0146642688bb254bF93C28fcCF1E182C81',
|
2888
|
+
crv: '0x4ce799e6eD8D64536b67dD428565d52A531B3640',
|
2889
|
+
dai: '0x16463c0fdb6ba9618909f5b120ea1581618c1b9e',
|
2890
|
+
knc: '0x9d1167df52328db20d5d77288dce6ae3ef3a3e1f',
|
2891
|
+
ldo: '0x3dba737ccc50a32a1764b493285dd51c8af6c278',
|
2892
|
+
link: '0xbe6977e08d4479c0a6777539ae0e8fa27be4e9d6',
|
2893
|
+
mana: '0xefb94ac00f1cee8a89d5c3f49faa799da6f03024',
|
2894
|
+
mln: '0xd8f8a53945bcfbbc19da162aa405e662ef71c40d',
|
2895
|
+
repv2: '0x5d65a134fd84b724c34703b88b20b0d84d22d918',
|
2896
|
+
ren: '0xbe0eb53f46cd790cd13851d5eff43d12404d33e8',
|
2897
|
+
uni: '0x47173b170c64d16393a52e6c480b3ad8c302ba1e',
|
2898
|
+
usdc: '0xae2d4617c862309a3d75a0ffb358c7a5009c673f',
|
2899
|
+
usdt: '0x5041ed759dd4afc3a72b8192c143f72f4724081a',
|
2900
|
+
weth: '0xe08A8b19e5722a201EaF20A6BC595eF655397bd5',
|
2901
|
+
zrx: '0x206376e8940e42538781cd94ef024df3c1e0fd43',
|
2902
|
+
cbat: '0x285306442cd985cab2c30515cfdab106fca7bc44',
|
2903
|
+
ccomp: '0xd74f186194ab9219fafac5c2fe4b3270169666db',
|
2904
|
+
cdai: '0x2bddEd18E2CA464355091266B7616956944ee7eE',
|
2905
|
+
ceth: '0xdb5aa12ad695ef2a28c6cdb69f2bb04bed20a48e',
|
2906
|
+
crep: '0xc2386de1b7271a87b416f4605d500846e826a185',
|
2907
|
+
cuni: '0x767ecb395def19ab8d1b2fcc89b3ddfbed28fd6b',
|
2908
|
+
cusdc: '0x9b4772e59385ec732bccb06018e318b7b3477459',
|
2909
|
+
czrx: '0x57ca561798413a20508b6bc997481e784f3e6e5f',
|
2910
|
+
seth: '0xc34a7c65aa08cb36744bda8eeec7b8e9891e147c',
|
2911
|
+
seur: '0xca17ef1925d49931918e3fde7aa4516a3a4958c4',
|
2912
|
+
susd: '0x49BE88F0fcC3A8393a59d3688480d7D253C37D2A',
|
2913
|
+
lidoSteth: '0x31f644e2dd5d74f5c8d6d9de89dd517474d51800',
|
2914
|
+
eurs: '0x98ed26de6451db36246672df78ae7c50f2c76f6d',
|
2915
|
+
idle: '0x34aaa3d5a73d6f9594326d0422ce69748f09b14f'
|
2916
|
+
};
|
2917
|
+
function unlockWhale(_x) {
|
2918
|
+
return _unlockWhale.apply(this, arguments);
|
2919
|
+
}
|
2920
|
+
|
2921
|
+
function _unlockWhale() {
|
2922
|
+
_unlockWhale = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(token) {
|
2923
|
+
var address;
|
2924
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
2925
|
+
while (1) {
|
2926
|
+
switch (_context.prev = _context.next) {
|
2927
|
+
case 0:
|
2928
|
+
address = ethers$1.resolveAddress(whales[token]);
|
2929
|
+
_context.next = 3;
|
2930
|
+
return provider.send('hardhat_impersonateAccount', [address]);
|
2931
|
+
|
2932
|
+
case 3:
|
2933
|
+
return _context.abrupt("return", provider.getSignerWithAddress(address));
|
2934
|
+
|
2935
|
+
case 4:
|
2936
|
+
case "end":
|
2937
|
+
return _context.stop();
|
2938
|
+
}
|
2939
|
+
}
|
2940
|
+
}, _callee);
|
2941
|
+
}));
|
2942
|
+
return _unlockWhale.apply(this, arguments);
|
2943
|
+
}
|
2944
|
+
|
2945
|
+
function unlockAllWhales() {
|
2946
|
+
return _unlockAllWhales.apply(this, arguments);
|
2947
|
+
}
|
2948
|
+
|
2949
|
+
function _unlockAllWhales() {
|
2950
|
+
_unlockAllWhales = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3() {
|
2951
|
+
var keys, signers;
|
2952
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
2953
|
+
while (1) {
|
2954
|
+
switch (_context3.prev = _context3.next) {
|
2955
|
+
case 0:
|
2956
|
+
keys = Object.keys(whales);
|
2957
|
+
_context3.next = 3;
|
2958
|
+
return Promise.all(keys.map( /*#__PURE__*/function () {
|
2959
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(token) {
|
2960
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
2961
|
+
while (1) {
|
2962
|
+
switch (_context2.prev = _context2.next) {
|
2963
|
+
case 0:
|
2964
|
+
return _context2.abrupt("return", unlockWhale(token));
|
2965
|
+
|
2966
|
+
case 1:
|
2967
|
+
case "end":
|
2968
|
+
return _context2.stop();
|
2969
|
+
}
|
2970
|
+
}
|
2971
|
+
}, _callee2);
|
2972
|
+
}));
|
2973
|
+
|
2974
|
+
return function (_x2) {
|
2975
|
+
return _ref.apply(this, arguments);
|
2976
|
+
};
|
2977
|
+
}()));
|
2978
|
+
|
2979
|
+
case 3:
|
2980
|
+
signers = _context3.sent;
|
2981
|
+
return _context3.abrupt("return", keys.reduce(function (carry, key, index) {
|
2982
|
+
return _objectSpread(_objectSpread({}, carry), {}, _defineProperty({}, key, signers[index]));
|
2983
|
+
}, {}));
|
2984
|
+
|
2985
|
+
case 5:
|
2986
|
+
case "end":
|
2987
|
+
return _context3.stop();
|
2988
|
+
}
|
2989
|
+
}
|
2990
|
+
}, _callee3);
|
2991
|
+
}));
|
2992
|
+
return _unlockAllWhales.apply(this, arguments);
|
2993
|
+
}
|
2994
|
+
|
2995
|
+
function unlockWhales() {
|
2996
|
+
return _unlockWhales.apply(this, arguments);
|
2997
|
+
}
|
2998
|
+
|
2999
|
+
function _unlockWhales() {
|
3000
|
+
_unlockWhales = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5() {
|
3001
|
+
var _len,
|
3002
|
+
tokens,
|
3003
|
+
_key,
|
3004
|
+
signers,
|
3005
|
+
_args5 = arguments;
|
3006
|
+
|
3007
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
3008
|
+
while (1) {
|
3009
|
+
switch (_context5.prev = _context5.next) {
|
3010
|
+
case 0:
|
3011
|
+
for (_len = _args5.length, tokens = new Array(_len), _key = 0; _key < _len; _key++) {
|
3012
|
+
tokens[_key] = _args5[_key];
|
3013
|
+
}
|
3014
|
+
|
3015
|
+
_context5.next = 3;
|
3016
|
+
return Promise.all(tokens.map( /*#__PURE__*/function () {
|
3017
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(token) {
|
3018
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
3019
|
+
while (1) {
|
3020
|
+
switch (_context4.prev = _context4.next) {
|
3021
|
+
case 0:
|
3022
|
+
return _context4.abrupt("return", unlockWhale(token));
|
3023
|
+
|
3024
|
+
case 1:
|
3025
|
+
case "end":
|
3026
|
+
return _context4.stop();
|
3027
|
+
}
|
3028
|
+
}
|
3029
|
+
}, _callee4);
|
3030
|
+
}));
|
3031
|
+
|
3032
|
+
return function (_x3) {
|
3033
|
+
return _ref2.apply(this, arguments);
|
3034
|
+
};
|
3035
|
+
}()));
|
3036
|
+
|
3037
|
+
case 3:
|
3038
|
+
signers = _context5.sent;
|
3039
|
+
return _context5.abrupt("return", tokens.reduce(function (carry, key, index) {
|
3040
|
+
return _objectSpread(_objectSpread({}, carry), {}, _defineProperty({}, key, signers[index]));
|
3041
|
+
}, {}));
|
3042
|
+
|
3043
|
+
case 5:
|
3044
|
+
case "end":
|
3045
|
+
return _context5.stop();
|
3046
|
+
}
|
3047
|
+
}
|
3048
|
+
}, _callee5);
|
3049
|
+
}));
|
3050
|
+
return _unlockWhales.apply(this, arguments);
|
3051
|
+
}
|
3052
|
+
|
3053
|
+
exports.AlphaHomoraV1Bank = AlphaHomoraV1Bank;
|
3054
|
+
exports.AlphaHomoraV1BankConfig = AlphaHomoraV1BankConfig;
|
3055
|
+
exports.CurveLiquidityGaugeV2 = CurveLiquidityGaugeV2;
|
3056
|
+
exports.CurveMinter = CurveMinter;
|
3057
|
+
exports.CurveSwaps = CurveSwaps;
|
3058
|
+
exports.ICompoundComptroller = ICompoundComptroller;
|
3059
|
+
exports.KyberNetworkProxy = KyberNetworkProxy;
|
3060
|
+
exports.UniswapV2Factory = UniswapV2Factory;
|
3061
|
+
exports.aaveLend = aaveLend;
|
3062
|
+
exports.aaveRedeem = aaveRedeem;
|
3063
|
+
exports.addNewAssetsToFund = addNewAssetsToFund;
|
3064
|
+
exports.addTrackedAssets = addTrackedAssets;
|
3065
|
+
exports.alphaHomoraV1Lend = alphaHomoraV1Lend;
|
3066
|
+
exports.alphaHomoraV1Redeem = alphaHomoraV1Redeem;
|
3067
|
+
exports.assertEvent = assertEvent;
|
3068
|
+
exports.assertNoEvent = assertNoEvent;
|
3069
|
+
exports.buyShares = buyShares;
|
3070
|
+
exports.calcAlphaBankLiveTotalEth = calcAlphaBankLiveTotalEth;
|
3071
|
+
exports.callOnExtension = callOnExtension;
|
3072
|
+
exports.compoundLend = compoundLend;
|
3073
|
+
exports.compoundRedeem = compoundRedeem;
|
3074
|
+
exports.createAuthUserExecutedSharesRequest = createAuthUserExecutedSharesRequest;
|
3075
|
+
exports.createAuthUserExecutedSharesRequestorProxy = createAuthUserExecutedSharesRequestorProxy;
|
3076
|
+
exports.createComptrollerProxy = createComptrollerProxy;
|
3077
|
+
exports.createFundDeployer = createFundDeployer;
|
3078
|
+
exports.createMigratedFundConfig = createMigratedFundConfig;
|
3079
|
+
exports.createNewFund = createNewFund;
|
3080
|
+
exports.curveAaveClaimRewards = curveAaveClaimRewards;
|
3081
|
+
exports.curveAaveClaimRewardsAndReinvest = curveAaveClaimRewardsAndReinvest;
|
3082
|
+
exports.curveAaveClaimRewardsAndSwap = curveAaveClaimRewardsAndSwap;
|
3083
|
+
exports.curveAaveLend = curveAaveLend;
|
3084
|
+
exports.curveAaveLendAndStake = curveAaveLendAndStake;
|
3085
|
+
exports.curveAaveRedeem = curveAaveRedeem;
|
3086
|
+
exports.curveAaveStake = curveAaveStake;
|
3087
|
+
exports.curveAaveUnstake = curveAaveUnstake;
|
3088
|
+
exports.curveAaveUnstakeAndRedeem = curveAaveUnstakeAndRedeem;
|
3089
|
+
exports.curveApproveAssets = curveApproveAssets;
|
3090
|
+
exports.curveEursClaimRewards = curveEursClaimRewards;
|
3091
|
+
exports.curveEursLend = curveEursLend;
|
3092
|
+
exports.curveEursLendAndStake = curveEursLendAndStake;
|
3093
|
+
exports.curveEursRedeem = curveEursRedeem;
|
3094
|
+
exports.curveEursStake = curveEursStake;
|
3095
|
+
exports.curveEursUnstake = curveEursUnstake;
|
3096
|
+
exports.curveEursUnstakeAndRedeem = curveEursUnstakeAndRedeem;
|
3097
|
+
exports.curveSethClaimRewards = curveSethClaimRewards;
|
3098
|
+
exports.curveSethClaimRewardsAndReinvest = curveSethClaimRewardsAndReinvest;
|
3099
|
+
exports.curveSethClaimRewardsAndSwap = curveSethClaimRewardsAndSwap;
|
3100
|
+
exports.curveSethLend = curveSethLend;
|
3101
|
+
exports.curveSethLendAndStake = curveSethLendAndStake;
|
3102
|
+
exports.curveSethRedeem = curveSethRedeem;
|
3103
|
+
exports.curveSethStake = curveSethStake;
|
3104
|
+
exports.curveSethUnstake = curveSethUnstake;
|
3105
|
+
exports.curveSethUnstakeAndRedeem = curveSethUnstakeAndRedeem;
|
3106
|
+
exports.curveStethClaimRewards = curveStethClaimRewards;
|
3107
|
+
exports.curveStethClaimRewardsAndReinvest = curveStethClaimRewardsAndReinvest;
|
3108
|
+
exports.curveStethClaimRewardsAndSwap = curveStethClaimRewardsAndSwap;
|
3109
|
+
exports.curveStethLend = curveStethLend;
|
3110
|
+
exports.curveStethLendAndStake = curveStethLendAndStake;
|
3111
|
+
exports.curveStethRedeem = curveStethRedeem;
|
3112
|
+
exports.curveStethStake = curveStethStake;
|
3113
|
+
exports.curveStethUnstake = curveStethUnstake;
|
3114
|
+
exports.curveStethUnstakeAndRedeem = curveStethUnstakeAndRedeem;
|
3115
|
+
exports.curveTakeOrder = curveTakeOrder;
|
3116
|
+
exports.defaultTestDeployment = defaultTestDeployment;
|
3117
|
+
exports.deployProtocolFixture = deployProtocolFixture;
|
3118
|
+
exports.generateFeeManagerConfigWithMockFees = generateFeeManagerConfigWithMockFees;
|
3119
|
+
exports.generatePolicyManagerConfigWithMockPolicies = generatePolicyManagerConfigWithMockPolicies;
|
3120
|
+
exports.generateRegisteredMockFees = generateRegisteredMockFees;
|
3121
|
+
exports.generateRegisteredMockPolicies = generateRegisteredMockPolicies;
|
3122
|
+
exports.getAssetBalances = getAssetBalances;
|
3123
|
+
exports.getNamedSigner = getNamedSigner;
|
3124
|
+
exports.getUnnamedSigners = getUnnamedSigners;
|
3125
|
+
exports.idleApproveAssets = idleApproveAssets;
|
3126
|
+
exports.idleClaimRewards = idleClaimRewards;
|
3127
|
+
exports.idleClaimRewardsAndReinvest = idleClaimRewardsAndReinvest;
|
3128
|
+
exports.idleClaimRewardsAndSwap = idleClaimRewardsAndSwap;
|
3129
|
+
exports.idleLend = idleLend;
|
3130
|
+
exports.idleRedeem = idleRedeem;
|
3131
|
+
exports.kyberTakeOrder = kyberTakeOrder;
|
3132
|
+
exports.mockGenericRemoveOnlySelector = mockGenericRemoveOnlySelector;
|
3133
|
+
exports.mockGenericSwap = mockGenericSwap;
|
3134
|
+
exports.mockGenericSwapASelector = mockGenericSwapASelector;
|
3135
|
+
exports.mockGenericSwapArgs = mockGenericSwapArgs;
|
3136
|
+
exports.mockGenericSwapBSelector = mockGenericSwapBSelector;
|
3137
|
+
exports.mockGenericSwapDirectFromVaultSelector = mockGenericSwapDirectFromVaultSelector;
|
3138
|
+
exports.mockGenericSwapViaApprovalSelector = mockGenericSwapViaApprovalSelector;
|
3139
|
+
exports.paraSwapV4GenerateDummyPaths = paraSwapV4GenerateDummyPaths;
|
3140
|
+
exports.paraSwapV4TakeOrder = paraSwapV4TakeOrder;
|
3141
|
+
exports.redeemShares = redeemShares;
|
3142
|
+
exports.removeTrackedAssets = removeTrackedAssets;
|
3143
|
+
exports.synthetixAssignExchangeDelegate = synthetixAssignExchangeDelegate;
|
3144
|
+
exports.synthetixResolveAddress = synthetixResolveAddress;
|
3145
|
+
exports.synthetixTakeOrder = synthetixTakeOrder;
|
3146
|
+
exports.transactionTimestamp = transactionTimestamp;
|
3147
|
+
exports.uniswapV2Lend = uniswapV2Lend;
|
3148
|
+
exports.uniswapV2Redeem = uniswapV2Redeem;
|
3149
|
+
exports.uniswapV2TakeOrder = uniswapV2TakeOrder;
|
3150
|
+
exports.uniswapV3TakeOrder = uniswapV3TakeOrder;
|
3151
|
+
exports.unlockAllWhales = unlockAllWhales;
|
3152
|
+
exports.unlockWhale = unlockWhale;
|
3153
|
+
exports.unlockWhales = unlockWhales;
|
3154
|
+
exports.updateChainlinkAggregator = updateChainlinkAggregator;
|
3155
|
+
exports.vaultCallCurveMinterMint = vaultCallCurveMinterMint;
|
3156
|
+
exports.vaultCallCurveMinterMintMany = vaultCallCurveMinterMintMany;
|
3157
|
+
exports.vaultCallCurveMinterToggleApproveMint = vaultCallCurveMinterToggleApproveMint;
|
3158
|
+
exports.yearnVaultV2Lend = yearnVaultV2Lend;
|
3159
|
+
exports.yearnVaultV2Redeem = yearnVaultV2Redeem;
|
3160
|
+
exports.zeroExV2TakeOrder = zeroExV2TakeOrder;
|