This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
hardhat.tasks.ts
316 lines (280 loc) · 10.5 KB
/
hardhat.tasks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
import '@nomiclabs/hardhat-ethers';
import { task } from 'hardhat/config';
import { setBorrowCap__task } from './tasks/exec/setBorrowCap';
import { airdropGas__task } from './tasks/airdropGas';
import { deployEmptyStrats__task } from './tasks/deploy/02-deployEmptyStrats';
import { deployOracleMock__task } from './tasks/deploy/04-deployOracleMock';
import { setLiquidationQueue__task } from './tasks/exec/setLiquidationQueue';
import { setLiquidationQueueBidSwapper__task } from './tasks/exec/setLiquidationQueueBidSwapper';
import { setLiquidationQueueExecutionSwapper__task } from './tasks/exec/setLiquidationQueueExecutionSwapper';
import { setProxyAdapterParams__task } from './tasks/exec/setProxyAdapterParams';
import { setProxyTrustedRemote__task } from './tasks/exec/setProxyTrustedRemote';
import { registerYbAssets__task } from './tasks/exec/registerYbAssets';
import { hasStoredPayload__task } from './tasks/test-hasStoredPayload';
import { otherChainBorrow__task } from './tasks/test-otherChainBorrow';
import { retryPayload__task } from './tasks/test-retryPayload';
import { sameChainBorrow__task } from './tasks/test-sameChainBorrow';
import { getBigBangMarkets__task } from './tasks/view/getBigBangMarkets';
import { getBigBangTotals__task } from './tasks/view/getBigBangTotals';
import { getParticipantBigBangInfo__task } from './tasks/view/getParticipantBigBangInfo';
import { getParticipantSingularityInfo__task } from './tasks/view/getParticipantSingularityInfo';
import { getSingularityMarkets__task } from './tasks/view/getSingularityMarkets';
import { getSingularityTotals__task } from './tasks/view/getSingularityTotals';
import { whitelistSingularity__task } from './tasks/whitelistSingularity';
import {
getLocalDeployments__task,
getSDKDeployments__task,
} from './tasks/view/getDeployments';
import { deployFullStack__task } from './tasks/deploy/00-deployFullStack';
import { deployLinkedChainStack__task } from './tasks/deploy/01-deployLinkedChainStack';
import { deploySGLMarket__task } from './tasks/deploy/deploySGLMarket';
import { deployBigBangMarket__task } from './tasks/deploy/deployBigBangMarket';
import { testCrossChainBorrow__task } from './tasks/test-borrow';
import { testCrossChainLend__task } from './tasks/test-lend';
import { setMinterStatus__task } from './tasks/exec/setMinterStatus';
import { sameChainFlowTest__task } from './tasks/test-sameChainFlow';
import { crossChainRepay__task } from './tasks/test-crossChainRepay';
import { sendFrom__task } from './tasks/exec/sendFrom';
import { testDeployMockSwapper__task } from './tasks/deploy/1000-testDeployMockSwapper';
task('accounts', 'Prints the list of accounts', async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
/**
* Getters
*/
task(
'singularityMarkets',
'Display the list of deployed Singularity markets for the current chain ID.',
getSingularityMarkets__task,
);
task(
'bigBangMarkets',
'Display the list of deployed BigBang markets for the current chain ID.',
getBigBangMarkets__task,
);
task(
'getLocalDeployments',
'Print a list of locally deployed contracts.',
getLocalDeployments__task,
);
task(
'getSDKDeployments',
'Print a list of SDK deployed contract.',
getSDKDeployments__task,
);
task(
'getParticipantSingularityInfo',
'Returns lend & borrow details for a specific address',
getParticipantSingularityInfo__task,
)
.addParam('singularity', 'Singularity address')
.addParam('participant', 'User address');
task(
'getParticipantBigBangInfo',
'Returns lend & borrow details for a specific address',
getParticipantBigBangInfo__task,
)
.addParam('singularity', 'Singularity address')
.addParam('participant', 'User address');
task(
'getSingularityTotals',
'Returns Singularity totals info',
getSingularityTotals__task,
).addParam('singularity', 'Singularity address');
task(
'getBigBangTotals',
'Returns BigBang totals info',
getBigBangTotals__task,
).addParam('bigBang', 'BigBang address');
/**
* Execs
*/
task(
'setMinterStatus',
'Set minter status on USDO for an operator',
setMinterStatus__task,
)
.addParam('operator', 'Minter address')
.addParam('status', 'true/false');
task(
'setBurnerStatus',
'Set burner status on USDO for an operator',
setMinterStatus__task,
)
.addParam('operator', 'Burner address')
.addParam('status', 'true/false');
/**
*
/**
* Deploy
*/
task(
'deploySGLMarket',
'Deploy a Singularity market',
deploySGLMarket__task,
).addOptionalParam('overrideOptions', 'Override options');
task(
'deployBigBangMarket',
'Deploy a BigBang market',
deployBigBangMarket__task,
).addOptionalParam('overrideOptions', 'Override options');
task(
'deployFullStack',
'Deploy the stack, use it for the host chain. Includes the following contract:\nYieldBox, USDO, Penrose, MasterContracts, MarketHelper, MultiSwapper, SingularityModules, CurveSwapper, StableToUSD0Bidder',
deployFullStack__task,
);
task(
'deployLinkedChainStack',
'Deploy the stack, use it for the host chain. Includes the following contract:\nYieldBox, USDO, Penromse, MasterContracts, MarketHelper, MultiSwapper, SingularityModules, CurveSwapper, StableToUSD0Bidder',
deployLinkedChainStack__task,
);
task('deployOracleMock', 'Deploy Oracle mock', deployOracleMock__task).addParam(
'name',
'Market name',
);
task(
'deployEmptyStrats',
'Deploy a bunch of ERC20WithoutStrategy for YieldBox',
deployEmptyStrats__task,
).addParam(
'type',
'Deploy empty strats for contracts of type: TOFT = 0, MarketsProxy = 1, USDO = 2, TAP = 3,',
'0',
);
task('setBorrowCap', 'Set borrow cap for Singularity', setBorrowCap__task)
.addParam('singularity', 'Singularity address', ' ')
.addParam('bigBang', 'BigBang address', ' ')
.addParam('cap', 'Borrow cap value');
task(
'setLiquidationQueueBidSwapper',
'Updates LiquidationQueue bid swapper',
setLiquidationQueueBidSwapper__task,
)
.addParam('singularity', 'Singularity address')
.addParam('swapper', 'Swapper address');
task(
'setLiquidationQueueExecutionSwapper',
'Updates LiquidationQueue execution swapper',
setLiquidationQueueExecutionSwapper__task,
)
.addParam('singularity', 'Singularity address')
.addParam('swapper', 'Swapper address');
task(
'setLiquidationQueue',
'Updates LiquidationQueue',
setLiquidationQueue__task,
)
.addParam('singularity', 'Singularity address')
.addParam('liquidationQueue', 'LiquidationQueue address')
.addParam('meta', 'LiquidationQueue meta object');
task(
'registerYbAssets',
'Register a bunch of YieldBox assets',
registerYbAssets__task,
);
task(
'setProxyTrustedRemote',
'Calls setProxyTrustedRemote on MarketsProxy contract',
setProxyTrustedRemote__task,
)
.addParam('chain', 'LZ destination chain id for trusted remotes')
.addParam('dst', 'MarketsProxy destination address')
.addParam('src', 'MarketsProxy source address');
task(
'setProxyAdapterParams',
'Sets setUseCustomAdapterParams on MarketsProxy contract',
setProxyAdapterParams__task,
).addOptionalParam(
'lzDestinationId',
'Destination LZ chain id to set min gas for',
);
task(
'sameChainBorrow',
'Deposits, adds collateral and borrows from the same chain',
sameChainBorrow__task,
)
.addParam('market', 'Singularity address')
.addParam('marketHelper', 'MarketsHelper address')
.addParam('collateralAmount', 'Collateral amount to add')
.addParam('borrowAmount', 'Borrow amount to get');
task(
'otherChainBorrow',
'Deposits, adds collateral and borrows from the another chain',
otherChainBorrow__task,
)
.addParam('srcLzChainId', 'LZ source chain id')
.addParam('destLzChainId', 'LZ destination chain id')
.addParam('extraGas', 'Extra gas for LZ send tx')
.addParam('assetId', 'Destination YieldBox asset id')
.addParam('zroAddress', 'ZRO address')
.addParam('depositGas', 'ETH sent for tx for YB deposit')
.addParam('singularityGas', 'ETH sent for tx for Singularity operations')
.addParam('airdropGas', 'ETH airdropped for withdraw operation')
.addParam('depositAmount', 'ETH sent for tx')
.addParam('oft', 'Tapioca OFT address')
.addParam('proxy', 'Proxy contract address')
.addParam('collateralShare', 'Collateral shares to add')
.addParam('borrowAmount', 'Asset amount to borrow')
.addParam('withdraw', 'True/false')
.addParam('singularityDestination', 'Singularity destination');
task(
'hasStoredPayload',
'Check if endpoint has a stored payload',
hasStoredPayload__task,
)
.addParam('srcChainId', 'LZ source chain id')
.addParam('srcAddress', 'Source address')
.addParam('dstAddress', 'Destination address')
.addParam('lzEndpoint', 'LZ endpoint address');
task('retryPayload', 'Retry a failed payload', retryPayload__task)
.addParam('srcChainId', 'LZ source chain id')
.addParam('srcAddress', 'Source address represented as bytes')
.addParam('dstAddress', 'Destination address')
.addParam('blockHash', 'Blockhash where to take the event from bytes')
.addParam('lzEndpoint', 'LZ endpoint address');
task(
'whitelistSingularity',
'Whitelist singularity status on SGLProxy',
whitelistSingularity__task,
)
.addParam('singularity', 'SGL address')
.addParam('sglProxy', 'SGLProxy addressF');
task('airdropGas', 'Airdrop gas to msg.sender', airdropGas__task)
.addParam('amount', 'Amount of gas to airdrop')
.addParam('dstChain', 'Destination chain id')
.addParam('dstAddress', 'Destination address')
.addOptionalParam(
'recursive',
'Number of time the airdrop should be called',
);
task(
'testCrossChainBorrow',
'Test crosschain borrow',
testCrossChainBorrow__task,
);
task('testCrossChainRepay', 'Test crosschain repay', crossChainRepay__task);
// To Remove
task('sendFrom', 'Calls toftSendFrom on tOFT contract', sendFrom__task)
.addParam('contractName', 'Name of the contract')
.addParam('src', 'Name of the source chain')
.addParam('dst', 'Name of the destination chain')
.addParam('value', 'Amount to send, (ex: 1.45)');
/**
* Test
*/
task(
'sameChainFlowTest',
'Test complete flow on same chain',
sameChainFlowTest__task,
)
.addParam('bbMarket', 'BigBang market address')
.addParam('sglMarket', 'SGL market address')
.addParam('magnetarAddress', 'Magnetar address');
task(
'testDeployMockSwapper',
'Deploy MockSwapper',
testDeployMockSwapper__task,
);