-
Notifications
You must be signed in to change notification settings - Fork 0
/
SuLiquidationMiddleware.json
613 lines (613 loc) · 114 KB
/
SuLiquidationMiddleware.json
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
{
"address": "0x97A29698664F00D868fCDcfE8DBf65c0cD276300",
"abi": [
{
"inputs": [],
"name": "BadAccessControlSingleton",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "badStablecoin",
"type": "address"
}
],
"name": "BadStablecoin",
"type": "error"
},
{
"inputs": [],
"name": "NoProfit",
"type": "error"
},
{
"inputs": [],
"name": "NoStablePro",
"type": "error"
},
{
"inputs": [],
"name": "OnlyAdminError",
"type": "error"
},
{
"inputs": [],
"name": "OnlyAlerterError",
"type": "error"
},
{
"inputs": [],
"name": "OnlyDAOError",
"type": "error"
},
{
"inputs": [],
"name": "OnlyLiquidationAccessError",
"type": "error"
},
{
"inputs": [],
"name": "OnlyMintAccessError",
"type": "error"
},
{
"inputs": [],
"name": "OnlyRewardAccessError",
"type": "error"
},
{
"inputs": [],
"name": "OnlyRoleError",
"type": "error"
},
{
"inputs": [],
"name": "OnlyVaultAccessError",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "debt",
"type": "uint256"
}
],
"name": "CollateralBorrowed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "StableProSwapped",
"type": "event"
},
{
"inputs": [],
"name": "ACCESS_CONTROL_SINGLETON",
"outputs": [
{
"internalType": "contract ISuAccessControl",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ADMIN_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ALERTER_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "DAO_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "LIQUIDATION_ACCESS_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MINT_ACCESS_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "REWARD_ACCESS_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "VAULT_ACCESS_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_stablecoin",
"type": "address"
}
],
"name": "addWhitelistStablecoin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "collateral",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "debt",
"type": "uint256"
}
],
"name": "borrowCollateralToSell",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "foundation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_stablecoin",
"type": "address"
}
],
"name": "hasWhitelistStablecoin",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_authControl",
"type": "address"
},
{
"internalType": "address",
"name": "_suExchangeModule",
"type": "address"
},
{
"internalType": "address",
"name": "_suOracle",
"type": "address"
},
{
"internalType": "address",
"name": "_stablePro",
"type": "address"
},
{
"internalType": "address",
"name": "_foundation",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "middlewareDebt",
"outputs": [
{
"internalType": "int256",
"name": "",
"type": "int256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_stablecoin",
"type": "address"
}
],
"name": "removeWhitelistStablecoin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "sendProfitToFoundation",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "sendStableProToDAO",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "stablePro",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "stablecoinToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "stableProAmountE18",
"type": "uint256"
}
],
"name": "swapStableProToStablecoin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"numDeployments": 1,
"solcInputHash": "6bdb767f00e3f0fe0de7c63e7a48801d",
"metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"BadAccessControlSingleton\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"badStablecoin\",\"type\":\"address\"}],\"name\":\"BadStablecoin\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoProfit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoStablePro\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyAdminError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyAlerterError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyDAOError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyLiquidationAccessError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyMintAccessError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyRewardAccessError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyRoleError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyVaultAccessError\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debt\",\"type\":\"uint256\"}],\"name\":\"CollateralBorrowed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StableProSwapped\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ACCESS_CONTROL_SINGLETON\",\"outputs\":[{\"internalType\":\"contract ISuAccessControl\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ALERTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DAO_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LIQUIDATION_ACCESS_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_ACCESS_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REWARD_ACCESS_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VAULT_ACCESS_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stablecoin\",\"type\":\"address\"}],\"name\":\"addWhitelistStablecoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"collateral\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debt\",\"type\":\"uint256\"}],\"name\":\"borrowCollateralToSell\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foundation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stablecoin\",\"type\":\"address\"}],\"name\":\"hasWhitelistStablecoin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_authControl\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_suExchangeModule\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_suOracle\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_stablePro\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_foundation\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"middlewareDebt\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stablecoin\",\"type\":\"address\"}],\"name\":\"removeWhitelistStablecoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sendProfitToFoundation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sendStableProToDAO\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stablePro\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"stablecoinToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"stableProAmountE18\",\"type\":\"uint256\"}],\"name\":\"swapStableProToStablecoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"See ISuLiquidationMiddleware interface for full details.\",\"kind\":\"dev\",\"methods\":{\"borrowCollateralToSell(address,uint256,uint256)\":{\"details\":\"TriggerLiquidation in SuManager need to send collateral to this contract and call this function\",\"params\":{\"amount\":\"- The amount of LP-token to be unwrapped\",\"collateral\":\"- collateral token address\",\"debt\":\"- debt to the SuManager - how much StablePro user borrow using this collateral*\"}},\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"title\":\"SuLiquidationMiddleware\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"borrowCollateralToSell(address,uint256,uint256)\":{\"notice\":\"Set order to swap collateral to stablecoin to exchange module and store his debt to the SuManager\"},\"sendProfitToFoundation()\":{\"notice\":\"DAO can send profit after liquidations that accumulates in this contract to foundation*\"},\"sendStableProToDAO()\":{\"notice\":\"After swapping Stablecoin to users StablePro Middleware can send them to DAO, that can send them to liquidity pool, burn them and etc.*\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/liquidator/SuLiquidationMiddleware.sol\":\"SuLiquidationMiddleware\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControlUpgradeable {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0xb8f5302f12138c5561362e88a78d061573e6298b7a1a5afe84a1e2c8d4d5aeaa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x89be10e757d242e9b18d5a32c9fbe2019f6d63052bbe46397a430a1d60d7f794\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x0e1f0f5f62f67a881cd1a9597acbc0a5e4071f3c2c10449a183b922ae7272e3f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9c80f545915582e63fe206c6ce27cbe85a86fc10b9cd2a0e8c9488fb7c2ee422\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```solidity\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSetUpgradeable {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x1c65595a26548a1b2263315b08a56334a2d7087319814437559c3c96025e939f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.6.0;\\n\\nimport '@openzeppelin/contracts/token/ERC20/IERC20.sol';\\n\\nlibrary TransferHelper {\\n /// @notice Transfers tokens from the targeted address to the given destination\\n /// @notice Errors with 'STF' if transfer fails\\n /// @param token The contract address of the token to be transferred\\n /// @param from The originating address from which the tokens will be transferred\\n /// @param to The destination address of the transfer\\n /// @param value The amount to be transferred\\n function safeTransferFrom(\\n address token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n (bool success, bytes memory data) =\\n token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));\\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');\\n }\\n\\n /// @notice Transfers tokens from msg.sender to a recipient\\n /// @dev Errors with ST if transfer fails\\n /// @param token The contract address of the token which will be transferred\\n /// @param to The recipient of the transfer\\n /// @param value The value of the transfer\\n function safeTransfer(\\n address token,\\n address to,\\n uint256 value\\n ) internal {\\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));\\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');\\n }\\n\\n /// @notice Approves the stipulated contract to spend the given allowance in the given token\\n /// @dev Errors with 'SA' if transfer fails\\n /// @param token The contract address of the token to be approved\\n /// @param to The target of the approval\\n /// @param value The amount of the given token the target will be allowed to spend\\n function safeApprove(\\n address token,\\n address to,\\n uint256 value\\n ) internal {\\n (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));\\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');\\n }\\n\\n /// @notice Transfers ETH to the recipient address\\n /// @dev Fails with `STE`\\n /// @param to The destination of the transfer\\n /// @param value The value to be transferred\\n function safeTransferETH(address to, uint256 value) internal {\\n (bool success, ) = to.call{value: value}(new bytes(0));\\n require(success, 'STE');\\n }\\n}\\n\",\"keccak256\":\"0x9af98b0908c96320ca6d08b22f0efca864742f6adbe5794cafe2d1d2e808b0cd\",\"license\":\"GPL-2.0-or-later\"},\"contracts/exchange/interfaces/IExchange.sol\":{\"content\":\"// SPDX-License-Identifier: BSL 1.1\\npragma solidity ^0.8.0;\\n\\nenum DiscountType {\\n aggressive,\\n middle,\\n conservative\\n}\\n\\nstruct Order {\\n address token2sell;\\n uint256 amountLeft;\\n address token2buy;\\n uint256 token2buyAmount;\\n address beneficiary;\\n uint256 creationTimestamp;\\n DiscountType discountType;\\n address caller;\\n}\\n\\nstruct OrderWithId {\\n Order order;\\n uint256 orderId;\\n}\\n\\ninterface IExchange {\\n /* ===================== ERRORS ===================== */\\n error OrderExist(uint256 orderId);\\n error OrderNotExist(uint256 orderId);\\n error IncorrectToken(address orderToken2buy, address inToken);\\n error SmallAmountLeft();\\n error UserIsNotBeneficiary();\\n error IsNotTopStaker(address staker);\\n error OrderNotForThisStaker(uint256 orderId, address staker);\\n error NotEnoughReturnValue();\\n error CallbackError();\\n\\n /* ======================== EVENTS ========================= */\\n event OrderAdded(uint256 orderId);\\n event OrderCanceled(uint256 orderId);\\n event OrderFilled(uint256 orderId);\\n event OrderFilledPartially(uint256 orderId);\\n event LpOrdersAdded(address LPToken, uint256[] orderIds);\\n\\n /* ==================== MUTABLE METHODS ==================== */\\n\\n /**\\n * @notice Add order to swap {token2sell} to {token2buy}.\\n * @dev This swap is async, because depends on how arbitrage bots will fill this order. Emits OrderAdded() event.\\n * Before addOrder user needs to approve token2sell for exchange contract\\n * @param token2sell - Address of token to sell\\n * @param amount2sell - Amount of {token2sell} to sell\\n * @param token2buy - Address of token to buy\\n * @param beneficiary - Address that will receive {token2buy} after filling order.\\n * @param discountType - Speed of decreasing swap price. { 0 - aggressive, 1 - middle, 2 - conservative }\\n **/\\n function addOrder (\\n address token2sell,\\n uint256 amount2sell,\\n address token2buy,\\n address beneficiary,\\n DiscountType discountType\\n ) external returns (uint256);\\n\\n /**\\n * @notice Only user who place order or who is beneficiary can cancelOrder();\\n * @param orderId - Id of order to cancel.\\n **/\\n function cancelOrder (uint256 orderId) external;\\n\\n /**\\n * @notice Fill order with flash-loan like logic\\n * @dev Caller contract receive orders {token2sell} and after that his stableunitFillOrderCallback() is called.\\n * At the end of thi callback contract should send some amount of another token back to Exchange contract.\\n * @param orderId - Id of order to fill.\\n * @param inAmount - Amount of {token2sell} to receive\\n * @param data - encoded data to pass to callback function\\n **/\\n function fillOrderAsFlashLoan (\\n uint256 orderId,\\n uint256 inAmount,\\n bytes memory data\\n ) external returns (uint256 outAmount);\\n\\n /**\\n * @notice Function to update price curve - how fast {token2sell} price will decrease/increase\\n * @param discountType - discount type to change\\n * @param newPriceCurve - parameters of formula\\n **/\\n function setPriceCurve(DiscountType discountType, uint256[2] calldata newPriceCurve) external;\\n\\n /* ==================== VIEW METHODS ==================== */\\n /**\\n * @return The amount of outcome that caller will receive if he will fill {orderId} with {inAmount} of {token2sell}\\n **/\\n function getExpectedOrderOutcome (uint256 orderId, uint256 inAmount) external view returns (uint256);\\n\\n /**\\n * @return Order with id = {orderId}\\n **/\\n function getOrder (uint256 orderId) external view returns (Order memory);\\n\\n /**\\n * @return The amount of not full-filled orders\\n **/\\n function getOrdersCount () external view returns (uint256);\\n\\n /**\\n * @return The array of all not-filled orders. May be deleted after adding GraphQL for orderIds\\n **/\\n function getAllOrders () external view returns (OrderWithId[] memory);\\n}\\n\",\"keccak256\":\"0x82e1cafa53606d6b49f02ca18891db728c3dfd3c678387e8d4a6e2ccbbda8a1b\",\"license\":\"BSL 1.1\"},\"contracts/interfaces/ISuLiquidationMiddleware.sol\":{\"content\":\"// SPDX-License-Identifier: BSL 1.1\\npragma solidity ^0.8.0;\\n\\n/* @notice This contract is middleware between our Lending module and Exchange module.\\n * This contract is responsible for getting collateral to liquidate from lending module, sell it using exchange module.\\n * After sell users with StablePro can swap them to another stablecoin.\\n * Also DAO can send profit after profitable liquidations to foundation or get swapped StablePro.\\n */\\ninterface ISuLiquidationMiddleware {\\n /* ===================== ERRORS ===================== */\\n error BadStablecoin(address badStablecoin);\\n error NoProfit();\\n error NoStablePro();\\n\\n /* ===================== EVENTS ===================== */\\n event CollateralBorrowed(uint256 debt);\\n event StableProSwapped(uint256 amount);\\n\\n /* ==================== MUTABLE METHODS ==================== */\\n\\n /**\\n * @notice Set order to swap collateral to stablecoin to exchange module and store his debt to the SuManager\\n * @dev TriggerLiquidation in SuManager need to send collateral to this contract and call this function\\n * @param collateral - collateral token address\\n * @param amount - The amount of LP-token to be unwrapped\\n * @param debt - debt to the SuManager - how much StablePro user borrow using this collateral\\n **/\\n function borrowCollateralToSell (\\n address collateral,\\n uint256 amount,\\n uint256 debt\\n ) external;\\n\\n /**\\n * @notice Swap users StablePro to Stablecoin that Middleware receive from exchange module after filling order\\n * @dev User need to approve StablePro for Middleware\\n * @param stablecoinToken - what stablecoin user want to receive\\n * @param stablecoinAmountEDecimal - The amount of stablecoinToken to receive\\n **/\\n function swapStableProToStablecoin(\\n address stablecoinToken,\\n uint256 stablecoinAmountEDecimal\\n ) external;\\n\\n /**\\n * @notice DAO can send profit after liquidations that accumulates in this contract to foundation\\n **/\\n function sendProfitToFoundation() external;\\n\\n /**\\n * @notice After swapping Stablecoin to users StablePro Middleware can send them to DAO,\\n * that can send them to liquidity pool, burn them and etc.\\n **/\\n function sendStableProToDAO() external;\\n\\n function addWhitelistStablecoin(address _stablecoin) external;\\n\\n function removeWhitelistStablecoin(address _stablecoin) external;\\n\\n /* ==================== VIEW METHODS ==================== */\\n\\n function hasWhitelistStablecoin(address _stablecoin) external view returns(bool);\\n}\\n\",\"keccak256\":\"0x47e708b7f9d12306cbb71c34ece650f10fb932347c19eb158f10a3e1ba2b4419\",\"license\":\"BSL 1.1\"},\"contracts/interfaces/ISuManager.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ISuManagerParameters.sol\\\";\\nimport \\\"./ISuManagerHelpers.sol\\\";\\nimport \\\"./ISuManagerLiquidation.sol\\\";\\n\\n/**\\n * @title SuManager\\n * @notice Manager mighty over the vault. Allows users to interact with their CDPs.\\n * User does only interact with manager as proxy to the vault.\\n **/\\ninterface ISuManager is ISuManagerParameters, ISuManagerHelpers, ISuManagerLiquidation {\\n /* ===================== EVENTS ===================== */\\n /**\\n * @notice Even triggered when user deposit collateral\\n **/\\n event Join(address indexed asset, address indexed owner, uint256 main, uint256 stablecoin);\\n\\n /**\\n * @notice Event triggered when user withdraws collateral\\n **/\\n event Exit(address indexed asset, address indexed owner, uint256 main, uint256 stablecoin);\\n\\n /* ===================== ERRORS ===================== */\\n error Restricted();\\n error UselessTransaction();\\n error UnsupportedDecimals();\\n error UnderCollateralized();\\n error SmallCollateral();\\n\\n /* ==================== METHODS ==================== */\\n /**\\n * @notice This function is called by user to deposit collateral and receive stablecoin\\n * @dev Before calling this function user has to approve the Vault to take his collateral\\n **/\\n function join(\\n address asset,\\n uint256 assetAmountEDecimal,\\n uint256 stablecoinAmountE18,\\n uint256 lockupPeriodSeconds\\n ) external;\\n\\n /**\\n * @notice User can pay back the stablecoin and take his collateral\\n * instead of passing both assetAmount and stablecoinAmount\\n * better user just to pass one of them\\n * also pass preferred rate and maybe acceptable diff percent\\n * that's the purpose of passing both to protect user from rate fluctuations\\n **/\\n function exit(address asset, uint256 assetAmountEDecimal, uint256 stablecoinAmountE18) external;\\n}\\n\",\"keccak256\":\"0x85b5124aac22a07972f193fbd4d896f73cf8832242f5697d55b0418a4ba443f8\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/ISuManagerHelpers.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ISuManagerHelpers\\n * @notice Abstract contract that should be in SuManager. Here we have all view and ui-helpers methods.\\n * Here we don't change any values.\\n **/\\ninterface ISuManagerHelpers {\\n /* ===================== ERRORS ===================== */\\n\\n error InvalidArgs();\\n\\n /* ==================== VIEW METHODS ==================== */\\n\\n /**\\n * @notice View function to check if position is liquidatable\\n **/\\n function isLiquidatablePosition(address asset, address owner) external view returns (bool);\\n\\n /**\\n * @notice Returns information about a liquidating position\\n * @param asset The address of the main collateral token of a position\\n * @param owner The owner of the collateral\\n * @return collateralEDecimal The amount of collateral\\n * @return debtWithFeesE18 The amount of borrowed stablecoins with accumulated fee\\n **/\\n function getPositionInfo(\\n address asset,\\n address owner\\n ) external view returns (uint256 collateralEDecimal, uint256 debtWithFeesE18);\\n\\n /**\\n * @notice Returns information about a liquidating position\\n * @param asset The address of the main collateral token of a position\\n * @param owner The owner of the collateral\\n * @return liquidationBlock The block number when the liquidation was triggered\\n **/\\n function getLiquidationBlock(address asset, address owner) external view returns (uint256);\\n\\n /**\\n * @notice USD value of collateral of owner\\n **/\\n function getCollateralUsdValueE18(address asset, address owner) external view returns (uint256);\\n\\n /* ==================== UI HELPERS ==================== */\\n\\n /**\\n * @notice Returns Loan-To-Value in e18\\n **/\\n function getLTVE18(address asset, address owner) external view returns (uint256);\\n\\n /**\\n * @notice Returns Available to Borrow\\n * we have invariant: (collateralAmountEDecimal * collateralPriceE18 / 1e18) * initialCollateralRatioE18 <= debtE18\\n * Has similar logic like in _ensurePositionCollateralization\\n **/\\n function getAvailableToBorrowE18(address asset, address owner) external view returns (uint256);\\n\\n /**\\n * @notice Returns Available to Withdraw\\n * Has similar invariant like in getAvailableToBorrowE18\\n **/\\n function getAvailableToWithdrawE18(address asset, address owner) external view returns (uint256);\\n\\n /**\\n * @notice Calculate liquidation price\\n * @dev can be used inside of _isLiquidatablePosition\\n **/\\n function liquidationPriceE18(address asset, address owner) external view returns (uint256);\\n\\n function liquidationPriceByAmount(\\n address asset,\\n address owner,\\n uint256 additionalCollateralAmount,\\n uint256 additionalStablecoinAmount\\n ) external view returns (uint256);\\n\\n /**\\n * @notice View function to show utilization ratio\\n * the same function can be used inside of _isLiquidatablePosition\\n **/\\n function utilizationRatioE18(address asset, address owner) external view returns (uint256);\\n}\",\"keccak256\":\"0xbaefa2bdb0d4285d10612fbb88495414a634ae115f6fd0f9cb099451282e0618\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/ISuManagerLiquidation.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ISuManagerLiquidation\\n * @notice Abstract contract that should be in SuManager.\\n * Here we have triggerLiquidation, that trigger bot should call after finding liquidatable position\\n **/\\ninterface ISuManagerLiquidation {\\n /* ===================== ERRORS ===================== */\\n\\n error PositionIsSafe();\\n error LiquidationIsTriggered();\\n\\n /* ===================== EVENTS ===================== */\\n /**\\n * @notice Event triggered when triggerLiquidation() is called\\n **/\\n event LiquidationTriggered(address asset, uint256 debtAmount);\\n\\n /* ==================== MUTABLE METHODS ==================== */\\n\\n /**\\n * @notice Marks a position as to be liquidated\\n * @dev\\n * Emits LiquidationTriggered event.\\n * Sets the current block as liquidationBlock for the position.\\n * Can be triggered only once for the position.\\n * Add order for liquidated collateral to sell it by stablecoin from whitelist\\n * @param asset The address of the main collateral token of a position\\n * @param owner The owner of a position\\n **/\\n function triggerLiquidation(address asset, address owner) external;\\n}\",\"keccak256\":\"0xb83ad87525768e72d36ab93a24a731536d18ed55d23d5dba6a877c549a141c94\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/ISuManagerParameters.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\ninterface ISuManagerParameters {\\n /* ====================== VARS ====================== */\\n /**\\n * @notice When ratio (debt / usdValue) goes below it user can't withdraw or borrow.\\n * Should be >= liquidationRatioE18. 1e18 = 100% ratio. Should be less than 1e18.\\n * Is used to calculate available to withdraw and borrow.\\n * For example, user can borrow <= usdValue * initialCollateralRatio\\n **/\\n function initialCollateralRatioE18 (address asset) external view returns ( uint256 );\\n\\n /**\\n * @notice Ratio when cdp can be liquidated.\\n * 1e18 = 100% ratio. Should be less than 1e18.\\n * Is used in isLiquidatablePosition(). It's true when debt / usdValue >= liquidationRatio\\n **/\\n function liquidationRatioE18 (address asset) external view returns ( uint256 );\\n\\n /**\\n * @notice The minimum value of collateral in USD which allowed to be left after partial closure\\n **/\\n function minCollateralInUsdE18 ( ) external view returns ( uint256 );\\n\\n /* ===================== ERRORS ===================== */\\n error BadLiquidationRatioValue();\\n error BadInitialCollateralRatioValue();\\n\\n /* ==================== METHODS ==================== */\\n function setCollateral (\\n address asset,\\n uint256 stabilityFeeValueE18,\\n uint256 initialCollateralRatioValueE18,\\n uint256 liquidationRatioValueE18,\\n uint256 stablecoinLimitE18,\\n uint256 minCollateralInUsdValueE18\\n ) external;\\n\\n /**\\n * @notice Only manager is able to call this function\\n * @dev Sets the initial collateral ratio\\n * @param asset The address of the main collateral token\\n * @param newValueE18 The collateralization ratio (1e18 = 100%)\\n **/\\n function setInitialCollateralRatioE18 ( address asset, uint256 newValueE18 ) external;\\n\\n /**\\n * @notice Only manager is able to call this function\\n * @dev Sets the liquidation ratio\\n * @param asset The address of the main collateral token\\n * @param newValueE18 The liquidation ratio (1e18 = 100%).\\n **/\\n function setLiquidationRatioE18 ( address asset, uint256 newValueE18 ) external;\\n\\n /**\\n * @notice Only manager is able to call this function\\n * @dev Sets a minimum value of collateral in USD which allowed to be left after partial closure\\n * @param newValueE18 The minimum value of collateral in USD\\n */\\n function setMinCollateralInUsdE18 ( uint256 newValueE18 ) external;\\n}\\n\",\"keccak256\":\"0x244cf5530c7f2f1769980a413e183b4d36e087b6d23d4cd020bc8e285fac174e\",\"license\":\"UNLICENSED\"},\"contracts/liquidator/SuLiquidationMiddleware.sol\":{\"content\":\"// SPDX-License-Identifier: BSL 1.1\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol\\\";\\nimport \\\"@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol\\\";\\n\\nimport \\\"../interfaces/ISuManager.sol\\\";\\nimport \\\"../interfaces/ISuLiquidationMiddleware.sol\\\";\\nimport \\\"../exchange/interfaces/IExchange.sol\\\";\\nimport \\\"../periphery/contracts/access-control/SuAuthenticated.sol\\\";\\nimport \\\"../periphery/contracts/interfaces/oracle/ISuOracle.sol\\\";\\n\\n/**\\n * @title SuLiquidationMiddleware\\n * @dev See ISuLiquidationMiddleware interface for full details.\\n */\\ncontract SuLiquidationMiddleware is SuAuthenticated, ISuLiquidationMiddleware {\\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\\n\\n ISuOracle internal _oracle;\\n address internal _exchangeModule;\\n address public foundation;\\n address public stablePro;\\n\\n // how much StablePro we get from SuManager\\n int256 public middlewareDebt;\\n EnumerableSetUpgradeable.AddressSet internal _stablecoinWhitelist;\\n\\n function initialize(\\n address _authControl,\\n address _suExchangeModule,\\n address _suOracle,\\n address _stablePro,\\n address _foundation\\n ) public initializer {\\n __suAuthenticatedInit(_authControl);\\n\\n _oracle = ISuOracle(_suOracle);\\n _exchangeModule = _suExchangeModule;\\n stablePro = _stablePro;\\n foundation = _foundation;\\n }\\n\\n // TODO: make partial liquidation\\n function borrowCollateralToSell (\\n address collateral,\\n uint256 amount,\\n uint256 debt\\n ) public onlyLiquidationAccess {\\n // TODO: create algorithm, how to choose stablecoin\\n address stablecoin = EnumerableSetUpgradeable.at(_stablecoinWhitelist, 0);\\n middlewareDebt += int256(debt);\\n IERC20(collateral).approve(_exchangeModule, amount);\\n\\n IExchange(_exchangeModule).addOrder(\\n collateral,\\n amount,\\n stablecoin,\\n address(this),\\n DiscountType.middle // TODO: should depend on HF\\n );\\n\\n emit CollateralBorrowed(debt);\\n }\\n\\n // user need to approve StablePro\\n function swapStableProToStablecoin(\\n address stablecoinToken,\\n uint256 stableProAmountE18\\n ) external {\\n if (!hasWhitelistStablecoin(stablecoinToken)) revert BadStablecoin(stablecoinToken);\\n\\n uint256 stablecoinAmountEDecimal = stableProAmountE18 * 1e18 / _oracle.getFiatPrice1e18(stablecoinToken);\\n\\n TransferHelper.safeTransferFrom(stablePro, msg.sender, address(this), stableProAmountE18);\\n TransferHelper.safeTransfer(stablecoinToken, msg.sender, stablecoinAmountEDecimal);\\n\\n middlewareDebt -= int256(stableProAmountE18);\\n\\n emit StableProSwapped(stableProAmountE18);\\n }\\n\\n function sendProfitToFoundation () public onlyDAO {\\n if (middlewareDebt < 0) {\\n TransferHelper.safeTransfer(stablePro, foundation, uint256(-middlewareDebt));\\n } else {\\n revert NoProfit();\\n }\\n }\\n\\n function sendStableProToDAO () public onlyDAO {\\n uint256 balance = IERC20Upgradeable(stablePro).balanceOf(address(this));\\n if (balance > 0) {\\n TransferHelper.safeTransfer(stablePro, msg.sender, balance);\\n } else {\\n revert NoStablePro();\\n }\\n }\\n\\n function addWhitelistStablecoin(address _stablecoin) public onlyDAO {\\n EnumerableSetUpgradeable.add(_stablecoinWhitelist, _stablecoin);\\n }\\n\\n function removeWhitelistStablecoin(address _stablecoin) public onlyDAO {\\n EnumerableSetUpgradeable.remove(_stablecoinWhitelist, _stablecoin);\\n }\\n\\n function hasWhitelistStablecoin(address _stablecoin) public view returns(bool) {\\n return EnumerableSetUpgradeable.contains(_stablecoinWhitelist, _stablecoin);\\n }\\n}\\n\",\"keccak256\":\"0xd0336501b2eed3a9fa29a32f429669e4ac070440666b9368e05fa6c28f4349a3\",\"license\":\"BSL 1.1\"},\"contracts/periphery/contracts/access-control/SuAccessRoles.sol\":{\"content\":\"// SPDX-License-Identifier: BSL 1.1\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title SuAccessRoles Library\\n * @dev SuAuthenticated and SuAccessControlSingleton need to have this constants\\n * Hierarchy:\\n * 1. DAO - can give admins and system roles\\n * 2.1. Admin - can set Alerters\\n * 2.2. System - includes Minter, Vault, Liquidation and Reward roles, don't have access to give some roles.\\n * 3. Alerter - can send alerts and trigger rate limits, don't have access to give some roles.\\n */\\nabstract contract SuAccessRoles {\\n bytes32 public constant ADMIN_ROLE = 0x00;\\n\\n bytes32 public constant DAO_ROLE = keccak256(\\\"DAO_ROLE\\\");\\n\\n bytes32 public constant ALERTER_ROLE = keccak256(\\\"ALERTER_ROLE\\\");\\n\\n // system roles\\n bytes32 public constant MINT_ACCESS_ROLE = keccak256(\\\"MINT_ACCESS_ROLE\\\");\\n bytes32 public constant VAULT_ACCESS_ROLE = keccak256(\\\"VAULT_ACCESS_ROLE\\\");\\n bytes32 public constant LIQUIDATION_ACCESS_ROLE = keccak256(\\\"LIQUIDATION_ACCESS_ROLE\\\");\\n bytes32 public constant REWARD_ACCESS_ROLE = keccak256(\\\"REWARD_ACCESS_ROLE\\\");\\n}\\n\",\"keccak256\":\"0x024209469b6b337eef6cf520501d1e6c2ba66a79f014c25220a35e407d69b02e\",\"license\":\"BSL 1.1\"},\"contracts/periphery/contracts/access-control/SuAuthenticated.sol\":{\"content\":\"// SPDX-License-Identifier: BSL 1.1\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../interfaces/access-control/ISuAccessControl.sol\\\";\\nimport \\\"./SuAccessRoles.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @title SuAuthenticated\\n * @dev other contracts should inherit to be authenticated.\\n * The address of SuAccessControlSingleton should be one for all contract that inherits SuAuthenticated\\n */\\nabstract contract SuAuthenticated is Initializable, SuAccessRoles, IERC165Upgradeable {\\n ISuAccessControl public ACCESS_CONTROL_SINGLETON;\\n\\n error OnlyDAOError();\\n error OnlyAdminError();\\n error OnlyAlerterError();\\n error OnlyVaultAccessError();\\n error OnlyLiquidationAccessError();\\n error OnlyMintAccessError();\\n error OnlyRewardAccessError();\\n error OnlyRoleError();\\n error BadAccessControlSingleton();\\n\\n /**\\n * @dev should be passed in constructor\\n */\\n function __suAuthenticatedInit(address _accessControlSingleton) internal onlyInitializing {\\n ACCESS_CONTROL_SINGLETON = ISuAccessControl(_accessControlSingleton);\\n if (\\n !ISuAccessControl(_accessControlSingleton).supportsInterface(type(IAccessControlUpgradeable).interfaceId)\\n ) revert BadAccessControlSingleton();\\n }\\n\\n /** CORE ROLES */\\n\\n modifier onlyDAO() {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(DAO_ROLE, msg.sender)) revert OnlyDAOError();\\n _;\\n }\\n\\n modifier onlyAdmin() {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(ADMIN_ROLE, msg.sender)) revert OnlyAdminError();\\n _;\\n }\\n\\n modifier onlyAlerter() {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(ALERTER_ROLE, msg.sender)) revert OnlyAlerterError();\\n _;\\n }\\n\\n /** SYSTEM ROLES */\\n\\n modifier onlyVaultAccess() {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(VAULT_ACCESS_ROLE, msg.sender)) revert OnlyVaultAccessError();\\n _;\\n }\\n\\n modifier onlyLiquidationAccess() {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(LIQUIDATION_ACCESS_ROLE, msg.sender)) revert OnlyLiquidationAccessError();\\n _;\\n }\\n\\n modifier onlyMintAccess() {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(MINT_ACCESS_ROLE, msg.sender)) revert OnlyMintAccessError();\\n _;\\n }\\n\\n modifier onlyRewardAccess() {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(REWARD_ACCESS_ROLE, msg.sender)) revert OnlyRewardAccessError();\\n _;\\n }\\n\\n // syntax sugar under ACCESS_CONTROL_SINGLETON\\n modifier onlyRole(bytes32 role) {\\n if (!ACCESS_CONTROL_SINGLETON.hasRole(role, msg.sender)) revert OnlyRoleError();\\n _;\\n }\\n\\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\\n return ACCESS_CONTROL_SINGLETON.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x3553007ac782c0c5f2ecf3ca47b8b72d74b2cae35c34ffe2d030b968938b2b0d\",\"license\":\"BSL 1.1\"},\"contracts/periphery/contracts/interfaces/access-control/ISuAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\\\";\\nimport \\\"../../access-control/SuAccessRoles.sol\\\";\\n\\n/**\\n * @notice Access control for contracts\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n **/\\ninterface ISuAccessControl is IAccessControlUpgradeable, IERC165Upgradeable {\\n function setRoleAdmin(bytes32 role, bytes32 adminRole) external;\\n}\\n\",\"keccak256\":\"0x25724ac502fd6418ccd38273b276de4b2fdecd023d723c5d80c9f0a27c407bcd\",\"license\":\"MIT\"},\"contracts/periphery/contracts/interfaces/oracle/ISuOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\n// solhint-disable compiler-version\\npragma solidity >=0.7.6;\\n\\ninterface ISuOracle {\\n /**\\n * @notice WARNING! Read this description very carefully!\\n * function getFiatPrice1e18(address asset) returns (uint256) that:\\n * basicAmountOfAsset * getFiatPrice1e18(asset) / 1e18 === $$ * 1e18\\n * in other words, it doesn't matter what's the erc20.decimals is,\\n * you just multiply token balance in basic units on value from oracle and get dollar amount multiplied on 1e18.\\n *\\n * different assets have different deviation threshold (errors)\\n * for wBTC it's <= 0.5%, read more https://data.chain.link/ethereum/mainnet/crypto-usd/btc-usd\\n * for other asset is can be larger based on particular oracle implementation.\\n *\\n * examples:\\n * market price of btc = $30k,\\n * for 0.1 wBTC the unit256 amount is 0.1 * 1e18\\n * 0.1 * 1e18 * (price1e18 / 1e18) == $3000 == uint256(3000*1e18)\\n * => price1e18 = 30000 * 1e18;\\n *\\n * market price of usdt = $0.97,\\n * for 1 usdt uint256 = 1 * 1e6\\n * so 1*1e6 * price1e18 / 1e18 == $0.97 == uint256(0.97*1e18)\\n * => 1*1e6 * (price1e18 / 1e18) / (0.97*1e18) = 1\\n * => price1e18 = 0.97 * (1e18/1e6) * 1e18\\n *\\n * assume market price of wBTC = $31,503.77, oracle error = $158\\n *\\n * case #1: small amount of wBTC\\n * we have 0.0,000,001 wBTC that is worth v = $0.00315 \\u00b1 $0.00001 = 0.00315*1e18 = 315*1e13 \\u00b1 1*1e13\\n * actual balance on the asset b = wBTC.balanceOf() = 0.0000001*1e18 = 1e11\\n * oracle should return or = oracle.getFiatPrice1e18(wBTC) <=>\\n * <=> b*or = v => v/b = 315*1e13 / 1e11 = 315*1e2 \\u00b1 1e2\\n * error = or.error * b = 1e2 * 1e11 = 1e13 => 1e13/1e18 usd = 1e-5 = 0.00001 usd\\n *\\n * case #2: large amount of wBTC\\n * v = 2,000,000 wBTC = $31,503.77 * 2m \\u00b1 158*2m = $63,007,540,000 \\u00b1 $316,000,000 = 63,007*1e24 \\u00b1 316*1e24\\n * for calc convenience we increase error on 0.05 and have v = 63,000*24 \\u00b1 300*1e24 = (630 \\u00b1 3)*1e26\\n * b = 2*1e6 * 1e18 = 2*1e24\\n * or = v/b = (630 \\u00b1 3)*1e26 / 2*1e24 = 315*1e2 \\u00b1 1.5*1e2\\n * error = or.error * b = 1.5*100 * 2*1e24 = 3*1e26 = 3*1e8*1e18 = $300,000,000 ~ $316,000,000\\n *\\n * assume the market price of USDT = $0.97 \\u00b1 $0.00485,\\n *\\n * case #3: little amount of USDT\\n * v = USDT amount 0.005 = 0.005*(0.97 \\u00b1 0.00485) = 0.00485*1e18 \\u00b1 0.00002425*1e18 = 485*1e13 \\u00b1 3*1e13\\n * we rounded error up on (3000-2425)/2425 ~= +24% for calculation convenience.\\n * b = USDT.balanceOf() = 0.005*1e6 = 5*1e3\\n * b*or = v => or = v/b = (485*1e13 \\u00b1 3*1e13) / 5*1e3 = 970*1e9 \\u00b1 6*1e9\\n * error = 6*1e9 * 5*1e3 / 1e18 = 30*1e12/1e18 = 3*1e-5 = $0,00005\\n *\\n * case #4: lot of USDT\\n * v = we have 100,000,000,000 USDT = $97B = 97*1e9*1e18 \\u00b1 0.5*1e9*1e18\\n * b = USDT.balanceOf() = 1e11*1e6 = 1e17\\n * or = v/b = (97*1e9*1e18 \\u00b1 0.5*1e9*1e18) / 1e17 = 970*1e9 \\u00b1 5*1e9\\n * error = 5*1e9 * 1e17 = 5*1e26 = 0.5 * 1e8*1e18\\n *\\n * @param asset - address of erc20 token contract\\n * @return usdPrice1e18 such that asset.balanceOf() * getFiatPrice1e18(asset) / 1e18 == $$ * 1e18\\n **/\\n function getFiatPrice1e18(address asset) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xa56b9cc86ef5935efecc276e6a3188d518f1a99cad960083a8de35849c997687\",\"license\":\"UNLICENSED\"}},\"version\":1}",
"bytecode": "0x60808060405234610016576111c0908161001c8239f35b600080fdfe6080604081815260048036101561001557600080fd5b600092833560e01c90816301ffc9a714610da85750806303ee9f2214610d7c5780631459457a14610ae257806314c376dc14610aa757806324f204ce146109b457806341fbb0501461098b578063438280dd14610950578063550a1e001461070857806371d0fb41146106cd57806375b238fc146106b25780637ae8b2e1146106175780637d2f775a146104f25780638e5313e0146104b7578063c1c5017614610498578063d09a79dd146103e0578063d46e50d0146103b9578063dc97e84e14610390578063de51eefd1461034a578063e9c265181461031d5763fb313187146100ff57600080fd5b3461031957606036600319011261031957610118610e3e565b6024356044359160018060a01b0380875460101c169486518096632474521560e21b825260008051602061116b833981519152838301523360248301528160446020998a935afa90811561030f5789916102f2575b50156102e457600654156102d1576006885281868920541692600554868101908a88831291129080158216911516176102be57836101cf959493928b926005551693888785600254168c51988992839263095ea7b360e01b8452888401610eaa565b038185895af19384156102b457899660a495610287575b5060025416908a51978896879563c3f2b67d60e01b875286015260248501526044840152306064840152600160848401525af1801561027d5761024f575b507f44774e2297d3db5bced0cfd5129ff61632a7d013f5aa953ccbc8a829d56aee099251908152a180f35b8290813d8311610276575b6102648183610e59565b810103126102725738610224565b8380fd5b503d61025a565b84513d87823e3d90fd5b6102a690883d8a116102ad575b61029e8183610e59565b810190610e92565b50386101e6565b503d610294565b8a513d84823e3d90fd5b634e487b7160e01b8a526011835260248afd5b634e487b7160e01b885260329052602487fd5b865163200ab6d960e01b8152fd5b6103099150873d89116102ad5761029e8183610e59565b3861016d565b88513d8b823e3d90fd5b8280fd5b5050346103465781600319360112610346576020905160008051602061114b8339815191528152f35b5080fd5b505034610346576020366003190112610346576020906103876001600160a01b03610373610e3e565b166000526007602052604060002054151590565b90519015158152f35b5050346103465781600319360112610346576020905160008051602061116b8339815191528152f35b50346103195782600319360112610319575490516001600160a01b03909116815260209150f35b50919034610346576020366003190112610346576103fc610e3e565b82548251632474521560e21b815260008051602061114b833981519152868201523360248201526001600160a01b0393916020908290604490829060101c88165afa90811561048e578591610470575b5015610461575061045d9116610fe1565b5080f35b5163599a6c3360e11b81528490fd5b610488915060203d81116102ad5761029e8183610e59565b3861044c565b82513d87823e3d90fd5b5050346103465781600319360112610346576020906005549051908152f35b505034610346578160031936011261034657602090517fe453bacb314e78dcd5192e6b1a2b1f0e7c76e92f6b7e429a6a90f04e39db3b768152f35b5091903461034657816003193601126103465781548151632474521560e21b815260008051602061114b83398151915285820152336024820152602092916001600160a01b03919084908290604490829060101c86165afa90811561060d5785916105f0575b50156105e0578454169080516370a0823160e01b815230868201528381602481865afa93841561048e5785946105b0575b505082156105a157509061059e913390610f35565b80f35b51632d7de5ad60e11b81528490fd5b9080929450813d83116105d9575b6105c88183610e59565b810103126102725751913880610589565b503d6105be565b815163599a6c3360e11b81528590fd5b6106079150843d86116102ad5761029e8183610e59565b38610558565b83513d87823e3d90fd5b5091903461034657602036600319011261034657610633610e3e565b82548251632474521560e21b815260008051602061114b833981519152868201523360248201526001600160a01b0393916020908290604490829060101c88165afa90811561048e578591610694575b5015610461575061045d9116611060565b6106ac915060203d81116102ad5761029e8183610e59565b38610683565b50503461034657816003193601126103465751908152602090f35b505034610346578160031936011261034657602090517f880a91047114272656e533301261260c75e4d11543ac7303d6fe4204579ec7278152f35b50829034610346578260031936011261034657610723610e3e565b9060249384359160018060a01b039384811661074c816000526007602052604060002054151590565b1561093b57670de0b6b3a7640000808602908682041486151715610929578660015416968551978893631735856760e31b855286850152838b60209a8b935afa92831561091f5790899182946108e8575b5083156108d6578554168651898101906323b872dd60e01b8252338d8201523060448201528960648201526064815260a0810181811060018060401b038211176108c4578493929184918b5251925af16107f5610ef6565b81610894575b501561086c5790610810929104903390610f35565b6005548381039190868512801582851316918412161761085a57507f062234b32cab33fa5bcd957e318141fefab38cc79f25ec5b972be8392e98cb6c94955060055551908152a180f35b634e487b7160e01b8652601190528585fd5b845162461bcd60e51b81528085018890526003818b01526229aa2360e91b6044820152606490fd5b805180159250899083156108ac575b5050508a6107fb565b6108bc9350820181019101610e92565b8a88816108a3565b634e487b7160e01b8552604189528d85fd5b634e487b7160e01b8252601286528a82fd5b89809295508193503d8311610918575b6109028183610e59565b8101031261091457889051928b61079d565b8880fd5b503d6108f8565b86513d8b823e3d90fd5b634e487b7160e01b8852601184528888fd5b905086925191633935d9fb60e21b8352820152fd5b505034610346578160031936011261034657602090517f39f61ca2a1a28fee144218173ec637b649a353e4026b2738c673800e5bf1437b8152f35b50503461034657816003193601126103465760035490516001600160a01b039091168152602090f35b5091903461034657816003193601126103465781548151632474521560e21b815260008051602061114b833981519152858201523360248201526001600160a01b0392916020908290604490829060101c87165afa908115610a9d578491610a7f575b5015610a70576005549083821215610a6157508354600354908316921690600160ff1b8114610a4e578361059e9495500391610f35565b634e487b7160e01b845260118552602484fd5b516371cd57f760e11b81528490fd5b5163599a6c3360e11b81528390fd5b610a97915060203d81116102ad5761029e8183610e59565b38610a17565b82513d86823e3d90fd5b505034610346578160031936011261034657602090517fe965846df3dd5b1dfa65f58e31477079e90140e0908b6dd31b5aead5a57cf3658152f35b50346103195760a036600319011261031957610afc610e3e565b916001600160a01b03916024358381169190829003610d7857604435848116809103610d745760643591858316809303610d7057608435928684168094036109145788549460ff8660081c161595868097610d63575b8015610d4c575b15610cf25760ff1981166001178b5586610ce1575b5089549760ff8960081c1615610c8a5762010000600160b01b0360108b901b1662010000600160b01b03198a1681178c5588516301ffc9a760e01b8152637965db0b60e01b86820152909a909160209183916024918391165afa908115610c80578b91610c62575b5015610c525760018060a01b031993846001541617600155836002541617600255828254161790556003541617600355610c0e578380f35b610100600160b01b0319909116909117825551600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a13880808380f35b86516384d942fd60e01b81528390fd5b610c7a915060203d81116102ad5761029e8183610e59565b38610bd6565b88513d8d823e3d90fd5b875162461bcd60e51b8152602081860152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b61ffff1916610101178a5538610b6e565b875162461bcd60e51b8152602081860152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b158015610b595750600160ff821614610b59565b50600160ff821610610b52565b8780fd5b8680fd5b8580fd5b5050346103465781600319360112610346579054905160109190911c6001600160a01b03168152602090f35b929190503461027257602036600319011261027257803563ffffffff60e01b8116809103610e3a5784546301ffc9a760e01b8552918401526020908390602490829060101c6001600160a01b03165afa918215610e305760209392610e11575b50519015158152f35b610e29919250833d81116102ad5761029e8183610e59565b9038610e08565b81513d85823e3d90fd5b8480fd5b600435906001600160a01b0382168203610e5457565b600080fd5b601f909101601f19168101906001600160401b03821190821017610e7c57604052565b634e487b7160e01b600052604160045260246000fd5b90816020910312610e5457518015158103610e545790565b6001600160a01b039091168152602081019190915260400190565b600654811015610ee057600660005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b3d15610f30573d906001600160401b038211610e7c5760405191610f24601f8201601f191660200184610e59565b82523d6000602084013e565b606090565b6000929183610f60610f6e8295604051928391602083019663a9059cbb60e01b885260248401610eaa565b03601f198101835282610e59565b51925af1610f7a610ef6565b81610fb2575b5015610f8857565b60405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606490fd5b8051801592508215610fc7575b505038610f80565b610fda9250602080918301019101610e92565b3880610fbf565b60008181526007602052604081205461105b57600654600160401b81101561104757908261103361101a84600160409601600655610ec5565b819391549060031b600019811b9283911b169119161790565b905560065492815260076020522055600190565b634e487b7160e01b82526041600452602482fd5b905090565b60008181526007602052604081205490919080156111455760001990808201818111611131576006549083820191821161111d578082036110e9575b50505060065480156110d5578101906110b482610ec5565b909182549160031b1b19169055600655815260076020526040812055600190565b634e487b7160e01b84526031600452602484fd5b6111076110f861101a93610ec5565b90549060031b1c928392610ec5565b905584526007602052604084205538808061109c565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b50509056fe3b5d4cc60d3ec3516ee8ae083bd60934f6eb2a6c54b1229985c41bfb092b26039a9aef7c1247d5fc769b0185c052913e39673da29a880317dfd20ebf86f26a49a26469706673582212202611d48ce9da0241c8c73ab8bb0b1bfa19012e3d01eb61d8aea39d027465a2ef64736f6c63430008110033",
"deployedBytecode": "0x6080604081815260048036101561001557600080fd5b600092833560e01c90816301ffc9a714610da85750806303ee9f2214610d7c5780631459457a14610ae257806314c376dc14610aa757806324f204ce146109b457806341fbb0501461098b578063438280dd14610950578063550a1e001461070857806371d0fb41146106cd57806375b238fc146106b25780637ae8b2e1146106175780637d2f775a146104f25780638e5313e0146104b7578063c1c5017614610498578063d09a79dd146103e0578063d46e50d0146103b9578063dc97e84e14610390578063de51eefd1461034a578063e9c265181461031d5763fb313187146100ff57600080fd5b3461031957606036600319011261031957610118610e3e565b6024356044359160018060a01b0380875460101c169486518096632474521560e21b825260008051602061116b833981519152838301523360248301528160446020998a935afa90811561030f5789916102f2575b50156102e457600654156102d1576006885281868920541692600554868101908a88831291129080158216911516176102be57836101cf959493928b926005551693888785600254168c51988992839263095ea7b360e01b8452888401610eaa565b038185895af19384156102b457899660a495610287575b5060025416908a51978896879563c3f2b67d60e01b875286015260248501526044840152306064840152600160848401525af1801561027d5761024f575b507f44774e2297d3db5bced0cfd5129ff61632a7d013f5aa953ccbc8a829d56aee099251908152a180f35b8290813d8311610276575b6102648183610e59565b810103126102725738610224565b8380fd5b503d61025a565b84513d87823e3d90fd5b6102a690883d8a116102ad575b61029e8183610e59565b810190610e92565b50386101e6565b503d610294565b8a513d84823e3d90fd5b634e487b7160e01b8a526011835260248afd5b634e487b7160e01b885260329052602487fd5b865163200ab6d960e01b8152fd5b6103099150873d89116102ad5761029e8183610e59565b3861016d565b88513d8b823e3d90fd5b8280fd5b5050346103465781600319360112610346576020905160008051602061114b8339815191528152f35b5080fd5b505034610346576020366003190112610346576020906103876001600160a01b03610373610e3e565b166000526007602052604060002054151590565b90519015158152f35b5050346103465781600319360112610346576020905160008051602061116b8339815191528152f35b50346103195782600319360112610319575490516001600160a01b03909116815260209150f35b50919034610346576020366003190112610346576103fc610e3e565b82548251632474521560e21b815260008051602061114b833981519152868201523360248201526001600160a01b0393916020908290604490829060101c88165afa90811561048e578591610470575b5015610461575061045d9116610fe1565b5080f35b5163599a6c3360e11b81528490fd5b610488915060203d81116102ad5761029e8183610e59565b3861044c565b82513d87823e3d90fd5b5050346103465781600319360112610346576020906005549051908152f35b505034610346578160031936011261034657602090517fe453bacb314e78dcd5192e6b1a2b1f0e7c76e92f6b7e429a6a90f04e39db3b768152f35b5091903461034657816003193601126103465781548151632474521560e21b815260008051602061114b83398151915285820152336024820152602092916001600160a01b03919084908290604490829060101c86165afa90811561060d5785916105f0575b50156105e0578454169080516370a0823160e01b815230868201528381602481865afa93841561048e5785946105b0575b505082156105a157509061059e913390610f35565b80f35b51632d7de5ad60e11b81528490fd5b9080929450813d83116105d9575b6105c88183610e59565b810103126102725751913880610589565b503d6105be565b815163599a6c3360e11b81528590fd5b6106079150843d86116102ad5761029e8183610e59565b38610558565b83513d87823e3d90fd5b5091903461034657602036600319011261034657610633610e3e565b82548251632474521560e21b815260008051602061114b833981519152868201523360248201526001600160a01b0393916020908290604490829060101c88165afa90811561048e578591610694575b5015610461575061045d9116611060565b6106ac915060203d81116102ad5761029e8183610e59565b38610683565b50503461034657816003193601126103465751908152602090f35b505034610346578160031936011261034657602090517f880a91047114272656e533301261260c75e4d11543ac7303d6fe4204579ec7278152f35b50829034610346578260031936011261034657610723610e3e565b9060249384359160018060a01b039384811661074c816000526007602052604060002054151590565b1561093b57670de0b6b3a7640000808602908682041486151715610929578660015416968551978893631735856760e31b855286850152838b60209a8b935afa92831561091f5790899182946108e8575b5083156108d6578554168651898101906323b872dd60e01b8252338d8201523060448201528960648201526064815260a0810181811060018060401b038211176108c4578493929184918b5251925af16107f5610ef6565b81610894575b501561086c5790610810929104903390610f35565b6005548381039190868512801582851316918412161761085a57507f062234b32cab33fa5bcd957e318141fefab38cc79f25ec5b972be8392e98cb6c94955060055551908152a180f35b634e487b7160e01b8652601190528585fd5b845162461bcd60e51b81528085018890526003818b01526229aa2360e91b6044820152606490fd5b805180159250899083156108ac575b5050508a6107fb565b6108bc9350820181019101610e92565b8a88816108a3565b634e487b7160e01b8552604189528d85fd5b634e487b7160e01b8252601286528a82fd5b89809295508193503d8311610918575b6109028183610e59565b8101031261091457889051928b61079d565b8880fd5b503d6108f8565b86513d8b823e3d90fd5b634e487b7160e01b8852601184528888fd5b905086925191633935d9fb60e21b8352820152fd5b505034610346578160031936011261034657602090517f39f61ca2a1a28fee144218173ec637b649a353e4026b2738c673800e5bf1437b8152f35b50503461034657816003193601126103465760035490516001600160a01b039091168152602090f35b5091903461034657816003193601126103465781548151632474521560e21b815260008051602061114b833981519152858201523360248201526001600160a01b0392916020908290604490829060101c87165afa908115610a9d578491610a7f575b5015610a70576005549083821215610a6157508354600354908316921690600160ff1b8114610a4e578361059e9495500391610f35565b634e487b7160e01b845260118552602484fd5b516371cd57f760e11b81528490fd5b5163599a6c3360e11b81528390fd5b610a97915060203d81116102ad5761029e8183610e59565b38610a17565b82513d86823e3d90fd5b505034610346578160031936011261034657602090517fe965846df3dd5b1dfa65f58e31477079e90140e0908b6dd31b5aead5a57cf3658152f35b50346103195760a036600319011261031957610afc610e3e565b916001600160a01b03916024358381169190829003610d7857604435848116809103610d745760643591858316809303610d7057608435928684168094036109145788549460ff8660081c161595868097610d63575b8015610d4c575b15610cf25760ff1981166001178b5586610ce1575b5089549760ff8960081c1615610c8a5762010000600160b01b0360108b901b1662010000600160b01b03198a1681178c5588516301ffc9a760e01b8152637965db0b60e01b86820152909a909160209183916024918391165afa908115610c80578b91610c62575b5015610c525760018060a01b031993846001541617600155836002541617600255828254161790556003541617600355610c0e578380f35b610100600160b01b0319909116909117825551600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602090a13880808380f35b86516384d942fd60e01b81528390fd5b610c7a915060203d81116102ad5761029e8183610e59565b38610bd6565b88513d8d823e3d90fd5b875162461bcd60e51b8152602081860152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b61ffff1916610101178a5538610b6e565b875162461bcd60e51b8152602081860152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b158015610b595750600160ff821614610b59565b50600160ff821610610b52565b8780fd5b8680fd5b8580fd5b5050346103465781600319360112610346579054905160109190911c6001600160a01b03168152602090f35b929190503461027257602036600319011261027257803563ffffffff60e01b8116809103610e3a5784546301ffc9a760e01b8552918401526020908390602490829060101c6001600160a01b03165afa918215610e305760209392610e11575b50519015158152f35b610e29919250833d81116102ad5761029e8183610e59565b9038610e08565b81513d85823e3d90fd5b8480fd5b600435906001600160a01b0382168203610e5457565b600080fd5b601f909101601f19168101906001600160401b03821190821017610e7c57604052565b634e487b7160e01b600052604160045260246000fd5b90816020910312610e5457518015158103610e545790565b6001600160a01b039091168152602081019190915260400190565b600654811015610ee057600660005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b3d15610f30573d906001600160401b038211610e7c5760405191610f24601f8201601f191660200184610e59565b82523d6000602084013e565b606090565b6000929183610f60610f6e8295604051928391602083019663a9059cbb60e01b885260248401610eaa565b03601f198101835282610e59565b51925af1610f7a610ef6565b81610fb2575b5015610f8857565b60405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606490fd5b8051801592508215610fc7575b505038610f80565b610fda9250602080918301019101610e92565b3880610fbf565b60008181526007602052604081205461105b57600654600160401b81101561104757908261103361101a84600160409601600655610ec5565b819391549060031b600019811b9283911b169119161790565b905560065492815260076020522055600190565b634e487b7160e01b82526041600452602482fd5b905090565b60008181526007602052604081205490919080156111455760001990808201818111611131576006549083820191821161111d578082036110e9575b50505060065480156110d5578101906110b482610ec5565b909182549160031b1b19169055600655815260076020526040812055600190565b634e487b7160e01b84526031600452602484fd5b6111076110f861101a93610ec5565b90549060031b1c928392610ec5565b905584526007602052604084205538808061109c565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b50509056fe3b5d4cc60d3ec3516ee8ae083bd60934f6eb2a6c54b1229985c41bfb092b26039a9aef7c1247d5fc769b0185c052913e39673da29a880317dfd20ebf86f26a49a26469706673582212202611d48ce9da0241c8c73ab8bb0b1bfa19012e3d01eb61d8aea39d027465a2ef64736f6c63430008110033",
"devdoc": {
"details": "See ISuLiquidationMiddleware interface for full details.",
"kind": "dev",
"methods": {
"borrowCollateralToSell(address,uint256,uint256)": {
"details": "TriggerLiquidation in SuManager need to send collateral to this contract and call this function",
"params": {
"amount": "- The amount of LP-token to be unwrapped",
"collateral": "- collateral token address",
"debt": "- debt to the SuManager - how much StablePro user borrow using this collateral*"
}
},
"supportsInterface(bytes4)": {
"details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas."
}
},
"title": "SuLiquidationMiddleware",
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {
"borrowCollateralToSell(address,uint256,uint256)": {
"notice": "Set order to swap collateral to stablecoin to exchange module and store his debt to the SuManager"
},
"sendProfitToFoundation()": {
"notice": "DAO can send profit after liquidations that accumulates in this contract to foundation*"
},
"sendStableProToDAO()": {
"notice": "After swapping Stablecoin to users StablePro Middleware can send them to DAO, that can send them to liquidity pool, burn them and etc.*"
}
},
"version": 1
},
"storageLayout": {
"storage": [
{
"astId": 671,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8"
},
{
"astId": 674,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool"
},
{
"astId": 28586,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "ACCESS_CONTROL_SINGLETON",
"offset": 2,
"slot": "0",
"type": "t_contract(ISuAccessControl)32175"
},
{
"astId": 27051,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_oracle",
"offset": 0,
"slot": "1",
"type": "t_contract(ISuOracle)32359"
},
{
"astId": 27053,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_exchangeModule",
"offset": 0,
"slot": "2",
"type": "t_address"
},
{
"astId": 27055,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "foundation",
"offset": 0,
"slot": "3",
"type": "t_address"
},
{
"astId": 27057,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "stablePro",
"offset": 0,
"slot": "4",
"type": "t_address"
},
{
"astId": 27059,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "middlewareDebt",
"offset": 0,
"slot": "5",
"type": "t_int256"
},
{
"astId": 27062,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_stablecoinWhitelist",
"offset": 0,
"slot": "6",
"type": "t_struct(AddressSet)4927_storage"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_bytes32)dyn_storage": {
"base": "t_bytes32",
"encoding": "dynamic_array",
"label": "bytes32[]",
"numberOfBytes": "32"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes32": {
"encoding": "inplace",
"label": "bytes32",
"numberOfBytes": "32"
},
"t_contract(ISuAccessControl)32175": {
"encoding": "inplace",
"label": "contract ISuAccessControl",
"numberOfBytes": "20"
},
"t_contract(ISuOracle)32359": {
"encoding": "inplace",
"label": "contract ISuOracle",
"numberOfBytes": "20"
},
"t_int256": {
"encoding": "inplace",
"label": "int256",
"numberOfBytes": "32"
},
"t_mapping(t_bytes32,t_uint256)": {
"encoding": "mapping",
"key": "t_bytes32",
"label": "mapping(bytes32 => uint256)",
"numberOfBytes": "32",
"value": "t_uint256"
},
"t_struct(AddressSet)4927_storage": {
"encoding": "inplace",
"label": "struct EnumerableSetUpgradeable.AddressSet",
"members": [
{
"astId": 4926,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_inner",
"offset": 0,
"slot": "0",
"type": "t_struct(Set)4612_storage"
}
],
"numberOfBytes": "64"
},
"t_struct(Set)4612_storage": {
"encoding": "inplace",
"label": "struct EnumerableSetUpgradeable.Set",
"members": [
{
"astId": 4607,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_values",
"offset": 0,
"slot": "0",
"type": "t_array(t_bytes32)dyn_storage"
},
{
"astId": 4611,
"contract": "contracts/liquidator/SuLiquidationMiddleware.sol:SuLiquidationMiddleware",
"label": "_indexes",
"offset": 0,
"slot": "1",
"type": "t_mapping(t_bytes32,t_uint256)"
}
],
"numberOfBytes": "64"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"encoding": "inplace",
"label": "uint8",
"numberOfBytes": "1"
}
}
}
}