Проверенный контрактЧастичноеMIT
AaveV3EthereumLido_ReserveFactorUpdatesAcrossAaveV3AndV2Markets_20261111
Адрес0x923bf5b3f3df369b4f4cffe86d08476471bc36cf
- Баланс
0 ETH
- Транзакций
0
- Компилятор
solc 0.8.28
- Тот же код
Только этот контракт
Подробности
- Компилятор
- solc 0.8.28+commit.7893614a
- Язык
- solidity
- Оптимизация
- Да, 200 прогонов
- Версия EVM
- shanghai
- Лицензия
- MIT
- Совпадение
- Частичноекод создания: да, код в сети: да
- Проверен на Sourcify
- Создан в блоке
- 26 499 953
- Транзакция создания
- 0x1e97bc336b…0ba1bc617d
28 файлов
- src/20261111_Multi_ReserveFactorUpdatesAcrossAaveV3AndV2Markets/AaveV3EthereumLido_ReserveFactorUpdatesAcrossAaveV3AndV2Markets_20261111.solглавный1,38 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2,78 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol6,03 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Errors.sol896 Б
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/dependencies/chainlink/AggregatorInterface.sol1,21 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol6,79 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/EngineFlags.sol1,5 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol11,39 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IACLManager.sol5,46 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IAToken.sol5,69 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IAaveOracle.sol2,39 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IDefaultInterestRateStrategyV2.sol6,1 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IInitializableAToken.sol1,7 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPool.sol36,35 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPoolAddressesProvider.sol8,21 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPoolConfigurator.sol19,6 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPoolDataProvider.sol9,71 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPriceOracleGetter.sol848 Б
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IReserveInterestRateStrategy.sol1,12 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IScaledBalanceToken.sol2,74 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/helpers/Errors.sol7,36 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/math/WadRayMath.sol5,4 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol649 Б
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/types/DataTypes.sol9,72 КБ
- lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/treasury/ICollector.sol6,61 КБ
- lib/aave-helpers/lib/aave-address-book/src/AaveV3.sol2,06 КБ
- lib/aave-helpers/lib/aave-address-book/src/AaveV3EthereumLido.sol16,87 КБ
- lib/aave-helpers/src/v3-config-engine/AaveV3PayloadEthereumLido.sol618 Б
src/20261111_Multi_ReserveFactorUpdatesAcrossAaveV3AndV2Markets/AaveV3EthereumLido_ReserveFactorUpdatesAcrossAaveV3AndV2Markets_20261111.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {AaveV3EthereumLidoAssets} from 'aave-address-book/AaveV3EthereumLido.sol';
import {AaveV3PayloadEthereumLido} from 'aave-helpers/src/v3-config-engine/AaveV3PayloadEthereumLido.sol';
import {EngineFlags} from 'aave-v3-origin/contracts/extensions/v3-config-engine/EngineFlags.sol';
import {IAaveV3ConfigEngine} from 'aave-v3-origin/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
/**
* @title Reserve Factor Updates Across Aave V3 and V2 Markets
* @author @TokenLogic
* - Snapshot: Direct-to-AIP
* - Discussion: https://governance.aave.com/t/direct-to-aip-reserve-factor-updates-across-aave-v3-and-v2-markets/26249
*/
contract AaveV3EthereumLido_ReserveFactorUpdatesAcrossAaveV3AndV2Markets_20261111 is
AaveV3PayloadEthereumLido
{
uint256 public constant wstETH_RF = 50_00;
function borrowsUpdates()
public
pure
override
returns (IAaveV3ConfigEngine.BorrowUpdate[] memory)
{
IAaveV3ConfigEngine.BorrowUpdate[]
memory borrowUpdates = new IAaveV3ConfigEngine.BorrowUpdate[](1);
borrowUpdates[0] = IAaveV3ConfigEngine.BorrowUpdate({
asset: AaveV3EthereumLidoAssets.wstETH_UNDERLYING,
enabledToBorrow: EngineFlags.KEEP_CURRENT,
flashloanable: EngineFlags.KEEP_CURRENT,
reserveFactor: wstETH_RF
});
return borrowUpdates;
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert Errors.FailedCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/dependencies/chainlink/AggregatorInterface.sol
// SPDX-License-Identifier: MIT
// Chainlink Contracts v0.8
pragma solidity ^0.8.0;
interface AggregatorInterface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function getRoundData(
uint80 _roundId
)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
function aggregator() external view returns (address);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import {Address} from 'openzeppelin-contracts/contracts/utils/Address.sol';
import {WadRayMath} from '../../protocol/libraries/math/WadRayMath.sol';
import {IAaveV3ConfigEngine as IEngine} from './IAaveV3ConfigEngine.sol';
import {EngineFlags} from './EngineFlags.sol';
/**
* @dev Base smart contract for an Aave v3.0.1 configs update.
* - !!!IMPORTANT!!! This payload inheriting AaveV3Payload MUST BE STATELESS always
* - Assumes this contract has the right permissions
* - Connected to a IAaveV3ConfigEngine engine contact, which abstract the complexities of
* interaction with the Aave protocol.
* - At the moment covering:
* - Listings of new assets on the pool.
* - Listings of new assets on the pool with custom token impl.
* - Updates of caps (supply cap, borrow cap).
* - Updates of price feeds
* - Updates of interest rate strategies
* - Updates of borrow parameters (flashloanable, reserveFactor)
* - Updates of collateral parameters (ltv, liq threshold, liq bonus, liq protocol fee)
* - Updates of emode category parameters (ltv, liq threshold, liq bonus, price source, label)
* - Updates of emode category of assets (e-mode id)
* @author BGD Labs
*/
abstract contract AaveV3Payload {
using Address for address;
IEngine public immutable CONFIG_ENGINE;
constructor(IEngine engine) {
CONFIG_ENGINE = engine;
}
/// @dev to be overriden on the child if any extra logic is needed pre-listing
function _preExecute() internal virtual {}
/// @dev to be overriden on the child if any extra logic is needed post-listing
function _postExecute() internal virtual {}
function execute() external {
_preExecute();
IEngine.Listing[] memory listings = newListings();
IEngine.ListingWithCustomImpl[] memory listingsCustom = newListingsCustom();
IEngine.EModeCategoryUpdate[] memory eModeCategories = eModeCategoriesUpdates();
IEngine.AssetEModeUpdate[] memory assetsEModes = assetsEModeUpdates();
IEngine.EModeCategoryCreation[] memory newEmodes = eModeCategoryCreations();
IEngine.CollateralUpdate[] memory collaterals = collateralsUpdates();
IEngine.BorrowUpdate[] memory borrows = borrowsUpdates();
IEngine.RateStrategyUpdate[] memory rates = rateStrategiesUpdates();
IEngine.PriceFeedUpdate[] memory priceFeeds = priceFeedsUpdates();
IEngine.CapsUpdate[] memory caps = capsUpdates();
if (listings.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.listAssets.selector, getPoolContext(), listings)
);
}
if (listingsCustom.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(
CONFIG_ENGINE.listAssetsCustom.selector,
getPoolContext(),
listingsCustom
)
);
}
if (eModeCategories.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.updateEModeCategories.selector, eModeCategories)
);
}
if (assetsEModes.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.updateAssetsEMode.selector, assetsEModes)
);
}
if (newEmodes.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.createEModeCategories.selector, newEmodes)
);
}
if (borrows.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.updateBorrowSide.selector, borrows)
);
}
if (collaterals.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.updateCollateralSide.selector, collaterals)
);
}
if (rates.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.updateRateStrategies.selector, rates)
);
}
if (priceFeeds.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.updatePriceFeeds.selector, priceFeeds)
);
}
if (caps.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
abi.encodeWithSelector(CONFIG_ENGINE.updateCaps.selector, caps)
);
}
_postExecute();
}
/** @dev Converts basis points to RAY units
* e.g. 10_00 (10.00%) will return 100000000000000000000000000
*/
function _bpsToRay(uint256 amount) internal pure returns (uint256) {
return (amount * WadRayMath.RAY) / 10_000;
}
/// @dev to be defined in the child with a list of new assets to list
function newListings() public view virtual returns (IEngine.Listing[] memory) {}
/// @dev to be defined in the child with a list of new assets to list (with custom a/v/s tokens implementations)
function newListingsCustom()
public
view
virtual
returns (IEngine.ListingWithCustomImpl[] memory)
{}
/// @dev to be defined in the child with a list of caps to update
function capsUpdates() public view virtual returns (IEngine.CapsUpdate[] memory) {}
/// @dev to be defined in the child with a list of collaterals' params to update
function collateralsUpdates() public view virtual returns (IEngine.CollateralUpdate[] memory) {}
/// @dev to be defined in the child with a list of borrows' params to update
function borrowsUpdates() public view virtual returns (IEngine.BorrowUpdate[] memory) {}
/// @dev to be defined in the child with a list of priceFeeds to update
function priceFeedsUpdates() public view virtual returns (IEngine.PriceFeedUpdate[] memory) {}
/// @dev to be defined in the child with a list of eMode categories to create
function eModeCategoryCreations()
public
view
virtual
returns (IEngine.EModeCategoryCreation[] memory)
{}
/// @dev to be defined in the child with a list of eMode categories to update
function eModeCategoriesUpdates()
public
view
virtual
returns (IEngine.EModeCategoryUpdate[] memory)
{}
/// @dev to be defined in the child with a list of assets for which eMode collateral to update
function assetsEModeUpdates() public view virtual returns (IEngine.AssetEModeUpdate[] memory) {}
/// @dev to be defined in the child with a list of set of parameters of rate strategies
function rateStrategiesUpdates()
public
view
virtual
returns (IEngine.RateStrategyUpdate[] memory)
{}
/// @dev the lack of support for immutable strings kinds of forces for this
/// Besides that, it can actually be useful being able to change the naming, but remote
function getPoolContext() public view virtual returns (IEngine.PoolContext memory);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/EngineFlags.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
library EngineFlags {
/// @dev magic value to be used as flag to keep unchanged any current configuration
/// Strongly assumes that the value `type(uint256).max - 42` will never be used, which seems reasonable
uint256 internal constant KEEP_CURRENT = type(uint256).max - 42;
/// @dev magic value to be used as flag to keep unchanged any current configuration
/// Strongly assumes that the value `KEEP_CURRENT_STRING` will never be used, which seems reasonable
string internal constant KEEP_CURRENT_STRING = 'KEEP_CURRENT_STRING';
/// @dev magic value to be used as flag to keep unchanged any current configuration
/// Strongly assumes that the value `0x0000000000000000000000000000000000000050` will never be used, which seems reasonable
address internal constant KEEP_CURRENT_ADDRESS =
address(0x0000000000000000000000000000000000000050);
/// @dev value to be used as flag for bool value true
uint256 internal constant ENABLED = 1;
/// @dev value to be used as flag for bool value false
uint256 internal constant DISABLED = 0;
/// @dev converts flag ENABLED DISABLED to bool
function toBool(uint256 flag) internal pure returns (bool) {
require(flag == 0 || flag == 1, 'INVALID_CONVERSION_TO_BOOL');
return flag == 1;
}
/// @dev converts bool to ENABLED DISABLED flags
function fromBool(bool isTrue) internal pure returns (uint256) {
return isTrue ? ENABLED : DISABLED;
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {IPool} from '../../interfaces/IPool.sol';
import {IPoolConfigurator} from '../../interfaces/IPoolConfigurator.sol';
import {IAaveOracle} from '../../interfaces/IAaveOracle.sol';
import {IDefaultInterestRateStrategyV2} from '../../interfaces/IDefaultInterestRateStrategyV2.sol';
/// @dev Examples here assume the usage of the `AaveV3Payload` base contracts
/// contained in this same repository
interface IAaveV3ConfigEngine {
struct Basic {
string assetSymbol;
TokenImplementations implementations;
}
struct EngineConstants {
IPool pool;
IPoolConfigurator poolConfigurator;
IAaveOracle oracle;
address rewardsController;
address collector;
address defaultInterestRateStrategy;
}
struct InterestRateInputData {
uint256 optimalUsageRatio;
uint256 baseVariableBorrowRate;
uint256 variableRateSlope1;
uint256 variableRateSlope2;
}
/**
* @dev Required for naming of a/v/s tokens
* Example (mock):
* PoolContext({
* networkName: 'Polygon',
* networkAbbreviation: 'Pol'
* })
*/
struct PoolContext {
string networkName;
string networkAbbreviation;
}
/**
* @dev Example (mock):
* Listing({
* asset: 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9,
* assetSymbol: 'AAVE',
* priceFeed: 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9,
* rateStrategyParams: InterestRateInputData({
* optimalUsageRatio: 80_00,
* baseVariableBorrowRate: 25, // 0.25%
* variableRateSlope1: 3_00,
* variableRateSlope2: 75_00
* }),
* enabledToBorrow: EngineFlags.ENABLED,
* flashloanable: EngineFlags.ENABLED,
* ltv: 70_50, // 70.5%
* liqThreshold: 76_00, // 76%
* liqBonus: 5_00, // 5%
* reserveFactor: 10_00, // 10%
* supplyCap: 100_000, // 100k AAVE
* borrowCap: 60_000, // 60k AAVE
* liqProtocolFee: 10_00, // 10%
* }
*/
struct Listing {
address asset;
string assetSymbol;
address priceFeed;
InterestRateInputData rateStrategyParams; // Mandatory, no matter if enabled for borrowing or not
uint256 enabledToBorrow;
uint256 flashloanable; // Independent from enabled to borrow: an asset can be flashloanble and not enabled to borrow
uint256 ltv; // Only considered if liqThreshold > 0
uint256 liqThreshold; // If `0`, the asset will not be enabled as collateral
uint256 liqBonus; // Only considered if liqThreshold > 0
uint256 reserveFactor; // Only considered if enabledToBorrow == EngineFlags.ENABLED (true)
uint256 supplyCap; // If passing any value distinct to EngineFlags.KEEP_CURRENT, always configured
uint256 borrowCap; // If passing any value distinct to EngineFlags.KEEP_CURRENT, always configured
uint256 liqProtocolFee; // Only considered if liqThreshold > 0
}
struct RepackedListings {
address[] ids;
Basic[] basics;
BorrowUpdate[] borrowsUpdates;
CollateralUpdate[] collateralsUpdates;
PriceFeedUpdate[] priceFeedsUpdates;
CapsUpdate[] capsUpdates;
IDefaultInterestRateStrategyV2.InterestRateData[] rates;
}
struct TokenImplementations {
address aToken;
address vToken;
}
struct ListingWithCustomImpl {
Listing base;
TokenImplementations implementations;
}
/**
* @dev Example (mock):
* CapsUpdate({
* asset: AaveV3EthereumAssets.AAVE_UNDERLYING,
* supplyCap: 1_000_000,
* borrowCap: EngineFlags.KEEP_CURRENT
* }
*/
struct CapsUpdate {
address asset;
uint256 supplyCap; // Pass any value, of EngineFlags.KEEP_CURRENT to keep it as it is
uint256 borrowCap; // Pass any value, of EngineFlags.KEEP_CURRENT to keep it as it is
}
/**
* @dev Example (mock):
* PriceFeedUpdate({
* asset: AaveV3EthereumAssets.AAVE_UNDERLYING,
* priceFeed: 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9
* })
*/
struct PriceFeedUpdate {
address asset;
address priceFeed;
}
/**
* @dev Example (mock):
* CollateralUpdate({
* asset: AaveV3EthereumAssets.AAVE_UNDERLYING,
* ltv: 60_00,
* liqThreshold: 70_00,
* liqBonus: EngineFlags.KEEP_CURRENT,
* liqProtocolFee: 7_00
* })
*/
struct CollateralUpdate {
address asset;
uint256 ltv;
uint256 liqThreshold;
uint256 liqBonus;
uint256 liqProtocolFee;
}
/**
* @dev Example (mock):
* BorrowUpdate({
* asset: AaveV3EthereumAssets.AAVE_UNDERLYING,
* enabledToBorrow: EngineFlags.ENABLED,
* flashloanable: EngineFlags.KEEP_CURRENT,
* reserveFactor: 15_00, // 15%
* })
*/
struct BorrowUpdate {
address asset;
uint256 enabledToBorrow;
uint256 flashloanable;
uint256 reserveFactor;
}
/**
* @dev Example (mock):
* AssetEModeUpdate({
* asset: AaveV3EthereumAssets.rETH_UNDERLYING,
* eModeCategory: 1, // ETH correlated
* borrowable: EngineFlags.ENABLED,
* collateral: EngineFlags.KEEP_CURRENT,
* ltvzero: EngineFlags.KEEP_CURRENT
* })
*/
struct AssetEModeUpdate {
address asset;
uint8 eModeCategory;
uint256 borrowable;
uint256 collateral;
uint256 ltvzero;
}
/**
* @dev Example (mock):
* EModeCategoryUpdate({
* eModeCategory: 1, // ETH correlated
* ltv: 60_00,
* liqThreshold: 70_00,
* liqBonus: EngineFlags.KEEP_CURRENT,
* label: EngineFlags.KEEP_CURRENT_STRING,
* isolated: EngineFlags.ENABLED
* })
*/
struct EModeCategoryUpdate {
uint8 eModeCategory;
uint256 ltv;
uint256 liqThreshold;
uint256 liqBonus;
string label;
uint256 isolated;
}
/**
* @dev Example (mock):
* EModeCategoryUpdate({
* ltv: 60_00,
* liqThreshold: 70_00,
* liqBonus: 3_00,
* label: 'WETH USDC',
* borrowables:[USDC],
* collaterals:[ETH]
* })
*/
struct EModeCategoryCreation {
uint256 ltv;
uint256 liqThreshold;
uint256 liqBonus;
string label;
address[] borrowables;
address[] collaterals;
bool isolated;
}
/**
* @dev Example (mock):
* RateStrategyUpdate({
* asset: AaveV3OptimismAssets.USDT_UNDERLYING,
* params: InterestRateInputData({
* optimalUsageRatio: _bpsToRay(80_00),
* baseVariableBorrowRate: EngineFlags.KEEP_CURRENT,
* variableRateSlope1: EngineFlags.KEEP_CURRENT,
* variableRateSlope2: _bpsToRay(75_00)
* })
* })
*/
struct RateStrategyUpdate {
address asset;
InterestRateInputData params;
}
/**
* @notice Performs full listing of the assets, in the Aave pool configured in this engine instance
* @param context `PoolContext` struct, effectively meta-data for naming of a/v/s tokens.
* More information on the documentation of the struct.
* @param listings `Listing[]` list of declarative configs for every aspect of the asset listings.
* More information on the documentation of the struct.
*/
function listAssets(PoolContext memory context, Listing[] memory listings) external;
/**
* @notice Performs full listings of assets, in the Aave pool configured in this engine instance
* @dev This function allows more customization, especifically enables to set custom implementations
* for a/v/s tokens.
* IMPORTANT. Use it only if understanding the internals of the Aave v3 protocol
* @param context `PoolContext` struct, effectively meta-data for naming of a/v/s tokens.
* More information on the documentation of the struct.
* @param listings `ListingWithCustomImpl[]` list of declarative configs for every aspect of the asset listings.
*/
function listAssetsCustom(
PoolContext memory context,
ListingWithCustomImpl[] memory listings
) external;
/**
* @notice Performs an update of the caps (supply, borrow) of the assets, in the Aave pool configured in this engine instance
* @param updates `CapsUpdate[]` list of declarative updates containing the new caps
* More information on the documentation of the struct.
*/
function updateCaps(CapsUpdate[] memory updates) external;
/**
* @notice Performs an update on the rate strategy params of the assets, in the Aave pool configured in this engine instance
* @dev The engine itself manages if a new rate strategy needs to be deployed or if an existing one can be re-used
* @param updates `RateStrategyUpdate[]` list of declarative updates containing the new rate strategy params
* More information on the documentation of the struct.
*/
function updateRateStrategies(RateStrategyUpdate[] memory updates) external;
/**
* @notice Performs an update of the collateral-related params of the assets, in the Aave pool configured in this engine instance
* @param updates `CollateralUpdate[]` list of declarative updates containing the new parameters
* More information on the documentation of the struct.
*/
function updateCollateralSide(CollateralUpdate[] memory updates) external;
/**
* @notice Performs an update of the price feed of the assets, in the Aave pool configured in this engine instance
* @param updates `PriceFeedUpdate[]` list of declarative updates containing the new parameters
* More information on the documentation of the struct.
*/
function updatePriceFeeds(PriceFeedUpdate[] memory updates) external;
/**
* @notice Performs an update of the borrow-related params of the assets, in the Aave pool configured in this engine instance
* @param updates `BorrowUpdate[]` list of declarative updates containing the new parameters
* More information on the documentation of the struct.
*/
function updateBorrowSide(BorrowUpdate[] memory updates) external;
/**
* @notice Performs creation of new e-mode categories, in the Aave pool configured in this engine instance
* @param creations `EModeCategoryCreation[]` list of declarative creations containing the new parameters
* More information on the documentation of the struct.
*/
function createEModeCategories(EModeCategoryCreation[] memory creations) external;
/**
* @notice Performs an update of the e-mode categories, in the Aave pool configured in this engine instance
* @param updates `EModeCategoryUpdate[]` list of declarative updates containing the new parameters
* More information on the documentation of the struct.
*/
function updateEModeCategories(EModeCategoryUpdate[] memory updates) external;
/**
* @notice Performs an update of the e-mode category.
* Sets a specified asset collateral and/or borrowable, in the Aave pool configured in this engine instance
* @param updates `EModeCollateralUpdate[]` list of declarative updates containing the new parameters
* More information on the documentation of the struct.
*/
function updateAssetsEMode(AssetEModeUpdate[] calldata updates) external;
function DEFAULT_INTEREST_RATE_STRATEGY() external view returns (address);
function POOL() external view returns (IPool);
function POOL_CONFIGURATOR() external view returns (IPoolConfigurator);
function ORACLE() external view returns (IAaveOracle);
function ATOKEN_IMPL() external view returns (address);
function VTOKEN_IMPL() external view returns (address);
function REWARDS_CONTROLLER() external view returns (address);
function COLLECTOR() external view returns (address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IACLManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
/**
* @title IACLManager
* @author Aave
* @notice Defines the basic interface for the ACL Manager
*/
interface IACLManager {
/**
* @notice Returns the contract address of the PoolAddressesProvider
* @return The address of the PoolAddressesProvider
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
/**
* @notice Returns the identifier of the PoolAdmin role
* @return The id of the PoolAdmin role
*/
function POOL_ADMIN_ROLE() external view returns (bytes32);
/**
* @notice Returns the identifier of the EmergencyAdmin role
* @return The id of the EmergencyAdmin role
*/
function EMERGENCY_ADMIN_ROLE() external view returns (bytes32);
/**
* @notice Returns the identifier of the RiskAdmin role
* @return The id of the RiskAdmin role
*/
function RISK_ADMIN_ROLE() external view returns (bytes32);
/**
* @notice Returns the identifier of the FlashBorrower role
* @return The id of the FlashBorrower role
*/
function FLASH_BORROWER_ROLE() external view returns (bytes32);
/**
* @notice Returns the identifier of the Bridge role
* @return The id of the Bridge role
*/
function BRIDGE_ROLE() external view returns (bytes32);
/**
* @notice Returns the identifier of the AssetListingAdmin role
* @return The id of the AssetListingAdmin role
*/
function ASSET_LISTING_ADMIN_ROLE() external view returns (bytes32);
/**
* @notice Set the role as admin of a specific role.
* @dev By default the admin role for all roles is `DEFAULT_ADMIN_ROLE`.
* @param role The role to be managed by the admin role
* @param adminRole The admin role
*/
function setRoleAdmin(bytes32 role, bytes32 adminRole) external;
/**
* @notice Adds a new admin as PoolAdmin
* @param admin The address of the new admin
*/
function addPoolAdmin(address admin) external;
/**
* @notice Removes an admin as PoolAdmin
* @param admin The address of the admin to remove
*/
function removePoolAdmin(address admin) external;
/**
* @notice Returns true if the address is PoolAdmin, false otherwise
* @param admin The address to check
* @return True if the given address is PoolAdmin, false otherwise
*/
function isPoolAdmin(address admin) external view returns (bool);
/**
* @notice Adds a new admin as EmergencyAdmin
* @param admin The address of the new admin
*/
function addEmergencyAdmin(address admin) external;
/**
* @notice Removes an admin as EmergencyAdmin
* @param admin The address of the admin to remove
*/
function removeEmergencyAdmin(address admin) external;
/**
* @notice Returns true if the address is EmergencyAdmin, false otherwise
* @param admin The address to check
* @return True if the given address is EmergencyAdmin, false otherwise
*/
function isEmergencyAdmin(address admin) external view returns (bool);
/**
* @notice Adds a new admin as RiskAdmin
* @param admin The address of the new admin
*/
function addRiskAdmin(address admin) external;
/**
* @notice Removes an admin as RiskAdmin
* @param admin The address of the admin to remove
*/
function removeRiskAdmin(address admin) external;
/**
* @notice Returns true if the address is RiskAdmin, false otherwise
* @param admin The address to check
* @return True if the given address is RiskAdmin, false otherwise
*/
function isRiskAdmin(address admin) external view returns (bool);
/**
* @notice Adds a new address as FlashBorrower
* @param borrower The address of the new FlashBorrower
*/
function addFlashBorrower(address borrower) external;
/**
* @notice Removes an address as FlashBorrower
* @param borrower The address of the FlashBorrower to remove
*/
function removeFlashBorrower(address borrower) external;
/**
* @notice Returns true if the address is FlashBorrower, false otherwise
* @param borrower The address to check
* @return True if the given address is FlashBorrower, false otherwise
*/
function isFlashBorrower(address borrower) external view returns (bool);
/**
* @notice Adds a new address as Bridge
* @param bridge The address of the new Bridge
*/
function addBridge(address bridge) external;
/**
* @notice Removes an address as Bridge
* @param bridge The address of the bridge to remove
*/
function removeBridge(address bridge) external;
/**
* @notice Returns true if the address is Bridge, false otherwise
* @param bridge The address to check
* @return True if the given address is Bridge, false otherwise
*/
function isBridge(address bridge) external view returns (bool);
/**
* @notice Adds a new admin as AssetListingAdmin
* @param admin The address of the new admin
*/
function addAssetListingAdmin(address admin) external;
/**
* @notice Removes an admin as AssetListingAdmin
* @param admin The address of the admin to remove
*/
function removeAssetListingAdmin(address admin) external;
/**
* @notice Returns true if the address is AssetListingAdmin, false otherwise
* @param admin The address to check
* @return True if the given address is AssetListingAdmin, false otherwise
*/
function isAssetListingAdmin(address admin) external view returns (bool);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IAToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {IScaledBalanceToken} from './IScaledBalanceToken.sol';
import {IInitializableAToken} from './IInitializableAToken.sol';
/**
* @title IAToken
* @author Aave
* @notice Defines the basic interface for an AToken.
*/
interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/**
* @dev Emitted during the transfer action
* @param from The user whose tokens are being transferred
* @param to The recipient
* @param value The scaled amount being transferred
* @param index The next liquidity index of the reserve
*/
event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);
/**
* @notice Mints `amount` aTokens to `user`
* @param caller The address performing the mint
* @param onBehalfOf The address of the user that will receive the minted aTokens
* @param scaledAmount The scaled amount of tokens getting minted
* @param index The next liquidity index of the reserve
* @return `true` if the the previous balance of the user was 0
*/
function mint(
address caller,
address onBehalfOf,
uint256 scaledAmount,
uint256 index
) external returns (bool);
/**
* @notice Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying`.
* @dev Passing both the unscaled and scaled amounts enhances precision. The `scaledAmount` is used for precise balance updates,
* while the `amount` is used for the underlying asset transfer, preventing cumulative rounding errors.
* @dev In some instances, a mint event may be emitted from a burn transaction if the amount to burn is less than the interest that the user accrued.
* @param from The address from which the aTokens will be burned
* @param receiverOfUnderlying The address that will receive the underlying
* @param amount The amount of underlying to be burned (non scaled)
* @param scaledAmount The scaled amount of aTokens to be burned (scaled)
* @param index The next liquidity index of the reserve
* @return `true` if the the new balance of the user is 0
*/
function burn(
address from,
address receiverOfUnderlying,
uint256 amount,
uint256 scaledAmount,
uint256 index
) external returns (bool);
/**
* @notice Mints aTokens to the reserve treasury
* @param scaledAmount The scaled amount of tokens getting minted
* @param index The next liquidity index of the reserve
*/
function mintToTreasury(uint256 scaledAmount, uint256 index) external;
/**
* @notice Transfers aTokens in the event of a borrow being liquidated, in case the liquidator reclaims the aToken.
* @dev Passing both the unscaled and scaled amounts enhances precision. The `scaledAmount` is used for precise balance updates,
* while the `amount` is used for logging and consistency, preventing cumulative rounding errors.
* @param from The address getting liquidated, current owner of the aTokens
* @param to The recipient
* @param amount The amount of tokens getting transferred (non-scaled)
* @param scaledAmount The scaled amount of tokens getting transferred (scaled)
* @param index The next liquidity index of the reserve
*/
function transferOnLiquidation(
address from,
address to,
uint256 amount,
uint256 scaledAmount,
uint256 index
) external;
/**
* @notice Transfers the underlying asset to `target`.
* @dev Used by the Pool to transfer assets in borrow(), withdraw() and flashLoan()
* @param target The recipient of the underlying
* @param amount The amount getting transferred
*/
function transferUnderlyingTo(address target, uint256 amount) external;
/**
* @notice Allow passing a signed message to approve spending
* @dev implements the permit function as for
* https://github.com/ethereum/EIPs/blob/8a34d644aacf0f9f8f00815307fd7dd5da07655f/EIPS/eip-2612.md
* @param owner The owner of the funds
* @param spender The spender
* @param value The amount
* @param deadline The deadline timestamp, type(uint256).max for max deadline
* @param v Signature param
* @param s Signature param
* @param r Signature param
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @notice Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)
* @return The address of the underlying asset
*/
function UNDERLYING_ASSET_ADDRESS() external view returns (address);
/**
* @notice Returns the address of the Aave treasury, receiving the fees on this aToken.
* @return Address of the Aave treasury
*/
function RESERVE_TREASURY_ADDRESS() external view returns (address);
/**
* @notice Get the domain separator for the token
* @dev Return cached value if chainId matches cache, otherwise recomputes separator
* @return The domain separator of the token at current chain
*/
function DOMAIN_SEPARATOR() external view returns (bytes32);
/**
* @notice Returns the nonce for owner.
* @param owner The address of the owner
* @return The nonce of the owner
*/
function nonces(address owner) external view returns (uint256);
/**
* @notice Rescue and transfer tokens locked in this contract
* @param token The address of the token
* @param to The address of the recipient
* @param amount The amount of token to transfer
*/
function rescueTokens(address token, address to, uint256 amount) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IAaveOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPriceOracleGetter} from './IPriceOracleGetter.sol';
import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
/**
* @title IAaveOracle
* @author Aave
* @notice Defines the basic interface for the Aave Oracle
*/
interface IAaveOracle is IPriceOracleGetter {
/**
* @dev Emitted after the base currency is set
* @param baseCurrency The base currency of used for price quotes
* @param baseCurrencyUnit The unit of the base currency
*/
event BaseCurrencySet(address indexed baseCurrency, uint256 baseCurrencyUnit);
/**
* @dev Emitted after the price source of an asset is updated
* @param asset The address of the asset
* @param source The price source of the asset
*/
event AssetSourceUpdated(address indexed asset, address indexed source);
/**
* @dev Emitted after the address of fallback oracle is updated
* @param fallbackOracle The address of the fallback oracle
*/
event FallbackOracleUpdated(address indexed fallbackOracle);
/**
* @notice Returns the PoolAddressesProvider
* @return The address of the PoolAddressesProvider contract
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
/**
* @notice Sets or replaces price sources of assets
* @param assets The addresses of the assets
* @param sources The addresses of the price sources
*/
function setAssetSources(address[] calldata assets, address[] calldata sources) external;
/**
* @notice Sets the fallback oracle
* @param fallbackOracle The address of the fallback oracle
*/
function setFallbackOracle(address fallbackOracle) external;
/**
* @notice Returns a list of prices from a list of assets addresses
* @param assets The list of assets addresses
* @return The prices of the given assets
*/
function getAssetsPrices(address[] calldata assets) external view returns (uint256[] memory);
/**
* @notice Returns the address of the source for an asset address
* @param asset The address of the asset
* @return The address of the source
*/
function getSourceOfAsset(address asset) external view returns (address);
/**
* @notice Returns the address of the fallback oracle
* @return The address of the fallback oracle
*/
function getFallbackOracle() external view returns (address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IDefaultInterestRateStrategyV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IReserveInterestRateStrategy} from './IReserveInterestRateStrategy.sol';
import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
/**
* @title IDefaultInterestRateStrategyV2
* @author BGD Labs
* @notice Interface of the default interest rate strategy used by the Aave protocol
*/
interface IDefaultInterestRateStrategyV2 is IReserveInterestRateStrategy {
/**
* @notice Holds the interest rate data for a given reserve
*
* @dev Since values are in bps, they are multiplied by 1e23 in order to become rays with 27 decimals. This
* in turn means that the maximum supported interest rate is 4294967295 (2**32-1) bps or 42949672.95%.
*
* @param optimalUsageRatio The optimal usage ratio, in bps
* @param baseVariableBorrowRate The base variable borrow rate, in bps
* @param variableRateSlope1 The slope of the variable interest curve, before hitting the optimal ratio, in bps
* @param variableRateSlope2 The slope of the variable interest curve, after hitting the optimal ratio, in bps
*/
struct InterestRateData {
uint16 optimalUsageRatio;
uint32 baseVariableBorrowRate;
uint32 variableRateSlope1;
uint32 variableRateSlope2;
}
/**
* @notice The interest rate data, where all values are in ray (fixed-point 27 decimal numbers) for a given reserve,
* used in in-memory calculations.
*
* @param optimalUsageRatio The optimal usage ratio
* @param baseVariableBorrowRate The base variable borrow rate
* @param variableRateSlope1 The slope of the variable interest curve, before hitting the optimal ratio
* @param variableRateSlope2 The slope of the variable interest curve, after hitting the optimal ratio
*/
struct InterestRateDataRay {
uint256 optimalUsageRatio;
uint256 baseVariableBorrowRate;
uint256 variableRateSlope1;
uint256 variableRateSlope2;
}
/**
* @notice emitted when new interest rate data is set in a reserve
*
* @param reserve address of the reserve that has new interest rate data set
* @param optimalUsageRatio The optimal usage ratio, in bps
* @param baseVariableBorrowRate The base variable borrow rate, in bps
* @param variableRateSlope1 The slope of the variable interest curve, before hitting the optimal ratio, in bps
* @param variableRateSlope2 The slope of the variable interest curve, after hitting the optimal ratio, in bps
*/
event RateDataUpdate(
address indexed reserve,
uint256 optimalUsageRatio,
uint256 baseVariableBorrowRate,
uint256 variableRateSlope1,
uint256 variableRateSlope2
);
/**
* @notice Returns the address of the PoolAddressesProvider
* @return The address of the PoolAddressesProvider contract
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
/**
* @notice Returns the maximum value achievable for variable borrow rate, in bps
* @return The maximum rate
*/
function MAX_BORROW_RATE() external view returns (uint256);
/**
* @notice Returns the minimum optimal point, in bps
* @return The optimal point
*/
function MIN_OPTIMAL_POINT() external view returns (uint256);
/**
* @notice Returns the maximum optimal point, in bps
* @return The optimal point
*/
function MAX_OPTIMAL_POINT() external view returns (uint256);
/**
* @notice Returns the full InterestRateData object for the given reserve, in ray
*
* @param reserve The reserve to get the data of
*
* @return The InterestRateDataRay object for the given reserve
*/
function getInterestRateData(address reserve) external view returns (InterestRateDataRay memory);
/**
* @notice Returns the full InterestRateData object for the given reserve, in bps
*
* @param reserve The reserve to get the data of
*
* @return The InterestRateData object for the given reserve
*/
function getInterestRateDataBps(address reserve) external view returns (InterestRateData memory);
/**
* @notice Returns the optimal usage rate for the given reserve in ray
*
* @param reserve The reserve to get the optimal usage rate of
*
* @return The optimal usage rate is the level of borrow / collateral at which the borrow rate
*/
function getOptimalUsageRatio(address reserve) external view returns (uint256);
/**
* @notice Returns the variable rate slope below optimal usage ratio in ray
* @dev It's the variable rate when usage ratio > 0 and <= OPTIMAL_USAGE_RATIO
*
* @param reserve The reserve to get the variable rate slope 1 of
*
* @return The variable rate slope
*/
function getVariableRateSlope1(address reserve) external view returns (uint256);
/**
* @notice Returns the variable rate slope above optimal usage ratio in ray
* @dev It's the variable rate when usage ratio > OPTIMAL_USAGE_RATIO
*
* @param reserve The reserve to get the variable rate slope 2 of
*
* @return The variable rate slope
*/
function getVariableRateSlope2(address reserve) external view returns (uint256);
/**
* @notice Returns the base variable borrow rate, in ray
*
* @param reserve The reserve to get the base variable borrow rate of
*
* @return The base variable borrow rate
*/
function getBaseVariableBorrowRate(address reserve) external view returns (uint256);
/**
* @notice Returns the maximum variable borrow rate, in ray
*
* @param reserve The reserve to get the maximum variable borrow rate of
*
* @return The maximum variable borrow rate
*/
function getMaxVariableBorrowRate(address reserve) external view returns (uint256);
/**
* @notice Sets interest rate data for an Aave rate strategy
* @param reserve The reserve to update
* @param rateData The reserve interest rate data to apply to the given reserve
* Being specific to this custom implementation, with custom struct type,
* overloading the function on the generic interface
*/
function setInterestRateParams(address reserve, InterestRateData calldata rateData) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IInitializableAToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPool} from './IPool.sol';
/**
* @title IInitializableAToken
* @author Aave
* @notice Interface for the initialize function on AToken
*/
interface IInitializableAToken {
/**
* @dev Emitted when an aToken is initialized
* @param underlyingAsset The address of the underlying asset
* @param pool The address of the associated pool
* @param treasury The address of the treasury
* @param incentivesController The address of the incentives controller for this aToken
* @param aTokenDecimals The decimals of the underlying
* @param aTokenName The name of the aToken
* @param aTokenSymbol The symbol of the aToken
* @param params A set of encoded parameters for additional initialization
*/
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address treasury,
address incentivesController,
uint8 aTokenDecimals,
string aTokenName,
string aTokenSymbol,
bytes params
);
/**
* @notice Initializes the aToken
* @param pool The pool contract that is initializing this contract
* @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH)
* @param aTokenDecimals The decimals of the aToken, same as the underlying asset's
* @param aTokenName The name of the aToken
* @param aTokenSymbol The symbol of the aToken
* @param params A set of encoded parameters for additional initialization
*/
function initialize(
IPool pool,
address underlyingAsset,
uint8 aTokenDecimals,
string calldata aTokenName,
string calldata aTokenSymbol,
bytes calldata params
) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
/**
* @title IPool
* @author Aave
* @notice Defines the basic interface for an Aave Pool.
*/
interface IPool {
/**
* @dev Emitted on supply()
* @param reserve The address of the underlying asset of the reserve
* @param user The address initiating the supply
* @param onBehalfOf The beneficiary of the supply, receiving the aTokens
* @param amount The amount supplied
* @param referralCode The referral code used
*/
event Supply(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
/**
* @dev Emitted on withdraw()
* @param reserve The address of the underlying asset being withdrawn
* @param user The address initiating the withdrawal, owner of aTokens
* @param to The address that will receive the underlying
* @param amount The amount to be withdrawn
*/
event Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount);
/**
* @dev Emitted on borrow() and flashLoan() when debt needs to be opened
* @param reserve The address of the underlying asset being borrowed
* @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
* initiator of the transaction on flashLoan()
* @param onBehalfOf The address that will be getting the debt
* @param amount The amount borrowed out
* @param interestRateMode The rate mode: 2 for Variable, 1 is deprecated (changed on v3.2.0)
* @param borrowRate The numeric rate at which the user has borrowed, expressed in ray
* @param referralCode The referral code used
*/
event Borrow(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
DataTypes.InterestRateMode interestRateMode,
uint256 borrowRate,
uint16 indexed referralCode
);
/**
* @dev Emitted on repay()
* @param reserve The address of the underlying asset of the reserve
* @param user The beneficiary of the repayment, getting his debt reduced
* @param repayer The address of the user initiating the repay(), providing the funds
* @param amount The amount repaid
* @param useATokens True if the repayment is done using aTokens, `false` if done with underlying asset directly
*/
event Repay(
address indexed reserve,
address indexed user,
address indexed repayer,
uint256 amount,
bool useATokens
);
/**
* @dev Emitted when the user selects a certain asset category for eMode
* @param user The address of the user
* @param categoryId The category id
*/
event UserEModeSet(address indexed user, uint8 categoryId);
/**
* @dev Emitted on setUserUseReserveAsCollateral()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user enabling the usage as collateral
*/
event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);
/**
* @dev Emitted on setUserUseReserveAsCollateral()
* @param reserve The address of the underlying asset of the reserve
* @param user The address of the user enabling the usage as collateral
*/
event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
/**
* @dev Emitted on flashLoan()
* @param target The address of the flash loan receiver contract
* @param initiator The address initiating the flash loan
* @param asset The address of the asset being flash borrowed
* @param amount The amount flash borrowed
* @param interestRateMode The flashloan mode: 0 for regular flashloan,
* 1 for Stable (Deprecated on v3.2.0), 2 for Variable
* @param premium The fee flash borrowed
* @param referralCode The referral code used
*/
event FlashLoan(
address indexed target,
address initiator,
address indexed asset,
uint256 amount,
DataTypes.InterestRateMode interestRateMode,
uint256 premium,
uint16 indexed referralCode
);
/**
* @dev Emitted when a borrower is liquidated.
* @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
* @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
* @param user The address of the borrower getting liquidated
* @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
* @param liquidatedCollateralAmount The amount of collateral received by the liquidator
* @param liquidator The address of the liquidator
* @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
* to receive the underlying collateral asset directly
*/
event LiquidationCall(
address indexed collateralAsset,
address indexed debtAsset,
address indexed user,
uint256 debtToCover,
uint256 liquidatedCollateralAmount,
address liquidator,
bool receiveAToken
);
/**
* @dev Emitted when the state of a reserve is updated.
* @param reserve The address of the underlying asset of the reserve
* @param liquidityRate The next liquidity rate
* @param stableBorrowRate The next stable borrow rate @note deprecated on v3.2.0
* @param variableBorrowRate The next variable borrow rate
* @param liquidityIndex The next liquidity index
* @param variableBorrowIndex The next variable borrow index
*/
event ReserveDataUpdated(
address indexed reserve,
uint256 liquidityRate,
uint256 stableBorrowRate,
uint256 variableBorrowRate,
uint256 liquidityIndex,
uint256 variableBorrowIndex
);
/**
* @dev Emitted when the deficit of a reserve is covered.
* @param reserve The address of the underlying asset of the reserve
* @param caller The caller that triggered the DeficitCovered event
* @param amountCovered The amount of deficit covered
*/
event DeficitCovered(address indexed reserve, address caller, uint256 amountCovered);
/**
* @dev Emitted when the protocol treasury receives minted aTokens from the accrued interest.
* @param reserve The address of the reserve
* @param amountMinted The amount minted to the treasury
*/
event MintedToTreasury(address indexed reserve, uint256 amountMinted);
/**
* @dev Emitted when deficit is realized on a liquidation.
* @param user The user address where the bad debt will be burned
* @param debtAsset The address of the underlying borrowed asset to be burned
* @param amountCreated The amount of deficit created
*/
event DeficitCreated(address indexed user, address indexed debtAsset, uint256 amountCreated);
/**
* @dev Emitted when a position manager is approved by the user.
* @param user The user address
* @param positionManager The address of the position manager
*/
event PositionManagerApproved(address indexed user, address indexed positionManager);
/**
* @dev Emitted when a position manager is revoked by the user.
* @param user The user address
* @param positionManager The address of the position manager
*/
event PositionManagerRevoked(address indexed user, address indexed positionManager);
/**
* @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
/**
* @notice Supply with transfer approval of asset to be supplied done via permit function
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param deadline The deadline timestamp that the permit is valid
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @param permitV The V parameter of ERC712 permit sig
* @param permitR The R parameter of ERC712 permit sig
* @param permitS The S parameter of ERC712 permit sig
*/
function supplyWithPermit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external;
/**
* @notice Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
* E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
* @param asset The address of the underlying asset to withdraw
* @param amount The underlying amount to be withdrawn
* - Send the value type(uint256).max in order to withdraw the whole aToken balance
* @param to The address that will receive the underlying, same as msg.sender if the user
* wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet
* @return The final amount withdrawn
*/
function withdraw(address asset, uint256 amount, address to) external returns (uint256);
/**
* @notice Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
* already supplied enough collateral, or he was given enough allowance by a credit delegator on the VariableDebtToken
* - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
* and 100 variable debt tokens
* @param asset The address of the underlying asset to borrow
* @param amount The amount to be borrowed
* @param interestRateMode 2 for Variable, 1 is deprecated on v3.2.0
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @param onBehalfOf The address of the user who will receive the debt. Should be the address of the borrower itself
* calling the function if he wants to borrow against his own collateral, or the address of the credit delegator
* if he has been given credit delegation allowance
*/
function borrow(
address asset,
uint256 amount,
uint256 interestRateMode,
uint16 referralCode,
address onBehalfOf
) external;
/**
* @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
* - E.g. User repays 100 USDC, burning 100 variable debt tokens of the `onBehalfOf` address
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode 2 for Variable, 1 is deprecated on v3.2.0
* @param onBehalfOf The address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
* @return The final amount repaid
*/
function repay(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf
) external returns (uint256);
/**
* @notice Repay with transfer approval of asset to be repaid done via permit function
* see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode 2 for Variable, 1 is deprecated on v3.2.0
* @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
* @param deadline The deadline timestamp that the permit is valid
* @param permitV The V parameter of ERC712 permit sig
* @param permitR The R parameter of ERC712 permit sig
* @param permitS The S parameter of ERC712 permit sig
* @return The final amount repaid
*/
function repayWithPermit(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf,
uint256 deadline,
uint8 permitV,
bytes32 permitR,
bytes32 permitS
) external returns (uint256);
/**
* @notice Repays a borrowed `amount` on a specific reserve using the reserve aTokens, burning the
* equivalent debt tokens
* - E.g. User repays 100 USDC using 100 aUSDC, burning 100 variable debt tokens
* @dev Passing uint256.max as amount will clean up any residual aToken dust balance, if the user aToken
* balance is not enough to cover the whole debt
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
* @param interestRateMode DEPRECATED in v3.2.0
* @return The final amount repaid
*/
function repayWithATokens(
address asset,
uint256 amount,
uint256 interestRateMode
) external returns (uint256);
/**
* @notice Allows suppliers to enable/disable a specific supplied asset as collateral
* @param asset The address of the underlying asset supplied
* @param useAsCollateral True if the user wants to use the supply as collateral, false otherwise
*/
function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;
/**
* @notice Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
* - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives
* a proportionally amount of the `collateralAsset` plus a bonus to cover market risk
* @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
* @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
* @param borrower The address of the borrower getting liquidated
* @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
* @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
* to receive the underlying collateral asset directly
*/
function liquidationCall(
address collateralAsset,
address debtAsset,
address borrower,
uint256 debtToCover,
bool receiveAToken
) external;
/**
* @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
* as long as the amount taken plus a fee is returned.
* @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
* into consideration. For further details please visit https://docs.aave.com/developers/
* @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface
* @param assets The addresses of the assets being flash-borrowed
* @param amounts The amounts of the assets being flash-borrowed
* @param interestRateModes Types of the debt to open if the flash loan is not returned:
* 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
* 1 -> Deprecated on v3.2.0
* 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
* @param onBehalfOf The address that will receive the debt in the case of using 2 on `modes`
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function flashLoan(
address receiverAddress,
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata interestRateModes,
address onBehalfOf,
bytes calldata params,
uint16 referralCode
) external;
/**
* @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
* as long as the amount taken plus a fee is returned.
* @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
* into consideration. For further details please visit https://docs.aave.com/developers/
* @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface
* @param asset The address of the asset being flash-borrowed
* @param amount The amount of the asset being flash-borrowed
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function flashLoanSimple(
address receiverAddress,
address asset,
uint256 amount,
bytes calldata params,
uint16 referralCode
) external;
/**
* @notice Returns the user account data across all the reserves
* @param user The address of the user
* @return totalCollateralBase The total collateral of the user in the base currency used by the price feed
* @return totalDebtBase The total debt of the user in the base currency used by the price feed
* @return availableBorrowsBase The borrowing power left of the user in the base currency used by the price feed
* @return currentLiquidationThreshold The liquidation threshold of the user
* @return ltv The loan to value of The user
* @return healthFactor The current health factor of the user
*/
function getUserAccountData(
address user
)
external
view
returns (
uint256 totalCollateralBase,
uint256 totalDebtBase,
uint256 availableBorrowsBase,
uint256 currentLiquidationThreshold,
uint256 ltv,
uint256 healthFactor
);
/**
* @notice Initializes a reserve, activating it, assigning an aToken and debt tokens
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param aTokenAddress The address of the aToken that will be assigned to the reserve
* @param variableDebtAddress The address of the VariableDebtToken that will be assigned to the reserve
*/
function initReserve(address asset, address aTokenAddress, address variableDebtAddress) external;
/**
* @notice Accumulates interest to all indexes of the reserve
* @dev Only callable by the PoolConfigurator contract
* @dev To be used when required by the configurator, for example when updating interest rates strategy data
* @param asset The address of the underlying asset of the reserve
*/
function syncIndexesState(address asset) external;
/**
* @notice Updates interest rates on the reserve data
* @dev Only callable by the PoolConfigurator contract
* @dev To be used when required by the configurator, for example when updating interest rates strategy data
* @param asset The address of the underlying asset of the reserve
*/
function syncRatesState(address asset) external;
/**
* @notice Sets the configuration bitmap of the reserve as a whole
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param configuration The new configuration bitmap
*/
function setConfiguration(
address asset,
DataTypes.ReserveConfigurationMap calldata configuration
) external;
/**
* @notice Returns the configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The configuration of the reserve
*/
function getConfiguration(
address asset
) external view returns (DataTypes.ReserveConfigurationMap memory);
/**
* @notice Returns the configuration of the user across all the reserves
* @param user The user address
* @return The configuration of the user
*/
function getUserConfiguration(
address user
) external view returns (DataTypes.UserConfigurationMap memory);
/**
* @notice Returns the normalized income of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The reserve's normalized income
*/
function getReserveNormalizedIncome(address asset) external view returns (uint256);
/**
* @notice Returns the normalized variable debt per unit of asset
* @dev WARNING: This function is intended to be used primarily by the protocol itself to get a
* "dynamic" variable index based on time, current stored index and virtual rate at the current
* moment (approx. a borrower would get if opening a position). This means that is always used in
* combination with variable debt supply/balances.
* If using this function externally, consider that is possible to have an increasing normalized
* variable debt that is not equivalent to how the variable debt index would be updated in storage
* (e.g. only updates with non-zero variable debt supply)
* @param asset The address of the underlying asset of the reserve
* @return The reserve normalized variable debt
*/
function getReserveNormalizedVariableDebt(address asset) external view returns (uint256);
/**
* @notice Returns the state and configuration of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The state and configuration data of the reserve
*/
function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory);
/**
* @notice Returns the virtual underlying balance of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The reserve virtual underlying balance
*/
function getVirtualUnderlyingBalance(address asset) external view returns (uint128);
/**
* @notice Validates and finalizes an aToken transfer
* @dev Only callable by the overlying aToken of the `asset`
* @param asset The address of the underlying asset of the aToken
* @param from The user from which the aTokens are transferred
* @param to The user receiving the aTokens
* @param scaledAmount The scaled amount being transferred/withdrawn
* @param scaledBalanceFromBefore The aToken scaled balance of the `from` user before the transfer
*/
function finalizeTransfer(
address asset,
address from,
address to,
uint256 scaledAmount,
uint256 scaledBalanceFromBefore
) external;
/**
* @notice Returns the list of the underlying assets of all the initialized reserves
* @dev It does not include dropped reserves
* @return The addresses of the underlying assets of the initialized reserves
*/
function getReservesList() external view returns (address[] memory);
/**
* @notice Returns the number of initialized reserves
* @dev It includes dropped reserves
* @return The count
*/
function getReservesCount() external view returns (uint256);
/**
* @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct
* @param id The id of the reserve as stored in the DataTypes.ReserveData struct
* @return The address of the reserve associated with id
*/
function getReserveAddressById(uint16 id) external view returns (address);
/**
* @notice Returns the PoolAddressesProvider connected to this contract
* @return The address of the PoolAddressesProvider
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
/**
* @notice Returns the ReserveInterestRateStrategy connected to all the reserves
* @return The address of the ReserveInterestRateStrategy contract
*/
function RESERVE_INTEREST_RATE_STRATEGY() external view returns (address);
/**
* @notice Updates flash loan premium. All this premium is collected by the protocol treasury.
* @dev The premium is calculated on the total borrowed amount
* @dev Only callable by the PoolConfigurator contract
* @param flashLoanPremium The flash loan premium, expressed in bps
*/
function updateFlashloanPremium(uint128 flashLoanPremium) external;
/**
* @notice Configures a new or alters an existing collateral configuration of an eMode.
* @dev In eMode, the protocol allows very high borrowing power to borrow assets of the same category.
* The category 0 is reserved as it's the default for volatile assets
* @param id The id of the category
* @param config The configuration of the category
*/
function configureEModeCategory(
uint8 id,
DataTypes.EModeCategoryBaseConfiguration memory config
) external;
/**
* @notice Replaces the current eMode collateralBitmap.
* @param id The id of the category
* @param collateralBitmap The collateralBitmap of the category
*/
function configureEModeCategoryCollateralBitmap(uint8 id, uint128 collateralBitmap) external;
/**
* @notice Replaces the current eMode borrowableBitmap.
* @param id The id of the category
* @param borrowableBitmap The borrowableBitmap of the category
*/
function configureEModeCategoryBorrowableBitmap(uint8 id, uint128 borrowableBitmap) external;
/**
* @notice Replaces the current eMode ltvzeroBitmap.
* @param id The id of the category
* @param ltvzeroBitmap The ltvzeroBitmap of the category
*/
function configureEModeCategoryLtvzeroBitmap(uint8 id, uint128 ltvzeroBitmap) external;
/**
* @notice Sets the isolated flag of an eMode category.
* @param id The id of the category
* @param isolated True if the eMode should be isolated
*/
function configureEModeCategoryIsolated(uint8 id, bool isolated) external;
/**
* @notice Returns the data of an eMode category
* @dev DEPRECATED use independent getters instead
* @param id The id of the category
* @return The configuration data of the category
*/
function getEModeCategoryData(
uint8 id
) external view returns (DataTypes.EModeCategoryLegacy memory);
/**
* @notice Returns the label of an eMode category
* @dev This function is deprecated and will be removed in a future version.
* @custom:deprecated
* @param id The id of the category
* @return The label of the category
*/
function getEModeCategoryLabel(uint8 id) external view returns (string memory);
/**
* @notice Returns the collateral config of an eMode category
* @param id The id of the category
* @return The ltv,lt,lb of the category
*/
function getEModeCategoryCollateralConfig(
uint8 id
) external view returns (DataTypes.CollateralConfig memory);
/**
* @notice Returns the collateralBitmap of an eMode category
* @param id The id of the category
* @return The collateralBitmap of the category
*/
function getEModeCategoryCollateralBitmap(uint8 id) external view returns (uint128);
/**
* @notice Returns the borrowableBitmap of an eMode category
* @param id The id of the category
* @return The borrowableBitmap of the category
*/
function getEModeCategoryBorrowableBitmap(uint8 id) external view returns (uint128);
/**
* @notice Returns the ltvzero of an eMode category
* @param id The id of the category
* @return The ltvzeroBitmap of the category
*/
function getEModeCategoryLtvzeroBitmap(uint8 id) external view returns (uint128);
/**
* @notice Returns the isolated flag of an eMode category
* @param id The id of the category
* @return True if the eMode category is isolated
*/
function getIsEModeCategoryIsolated(uint8 id) external view returns (bool);
/**
* @notice Allows a user to use the protocol in eMode
* @param categoryId The id of the category
*/
function setUserEMode(uint8 categoryId) external;
/**
* @notice Returns the eMode the user is using
* @param user The address of the user
* @return The eMode id
*/
function getUserEMode(address user) external view returns (uint256);
/**
* @notice Sets the liquidation grace period of the given asset
* @dev To enable a liquidation grace period, a timestamp in the future should be set,
* To disable a liquidation grace period, any timestamp in the past works, like 0
* @param asset The address of the underlying asset to set the liquidationGracePeriod
* @param until Timestamp when the liquidation grace period will end
**/
function setLiquidationGracePeriod(address asset, uint40 until) external;
/**
* @notice Returns the liquidation grace period of the given asset
* @param asset The address of the underlying asset
* @return Timestamp when the liquidation grace period will end
**/
function getLiquidationGracePeriod(address asset) external view returns (uint40);
/**
* @notice Returns the total fee on flash loans.
* @dev From v3.4 all flashloan fees will be send to the treasury.
* @return The total fee on flashloans
*/
function FLASHLOAN_PREMIUM_TOTAL() external view returns (uint128);
/**
* @notice Returns the part of the flashloan fees sent to protocol
* @dev From v3.4 all flashloan fees will be send to the treasury and this value
* is always 100_00.
* @return The flashloan fee sent to the protocol treasury
*/
function FLASHLOAN_PREMIUM_TO_PROTOCOL() external view returns (uint128);
/**
* @notice Returns the maximum number of reserves supported to be listed in this Pool
* @return The maximum number of reserves supported
*/
function MAX_NUMBER_RESERVES() external view returns (uint16);
/**
* @notice Mints the assets accrued through the reserve factor to the treasury in the form of aTokens
* @param assets The list of reserves for which the minting needs to be executed
*/
function mintToTreasury(address[] calldata assets) external;
/**
* @notice Rescue and transfer tokens locked in this contract
* @param token The address of the token
* @param to The address of the recipient
* @param amount The amount of token to transfer
*/
function rescueTokens(address token, address to, uint256 amount) external;
/**
* @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @dev Deprecated: Use the `supply` function instead
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*/
function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
/**
* @notice It covers the deficit of a specified reserve by burning the equivalent aToken `amount` for assets
* @dev The deficit of a reserve can occur due to situations where borrowed assets are not repaid, leading to bad debt.
* @param asset The address of the underlying asset to cover the deficit.
* @param amount The amount to be covered, in aToken
* @return The amount of tokens burned
*/
function eliminateReserveDeficit(address asset, uint256 amount) external returns (uint256);
/**
* @notice Approves or disapproves a position manager. This position manager will be able
* to call the `setUserUseReserveAsCollateralOnBehalfOf` and the
* `setUserEModeOnBehalfOf` function on behalf of the user.
* @param positionManager The address of the position manager
* @param approve True if the position manager should be approved, false otherwise
*/
function approvePositionManager(address positionManager, bool approve) external;
/**
* @notice Renounces a position manager role for a given user.
* @param user The address of the user
*/
function renouncePositionManagerRole(address user) external;
/**
* @notice Sets the use as collateral flag for the user on the specific reserve on behalf of the user.
* @param asset The address of the underlying asset of the reserve
* @param useAsCollateral True if the user wants to use the reserve as collateral, false otherwise
* @param onBehalfOf The address of the user
*/
function setUserUseReserveAsCollateralOnBehalfOf(
address asset,
bool useAsCollateral,
address onBehalfOf
) external;
/**
* @notice Sets the eMode category for the user on the specific reserve on behalf of the user.
* @param categoryId The id of the category
* @param onBehalfOf The address of the user
*/
function setUserEModeOnBehalfOf(uint8 categoryId, address onBehalfOf) external;
/**
* @notice Returns true if the `positionManager` address is approved to use the position manager role on behalf of the user.
* @param user The address of the user
* @param positionManager The address of the position manager
* @return True if the user is approved to use the position manager, false otherwise
*/
function isApprovedPositionManager(
address user,
address positionManager
) external view returns (bool);
/**
* @notice Returns the current deficit of a reserve.
* @param asset The address of the underlying asset of the reserve
* @return The current deficit of the reserve
*/
function getReserveDeficit(address asset) external view returns (uint256);
/**
* @notice Returns the aToken address of a reserve.
* @param asset The address of the underlying asset of the reserve
* @return The address of the aToken
*/
function getReserveAToken(address asset) external view returns (address);
/**
* @notice Returns the variableDebtToken address of a reserve.
* @param asset The address of the underlying asset of the reserve
* @return The address of the variableDebtToken
*/
function getReserveVariableDebtToken(address asset) external view returns (address);
/**
* @notice Gets the address of the external FlashLoanLogic
*/
function getFlashLoanLogic() external view returns (address);
/**
* @notice Gets the address of the external BorrowLogic
*/
function getBorrowLogic() external view returns (address);
/**
* @notice Gets the address of the external LiquidationLogic
*/
function getLiquidationLogic() external view returns (address);
/**
* @notice Gets the address of the external PoolLogic
*/
function getPoolLogic() external view returns (address);
/**
* @notice Gets the address of the external SupplyLogic
*/
function getSupplyLogic() external view returns (address);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPoolAddressesProvider.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title IPoolAddressesProvider
* @author Aave
* @notice Defines the basic interface for a Pool Addresses Provider.
*/
interface IPoolAddressesProvider {
/**
* @dev Emitted when the market identifier is updated.
* @param oldMarketId The old id of the market
* @param newMarketId The new id of the market
*/
event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);
/**
* @dev Emitted when the pool is updated.
* @param oldAddress The old address of the Pool
* @param newAddress The new address of the Pool
*/
event PoolUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool configurator is updated.
* @param oldAddress The old address of the PoolConfigurator
* @param newAddress The new address of the PoolConfigurator
*/
event PoolConfiguratorUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the price oracle is updated.
* @param oldAddress The old address of the PriceOracle
* @param newAddress The new address of the PriceOracle
*/
event PriceOracleUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the ACL manager is updated.
* @param oldAddress The old address of the ACLManager
* @param newAddress The new address of the ACLManager
*/
event ACLManagerUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the ACL admin is updated.
* @param oldAddress The old address of the ACLAdmin
* @param newAddress The new address of the ACLAdmin
*/
event ACLAdminUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the price oracle sentinel is updated.
* @param oldAddress The old address of the PriceOracleSentinel
* @param newAddress The new address of the PriceOracleSentinel
*/
event PriceOracleSentinelUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool data provider is updated.
* @param oldAddress The old address of the PoolDataProvider
* @param newAddress The new address of the PoolDataProvider
*/
event PoolDataProviderUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when a new proxy is created.
* @param id The identifier of the proxy
* @param proxyAddress The address of the created proxy contract
* @param implementationAddress The address of the implementation contract
*/
event ProxyCreated(
bytes32 indexed id,
address indexed proxyAddress,
address indexed implementationAddress
);
/**
* @dev Emitted when a new non-proxied contract address is registered.
* @param id The identifier of the contract
* @param oldAddress The address of the old contract
* @param newAddress The address of the new contract
*/
event AddressSet(bytes32 indexed id, address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the implementation of the proxy registered with id is updated
* @param id The identifier of the contract
* @param proxyAddress The address of the proxy contract
* @param oldImplementationAddress The address of the old implementation contract
* @param newImplementationAddress The address of the new implementation contract
*/
event AddressSetAsProxy(
bytes32 indexed id,
address indexed proxyAddress,
address oldImplementationAddress,
address indexed newImplementationAddress
);
/**
* @notice Returns the id of the Aave market to which this contract points to.
* @return The market id
*/
function getMarketId() external view returns (string memory);
/**
* @notice Associates an id with a specific PoolAddressesProvider.
* @dev This can be used to create an onchain registry of PoolAddressesProviders to
* identify and validate multiple Aave markets.
* @param newMarketId The market id
*/
function setMarketId(string calldata newMarketId) external;
/**
* @notice Returns an address by its identifier.
* @dev The returned address might be an EOA or a contract, potentially proxied
* @dev It returns ZERO if there is no registered address with the given id
* @param id The id
* @return The address of the registered for the specified id
*/
function getAddress(bytes32 id) external view returns (address);
/**
* @notice General function to update the implementation of a proxy registered with
* certain `id`. If there is no proxy registered, it will instantiate one and
* set as implementation the `newImplementationAddress`.
* @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
* setter function, in order to avoid unexpected consequences
* @param id The id
* @param newImplementationAddress The address of the new implementation
*/
function setAddressAsProxy(bytes32 id, address newImplementationAddress) external;
/**
* @notice Sets an address for an id replacing the address saved in the addresses map.
* @dev IMPORTANT Use this function carefully, as it will do a hard replacement
* @param id The id
* @param newAddress The address to set
*/
function setAddress(bytes32 id, address newAddress) external;
/**
* @notice Returns the address of the Pool proxy.
* @return The Pool proxy address
*/
function getPool() external view returns (address);
/**
* @notice Updates the implementation of the Pool, or creates a proxy
* setting the new `pool` implementation when the function is called for the first time.
* @param newPoolImpl The new Pool implementation
*/
function setPoolImpl(address newPoolImpl) external;
/**
* @notice Returns the address of the PoolConfigurator proxy.
* @return The PoolConfigurator proxy address
*/
function getPoolConfigurator() external view returns (address);
/**
* @notice Updates the implementation of the PoolConfigurator, or creates a proxy
* setting the new `PoolConfigurator` implementation when the function is called for the first time.
* @param newPoolConfiguratorImpl The new PoolConfigurator implementation
*/
function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;
/**
* @notice Returns the address of the price oracle.
* @return The address of the PriceOracle
*/
function getPriceOracle() external view returns (address);
/**
* @notice Updates the address of the price oracle.
* @param newPriceOracle The address of the new PriceOracle
*/
function setPriceOracle(address newPriceOracle) external;
/**
* @notice Returns the address of the ACL manager.
* @return The address of the ACLManager
*/
function getACLManager() external view returns (address);
/**
* @notice Updates the address of the ACL manager.
* @param newAclManager The address of the new ACLManager
*/
function setACLManager(address newAclManager) external;
/**
* @notice Returns the address of the ACL admin.
* @return The address of the ACL admin
*/
function getACLAdmin() external view returns (address);
/**
* @notice Updates the address of the ACL admin.
* @param newAclAdmin The address of the new ACL admin
*/
function setACLAdmin(address newAclAdmin) external;
/**
* @notice Returns the address of the price oracle sentinel.
* @return The address of the PriceOracleSentinel
*/
function getPriceOracleSentinel() external view returns (address);
/**
* @notice Updates the address of the price oracle sentinel.
* @param newPriceOracleSentinel The address of the new PriceOracleSentinel
*/
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
/**
* @notice Returns the address of the data provider.
* @return The address of the DataProvider
*/
function getPoolDataProvider() external view returns (address);
/**
* @notice Updates the address of the data provider.
* @param newDataProvider The address of the new DataProvider
*/
function setPoolDataProvider(address newDataProvider) external;
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPoolConfigurator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ConfiguratorInputTypes} from '../protocol/libraries/types/ConfiguratorInputTypes.sol';
/**
* @title IPoolConfigurator
* @author Aave
* @notice Defines the basic interface for a Pool configurator.
*/
interface IPoolConfigurator {
/**
* @dev Emitted when a reserve is initialized.
* @param asset The address of the underlying asset of the reserve
* @param aToken The address of the associated aToken contract
* @param stableDebtToken, DEPRECATED in v3.2.0
* @param variableDebtToken The address of the associated variable rate debt token
* @param interestRateStrategyAddress The address of the interest rate strategy for the reserve
*/
event ReserveInitialized(
address indexed asset,
address indexed aToken,
address stableDebtToken,
address variableDebtToken,
address interestRateStrategyAddress
);
/**
* @dev Emitted when borrowing is enabled or disabled on a reserve.
* @param asset The address of the underlying asset of the reserve
* @param enabled True if borrowing is enabled, false otherwise
*/
event ReserveBorrowing(address indexed asset, bool enabled);
/**
* @dev Emitted when flashloans are enabled or disabled on a reserve.
* @param asset The address of the underlying asset of the reserve
* @param enabled True if flashloans are enabled, false otherwise
*/
event ReserveFlashLoaning(address indexed asset, bool enabled);
/**
* @dev Emitted when the ltv is set for the frozen asset.
* @param asset The address of the underlying asset of the reserve
* @param ltv The loan to value of the asset when used as collateral
*/
event PendingLtvChanged(address indexed asset, uint256 ltv);
/**
* @dev Emitted when the collateralization risk parameters for the specified asset are updated.
* @param asset The address of the underlying asset of the reserve
* @param ltv The loan to value of the asset when used as collateral
* @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
* @param liquidationBonus The bonus liquidators receive to liquidate this asset
*/
event CollateralConfigurationChanged(
address indexed asset,
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus
);
/**
* @dev Emitted when a reserve is activated or deactivated
* @param asset The address of the underlying asset of the reserve
* @param active True if reserve is active, false otherwise
*/
event ReserveActive(address indexed asset, bool active);
/**
* @dev Emitted when a reserve is frozen or unfrozen
* @param asset The address of the underlying asset of the reserve
* @param frozen True if reserve is frozen, false otherwise
*/
event ReserveFrozen(address indexed asset, bool frozen);
/**
* @dev Emitted when a reserve is paused or unpaused
* @param asset The address of the underlying asset of the reserve
* @param paused True if reserve is paused, false otherwise
*/
event ReservePaused(address indexed asset, bool paused);
/**
* @dev Emitted when a reserve factor is updated.
* @param asset The address of the underlying asset of the reserve
* @param oldReserveFactor The old reserve factor, expressed in bps
* @param newReserveFactor The new reserve factor, expressed in bps
*/
event ReserveFactorChanged(
address indexed asset,
uint256 oldReserveFactor,
uint256 newReserveFactor
);
/**
* @dev Emitted when the borrow cap of a reserve is updated.
* @param asset The address of the underlying asset of the reserve
* @param oldBorrowCap The old borrow cap
* @param newBorrowCap The new borrow cap
*/
event BorrowCapChanged(address indexed asset, uint256 oldBorrowCap, uint256 newBorrowCap);
/**
* @dev Emitted when the supply cap of a reserve is updated.
* @param asset The address of the underlying asset of the reserve
* @param oldSupplyCap The old supply cap
* @param newSupplyCap The new supply cap
*/
event SupplyCapChanged(address indexed asset, uint256 oldSupplyCap, uint256 newSupplyCap);
/**
* @dev Emitted when the liquidation protocol fee of a reserve is updated.
* @param asset The address of the underlying asset of the reserve
* @param oldFee The old liquidation protocol fee, expressed in bps
* @param newFee The new liquidation protocol fee, expressed in bps
*/
event LiquidationProtocolFeeChanged(address indexed asset, uint256 oldFee, uint256 newFee);
/**
* @dev Emitted when the liquidation grace period is updated.
* @param asset The address of the underlying asset of the reserve
* @param gracePeriodUntil Timestamp until when liquidations will not be allowed post-unpause
*/
event LiquidationGracePeriodChanged(address indexed asset, uint40 gracePeriodUntil);
/**
* @dev Emitted when the liquidation grace period is disabled.
* @param asset The address of the underlying asset of the reserve
*/
event LiquidationGracePeriodDisabled(address indexed asset);
/**
* @dev Emitted when an collateral configuration of an asset in an eMode is changed.
* @param asset The address of the underlying asset of the reserve
* @param categoryId The eMode category
* @param collateral True if the asset is enabled as collateral in the eMode, false otherwise.
*/
event AssetCollateralInEModeChanged(address indexed asset, uint8 categoryId, bool collateral);
/**
* @dev Emitted when the borrowable configuration of an asset in an eMode changed.
* @param asset The address of the underlying asset of the reserve
* @param categoryId The eMode category
* @param borrowable True if the asset is enabled as borrowable in the eMode, false otherwise.
*/
event AssetBorrowableInEModeChanged(address indexed asset, uint8 categoryId, bool borrowable);
/**
* @dev Emitted when the ltvzero configuration of an asset in an eMode changed.
* @param asset The address of the underlying asset of the reserve
* @param categoryId The eMode category
* @param ltvzero True if the asset is enabled as ltvzero in the eMode, false otherwise.
*/
event AssetLtvzeroInEModeChanged(address indexed asset, uint8 categoryId, bool ltvzero);
/**
* @dev Emitted when a new eMode category is added or an existing category is altered.
* @param categoryId The new eMode category id
* @param ltv The ltv for the asset category in eMode
* @param liquidationThreshold The liquidationThreshold for the asset category in eMode
* @param liquidationBonus The liquidationBonus for the asset category in eMode
* @param oracle DEPRECATED in v3.2.0
* @param label A human readable identifier for the category
*/
event EModeCategoryAdded(
uint8 indexed categoryId,
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
address oracle,
string label
);
/**
* @dev Emitted when the isolated flag of an eMode category is changed.
* @param categoryId The eMode category id
* @param isolated True if the eMode is isolated (only eMode collateral contributes LTV)
*/
event EModeCategoryIsolationChanged(uint8 indexed categoryId, bool isolated);
/**
* @dev Emitted when a reserve interest strategy contract is updated.
* @param asset The address of the underlying asset of the reserve
* @param oldStrategy The address of the old interest strategy contract
* @param newStrategy The address of the new interest strategy contract
*/
event ReserveInterestRateStrategyChanged(
address indexed asset,
address oldStrategy,
address newStrategy
);
/**
* @dev Emitted when the data of a reserve interest strategy contract is updated.
* @param asset The address of the underlying asset of the reserve
* @param data abi encoded data
*/
event ReserveInterestRateDataChanged(address indexed asset, address indexed strategy, bytes data);
/**
* @dev Emitted when an aToken implementation is upgraded.
* @param asset The address of the underlying asset of the reserve
* @param proxy The aToken proxy address
* @param implementation The new aToken implementation
*/
event ATokenUpgraded(
address indexed asset,
address indexed proxy,
address indexed implementation
);
/**
* @dev Emitted when the implementation of a variable debt token is upgraded.
* @param asset The address of the underlying asset of the reserve
* @param proxy The variable debt token proxy address
* @param implementation The new aToken implementation
*/
event VariableDebtTokenUpgraded(
address indexed asset,
address indexed proxy,
address indexed implementation
);
/**
* @dev Emitted when the total premium on flashloans is updated.
* @param oldFlashloanPremiumTotal The old premium, expressed in bps
* @param newFlashloanPremiumTotal The new premium, expressed in bps
*/
event FlashloanPremiumTotalUpdated(
uint128 oldFlashloanPremiumTotal,
uint128 newFlashloanPremiumTotal
);
/**
* @dev Emitted when the part of the premium that goes to protocol is updated.
Deprecated, from the v3.4 version the `flashloanPremiumToProtocol` value
is always 100%.
* @param oldFlashloanPremiumToProtocol The old premium, expressed in bps
* @param newFlashloanPremiumToProtocol The new premium, expressed in bps
*/
event FlashloanPremiumToProtocolUpdated(
uint128 oldFlashloanPremiumToProtocol,
uint128 newFlashloanPremiumToProtocol
);
/**
* @notice Initializes multiple reserves.
* @param input The array of initialization parameters
*/
function initReserves(ConfiguratorInputTypes.InitReserveInput[] calldata input) external;
/**
* @dev Updates the aToken implementation for the reserve.
* @param input The aToken update parameters
*/
function updateAToken(ConfiguratorInputTypes.UpdateATokenInput calldata input) external;
/**
* @notice Updates the variable debt token implementation for the asset.
* @param input The variableDebtToken update parameters
*/
function updateVariableDebtToken(
ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
) external;
/**
* @notice Configures borrowing on a reserve.
* @param asset The address of the underlying asset of the reserve
* @param enabled True if borrowing needs to be enabled, false otherwise
*/
function setReserveBorrowing(address asset, bool enabled) external;
/**
* @notice Configures the reserve collateralization parameters.
* @dev All the values are expressed in bps. A value of 10000, results in 100.00%
* @dev The `liquidationBonus` is always above 100%. A value of 105% means the liquidator will receive a 5% bonus
* @param asset The address of the underlying asset of the reserve
* @param ltv The loan to value of the asset when used as collateral
* @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
* @param liquidationBonus The bonus liquidators receive to liquidate this asset
*/
function configureReserveAsCollateral(
address asset,
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus
) external;
/**
* @notice Enable or disable flashloans on a reserve
* @param asset The address of the underlying asset of the reserve
* @param enabled True if flashloans need to be enabled, false otherwise
*/
function setReserveFlashLoaning(address asset, bool enabled) external;
/**
* @notice Activate or deactivate a reserve
* @param asset The address of the underlying asset of the reserve
* @param active True if the reserve needs to be active, false otherwise
*/
function setReserveActive(address asset, bool active) external;
/**
* @notice Freeze or unfreeze a reserve. A frozen reserve doesn't allow any new supply, borrow
* or rate swap but allows repayments, liquidations, rate rebalances and withdrawals.
* Also sets ltvzero on affected eModes and reserve ltv to 0.
* Stores the current reserve ltv in pendingLtv[asset].
* @param asset The address of the underlying asset of the reserve
* @param freeze True if the reserve needs to be frozen, false otherwise
*/
function setReserveFreeze(address asset, bool freeze) external;
/**
* @notice Restores the pending ltv for a reserve in non-emode (emode 0), if it is non-zero.
* @param asset The address of the underlying asset of the reserve
* @param ltvzero True if the reserve should be flagged as ltvzero, false otherwise
*/
function setReserveLtvzero(address asset, bool ltvzero) external;
/**
* @notice Pauses a reserve. A paused reserve does not allow any interaction (supply, borrow, repay,
* swap interest rate, liquidate, atoken transfers).
* @param asset The address of the underlying asset of the reserve
* @param paused True if pausing the reserve, false if unpausing
* @param gracePeriod Count of seconds after unpause during which liquidations will not be available
* - Only applicable whenever unpausing (`paused` as false)
* - Passing 0 means no grace period
* - Capped to maximum MAX_GRACE_PERIOD
*/
function setReservePause(address asset, bool paused, uint40 gracePeriod) external;
/**
* @notice Pauses a reserve. A paused reserve does not allow any interaction (supply, borrow, repay,
* swap interest rate, liquidate, atoken transfers).
* @dev Version with no grace period
* @param asset The address of the underlying asset of the reserve
* @param paused True if pausing the reserve, false if unpausing
*/
function setReservePause(address asset, bool paused) external;
/**
* @notice Disables liquidation grace period for the asset. The liquidation grace period is set in the past
* so that liquidations are allowed for the asset.
* @param asset The address of the underlying asset of the reserve
*/
function disableLiquidationGracePeriod(address asset) external;
/**
* @notice Updates the reserve factor of a reserve.
* @param asset The address of the underlying asset of the reserve
* @param newReserveFactor The new reserve factor of the reserve
*/
function setReserveFactor(address asset, uint256 newReserveFactor) external;
/**
* @notice Sets interest rate data for a reserve
* @param asset The address of the underlying asset of the reserve
* @param rateData bytes-encoded rate data. In this format in order to allow the rate strategy contract
* to de-structure custom data
*/
function setReserveInterestRateData(address asset, bytes calldata rateData) external;
/**
* @notice Pauses or unpauses all the protocol reserves. In the paused state all the protocol interactions
* are suspended.
* @param paused True if protocol needs to be paused, false otherwise
* @param gracePeriod Count of seconds after unpause during which liquidations will not be available
* - Only applicable whenever unpausing (`paused` as false)
* - Passing 0 means no grace period
* - Capped to maximum MAX_GRACE_PERIOD
*/
function setPoolPause(bool paused, uint40 gracePeriod) external;
/**
* @notice Pauses or unpauses all the protocol reserves. In the paused state all the protocol interactions
* are suspended.
* @dev Version with no grace period
* @param paused True if protocol needs to be paused, false otherwise
*/
function setPoolPause(bool paused) external;
/**
* @notice Updates the borrow cap of a reserve.
* @param asset The address of the underlying asset of the reserve
* @param newBorrowCap The new borrow cap of the reserve
*/
function setBorrowCap(address asset, uint256 newBorrowCap) external;
/**
* @notice Updates the supply cap of a reserve.
* @param asset The address of the underlying asset of the reserve
* @param newSupplyCap The new supply cap of the reserve
*/
function setSupplyCap(address asset, uint256 newSupplyCap) external;
/**
* @notice Updates the liquidation protocol fee of reserve.
* @param asset The address of the underlying asset of the reserve
* @param newFee The new liquidation protocol fee of the reserve, expressed in bps
*/
function setLiquidationProtocolFee(address asset, uint256 newFee) external;
/**
* @notice Enables/disables an asset to be borrowable in a selected eMode.
* @param asset The address of the underlying asset of the reserve
* @param categoryId The eMode categoryId
* @param borrowable True if the asset should be borrowable in the given eMode category, false otherwise.
*/
function setAssetBorrowableInEMode(address asset, uint8 categoryId, bool borrowable) external;
/**
* @notice Enables/disables an asset to be collateral in a selected eMode.
* @param asset The address of the underlying asset of the reserve
* @param categoryId The eMode categoryId
* @param collateral True if the asset should be collateral in the given eMode category, false otherwise.
*/
function setAssetCollateralInEMode(address asset, uint8 categoryId, bool collateral) external;
/**
* @notice Enables/disables an asset to be ltvzero in a selected eMode.
* @param asset The address of the underlying asset of the reserve
* @param categoryId The eMode categoryId
* @param ltvzero True if the asset should be ltvzero in the given eMode category, false otherwise.
*/
function setAssetLtvzeroInEMode(address asset, uint8 categoryId, bool ltvzero) external;
/**
* @notice Sets the isolated flag of an eMode category.
* @param categoryId The eMode category id
* @param isolated When true, users with non-eMode collateral enabled cannot enter the eMode,
* and non-eMode assets get LTV=0 (liquidation threshold is unaffected, preserving health factor of existing positions)
*/
function setEModeCategoryIsolated(uint8 categoryId, bool isolated) external;
/**
* @notice Adds a new efficiency mode (eMode) category or alters a existing one.
* @param categoryId The id of the category to be configured
* @param ltv The ltv associated with the category
* @param liquidationThreshold The liquidation threshold associated with the category
* @param liquidationBonus The liquidation bonus associated with the category
* @param label A label identifying the category
* @param isolated When true, users with non-eMode collateral enabled cannot enter the eMode,
* and non-eMode assets get LTV=0 (liquidation threshold is unaffected, preserving health factor of existing positions)
*/
function setEModeCategory(
uint8 categoryId,
uint16 ltv,
uint16 liquidationThreshold,
uint16 liquidationBonus,
string calldata label,
bool isolated
) external;
/**
* @notice Updates the flash loan premium. All this premium
* will be collected by the treasury.
* @dev Expressed in bps
* @dev The premium is calculated on the total amount borrowed
* @param newFlashloanPremium The flashloan premium
*/
function updateFlashloanPremium(uint128 newFlashloanPremium) external;
/**
* @notice Gets pending ltv value
* @param asset The address of the underlying asset of the reserve
*/
function getPendingLtv(address asset) external view returns (uint256);
/**
* @notice Gets the maximum liquidations grace period allowed, in seconds
*/
function MAX_GRACE_PERIOD() external view returns (uint40);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPoolDataProvider.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
import {IPool} from './IPool.sol';
/**
* @title IPoolDataProvider
* @author Aave
* @notice Defines the basic interface of a PoolDataProvider
*/
interface IPoolDataProvider {
struct TokenData {
string symbol;
address tokenAddress;
}
/**
* @notice Returns the address for the PoolAddressesProvider contract.
* @return The address for the PoolAddressesProvider contract
*/
function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);
/**
* @notice Returns the address for the Pool contract.
* @return The address for the Pool contract
*/
function POOL() external view returns (IPool);
/**
* @notice Returns the list of the existing reserves in the pool.
* @dev Handling MKR and ETH in a different way since they do not have standard `symbol` functions.
* @return The list of reserves, pairs of symbols and addresses
*/
function getAllReservesTokens() external view returns (TokenData[] memory);
/**
* @notice Returns the list of the existing ATokens in the pool.
* @return The list of ATokens, pairs of symbols and addresses
*/
function getAllATokens() external view returns (TokenData[] memory);
/**
* @notice Returns the configuration data of the reserve
* @dev Not returning borrow and supply caps for compatibility, nor pause flag
* @param asset The address of the underlying asset of the reserve
* @return decimals The number of decimals of the reserve
* @return ltv The ltv of the reserve
* @return liquidationThreshold The liquidationThreshold of the reserve
* @return liquidationBonus The liquidationBonus of the reserve
* @return reserveFactor The reserveFactor of the reserve
* @return usageAsCollateralEnabled True if the usage as collateral is enabled, false otherwise
* @return borrowingEnabled True if borrowing is enabled, false otherwise
* @return stableBorrowRateEnabled True if stable rate borrowing is enabled, false otherwise
* @return isActive True if it is active, false otherwise
* @return isFrozen True if it is frozen, false otherwise
*/
function getReserveConfigurationData(
address asset
)
external
view
returns (
uint256 decimals,
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
uint256 reserveFactor,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
bool stableBorrowRateEnabled,
bool isActive,
bool isFrozen
);
/**
* @notice Returns the caps parameters of the reserve
* @param asset The address of the underlying asset of the reserve
* @return borrowCap The borrow cap of the reserve
* @return supplyCap The supply cap of the reserve
*/
function getReserveCaps(
address asset
) external view returns (uint256 borrowCap, uint256 supplyCap);
/**
* @notice Returns if the pool is paused
* @param asset The address of the underlying asset of the reserve
* @return isPaused True if the pool is paused, false otherwise
*/
function getPaused(address asset) external view returns (bool isPaused);
/**
* @notice Returns the siloed borrowing flag
* @param asset The address of the underlying asset of the reserve
* @return false, DEPRECATED in v3.7.0
*/
function getSiloedBorrowing(address asset) external view returns (bool);
/**
* @notice Returns the protocol fee on the liquidation bonus
* @param asset The address of the underlying asset of the reserve
* @return The protocol fee on liquidation
*/
function getLiquidationProtocolFee(address asset) external view returns (uint256);
/**
* @notice Returns the unbacked mint cap of the reserve
* @param asset The address of the underlying asset of the reserve
* @return 0, DEPRECATED in v3.4.0
*/
function getUnbackedMintCap(address asset) external view returns (uint256);
/**
* @notice Returns the debt ceiling of the reserve
* @param asset The address of the underlying asset of the reserve
* @return 0, DEPRECATED in v3.7.0
*/
function getDebtCeiling(address asset) external view returns (uint256);
/**
* @notice Returns the debt ceiling decimals
* @return 2, DEPRECATED in v3.7.0
*/
function getDebtCeilingDecimals() external pure returns (uint256);
/**
* @notice Returns the reserve data
* @param asset The address of the underlying asset of the reserve
* @return unbacked The amount of unbacked tokens
* @return accruedToTreasuryScaled The scaled amount of tokens accrued to treasury that is to be minted
* @return totalAToken The total supply of the aToken
* @return totalStableDebt The total stable debt of the reserve
* @return totalVariableDebt The total variable debt of the reserve
* @return liquidityRate The liquidity rate of the reserve
* @return variableBorrowRate The variable borrow rate of the reserve
* @return stableBorrowRate The stable borrow rate of the reserve
* @return averageStableBorrowRate The average stable borrow rate of the reserve
* @return liquidityIndex The liquidity index of the reserve
* @return variableBorrowIndex The variable borrow index of the reserve
* @return lastUpdateTimestamp The timestamp of the last update of the reserve
*/
function getReserveData(
address asset
)
external
view
returns (
uint256 unbacked,
uint256 accruedToTreasuryScaled,
uint256 totalAToken,
uint256 totalStableDebt,
uint256 totalVariableDebt,
uint256 liquidityRate,
uint256 variableBorrowRate,
uint256 stableBorrowRate,
uint256 averageStableBorrowRate,
uint256 liquidityIndex,
uint256 variableBorrowIndex,
uint40 lastUpdateTimestamp
);
/**
* @notice Returns the total supply of aTokens for a given asset
* @param asset The address of the underlying asset of the reserve
* @return The total supply of the aToken
*/
function getATokenTotalSupply(address asset) external view returns (uint256);
/**
* @notice Returns the total debt for a given asset
* @param asset The address of the underlying asset of the reserve
* @return The total debt for asset
*/
function getTotalDebt(address asset) external view returns (uint256);
/**
* @notice Returns the user data in a reserve
* @param asset The address of the underlying asset of the reserve
* @param user The address of the user
* @return currentATokenBalance The current AToken balance of the user
* @return currentStableDebt The current stable debt of the user
* @return currentVariableDebt The current variable debt of the user
* @return principalStableDebt The principal stable debt of the user
* @return scaledVariableDebt The scaled variable debt of the user
* @return stableBorrowRate The stable borrow rate of the user
* @return liquidityRate The liquidity rate of the reserve
* @return stableRateLastUpdated The timestamp of the last update of the user stable rate
* @return usageAsCollateralEnabled True if the user is using the asset as collateral, false
* otherwise
*/
function getUserReserveData(
address asset,
address user
)
external
view
returns (
uint256 currentATokenBalance,
uint256 currentStableDebt,
uint256 currentVariableDebt,
uint256 principalStableDebt,
uint256 scaledVariableDebt,
uint256 stableBorrowRate,
uint256 liquidityRate,
uint40 stableRateLastUpdated,
bool usageAsCollateralEnabled
);
/**
* @notice Returns the token addresses of the reserve
* @param asset The address of the underlying asset of the reserve
* @return aTokenAddress The AToken address of the reserve
* @return stableDebtTokenAddress DEPRECATED in v3.2.0
* @return variableDebtTokenAddress The VariableDebtToken address of the reserve
*/
function getReserveTokensAddresses(
address asset
)
external
view
returns (
address aTokenAddress,
address stableDebtTokenAddress,
address variableDebtTokenAddress
);
/**
* @notice Returns the address of the Interest Rate strategy
* @param asset The address of the underlying asset of the reserve
* @return irStrategyAddress The address of the Interest Rate strategy
*/
function getInterestRateStrategyAddress(
address asset
) external view returns (address irStrategyAddress);
/**
* @notice Returns whether the reserve has FlashLoans enabled or disabled
* @param asset The address of the underlying asset of the reserve
* @return True if FlashLoans are enabled, false otherwise
*/
function getFlashLoanEnabled(address asset) external view returns (bool);
/**
* @notice Returns whether virtual accounting is enabled/not for a reserve
* @param asset The address of the underlying asset of the reserve
* @return True, DEPRECATED in v3.4.0 as all reserves have virtual accounting set as active
*/
function getIsVirtualAccActive(address asset) external view returns (bool);
/**
* @notice Returns the virtual underlying balance of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The reserve virtual underlying balance
*/
function getVirtualUnderlyingBalance(address asset) external view returns (uint256);
/**
* @notice Returns the deficit of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The reserve deficit
*/
function getReserveDeficit(address asset) external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IPriceOracleGetter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title IPriceOracleGetter
* @author Aave
* @notice Interface for the Aave price oracle.
*/
interface IPriceOracleGetter {
/**
* @notice Returns the base currency address
* @dev Address 0x0 is reserved for USD as base currency.
* @return Returns the base currency address.
*/
function BASE_CURRENCY() external view returns (address);
/**
* @notice Returns the base currency unit
* @dev 1 ether for ETH, 1e8 for USD.
* @return Returns the base currency unit.
*/
function BASE_CURRENCY_UNIT() external view returns (uint256);
/**
* @notice Returns the asset price in the base currency
* @param asset The address of the asset
* @return The price of the asset
*/
function getAssetPrice(address asset) external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IReserveInterestRateStrategy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
/**
* @title IReserveInterestRateStrategy
* @author BGD Labs
* @notice Basic interface for any rate strategy used by the Aave protocol
*/
interface IReserveInterestRateStrategy {
/**
* @notice Sets interest rate data for an Aave rate strategy
* @param reserve The reserve to update
* @param rateData The abi encoded reserve interest rate data to apply to the given reserve
* Abstracted this way as rate strategies can be custom
*/
function setInterestRateParams(address reserve, bytes calldata rateData) external;
/**
* @notice Calculates the interest rates depending on the reserve's state and configurations
* @param params The parameters needed to calculate interest rates
* @return liquidityRate The liquidity rate expressed in ray
* @return variableBorrowRate The variable borrow rate expressed in ray
*/
function calculateInterestRates(
DataTypes.CalculateInterestRatesParams memory params
) external view returns (uint256, uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/interfaces/IScaledBalanceToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title IScaledBalanceToken
* @author Aave
* @notice Defines the basic interface for a scaled-balance token.
*/
interface IScaledBalanceToken {
/**
* @dev Emitted after the mint action
* @param caller The address performing the mint
* @param onBehalfOf The address of the user that will receive the minted tokens
* @param value The scaled-up amount being minted (based on user entered amount and balance increase from interest)
* @param balanceIncrease The increase in scaled-up balance since the last action of 'onBehalfOf'
* @param index The next liquidity index of the reserve
*/
event Mint(
address indexed caller,
address indexed onBehalfOf,
uint256 value,
uint256 balanceIncrease,
uint256 index
);
/**
* @dev Emitted after the burn action
* @dev If the burn function does not involve a transfer of the underlying asset, the target defaults to zero address
* @param from The address from which the tokens will be burned
* @param target The address that will receive the underlying, if any
* @param value The scaled-up amount being burned (user entered amount - balance increase from interest)
* @param balanceIncrease The increase in scaled-up balance since the last action of 'from'
* @param index The next liquidity index of the reserve
*/
event Burn(
address indexed from,
address indexed target,
uint256 value,
uint256 balanceIncrease,
uint256 index
);
/**
* @notice Returns the scaled balance of the user.
* @dev The scaled balance is the sum of all the updated stored balance divided by the reserve's liquidity index
* at the moment of the update
* @param user The user whose balance is calculated
* @return The scaled balance of the user
*/
function scaledBalanceOf(address user) external view returns (uint256);
/**
* @notice Returns the scaled balance of the user and the scaled total supply.
* @param user The address of the user
* @return The scaled balance of the user
* @return The scaled total supply
*/
function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);
/**
* @notice Returns the scaled total supply of the scaled balance token. Represents sum(debt/index)
* @return The scaled total supply
*/
function scaledTotalSupply() external view returns (uint256);
/**
* @notice Returns last index interest was accrued to the user's balance
* @param user The address of the user
* @return The last index interest was accrued to the user's balance, expressed in ray
*/
function getPreviousIndex(address user) external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/helpers/Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Errors library
* @author Aave
* @notice Defines the error messages emitted by the different contracts of the Aave protocol
*/
library Errors {
error CallerNotPoolAdmin(); // 'The caller of the function is not a pool admin'
error CallerNotPoolOrEmergencyAdmin(); // 'The caller of the function is not a pool or emergency admin'
error CallerNotRiskOrPoolAdmin(); // 'The caller of the function is not a risk or pool admin'
error CallerNotAssetListingOrPoolAdmin(); // 'The caller of the function is not an asset listing or pool admin'
error AddressesProviderNotRegistered(); // 'Pool addresses provider is not registered'
error InvalidAddressesProviderId(); // 'Invalid id for the pool addresses provider'
error NotContract(); // 'Address is not a contract'
error CallerNotPoolConfigurator(); // 'The caller of the function is not the pool configurator'
error CallerNotAToken(); // 'The caller of the function is not an AToken'
error InvalidAddressesProvider(); // 'The address of the pool addresses provider is invalid'
error InvalidFlashloanExecutorReturn(); // 'Invalid return value of the flashloan executor function'
error ReserveAlreadyAdded(); // 'Reserve has already been added to reserve list'
error NoMoreReservesAllowed(); // 'Maximum amount of reserves in the pool reached'
error EModeCategoryReserved(); // 'Zero eMode category is reserved for volatile heterogeneous assets'
error ReserveLiquidityNotZero(); // 'The liquidity of the reserve needs to be 0'
error FlashloanPremiumInvalid(); // 'Invalid flashloan premium'
error InvalidReserveParams(); // 'Invalid risk parameters for the reserve'
error InvalidEmodeCategoryParams(); // 'Invalid risk parameters for the eMode category'
error CallerMustBePool(); // 'The caller of this function must be a pool'
error InvalidMintAmount(); // 'Invalid amount to mint'
error InvalidBurnAmount(); // 'Invalid amount to burn'
error InvalidAmount(); // 'Amount must be greater than 0'
error ReserveInactive(); // 'Action requires an active reserve'
error ReserveFrozen(); // 'Action cannot be performed because the reserve is frozen'
error ReservePaused(); // 'Action cannot be performed because the reserve is paused'
error BorrowingNotEnabled(); // 'Borrowing is not enabled'
error NotEnoughAvailableUserBalance(); // 'User cannot withdraw more than the available balance'
error InvalidInterestRateModeSelected(); // 'Invalid interest rate mode selected'
error HealthFactorLowerThanLiquidationThreshold(); // 'Health factor is below the liquidation threshold'
error CollateralCannotCoverNewBorrow(); // 'There is not enough collateral to cover a new borrow'
error NoDebtOfSelectedType(); // 'For repayment of a specific type of debt, the user needs to have debt that type'
error NoExplicitAmountToRepayOnBehalf(); // 'To repay on behalf of a user an explicit amount to repay is needed'
error UnderlyingBalanceZero(); // 'The underlying balance needs to be greater than 0'
error HealthFactorNotBelowThreshold(); // 'Health factor is not below the threshold'
error CollateralCannotBeLiquidated(); // 'The collateral chosen cannot be liquidated'
error SpecifiedCurrencyNotBorrowedByUser(); // 'User did not borrow the specified currency'
error InconsistentFlashloanParams(); // 'Inconsistent flashloan parameters'
error BorrowCapExceeded(); // 'Borrow cap is exceeded'
error SupplyCapExceeded(); // 'Supply cap is exceeded'
error LtvValidationFailed(); // 'Ltv validation failed'
error InconsistentEModeCategory(); // 'Inconsistent eMode category'
error ReserveAlreadyInitialized(); // 'Reserve has already been initialized'
error UserHasAssetWithZeroLtv(); // 'User has asset with ltv being zero'
error InvalidLtv(); // 'Invalid ltv parameter for the reserve'
error InvalidLiquidationThreshold(); // 'Invalid liquidity threshold parameter for the reserve'
error InvalidLiquidationBonus(); // 'Invalid liquidity bonus parameter for the reserve'
error InvalidDecimals(); // 'Invalid decimals parameter of the underlying asset of the reserve'
error InvalidReserveFactor(); // 'Invalid reserve factor parameter for the reserve'
error InvalidBorrowCap(); // 'Invalid borrow cap for the reserve'
error InvalidSupplyCap(); // 'Invalid supply cap for the reserve'
error InvalidLiquidationProtocolFee(); // 'Invalid liquidation protocol fee for the reserve'
error InvalidReserveIndex(); // 'Invalid reserve index'
error AclAdminCannotBeZero(); // 'ACL admin cannot be set to the zero address'
error InconsistentParamsLength(); // 'Array parameters that should be equal length are not'
error ZeroAddressNotValid(); // 'Zero address not valid'
error InvalidExpiration(); // 'Invalid expiration'
error InvalidSignature(); // 'Invalid signature'
error OperationNotSupported(); // 'Operation not supported'
error AssetNotListed(); // 'Asset is not listed'
error InvalidOptimalUsageRatio(); // 'Invalid optimal usage ratio'
error UnderlyingCannotBeRescued(); // 'The underlying asset cannot be rescued'
error AddressesProviderAlreadyAdded(); // 'Reserve has already been added to reserve list'
error PoolAddressesDoNotMatch(); // 'The token implementation pool address and the pool address provided by the initializing pool do not match'
error ReserveDebtNotZero(); // the total debt of the reserve needs to be 0
error FlashloanDisabled(); // FlashLoaning for this asset is disabled
error InvalidMaxRate(); // The expect maximum borrow rate is invalid
error WithdrawToAToken(); // Withdrawing to the aToken is not allowed
error SupplyToAToken(); // Supplying to the aToken is not allowed
error Slope2MustBeGteSlope1(); // Variable interest rate slope 2 can not be lower than slope 1
error CallerNotRiskOrPoolOrEmergencyAdmin(); // 'The caller of the function is not a risk, pool or emergency admin'
error LiquidationGraceSentinelCheckFailed(); // 'Liquidation grace sentinel validation failed'
error InvalidGracePeriod(); // Grace period above a valid range
error InvalidFreezeState(); // Reserve is already in the passed freeze state
error InvalidLtvzeroState(); // Reserve is already in the passed ltvzero state
error NotBorrowableInEMode(); // Asset not borrowable in eMode
error CallerNotUmbrella(); // The caller of the function is not the umbrella contract
error ReserveNotInDeficit(); // The reserve is not in deficit
error MustNotLeaveDust(); // Below a certain threshold liquidators need to take the full position
error UserCannotHaveDebt(); // Thrown when a user tries to interact with a method that requires a position without debt
error SelfLiquidation(); // Thrown when a user tries to liquidate themselves
error CallerNotPositionManager(); // Thrown when the caller has not been enabled as a position manager of the on-behalf-of user
error InvalidCollateralInEmode(address reserve, uint256 categoryId); /// Thrown when trying to enter an eMode with an invalid collateral asset
error InvalidDebtInEmode(address reserve, uint256 categoryId); /// Thrown when trying to enter an eMode with an invalid debt asset
error MustBeEmodeCollateral(address reserve, uint256 categoryId); /// Thrown when trying to configure an asset as eMode-ltvzero that is not an eMode collateral
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/math/WadRayMath.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
/**
* @title WadRayMath library
* @author Aave
* @notice Provides functions to perform calculations with Wad and Ray units
* @dev Provides mul and div function for wads (decimal numbers with 18 digits of precision) and rays (decimal numbers
* with 27 digits of precision).
* @dev Default operations round half up (if a value is >= .5, it will be rounded up, otherwise rounded down).
* @dev For specific rounding behaviors, functions with `Floor` and `Ceil` suffixes or a `Rounding` parameter are available.
*/
library WadRayMath {
enum Rounding {
Floor,
Ceil
}
// HALF_WAD and HALF_RAY expressed with extended notation as constant with operations are not supported in Yul assembly
uint256 internal constant WAD = 1e18;
uint256 internal constant HALF_WAD = 0.5e18;
uint256 internal constant RAY = 1e27;
uint256 internal constant HALF_RAY = 0.5e27;
uint256 internal constant WAD_RAY_RATIO = 1e9;
/**
* @dev Multiplies two wad, rounding half up to the nearest wad
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Wad
* @param b Wad
* @return c = a*b, in wad
*/
function wadMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// to avoid overflow, a <= (type(uint256).max - HALF_WAD) / b
assembly {
if iszero(or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_WAD), b))))) {
revert(0, 0)
}
c := div(add(mul(a, b), HALF_WAD), WAD)
}
}
/**
* @dev Divides two wad, rounding half up to the nearest wad
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Wad
* @param b Wad
* @return c = a/b, in wad
*/
function wadDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
// to avoid overflow, a <= (type(uint256).max - halfB) / WAD
assembly {
if or(iszero(b), iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), WAD))))) {
revert(0, 0)
}
c := div(add(mul(a, WAD), div(b, 2)), b)
}
}
function rayMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
// to avoid overflow, a <= (type(uint256).max - HALF_RAY) / b
if iszero(or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_RAY), b))))) {
revert(0, 0)
}
c := div(add(mul(a, b), HALF_RAY), RAY)
}
}
function rayMulFloor(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
// Overflow check: Ensure a * b does not exceed uint256 max
if iszero(or(iszero(b), iszero(gt(a, div(not(0), b))))) {
revert(0, 0)
}
c := div(mul(a, b), RAY)
}
}
function rayMulCeil(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
// Overflow check: Ensure a * b does not exceed uint256 max
if iszero(or(iszero(b), iszero(gt(a, div(not(0), b))))) {
revert(0, 0)
}
let product := mul(a, b)
c := add(div(product, RAY), iszero(iszero(mod(product, RAY))))
}
}
/**
* @notice Divides two ray, rounding half up to the nearest ray
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Ray
* @param b Ray
* @return c = a raydiv b
*/
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
// to avoid overflow, a <= (type(uint256).max - b / 2) / RAY
if or(iszero(b), iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), RAY))))) {
revert(0, 0)
}
c := div(add(mul(a, RAY), div(b, 2)), b)
}
}
function rayDivCeil(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
// Overflow check: Ensure a * RAY does not exceed uint256 max
if or(iszero(b), iszero(iszero(gt(a, div(not(0), RAY))))) {
revert(0, 0)
}
let scaled := mul(a, RAY)
c := add(div(scaled, b), iszero(iszero(mod(scaled, b))))
}
}
function rayDivFloor(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
// Overflow check: Ensure a * RAY does not exceed uint256 max
if or(iszero(b), iszero(iszero(gt(a, div(not(0), RAY))))) {
revert(0, 0)
}
c := div(mul(a, RAY), b)
}
}
/**
* @dev Casts ray down to wad
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Ray
* @return b = a converted to wad, rounded half up to the nearest wad
*/
function rayToWad(uint256 a) internal pure returns (uint256 b) {
assembly {
b := div(a, WAD_RAY_RATIO)
let remainder := mod(a, WAD_RAY_RATIO)
if iszero(lt(remainder, div(WAD_RAY_RATIO, 2))) {
b := add(b, 1)
}
}
}
/**
* @dev Converts wad up to ray
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
* @param a Wad
* @return b = a converted in ray
*/
function wadToRay(uint256 a) internal pure returns (uint256 b) {
// to avoid overflow, b/WAD_RAY_RATIO == a
assembly {
b := mul(a, WAD_RAY_RATIO)
if iszero(eq(div(b, WAD_RAY_RATIO), a)) {
revert(0, 0)
}
}
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library ConfiguratorInputTypes {
struct InitReserveInput {
address aTokenImpl;
address variableDebtTokenImpl;
address underlyingAsset;
string aTokenName;
string aTokenSymbol;
string variableDebtTokenName;
string variableDebtTokenSymbol;
bytes params;
bytes interestRateData;
}
struct UpdateATokenInput {
address asset;
string name;
string symbol;
address implementation;
bytes params;
}
struct UpdateDebtTokenInput {
address asset;
string name;
string symbol;
address implementation;
bytes params;
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/libraries/types/DataTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library DataTypes {
/**
* This exists specifically to maintain the `getReserveData()` interface, since the new, internal
* `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`.
*/
struct ReserveDataLegacy {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
// DEPRECATED on v3.2.0
uint128 currentStableBorrowRate;
//timestamp of last update
uint40 lastUpdateTimestamp;
//the id of the reserve. Represents the position in the list of the active reserves
uint16 id;
//aToken address
address aTokenAddress;
// DEPRECATED on v3.2.0
address stableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
// DEPRECATED on v3.4.0, should use the `RESERVE_INTEREST_RATE_STRATEGY` variable from the Pool contract
address interestRateStrategyAddress;
//the current treasury balance, scaled
uint128 accruedToTreasury;
// DEPRECATED on v3.4.0
uint128 unbacked;
// DEPRECATED on v3.7.0
uint128 isolationModeTotalDebt;
}
struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
/// @notice reused `__deprecatedStableBorrowRate` storage from pre 3.2
// the current accumulate deficit in underlying tokens
uint128 deficit;
//timestamp of last update
uint40 lastUpdateTimestamp;
//the id of the reserve. Represents the position in the list of the active reserves
uint16 id;
//timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed
uint40 liquidationGracePeriodUntil;
//aToken address
address aTokenAddress;
// DEPRECATED on v3.2.0
address __deprecatedStableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
// DEPRECATED on v3.4.0, should use the `RESERVE_INTEREST_RATE_STRATEGY` variable from the Pool contract
address __deprecatedInterestRateStrategyAddress;
//the current treasury balance, scaled
uint128 accruedToTreasury;
// In aave 3.3.0 this storage slot contained the `unbacked`
uint128 virtualUnderlyingBalance;
//the outstanding debt borrowed against this asset in isolation mode
uint128 __deprecatedIsolationModeTotalDebt;
//the amount of underlying accounted for by the protocol
// DEPRECATED on v3.4.0. Moved into the same slot as accruedToTreasury for optimized storage access.
uint128 __deprecatedVirtualUnderlyingBalance;
}
struct ReserveConfigurationMap {
//bit 0-15: LTV
//bit 16-31: Liq. threshold
//bit 32-47: Liq. bonus
//bit 48-55: Decimals
//bit 56: reserve is active
//bit 57: reserve is frozen
//bit 58: borrowing is enabled
//bit 59: DEPRECATED: stable rate borrowing enabled
//bit 60: asset is paused
//bit 61: DEPRECATED: borrowing in isolation mode is enabled
//bit 62: DEPRECATED: siloed borrowing enabled
//bit 63: flashloaning enabled
//bit 64-79: reserve factor
//bit 80-115: borrow cap in whole tokens, borrowCap == 0 => no cap
//bit 116-151: supply cap in whole tokens, supplyCap == 0 => no cap
//bit 152-167: liquidation protocol fee
//bit 168-175: DEPRECATED: eMode category
//bit 176-211: DEPRECATED: unbacked mint cap
//bit 212-251: DEPRECATED: debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals
//bit 252: DEPRECATED: virtual accounting is enabled for the reserve
//bit 253-255 unused
uint256 data;
}
struct UserConfigurationMap {
/**
* @dev Bitmap of the users collaterals and borrows. It is divided in pairs of bits, one pair per asset.
* The first bit indicates if an asset is used as collateral by the user, the second whether an
* asset is borrowed by the user.
*/
uint256 data;
}
// DEPRECATED: kept for backwards compatibility, might be removed in a future version
struct EModeCategoryLegacy {
// each eMode category has a custom ltv and liquidation threshold
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
// DEPRECATED
address priceSource;
string label;
}
struct CollateralConfig {
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
}
struct EModeCategoryBaseConfiguration {
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
bool isolated;
string label;
}
struct EModeCategory {
// each eMode category has a custom ltv and liquidation threshold
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
uint128 collateralBitmap;
bool isolated; // if true, only assets in collateralBitmap can be used as collateral, and all others will have ltv0 rules applying
string label;
uint128 borrowableBitmap;
uint128 ltvzeroBitmap; // if true, the asset will be treated as ltv0 and ltv0 rules apply
}
enum InterestRateMode {
NONE,
__DEPRECATED,
VARIABLE
}
struct ReserveCache {
uint256 currScaledVariableDebt;
uint256 nextScaledVariableDebt;
uint256 currLiquidityIndex;
uint256 nextLiquidityIndex;
uint256 currVariableBorrowIndex;
uint256 nextVariableBorrowIndex;
uint256 currLiquidityRate;
uint256 currVariableBorrowRate;
uint256 reserveFactor;
ReserveConfigurationMap reserveConfiguration;
address aTokenAddress;
address variableDebtTokenAddress;
uint40 reserveLastUpdateTimestamp;
}
struct ExecuteLiquidationCallParams {
address liquidator;
uint256 debtToCover;
address collateralAsset;
address debtAsset;
address borrower;
bool receiveAToken;
address priceOracle;
uint8 borrowerEModeCategory;
address interestRateStrategyAddress;
}
struct ExecuteSupplyParams {
address user;
address asset;
address interestRateStrategyAddress;
uint256 amount;
address onBehalfOf;
uint16 referralCode;
uint8 supplierEModeCategory;
}
struct ExecuteBorrowParams {
address asset;
address user;
address onBehalfOf;
address interestRateStrategyAddress;
uint256 amount;
InterestRateMode interestRateMode;
uint16 referralCode;
bool releaseUnderlying;
address oracle;
uint8 userEModeCategory;
}
struct ExecuteRepayParams {
address asset;
address user;
address interestRateStrategyAddress;
uint256 amount;
InterestRateMode interestRateMode;
address onBehalfOf;
bool useATokens;
address oracle;
uint8 userEModeCategory;
}
struct ExecuteWithdrawParams {
address user;
address asset;
address interestRateStrategyAddress;
uint256 amount;
address to;
address oracle;
uint8 userEModeCategory;
}
struct ExecuteEliminateDeficitParams {
address user;
address asset;
address interestRateStrategyAddress;
uint256 amount;
}
struct FinalizeTransferParams {
address asset;
address from;
address to;
uint256 scaledAmount;
uint256 scaledBalanceFromBefore;
address oracle;
uint8 fromEModeCategory;
}
struct FlashloanParams {
address user;
address receiverAddress;
address[] assets;
uint256[] amounts;
uint256[] interestRateModes;
address interestRateStrategyAddress;
address onBehalfOf;
bytes params;
uint16 referralCode;
uint256 flashLoanPremium;
address addressesProvider;
address pool;
bool isAuthorizedFlashBorrower;
}
struct FlashloanSimpleParams {
address user;
address receiverAddress;
address asset;
address interestRateStrategyAddress;
uint256 amount;
bytes params;
uint16 referralCode;
uint256 flashLoanPremium;
}
struct FlashLoanRepaymentParams {
address user;
uint256 amount;
uint256 totalPremium;
address asset;
address interestRateStrategyAddress;
address receiverAddress;
uint16 referralCode;
}
struct CalculateUserAccountDataParams {
UserConfigurationMap userConfig;
address user;
address oracle;
uint8 userEModeCategory;
}
struct ValidateBorrowParams {
ReserveCache reserveCache;
address asset;
uint256 amountScaled;
InterestRateMode interestRateMode;
uint8 userEModeCategory;
}
struct ValidateLiquidationCallParams {
ReserveCache debtReserveCache;
uint256 totalDebt;
uint256 healthFactor;
address borrower;
address liquidator;
}
struct CalculateInterestRatesParams {
uint256 unbacked;
uint256 liquidityAdded;
uint256 liquidityTaken;
uint256 totalDebt;
uint256 reserveFactor;
address reserve;
// @notice DEPRECATED in 3.4, but kept for backwards compatibility
bool usingVirtualBalance;
uint256 virtualUnderlyingBalance;
}
struct InitReserveParams {
address asset;
address aTokenAddress;
address variableDebtAddress;
uint16 reservesCount;
uint16 maxNumberReserves;
}
}
lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/treasury/ICollector.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
interface ICollector {
struct Stream {
uint256 deposit;
uint256 ratePerSecond;
uint256 remainingBalance;
uint256 startTime;
uint256 stopTime;
address recipient;
address sender;
address tokenAddress;
bool isEntity;
}
/**
* @dev Withdraw amount exceeds available balance
*/
error BalanceExceeded();
/**
* @dev Deposit smaller than time delta
*/
error DepositSmallerTimeDelta();
/**
* @dev Deposit not multiple of time delta
*/
error DepositNotMultipleTimeDelta();
/**
* @dev Recipient cannot be the contract itself or msg.sender
*/
error InvalidRecipient();
/**
* @dev Start time cannot be before block.timestamp
*/
error InvalidStartTime();
/**
* @dev Stop time must be greater than startTime
*/
error InvalidStopTime();
/**
* @dev Provided address cannot be the zero-address
*/
error InvalidZeroAddress();
/**
* @dev Amount cannot be zero
*/
error InvalidZeroAmount();
/**
* @dev Only caller with FUNDS_ADMIN role can call
*/
error OnlyFundsAdmin();
/**
* @dev Only caller with FUNDS_ADMIN role or stream recipient can call
*/
error OnlyFundsAdminOrRecipient();
/**
* @dev The provided ID does not belong to an existing stream
*/
error StreamDoesNotExist();
/** @notice Emitted when the new stream is created
* @param streamId The identifier of the stream.
* @param sender The address of the collector.
* @param recipient The address towards which the money is streamed.
* @param deposit The amount of money to be streamed.
* @param tokenAddress The ERC20 token to use as streaming currency.
* @param startTime The unix timestamp for when the stream starts.
* @param stopTime The unix timestamp for when the stream stops.
**/
event CreateStream(
uint256 indexed streamId,
address indexed sender,
address indexed recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime
);
/**
* @notice Emmitted when withdraw happens from the contract to the recipient's account.
* @param streamId The id of the stream to withdraw tokens from.
* @param recipient The address towards which the money is streamed.
* @param amount The amount of tokens to withdraw.
*/
event WithdrawFromStream(uint256 indexed streamId, address indexed recipient, uint256 amount);
/**
* @notice Emmitted when the stream is canceled.
* @param streamId The id of the stream to withdraw tokens from.
* @param sender The address of the collector.
* @param recipient The address towards which the money is streamed.
* @param senderBalance The sender's balance at the moment of cancelling.
* @param recipientBalance The recipient's balance at the moment of cancelling.
*/
event CancelStream(
uint256 indexed streamId,
address indexed sender,
address indexed recipient,
uint256 senderBalance,
uint256 recipientBalance
);
/**
* @notice FUNDS_ADMIN role granted by ACL Manager
**/
function FUNDS_ADMIN_ROLE() external view returns (bytes32);
/** @notice Returns the mock ETH reference address
* @return address The address
**/
function ETH_MOCK_ADDRESS() external pure returns (address);
/**
* @notice Checks if address is funds admin
* @return bool If the address has the funds admin role
**/
function isFundsAdmin(address admin) external view returns (bool);
/**
* @notice Returns the available funds for the given stream id and address.
* @param streamId The id of the stream for which to query the balance.
* @param who The address for which to query the balance.
* @notice Returns the total funds allocated to `who` as uint256.
**/
function balanceOf(uint256 streamId, address who) external view returns (uint256 balance);
/**
* @dev Function for the funds admin to give ERC20 allowance to other parties
* @param token The address of the token to give allowance from
* @param recipient Allowance's recipient
* @param amount Allowance to approve
**/
function approve(IERC20 token, address recipient, uint256 amount) external;
/**
* @notice Function for the funds admin to transfer ERC20 tokens to other parties
* @param token The address of the token to transfer
* @param recipient Transfer's recipient
* @param amount Amount to transfer
**/
function transfer(IERC20 token, address recipient, uint256 amount) external;
/**
* @notice Creates a new stream funded by this contracts itself and paid towards `recipient`.
* @param recipient The address towards which the money is streamed.
* @param deposit The amount of money to be streamed.
* @param tokenAddress The ERC20 token to use as streaming currency.
* @param startTime The unix timestamp for when the stream starts.
* @param stopTime The unix timestamp for when the stream stops.
* @return streamId the uint256 id of the newly created stream.
*/
function createStream(
address recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime
) external returns (uint256 streamId);
/**
* @notice Returns the stream with all its properties.
* @dev Throws if the id does not point to a valid stream.
* @param streamId The id of the stream to query.
* @notice Returns the stream object.
*/
function getStream(
uint256 streamId
)
external
view
returns (
address sender,
address recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime,
uint256 remainingBalance,
uint256 ratePerSecond
);
/**
* @notice Withdraws from the contract to the recipient's account.
* @param streamId The id of the stream to withdraw tokens from.
* @param amount The amount of tokens to withdraw.
* @return bool Returns true if successful.
*/
function withdrawFromStream(uint256 streamId, uint256 amount) external returns (bool);
/**
* @notice Cancels the stream and transfers the tokens back on a pro rata basis.
* @param streamId The id of the stream to cancel.
* @return bool Returns true if successful.
*/
function cancelStream(uint256 streamId) external returns (bool);
/**
* @notice Returns the next available stream id
* @return nextStreamId Returns the stream id.
*/
function getNextStreamId() external view returns (uint256);
}
lib/aave-helpers/lib/aave-address-book/src/AaveV3.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import {DataTypes} from 'aave-v3-origin/contracts/protocol/libraries/types/DataTypes.sol';
import {Errors} from 'aave-v3-origin/contracts/protocol/libraries/helpers/Errors.sol';
import {ConfiguratorInputTypes} from 'aave-v3-origin/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol';
import {IPoolAddressesProvider} from 'aave-v3-origin/contracts/interfaces/IPoolAddressesProvider.sol';
import {IAToken} from 'aave-v3-origin/contracts/interfaces/IAToken.sol';
import {IPool} from 'aave-v3-origin/contracts/interfaces/IPool.sol';
import {IPoolConfigurator} from 'aave-v3-origin/contracts/interfaces/IPoolConfigurator.sol';
import {IPriceOracleGetter} from 'aave-v3-origin/contracts/interfaces/IPriceOracleGetter.sol';
import {IAaveOracle} from 'aave-v3-origin/contracts/interfaces/IAaveOracle.sol';
import {IACLManager as BasicIACLManager} from 'aave-v3-origin/contracts/interfaces/IACLManager.sol';
import {IPoolDataProvider} from 'aave-v3-origin/contracts/interfaces/IPoolDataProvider.sol';
import {IDefaultInterestRateStrategyV2} from 'aave-v3-origin/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
import {IReserveInterestRateStrategy} from 'aave-v3-origin/contracts/interfaces/IReserveInterestRateStrategy.sol';
import {IPoolDataProvider as IAaveProtocolDataProvider} from 'aave-v3-origin/contracts/interfaces/IPoolDataProvider.sol';
import {AggregatorInterface} from 'aave-v3-origin/contracts/dependencies/chainlink/AggregatorInterface.sol';
import {ICollector} from 'aave-v3-origin/contracts/treasury/ICollector.sol';
interface IACLManager is BasicIACLManager {
function hasRole(bytes32 role, address account) external view returns (bool);
function DEFAULT_ADMIN_ROLE() external pure returns (bytes32);
function renounceRole(bytes32 role, address account) external;
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
}
lib/aave-helpers/lib/aave-address-book/src/AaveV3EthereumLido.sol
// AUTOGENERATED - MANUAL CHANGES WILL BE REVERTED BY THE GENERATOR
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import {IPoolAddressesProvider, IPool, IPoolConfigurator, IAaveOracle, IPoolDataProvider, IACLManager, ICollector} from './AaveV3.sol';
library AaveV3EthereumLido {
// https://etherscan.io/address/0xcfBf336fe147D643B9Cb705648500e101504B16d
IPoolAddressesProvider internal constant POOL_ADDRESSES_PROVIDER =
IPoolAddressesProvider(0xcfBf336fe147D643B9Cb705648500e101504B16d);
// https://etherscan.io/address/0x4e033931ad43597d96D6bcc25c280717730B58B1
IPool internal constant POOL = IPool(0x4e033931ad43597d96D6bcc25c280717730B58B1);
// https://etherscan.io/address/0x342631c6CeFC9cfbf97b2fe4aa242a236e1fd517
IPoolConfigurator internal constant POOL_CONFIGURATOR =
IPoolConfigurator(0x342631c6CeFC9cfbf97b2fe4aa242a236e1fd517);
// https://etherscan.io/address/0xE3C061981870C0C7b1f3C4F4bB36B95f1F260BE6
IAaveOracle internal constant ORACLE = IAaveOracle(0xE3C061981870C0C7b1f3C4F4bB36B95f1F260BE6);
// https://etherscan.io/address/0x5300A1a15135EA4dc7aD5a167152C01EFc9b192A
address internal constant ACL_ADMIN = 0x5300A1a15135EA4dc7aD5a167152C01EFc9b192A;
// https://etherscan.io/address/0x013E2C7567b6231e865BB9273F8c7656103611c0
IACLManager internal constant ACL_MANAGER =
IACLManager(0x013E2C7567b6231e865BB9273F8c7656103611c0);
// https://etherscan.io/address/0xB85B2bFEbeC4F5f401dbf92ac147A3076391fCD5
IPoolDataProvider internal constant AAVE_PROTOCOL_DATA_PROVIDER =
IPoolDataProvider(0xB85B2bFEbeC4F5f401dbf92ac147A3076391fCD5);
// https://etherscan.io/address/0x13Fa6017A1d0479ad3117e7E80B785Cc1372D0F3
address internal constant POOL_IMPL = 0x13Fa6017A1d0479ad3117e7E80B785Cc1372D0F3;
// https://etherscan.io/address/0xFF42Ce30054dcE7dc7C1282a9a497aa58eaBCe99
address internal constant POOL_CONFIGURATOR_IMPL = 0xFF42Ce30054dcE7dc7C1282a9a497aa58eaBCe99;
// https://etherscan.io/address/0x8164Cc65827dcFe994AB23944CBC90e0aa80bFcb
address internal constant DEFAULT_INCENTIVES_CONTROLLER =
0x8164Cc65827dcFe994AB23944CBC90e0aa80bFcb;
// https://etherscan.io/address/0x223d844fc4B006D67c0cDbd39371A9F73f69d974
address internal constant EMISSION_MANAGER = 0x223d844fc4B006D67c0cDbd39371A9F73f69d974;
// https://etherscan.io/address/0x464C71f6c2F760DdA6093dCB91C24c39e5d6e18c
ICollector internal constant COLLECTOR = ICollector(0x464C71f6c2F760DdA6093dCB91C24c39e5d6e18c);
// https://etherscan.io/address/0x80D786DF608603cCDcC83F5712B97C185A6A948d
address internal constant DEFAULT_A_TOKEN_IMPL = 0x80D786DF608603cCDcC83F5712B97C185A6A948d;
// https://etherscan.io/address/0x79f5C4562EC3e85C3103Ce63Ab94E92EFfDd6197
address internal constant DEFAULT_VARIABLE_DEBT_TOKEN_IMPL =
0x79f5C4562EC3e85C3103Ce63Ab94E92EFfDd6197;
// https://etherscan.io/address/0xC6cAB8D39D93DC0Bd5986E7Ce5Bb956E30103A43
address internal constant POOL_ADDRESSES_PROVIDER_REGISTRY =
0xC6cAB8D39D93DC0Bd5986E7Ce5Bb956E30103A43;
// https://etherscan.io/address/0x66E1aBdb06e7363a618D65a910c540dfED23754f
address internal constant REPAY_WITH_COLLATERAL_ADAPTER =
0x66E1aBdb06e7363a618D65a910c540dfED23754f;
// https://etherscan.io/address/0xD0887AA7fEBC8962c622493646195e7c76D94fCE
address internal constant SWAP_COLLATERAL_ADAPTER = 0xD0887AA7fEBC8962c622493646195e7c76D94fCE;
// https://etherscan.io/address/0x43eDB797834151D041619EEF833Edc784B509dAE
address internal constant WITHDRAW_SWAP_ADAPTER = 0x43eDB797834151D041619EEF833Edc784B509dAE;
// https://etherscan.io/address/0xe3dFf4052F0bF6134ACb73bEaE8fe2317d71F047
address internal constant UI_INCENTIVE_DATA_PROVIDER = 0xe3dFf4052F0bF6134ACb73bEaE8fe2317d71F047;
// https://etherscan.io/address/0x2dAd8162A989cd99D673dE4425Bb2298Db1E1aA2
address internal constant UI_POOL_DATA_PROVIDER = 0x2dAd8162A989cd99D673dE4425Bb2298Db1E1aA2;
// https://etherscan.io/address/0xC7be5307ba715ce89b152f3Df0658295b3dbA8E2
address internal constant WALLET_BALANCE_PROVIDER = 0xC7be5307ba715ce89b152f3Df0658295b3dbA8E2;
// https://etherscan.io/address/0x3167C452fA3fa1e5C16bB83Bc0fde4519C464299
address internal constant WETH_GATEWAY = 0x3167C452fA3fa1e5C16bB83Bc0fde4519C464299;
// https://etherscan.io/address/0xBF87A82B9186C15eF4Ab547920C8c05a773c8346
address internal constant CONFIG_ENGINE = 0xBF87A82B9186C15eF4Ab547920C8c05a773c8346;
// https://etherscan.io/address/0x5BA8d98feE911C2422EbEBFB6b774128924CcD68
address internal constant RISK_STEWARD = 0x5BA8d98feE911C2422EbEBFB6b774128924CcD68;
// https://etherscan.io/address/0x47c71dFEB55Ebaa431Ae3fbF99Ea50e0D3d30fA8
address internal constant RISK_COUNCIL = 0x47c71dFEB55Ebaa431Ae3fbF99Ea50e0D3d30fA8;
// https://etherscan.io/address/0xd1B2dec98A95B773C4909B5CD8FB455F467A527f
address internal constant DEBT_SWAP_ADAPTER = 0xd1B2dec98A95B773C4909B5CD8FB455F467A527f;
// https://etherscan.io/address/0x81aFd0F99c2Afa2f2DD7E387c2Ef9CD2a29b6E1A
address internal constant EDGE_RISK_STEWARD_RATES = 0x81aFd0F99c2Afa2f2DD7E387c2Ef9CD2a29b6E1A;
// https://etherscan.io/address/0x834a5aC6e9D05b92F599A031941262F761c34859
address internal constant EDGE_INJECTOR_RATES = 0x834a5aC6e9D05b92F599A031941262F761c34859;
// https://etherscan.io/address/0x347C75d19718a05148687E13dca259aD016aB411
address internal constant STATA_FACTORY = 0x347C75d19718a05148687E13dca259aD016aB411;
// https://etherscan.io/address/0x2cE01c87Fec1b71A9041c52CaED46Fc5f4807285
address internal constant GHO_DIRECT_MINTER = 0x2cE01c87Fec1b71A9041c52CaED46Fc5f4807285;
// https://etherscan.io/address/0x31a0Ba3C2242a095dBF58A7C53751eCBd27dBA9b
address internal constant DUST_BIN = 0x31a0Ba3C2242a095dBF58A7C53751eCBd27dBA9b;
// https://etherscan.io/address/0x7571F419F7Df2d0622C1A20154a0D4250B2265cC
address internal constant CLINIC_STEWARD = 0x7571F419F7Df2d0622C1A20154a0D4250B2265cC;
// https://etherscan.io/address/0x84f2C90f2D66E700baA4CF3cbF66bE7D8f21Bd87
address internal constant SVR_STEWARD = 0x84f2C90f2D66E700baA4CF3cbF66bE7D8f21Bd87;
// https://etherscan.io/address/0xFdFA036213C375808135744E865767FD90897F0A
address internal constant COW_ADAPTER_FACTORY = 0xFdFA036213C375808135744E865767FD90897F0A;
// https://etherscan.io/address/0xdf36e299a5326dd284E3E7b5AD891b4262e32f0a
address internal constant COW_COLLATERAL_SWAP_ADAPTER =
0xdf36e299a5326dd284E3E7b5AD891b4262e32f0a;
// https://etherscan.io/address/0xC654F2E06448f1E0912B0b0Da5B32a98e4c32919
address internal constant COW_DEBT_SWAP_ADAPTER = 0xC654F2E06448f1E0912B0b0Da5B32a98e4c32919;
// https://etherscan.io/address/0xF04f7527C082be4F3802f26cC769d40da9a84e66
address internal constant COW_REPAY_WITH_COLLATERAL_ADAPTER =
0xF04f7527C082be4F3802f26cC769d40da9a84e66;
// https://etherscan.io/address/0xbE1131cD9df966Dd622532f9fFddE0644457C840
address internal constant COW_LEVERAGE_ADAPTER = 0xbE1131cD9df966Dd622532f9fFddE0644457C840;
}
library AaveV3EthereumLidoAssets {
// https://etherscan.io/address/0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0
address internal constant wstETH_UNDERLYING = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;
uint8 internal constant wstETH_DECIMALS = 18;
// https://etherscan.io/address/0xC035a7cf15375cE2706766804551791aD035E0C2
address internal constant wstETH_A_TOKEN = 0xC035a7cf15375cE2706766804551791aD035E0C2;
// https://etherscan.io/address/0xE439edd2625772AA635B437C099C607B6eb7d35f
address internal constant wstETH_V_TOKEN = 0xE439edd2625772AA635B437C099C607B6eb7d35f;
// https://etherscan.io/address/0xe1D97bF61901B075E9626c8A2340a7De385861Ef
address internal constant wstETH_ORACLE = 0xe1D97bF61901B075E9626c8A2340a7De385861Ef;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant wstETH_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0x775F661b0bD1739349b9A2A3EF60be277c5d2D29
address internal constant wstETH_STATA_TOKEN = 0x775F661b0bD1739349b9A2A3EF60be277c5d2D29;
// https://etherscan.io/address/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
address internal constant WETH_UNDERLYING = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
uint8 internal constant WETH_DECIMALS = 18;
// https://etherscan.io/address/0xfA1fDbBD71B0aA16162D76914d69cD8CB3Ef92da
address internal constant WETH_A_TOKEN = 0xfA1fDbBD71B0aA16162D76914d69cD8CB3Ef92da;
// https://etherscan.io/address/0x91b7d78BF92db564221f6B5AeE744D1727d1Dd1e
address internal constant WETH_V_TOKEN = 0x91b7d78BF92db564221f6B5AeE744D1727d1Dd1e;
// https://etherscan.io/address/0x5424384B256154046E9667dDFaaa5e550145215e
address internal constant WETH_ORACLE = 0x5424384B256154046E9667dDFaaa5e550145215e;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant WETH_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0x0FE906e030a44eF24CA8c7dC7B7c53A6C4F00ce9
address internal constant WETH_STATA_TOKEN = 0x0FE906e030a44eF24CA8c7dC7B7c53A6C4F00ce9;
// https://etherscan.io/address/0xdC035D45d973E3EC169d2276DDab16f1e407384F
address internal constant USDS_UNDERLYING = 0xdC035D45d973E3EC169d2276DDab16f1e407384F;
uint8 internal constant USDS_DECIMALS = 18;
// https://etherscan.io/address/0x09AA30b182488f769a9824F15E6Ce58591Da4781
address internal constant USDS_A_TOKEN = 0x09AA30b182488f769a9824F15E6Ce58591Da4781;
// https://etherscan.io/address/0x2D9fe18b6c35FE439cC15D932cc5C943bf2d901E
address internal constant USDS_V_TOKEN = 0x2D9fe18b6c35FE439cC15D932cc5C943bf2d901E;
// https://etherscan.io/address/0x94C7FD62fd0506e71d8142E9D36687fC72A86B02
address internal constant USDS_ORACLE = 0x94C7FD62fd0506e71d8142E9D36687fC72A86B02;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant USDS_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
address internal constant USDC_UNDERLYING = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
uint8 internal constant USDC_DECIMALS = 6;
// https://etherscan.io/address/0x2A1FBcb52Ed4d9b23daD17E1E8Aed4BB0E6079b8
address internal constant USDC_A_TOKEN = 0x2A1FBcb52Ed4d9b23daD17E1E8Aed4BB0E6079b8;
// https://etherscan.io/address/0xeD90dE2D824Ee766c6Fd22E90b12e598f681dc9F
address internal constant USDC_V_TOKEN = 0xeD90dE2D824Ee766c6Fd22E90b12e598f681dc9F;
// https://etherscan.io/address/0x3f73F03aa83B2A48ed27E964eD0fDb590332095B
address internal constant USDC_ORACLE = 0x3f73F03aa83B2A48ed27E964eD0fDb590332095B;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant USDC_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0xbf5495Efe5DB9ce00f80364C8B423567e58d2110
address internal constant ezETH_UNDERLYING = 0xbf5495Efe5DB9ce00f80364C8B423567e58d2110;
uint8 internal constant ezETH_DECIMALS = 18;
// https://etherscan.io/address/0x74e5664394998f13B07aF42446380ACef637969f
address internal constant ezETH_A_TOKEN = 0x74e5664394998f13B07aF42446380ACef637969f;
// https://etherscan.io/address/0x08e1bba76D27841dD91FAb4b3a636A0D5CF8c3E9
address internal constant ezETH_V_TOKEN = 0x08e1bba76D27841dD91FAb4b3a636A0D5CF8c3E9;
// https://etherscan.io/address/0xF3d49021fF3bbBFDfC1992A4b09E5D1d141D044C
address internal constant ezETH_ORACLE = 0xF3d49021fF3bbBFDfC1992A4b09E5D1d141D044C;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant ezETH_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0x9D39A5DE30e57443BfF2A8307A4256c8797A3497
address internal constant sUSDe_UNDERLYING = 0x9D39A5DE30e57443BfF2A8307A4256c8797A3497;
uint8 internal constant sUSDe_DECIMALS = 18;
// https://etherscan.io/address/0xc2015641564a5914A17CB9A92eC8d8feCfa8f2D0
address internal constant sUSDe_A_TOKEN = 0xc2015641564a5914A17CB9A92eC8d8feCfa8f2D0;
// https://etherscan.io/address/0x2ABbAab3EF4e4A899d39e7EC996b5715E76b399a
address internal constant sUSDe_V_TOKEN = 0x2ABbAab3EF4e4A899d39e7EC996b5715E76b399a;
// https://etherscan.io/address/0x42bc86f2f08419280a99d8fbEa4672e7c30a86ec
address internal constant sUSDe_ORACLE = 0x42bc86f2f08419280a99d8fbEa4672e7c30a86ec;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant sUSDe_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f
address internal constant GHO_UNDERLYING = 0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f;
uint8 internal constant GHO_DECIMALS = 18;
// https://etherscan.io/address/0x18eFE565A5373f430e2F809b97De30335B3ad96A
address internal constant GHO_A_TOKEN = 0x18eFE565A5373f430e2F809b97De30335B3ad96A;
// https://etherscan.io/address/0x18577F0f4A0B2Ee6F4048dB51c7acd8699F97DB8
address internal constant GHO_V_TOKEN = 0x18577F0f4A0B2Ee6F4048dB51c7acd8699F97DB8;
// https://etherscan.io/address/0xD110cac5d8682A3b045D5524a9903E031d70FCCd
address internal constant GHO_ORACLE = 0xD110cac5d8682A3b045D5524a9903E031d70FCCd;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant GHO_INTEREST_RATE_STRATEGY = 0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0xC71Ea051a5F82c67ADcF634c36FFE6334793D24C
address internal constant GHO_STATA_TOKEN = 0xC71Ea051a5F82c67ADcF634c36FFE6334793D24C;
// https://etherscan.io/address/0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7
address internal constant rsETH_UNDERLYING = 0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7;
uint8 internal constant rsETH_DECIMALS = 18;
// https://etherscan.io/address/0x56D919E7B25aA42F3F8a4BC77b8982048F2E84B4
address internal constant rsETH_A_TOKEN = 0x56D919E7B25aA42F3F8a4BC77b8982048F2E84B4;
// https://etherscan.io/address/0x2c2163f120cf58631368981BC16e90190Bc6C644
address internal constant rsETH_V_TOKEN = 0x2c2163f120cf58631368981BC16e90190Bc6C644;
// https://etherscan.io/address/0x7292C95A5f6A501a9c4B34f6393e221F2A0139c3
address internal constant rsETH_ORACLE = 0x7292C95A5f6A501a9c4B34f6393e221F2A0139c3;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant rsETH_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
// https://etherscan.io/address/0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8
address internal constant tETH_UNDERLYING = 0xD11c452fc99cF405034ee446803b6F6c1F6d5ED8;
uint8 internal constant tETH_DECIMALS = 18;
// https://etherscan.io/address/0xce8c60fd8390eFCc3Fc66A3f0bd64BEb969e750E
address internal constant tETH_A_TOKEN = 0xce8c60fd8390eFCc3Fc66A3f0bd64BEb969e750E;
// https://etherscan.io/address/0xe7ea6125490ae4594aD9B44D05dFF9F2A4343134
address internal constant tETH_V_TOKEN = 0xe7ea6125490ae4594aD9B44D05dFF9F2A4343134;
// https://etherscan.io/address/0x85968026294b8f8Fb86d6bF3Cda079f9376aD05A
address internal constant tETH_ORACLE = 0x85968026294b8f8Fb86d6bF3Cda079f9376aD05A;
// https://etherscan.io/address/0x8958b1C39269167527821f8c276Ef7504883f2fa
address internal constant tETH_INTEREST_RATE_STRATEGY =
0x8958b1C39269167527821f8c276Ef7504883f2fa;
}
library AaveV3EthereumLidoEModes {
uint8 internal constant NONE = 0;
uint8 internal constant wstETH__WETH = 1;
uint8 internal constant ezETH__USDC_GHO = 2;
uint8 internal constant ezETH__wstETH = 3;
uint8 internal constant sUSDe__USDC_GHO = 4;
uint8 internal constant rsETH__wstETH = 5;
uint8 internal constant rsETH__USDC_GHO = 6;
uint8 internal constant tETH__wstETH = 7;
}
library AaveV3EthereumLidoExternalLibraries {
// https://etherscan.io/address/0xC27a4d7AC0623B129919786d88714eF16132BEaE
address internal constant FLASHLOAN_LOGIC = 0xC27a4d7AC0623B129919786d88714eF16132BEaE;
// https://etherscan.io/address/0x52Da0ce88202D1542543598D1e1e27F0d344726A
address internal constant BORROW_LOGIC = 0x52Da0ce88202D1542543598D1e1e27F0d344726A;
// https://etherscan.io/address/0x96D5686812e33Ab509ECCDb38C89d15607B2a413
address internal constant LIQUIDATION_LOGIC = 0x96D5686812e33Ab509ECCDb38C89d15607B2a413;
// https://etherscan.io/address/0xD70593841C57cbaA04957cc3EAcE95708e48853b
address internal constant POOL_LOGIC = 0xD70593841C57cbaA04957cc3EAcE95708e48853b;
// https://etherscan.io/address/0x584C7d8c4cb05304FE5Ac7fbc97f20A10Fb07564
address internal constant SUPPLY_LOGIC = 0x584C7d8c4cb05304FE5Ac7fbc97f20A10Fb07564;
}
lib/aave-helpers/src/v3-config-engine/AaveV3PayloadEthereumLido.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {AaveV3EthereumLido} from 'aave-address-book/AaveV3EthereumLido.sol';
import 'aave-v3-origin/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Base smart contract for an Aave v3.1.0 listing on v3 Ethereum Lido.
* @author BGD Labs
*/
abstract contract AaveV3PayloadEthereumLido is
AaveV3Payload(IEngine(AaveV3EthereumLido.CONFIG_ENGINE))
{
function getPoolContext() public pure override returns (IEngine.PoolContext memory) {
return IEngine.PoolContext({networkName: 'Ethereum Lido', networkAbbreviation: 'EthLido'});
}
}
Настройки компилятораПоказать
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "none",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "shanghai",
"remappings": [
"forge-std/=lib/aave-helpers/lib/forge-std/src/",
"solidity-utils/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/src/",
"aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/",
"aave-v3-origin-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/tests/",
"aave-address-book/=lib/aave-helpers/lib/aave-address-book/src/",
"aave-v4/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"openzeppelin-contracts/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
"aave-helpers/=lib/aave-helpers/",
"lib/aave-helpers/:src/=lib/aave-helpers/src/",
"lib/aave-helpers/:src/=lib/aave-helpers/src/",
"aave-umbrella/=lib/aave-umbrella/src/contracts/",
"lib/aave-helpers/:aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/",
"lib/aave-helpers/:aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/",
"lib/aave-address-book/lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-v4/:src/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/:ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:erc4626-tests/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/:halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/lib/erc4626-tests/",
"lib/aave-helpers/lib/aave-address-book/lib/aave-v4/:erc4626-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v4/lib/erc4626-tests/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/:openzeppelin-contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/",
"lib/aave-umbrella/:erc4626-tests/=lib/aave-umbrella/lib/erc4626-tests/",
"lib/aave-umbrella/:erc4626-tests/=lib/aave-umbrella/lib/erc4626-tests/",
"@openzeppelin/contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/aave-umbrella/lib/aave-v3-origin/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/aave-umbrella/lib/erc4626-tests/",
"halmos-cheatcodes/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/aave-umbrella/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/"
]
}Исходный код и метаданные: Sourcify.
Исходный код принадлежит авторам контракта.