@bgd-labs/aave-address-book 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/.gitmodules +4 -0
  2. package/CHANGELOG.md +56 -0
  3. package/LICENSE +7 -0
  4. package/README.md +94 -0
  5. package/addressbook_logo.png +0 -0
  6. package/dist/AaveAddressBook.d.ts +17 -0
  7. package/dist/AaveAddressBook.js +20 -0
  8. package/dist/AaveV2Avalanche.d.ts +9 -0
  9. package/dist/AaveV2Avalanche.js +12 -0
  10. package/dist/AaveV2Ethereum.d.ts +9 -0
  11. package/dist/AaveV2Ethereum.js +12 -0
  12. package/dist/AaveV2EthereumAMM.d.ts +9 -0
  13. package/dist/AaveV2EthereumAMM.js +12 -0
  14. package/dist/AaveV2EthereumArc.d.ts +9 -0
  15. package/dist/AaveV2EthereumArc.js +12 -0
  16. package/dist/AaveV2Fuji.d.ts +9 -0
  17. package/dist/AaveV2Fuji.js +12 -0
  18. package/dist/AaveV2Mumbai.d.ts +9 -0
  19. package/dist/AaveV2Mumbai.js +12 -0
  20. package/dist/AaveV2Polygon.d.ts +9 -0
  21. package/dist/AaveV2Polygon.js +12 -0
  22. package/dist/AaveV3Arbitrum.d.ts +9 -0
  23. package/dist/AaveV3Arbitrum.js +12 -0
  24. package/dist/AaveV3Avalanche.d.ts +9 -0
  25. package/dist/AaveV3Avalanche.js +12 -0
  26. package/dist/AaveV3Fantom.d.ts +9 -0
  27. package/dist/AaveV3Fantom.js +12 -0
  28. package/dist/AaveV3FantomTestnet.d.ts +9 -0
  29. package/dist/AaveV3FantomTestnet.js +12 -0
  30. package/dist/AaveV3Fuji.d.ts +9 -0
  31. package/dist/AaveV3Fuji.js +12 -0
  32. package/dist/AaveV3Harmony.d.ts +9 -0
  33. package/dist/AaveV3Harmony.js +12 -0
  34. package/dist/AaveV3Mumbai.d.ts +9 -0
  35. package/dist/AaveV3Mumbai.js +12 -0
  36. package/dist/AaveV3Optimism.d.ts +9 -0
  37. package/dist/AaveV3Optimism.js +12 -0
  38. package/dist/AaveV3OptimismKovan.d.ts +9 -0
  39. package/dist/AaveV3OptimismKovan.js +12 -0
  40. package/dist/AaveV3Polygon.d.ts +9 -0
  41. package/dist/AaveV3Polygon.js +12 -0
  42. package/foundry.toml +8 -0
  43. package/lib/forge-std/.github/workflows/tests.yml +27 -0
  44. package/lib/forge-std/.gitmodules +3 -0
  45. package/lib/forge-std/LICENSE-APACHE +203 -0
  46. package/lib/forge-std/LICENSE-MIT +25 -0
  47. package/lib/forge-std/README.md +246 -0
  48. package/lib/forge-std/lib/ds-test/LICENSE +674 -0
  49. package/lib/forge-std/lib/ds-test/Makefile +14 -0
  50. package/lib/forge-std/lib/ds-test/default.nix +4 -0
  51. package/lib/forge-std/lib/ds-test/demo/demo.sol +222 -0
  52. package/lib/forge-std/lib/ds-test/src/test.sol +469 -0
  53. package/lib/forge-std/src/Script.sol +39 -0
  54. package/lib/forge-std/src/StdJson.sol +118 -0
  55. package/lib/forge-std/src/Test.sol +1134 -0
  56. package/lib/forge-std/src/Vm.sol +231 -0
  57. package/lib/forge-std/src/console.sol +1533 -0
  58. package/lib/forge-std/src/console2.sol +1538 -0
  59. package/lib/forge-std/src/test/Script.t.sol +12 -0
  60. package/lib/forge-std/src/test/StdAssertions.t.sol +591 -0
  61. package/lib/forge-std/src/test/StdCheats.t.sol +282 -0
  62. package/lib/forge-std/src/test/StdError.t.sol +124 -0
  63. package/lib/forge-std/src/test/StdMath.t.sol +200 -0
  64. package/lib/forge-std/src/test/StdStorage.t.sol +321 -0
  65. package/lib/forge-std/src/test/fixtures/broadcast.log.json +187 -0
  66. package/package.json +39 -0
  67. package/src/AaveAddressBook.sol +28 -0
  68. package/src/AaveAddressBookV2.sol +143 -0
  69. package/src/AaveAddressBookV2Testnet.sol +74 -0
  70. package/src/AaveAddressBookV3.sol +166 -0
  71. package/src/AaveAddressBookV3Testnet.sol +120 -0
  72. package/src/AaveGovernanceV2.sol +549 -0
  73. package/src/AaveV2.sol +931 -0
  74. package/src/AaveV2Avalanche.sol +35 -0
  75. package/src/AaveV2Ethereum.sol +36 -0
  76. package/src/AaveV2EthereumAMM.sol +36 -0
  77. package/src/AaveV2EthereumArc.sol +36 -0
  78. package/src/AaveV2Fuji.sol +35 -0
  79. package/src/AaveV2Mumbai.sol +35 -0
  80. package/src/AaveV2Polygon.sol +35 -0
  81. package/src/AaveV3.sol +2406 -0
  82. package/src/AaveV3Arbitrum.sol +34 -0
  83. package/src/AaveV3Avalanche.sol +34 -0
  84. package/src/AaveV3Fantom.sol +34 -0
  85. package/src/AaveV3FantomTestnet.sol +34 -0
  86. package/src/AaveV3Fuji.sol +34 -0
  87. package/src/AaveV3Harmony.sol +34 -0
  88. package/src/AaveV3HarmonyTestnet.sol +34 -0
  89. package/src/AaveV3Mumbai.sol +34 -0
  90. package/src/AaveV3Optimism.sol +34 -0
  91. package/src/AaveV3OptimismKovan.sol +34 -0
  92. package/src/AaveV3Polygon.sol +34 -0
  93. package/src/Common.sol +9 -0
  94. package/src/test/AaveV2Ethereum.t.sol +72 -0
  95. package/src/test/AaveV2Misfits.t.sol +33 -0
  96. package/src/test/AaveV3Avalanche.t.sol +65 -0
  97. package/src/ts/AaveAddressBook.ts +17 -0
  98. package/src/ts/AaveV2Avalanche.ts +11 -0
  99. package/src/ts/AaveV2Ethereum.ts +12 -0
  100. package/src/ts/AaveV2EthereumAMM.ts +12 -0
  101. package/src/ts/AaveV2EthereumArc.ts +12 -0
  102. package/src/ts/AaveV2Fuji.ts +11 -0
  103. package/src/ts/AaveV2Mumbai.ts +11 -0
  104. package/src/ts/AaveV2Polygon.ts +11 -0
  105. package/src/ts/AaveV3Arbitrum.ts +12 -0
  106. package/src/ts/AaveV3Avalanche.ts +12 -0
  107. package/src/ts/AaveV3Fantom.ts +12 -0
  108. package/src/ts/AaveV3FantomTestnet.ts +12 -0
  109. package/src/ts/AaveV3Fuji.ts +12 -0
  110. package/src/ts/AaveV3Harmony.ts +12 -0
  111. package/src/ts/AaveV3Mumbai.ts +12 -0
  112. package/src/ts/AaveV3Optimism.ts +12 -0
  113. package/src/ts/AaveV3OptimismKovan.ts +12 -0
  114. package/src/ts/AaveV3Polygon.ts +12 -0
  115. package/tsconfig.json +101 -0
package/src/AaveV3.sol ADDED
@@ -0,0 +1,2406 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.6.0;
3
+
4
+ library DataTypes {
5
+ struct ReserveData {
6
+ //stores the reserve configuration
7
+ ReserveConfigurationMap configuration;
8
+ //the liquidity index. Expressed in ray
9
+ uint128 liquidityIndex;
10
+ //the current supply rate. Expressed in ray
11
+ uint128 currentLiquidityRate;
12
+ //variable borrow index. Expressed in ray
13
+ uint128 variableBorrowIndex;
14
+ //the current variable borrow rate. Expressed in ray
15
+ uint128 currentVariableBorrowRate;
16
+ //the current stable borrow rate. Expressed in ray
17
+ uint128 currentStableBorrowRate;
18
+ //timestamp of last update
19
+ uint40 lastUpdateTimestamp;
20
+ //the id of the reserve. Represents the position in the list of the active reserves
21
+ uint16 id;
22
+ //aToken address
23
+ address aTokenAddress;
24
+ //stableDebtToken address
25
+ address stableDebtTokenAddress;
26
+ //variableDebtToken address
27
+ address variableDebtTokenAddress;
28
+ //address of the interest rate strategy
29
+ address interestRateStrategyAddress;
30
+ //the current treasury balance, scaled
31
+ uint128 accruedToTreasury;
32
+ //the outstanding unbacked aTokens minted through the bridging feature
33
+ uint128 unbacked;
34
+ //the outstanding debt borrowed against this asset in isolation mode
35
+ uint128 isolationModeTotalDebt;
36
+ }
37
+
38
+ struct ReserveConfigurationMap {
39
+ //bit 0-15: LTV
40
+ //bit 16-31: Liq. threshold
41
+ //bit 32-47: Liq. bonus
42
+ //bit 48-55: Decimals
43
+ //bit 56: reserve is active
44
+ //bit 57: reserve is frozen
45
+ //bit 58: borrowing is enabled
46
+ //bit 59: stable rate borrowing enabled
47
+ //bit 60: asset is paused
48
+ //bit 61: borrowing in isolation mode is enabled
49
+ //bit 62-63: reserved
50
+ //bit 64-79: reserve factor
51
+ //bit 80-115 borrow cap in whole tokens, borrowCap == 0 => no cap
52
+ //bit 116-151 supply cap in whole tokens, supplyCap == 0 => no cap
53
+ //bit 152-167 liquidation protocol fee
54
+ //bit 168-175 eMode category
55
+ //bit 176-211 unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled
56
+ //bit 212-251 debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals
57
+ //bit 252-255 unused
58
+
59
+ uint256 data;
60
+ }
61
+
62
+ struct UserConfigurationMap {
63
+ /**
64
+ * @dev Bitmap of the users collaterals and borrows. It is divided in pairs of bits, one pair per asset.
65
+ * The first bit indicates if an asset is used as collateral by the user, the second whether an
66
+ * asset is borrowed by the user.
67
+ */
68
+ uint256 data;
69
+ }
70
+
71
+ struct EModeCategory {
72
+ // each eMode category has a custom ltv and liquidation threshold
73
+ uint16 ltv;
74
+ uint16 liquidationThreshold;
75
+ uint16 liquidationBonus;
76
+ // each eMode category may or may not have a custom oracle to override the individual assets price oracles
77
+ address priceSource;
78
+ string label;
79
+ }
80
+
81
+ enum InterestRateMode {
82
+ NONE,
83
+ STABLE,
84
+ VARIABLE
85
+ }
86
+
87
+ struct ReserveCache {
88
+ uint256 currScaledVariableDebt;
89
+ uint256 nextScaledVariableDebt;
90
+ uint256 currPrincipalStableDebt;
91
+ uint256 currAvgStableBorrowRate;
92
+ uint256 currTotalStableDebt;
93
+ uint256 nextAvgStableBorrowRate;
94
+ uint256 nextTotalStableDebt;
95
+ uint256 currLiquidityIndex;
96
+ uint256 nextLiquidityIndex;
97
+ uint256 currVariableBorrowIndex;
98
+ uint256 nextVariableBorrowIndex;
99
+ uint256 currLiquidityRate;
100
+ uint256 currVariableBorrowRate;
101
+ uint256 reserveFactor;
102
+ ReserveConfigurationMap reserveConfiguration;
103
+ address aTokenAddress;
104
+ address stableDebtTokenAddress;
105
+ address variableDebtTokenAddress;
106
+ uint40 reserveLastUpdateTimestamp;
107
+ uint40 stableDebtLastUpdateTimestamp;
108
+ }
109
+
110
+ struct ExecuteLiquidationCallParams {
111
+ uint256 reservesCount;
112
+ uint256 debtToCover;
113
+ address collateralAsset;
114
+ address debtAsset;
115
+ address user;
116
+ bool receiveAToken;
117
+ address priceOracle;
118
+ uint8 userEModeCategory;
119
+ address priceOracleSentinel;
120
+ }
121
+
122
+ struct ExecuteSupplyParams {
123
+ address asset;
124
+ uint256 amount;
125
+ address onBehalfOf;
126
+ uint16 referralCode;
127
+ }
128
+
129
+ struct ExecuteBorrowParams {
130
+ address asset;
131
+ address user;
132
+ address onBehalfOf;
133
+ uint256 amount;
134
+ InterestRateMode interestRateMode;
135
+ uint16 referralCode;
136
+ bool releaseUnderlying;
137
+ uint256 maxStableRateBorrowSizePercent;
138
+ uint256 reservesCount;
139
+ address oracle;
140
+ uint8 userEModeCategory;
141
+ address priceOracleSentinel;
142
+ }
143
+
144
+ struct ExecuteRepayParams {
145
+ address asset;
146
+ uint256 amount;
147
+ InterestRateMode interestRateMode;
148
+ address onBehalfOf;
149
+ bool useATokens;
150
+ }
151
+
152
+ struct ExecuteWithdrawParams {
153
+ address asset;
154
+ uint256 amount;
155
+ address to;
156
+ uint256 reservesCount;
157
+ address oracle;
158
+ uint8 userEModeCategory;
159
+ }
160
+
161
+ struct ExecuteSetUserEModeParams {
162
+ uint256 reservesCount;
163
+ address oracle;
164
+ uint8 categoryId;
165
+ }
166
+
167
+ struct FinalizeTransferParams {
168
+ address asset;
169
+ address from;
170
+ address to;
171
+ uint256 amount;
172
+ uint256 balanceFromBefore;
173
+ uint256 balanceToBefore;
174
+ uint256 reservesCount;
175
+ address oracle;
176
+ uint8 fromEModeCategory;
177
+ }
178
+
179
+ struct FlashloanParams {
180
+ address receiverAddress;
181
+ address[] assets;
182
+ uint256[] amounts;
183
+ uint256[] interestRateModes;
184
+ address onBehalfOf;
185
+ bytes params;
186
+ uint16 referralCode;
187
+ uint256 flashLoanPremiumToProtocol;
188
+ uint256 flashLoanPremiumTotal;
189
+ uint256 maxStableRateBorrowSizePercent;
190
+ uint256 reservesCount;
191
+ address addressesProvider;
192
+ uint8 userEModeCategory;
193
+ bool isAuthorizedFlashBorrower;
194
+ }
195
+
196
+ struct FlashloanSimpleParams {
197
+ address receiverAddress;
198
+ address asset;
199
+ uint256 amount;
200
+ bytes params;
201
+ uint16 referralCode;
202
+ uint256 flashLoanPremiumToProtocol;
203
+ uint256 flashLoanPremiumTotal;
204
+ }
205
+
206
+ struct FlashLoanRepaymentParams {
207
+ uint256 amount;
208
+ uint256 totalPremium;
209
+ uint256 flashLoanPremiumToProtocol;
210
+ address asset;
211
+ address receiverAddress;
212
+ uint16 referralCode;
213
+ }
214
+
215
+ struct CalculateUserAccountDataParams {
216
+ UserConfigurationMap userConfig;
217
+ uint256 reservesCount;
218
+ address user;
219
+ address oracle;
220
+ uint8 userEModeCategory;
221
+ }
222
+
223
+ struct ValidateBorrowParams {
224
+ ReserveCache reserveCache;
225
+ UserConfigurationMap userConfig;
226
+ address asset;
227
+ address userAddress;
228
+ uint256 amount;
229
+ InterestRateMode interestRateMode;
230
+ uint256 maxStableLoanPercent;
231
+ uint256 reservesCount;
232
+ address oracle;
233
+ uint8 userEModeCategory;
234
+ address priceOracleSentinel;
235
+ bool isolationModeActive;
236
+ address isolationModeCollateralAddress;
237
+ uint256 isolationModeDebtCeiling;
238
+ }
239
+
240
+ struct ValidateLiquidationCallParams {
241
+ ReserveCache debtReserveCache;
242
+ uint256 totalDebt;
243
+ uint256 healthFactor;
244
+ address priceOracleSentinel;
245
+ }
246
+
247
+ struct CalculateInterestRatesParams {
248
+ uint256 unbacked;
249
+ uint256 liquidityAdded;
250
+ uint256 liquidityTaken;
251
+ uint256 totalStableDebt;
252
+ uint256 totalVariableDebt;
253
+ uint256 averageStableBorrowRate;
254
+ uint256 reserveFactor;
255
+ address reserve;
256
+ address aToken;
257
+ }
258
+
259
+ struct InitReserveParams {
260
+ address asset;
261
+ address aTokenAddress;
262
+ address stableDebtAddress;
263
+ address variableDebtAddress;
264
+ address interestRateStrategyAddress;
265
+ uint16 reservesCount;
266
+ uint16 maxNumberReserves;
267
+ }
268
+ }
269
+
270
+ library ConfiguratorInputTypes {
271
+ struct InitReserveInput {
272
+ address aTokenImpl;
273
+ address stableDebtTokenImpl;
274
+ address variableDebtTokenImpl;
275
+ uint8 underlyingAssetDecimals;
276
+ address interestRateStrategyAddress;
277
+ address underlyingAsset;
278
+ address treasury;
279
+ address incentivesController;
280
+ string aTokenName;
281
+ string aTokenSymbol;
282
+ string variableDebtTokenName;
283
+ string variableDebtTokenSymbol;
284
+ string stableDebtTokenName;
285
+ string stableDebtTokenSymbol;
286
+ bytes params;
287
+ }
288
+
289
+ struct UpdateATokenInput {
290
+ address asset;
291
+ address treasury;
292
+ address incentivesController;
293
+ string name;
294
+ string symbol;
295
+ address implementation;
296
+ bytes params;
297
+ }
298
+
299
+ struct UpdateDebtTokenInput {
300
+ address asset;
301
+ address incentivesController;
302
+ string name;
303
+ string symbol;
304
+ address implementation;
305
+ bytes params;
306
+ }
307
+ }
308
+
309
+ interface IPoolAddressesProvider {
310
+ /**
311
+ * @dev Emitted when the market identifier is updated.
312
+ * @param oldMarketId The old id of the market
313
+ * @param newMarketId The new id of the market
314
+ */
315
+ event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);
316
+
317
+ /**
318
+ * @dev Emitted when the pool is updated.
319
+ * @param oldAddress The old address of the Pool
320
+ * @param newAddress The new address of the Pool
321
+ */
322
+ event PoolUpdated(address indexed oldAddress, address indexed newAddress);
323
+
324
+ /**
325
+ * @dev Emitted when the pool configurator is updated.
326
+ * @param oldAddress The old address of the PoolConfigurator
327
+ * @param newAddress The new address of the PoolConfigurator
328
+ */
329
+ event PoolConfiguratorUpdated(
330
+ address indexed oldAddress,
331
+ address indexed newAddress
332
+ );
333
+
334
+ /**
335
+ * @dev Emitted when the price oracle is updated.
336
+ * @param oldAddress The old address of the PriceOracle
337
+ * @param newAddress The new address of the PriceOracle
338
+ */
339
+ event PriceOracleUpdated(
340
+ address indexed oldAddress,
341
+ address indexed newAddress
342
+ );
343
+
344
+ /**
345
+ * @dev Emitted when the ACL manager is updated.
346
+ * @param oldAddress The old address of the ACLManager
347
+ * @param newAddress The new address of the ACLManager
348
+ */
349
+ event ACLManagerUpdated(
350
+ address indexed oldAddress,
351
+ address indexed newAddress
352
+ );
353
+
354
+ /**
355
+ * @dev Emitted when the ACL admin is updated.
356
+ * @param oldAddress The old address of the ACLAdmin
357
+ * @param newAddress The new address of the ACLAdmin
358
+ */
359
+ event ACLAdminUpdated(address indexed oldAddress, address indexed newAddress);
360
+
361
+ /**
362
+ * @dev Emitted when the price oracle sentinel is updated.
363
+ * @param oldAddress The old address of the PriceOracleSentinel
364
+ * @param newAddress The new address of the PriceOracleSentinel
365
+ */
366
+ event PriceOracleSentinelUpdated(
367
+ address indexed oldAddress,
368
+ address indexed newAddress
369
+ );
370
+
371
+ /**
372
+ * @dev Emitted when the pool data provider is updated.
373
+ * @param oldAddress The old address of the PoolDataProvider
374
+ * @param newAddress The new address of the PoolDataProvider
375
+ */
376
+ event PoolDataProviderUpdated(
377
+ address indexed oldAddress,
378
+ address indexed newAddress
379
+ );
380
+
381
+ /**
382
+ * @dev Emitted when a new proxy is created.
383
+ * @param id The identifier of the proxy
384
+ * @param proxyAddress The address of the created proxy contract
385
+ * @param implementationAddress The address of the implementation contract
386
+ */
387
+ event ProxyCreated(
388
+ bytes32 indexed id,
389
+ address indexed proxyAddress,
390
+ address indexed implementationAddress
391
+ );
392
+
393
+ /**
394
+ * @dev Emitted when a new non-proxied contract address is registered.
395
+ * @param id The identifier of the contract
396
+ * @param oldAddress The address of the old contract
397
+ * @param newAddress The address of the new contract
398
+ */
399
+ event AddressSet(
400
+ bytes32 indexed id,
401
+ address indexed oldAddress,
402
+ address indexed newAddress
403
+ );
404
+
405
+ /**
406
+ * @dev Emitted when the implementation of the proxy registered with id is updated
407
+ * @param id The identifier of the contract
408
+ * @param proxyAddress The address of the proxy contract
409
+ * @param oldImplementationAddress The address of the old implementation contract
410
+ * @param newImplementationAddress The address of the new implementation contract
411
+ */
412
+ event AddressSetAsProxy(
413
+ bytes32 indexed id,
414
+ address indexed proxyAddress,
415
+ address oldImplementationAddress,
416
+ address indexed newImplementationAddress
417
+ );
418
+
419
+ /**
420
+ * @notice Returns the id of the Aave market to which this contract points to.
421
+ * @return The market id
422
+ **/
423
+ function getMarketId() external view returns (string memory);
424
+
425
+ /**
426
+ * @notice Associates an id with a specific PoolAddressesProvider.
427
+ * @dev This can be used to create an onchain registry of PoolAddressesProviders to
428
+ * identify and validate multiple Aave markets.
429
+ * @param newMarketId The market id
430
+ */
431
+ function setMarketId(string calldata newMarketId) external;
432
+
433
+ /**
434
+ * @notice Returns an address by its identifier.
435
+ * @dev The returned address might be an EOA or a contract, potentially proxied
436
+ * @dev It returns ZERO if there is no registered address with the given id
437
+ * @param id The id
438
+ * @return The address of the registered for the specified id
439
+ */
440
+ function getAddress(bytes32 id) external view returns (address);
441
+
442
+ /**
443
+ * @notice General function to update the implementation of a proxy registered with
444
+ * certain `id`. If there is no proxy registered, it will instantiate one and
445
+ * set as implementation the `newImplementationAddress`.
446
+ * @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
447
+ * setter function, in order to avoid unexpected consequences
448
+ * @param id The id
449
+ * @param newImplementationAddress The address of the new implementation
450
+ */
451
+ function setAddressAsProxy(bytes32 id, address newImplementationAddress)
452
+ external;
453
+
454
+ /**
455
+ * @notice Sets an address for an id replacing the address saved in the addresses map.
456
+ * @dev IMPORTANT Use this function carefully, as it will do a hard replacement
457
+ * @param id The id
458
+ * @param newAddress The address to set
459
+ */
460
+ function setAddress(bytes32 id, address newAddress) external;
461
+
462
+ /**
463
+ * @notice Returns the address of the Pool proxy.
464
+ * @return The Pool proxy address
465
+ **/
466
+ function getPool() external view returns (address);
467
+
468
+ /**
469
+ * @notice Updates the implementation of the Pool, or creates a proxy
470
+ * setting the new `pool` implementation when the function is called for the first time.
471
+ * @param newPoolImpl The new Pool implementation
472
+ **/
473
+ function setPoolImpl(address newPoolImpl) external;
474
+
475
+ /**
476
+ * @notice Returns the address of the PoolConfigurator proxy.
477
+ * @return The PoolConfigurator proxy address
478
+ **/
479
+ function getPoolConfigurator() external view returns (address);
480
+
481
+ /**
482
+ * @notice Updates the implementation of the PoolConfigurator, or creates a proxy
483
+ * setting the new `PoolConfigurator` implementation when the function is called for the first time.
484
+ * @param newPoolConfiguratorImpl The new PoolConfigurator implementation
485
+ **/
486
+ function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;
487
+
488
+ /**
489
+ * @notice Returns the address of the price oracle.
490
+ * @return The address of the PriceOracle
491
+ */
492
+ function getPriceOracle() external view returns (address);
493
+
494
+ /**
495
+ * @notice Updates the address of the price oracle.
496
+ * @param newPriceOracle The address of the new PriceOracle
497
+ */
498
+ function setPriceOracle(address newPriceOracle) external;
499
+
500
+ /**
501
+ * @notice Returns the address of the ACL manager.
502
+ * @return The address of the ACLManager
503
+ */
504
+ function getACLManager() external view returns (address);
505
+
506
+ /**
507
+ * @notice Updates the address of the ACL manager.
508
+ * @param newAclManager The address of the new ACLManager
509
+ **/
510
+ function setACLManager(address newAclManager) external;
511
+
512
+ /**
513
+ * @notice Returns the address of the ACL admin.
514
+ * @return The address of the ACL admin
515
+ */
516
+ function getACLAdmin() external view returns (address);
517
+
518
+ /**
519
+ * @notice Updates the address of the ACL admin.
520
+ * @param newAclAdmin The address of the new ACL admin
521
+ */
522
+ function setACLAdmin(address newAclAdmin) external;
523
+
524
+ /**
525
+ * @notice Returns the address of the price oracle sentinel.
526
+ * @return The address of the PriceOracleSentinel
527
+ */
528
+ function getPriceOracleSentinel() external view returns (address);
529
+
530
+ /**
531
+ * @notice Updates the address of the price oracle sentinel.
532
+ * @param newPriceOracleSentinel The address of the new PriceOracleSentinel
533
+ **/
534
+ function setPriceOracleSentinel(address newPriceOracleSentinel) external;
535
+
536
+ /**
537
+ * @notice Returns the address of the data provider.
538
+ * @return The address of the DataProvider
539
+ */
540
+ function getPoolDataProvider() external view returns (address);
541
+
542
+ /**
543
+ * @notice Updates the address of the data provider.
544
+ * @param newDataProvider The address of the new DataProvider
545
+ **/
546
+ function setPoolDataProvider(address newDataProvider) external;
547
+ }
548
+
549
+ interface IPool {
550
+ /**
551
+ * @dev Emitted on mintUnbacked()
552
+ * @param reserve The address of the underlying asset of the reserve
553
+ * @param user The address initiating the supply
554
+ * @param onBehalfOf The beneficiary of the supplied assets, receiving the aTokens
555
+ * @param amount The amount of supplied assets
556
+ * @param referralCode The referral code used
557
+ **/
558
+ event MintUnbacked(
559
+ address indexed reserve,
560
+ address user,
561
+ address indexed onBehalfOf,
562
+ uint256 amount,
563
+ uint16 indexed referralCode
564
+ );
565
+
566
+ /**
567
+ * @dev Emitted on backUnbacked()
568
+ * @param reserve The address of the underlying asset of the reserve
569
+ * @param backer The address paying for the backing
570
+ * @param amount The amount added as backing
571
+ * @param fee The amount paid in fees
572
+ **/
573
+ event BackUnbacked(
574
+ address indexed reserve,
575
+ address indexed backer,
576
+ uint256 amount,
577
+ uint256 fee
578
+ );
579
+
580
+ /**
581
+ * @dev Emitted on supply()
582
+ * @param reserve The address of the underlying asset of the reserve
583
+ * @param user The address initiating the supply
584
+ * @param onBehalfOf The beneficiary of the supply, receiving the aTokens
585
+ * @param amount The amount supplied
586
+ * @param referralCode The referral code used
587
+ **/
588
+ event Supply(
589
+ address indexed reserve,
590
+ address user,
591
+ address indexed onBehalfOf,
592
+ uint256 amount,
593
+ uint16 indexed referralCode
594
+ );
595
+
596
+ /**
597
+ * @dev Emitted on withdraw()
598
+ * @param reserve The address of the underlying asset being withdrawn
599
+ * @param user The address initiating the withdrawal, owner of aTokens
600
+ * @param to The address that will receive the underlying
601
+ * @param amount The amount to be withdrawn
602
+ **/
603
+ event Withdraw(
604
+ address indexed reserve,
605
+ address indexed user,
606
+ address indexed to,
607
+ uint256 amount
608
+ );
609
+
610
+ /**
611
+ * @dev Emitted on borrow() and flashLoan() when debt needs to be opened
612
+ * @param reserve The address of the underlying asset being borrowed
613
+ * @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
614
+ * initiator of the transaction on flashLoan()
615
+ * @param onBehalfOf The address that will be getting the debt
616
+ * @param amount The amount borrowed out
617
+ * @param interestRateMode The rate mode: 1 for Stable, 2 for Variable
618
+ * @param borrowRate The numeric rate at which the user has borrowed, expressed in ray
619
+ * @param referralCode The referral code used
620
+ **/
621
+ event Borrow(
622
+ address indexed reserve,
623
+ address user,
624
+ address indexed onBehalfOf,
625
+ uint256 amount,
626
+ DataTypes.InterestRateMode interestRateMode,
627
+ uint256 borrowRate,
628
+ uint16 indexed referralCode
629
+ );
630
+
631
+ /**
632
+ * @dev Emitted on repay()
633
+ * @param reserve The address of the underlying asset of the reserve
634
+ * @param user The beneficiary of the repayment, getting his debt reduced
635
+ * @param repayer The address of the user initiating the repay(), providing the funds
636
+ * @param amount The amount repaid
637
+ * @param useATokens True if the repayment is done using aTokens, `false` if done with underlying asset directly
638
+ **/
639
+ event Repay(
640
+ address indexed reserve,
641
+ address indexed user,
642
+ address indexed repayer,
643
+ uint256 amount,
644
+ bool useATokens
645
+ );
646
+
647
+ /**
648
+ * @dev Emitted on swapBorrowRateMode()
649
+ * @param reserve The address of the underlying asset of the reserve
650
+ * @param user The address of the user swapping his rate mode
651
+ * @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
652
+ **/
653
+ event SwapBorrowRateMode(
654
+ address indexed reserve,
655
+ address indexed user,
656
+ DataTypes.InterestRateMode interestRateMode
657
+ );
658
+
659
+ /**
660
+ * @dev Emitted on borrow(), repay() and liquidationCall() when using isolated assets
661
+ * @param asset The address of the underlying asset of the reserve
662
+ * @param totalDebt The total isolation mode debt for the reserve
663
+ */
664
+ event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);
665
+
666
+ /**
667
+ * @dev Emitted when the user selects a certain asset category for eMode
668
+ * @param user The address of the user
669
+ * @param categoryId The category id
670
+ **/
671
+ event UserEModeSet(address indexed user, uint8 categoryId);
672
+
673
+ /**
674
+ * @dev Emitted on setUserUseReserveAsCollateral()
675
+ * @param reserve The address of the underlying asset of the reserve
676
+ * @param user The address of the user enabling the usage as collateral
677
+ **/
678
+ event ReserveUsedAsCollateralEnabled(
679
+ address indexed reserve,
680
+ address indexed user
681
+ );
682
+
683
+ /**
684
+ * @dev Emitted on setUserUseReserveAsCollateral()
685
+ * @param reserve The address of the underlying asset of the reserve
686
+ * @param user The address of the user enabling the usage as collateral
687
+ **/
688
+ event ReserveUsedAsCollateralDisabled(
689
+ address indexed reserve,
690
+ address indexed user
691
+ );
692
+
693
+ /**
694
+ * @dev Emitted on rebalanceStableBorrowRate()
695
+ * @param reserve The address of the underlying asset of the reserve
696
+ * @param user The address of the user for which the rebalance has been executed
697
+ **/
698
+ event RebalanceStableBorrowRate(
699
+ address indexed reserve,
700
+ address indexed user
701
+ );
702
+
703
+ /**
704
+ * @dev Emitted on flashLoan()
705
+ * @param target The address of the flash loan receiver contract
706
+ * @param initiator The address initiating the flash loan
707
+ * @param asset The address of the asset being flash borrowed
708
+ * @param amount The amount flash borrowed
709
+ * @param interestRateMode The flashloan mode: 0 for regular flashloan, 1 for Stable debt, 2 for Variable debt
710
+ * @param premium The fee flash borrowed
711
+ * @param referralCode The referral code used
712
+ **/
713
+ event FlashLoan(
714
+ address indexed target,
715
+ address initiator,
716
+ address indexed asset,
717
+ uint256 amount,
718
+ DataTypes.InterestRateMode interestRateMode,
719
+ uint256 premium,
720
+ uint16 indexed referralCode
721
+ );
722
+
723
+ /**
724
+ * @dev Emitted when a borrower is liquidated.
725
+ * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
726
+ * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
727
+ * @param user The address of the borrower getting liquidated
728
+ * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
729
+ * @param liquidatedCollateralAmount The amount of collateral received by the liquidator
730
+ * @param liquidator The address of the liquidator
731
+ * @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
732
+ * to receive the underlying collateral asset directly
733
+ **/
734
+ event LiquidationCall(
735
+ address indexed collateralAsset,
736
+ address indexed debtAsset,
737
+ address indexed user,
738
+ uint256 debtToCover,
739
+ uint256 liquidatedCollateralAmount,
740
+ address liquidator,
741
+ bool receiveAToken
742
+ );
743
+
744
+ /**
745
+ * @dev Emitted when the state of a reserve is updated.
746
+ * @param reserve The address of the underlying asset of the reserve
747
+ * @param liquidityRate The next liquidity rate
748
+ * @param stableBorrowRate The next stable borrow rate
749
+ * @param variableBorrowRate The next variable borrow rate
750
+ * @param liquidityIndex The next liquidity index
751
+ * @param variableBorrowIndex The next variable borrow index
752
+ **/
753
+ event ReserveDataUpdated(
754
+ address indexed reserve,
755
+ uint256 liquidityRate,
756
+ uint256 stableBorrowRate,
757
+ uint256 variableBorrowRate,
758
+ uint256 liquidityIndex,
759
+ uint256 variableBorrowIndex
760
+ );
761
+
762
+ /**
763
+ * @dev Emitted when the protocol treasury receives minted aTokens from the accrued interest.
764
+ * @param reserve The address of the reserve
765
+ * @param amountMinted The amount minted to the treasury
766
+ **/
767
+ event MintedToTreasury(address indexed reserve, uint256 amountMinted);
768
+
769
+ /**
770
+ * @dev Mints an `amount` of aTokens to the `onBehalfOf`
771
+ * @param asset The address of the underlying asset to mint
772
+ * @param amount The amount to mint
773
+ * @param onBehalfOf The address that will receive the aTokens
774
+ * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
775
+ * 0 if the action is executed directly by the user, without any middle-man
776
+ **/
777
+ function mintUnbacked(
778
+ address asset,
779
+ uint256 amount,
780
+ address onBehalfOf,
781
+ uint16 referralCode
782
+ ) external;
783
+
784
+ /**
785
+ * @dev Back the current unbacked underlying with `amount` and pay `fee`.
786
+ * @param asset The address of the underlying asset to back
787
+ * @param amount The amount to back
788
+ * @param fee The amount paid in fees
789
+ **/
790
+ function backUnbacked(
791
+ address asset,
792
+ uint256 amount,
793
+ uint256 fee
794
+ ) external;
795
+
796
+ /**
797
+ * @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
798
+ * - E.g. User supplies 100 USDC and gets in return 100 aUSDC
799
+ * @param asset The address of the underlying asset to supply
800
+ * @param amount The amount to be supplied
801
+ * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
802
+ * wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
803
+ * is a different wallet
804
+ * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
805
+ * 0 if the action is executed directly by the user, without any middle-man
806
+ **/
807
+ function supply(
808
+ address asset,
809
+ uint256 amount,
810
+ address onBehalfOf,
811
+ uint16 referralCode
812
+ ) external;
813
+
814
+ /**
815
+ * @notice Supply with transfer approval of asset to be supplied done via permit function
816
+ * see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
817
+ * @param asset The address of the underlying asset to supply
818
+ * @param amount The amount to be supplied
819
+ * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
820
+ * wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
821
+ * is a different wallet
822
+ * @param deadline The deadline timestamp that the permit is valid
823
+ * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
824
+ * 0 if the action is executed directly by the user, without any middle-man
825
+ * @param permitV The V parameter of ERC712 permit sig
826
+ * @param permitR The R parameter of ERC712 permit sig
827
+ * @param permitS The S parameter of ERC712 permit sig
828
+ **/
829
+ function supplyWithPermit(
830
+ address asset,
831
+ uint256 amount,
832
+ address onBehalfOf,
833
+ uint16 referralCode,
834
+ uint256 deadline,
835
+ uint8 permitV,
836
+ bytes32 permitR,
837
+ bytes32 permitS
838
+ ) external;
839
+
840
+ /**
841
+ * @notice Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
842
+ * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
843
+ * @param asset The address of the underlying asset to withdraw
844
+ * @param amount The underlying amount to be withdrawn
845
+ * - Send the value type(uint256).max in order to withdraw the whole aToken balance
846
+ * @param to The address that will receive the underlying, same as msg.sender if the user
847
+ * wants to receive it on his own wallet, or a different address if the beneficiary is a
848
+ * different wallet
849
+ * @return The final amount withdrawn
850
+ **/
851
+ function withdraw(
852
+ address asset,
853
+ uint256 amount,
854
+ address to
855
+ ) external returns (uint256);
856
+
857
+ /**
858
+ * @notice Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
859
+ * already supplied enough collateral, or he was given enough allowance by a credit delegator on the
860
+ * corresponding debt token (StableDebtToken or VariableDebtToken)
861
+ * - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
862
+ * and 100 stable/variable debt tokens, depending on the `interestRateMode`
863
+ * @param asset The address of the underlying asset to borrow
864
+ * @param amount The amount to be borrowed
865
+ * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
866
+ * @param referralCode The code used to register the integrator originating the operation, for potential rewards.
867
+ * 0 if the action is executed directly by the user, without any middle-man
868
+ * @param onBehalfOf The address of the user who will receive the debt. Should be the address of the borrower itself
869
+ * calling the function if he wants to borrow against his own collateral, or the address of the credit delegator
870
+ * if he has been given credit delegation allowance
871
+ **/
872
+ function borrow(
873
+ address asset,
874
+ uint256 amount,
875
+ uint256 interestRateMode,
876
+ uint16 referralCode,
877
+ address onBehalfOf
878
+ ) external;
879
+
880
+ /**
881
+ * @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
882
+ * - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address
883
+ * @param asset The address of the borrowed underlying asset previously borrowed
884
+ * @param amount The amount to repay
885
+ * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
886
+ * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
887
+ * @param onBehalfOf The address of the user who will get his debt reduced/removed. Should be the address of the
888
+ * user calling the function if he wants to reduce/remove his own debt, or the address of any other
889
+ * other borrower whose debt should be removed
890
+ * @return The final amount repaid
891
+ **/
892
+ function repay(
893
+ address asset,
894
+ uint256 amount,
895
+ uint256 interestRateMode,
896
+ address onBehalfOf
897
+ ) external returns (uint256);
898
+
899
+ /**
900
+ * @notice Repay with transfer approval of asset to be repaid done via permit function
901
+ * see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
902
+ * @param asset The address of the borrowed underlying asset previously borrowed
903
+ * @param amount The amount to repay
904
+ * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
905
+ * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
906
+ * @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
907
+ * user calling the function if he wants to reduce/remove his own debt, or the address of any other
908
+ * other borrower whose debt should be removed
909
+ * @param deadline The deadline timestamp that the permit is valid
910
+ * @param permitV The V parameter of ERC712 permit sig
911
+ * @param permitR The R parameter of ERC712 permit sig
912
+ * @param permitS The S parameter of ERC712 permit sig
913
+ * @return The final amount repaid
914
+ **/
915
+ function repayWithPermit(
916
+ address asset,
917
+ uint256 amount,
918
+ uint256 interestRateMode,
919
+ address onBehalfOf,
920
+ uint256 deadline,
921
+ uint8 permitV,
922
+ bytes32 permitR,
923
+ bytes32 permitS
924
+ ) external returns (uint256);
925
+
926
+ /**
927
+ * @notice Repays a borrowed `amount` on a specific reserve using the reserve aTokens, burning the
928
+ * equivalent debt tokens
929
+ * - E.g. User repays 100 USDC using 100 aUSDC, burning 100 variable/stable debt tokens
930
+ * @dev Passing uint256.max as amount will clean up any residual aToken dust balance, if the user aToken
931
+ * balance is not enough to cover the whole debt
932
+ * @param asset The address of the borrowed underlying asset previously borrowed
933
+ * @param amount The amount to repay
934
+ * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
935
+ * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
936
+ * @return The final amount repaid
937
+ **/
938
+ function repayWithATokens(
939
+ address asset,
940
+ uint256 amount,
941
+ uint256 interestRateMode
942
+ ) external returns (uint256);
943
+
944
+ /**
945
+ * @notice Allows a borrower to swap his debt between stable and variable mode, or vice versa
946
+ * @param asset The address of the underlying asset borrowed
947
+ * @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
948
+ **/
949
+ function swapBorrowRateMode(address asset, uint256 interestRateMode) external;
950
+
951
+ /**
952
+ * @notice Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
953
+ * - Users can be rebalanced if the following conditions are satisfied:
954
+ * 1. Usage ratio is above 95%
955
+ * 2. the current supply APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too
956
+ * much has been borrowed at a stable rate and suppliers are not earning enough
957
+ * @param asset The address of the underlying asset borrowed
958
+ * @param user The address of the user to be rebalanced
959
+ **/
960
+ function rebalanceStableBorrowRate(address asset, address user) external;
961
+
962
+ /**
963
+ * @notice Allows suppliers to enable/disable a specific supplied asset as collateral
964
+ * @param asset The address of the underlying asset supplied
965
+ * @param useAsCollateral True if the user wants to use the supply as collateral, false otherwise
966
+ **/
967
+ function setUserUseReserveAsCollateral(address asset, bool useAsCollateral)
968
+ external;
969
+
970
+ /**
971
+ * @notice Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
972
+ * - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives
973
+ * a proportionally amount of the `collateralAsset` plus a bonus to cover market risk
974
+ * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
975
+ * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
976
+ * @param user The address of the borrower getting liquidated
977
+ * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
978
+ * @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
979
+ * to receive the underlying collateral asset directly
980
+ **/
981
+ function liquidationCall(
982
+ address collateralAsset,
983
+ address debtAsset,
984
+ address user,
985
+ uint256 debtToCover,
986
+ bool receiveAToken
987
+ ) external;
988
+
989
+ /**
990
+ * @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
991
+ * as long as the amount taken plus a fee is returned.
992
+ * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
993
+ * into consideration. For further details please visit https://developers.aave.com
994
+ * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface
995
+ * @param assets The addresses of the assets being flash-borrowed
996
+ * @param amounts The amounts of the assets being flash-borrowed
997
+ * @param interestRateModes Types of the debt to open if the flash loan is not returned:
998
+ * 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
999
+ * 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
1000
+ * 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
1001
+ * @param onBehalfOf The address that will receive the debt in the case of using on `modes` 1 or 2
1002
+ * @param params Variadic packed params to pass to the receiver as extra information
1003
+ * @param referralCode The code used to register the integrator originating the operation, for potential rewards.
1004
+ * 0 if the action is executed directly by the user, without any middle-man
1005
+ **/
1006
+ function flashLoan(
1007
+ address receiverAddress,
1008
+ address[] calldata assets,
1009
+ uint256[] calldata amounts,
1010
+ uint256[] calldata interestRateModes,
1011
+ address onBehalfOf,
1012
+ bytes calldata params,
1013
+ uint16 referralCode
1014
+ ) external;
1015
+
1016
+ /**
1017
+ * @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
1018
+ * as long as the amount taken plus a fee is returned.
1019
+ * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
1020
+ * into consideration. For further details please visit https://developers.aave.com
1021
+ * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface
1022
+ * @param asset The address of the asset being flash-borrowed
1023
+ * @param amount The amount of the asset being flash-borrowed
1024
+ * @param params Variadic packed params to pass to the receiver as extra information
1025
+ * @param referralCode The code used to register the integrator originating the operation, for potential rewards.
1026
+ * 0 if the action is executed directly by the user, without any middle-man
1027
+ **/
1028
+ function flashLoanSimple(
1029
+ address receiverAddress,
1030
+ address asset,
1031
+ uint256 amount,
1032
+ bytes calldata params,
1033
+ uint16 referralCode
1034
+ ) external;
1035
+
1036
+ /**
1037
+ * @notice Returns the user account data across all the reserves
1038
+ * @param user The address of the user
1039
+ * @return totalCollateralBase The total collateral of the user in the base currency used by the price feed
1040
+ * @return totalDebtBase The total debt of the user in the base currency used by the price feed
1041
+ * @return availableBorrowsBase The borrowing power left of the user in the base currency used by the price feed
1042
+ * @return currentLiquidationThreshold The liquidation threshold of the user
1043
+ * @return ltv The loan to value of The user
1044
+ * @return healthFactor The current health factor of the user
1045
+ **/
1046
+ function getUserAccountData(address user)
1047
+ external
1048
+ view
1049
+ returns (
1050
+ uint256 totalCollateralBase,
1051
+ uint256 totalDebtBase,
1052
+ uint256 availableBorrowsBase,
1053
+ uint256 currentLiquidationThreshold,
1054
+ uint256 ltv,
1055
+ uint256 healthFactor
1056
+ );
1057
+
1058
+ /**
1059
+ * @notice Initializes a reserve, activating it, assigning an aToken and debt tokens and an
1060
+ * interest rate strategy
1061
+ * @dev Only callable by the PoolConfigurator contract
1062
+ * @param asset The address of the underlying asset of the reserve
1063
+ * @param aTokenAddress The address of the aToken that will be assigned to the reserve
1064
+ * @param stableDebtAddress The address of the StableDebtToken that will be assigned to the reserve
1065
+ * @param variableDebtAddress The address of the VariableDebtToken that will be assigned to the reserve
1066
+ * @param interestRateStrategyAddress The address of the interest rate strategy contract
1067
+ **/
1068
+ function initReserve(
1069
+ address asset,
1070
+ address aTokenAddress,
1071
+ address stableDebtAddress,
1072
+ address variableDebtAddress,
1073
+ address interestRateStrategyAddress
1074
+ ) external;
1075
+
1076
+ /**
1077
+ * @notice Drop a reserve
1078
+ * @dev Only callable by the PoolConfigurator contract
1079
+ * @param asset The address of the underlying asset of the reserve
1080
+ **/
1081
+ function dropReserve(address asset) external;
1082
+
1083
+ /**
1084
+ * @notice Updates the address of the interest rate strategy contract
1085
+ * @dev Only callable by the PoolConfigurator contract
1086
+ * @param asset The address of the underlying asset of the reserve
1087
+ * @param rateStrategyAddress The address of the interest rate strategy contract
1088
+ **/
1089
+ function setReserveInterestRateStrategyAddress(
1090
+ address asset,
1091
+ address rateStrategyAddress
1092
+ ) external;
1093
+
1094
+ /**
1095
+ * @notice Sets the configuration bitmap of the reserve as a whole
1096
+ * @dev Only callable by the PoolConfigurator contract
1097
+ * @param asset The address of the underlying asset of the reserve
1098
+ * @param configuration The new configuration bitmap
1099
+ **/
1100
+ function setConfiguration(
1101
+ address asset,
1102
+ DataTypes.ReserveConfigurationMap calldata configuration
1103
+ ) external;
1104
+
1105
+ /**
1106
+ * @notice Returns the configuration of the reserve
1107
+ * @param asset The address of the underlying asset of the reserve
1108
+ * @return The configuration of the reserve
1109
+ **/
1110
+ function getConfiguration(address asset)
1111
+ external
1112
+ view
1113
+ returns (DataTypes.ReserveConfigurationMap memory);
1114
+
1115
+ /**
1116
+ * @notice Returns the configuration of the user across all the reserves
1117
+ * @param user The user address
1118
+ * @return The configuration of the user
1119
+ **/
1120
+ function getUserConfiguration(address user)
1121
+ external
1122
+ view
1123
+ returns (DataTypes.UserConfigurationMap memory);
1124
+
1125
+ /**
1126
+ * @notice Returns the normalized income normalized income of the reserve
1127
+ * @param asset The address of the underlying asset of the reserve
1128
+ * @return The reserve's normalized income
1129
+ */
1130
+ function getReserveNormalizedIncome(address asset)
1131
+ external
1132
+ view
1133
+ returns (uint256);
1134
+
1135
+ /**
1136
+ * @notice Returns the normalized variable debt per unit of asset
1137
+ * @param asset The address of the underlying asset of the reserve
1138
+ * @return The reserve normalized variable debt
1139
+ */
1140
+ function getReserveNormalizedVariableDebt(address asset)
1141
+ external
1142
+ view
1143
+ returns (uint256);
1144
+
1145
+ /**
1146
+ * @notice Returns the state and configuration of the reserve
1147
+ * @param asset The address of the underlying asset of the reserve
1148
+ * @return The state and configuration data of the reserve
1149
+ **/
1150
+ function getReserveData(address asset)
1151
+ external
1152
+ view
1153
+ returns (DataTypes.ReserveData memory);
1154
+
1155
+ /**
1156
+ * @notice Validates and finalizes an aToken transfer
1157
+ * @dev Only callable by the overlying aToken of the `asset`
1158
+ * @param asset The address of the underlying asset of the aToken
1159
+ * @param from The user from which the aTokens are transferred
1160
+ * @param to The user receiving the aTokens
1161
+ * @param amount The amount being transferred/withdrawn
1162
+ * @param balanceFromBefore The aToken balance of the `from` user before the transfer
1163
+ * @param balanceToBefore The aToken balance of the `to` user before the transfer
1164
+ */
1165
+ function finalizeTransfer(
1166
+ address asset,
1167
+ address from,
1168
+ address to,
1169
+ uint256 amount,
1170
+ uint256 balanceFromBefore,
1171
+ uint256 balanceToBefore
1172
+ ) external;
1173
+
1174
+ /**
1175
+ * @notice Returns the list of the underlying assets of all the initialized reserves
1176
+ * @dev It does not include dropped reserves
1177
+ * @return The addresses of the underlying assets of the initialized reserves
1178
+ **/
1179
+ function getReservesList() external view returns (address[] memory);
1180
+
1181
+ /**
1182
+ * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct
1183
+ * @param id The id of the reserve as stored in the DataTypes.ReserveData struct
1184
+ * @return The address of the reserve associated with id
1185
+ **/
1186
+ function getReserveAddressById(uint16 id) external view returns (address);
1187
+
1188
+ /**
1189
+ * @notice Returns the PoolAddressesProvider connected to this contract
1190
+ * @return The address of the PoolAddressesProvider
1191
+ **/
1192
+ function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
1193
+
1194
+ /**
1195
+ * @notice Updates the protocol fee on the bridging
1196
+ * @param bridgeProtocolFee The part of the premium sent to the protocol treasury
1197
+ */
1198
+ function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;
1199
+
1200
+ /**
1201
+ * @notice Updates flash loan premiums. Flash loan premium consists of two parts:
1202
+ * - A part is sent to aToken holders as extra, one time accumulated interest
1203
+ * - A part is collected by the protocol treasury
1204
+ * @dev The total premium is calculated on the total borrowed amount
1205
+ * @dev The premium to protocol is calculated on the total premium, being a percentage of `flashLoanPremiumTotal`
1206
+ * @dev Only callable by the PoolConfigurator contract
1207
+ * @param flashLoanPremiumTotal The total premium, expressed in bps
1208
+ * @param flashLoanPremiumToProtocol The part of the premium sent to the protocol treasury, expressed in bps
1209
+ */
1210
+ function updateFlashloanPremiums(
1211
+ uint128 flashLoanPremiumTotal,
1212
+ uint128 flashLoanPremiumToProtocol
1213
+ ) external;
1214
+
1215
+ /**
1216
+ * @notice Configures a new category for the eMode.
1217
+ * @dev In eMode, the protocol allows very high borrowing power to borrow assets of the same category.
1218
+ * The category 0 is reserved as it's the default for volatile assets
1219
+ * @param id The id of the category
1220
+ * @param config The configuration of the category
1221
+ */
1222
+ function configureEModeCategory(
1223
+ uint8 id,
1224
+ DataTypes.EModeCategory memory config
1225
+ ) external;
1226
+
1227
+ /**
1228
+ * @notice Returns the data of an eMode category
1229
+ * @param id The id of the category
1230
+ * @return The configuration data of the category
1231
+ */
1232
+ function getEModeCategoryData(uint8 id)
1233
+ external
1234
+ view
1235
+ returns (DataTypes.EModeCategory memory);
1236
+
1237
+ /**
1238
+ * @notice Allows a user to use the protocol in eMode
1239
+ * @param categoryId The id of the category
1240
+ */
1241
+ function setUserEMode(uint8 categoryId) external;
1242
+
1243
+ /**
1244
+ * @notice Returns the eMode the user is using
1245
+ * @param user The address of the user
1246
+ * @return The eMode id
1247
+ */
1248
+ function getUserEMode(address user) external view returns (uint256);
1249
+
1250
+ /**
1251
+ * @notice Resets the isolation mode total debt of the given asset to zero
1252
+ * @dev It requires the given asset has zero debt ceiling
1253
+ * @param asset The address of the underlying asset to reset the isolationModeTotalDebt
1254
+ */
1255
+ function resetIsolationModeTotalDebt(address asset) external;
1256
+
1257
+ /**
1258
+ * @notice Returns the percentage of available liquidity that can be borrowed at once at stable rate
1259
+ * @return The percentage of available liquidity to borrow, expressed in bps
1260
+ */
1261
+ function MAX_STABLE_RATE_BORROW_SIZE_PERCENT()
1262
+ external
1263
+ view
1264
+ returns (uint256);
1265
+
1266
+ /**
1267
+ * @notice Returns the total fee on flash loans
1268
+ * @return The total fee on flashloans
1269
+ */
1270
+ function FLASHLOAN_PREMIUM_TOTAL() external view returns (uint128);
1271
+
1272
+ /**
1273
+ * @notice Returns the part of the bridge fees sent to protocol
1274
+ * @return The bridge fee sent to the protocol treasury
1275
+ */
1276
+ function BRIDGE_PROTOCOL_FEE() external view returns (uint256);
1277
+
1278
+ /**
1279
+ * @notice Returns the part of the flashloan fees sent to protocol
1280
+ * @return The flashloan fee sent to the protocol treasury
1281
+ */
1282
+ function FLASHLOAN_PREMIUM_TO_PROTOCOL() external view returns (uint128);
1283
+
1284
+ /**
1285
+ * @notice Returns the maximum number of reserves supported to be listed in this Pool
1286
+ * @return The maximum number of reserves supported
1287
+ */
1288
+ function MAX_NUMBER_RESERVES() external view returns (uint16);
1289
+
1290
+ /**
1291
+ * @notice Mints the assets accrued through the reserve factor to the treasury in the form of aTokens
1292
+ * @param assets The list of reserves for which the minting needs to be executed
1293
+ **/
1294
+ function mintToTreasury(address[] calldata assets) external;
1295
+
1296
+ /**
1297
+ * @notice Rescue and transfer tokens locked in this contract
1298
+ * @param token The address of the token
1299
+ * @param to The address of the recipient
1300
+ * @param amount The amount of token to transfer
1301
+ */
1302
+ function rescueTokens(
1303
+ address token,
1304
+ address to,
1305
+ uint256 amount
1306
+ ) external;
1307
+
1308
+ /**
1309
+ * @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
1310
+ * - E.g. User supplies 100 USDC and gets in return 100 aUSDC
1311
+ * @dev Deprecated: Use the `supply` function instead
1312
+ * @param asset The address of the underlying asset to supply
1313
+ * @param amount The amount to be supplied
1314
+ * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
1315
+ * wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
1316
+ * is a different wallet
1317
+ * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
1318
+ * 0 if the action is executed directly by the user, without any middle-man
1319
+ **/
1320
+ function deposit(
1321
+ address asset,
1322
+ uint256 amount,
1323
+ address onBehalfOf,
1324
+ uint16 referralCode
1325
+ ) external;
1326
+ }
1327
+
1328
+ interface IPoolConfigurator {
1329
+ /**
1330
+ * @dev Emitted when a reserve is initialized.
1331
+ * @param asset The address of the underlying asset of the reserve
1332
+ * @param aToken The address of the associated aToken contract
1333
+ * @param stableDebtToken The address of the associated stable rate debt token
1334
+ * @param variableDebtToken The address of the associated variable rate debt token
1335
+ * @param interestRateStrategyAddress The address of the interest rate strategy for the reserve
1336
+ **/
1337
+ event ReserveInitialized(
1338
+ address indexed asset,
1339
+ address indexed aToken,
1340
+ address stableDebtToken,
1341
+ address variableDebtToken,
1342
+ address interestRateStrategyAddress
1343
+ );
1344
+
1345
+ /**
1346
+ * @dev Emitted when borrowing is enabled or disabled on a reserve.
1347
+ * @param asset The address of the underlying asset of the reserve
1348
+ * @param enabled True if borrowing is enabled, false otherwise
1349
+ **/
1350
+ event ReserveBorrowing(address indexed asset, bool enabled);
1351
+
1352
+ /**
1353
+ * @dev Emitted when the collateralization risk parameters for the specified asset are updated.
1354
+ * @param asset The address of the underlying asset of the reserve
1355
+ * @param ltv The loan to value of the asset when used as collateral
1356
+ * @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
1357
+ * @param liquidationBonus The bonus liquidators receive to liquidate this asset
1358
+ **/
1359
+ event CollateralConfigurationChanged(
1360
+ address indexed asset,
1361
+ uint256 ltv,
1362
+ uint256 liquidationThreshold,
1363
+ uint256 liquidationBonus
1364
+ );
1365
+
1366
+ /**
1367
+ * @dev Emitted when stable rate borrowing is enabled or disabled on a reserve
1368
+ * @param asset The address of the underlying asset of the reserve
1369
+ * @param enabled True if stable rate borrowing is enabled, false otherwise
1370
+ **/
1371
+ event ReserveStableRateBorrowing(address indexed asset, bool enabled);
1372
+
1373
+ /**
1374
+ * @dev Emitted when a reserve is activated or deactivated
1375
+ * @param asset The address of the underlying asset of the reserve
1376
+ * @param active True if reserve is active, false otherwise
1377
+ **/
1378
+ event ReserveActive(address indexed asset, bool active);
1379
+
1380
+ /**
1381
+ * @dev Emitted when a reserve is frozen or unfrozen
1382
+ * @param asset The address of the underlying asset of the reserve
1383
+ * @param frozen True if reserve is frozen, false otherwise
1384
+ **/
1385
+ event ReserveFrozen(address indexed asset, bool frozen);
1386
+
1387
+ /**
1388
+ * @dev Emitted when a reserve is paused or unpaused
1389
+ * @param asset The address of the underlying asset of the reserve
1390
+ * @param paused True if reserve is paused, false otherwise
1391
+ **/
1392
+ event ReservePaused(address indexed asset, bool paused);
1393
+
1394
+ /**
1395
+ * @dev Emitted when a reserve is dropped.
1396
+ * @param asset The address of the underlying asset of the reserve
1397
+ **/
1398
+ event ReserveDropped(address indexed asset);
1399
+
1400
+ /**
1401
+ * @dev Emitted when a reserve factor is updated.
1402
+ * @param asset The address of the underlying asset of the reserve
1403
+ * @param oldReserveFactor The old reserve factor, expressed in bps
1404
+ * @param newReserveFactor The new reserve factor, expressed in bps
1405
+ **/
1406
+ event ReserveFactorChanged(
1407
+ address indexed asset,
1408
+ uint256 oldReserveFactor,
1409
+ uint256 newReserveFactor
1410
+ );
1411
+
1412
+ /**
1413
+ * @dev Emitted when the borrow cap of a reserve is updated.
1414
+ * @param asset The address of the underlying asset of the reserve
1415
+ * @param oldBorrowCap The old borrow cap
1416
+ * @param newBorrowCap The new borrow cap
1417
+ **/
1418
+ event BorrowCapChanged(
1419
+ address indexed asset,
1420
+ uint256 oldBorrowCap,
1421
+ uint256 newBorrowCap
1422
+ );
1423
+
1424
+ /**
1425
+ * @dev Emitted when the supply cap of a reserve is updated.
1426
+ * @param asset The address of the underlying asset of the reserve
1427
+ * @param oldSupplyCap The old supply cap
1428
+ * @param newSupplyCap The new supply cap
1429
+ **/
1430
+ event SupplyCapChanged(
1431
+ address indexed asset,
1432
+ uint256 oldSupplyCap,
1433
+ uint256 newSupplyCap
1434
+ );
1435
+
1436
+ /**
1437
+ * @dev Emitted when the liquidation protocol fee of a reserve is updated.
1438
+ * @param asset The address of the underlying asset of the reserve
1439
+ * @param oldFee The old liquidation protocol fee, expressed in bps
1440
+ * @param newFee The new liquidation protocol fee, expressed in bps
1441
+ **/
1442
+ event LiquidationProtocolFeeChanged(
1443
+ address indexed asset,
1444
+ uint256 oldFee,
1445
+ uint256 newFee
1446
+ );
1447
+
1448
+ /**
1449
+ * @dev Emitted when the unbacked mint cap of a reserve is updated.
1450
+ * @param asset The address of the underlying asset of the reserve
1451
+ * @param oldUnbackedMintCap The old unbacked mint cap
1452
+ * @param newUnbackedMintCap The new unbacked mint cap
1453
+ */
1454
+ event UnbackedMintCapChanged(
1455
+ address indexed asset,
1456
+ uint256 oldUnbackedMintCap,
1457
+ uint256 newUnbackedMintCap
1458
+ );
1459
+
1460
+ /**
1461
+ * @dev Emitted when the category of an asset in eMode is changed.
1462
+ * @param asset The address of the underlying asset of the reserve
1463
+ * @param oldCategoryId The old eMode asset category
1464
+ * @param newCategoryId The new eMode asset category
1465
+ **/
1466
+ event EModeAssetCategoryChanged(
1467
+ address indexed asset,
1468
+ uint8 oldCategoryId,
1469
+ uint8 newCategoryId
1470
+ );
1471
+
1472
+ /**
1473
+ * @dev Emitted when a new eMode category is added.
1474
+ * @param categoryId The new eMode category id
1475
+ * @param ltv The ltv for the asset category in eMode
1476
+ * @param liquidationThreshold The liquidationThreshold for the asset category in eMode
1477
+ * @param liquidationBonus The liquidationBonus for the asset category in eMode
1478
+ * @param oracle The optional address of the price oracle specific for this category
1479
+ * @param label A human readable identifier for the category
1480
+ **/
1481
+ event EModeCategoryAdded(
1482
+ uint8 indexed categoryId,
1483
+ uint256 ltv,
1484
+ uint256 liquidationThreshold,
1485
+ uint256 liquidationBonus,
1486
+ address oracle,
1487
+ string label
1488
+ );
1489
+
1490
+ /**
1491
+ * @dev Emitted when a reserve interest strategy contract is updated.
1492
+ * @param asset The address of the underlying asset of the reserve
1493
+ * @param oldStrategy The address of the old interest strategy contract
1494
+ * @param newStrategy The address of the new interest strategy contract
1495
+ **/
1496
+ event ReserveInterestRateStrategyChanged(
1497
+ address indexed asset,
1498
+ address oldStrategy,
1499
+ address newStrategy
1500
+ );
1501
+
1502
+ /**
1503
+ * @dev Emitted when an aToken implementation is upgraded.
1504
+ * @param asset The address of the underlying asset of the reserve
1505
+ * @param proxy The aToken proxy address
1506
+ * @param implementation The new aToken implementation
1507
+ **/
1508
+ event ATokenUpgraded(
1509
+ address indexed asset,
1510
+ address indexed proxy,
1511
+ address indexed implementation
1512
+ );
1513
+
1514
+ /**
1515
+ * @dev Emitted when the implementation of a stable debt token is upgraded.
1516
+ * @param asset The address of the underlying asset of the reserve
1517
+ * @param proxy The stable debt token proxy address
1518
+ * @param implementation The new aToken implementation
1519
+ **/
1520
+ event StableDebtTokenUpgraded(
1521
+ address indexed asset,
1522
+ address indexed proxy,
1523
+ address indexed implementation
1524
+ );
1525
+
1526
+ /**
1527
+ * @dev Emitted when the implementation of a variable debt token is upgraded.
1528
+ * @param asset The address of the underlying asset of the reserve
1529
+ * @param proxy The variable debt token proxy address
1530
+ * @param implementation The new aToken implementation
1531
+ **/
1532
+ event VariableDebtTokenUpgraded(
1533
+ address indexed asset,
1534
+ address indexed proxy,
1535
+ address indexed implementation
1536
+ );
1537
+
1538
+ /**
1539
+ * @dev Emitted when the debt ceiling of an asset is set.
1540
+ * @param asset The address of the underlying asset of the reserve
1541
+ * @param oldDebtCeiling The old debt ceiling
1542
+ * @param newDebtCeiling The new debt ceiling
1543
+ **/
1544
+ event DebtCeilingChanged(
1545
+ address indexed asset,
1546
+ uint256 oldDebtCeiling,
1547
+ uint256 newDebtCeiling
1548
+ );
1549
+
1550
+ /**
1551
+ * @dev Emitted when the the siloed borrowing state for an asset is changed.
1552
+ * @param asset The address of the underlying asset of the reserve
1553
+ * @param oldState The old siloed borrowing state
1554
+ * @param newState The new siloed borrowing state
1555
+ **/
1556
+ event SiloedBorrowingChanged(
1557
+ address indexed asset,
1558
+ bool oldState,
1559
+ bool newState
1560
+ );
1561
+
1562
+ /**
1563
+ * @dev Emitted when the bridge protocol fee is updated.
1564
+ * @param oldBridgeProtocolFee The old protocol fee, expressed in bps
1565
+ * @param newBridgeProtocolFee The new protocol fee, expressed in bps
1566
+ */
1567
+ event BridgeProtocolFeeUpdated(
1568
+ uint256 oldBridgeProtocolFee,
1569
+ uint256 newBridgeProtocolFee
1570
+ );
1571
+
1572
+ /**
1573
+ * @dev Emitted when the total premium on flashloans is updated.
1574
+ * @param oldFlashloanPremiumTotal The old premium, expressed in bps
1575
+ * @param newFlashloanPremiumTotal The new premium, expressed in bps
1576
+ **/
1577
+ event FlashloanPremiumTotalUpdated(
1578
+ uint128 oldFlashloanPremiumTotal,
1579
+ uint128 newFlashloanPremiumTotal
1580
+ );
1581
+
1582
+ /**
1583
+ * @dev Emitted when the part of the premium that goes to protocol is updated.
1584
+ * @param oldFlashloanPremiumToProtocol The old premium, expressed in bps
1585
+ * @param newFlashloanPremiumToProtocol The new premium, expressed in bps
1586
+ **/
1587
+ event FlashloanPremiumToProtocolUpdated(
1588
+ uint128 oldFlashloanPremiumToProtocol,
1589
+ uint128 newFlashloanPremiumToProtocol
1590
+ );
1591
+
1592
+ /**
1593
+ * @dev Emitted when the reserve is set as borrowable/non borrowable in isolation mode.
1594
+ * @param asset The address of the underlying asset of the reserve
1595
+ * @param borrowable True if the reserve is borrowable in isolation, false otherwise
1596
+ **/
1597
+ event BorrowableInIsolationChanged(address asset, bool borrowable);
1598
+
1599
+ /**
1600
+ * @notice Initializes multiple reserves.
1601
+ * @param input The array of initialization parameters
1602
+ **/
1603
+ function initReserves(
1604
+ ConfiguratorInputTypes.InitReserveInput[] calldata input
1605
+ ) external;
1606
+
1607
+ /**
1608
+ * @dev Updates the aToken implementation for the reserve.
1609
+ * @param input The aToken update parameters
1610
+ **/
1611
+ function updateAToken(ConfiguratorInputTypes.UpdateATokenInput calldata input)
1612
+ external;
1613
+
1614
+ /**
1615
+ * @notice Updates the stable debt token implementation for the reserve.
1616
+ * @param input The stableDebtToken update parameters
1617
+ **/
1618
+ function updateStableDebtToken(
1619
+ ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
1620
+ ) external;
1621
+
1622
+ /**
1623
+ * @notice Updates the variable debt token implementation for the asset.
1624
+ * @param input The variableDebtToken update parameters
1625
+ **/
1626
+ function updateVariableDebtToken(
1627
+ ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
1628
+ ) external;
1629
+
1630
+ /**
1631
+ * @notice Configures borrowing on a reserve.
1632
+ * @dev Can only be disabled (set to false) if stable borrowing is disabled
1633
+ * @param asset The address of the underlying asset of the reserve
1634
+ * @param enabled True if borrowing needs to be enabled, false otherwise
1635
+ **/
1636
+ function setReserveBorrowing(address asset, bool enabled) external;
1637
+
1638
+ /**
1639
+ * @notice Configures the reserve collateralization parameters.
1640
+ * @dev All the values are expressed in bps. A value of 10000, results in 100.00%
1641
+ * @dev The `liquidationBonus` is always above 100%. A value of 105% means the liquidator will receive a 5% bonus
1642
+ * @param asset The address of the underlying asset of the reserve
1643
+ * @param ltv The loan to value of the asset when used as collateral
1644
+ * @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
1645
+ * @param liquidationBonus The bonus liquidators receive to liquidate this asset
1646
+ **/
1647
+ function configureReserveAsCollateral(
1648
+ address asset,
1649
+ uint256 ltv,
1650
+ uint256 liquidationThreshold,
1651
+ uint256 liquidationBonus
1652
+ ) external;
1653
+
1654
+ /**
1655
+ * @notice Enable or disable stable rate borrowing on a reserve.
1656
+ * @dev Can only be enabled (set to true) if borrowing is enabled
1657
+ * @param asset The address of the underlying asset of the reserve
1658
+ * @param enabled True if stable rate borrowing needs to be enabled, false otherwise
1659
+ **/
1660
+ function setReserveStableRateBorrowing(address asset, bool enabled) external;
1661
+
1662
+ /**
1663
+ * @notice Activate or deactivate a reserve
1664
+ * @param asset The address of the underlying asset of the reserve
1665
+ * @param active True if the reserve needs to be active, false otherwise
1666
+ **/
1667
+ function setReserveActive(address asset, bool active) external;
1668
+
1669
+ /**
1670
+ * @notice Freeze or unfreeze a reserve. A frozen reserve doesn't allow any new supply, borrow
1671
+ * or rate swap but allows repayments, liquidations, rate rebalances and withdrawals.
1672
+ * @param asset The address of the underlying asset of the reserve
1673
+ * @param freeze True if the reserve needs to be frozen, false otherwise
1674
+ **/
1675
+ function setReserveFreeze(address asset, bool freeze) external;
1676
+
1677
+ /**
1678
+ * @notice Sets the borrowable in isolation flag for the reserve.
1679
+ * @dev When this flag is set to true, the asset will be borrowable against isolated collaterals and the
1680
+ * borrowed amount will be accumulated in the isolated collateral's total debt exposure
1681
+ * @dev Only assets of the same family (e.g. USD stablecoins) should be borrowable in isolation mode to keep
1682
+ * consistency in the debt ceiling calculations
1683
+ * @param asset The address of the underlying asset of the reserve
1684
+ * @param borrowable True if the asset should be borrowable in isolation, false otherwise
1685
+ **/
1686
+ function setBorrowableInIsolation(address asset, bool borrowable) external;
1687
+
1688
+ /**
1689
+ * @notice Pauses a reserve. A paused reserve does not allow any interaction (supply, borrow, repay,
1690
+ * swap interest rate, liquidate, atoken transfers).
1691
+ * @param asset The address of the underlying asset of the reserve
1692
+ * @param paused True if pausing the reserve, false if unpausing
1693
+ **/
1694
+ function setReservePause(address asset, bool paused) external;
1695
+
1696
+ /**
1697
+ * @notice Updates the reserve factor of a reserve.
1698
+ * @param asset The address of the underlying asset of the reserve
1699
+ * @param newReserveFactor The new reserve factor of the reserve
1700
+ **/
1701
+ function setReserveFactor(address asset, uint256 newReserveFactor) external;
1702
+
1703
+ /**
1704
+ * @notice Sets the interest rate strategy of a reserve.
1705
+ * @param asset The address of the underlying asset of the reserve
1706
+ * @param newRateStrategyAddress The address of the new interest strategy contract
1707
+ **/
1708
+ function setReserveInterestRateStrategyAddress(
1709
+ address asset,
1710
+ address newRateStrategyAddress
1711
+ ) external;
1712
+
1713
+ /**
1714
+ * @notice Pauses or unpauses all the protocol reserves. In the paused state all the protocol interactions
1715
+ * are suspended.
1716
+ * @param paused True if protocol needs to be paused, false otherwise
1717
+ **/
1718
+ function setPoolPause(bool paused) external;
1719
+
1720
+ /**
1721
+ * @notice Updates the borrow cap of a reserve.
1722
+ * @param asset The address of the underlying asset of the reserve
1723
+ * @param newBorrowCap The new borrow cap of the reserve
1724
+ **/
1725
+ function setBorrowCap(address asset, uint256 newBorrowCap) external;
1726
+
1727
+ /**
1728
+ * @notice Updates the supply cap of a reserve.
1729
+ * @param asset The address of the underlying asset of the reserve
1730
+ * @param newSupplyCap The new supply cap of the reserve
1731
+ **/
1732
+ function setSupplyCap(address asset, uint256 newSupplyCap) external;
1733
+
1734
+ /**
1735
+ * @notice Updates the liquidation protocol fee of reserve.
1736
+ * @param asset The address of the underlying asset of the reserve
1737
+ * @param newFee The new liquidation protocol fee of the reserve, expressed in bps
1738
+ **/
1739
+ function setLiquidationProtocolFee(address asset, uint256 newFee) external;
1740
+
1741
+ /**
1742
+ * @notice Updates the unbacked mint cap of reserve.
1743
+ * @param asset The address of the underlying asset of the reserve
1744
+ * @param newUnbackedMintCap The new unbacked mint cap of the reserve
1745
+ **/
1746
+ function setUnbackedMintCap(address asset, uint256 newUnbackedMintCap)
1747
+ external;
1748
+
1749
+ /**
1750
+ * @notice Assign an efficiency mode (eMode) category to asset.
1751
+ * @param asset The address of the underlying asset of the reserve
1752
+ * @param newCategoryId The new category id of the asset
1753
+ **/
1754
+ function setAssetEModeCategory(address asset, uint8 newCategoryId) external;
1755
+
1756
+ /**
1757
+ * @notice Adds a new efficiency mode (eMode) category.
1758
+ * @dev If zero is provided as oracle address, the default asset oracles will be used to compute the overall debt and
1759
+ * overcollateralization of the users using this category.
1760
+ * @dev The new ltv and liquidation threshold must be greater than the base
1761
+ * ltvs and liquidation thresholds of all assets within the eMode category
1762
+ * @param categoryId The id of the category to be configured
1763
+ * @param ltv The ltv associated with the category
1764
+ * @param liquidationThreshold The liquidation threshold associated with the category
1765
+ * @param liquidationBonus The liquidation bonus associated with the category
1766
+ * @param oracle The oracle associated with the category
1767
+ * @param label A label identifying the category
1768
+ **/
1769
+ function setEModeCategory(
1770
+ uint8 categoryId,
1771
+ uint16 ltv,
1772
+ uint16 liquidationThreshold,
1773
+ uint16 liquidationBonus,
1774
+ address oracle,
1775
+ string calldata label
1776
+ ) external;
1777
+
1778
+ /**
1779
+ * @notice Drops a reserve entirely.
1780
+ * @param asset The address of the reserve to drop
1781
+ **/
1782
+ function dropReserve(address asset) external;
1783
+
1784
+ /**
1785
+ * @notice Updates the bridge fee collected by the protocol reserves.
1786
+ * @param newBridgeProtocolFee The part of the fee sent to the protocol treasury, expressed in bps
1787
+ */
1788
+ function updateBridgeProtocolFee(uint256 newBridgeProtocolFee) external;
1789
+
1790
+ /**
1791
+ * @notice Updates the total flash loan premium.
1792
+ * Total flash loan premium consists of two parts:
1793
+ * - A part is sent to aToken holders as extra balance
1794
+ * - A part is collected by the protocol reserves
1795
+ * @dev Expressed in bps
1796
+ * @dev The premium is calculated on the total amount borrowed
1797
+ * @param newFlashloanPremiumTotal The total flashloan premium
1798
+ */
1799
+ function updateFlashloanPremiumTotal(uint128 newFlashloanPremiumTotal)
1800
+ external;
1801
+
1802
+ /**
1803
+ * @notice Updates the flash loan premium collected by protocol reserves
1804
+ * @dev Expressed in bps
1805
+ * @dev The premium to protocol is calculated on the total flashloan premium
1806
+ * @param newFlashloanPremiumToProtocol The part of the flashloan premium sent to the protocol treasury
1807
+ */
1808
+ function updateFlashloanPremiumToProtocol(
1809
+ uint128 newFlashloanPremiumToProtocol
1810
+ ) external;
1811
+
1812
+ /**
1813
+ * @notice Sets the debt ceiling for an asset.
1814
+ * @param newDebtCeiling The new debt ceiling
1815
+ */
1816
+ function setDebtCeiling(address asset, uint256 newDebtCeiling) external;
1817
+
1818
+ /**
1819
+ * @notice Sets siloed borrowing for an asset
1820
+ * @param siloed The new siloed borrowing state
1821
+ */
1822
+ function setSiloedBorrowing(address asset, bool siloed) external;
1823
+ }
1824
+
1825
+ interface IPriceOracleGetter {
1826
+ /**
1827
+ * @notice Returns the base currency address
1828
+ * @dev Address 0x0 is reserved for USD as base currency.
1829
+ * @return Returns the base currency address.
1830
+ **/
1831
+ function BASE_CURRENCY() external view returns (address);
1832
+
1833
+ /**
1834
+ * @notice Returns the base currency unit
1835
+ * @dev 1 ether for ETH, 1e8 for USD.
1836
+ * @return Returns the base currency unit.
1837
+ **/
1838
+ function BASE_CURRENCY_UNIT() external view returns (uint256);
1839
+
1840
+ /**
1841
+ * @notice Returns the asset price in the base currency
1842
+ * @param asset The address of the asset
1843
+ * @return The price of the asset
1844
+ **/
1845
+ function getAssetPrice(address asset) external view returns (uint256);
1846
+ }
1847
+
1848
+ interface IAaveOracle is IPriceOracleGetter {
1849
+ /**
1850
+ * @dev Emitted after the base currency is set
1851
+ * @param baseCurrency The base currency of used for price quotes
1852
+ * @param baseCurrencyUnit The unit of the base currency
1853
+ */
1854
+ event BaseCurrencySet(address indexed baseCurrency, uint256 baseCurrencyUnit);
1855
+
1856
+ /**
1857
+ * @dev Emitted after the price source of an asset is updated
1858
+ * @param asset The address of the asset
1859
+ * @param source The price source of the asset
1860
+ */
1861
+ event AssetSourceUpdated(address indexed asset, address indexed source);
1862
+
1863
+ /**
1864
+ * @dev Emitted after the address of fallback oracle is updated
1865
+ * @param fallbackOracle The address of the fallback oracle
1866
+ */
1867
+ event FallbackOracleUpdated(address indexed fallbackOracle);
1868
+
1869
+ /**
1870
+ * @notice Returns the PoolAddressesProvider
1871
+ * @return The address of the PoolAddressesProvider contract
1872
+ */
1873
+ function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
1874
+
1875
+ /**
1876
+ * @notice Sets or replaces price sources of assets
1877
+ * @param assets The addresses of the assets
1878
+ * @param sources The addresses of the price sources
1879
+ */
1880
+ function setAssetSources(
1881
+ address[] calldata assets,
1882
+ address[] calldata sources
1883
+ ) external;
1884
+
1885
+ /**
1886
+ * @notice Sets the fallback oracle
1887
+ * @param fallbackOracle The address of the fallback oracle
1888
+ */
1889
+ function setFallbackOracle(address fallbackOracle) external;
1890
+
1891
+ /**
1892
+ * @notice Returns a list of prices from a list of assets addresses
1893
+ * @param assets The list of assets addresses
1894
+ * @return The prices of the given assets
1895
+ */
1896
+ function getAssetsPrices(address[] calldata assets)
1897
+ external
1898
+ view
1899
+ returns (uint256[] memory);
1900
+
1901
+ /**
1902
+ * @notice Returns the address of the source for an asset address
1903
+ * @param asset The address of the asset
1904
+ * @return The address of the source
1905
+ */
1906
+ function getSourceOfAsset(address asset) external view returns (address);
1907
+
1908
+ /**
1909
+ * @notice Returns the address of the fallback oracle
1910
+ * @return The address of the fallback oracle
1911
+ */
1912
+ function getFallbackOracle() external view returns (address);
1913
+ }
1914
+
1915
+ struct TokenData {
1916
+ string symbol;
1917
+ address tokenAddress;
1918
+ }
1919
+
1920
+ // TODO: add better documentation
1921
+ interface IAaveProtocolDataProvider {
1922
+
1923
+ function getAllReservesTokens() external view returns (TokenData[] memory);
1924
+
1925
+ function getAllATokens() external view returns (TokenData[] memory);
1926
+
1927
+ function getReserveConfigurationData(address asset)
1928
+ external
1929
+ view
1930
+ returns (
1931
+ uint256 decimals,
1932
+ uint256 ltv,
1933
+ uint256 liquidationThreshold,
1934
+ uint256 liquidationBonus,
1935
+ uint256 reserveFactor,
1936
+ bool usageAsCollateralEnabled,
1937
+ bool borrowingEnabled,
1938
+ bool stableBorrowRateEnabled,
1939
+ bool isActive,
1940
+ bool isFrozen
1941
+ );
1942
+
1943
+ function getReserveEModeCategory(address asset)
1944
+ external
1945
+ view
1946
+ returns (uint256);
1947
+
1948
+ function getReserveCaps(address asset)
1949
+ external
1950
+ view
1951
+ returns (uint256 borrowCap, uint256 supplyCap);
1952
+
1953
+ function getPaused(address asset) external view returns (bool isPaused);
1954
+
1955
+ function getSiloedBorrowing(address asset) external view returns (bool);
1956
+
1957
+ function getLiquidationProtocolFee(address asset)
1958
+ external
1959
+ view
1960
+ returns (uint256);
1961
+
1962
+ function getUnbackedMintCap(address asset) external view returns (uint256);
1963
+
1964
+ function getDebtCeiling(address asset) external view returns (uint256);
1965
+
1966
+ function getDebtCeilingDecimals() external pure returns (uint256);
1967
+
1968
+ /**
1969
+ * @notice Returns the reserve data
1970
+ * @param asset The address of the underlying asset of the reserve
1971
+ * @return unbacked The amount of unbacked tokens
1972
+ * @return accruedToTreasuryScaled The scaled amount of tokens accrued to treasury that is to be minted
1973
+ * @return totalAToken The total supply of the aToken
1974
+ * @return totalStableDebt The total stable debt of the reserve
1975
+ * @return totalVariableDebt The total variable debt of the reserve
1976
+ * @return liquidityRate The liquidity rate of the reserve
1977
+ * @return variableBorrowRate The variable borrow rate of the reserve
1978
+ * @return stableBorrowRate The stable borrow rate of the reserve
1979
+ * @return averageStableBorrowRate The average stable borrow rate of the reserve
1980
+ * @return liquidityIndex The liquidity index of the reserve
1981
+ * @return variableBorrowIndex The variable borrow index of the reserve
1982
+ * @return lastUpdateTimestamp The timestamp of the last update of the reserve
1983
+ **/
1984
+ function getReserveData(address asset)
1985
+ external
1986
+ view
1987
+ returns (
1988
+ uint256 unbacked,
1989
+ uint256 accruedToTreasuryScaled,
1990
+ uint256 totalAToken,
1991
+ uint256 totalStableDebt,
1992
+ uint256 totalVariableDebt,
1993
+ uint256 liquidityRate,
1994
+ uint256 variableBorrowRate,
1995
+ uint256 stableBorrowRate,
1996
+ uint256 averageStableBorrowRate,
1997
+ uint256 liquidityIndex,
1998
+ uint256 variableBorrowIndex,
1999
+ uint40 lastUpdateTimestamp
2000
+ );
2001
+
2002
+ /**
2003
+ * @notice Returns the total supply of aTokens for a given asset
2004
+ * @param asset The address of the underlying asset of the reserve
2005
+ * @return The total supply of the aToken
2006
+ **/
2007
+ function getATokenTotalSupply(address asset) external view returns (uint256);
2008
+
2009
+ /**
2010
+ * @notice Returns the total debt for a given asset
2011
+ * @param asset The address of the underlying asset of the reserve
2012
+ * @return The total debt for asset
2013
+ **/
2014
+ function getTotalDebt(address asset) external view returns (uint256);
2015
+
2016
+ function getUserReserveData(address asset, address user)
2017
+ external
2018
+ view
2019
+ returns (
2020
+ uint256 currentATokenBalance,
2021
+ uint256 currentStableDebt,
2022
+ uint256 currentVariableDebt,
2023
+ uint256 principalStableDebt,
2024
+ uint256 scaledVariableDebt,
2025
+ uint256 stableBorrowRate,
2026
+ uint256 liquidityRate,
2027
+ uint40 stableRateLastUpdated,
2028
+ bool usageAsCollateralEnabled
2029
+ );
2030
+
2031
+ function getReserveTokensAddresses(address asset)
2032
+ external
2033
+ view
2034
+ returns (
2035
+ address aTokenAddress,
2036
+ address stableDebtTokenAddress,
2037
+ address variableDebtTokenAddress
2038
+ );
2039
+
2040
+ function getInterestRateStrategyAddress(address asset)
2041
+ external
2042
+ view
2043
+ returns (address irStrategyAddress);
2044
+ }
2045
+
2046
+ /**
2047
+ * @title IACLManager
2048
+ * @author Aave
2049
+ * @notice Defines the basic interface for the ACL Manager
2050
+ **/
2051
+ interface IACLManager {
2052
+ /**
2053
+ * @notice Returns the contract address of the PoolAddressesProvider
2054
+ * @return The address of the PoolAddressesProvider
2055
+ */
2056
+ function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
2057
+
2058
+ /**
2059
+ * @notice Returns the identifier of the PoolAdmin role
2060
+ * @return The id of the PoolAdmin role
2061
+ */
2062
+ function POOL_ADMIN_ROLE() external view returns (bytes32);
2063
+
2064
+ /**
2065
+ * @notice Returns the identifier of the EmergencyAdmin role
2066
+ * @return The id of the EmergencyAdmin role
2067
+ */
2068
+ function EMERGENCY_ADMIN_ROLE() external view returns (bytes32);
2069
+
2070
+ /**
2071
+ * @notice Returns the identifier of the RiskAdmin role
2072
+ * @return The id of the RiskAdmin role
2073
+ */
2074
+ function RISK_ADMIN_ROLE() external view returns (bytes32);
2075
+
2076
+ /**
2077
+ * @notice Returns the identifier of the FlashBorrower role
2078
+ * @return The id of the FlashBorrower role
2079
+ */
2080
+ function FLASH_BORROWER_ROLE() external view returns (bytes32);
2081
+
2082
+ /**
2083
+ * @notice Returns the identifier of the Bridge role
2084
+ * @return The id of the Bridge role
2085
+ */
2086
+ function BRIDGE_ROLE() external view returns (bytes32);
2087
+
2088
+ /**
2089
+ * @notice Returns the identifier of the AssetListingAdmin role
2090
+ * @return The id of the AssetListingAdmin role
2091
+ */
2092
+ function ASSET_LISTING_ADMIN_ROLE() external view returns (bytes32);
2093
+
2094
+ /**
2095
+ * @notice Set the role as admin of a specific role.
2096
+ * @dev By default the admin role for all roles is `DEFAULT_ADMIN_ROLE`.
2097
+ * @param role The role to be managed by the admin role
2098
+ * @param adminRole The admin role
2099
+ */
2100
+ function setRoleAdmin(bytes32 role, bytes32 adminRole) external;
2101
+
2102
+ /**
2103
+ * @notice Adds a new admin as PoolAdmin
2104
+ * @param admin The address of the new admin
2105
+ */
2106
+ function addPoolAdmin(address admin) external;
2107
+
2108
+ /**
2109
+ * @notice Removes an admin as PoolAdmin
2110
+ * @param admin The address of the admin to remove
2111
+ */
2112
+ function removePoolAdmin(address admin) external;
2113
+
2114
+ /**
2115
+ * @notice Returns true if the address is PoolAdmin, false otherwise
2116
+ * @param admin The address to check
2117
+ * @return True if the given address is PoolAdmin, false otherwise
2118
+ */
2119
+ function isPoolAdmin(address admin) external view returns (bool);
2120
+
2121
+ /**
2122
+ * @notice Adds a new admin as EmergencyAdmin
2123
+ * @param admin The address of the new admin
2124
+ */
2125
+ function addEmergencyAdmin(address admin) external;
2126
+
2127
+ /**
2128
+ * @notice Removes an admin as EmergencyAdmin
2129
+ * @param admin The address of the admin to remove
2130
+ */
2131
+ function removeEmergencyAdmin(address admin) external;
2132
+
2133
+ /**
2134
+ * @notice Returns true if the address is EmergencyAdmin, false otherwise
2135
+ * @param admin The address to check
2136
+ * @return True if the given address is EmergencyAdmin, false otherwise
2137
+ */
2138
+ function isEmergencyAdmin(address admin) external view returns (bool);
2139
+
2140
+ /**
2141
+ * @notice Adds a new admin as RiskAdmin
2142
+ * @param admin The address of the new admin
2143
+ */
2144
+ function addRiskAdmin(address admin) external;
2145
+
2146
+ /**
2147
+ * @notice Removes an admin as RiskAdmin
2148
+ * @param admin The address of the admin to remove
2149
+ */
2150
+ function removeRiskAdmin(address admin) external;
2151
+
2152
+ /**
2153
+ * @notice Returns true if the address is RiskAdmin, false otherwise
2154
+ * @param admin The address to check
2155
+ * @return True if the given address is RiskAdmin, false otherwise
2156
+ */
2157
+ function isRiskAdmin(address admin) external view returns (bool);
2158
+
2159
+ /**
2160
+ * @notice Adds a new address as FlashBorrower
2161
+ * @param borrower The address of the new FlashBorrower
2162
+ */
2163
+ function addFlashBorrower(address borrower) external;
2164
+
2165
+ /**
2166
+ * @notice Removes an admin as FlashBorrower
2167
+ * @param borrower The address of the FlashBorrower to remove
2168
+ */
2169
+ function removeFlashBorrower(address borrower) external;
2170
+
2171
+ /**
2172
+ * @notice Returns true if the address is FlashBorrower, false otherwise
2173
+ * @param borrower The address to check
2174
+ * @return True if the given address is FlashBorrower, false otherwise
2175
+ */
2176
+ function isFlashBorrower(address borrower) external view returns (bool);
2177
+
2178
+ /**
2179
+ * @notice Adds a new address as Bridge
2180
+ * @param bridge The address of the new Bridge
2181
+ */
2182
+ function addBridge(address bridge) external;
2183
+
2184
+ /**
2185
+ * @notice Removes an address as Bridge
2186
+ * @param bridge The address of the bridge to remove
2187
+ */
2188
+ function removeBridge(address bridge) external;
2189
+
2190
+ /**
2191
+ * @notice Returns true if the address is Bridge, false otherwise
2192
+ * @param bridge The address to check
2193
+ * @return True if the given address is Bridge, false otherwise
2194
+ */
2195
+ function isBridge(address bridge) external view returns (bool);
2196
+
2197
+ /**
2198
+ * @notice Adds a new admin as AssetListingAdmin
2199
+ * @param admin The address of the new admin
2200
+ */
2201
+ function addAssetListingAdmin(address admin) external;
2202
+
2203
+ /**
2204
+ * @notice Removes an admin as AssetListingAdmin
2205
+ * @param admin The address of the admin to remove
2206
+ */
2207
+ function removeAssetListingAdmin(address admin) external;
2208
+
2209
+ /**
2210
+ * @notice Returns true if the address is AssetListingAdmin, false otherwise
2211
+ * @param admin The address to check
2212
+ * @return True if the given address is AssetListingAdmin, false otherwise
2213
+ */
2214
+ function isAssetListingAdmin(address admin) external view returns (bool);
2215
+
2216
+ /**
2217
+ * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
2218
+ *
2219
+ * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
2220
+ * {RoleAdminChanged} not being emitted signaling this.
2221
+ *
2222
+ * _Available since v3.1._
2223
+ */
2224
+ event RoleAdminChanged(
2225
+ bytes32 indexed role,
2226
+ bytes32 indexed previousAdminRole,
2227
+ bytes32 indexed newAdminRole
2228
+ );
2229
+
2230
+ /**
2231
+ * @dev Emitted when `account` is granted `role`.
2232
+ *
2233
+ * `sender` is the account that originated the contract call, an admin role
2234
+ * bearer except when using {AccessControl-_setupRole}.
2235
+ */
2236
+ event RoleGranted(
2237
+ bytes32 indexed role,
2238
+ address indexed account,
2239
+ address indexed sender
2240
+ );
2241
+
2242
+ // Parent Access Control Interface
2243
+ /**
2244
+ * @dev Emitted when `account` is revoked `role`.
2245
+ *
2246
+ * `sender` is the account that originated the contract call:
2247
+ * - if using `revokeRole`, it is the admin role bearer
2248
+ * - if using `renounceRole`, it is the role bearer (i.e. `account`)
2249
+ */
2250
+ event RoleRevoked(
2251
+ bytes32 indexed role,
2252
+ address indexed account,
2253
+ address indexed sender
2254
+ );
2255
+
2256
+ /**
2257
+ * @dev Returns `true` if `account` has been granted `role`.
2258
+ */
2259
+ function hasRole(bytes32 role, address account) external view returns (bool);
2260
+
2261
+ /**
2262
+ * @dev Returns the admin role that controls `role`. See {grantRole} and
2263
+ * {revokeRole}.
2264
+ *
2265
+ * To change a role's admin, use {AccessControl-_setRoleAdmin}.
2266
+ */
2267
+ function getRoleAdmin(bytes32 role) external view returns (bytes32);
2268
+
2269
+ /**
2270
+ * @dev Grants `role` to `account`.
2271
+ *
2272
+ * If `account` had not been already granted `role`, emits a {RoleGranted}
2273
+ * event.
2274
+ *
2275
+ * Requirements:
2276
+ *
2277
+ * - the caller must have ``role``'s admin role.
2278
+ */
2279
+ function grantRole(bytes32 role, address account) external;
2280
+
2281
+ /**
2282
+ * @dev Revokes `role` from `account`.
2283
+ *
2284
+ * If `account` had been granted `role`, emits a {RoleRevoked} event.
2285
+ *
2286
+ * Requirements:
2287
+ *
2288
+ * - the caller must have ``role``'s admin role.
2289
+ */
2290
+ function revokeRole(bytes32 role, address account) external;
2291
+
2292
+ /**
2293
+ * @dev Revokes `role` from the calling account.
2294
+ *
2295
+ * Roles are often managed via {grantRole} and {revokeRole}: this function's
2296
+ * purpose is to provide a mechanism for accounts to lose their privileges
2297
+ * if they are compromised (such as when a trusted device is misplaced).
2298
+ *
2299
+ * If the calling account had been granted `role`, emits a {RoleRevoked}
2300
+ * event.
2301
+ *
2302
+ * Requirements:
2303
+ *
2304
+ * - the caller must be `account`.
2305
+ */
2306
+ function renounceRole(bytes32 role, address account) external;
2307
+ }
2308
+
2309
+ interface IInterestRateStrategy {
2310
+ /**
2311
+ * @dev This constant represents the usage ratio at which the pool aims to obtain most competitive borrow rates.
2312
+ * Expressed in ray
2313
+ */
2314
+ function OPTIMAL_USAGE_RATIO() external view returns (uint256);
2315
+
2316
+ /**
2317
+ * @dev This constant represents the optimal stable debt to total debt ratio of the reserve.
2318
+ * Expressed in ray
2319
+ */
2320
+ function OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO() external view returns (uint256);
2321
+
2322
+ /**
2323
+ * @dev This constant represents the excess usage ratio above the optimal. It's always equal to
2324
+ * 1-optimal usage ratio. Added as a constant here for gas optimizations.
2325
+ * Expressed in ray
2326
+ */
2327
+ function MAX_EXCESS_USAGE_RATIO() external view returns (uint256);
2328
+
2329
+ /**
2330
+ * @dev This constant represents the excess stable debt ratio above the optimal. It's always equal to
2331
+ * 1-optimal stable to total debt ratio. Added as a constant here for gas optimizations.
2332
+ * Expressed in ray
2333
+ */
2334
+ function MAX_EXCESS_STABLE_TO_TOTAL_DEBT_RATIO() external view returns (uint256);
2335
+
2336
+ function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
2337
+
2338
+ /**
2339
+ * @notice Returns the variable rate slope below optimal usage ratio
2340
+ * @dev Its the variable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
2341
+ * @return The variable rate slope
2342
+ */
2343
+ function getVariableRateSlope1() external view returns (uint256);
2344
+
2345
+ /**
2346
+ * @notice Returns the variable rate slope above optimal usage ratio
2347
+ * @dev Its the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
2348
+ * @return The variable rate slope
2349
+ */
2350
+ function getVariableRateSlope2() external view returns (uint256);
2351
+
2352
+ /**
2353
+ * @notice Returns the stable rate slope below optimal usage ratio
2354
+ * @dev Its the stable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
2355
+ * @return The stable rate slope
2356
+ */
2357
+ function getStableRateSlope1() external view returns (uint256);
2358
+
2359
+ /**
2360
+ * @notice Returns the stable rate slope above optimal usage ratio
2361
+ * @dev Its the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
2362
+ * @return The stable rate slope
2363
+ */
2364
+ function getStableRateSlope2() external view returns (uint256);
2365
+
2366
+ /**
2367
+ * @notice Returns the stable rate excess offset
2368
+ * @dev An additional premium applied to the stable when stable debt > OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO
2369
+ * @return The stable rate excess offset
2370
+ */
2371
+ function getStableRateExcessOffset() external view returns (uint256);
2372
+
2373
+ /**
2374
+ * @notice Returns the base stable borrow rate
2375
+ * @return The base stable borrow rate
2376
+ */
2377
+ function getBaseStableBorrowRate() external view returns (uint256);
2378
+
2379
+ /**
2380
+ * @notice Returns the base variable borrow rate
2381
+ * @return The base variable borrow rate, expressed in ray
2382
+ */
2383
+ function getBaseVariableBorrowRate() external view returns (uint256);
2384
+
2385
+ /**
2386
+ * @notice Returns the maximum variable borrow rate
2387
+ * @return The maximum variable borrow rate, expressed in ray
2388
+ */
2389
+ function getMaxVariableBorrowRate() external view returns (uint256);
2390
+
2391
+ /**
2392
+ * @notice Calculates the interest rates depending on the reserve's state and configurations
2393
+ * @param params The parameters needed to calculate interest rates
2394
+ * @return liquidityRate The liquidity rate expressed in rays
2395
+ * @return stableBorrowRate The stable borrow rate expressed in rays
2396
+ * @return variableBorrowRate The variable borrow rate expressed in rays
2397
+ */
2398
+ function calculateInterestRates(DataTypes.CalculateInterestRatesParams memory params)
2399
+ external
2400
+ view
2401
+ returns (
2402
+ uint256,
2403
+ uint256,
2404
+ uint256
2405
+ );
2406
+ }