Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 8234229 | 5 days ago | IN | 0 S | 0.00149835 |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
RiskSteward
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import {IPoolDataProvider} from 'aave-address-book/AaveV3.sol'; import {Address} from 'openzeppelin-contracts/contracts/utils/Address.sol'; import {SafeCast} from 'openzeppelin-contracts/contracts/utils/math/SafeCast.sol'; import {EngineFlags} from 'aave-v3-origin/src/contracts/extensions/v3-config-engine/EngineFlags.sol'; import {Ownable} from 'openzeppelin-contracts/contracts/access/Ownable.sol'; import {IAaveV3ConfigEngine as IEngine} from 'aave-v3-origin/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol'; import {IRiskSteward} from '../interfaces/IRiskSteward.sol'; import {IDefaultInterestRateStrategyV2} from 'aave-v3-origin/src/contracts/interfaces/IDefaultInterestRateStrategyV2.sol'; import {IPriceCapAdapter} from 'aave-capo/interfaces/IPriceCapAdapter.sol'; import {IPriceCapAdapterStable} from 'aave-capo/interfaces/IPriceCapAdapterStable.sol'; /** * @title RiskSteward * @author BGD labs * @notice Contract to manage the risk params within configured bound on aave v3 pool: * This contract can update the following risk params: caps, ltv, liqThreshold, liqBonus, debtCeiling, interest rates params. */ contract RiskSteward is Ownable, IRiskSteward { using Address for address; using SafeCast for uint256; using SafeCast for int256; /// @inheritdoc IRiskSteward IEngine public immutable CONFIG_ENGINE; /// @inheritdoc IRiskSteward IPoolDataProvider public immutable POOL_DATA_PROVIDER; /// @inheritdoc IRiskSteward address public immutable RISK_COUNCIL; uint256 internal constant BPS_MAX = 100_00; Config internal _riskConfig; mapping(address => Debounce) internal _timelocks; mapping(address => bool) internal _restrictedAddresses; /** * @dev Modifier preventing anyone, but the council to update risk params. */ modifier onlyRiskCouncil() { if (RISK_COUNCIL != msg.sender) revert InvalidCaller(); _; } /** * @param poolDataProvider The pool data provider of the pool to be controlled by the steward * @param engine the config engine to be used by the steward * @param riskCouncil the safe address of the council being able to interact with the steward * @param riskConfig the risk configuration to setup for each individual risk param */ constructor( IPoolDataProvider poolDataProvider, IEngine engine, address riskCouncil, Config memory riskConfig ) Ownable(msg.sender) { POOL_DATA_PROVIDER = poolDataProvider; CONFIG_ENGINE = engine; RISK_COUNCIL = riskCouncil; _riskConfig = riskConfig; } /// @inheritdoc IRiskSteward function updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) external virtual onlyRiskCouncil { _validateCapsUpdate(capsUpdate); _updateCaps(capsUpdate); } /// @inheritdoc IRiskSteward function updateRates( IEngine.RateStrategyUpdate[] calldata ratesUpdate ) external virtual onlyRiskCouncil { _validateRatesUpdate(ratesUpdate); _updateRates(ratesUpdate); } /// @inheritdoc IRiskSteward function updateCollateralSide( IEngine.CollateralUpdate[] calldata collateralUpdates ) external virtual onlyRiskCouncil { _validateCollateralsUpdate(collateralUpdates); _updateCollateralSide(collateralUpdates); } /// @inheritdoc IRiskSteward function updateLstPriceCaps( PriceCapLstUpdate[] calldata priceCapUpdates ) external virtual onlyRiskCouncil { _validatePriceCapUpdate(priceCapUpdates); _updateLstPriceCaps(priceCapUpdates); } /// @inheritdoc IRiskSteward function updateStablePriceCaps( PriceCapStableUpdate[] calldata priceCapUpdates ) external virtual onlyRiskCouncil { _validatePriceCapStableUpdate(priceCapUpdates); _updateStablePriceCaps(priceCapUpdates); } /// @inheritdoc IRiskSteward function getTimelock(address asset) external view returns (Debounce memory) { return _timelocks[asset]; } /// @inheritdoc IRiskSteward function setRiskConfig(Config calldata riskConfig) external onlyOwner { _riskConfig = riskConfig; emit RiskConfigSet(riskConfig); } /// @inheritdoc IRiskSteward function getRiskConfig() external view returns (Config memory) { return _riskConfig; } /// @inheritdoc IRiskSteward function isAddressRestricted(address contractAddress) external view returns (bool) { return _restrictedAddresses[contractAddress]; } /// @inheritdoc IRiskSteward function setAddressRestricted(address contractAddress, bool isRestricted) external onlyOwner { _restrictedAddresses[contractAddress] = isRestricted; emit AddressRestricted(contractAddress, isRestricted); } /** * @notice method to validate the caps update * @param capsUpdate list containing the new supply, borrow caps of the assets */ function _validateCapsUpdate(IEngine.CapsUpdate[] calldata capsUpdate) internal view { if (capsUpdate.length == 0) revert NoZeroUpdates(); for (uint256 i = 0; i < capsUpdate.length; i++) { address asset = capsUpdate[i].asset; if (_restrictedAddresses[asset]) revert AssetIsRestricted(); if (capsUpdate[i].supplyCap == 0 || capsUpdate[i].borrowCap == 0) revert InvalidUpdateToZero(); (uint256 currentBorrowCap, uint256 currentSupplyCap) = POOL_DATA_PROVIDER.getReserveCaps( capsUpdate[i].asset ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentSupplyCap, newValue: capsUpdate[i].supplyCap, lastUpdated: _timelocks[asset].supplyCapLastUpdated, riskConfig: _riskConfig.supplyCap, isChangeRelative: true }) ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentBorrowCap, newValue: capsUpdate[i].borrowCap, lastUpdated: _timelocks[asset].borrowCapLastUpdated, riskConfig: _riskConfig.borrowCap, isChangeRelative: true }) ); } } /** * @notice method to validate the interest rates update * @param ratesUpdate list containing the new interest rates params of the assets */ function _validateRatesUpdate(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal view { if (ratesUpdate.length == 0) revert NoZeroUpdates(); for (uint256 i = 0; i < ratesUpdate.length; i++) { address asset = ratesUpdate[i].asset; if (_restrictedAddresses[asset]) revert AssetIsRestricted(); ( uint256 currentOptimalUsageRatio, uint256 currentBaseVariableBorrowRate, uint256 currentVariableRateSlope1, uint256 currentVariableRateSlope2 ) = _getInterestRatesForAsset(asset); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentOptimalUsageRatio, newValue: ratesUpdate[i].params.optimalUsageRatio, lastUpdated: _timelocks[asset].optimalUsageRatioLastUpdated, riskConfig: _riskConfig.optimalUsageRatio, isChangeRelative: false }) ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentBaseVariableBorrowRate, newValue: ratesUpdate[i].params.baseVariableBorrowRate, lastUpdated: _timelocks[asset].baseVariableRateLastUpdated, riskConfig: _riskConfig.baseVariableBorrowRate, isChangeRelative: false }) ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentVariableRateSlope1, newValue: ratesUpdate[i].params.variableRateSlope1, lastUpdated: _timelocks[asset].variableRateSlope1LastUpdated, riskConfig: _riskConfig.variableRateSlope1, isChangeRelative: false }) ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentVariableRateSlope2, newValue: ratesUpdate[i].params.variableRateSlope2, lastUpdated: _timelocks[asset].variableRateSlope2LastUpdated, riskConfig: _riskConfig.variableRateSlope2, isChangeRelative: false }) ); } } /** * @notice method to validate the collaterals update * @param collateralUpdates list containing the new collateral updates of the assets */ function _validateCollateralsUpdate( IEngine.CollateralUpdate[] calldata collateralUpdates ) internal view { if (collateralUpdates.length == 0) revert NoZeroUpdates(); for (uint256 i = 0; i < collateralUpdates.length; i++) { address asset = collateralUpdates[i].asset; if (_restrictedAddresses[asset]) revert AssetIsRestricted(); if (collateralUpdates[i].liqProtocolFee != EngineFlags.KEEP_CURRENT) revert ParamChangeNotAllowed(); if ( collateralUpdates[i].ltv == 0 || collateralUpdates[i].liqThreshold == 0 || collateralUpdates[i].liqBonus == 0 || collateralUpdates[i].debtCeiling == 0 ) revert InvalidUpdateToZero(); ( , uint256 currentLtv, uint256 currentLiquidationThreshold, uint256 currentLiquidationBonus, , , , , , ) = POOL_DATA_PROVIDER.getReserveConfigurationData(asset); uint256 currentDebtCeiling = POOL_DATA_PROVIDER.getDebtCeiling(asset); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentLtv, newValue: collateralUpdates[i].ltv, lastUpdated: _timelocks[asset].ltvLastUpdated, riskConfig: _riskConfig.ltv, isChangeRelative: false }) ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentLiquidationThreshold, newValue: collateralUpdates[i].liqThreshold, lastUpdated: _timelocks[asset].liquidationThresholdLastUpdated, riskConfig: _riskConfig.liquidationThreshold, isChangeRelative: false }) ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentLiquidationBonus - 100_00, // as the definition is 100% + x%, and config engine takes into account x% for simplicity. newValue: collateralUpdates[i].liqBonus, lastUpdated: _timelocks[asset].liquidationBonusLastUpdated, riskConfig: _riskConfig.liquidationBonus, isChangeRelative: false }) ); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentDebtCeiling / 100, // as the definition is with 2 decimals, and config engine does not take the decimals into account. newValue: collateralUpdates[i].debtCeiling, lastUpdated: _timelocks[asset].debtCeilingLastUpdated, riskConfig: _riskConfig.debtCeiling, isChangeRelative: true }) ); } } /** * @notice method to validate the oracle price caps update * @param priceCapsUpdate list containing the new price cap params for the oracles */ function _validatePriceCapUpdate(PriceCapLstUpdate[] calldata priceCapsUpdate) internal view { if (priceCapsUpdate.length == 0) revert NoZeroUpdates(); for (uint256 i = 0; i < priceCapsUpdate.length; i++) { address oracle = priceCapsUpdate[i].oracle; if (_restrictedAddresses[oracle]) revert OracleIsRestricted(); if ( priceCapsUpdate[i].priceCapUpdateParams.snapshotRatio == 0 || priceCapsUpdate[i].priceCapUpdateParams.snapshotTimestamp == 0 || priceCapsUpdate[i].priceCapUpdateParams.maxYearlyRatioGrowthPercent == 0 ) revert InvalidUpdateToZero(); // get current rate uint256 currentMaxYearlyGrowthPercent = IPriceCapAdapter(oracle) .getMaxYearlyGrowthRatePercent(); uint104 currentRatio = IPriceCapAdapter(oracle).getRatio().toUint256().toUint104(); // check that snapshotRatio is less or equal than current one if (priceCapsUpdate[i].priceCapUpdateParams.snapshotRatio > currentRatio) revert UpdateNotInRange(); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentMaxYearlyGrowthPercent, newValue: priceCapsUpdate[i].priceCapUpdateParams.maxYearlyRatioGrowthPercent, lastUpdated: _timelocks[oracle].priceCapLastUpdated, riskConfig: _riskConfig.priceCapLst, isChangeRelative: true }) ); } } /** * @notice method to validate the oracle stable price caps update * @param priceCapsUpdate list containing the new price cap values for the oracles */ function _validatePriceCapStableUpdate( PriceCapStableUpdate[] calldata priceCapsUpdate ) internal view { if (priceCapsUpdate.length == 0) revert NoZeroUpdates(); for (uint256 i = 0; i < priceCapsUpdate.length; i++) { address oracle = priceCapsUpdate[i].oracle; if (_restrictedAddresses[oracle]) revert OracleIsRestricted(); if (priceCapsUpdate[i].priceCap == 0) revert InvalidUpdateToZero(); // get current rate int256 currentPriceCap = IPriceCapAdapterStable(oracle).getPriceCap(); _validateParamUpdate( ParamUpdateValidationInput({ currentValue: currentPriceCap.toUint256(), newValue: priceCapsUpdate[i].priceCap, lastUpdated: _timelocks[oracle].priceCapLastUpdated, riskConfig: _riskConfig.priceCapStable, isChangeRelative: true }) ); } } /** * @notice method to validate the risk param update is within the allowed bound and the debounce is respected * @param validationParam struct containing values used for validation of the risk param update */ function _validateParamUpdate(ParamUpdateValidationInput memory validationParam) internal view { if (validationParam.newValue == EngineFlags.KEEP_CURRENT) return; if (block.timestamp - validationParam.lastUpdated < validationParam.riskConfig.minDelay) revert DebounceNotRespected(); if ( !_updateWithinAllowedRange( validationParam.currentValue, validationParam.newValue, validationParam.riskConfig.maxPercentChange, validationParam.isChangeRelative ) ) revert UpdateNotInRange(); } /** * @notice method to update the borrow / supply caps using the config engine and updates the debounce * @param capsUpdate list containing the new supply, borrow caps of the assets */ function _updateCaps(IEngine.CapsUpdate[] calldata capsUpdate) internal { for (uint256 i = 0; i < capsUpdate.length; i++) { address asset = capsUpdate[i].asset; if (capsUpdate[i].supplyCap != EngineFlags.KEEP_CURRENT) { _timelocks[asset].supplyCapLastUpdated = uint40(block.timestamp); } if (capsUpdate[i].borrowCap != EngineFlags.KEEP_CURRENT) { _timelocks[asset].borrowCapLastUpdated = uint40(block.timestamp); } } address(CONFIG_ENGINE).functionDelegateCall( abi.encodeWithSelector(CONFIG_ENGINE.updateCaps.selector, capsUpdate) ); } /** * @notice method to update the interest rates params using the config engine and updates the debounce * @param ratesUpdate list containing the new interest rates params of the assets */ function _updateRates(IEngine.RateStrategyUpdate[] calldata ratesUpdate) internal { for (uint256 i = 0; i < ratesUpdate.length; i++) { address asset = ratesUpdate[i].asset; if (ratesUpdate[i].params.optimalUsageRatio != EngineFlags.KEEP_CURRENT) { _timelocks[asset].optimalUsageRatioLastUpdated = uint40(block.timestamp); } if (ratesUpdate[i].params.baseVariableBorrowRate != EngineFlags.KEEP_CURRENT) { _timelocks[asset].baseVariableRateLastUpdated = uint40(block.timestamp); } if (ratesUpdate[i].params.variableRateSlope1 != EngineFlags.KEEP_CURRENT) { _timelocks[asset].variableRateSlope1LastUpdated = uint40(block.timestamp); } if (ratesUpdate[i].params.variableRateSlope2 != EngineFlags.KEEP_CURRENT) { _timelocks[asset].variableRateSlope2LastUpdated = uint40(block.timestamp); } } address(CONFIG_ENGINE).functionDelegateCall( abi.encodeWithSelector(CONFIG_ENGINE.updateRateStrategies.selector, ratesUpdate) ); } /** * @notice method to update the collateral side params using the config engine and updates the debounce * @param collateralUpdates list containing the new collateral updates of the assets */ function _updateCollateralSide(IEngine.CollateralUpdate[] calldata collateralUpdates) internal { for (uint256 i = 0; i < collateralUpdates.length; i++) { address asset = collateralUpdates[i].asset; if (collateralUpdates[i].ltv != EngineFlags.KEEP_CURRENT) { _timelocks[asset].ltvLastUpdated = uint40(block.timestamp); } if (collateralUpdates[i].liqThreshold != EngineFlags.KEEP_CURRENT) { _timelocks[asset].liquidationThresholdLastUpdated = uint40(block.timestamp); } if (collateralUpdates[i].liqBonus != EngineFlags.KEEP_CURRENT) { _timelocks[asset].liquidationBonusLastUpdated = uint40(block.timestamp); } if (collateralUpdates[i].debtCeiling != EngineFlags.KEEP_CURRENT) { _timelocks[asset].debtCeilingLastUpdated = uint40(block.timestamp); } } address(CONFIG_ENGINE).functionDelegateCall( abi.encodeWithSelector(CONFIG_ENGINE.updateCollateralSide.selector, collateralUpdates) ); } /** * @notice method to update the oracle price caps update * @param priceCapsUpdate list containing the new price cap params for the oracles */ function _updateLstPriceCaps(PriceCapLstUpdate[] calldata priceCapsUpdate) internal { for (uint256 i = 0; i < priceCapsUpdate.length; i++) { address oracle = priceCapsUpdate[i].oracle; _timelocks[oracle].priceCapLastUpdated = uint40(block.timestamp); IPriceCapAdapter(oracle).setCapParameters(priceCapsUpdate[i].priceCapUpdateParams); if (IPriceCapAdapter(oracle).isCapped()) revert InvalidPriceCapUpdate(); } } /** * @notice method to update the oracle stable price caps update * @param priceCapsUpdate list containing the new price cap values for the oracles */ function _updateStablePriceCaps(PriceCapStableUpdate[] calldata priceCapsUpdate) internal { for (uint256 i = 0; i < priceCapsUpdate.length; i++) { address oracle = priceCapsUpdate[i].oracle; _timelocks[oracle].priceCapLastUpdated = uint40(block.timestamp); IPriceCapAdapterStable(oracle).setPriceCap(priceCapsUpdate[i].priceCap.toInt256()); } } /** * @notice method to fetch the current interest rate params of the asset * @param asset the address of the underlying asset * @return optimalUsageRatio the current optimal usage ratio of the asset * @return baseVariableBorrowRate the current base variable borrow rate of the asset * @return variableRateSlope1 the current variable rate slope 1 of the asset * @return variableRateSlope2 the current variable rate slope 2 of the asset */ function _getInterestRatesForAsset( address asset ) internal view returns ( uint256 optimalUsageRatio, uint256 baseVariableBorrowRate, uint256 variableRateSlope1, uint256 variableRateSlope2 ) { address rateStrategyAddress = POOL_DATA_PROVIDER.getInterestRateStrategyAddress(asset); IDefaultInterestRateStrategyV2.InterestRateData memory interestRateData = IDefaultInterestRateStrategyV2(rateStrategyAddress) .getInterestRateDataBps(asset); return ( interestRateData.optimalUsageRatio, interestRateData.baseVariableBorrowRate, interestRateData.variableRateSlope1, interestRateData.variableRateSlope2 ); } /** * @notice Ensures the risk param update is within the allowed range * @param from current risk param value * @param to new updated risk param value * @param maxPercentChange the max percent change allowed * @param isChangeRelative true, if maxPercentChange is relative in value, false if maxPercentChange * is absolute in value. * @return bool true, if difference is within the maxPercentChange */ function _updateWithinAllowedRange( uint256 from, uint256 to, uint256 maxPercentChange, bool isChangeRelative ) internal pure returns (bool) { // diff denotes the difference between the from and to values, ensuring it is a positive value always uint256 diff = from > to ? from - to : to - from; // maxDiff denotes the max permitted difference on both the upper and lower bounds, if the maxPercentChange is relative in value // we calculate the max permitted difference using the maxPercentChange and the from value, otherwise if the maxPercentChange is absolute in value // the max permitted difference is the maxPercentChange itself uint256 maxDiff = isChangeRelative ? (maxPercentChange * from) / BPS_MAX : maxPercentChange; if (diff > maxDiff) return false; return true; } }
// 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'; 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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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 AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 * {FailedInnerCall} 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 AddressInsufficientBalance(address(this)); } (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 {FailedInnerCall}) 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 {FailedInnerCall} 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 {FailedInnerCall}. */ 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.20; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeCast { /** * @dev Value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); /** * @dev An int value doesn't fit in an uint of `bits` size. */ error SafeCastOverflowedIntToUint(int256 value); /** * @dev Value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); /** * @dev An uint value doesn't fit in an int of `bits` size. */ error SafeCastOverflowedUintToInt(uint256 value); /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits */ function toUint248(uint256 value) internal pure returns (uint248) { if (value > type(uint248).max) { revert SafeCastOverflowedUintDowncast(248, value); } return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits */ function toUint240(uint256 value) internal pure returns (uint240) { if (value > type(uint240).max) { revert SafeCastOverflowedUintDowncast(240, value); } return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits */ function toUint232(uint256 value) internal pure returns (uint232) { if (value > type(uint232).max) { revert SafeCastOverflowedUintDowncast(232, value); } return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { if (value > type(uint224).max) { revert SafeCastOverflowedUintDowncast(224, value); } return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits */ function toUint216(uint256 value) internal pure returns (uint216) { if (value > type(uint216).max) { revert SafeCastOverflowedUintDowncast(216, value); } return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits */ function toUint208(uint256 value) internal pure returns (uint208) { if (value > type(uint208).max) { revert SafeCastOverflowedUintDowncast(208, value); } return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits */ function toUint200(uint256 value) internal pure returns (uint200) { if (value > type(uint200).max) { revert SafeCastOverflowedUintDowncast(200, value); } return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits */ function toUint192(uint256 value) internal pure returns (uint192) { if (value > type(uint192).max) { revert SafeCastOverflowedUintDowncast(192, value); } return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits */ function toUint184(uint256 value) internal pure returns (uint184) { if (value > type(uint184).max) { revert SafeCastOverflowedUintDowncast(184, value); } return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits */ function toUint176(uint256 value) internal pure returns (uint176) { if (value > type(uint176).max) { revert SafeCastOverflowedUintDowncast(176, value); } return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits */ function toUint168(uint256 value) internal pure returns (uint168) { if (value > type(uint168).max) { revert SafeCastOverflowedUintDowncast(168, value); } return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits */ function toUint160(uint256 value) internal pure returns (uint160) { if (value > type(uint160).max) { revert SafeCastOverflowedUintDowncast(160, value); } return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits */ function toUint152(uint256 value) internal pure returns (uint152) { if (value > type(uint152).max) { revert SafeCastOverflowedUintDowncast(152, value); } return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits */ function toUint144(uint256 value) internal pure returns (uint144) { if (value > type(uint144).max) { revert SafeCastOverflowedUintDowncast(144, value); } return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits */ function toUint136(uint256 value) internal pure returns (uint136) { if (value > type(uint136).max) { revert SafeCastOverflowedUintDowncast(136, value); } return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { if (value > type(uint128).max) { revert SafeCastOverflowedUintDowncast(128, value); } return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { if (value > type(uint120).max) { revert SafeCastOverflowedUintDowncast(120, value); } return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits */ function toUint112(uint256 value) internal pure returns (uint112) { if (value > type(uint112).max) { revert SafeCastOverflowedUintDowncast(112, value); } return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits */ function toUint104(uint256 value) internal pure returns (uint104) { if (value > type(uint104).max) { revert SafeCastOverflowedUintDowncast(104, value); } return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { if (value > type(uint96).max) { revert SafeCastOverflowedUintDowncast(96, value); } return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits */ function toUint88(uint256 value) internal pure returns (uint88) { if (value > type(uint88).max) { revert SafeCastOverflowedUintDowncast(88, value); } return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits */ function toUint80(uint256 value) internal pure returns (uint80) { if (value > type(uint80).max) { revert SafeCastOverflowedUintDowncast(80, value); } return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits */ function toUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert SafeCastOverflowedUintDowncast(72, value); } return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { if (value > type(uint64).max) { revert SafeCastOverflowedUintDowncast(64, value); } return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits */ function toUint56(uint256 value) internal pure returns (uint56) { if (value > type(uint56).max) { revert SafeCastOverflowedUintDowncast(56, value); } return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits */ function toUint48(uint256 value) internal pure returns (uint48) { if (value > type(uint48).max) { revert SafeCastOverflowedUintDowncast(48, value); } return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert SafeCastOverflowedUintDowncast(40, value); } return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { if (value > type(uint32).max) { revert SafeCastOverflowedUintDowncast(32, value); } return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits */ function toUint24(uint256 value) internal pure returns (uint24) { if (value > type(uint24).max) { revert SafeCastOverflowedUintDowncast(24, value); } return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { if (value > type(uint16).max) { revert SafeCastOverflowedUintDowncast(16, value); } return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits */ function toUint8(uint256 value) internal pure returns (uint8) { if (value > type(uint8).max) { revert SafeCastOverflowedUintDowncast(8, value); } return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { if (value < 0) { revert SafeCastOverflowedIntToUint(value); } return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(248, value); } } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(240, value); } } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(232, value); } } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(224, value); } } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(216, value); } } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(208, value); } } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(200, value); } } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(192, value); } } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(184, value); } } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(176, value); } } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(168, value); } } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(160, value); } } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(152, value); } } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(144, value); } } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(136, value); } } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(128, value); } } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(120, value); } } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(112, value); } } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(104, value); } } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(96, value); } } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(88, value); } } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(80, value); } } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(72, value); } } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(64, value); } } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(56, value); } } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(48, value); } } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(40, value); } } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(32, value); } } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(24, value); } } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(16, value); } } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); if (downcasted != value) { revert SafeCastOverflowedIntDowncast(8, value); } } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive if (value > uint256(type(int256).max)) { revert SafeCastOverflowedUintToInt(value); } return int256(value); } }
// 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// 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 EngineLibraries { address listingEngine; address eModeEngine; address borrowEngine; address collateralEngine; address priceFeedEngine; address rateEngine; address capsEngine; } 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, * borrowableInIsolation: EngineFlags.ENABLED, * withSiloedBorrowing:, EngineFlags.DISABLED, * 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 * debtCeiling: 100_000, // 100k USD * liqProtocolFee: 10_00, // 10% * eModeCategory: 0, // No category * } */ struct Listing { address asset; string assetSymbol; address priceFeed; InterestRateInputData rateStrategyParams; // Mandatory, no matter if enabled for borrowing or not uint256 enabledToBorrow; uint256 borrowableInIsolation; // Only considered is enabledToBorrow == EngineFlags.ENABLED (true) uint256 withSiloedBorrowing; // Only considered if enabledToBorrow == EngineFlags.ENABLED (true) 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 debtCeiling; // Only considered if liqThreshold > 0 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, * debtCeiling: EngineFlags.KEEP_CURRENT, * liqProtocolFee: 7_00 * }) */ struct CollateralUpdate { address asset; uint256 ltv; uint256 liqThreshold; uint256 liqBonus; uint256 debtCeiling; uint256 liqProtocolFee; } /** * @dev Example (mock): * BorrowUpdate({ * asset: AaveV3EthereumAssets.AAVE_UNDERLYING, * enabledToBorrow: EngineFlags.ENABLED, * flashloanable: EngineFlags.KEEP_CURRENT, * borrowableInIsolation: EngineFlags.KEEP_CURRENT, * withSiloedBorrowing: EngineFlags.KEEP_CURRENT, * reserveFactor: 15_00, // 15% * }) */ struct BorrowUpdate { address asset; uint256 enabledToBorrow; uint256 flashloanable; uint256 borrowableInIsolation; uint256 withSiloedBorrowing; uint256 reserveFactor; } /** * @dev Example (mock): * AssetEModeUpdate({ * asset: AaveV3EthereumAssets.rETH_UNDERLYING, * eModeCategory: 1, // ETH correlated * borrowable: EngineFlags.ENABLED, * collateral: EngineFlags.KEEP_CURRENT, * }) */ struct AssetEModeUpdate { address asset; uint8 eModeCategory; uint256 borrowable; uint256 collateral; } /** * @dev Example (mock): * EModeCategoryUpdate({ * eModeCategory: 1, // ETH correlated * ltv: 60_00, * liqThreshold: 70_00, * liqBonus: EngineFlags.KEEP_CURRENT, * label: EngineFlags.KEEP_CURRENT_STRING * }) */ struct EModeCategoryUpdate { uint8 eModeCategory; uint256 ltv; uint256 liqThreshold; uint256 liqBonus; string label; } /** * @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 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); function BORROW_ENGINE() external view returns (address); function CAPS_ENGINE() external view returns (address); function COLLATERAL_ENGINE() external view returns (address); function EMODE_ENGINE() external view returns (address); function LISTING_ENGINE() external view returns (address); function PRICE_FEED_ENGINE() external view returns (address); function RATE_ENGINE() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IPoolDataProvider} from 'aave-address-book/AaveV3.sol'; import {IAaveV3ConfigEngine as IEngine} from 'aave-v3-origin/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol'; import {IPriceCapAdapter} from 'aave-capo/interfaces/IPriceCapAdapter.sol'; /** * @title IRiskSteward * @author BGD labs * @notice Defines the interface for the contract to manage the risk params updates on aave v3 pool */ interface IRiskSteward { /** * @notice Only the permissioned council is allowed to call methods on the steward */ error InvalidCaller(); /** * @notice A single risk param update can only be changed after the minimum delay configured has passed */ error DebounceNotRespected(); /** * @notice A single risk param update must not be increased / decreased by maxPercentChange configured */ error UpdateNotInRange(); /** * @notice The risk param update is not allowed on the Risk Steward. */ error UpdateNotAllowed(); /** * @notice There must be at least one risk param update per execution */ error NoZeroUpdates(); /** * @notice The steward does not allow the risk param change for the param given */ error ParamChangeNotAllowed(); /** * @notice The steward does not allow updates of risk param of a restricted asset */ error AssetIsRestricted(); /** * @notice The steward does not allow updates of cap param of a restricted oracle */ error OracleIsRestricted(); /** * @notice Setting the risk parameter value to zero is not allowed */ error InvalidUpdateToZero(); /** * @notice Setting the price cap to be capping the value is not allowed */ error InvalidPriceCapUpdate(); /** * @notice Emitted when the owner configures an asset/oracle as restricted to be used by steward * @param contractAddress address of the underlying asset or oracle * @param isRestricted true if asset is set as restricted, false otherwise */ event AddressRestricted(address indexed contractAddress, bool indexed isRestricted); /** * @notice Emitted when the risk configuration for the risk params has been set * @param riskConfig struct containing the risk configurations */ event RiskConfigSet(Config indexed riskConfig); /** * @notice Struct storing the last update by the steward of each risk param */ struct Debounce { uint40 supplyCapLastUpdated; uint40 borrowCapLastUpdated; uint40 ltvLastUpdated; uint40 liquidationBonusLastUpdated; uint40 liquidationThresholdLastUpdated; uint40 debtCeilingLastUpdated; uint40 baseVariableRateLastUpdated; uint40 variableRateSlope1LastUpdated; uint40 variableRateSlope2LastUpdated; uint40 optimalUsageRatioLastUpdated; uint40 priceCapLastUpdated; } /** * @notice Struct storing the params used for validation of the risk param update * @param currentValue the current value of the risk param * @param newValue the new value of the risk param * @param lastUpdated timestamp when the risk param was last updated by the steward * @param riskConfig the risk configuration containing the minimum delay and the max percent change allowed for the risk param * @param isChangeRelative true, if risk param change is relative in value, false if risk param change is absolute in value */ struct ParamUpdateValidationInput { uint256 currentValue; uint256 newValue; uint40 lastUpdated; RiskParamConfig riskConfig; bool isChangeRelative; } /** * @notice Struct storing the minimum delay and maximum percent change for a risk param */ struct RiskParamConfig { uint40 minDelay; uint256 maxPercentChange; } /** * @notice Struct storing the risk configuration for all the risk param */ struct Config { RiskParamConfig ltv; RiskParamConfig liquidationThreshold; RiskParamConfig liquidationBonus; RiskParamConfig supplyCap; RiskParamConfig borrowCap; RiskParamConfig debtCeiling; RiskParamConfig baseVariableBorrowRate; RiskParamConfig variableRateSlope1; RiskParamConfig variableRateSlope2; RiskParamConfig optimalUsageRatio; RiskParamConfig priceCapLst; RiskParamConfig priceCapStable; } /** * @notice Struct used to update the LST cap params */ struct PriceCapLstUpdate { address oracle; IPriceCapAdapter.PriceCapUpdateParams priceCapUpdateParams; } /** * @notice Struct used to update the stable cap params */ struct PriceCapStableUpdate { address oracle; uint256 priceCap; } /** * @notice The config engine used to perform the cap update via delegatecall */ function CONFIG_ENGINE() external view returns (IEngine); /** * @notice The pool data provider of the POOL the steward controls */ function POOL_DATA_PROVIDER() external view returns (IPoolDataProvider); /** * @notice The safe controlling the steward */ function RISK_COUNCIL() external view returns (address); /** * @notice Allows increasing borrow and supply caps across multiple assets * @dev A cap update is only possible after minDelay has passed after last update * @dev A cap increase / decrease is only allowed by a magnitude of maxPercentChange * @param capUpdates struct containing new caps to be updated */ function updateCaps(IEngine.CapsUpdate[] calldata capUpdates) external; /** * @notice Allows updating interest rates params across multiple assets * @dev A rate update is only possible after minDelay has passed after last update * @dev A rate increase / decrease is only allowed by a magnitude of maxPercentChange * @param rateUpdates struct containing new interest rate params to be updated */ function updateRates(IEngine.RateStrategyUpdate[] calldata rateUpdates) external; /** * @notice Allows updating collateral params across multiple assets * @dev A collateral update is only possible after minDelay has passed after last update * @dev A collateral increase / decrease is only allowed by a magnitude of maxPercentChange * @param collateralUpdates struct containing new collateral rate params to be updated */ function updateCollateralSide(IEngine.CollateralUpdate[] calldata collateralUpdates) external; /** * @notice Allows updating lst price cap params across multiple oracles * @dev A price cap update is only possible after minDelay has passed after last update * @dev A price cap increase / decrease is only allowed by a magnitude of maxPercentChange * @param priceCapUpdates struct containing new price cap params to be updated */ function updateLstPriceCaps(PriceCapLstUpdate[] calldata priceCapUpdates) external; /** * @notice Allows updating price cap params across multiple oracles * @dev A price cap update is only possible after minDelay has passed after last update * @dev A price cap increase / decrease is only allowed by a magnitude of maxPercentChange * @param priceCapUpdates struct containing new price cap params to be updated */ function updateStablePriceCaps(PriceCapStableUpdate[] calldata priceCapUpdates) external; /** * @notice method to check if an asset/oracle is restricted to be used by the risk stewards * @param contractAddress address of the underlying asset or oracle * @return bool if asset is restricted or not */ function isAddressRestricted(address contractAddress) external view returns (bool); /** * @notice method called by the owner to set an asset/oracle as restricted * @param contractAddress address of the underlying asset or oracle * @param isRestricted true if asset needs to be restricted, false otherwise */ function setAddressRestricted(address contractAddress, bool isRestricted) external; /** * @notice Returns the timelock for a specific asset i.e the last updated timestamp * @param asset for which to fetch the timelock * @return struct containing the latest updated timestamps of all the risk params by the steward */ function getTimelock(address asset) external view returns (Debounce memory); /** * @notice method to get the risk configuration set for all the risk params * @return struct containing the risk configurations */ function getRiskConfig() external view returns (Config memory); /** * @notice method called by the owner to set the risk configuration for the risk params * @param riskConfig struct containing the risk configurations */ function setRiskConfig(Config memory riskConfig) external; }
// 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 InterestRateDataRay 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; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import {IACLManager} from 'aave-address-book/AaveV3.sol'; import {ICLSynchronicityPriceAdapter} from 'cl-synchronicity-price-adapter/interfaces/ICLSynchronicityPriceAdapter.sol'; import {IChainlinkAggregator} from 'cl-synchronicity-price-adapter/interfaces/IChainlinkAggregator.sol'; interface IPriceCapAdapter is ICLSynchronicityPriceAdapter { /** * @dev Emitted when the cap parameters are updated * @param snapshotRatio the ratio at the time of snapshot * @param snapshotTimestamp the timestamp at the time of snapshot * @param maxRatioGrowthPerSecond max ratio growth per second * @param maxYearlyRatioGrowthPercent max yearly ratio growth percent **/ event CapParametersUpdated( uint256 snapshotRatio, uint256 snapshotTimestamp, uint256 maxRatioGrowthPerSecond, uint16 maxYearlyRatioGrowthPercent ); /** * @notice Parameters to create adapter * @param capAdapterParams parameters to create adapter */ struct CapAdapterBaseParams { IACLManager aclManager; address baseAggregatorAddress; address ratioProviderAddress; string pairDescription; uint8 ratioDecimals; uint48 minimumSnapshotDelay; PriceCapUpdateParams priceCapParams; } /** * @notice Parameters to create CL cap adapter * @param clCapAdapterParams parameters to create CL cap adapter */ struct CapAdapterParams { IACLManager aclManager; address baseAggregatorAddress; address ratioProviderAddress; string pairDescription; uint48 minimumSnapshotDelay; PriceCapUpdateParams priceCapParams; } /** * @notice Parameters to update price cap * @param priceCapParams parameters to set price cap */ struct PriceCapUpdateParams { uint104 snapshotRatio; uint48 snapshotTimestamp; uint16 maxYearlyRatioGrowthPercent; } /** * @notice Updates price cap parameters * @param priceCapParams parameters to set price cap */ function setCapParameters(PriceCapUpdateParams memory priceCapParams) external; /** * @notice Maximum percentage factor (100.00%) */ function PERCENTAGE_FACTOR() external view returns (uint256); /** * @notice Minimal time while ratio should not overflow, in years */ function MINIMAL_RATIO_INCREASE_LIFETIME() external view returns (uint256); /** * @notice Number of seconds per year (365 days) */ function SECONDS_PER_YEAR() external view returns (uint256); /** * @notice Price feed for (BASE_ASSET / USD) pair */ function BASE_TO_USD_AGGREGATOR() external view returns (IChainlinkAggregator); /** * @notice Ratio feed for (LST_ASSET / BASE_ASSET) pair */ function RATIO_PROVIDER() external view returns (address); /** * @notice ACL manager contract */ function ACL_MANAGER() external view returns (IACLManager); /** * @notice Number of decimals in the output of this price adapter */ function DECIMALS() external view returns (uint8); /** * @notice Number of decimals for (lst asset / underlying asset) ratio */ function RATIO_DECIMALS() external view returns (uint8); /** * @notice Minimum time (in seconds) that should have passed from the snapshot timestamp to the current block.timestamp */ function MINIMUM_SNAPSHOT_DELAY() external view returns (uint48); /** * @notice Returns the current exchange ratio of lst to the underlying(base) asset */ function getRatio() external view returns (int256); /** * @notice Returns the latest snapshot ratio */ function getSnapshotRatio() external view returns (uint256); /** * @notice Returns the latest snapshot timestamp */ function getSnapshotTimestamp() external view returns (uint256); /** * @notice Returns the max ratio growth per second */ function getMaxRatioGrowthPerSecond() external view returns (uint256); /** * @notice Returns the max yearly ratio growth */ function getMaxYearlyGrowthRatePercent() external view returns (uint256); /** * @notice Returns if the price is currently capped */ function isCapped() external view returns (bool); error ACLManagerIsZeroAddress(); error SnapshotRatioIsZero(); error SnapshotMayOverflowSoon(uint104 snapshotRatio, uint16 maxYearlyRatioGrowthPercent); error InvalidRatioTimestamp(uint48 timestamp); error CallerIsNotRiskOrPoolAdmin(); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IACLManager} from 'aave-address-book/AaveV3.sol'; import {IChainlinkAggregator} from 'cl-synchronicity-price-adapter/interfaces/IChainlinkAggregator.sol'; import {ICLSynchronicityPriceAdapter} from 'cl-synchronicity-price-adapter/interfaces/ICLSynchronicityPriceAdapter.sol'; interface IPriceCapAdapterStable is ICLSynchronicityPriceAdapter { /** * @dev Emitted when the price cap gets updated * @param priceCap the new price cap **/ event PriceCapUpdated(int256 priceCap); /** * @notice Parameters to create stable cap adapter * @param capAdapterStableParams parameters to create stable cap adapter */ struct CapAdapterStableParams { IACLManager aclManager; IChainlinkAggregator assetToUsdAggregator; string adapterDescription; int256 priceCap; } /** * @notice Price feed for (ASSET / USD) pair */ function ASSET_TO_USD_AGGREGATOR() external view returns (IChainlinkAggregator); /** * @notice ACL manager contract */ function ACL_MANAGER() external view returns (IACLManager); /** * @notice Updates price cap * @param priceCap the new price cap */ function setPriceCap(int256 priceCap) external; /** * @notice Get price cap value */ function getPriceCap() external view returns (int256); /** * @notice Returns if the price is currently capped */ function isCapped() external view returns (bool); error ACLManagerIsZeroAddress(); error CallerIsNotRiskOrPoolAdmin(); error CapLowerThanActualPrice(); }
// 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; //address of the interest rate strategy address interestRateStrategyAddress; //the current treasury balance, scaled uint128 accruedToTreasury; //the outstanding unbacked aTokens minted through the bridging feature uint128 unbacked; //the outstanding debt borrowed against this asset in isolation mode 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; // DEPRECATED on v3.2.0 uint128 __deprecatedStableBorrowRate; //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; //address of the interest rate strategy address interestRateStrategyAddress; //the current treasury balance, scaled uint128 accruedToTreasury; //the outstanding unbacked aTokens minted through the bridging feature uint128 unbacked; //the outstanding debt borrowed against this asset in isolation mode uint128 isolationModeTotalDebt; //the amount of underlying accounted for by the protocol uint128 virtualUnderlyingBalance; } 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: borrowing in isolation mode is enabled //bit 62: 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: unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled //bit 212-251: debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals //bit 252: 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; string label; } struct EModeCategory { // each eMode category has a custom ltv and liquidation threshold uint16 ltv; uint16 liquidationThreshold; uint16 liquidationBonus; uint128 collateralBitmap; string label; uint128 borrowableBitmap; } 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 { uint256 reservesCount; uint256 debtToCover; address collateralAsset; address debtAsset; address user; bool receiveAToken; address priceOracle; uint8 userEModeCategory; address priceOracleSentinel; } struct ExecuteSupplyParams { address asset; uint256 amount; address onBehalfOf; uint16 referralCode; } struct ExecuteBorrowParams { address asset; address user; address onBehalfOf; uint256 amount; InterestRateMode interestRateMode; uint16 referralCode; bool releaseUnderlying; uint256 reservesCount; address oracle; uint8 userEModeCategory; address priceOracleSentinel; } struct ExecuteRepayParams { address asset; uint256 amount; InterestRateMode interestRateMode; address onBehalfOf; bool useATokens; } struct ExecuteWithdrawParams { address asset; uint256 amount; address to; uint256 reservesCount; address oracle; uint8 userEModeCategory; } struct ExecuteSetUserEModeParams { uint256 reservesCount; address oracle; uint8 categoryId; } struct FinalizeTransferParams { address asset; address from; address to; uint256 amount; uint256 balanceFromBefore; uint256 balanceToBefore; uint256 reservesCount; address oracle; uint8 fromEModeCategory; } struct FlashloanParams { address receiverAddress; address[] assets; uint256[] amounts; uint256[] interestRateModes; address onBehalfOf; bytes params; uint16 referralCode; uint256 flashLoanPremiumToProtocol; uint256 flashLoanPremiumTotal; uint256 reservesCount; address addressesProvider; address pool; uint8 userEModeCategory; bool isAuthorizedFlashBorrower; } struct FlashloanSimpleParams { address receiverAddress; address asset; uint256 amount; bytes params; uint16 referralCode; uint256 flashLoanPremiumToProtocol; uint256 flashLoanPremiumTotal; } struct FlashLoanRepaymentParams { uint256 amount; uint256 totalPremium; uint256 flashLoanPremiumToProtocol; address asset; address receiverAddress; uint16 referralCode; } struct CalculateUserAccountDataParams { UserConfigurationMap userConfig; uint256 reservesCount; address user; address oracle; uint8 userEModeCategory; } struct ValidateBorrowParams { ReserveCache reserveCache; UserConfigurationMap userConfig; address asset; address userAddress; uint256 amount; InterestRateMode interestRateMode; uint256 reservesCount; address oracle; uint8 userEModeCategory; address priceOracleSentinel; bool isolationModeActive; address isolationModeCollateralAddress; uint256 isolationModeDebtCeiling; } struct ValidateLiquidationCallParams { ReserveCache debtReserveCache; uint256 totalDebt; uint256 healthFactor; address priceOracleSentinel; } struct CalculateInterestRatesParams { uint256 unbacked; uint256 liquidityAdded; uint256 liquidityTaken; uint256 totalDebt; uint256 reserveFactor; address reserve; bool usingVirtualBalance; uint256 virtualUnderlyingBalance; } struct InitReserveParams { address asset; address aTokenAddress; address variableDebtAddress; address interestRateStrategyAddress; uint16 reservesCount; uint16 maxNumberReserves; } }
// 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 { string public constant CALLER_NOT_POOL_ADMIN = '1'; // 'The caller of the function is not a pool admin' string public constant CALLER_NOT_EMERGENCY_ADMIN = '2'; // 'The caller of the function is not an emergency admin' string public constant CALLER_NOT_POOL_OR_EMERGENCY_ADMIN = '3'; // 'The caller of the function is not a pool or emergency admin' string public constant CALLER_NOT_RISK_OR_POOL_ADMIN = '4'; // 'The caller of the function is not a risk or pool admin' string public constant CALLER_NOT_ASSET_LISTING_OR_POOL_ADMIN = '5'; // 'The caller of the function is not an asset listing or pool admin' string public constant CALLER_NOT_BRIDGE = '6'; // 'The caller of the function is not a bridge' string public constant ADDRESSES_PROVIDER_NOT_REGISTERED = '7'; // 'Pool addresses provider is not registered' string public constant INVALID_ADDRESSES_PROVIDER_ID = '8'; // 'Invalid id for the pool addresses provider' string public constant NOT_CONTRACT = '9'; // 'Address is not a contract' string public constant CALLER_NOT_POOL_CONFIGURATOR = '10'; // 'The caller of the function is not the pool configurator' string public constant CALLER_NOT_ATOKEN = '11'; // 'The caller of the function is not an AToken' string public constant INVALID_ADDRESSES_PROVIDER = '12'; // 'The address of the pool addresses provider is invalid' string public constant INVALID_FLASHLOAN_EXECUTOR_RETURN = '13'; // 'Invalid return value of the flashloan executor function' string public constant RESERVE_ALREADY_ADDED = '14'; // 'Reserve has already been added to reserve list' string public constant NO_MORE_RESERVES_ALLOWED = '15'; // 'Maximum amount of reserves in the pool reached' string public constant EMODE_CATEGORY_RESERVED = '16'; // 'Zero eMode category is reserved for volatile heterogeneous assets' string public constant INVALID_EMODE_CATEGORY_ASSIGNMENT = '17'; // 'Invalid eMode category assignment to asset' string public constant RESERVE_LIQUIDITY_NOT_ZERO = '18'; // 'The liquidity of the reserve needs to be 0' string public constant FLASHLOAN_PREMIUM_INVALID = '19'; // 'Invalid flashloan premium' string public constant INVALID_RESERVE_PARAMS = '20'; // 'Invalid risk parameters for the reserve' string public constant INVALID_EMODE_CATEGORY_PARAMS = '21'; // 'Invalid risk parameters for the eMode category' string public constant BRIDGE_PROTOCOL_FEE_INVALID = '22'; // 'Invalid bridge protocol fee' string public constant CALLER_MUST_BE_POOL = '23'; // 'The caller of this function must be a pool' string public constant INVALID_MINT_AMOUNT = '24'; // 'Invalid amount to mint' string public constant INVALID_BURN_AMOUNT = '25'; // 'Invalid amount to burn' string public constant INVALID_AMOUNT = '26'; // 'Amount must be greater than 0' string public constant RESERVE_INACTIVE = '27'; // 'Action requires an active reserve' string public constant RESERVE_FROZEN = '28'; // 'Action cannot be performed because the reserve is frozen' string public constant RESERVE_PAUSED = '29'; // 'Action cannot be performed because the reserve is paused' string public constant BORROWING_NOT_ENABLED = '30'; // 'Borrowing is not enabled' string public constant NOT_ENOUGH_AVAILABLE_USER_BALANCE = '32'; // 'User cannot withdraw more than the available balance' string public constant INVALID_INTEREST_RATE_MODE_SELECTED = '33'; // 'Invalid interest rate mode selected' string public constant COLLATERAL_BALANCE_IS_ZERO = '34'; // 'The collateral balance is 0' string public constant HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = '35'; // 'Health factor is lesser than the liquidation threshold' string public constant COLLATERAL_CANNOT_COVER_NEW_BORROW = '36'; // 'There is not enough collateral to cover a new borrow' string public constant COLLATERAL_SAME_AS_BORROWING_CURRENCY = '37'; // 'Collateral is (mostly) the same currency that is being borrowed' string public constant NO_DEBT_OF_SELECTED_TYPE = '39'; // 'For repayment of a specific type of debt, the user needs to have debt that type' string public constant NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = '40'; // 'To repay on behalf of a user an explicit amount to repay is needed' string public constant NO_OUTSTANDING_VARIABLE_DEBT = '42'; // 'User does not have outstanding variable rate debt on this reserve' string public constant UNDERLYING_BALANCE_ZERO = '43'; // 'The underlying balance needs to be greater than 0' string public constant INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = '44'; // 'Interest rate rebalance conditions were not met' string public constant HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '45'; // 'Health factor is not below the threshold' string public constant COLLATERAL_CANNOT_BE_LIQUIDATED = '46'; // 'The collateral chosen cannot be liquidated' string public constant SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '47'; // 'User did not borrow the specified currency' string public constant INCONSISTENT_FLASHLOAN_PARAMS = '49'; // 'Inconsistent flashloan parameters' string public constant BORROW_CAP_EXCEEDED = '50'; // 'Borrow cap is exceeded' string public constant SUPPLY_CAP_EXCEEDED = '51'; // 'Supply cap is exceeded' string public constant UNBACKED_MINT_CAP_EXCEEDED = '52'; // 'Unbacked mint cap is exceeded' string public constant DEBT_CEILING_EXCEEDED = '53'; // 'Debt ceiling is exceeded' string public constant UNDERLYING_CLAIMABLE_RIGHTS_NOT_ZERO = '54'; // 'Claimable rights over underlying not zero (aToken supply or accruedToTreasury)' string public constant VARIABLE_DEBT_SUPPLY_NOT_ZERO = '56'; // 'Variable debt supply is not zero' string public constant LTV_VALIDATION_FAILED = '57'; // 'Ltv validation failed' string public constant INCONSISTENT_EMODE_CATEGORY = '58'; // 'Inconsistent eMode category' string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' string public constant INVALID_DECIMALS = '66'; // 'Invalid decimals parameter of the underlying asset of the reserve' string public constant INVALID_RESERVE_FACTOR = '67'; // 'Invalid reserve factor parameter for the reserve' string public constant INVALID_BORROW_CAP = '68'; // 'Invalid borrow cap for the reserve' string public constant INVALID_SUPPLY_CAP = '69'; // 'Invalid supply cap for the reserve' string public constant INVALID_LIQUIDATION_PROTOCOL_FEE = '70'; // 'Invalid liquidation protocol fee for the reserve' string public constant INVALID_EMODE_CATEGORY = '71'; // 'Invalid eMode category for the reserve' string public constant INVALID_UNBACKED_MINT_CAP = '72'; // 'Invalid unbacked mint cap for the reserve' string public constant INVALID_DEBT_CEILING = '73'; // 'Invalid debt ceiling for the reserve string public constant INVALID_RESERVE_INDEX = '74'; // 'Invalid reserve index' string public constant ACL_ADMIN_CANNOT_BE_ZERO = '75'; // 'ACL admin cannot be set to the zero address' string public constant INCONSISTENT_PARAMS_LENGTH = '76'; // 'Array parameters that should be equal length are not' string public constant ZERO_ADDRESS_NOT_VALID = '77'; // 'Zero address not valid' string public constant INVALID_EXPIRATION = '78'; // 'Invalid expiration' string public constant INVALID_SIGNATURE = '79'; // 'Invalid signature' string public constant OPERATION_NOT_SUPPORTED = '80'; // 'Operation not supported' string public constant DEBT_CEILING_NOT_ZERO = '81'; // 'Debt ceiling is not zero' string public constant ASSET_NOT_LISTED = '82'; // 'Asset is not listed' string public constant INVALID_OPTIMAL_USAGE_RATIO = '83'; // 'Invalid optimal usage ratio' string public constant UNDERLYING_CANNOT_BE_RESCUED = '85'; // 'The underlying asset cannot be rescued' string public constant ADDRESSES_PROVIDER_ALREADY_ADDED = '86'; // 'Reserve has already been added to reserve list' string public constant POOL_ADDRESSES_DO_NOT_MATCH = '87'; // 'The token implementation pool address and the pool address provided by the initializing pool do not match' string public constant SILOED_BORROWING_VIOLATION = '89'; // 'User is trying to borrow multiple assets including a siloed one' string public constant RESERVE_DEBT_NOT_ZERO = '90'; // the total debt of the reserve needs to be 0 string public constant FLASHLOAN_DISABLED = '91'; // FlashLoaning for this asset is disabled string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' string public constant LIQUIDATION_GRACE_SENTINEL_CHECK_FAILED = '97'; // 'Liquidation grace sentinel validation failed' string public constant INVALID_GRACE_PERIOD = '98'; // Grace period above a valid range string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state string public constant NOT_BORROWABLE_IN_EMODE = '100'; // Asset not borrowable in eMode }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library ConfiguratorInputTypes { struct InitReserveInput { address aTokenImpl; address variableDebtTokenImpl; bool useVirtualBalance; address interestRateStrategyAddress; address underlyingAsset; address treasury; address incentivesController; string aTokenName; string aTokenSymbol; string variableDebtTokenName; string variableDebtTokenSymbol; bytes params; bytes interestRateData; } struct UpdateATokenInput { address asset; address treasury; address incentivesController; string name; string symbol; address implementation; bytes params; } struct UpdateDebtTokenInput { address asset; address incentivesController; string name; string symbol; address implementation; bytes params; } }
// 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; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from '../dependencies/openzeppelin/contracts/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 amount The 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 amount, uint256 index ) external returns (bool); /** * @notice Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying` * @dev In some instances, the mint event could 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 being burned * @param index The next liquidity index of the reserve */ function burn(address from, address receiverOfUnderlying, uint256 amount, uint256 index) external; /** * @notice Mints aTokens to the reserve treasury * @param amount The amount of tokens getting minted * @param index The next liquidity index of the reserve */ function mintToTreasury(uint256 amount, uint256 index) external; /** * @notice Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken * @param from The address getting liquidated, current owner of the aTokens * @param to The recipient * @param value The amount of tokens getting transferred */ function transferOnLiquidation(address from, address to, uint256 value) 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 Handles the underlying received by the aToken after the transfer has been completed. * @dev The default implementation is empty as with standard ERC20 tokens, nothing needs to be done after the * transfer is concluded. However in the future there may be aTokens that allow for example to stake the underlying * to receive LM rewards. In that case, `handleRepayment()` would perform the staking of the underlying asset. * @param user The user executing the repayment * @param onBehalfOf The address of the user who will get his debt reduced/removed * @param amount The amount getting repaid */ function handleRepayment(address user, address onBehalfOf, 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; }
// 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 mintUnbacked() * @param reserve The address of the underlying asset of the reserve * @param user The address initiating the supply * @param onBehalfOf The beneficiary of the supplied assets, receiving the aTokens * @param amount The amount of supplied assets * @param referralCode The referral code used */ event MintUnbacked( address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint16 indexed referralCode ); /** * @dev Emitted on backUnbacked() * @param reserve The address of the underlying asset of the reserve * @param backer The address paying for the backing * @param amount The amount added as backing * @param fee The amount paid in fees */ event BackUnbacked(address indexed reserve, address indexed backer, uint256 amount, uint256 fee); /** * @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 on borrow(), repay() and liquidationCall() when using isolated assets * @param asset The address of the underlying asset of the reserve * @param totalDebt The total isolation mode debt for the reserve */ event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt); /** * @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 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); /** * @notice Mints an `amount` of aTokens to the `onBehalfOf` * @param asset The address of the underlying asset to mint * @param amount The amount to mint * @param onBehalfOf The address that will receive the aTokens * @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 mintUnbacked( address asset, uint256 amount, address onBehalfOf, uint16 referralCode ) external; /** * @notice Back the current unbacked underlying with `amount` and pay `fee`. * @param asset The address of the underlying asset to back * @param amount The amount to back * @param fee The amount paid in fees * @return The backed amount */ function backUnbacked(address asset, uint256 amount, uint256 fee) external returns (uint256); /** * @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 user 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 user, 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 and an * interest rate strategy * @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 * @param interestRateStrategyAddress The address of the interest rate strategy contract */ function initReserve( address asset, address aTokenAddress, address variableDebtAddress, address interestRateStrategyAddress ) external; /** * @notice Drop a reserve * @dev Only callable by the PoolConfigurator contract * @dev Does not reset eMode flags, which must be considered when reusing the same reserve id for a different reserve. * @param asset The address of the underlying asset of the reserve */ function dropReserve(address asset) external; /** * @notice Updates the address of the interest rate strategy contract * @dev Only callable by the PoolConfigurator contract * @param asset The address of the underlying asset of the reserve * @param rateStrategyAddress The address of the interest rate strategy contract */ function setReserveInterestRateStrategyAddress( address asset, address rateStrategyAddress ) 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 state and configuration of the reserve, including extra data included with Aave v3.1 * @dev DEPRECATED use independent getters instead (getReserveData, getLiquidationGracePeriod) * @param asset The address of the underlying asset of the reserve * @return The state and configuration data of the reserve with virtual accounting */ function getReserveDataExtended( address asset ) external view returns (DataTypes.ReserveData 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 amount The amount being transferred/withdrawn * @param balanceFromBefore The aToken balance of the `from` user before the transfer * @param balanceToBefore The aToken balance of the `to` user before the transfer */ function finalizeTransfer( address asset, address from, address to, uint256 amount, uint256 balanceFromBefore, uint256 balanceToBefore ) 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 Updates the protocol fee on the bridging * @param bridgeProtocolFee The part of the premium sent to the protocol treasury */ function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external; /** * @notice Updates flash loan premiums. Flash loan premium consists of two parts: * - A part is sent to aToken holders as extra, one time accumulated interest * - A part is collected by the protocol treasury * @dev The total premium is calculated on the total borrowed amount * @dev The premium to protocol is calculated on the total premium, being a percentage of `flashLoanPremiumTotal` * @dev Only callable by the PoolConfigurator contract * @param flashLoanPremiumTotal The total premium, expressed in bps * @param flashLoanPremiumToProtocol The part of the premium sent to the protocol treasury, expressed in bps */ function updateFlashloanPremiums( uint128 flashLoanPremiumTotal, uint128 flashLoanPremiumToProtocol ) 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 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 * @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 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 Resets the isolation mode total debt of the given asset to zero * @dev It requires the given asset has zero debt ceiling * @param asset The address of the underlying asset to reset the isolationModeTotalDebt */ function resetIsolationModeTotalDebt(address asset) external; /** * @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 returns (uint40); /** * @notice Returns the total fee on flash loans * @return The total fee on flashloans */ function FLASHLOAN_PREMIUM_TOTAL() external view returns (uint128); /** * @notice Returns the part of the bridge fees sent to protocol * @return The bridge fee sent to the protocol treasury */ function BRIDGE_PROTOCOL_FEE() external view returns (uint256); /** * @notice Returns the part of the flashloan fees sent to protocol * @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 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 BridgeLogic */ function getBridgeLogic() external view returns (address); /** * @notice Gets the address of the external EModeLogic */ function getEModeLogic() 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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ConfiguratorInputTypes} from '../protocol/libraries/types/ConfiguratorInputTypes.sol'; import {IDefaultInterestRateStrategyV2} from './IDefaultInterestRateStrategyV2.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 is dropped. * @param asset The address of the underlying asset of the reserve */ event ReserveDropped(address indexed asset); /** * @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 the unbacked mint cap of a reserve is updated. * @param asset The address of the underlying asset of the reserve * @param oldUnbackedMintCap The old unbacked mint cap * @param newUnbackedMintCap The new unbacked mint cap */ event UnbackedMintCapChanged( address indexed asset, uint256 oldUnbackedMintCap, uint256 newUnbackedMintCap ); /** * @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 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 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 debt ceiling of an asset is set. * @param asset The address of the underlying asset of the reserve * @param oldDebtCeiling The old debt ceiling * @param newDebtCeiling The new debt ceiling */ event DebtCeilingChanged(address indexed asset, uint256 oldDebtCeiling, uint256 newDebtCeiling); /** * @dev Emitted when the the siloed borrowing state for an asset is changed. * @param asset The address of the underlying asset of the reserve * @param oldState The old siloed borrowing state * @param newState The new siloed borrowing state */ event SiloedBorrowingChanged(address indexed asset, bool oldState, bool newState); /** * @dev Emitted when the bridge protocol fee is updated. * @param oldBridgeProtocolFee The old protocol fee, expressed in bps * @param newBridgeProtocolFee The new protocol fee, expressed in bps */ event BridgeProtocolFeeUpdated(uint256 oldBridgeProtocolFee, uint256 newBridgeProtocolFee); /** * @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. * @param oldFlashloanPremiumToProtocol The old premium, expressed in bps * @param newFlashloanPremiumToProtocol The new premium, expressed in bps */ event FlashloanPremiumToProtocolUpdated( uint128 oldFlashloanPremiumToProtocol, uint128 newFlashloanPremiumToProtocol ); /** * @dev Emitted when the reserve is set as borrowable/non borrowable in isolation mode. * @param asset The address of the underlying asset of the reserve * @param borrowable True if the reserve is borrowable in isolation, false otherwise */ event BorrowableInIsolationChanged(address asset, bool borrowable); /** * @notice Initializes multiple reserves. * @dev param useVirtualBalance of the input struct should be true for all normal assets and should be false * only in special cases (ex. GHO) where an asset is minted instead of supplied. * @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. * @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 Sets the borrowable in isolation flag for the reserve. * @dev When this flag is set to true, the asset will be borrowable against isolated collaterals and the * borrowed amount will be accumulated in the isolated collateral's total debt exposure * @dev Only assets of the same family (e.g. USD stablecoins) should be borrowable in isolation mode to keep * consistency in the debt ceiling calculations * @param asset The address of the underlying asset of the reserve * @param borrowable True if the asset should be borrowable in isolation, false otherwise */ function setBorrowableInIsolation(address asset, bool borrowable) 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 the interest rate strategy of a reserve. * @param asset The address of the underlying asset of the reserve * @param newRateStrategyAddress The address of the new interest strategy contract * @param rateData bytes-encoded rate data. In this format in order to allow the rate strategy contract * to de-structure custom data */ function setReserveInterestRateStrategyAddress( address asset, address newRateStrategyAddress, bytes calldata rateData ) 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 Updates the unbacked mint cap of reserve. * @param asset The address of the underlying asset of the reserve * @param newUnbackedMintCap The new unbacked mint cap of the reserve */ function setUnbackedMintCap(address asset, uint256 newUnbackedMintCap) external; /** * @notice Enables/disables an asset to be borrowable in a selected eMode. * - eMode.borrowable always has less priority then reserve.borrowable * @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 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 */ function setEModeCategory( uint8 categoryId, uint16 ltv, uint16 liquidationThreshold, uint16 liquidationBonus, string calldata label ) external; /** * @notice Drops a reserve entirely. * @param asset The address of the reserve to drop */ function dropReserve(address asset) external; /** * @notice Updates the bridge fee collected by the protocol reserves. * @param newBridgeProtocolFee The part of the fee sent to the protocol treasury, expressed in bps */ function updateBridgeProtocolFee(uint256 newBridgeProtocolFee) external; /** * @notice Updates the total flash loan premium. * Total flash loan premium consists of two parts: * - A part is sent to aToken holders as extra balance * - A part is collected by the protocol reserves * @dev Expressed in bps * @dev The premium is calculated on the total amount borrowed * @param newFlashloanPremiumTotal The total flashloan premium */ function updateFlashloanPremiumTotal(uint128 newFlashloanPremiumTotal) external; /** * @notice Updates the flash loan premium collected by protocol reserves * @dev Expressed in bps * @dev The premium to protocol is calculated on the total flashloan premium * @param newFlashloanPremiumToProtocol The part of the flashloan premium sent to the protocol treasury */ function updateFlashloanPremiumToProtocol(uint128 newFlashloanPremiumToProtocol) external; /** * @notice Sets the debt ceiling for an asset. * @param newDebtCeiling The new debt ceiling */ function setDebtCeiling(address asset, uint256 newDebtCeiling) external; /** * @notice Sets siloed borrowing for an asset * @param siloed The new siloed borrowing state */ function setSiloedBorrowing(address asset, bool siloed) external; /** * @notice Gets pending ltv value * @param asset The new siloed borrowing state */ function getPendingLtv(address asset) external view returns (uint256); /** * @notice Gets the address of the external ConfiguratorLogic */ function getConfiguratorLogic() external view returns (address); /** * @notice Gets the maximum liquidations grace period allowed, in seconds */ function MAX_GRACE_PERIOD() external view returns (uint40); }
// 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); }
// 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); }
// 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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IPoolAddressesProvider} from './IPoolAddressesProvider.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 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 True if the asset is siloed for borrowing */ 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 The unbacked mint cap of the reserve */ 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 The debt ceiling of the reserve */ function getDebtCeiling(address asset) external view returns (uint256); /** * @notice Returns the debt ceiling decimals * @return The debt ceiling decimals */ 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 if active, false otherwise */ 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); }
// 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); }
// SPDX-License-Identifier: MIT // Chainlink Contracts v0.8 pragma solidity ^0.8.0; interface AggregatorInterface { 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); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ICLSynchronicityPriceAdapter { /** * @notice Calculates the current answer based on the aggregators. * @return int256 latestAnswer */ function latestAnswer() external view returns (int256); /** * @notice Returns the description of the feed * @return string desciption */ function description() external view returns (string memory); /** * @notice Returns the feed decimals * @return uint8 decimals */ function decimals() external view returns (uint8); error DecimalsAboveLimit(); error DecimalsNotEqual(); error RatioOutOfBounds(); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IChainlinkAggregator { function decimals() external view returns (uint8); 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); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); event NewRound(uint256 indexed roundId, address indexed startedBy); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
// 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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IAaveIncentivesController} from './IAaveIncentivesController.sol'; 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 treasury The address of the Aave treasury, receiving the fees on this aToken * @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH) * @param incentivesController The smart contract managing potential incentives distribution * @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 treasury, address underlyingAsset, IAaveIncentivesController incentivesController, uint8 aTokenDecimals, string calldata aTokenName, string calldata aTokenSymbol, bytes calldata params ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title IAaveIncentivesController * @author Aave * @notice Defines the basic interface for an Aave Incentives Controller. * @dev It only contains one single function, needed as a hook on aToken and debtToken transfers. */ interface IAaveIncentivesController { /** * @dev Called by the corresponding asset on transfer hook in order to update the rewards distribution. * @dev The units of `totalSupply` and `userBalance` should be the same. * @param user The address of the user whose asset balance has changed * @param totalSupply The total supply of the asset prior to user balance change * @param userBalance The previous user balance prior to balance change */ function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; }
{ "remappings": [ "aave-helpers/=lib/aave-helpers/", "forge-std/=lib/aave-helpers/lib/forge-std/src/", "aave-address-book/=lib/aave-helpers/lib/aave-address-book/src/", "solidity-utils/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/src/", "lib/aave-helpers:aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/", "aave-v3-origin/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/", "aave-capo/=lib/aave-capo/src/", "lib/aave-capo:cl-synchronicity-price-adapter/=lib/aave-capo/lib/cl-synchronicity-price-adapter/src/", "@openzeppelin/contracts-upgradeable/=lib/aave-capo/lib/aave-helpers/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/aave-capo/lib/aave-helpers/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/", "aave-v3-core/=lib/aave-capo/lib/aave-address-book/lib/aave-v3-origin/src/core/", "aave-v3-origin-tests/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/tests/", "aave-v3-periphery/=lib/aave-capo/lib/aave-address-book/lib/aave-v3-origin/src/periphery/", "cl-synchronicity-price-adapter/=lib/aave-capo/lib/cl-synchronicity-price-adapter/", "ds-test/=lib/aave-capo/lib/cl-synchronicity-price-adapter/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/aave-capo/lib/aave-helpers/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "halmos-cheatcodes/=lib/aave-helpers/lib/aave-address-book/lib/aave-v3-origin/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/", "openzeppelin-contracts-upgradeable/=lib/aave-capo/lib/aave-helpers/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/aave-capo/lib/aave-helpers/lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IPoolDataProvider","name":"poolDataProvider","type":"address"},{"internalType":"contract IAaveV3ConfigEngine","name":"engine","type":"address"},{"internalType":"address","name":"riskCouncil","type":"address"},{"components":[{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"ltv","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationThreshold","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationBonus","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"supplyCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"borrowCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"debtCeiling","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"baseVariableBorrowRate","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope1","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope2","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"optimalUsageRatio","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapLst","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapStable","type":"tuple"}],"internalType":"struct IRiskSteward.Config","name":"riskConfig","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"AssetIsRestricted","type":"error"},{"inputs":[],"name":"DebounceNotRespected","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidCaller","type":"error"},{"inputs":[],"name":"InvalidPriceCapUpdate","type":"error"},{"inputs":[],"name":"InvalidUpdateToZero","type":"error"},{"inputs":[],"name":"NoZeroUpdates","type":"error"},{"inputs":[],"name":"OracleIsRestricted","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ParamChangeNotAllowed","type":"error"},{"inputs":[{"internalType":"int256","name":"value","type":"int256"}],"name":"SafeCastOverflowedIntToUint","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintToInt","type":"error"},{"inputs":[],"name":"UpdateNotAllowed","type":"error"},{"inputs":[],"name":"UpdateNotInRange","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":true,"internalType":"bool","name":"isRestricted","type":"bool"}],"name":"AddressRestricted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"components":[{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"ltv","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationThreshold","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationBonus","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"supplyCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"borrowCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"debtCeiling","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"baseVariableBorrowRate","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope1","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope2","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"optimalUsageRatio","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapLst","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapStable","type":"tuple"}],"indexed":true,"internalType":"struct IRiskSteward.Config","name":"riskConfig","type":"tuple"}],"name":"RiskConfigSet","type":"event"},{"inputs":[],"name":"CONFIG_ENGINE","outputs":[{"internalType":"contract IAaveV3ConfigEngine","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POOL_DATA_PROVIDER","outputs":[{"internalType":"contract IPoolDataProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RISK_COUNCIL","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRiskConfig","outputs":[{"components":[{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"ltv","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationThreshold","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationBonus","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"supplyCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"borrowCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"debtCeiling","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"baseVariableBorrowRate","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope1","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope2","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"optimalUsageRatio","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapLst","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapStable","type":"tuple"}],"internalType":"struct IRiskSteward.Config","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getTimelock","outputs":[{"components":[{"internalType":"uint40","name":"supplyCapLastUpdated","type":"uint40"},{"internalType":"uint40","name":"borrowCapLastUpdated","type":"uint40"},{"internalType":"uint40","name":"ltvLastUpdated","type":"uint40"},{"internalType":"uint40","name":"liquidationBonusLastUpdated","type":"uint40"},{"internalType":"uint40","name":"liquidationThresholdLastUpdated","type":"uint40"},{"internalType":"uint40","name":"debtCeilingLastUpdated","type":"uint40"},{"internalType":"uint40","name":"baseVariableRateLastUpdated","type":"uint40"},{"internalType":"uint40","name":"variableRateSlope1LastUpdated","type":"uint40"},{"internalType":"uint40","name":"variableRateSlope2LastUpdated","type":"uint40"},{"internalType":"uint40","name":"optimalUsageRatioLastUpdated","type":"uint40"},{"internalType":"uint40","name":"priceCapLastUpdated","type":"uint40"}],"internalType":"struct IRiskSteward.Debounce","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"isAddressRestricted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"bool","name":"isRestricted","type":"bool"}],"name":"setAddressRestricted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"ltv","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationThreshold","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"liquidationBonus","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"supplyCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"borrowCap","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"debtCeiling","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"baseVariableBorrowRate","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope1","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"variableRateSlope2","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"optimalUsageRatio","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapLst","type":"tuple"},{"components":[{"internalType":"uint40","name":"minDelay","type":"uint40"},{"internalType":"uint256","name":"maxPercentChange","type":"uint256"}],"internalType":"struct IRiskSteward.RiskParamConfig","name":"priceCapStable","type":"tuple"}],"internalType":"struct IRiskSteward.Config","name":"riskConfig","type":"tuple"}],"name":"setRiskConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"}],"internalType":"struct IAaveV3ConfigEngine.CapsUpdate[]","name":"capsUpdate","type":"tuple[]"}],"name":"updateCaps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"ltv","type":"uint256"},{"internalType":"uint256","name":"liqThreshold","type":"uint256"},{"internalType":"uint256","name":"liqBonus","type":"uint256"},{"internalType":"uint256","name":"debtCeiling","type":"uint256"},{"internalType":"uint256","name":"liqProtocolFee","type":"uint256"}],"internalType":"struct IAaveV3ConfigEngine.CollateralUpdate[]","name":"collateralUpdates","type":"tuple[]"}],"name":"updateCollateralSide","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"oracle","type":"address"},{"components":[{"internalType":"uint104","name":"snapshotRatio","type":"uint104"},{"internalType":"uint48","name":"snapshotTimestamp","type":"uint48"},{"internalType":"uint16","name":"maxYearlyRatioGrowthPercent","type":"uint16"}],"internalType":"struct IPriceCapAdapter.PriceCapUpdateParams","name":"priceCapUpdateParams","type":"tuple"}],"internalType":"struct IRiskSteward.PriceCapLstUpdate[]","name":"priceCapUpdates","type":"tuple[]"}],"name":"updateLstPriceCaps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"components":[{"internalType":"uint256","name":"optimalUsageRatio","type":"uint256"},{"internalType":"uint256","name":"baseVariableBorrowRate","type":"uint256"},{"internalType":"uint256","name":"variableRateSlope1","type":"uint256"},{"internalType":"uint256","name":"variableRateSlope2","type":"uint256"}],"internalType":"struct IAaveV3ConfigEngine.InterestRateInputData","name":"params","type":"tuple"}],"internalType":"struct IAaveV3ConfigEngine.RateStrategyUpdate[]","name":"ratesUpdate","type":"tuple[]"}],"name":"updateRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"oracle","type":"address"},{"internalType":"uint256","name":"priceCap","type":"uint256"}],"internalType":"struct IRiskSteward.PriceCapStableUpdate[]","name":"priceCapUpdates","type":"tuple[]"}],"name":"updateStablePriceCaps","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e060405234801562000010575f80fd5b50604051620034d8380380620034d88339810160408190526200003391620002f5565b33806200005957604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6200006481620001e8565b506001600160a01b0393841660a090815292841660809081529190931660c0908152835180516001805464ffffffffff1990811664ffffffffff938416179091556020928301516002558683015180516003805484169185169190911790558301516004556040870151805160058054841691851691909117905583015160065560608701518051600780548416918516919091179055830151600855938601518051600980548716918416919091179055820151600a55938501518051600b80548616918716919091179055810151600c55908401518051600d80548516918616919091179055810151600e5560e08401518051600f80548516918616919091179055810151601055610100840151805160118054851691861691909117905581015160125561012084015180516013805485169186169190911790558101516014556101408401518051601580548516918616919091179055810151601655610160909301518051601780549093169316929092179055015160185562000462565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200024c575f80fd5b50565b60405161018081016001600160401b03811182821017156200027f57634e487b7160e01b5f52604160045260245ffd5b60405290565b5f6040828403121562000296575f80fd5b604080519081016001600160401b0381118282101715620002c557634e487b7160e01b5f52604160045260245ffd5b8060405250809150825164ffffffffff81168114620002e2575f80fd5b8152602092830151920191909152919050565b5f805f808486036103608112156200030b575f80fd5b8551620003188162000237565b60208701519095506200032b8162000237565b60408701519094506200033e8162000237565b9250610300605f198201121562000353575f80fd5b506200035e6200024f565b6200036d876060880162000285565b81526200037e8760a0880162000285565b6020820152620003928760e0880162000285565b6040820152610120620003a88882890162000285565b6060830152610160620003be89828a0162000285565b6080840152620003d3896101a08a0162000285565b60a0840152620003e8896101e08a0162000285565b60c0840152620003fd896102208a0162000285565b60e084015262000412896102608a0162000285565b61010084015262000428896102a08a0162000285565b828401526200043c896102e08a0162000285565b61014084015262000452896103208a0162000285565b9083015250939692955090935050565b60805160a05160c051613005620004d35f395f81816101370152818161063401528181610695015281816106f201528181610814015261087101525f818161023c01528181610ab401528181610b30015281816115fe015261227f01525f818161019c015261105401526130055ff3fe608060405234801561000f575f80fd5b50600436106100fb575f3560e01c806392ac103e11610093578063bf1e799b11610063578063bf1e799b1461025e578063decec2151461038d578063ec3b79aa146103a0578063f2fde38b146103b3575f80fd5b806392ac103e146101d657806394a85932146101e9578063ab5e16e3146101fc578063ae56764014610237575f80fd5b806355caa163116100ce57806355caa163146101845780635e5eef7a14610197578063715018a6146101be5780638da5cb5b146101c6575f80fd5b806306134fdf146100ff57806309d833281461011d57806311aa1670146101325780632cd77b8014610171575b5f80fd5b6101076103c6565b60405161011491906124d4565b60405180910390f35b61013061012b366004612640565b610632565b005b6101597f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610114565b61013061017f3660046126af565b610693565b61013061019236600461270c565b6106f0565b6101597f000000000000000000000000000000000000000000000000000000000000000081565b61013061074d565b5f546001600160a01b0316610159565b6101306101e4366004612769565b610760565b6101306101f73660046127a1565b6107b7565b61022761020a3660046127d8565b6001600160a01b03165f908152601a602052604090205460ff1690565b6040519015158152602001610114565b6101597f000000000000000000000000000000000000000000000000000000000000000081565b61038061026c3660046127d8565b60408051610160810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810191909152506001600160a01b03165f90815260196020908152604091829020825161016081018452815464ffffffffff8082168352600160281b808304821695840195909552600160501b808304821696840196909652600160781b80830482166060850152600160a01b80840483166080860152600160c81b909304821660a085015260019094015480821660c0850152948504811660e084015294840485166101008301529183048416610120820152910490911661014082015290565b60405161011491906127f3565b61013061039b3660046128e9565b610812565b6101306103ae366004612946565b61086f565b6101306103c13660046127d8565b6108cc565b6104d7604080516101c0810182525f61018082018181526101a0830182905282528251808401845281815260208082018390528084019190915283518085018552828152808201839052838501528351808501855282815280820183905260608401528351808501855282815280820183905260808401528351808501855282815280820183905260a08401528351808501855282815280820183905260c08401528351808501855282815280820183905260e084015283518085018552828152808201839052610100840152835180850185528281528082018390526101208401528351808501855282815280820183905261014084015283518085019094528184528301529061016082015290565b50604080516101c08101825260015464ffffffffff90811661018083019081526002546101a084015282528251808401845260035482168152600454602082810191909152808401919091528351808501855260055483168152600654818301528385015283518085018552600754831681526008548183015260608401528351808501855260095483168152600a5481830152608084015283518085018552600b5483168152600c548183015260a084015283518085018552600d5483168152600e548183015260c084015283518085018552600f54831681526010548183015260e0840152835180850185526011548316815260125481830152610100840152835180850185526013548316815260145481830152610120840152835180850185526015548316815260165481830152610140840152835180850190945260175490911683526018549083015261016081019190915290565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316331461067b576040516348f5c3ed60e01b815260040160405180910390fd5b610685828261090e565b61068f8282610e2d565b5050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146106dc576040516348f5c3ed60e01b815260040160405180910390fd5b6106e6828261107a565b61068f82826113ab565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163314610739576040516348f5c3ed60e01b815260040160405180910390fd5b6107438282611509565b61068f82826117d8565b6107556118f6565b61075e5f611922565b565b6107686118f6565b80600161077582826129e4565b5050604051610785908290612acc565b604051908190038120907f35806af6c047aee07a019c95dd9cd844300bad6982aaeb6a6eafb9f73a4d7d1f905f90a250565b6107bf6118f6565b6001600160a01b0382165f818152601a6020526040808220805460ff191685151590811790915590519092917f3b34bc5a3a5e9ef38a88db81f0fb7baf5fbeb0cd6b571745d2d567e99b538bc991a35050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316331461085b576040516348f5c3ed60e01b815260040160405180910390fd5b6108658282611971565b61068f8282611c5c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146108b8576040516348f5c3ed60e01b815260040160405180910390fd5b6108c28282611e57565b61068f8282612026565b6108d46118f6565b6001600160a01b03811661090257604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61090b81611922565b50565b5f81900361092f5760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f83838381811061094c5761094c612b6c565b61096292602060c09092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff161561099e5760405163a7a64f0d60e01b815260040160405180910390fd5b6109aa602a5f19612b94565b8484848181106109bc576109bc612b6c565b905060c0020160a00135146109e457604051630c2e0be960e11b815260040160405180910390fd5b8383838181106109f6576109f6612b6c565b905060c00201602001355f1480610a275750838383818110610a1a57610a1a612b6c565b905060c00201604001355f145b80610a4c5750838383818110610a3f57610a3f612b6c565b905060c00201606001355f145b80610a715750838383818110610a6457610a64612b6c565b905060c00201608001355f145b15610a8f57604051637e475a0b60e01b815260040160405180910390fd5b604051633e15014160e01b81526001600160a01b0382811660048301525f91829182917f000000000000000000000000000000000000000000000000000000000000000090911690633e1501419060240161014060405180830381865afa158015610afc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b209190612ba7565b505050505050935093509350505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633c798109866040518263ffffffff1660e01b8152600401610b8991906001600160a01b0391909116815260200190565b602060405180830381865afa158015610ba4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bc89190612c48565b9050610c576040518060a001604052808681526020018a8a8a818110610bf057610bf0612b6c565b602060c0909102929092018201358352506001600160a01b0389165f9081526019825260408082205464ffffffffff600160501b90910481168585015281518083018352600154909116815260025493810193909352830191909152606090910152612115565b610ce66040518060a001604052808581526020018a8a8a818110610c7d57610c7d612b6c565b604060c0909102929092018201358352506001600160a01b0389165f908152601960209081528282205464ffffffffff600160a01b9091048116828601528351808501855260035490911681526004549181019190915291830191909152606090910152612115565b610d7d6040518060a0016040528061271085610d029190612b94565b81526020018a8a8a818110610d1957610d19612b6c565b606060c0909102929092018201358352506001600160a01b0389165f9081526019602090815260408083205464ffffffffff600160781b90910481168387015281518083018352600554909116815260065492810192909252840152910152612115565b610e176040518060a00160405280606484610d989190612c5f565b81526020018a8a8a818110610daf57610daf612b6c565b60c00291909101608001358252506001600160a01b0388165f9081526019602090815260409182902054600160c81b900464ffffffffff9081168285015282518084018452600b549091168152600c5491810191909152908201526001606090910152612115565b505060019093019250610931915050565b505050565b5f5b81811015610ff7575f838383818110610e4a57610e4a612b6c565b610e6092602060c09092020190810191506127d8565b9050610e6e602a5f19612b94565b848484818110610e8057610e80612b6c565b905060c002016020013514610ec5576001600160a01b0381165f908152601960205260409020805464ffffffffff60501b1916600160501b4264ffffffffff16021790555b610ed1602a5f19612b94565b848484818110610ee357610ee3612b6c565b905060c002016040013514610f28576001600160a01b0381165f908152601960205260409020805464ffffffffff60a01b1916600160a01b4264ffffffffff16021790555b610f34602a5f19612b94565b848484818110610f4657610f46612b6c565b905060c002016060013514610f8b576001600160a01b0381165f908152601960205260409020805464ffffffffff60781b1916600160781b4264ffffffffff16021790555b610f97602a5f19612b94565b848484818110610fa957610fa9612b6c565b905060c002016080013514610fee576001600160a01b0381165f908152601960205260409020805464ffffffffff60c81b1916600160c81b4264ffffffffff16021790555b50600101610e2f565b50604051610e289063013b066560e31b906110189085908590602401612c7e565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906121a8565b5f81900361109b5760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f8383838181106110b8576110b8612b6c565b6110ce92602060809092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff161561110a57604051630346c27b60e41b815260040160405180910390fd5b83838381811061111c5761111c612b6c565b6111359260406080909202019081019150602001612d19565b6001600160681b0316158061117a575083838381811061115757611157612b6c565b6111709260606080909202019081019150604001612d47565b65ffffffffffff16155b806111af575083838381811061119257611192612b6c565b6111a9926080918202019081019150606001612d6f565b61ffff16155b156111cd57604051637e475a0b60e01b815260040160405180910390fd5b5f816001600160a01b031663caa4cdcf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061122e9190612c48565b90505f6112a161129c846001600160a01b031663ec1ebd7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611273573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112979190612c48565b61221c565b612245565b9050806001600160681b03168686868181106112bf576112bf612b6c565b6112d89260406080909202019081019150602001612d19565b6001600160681b031611156113005760405163c7b8653960e01b815260040160405180910390fd5b6113a06040518060a0016040528084815260200188888881811061132657611326612b6c565b61133d926080918202019081019150606001612d6f565b61ffff1681526001600160a01b0386165f9081526019602090815260409182902060019081015464ffffffffff600160a01b9091048116838601528351808501855260155490911681526016549281019290925291830152606090910152612115565b50505060010161109d565b5f5b81811015610e28575f8383838181106113c8576113c8612b6c565b6113de92602060809092020190810191506127d8565b6001600160a01b0381165f818152601960205260409020600101805464ffffffffff60a01b1916600160a01b4264ffffffffff160217905590915063c1b8c2e085858581811061143057611430612b6c565b9050608002016020016040518263ffffffff1660e01b81526004016114559190612d8a565b5f604051808303815f87803b15801561146c575f80fd5b505af115801561147e573d5f803e3d5ffd5b50505050806001600160a01b031663671528d46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114be573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114e29190612dda565b1561150057604051630408a0d560e21b815260040160405180910390fd5b506001016113ad565b5f81900361152a5760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f83838381811061154757611547612b6c565b61155d92602060609092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff16156115995760405163a7a64f0d60e01b815260040160405180910390fd5b8383838181106115ab576115ab612b6c565b905060600201602001355f14806115dc57508383838181106115cf576115cf612b6c565b905060600201604001355f145b156115fa57604051637e475a0b60e01b815260040160405180910390fd5b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166346fbe55887878781811061163d5761163d612b6c565b61165392602060609092020190810191506127d8565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024016040805180830381865afa158015611694573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116b89190612df5565b915091506117406040518060a001604052808381526020018888888181106116e2576116e2612b6c565b60609081029290920160209081013584526001600160a01b0389165f908152601982526040908190205464ffffffffff9081168684015281518083018352600754909116815260085492810192909252840152506001910152612115565b6117cd6040518060a0016040528084815260200188888881811061176657611766612b6c565b60609081029290920160409081013584526001600160a01b0389165f908152601960209081529082902054600160281b900464ffffffffff90811682870152825180840184526009549091168152600a549181019190915290840152506001910152612115565b50505060010161152c565b5f5b818110156118d5575f8383838181106117f5576117f5612b6c565b61180b92602060609092020190810191506127d8565b9050611819602a5f19612b94565b84848481811061182b5761182b612b6c565b9050606002016020013514611867576001600160a01b0381165f908152601960205260409020805464ffffffffff19164264ffffffffff161790555b611873602a5f19612b94565b84848481811061188557611885612b6c565b90506060020160400135146118cc576001600160a01b0381165f908152601960205260409020805469ffffffffff00000000001916600160281b4264ffffffffff16021790555b506001016117da565b50604051610e28906355caa16360e01b906110189085908590602401612e17565b5f546001600160a01b0316331461075e5760405163118cdaa760e01b81523360048201526024016108f9565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f8190036119925760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f8383838181106119af576119af612b6c565b6119c592602060a09092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff1615611a015760405163a7a64f0d60e01b815260040160405180910390fd5b5f805f80611a0e85612278565b9350935093509350611aa66040518060a001604052808681526020018a8a8a818110611a3c57611a3c612b6c565b602060a0909102929092018201358352506001600160a01b0389165f9081526019825260408082206001015464ffffffffff600160781b90910481168585015281518083018352601354909116815260145493810193909352830191909152606090910152612115565b611b316040518060a001604052808581526020018a8a8a818110611acc57611acc612b6c565b604060a0909102929092018201358352506001600160a01b0389165f908152601960209081528282206001015464ffffffffff9081168583015283518085018552600d549091168152600e549181019190915291830191909152606090910152612115565b611bbe6040518060a001604052808481526020018a8a8a818110611b5757611b57612b6c565b606060a0909102929092018201358352506001600160a01b0389165f9081526019602090815260408083206001015464ffffffffff600160281b90910481168684015281518083018352600f54909116815260105492810192909252840152910152612115565b611c4b6040518060a001604052808381526020018a8a8a818110611be457611be4612b6c565b60a00291909101608001358252506001600160a01b0388165f90815260196020908152604080832060010154600160501b900464ffffffffff9081168386015281518083018352601154909116815260125492810192909252830152606090910152612115565b505060019093019250611994915050565b5f5b81811015611e36575f838383818110611c7957611c79612b6c565b611c8f92602060a09092020190810191506127d8565b9050611c9d602a5f19612b94565b848484818110611caf57611caf612b6c565b905060a002016020015f013514611cf9576001600160a01b0381165f908152601960205260409020600101805464ffffffffff60781b1916600160781b4264ffffffffff16021790555b611d05602a5f19612b94565b848484818110611d1757611d17612b6c565b905060a002016020016020013514611d59576001600160a01b0381165f908152601960205260409020600101805464ffffffffff19164264ffffffffff161790555b611d65602a5f19612b94565b848484818110611d7757611d77612b6c565b905060a002016020016040013514611dc4576001600160a01b0381165f908152601960205260409020600101805469ffffffffff00000000001916600160281b4264ffffffffff16021790555b611dd0602a5f19612b94565b848484818110611de257611de2612b6c565b905060a002016020016060013514611e2d576001600160a01b0381165f908152601960205260409020600101805464ffffffffff60501b1916600160501b4264ffffffffff16021790555b50600101611c5e565b50604051610e289063b79421eb60e01b906110189085908590602401612e6c565b5f819003611e785760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f838383818110611e9557611e95612b6c565b611eab92602060409092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff1615611ee757604051630346c27b60e41b815260040160405180910390fd5b838383818110611ef957611ef9612b6c565b905060400201602001355f03611f2257604051637e475a0b60e01b815260040160405180910390fd5b5f816001600160a01b0316634c7afe606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f5f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f839190612c48565b905061201c6040518060a00160405280611f9c8461221c565b8152602001878787818110611fb357611fb3612b6c565b60409081029290920160209081013584526001600160a01b0388165f90815260198252839020600190810154600160a01b900464ffffffffff90811686840152845180860186526017549091168152601854928101929092529284015250606090910152612115565b5050600101611e7a565b5f5b81811015610e28575f83838381811061204357612043612b6c565b61205992602060409092020190810191506127d8565b6001600160a01b0381165f818152601960205260409020600101805464ffffffffff60a01b1916600160a01b4264ffffffffff160217905590915063030c96c06120bd8686868181106120ae576120ae612b6c565b905060400201602001356123b6565b6040518263ffffffff1660e01b81526004016120db91815260200190565b5f604051808303815f87803b1580156120f2575f80fd5b505af1158015612104573d5f803e3d5ffd5b505060019093019250612028915050565b612121602a5f19612b94565b81602001510361212e5750565b606081015151604082015164ffffffffff9182169161214e911642612b94565b101561216c5760405162ab607360e81b815260040160405180910390fd5b61218b815f0151826020015183606001516020015184608001516123e2565b61090b5760405163c7b8653960e01b815260040160405180910390fd5b60605f80846001600160a01b0316846040516121c49190612ed5565b5f60405180830381855af49150503d805f81146121fc576040519150601f19603f3d011682016040523d82523d5f602084013e612201565b606091505b509150915061221185838361244c565b925050505b92915050565b5f8082121561224157604051635467221960e11b8152600481018390526024016108f9565b5090565b5f6001600160681b03821115612241576040516306dfcc6560e41b815260686004820152602481018390526044016108f9565b5f805f805f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636744362a876040518263ffffffff1660e01b81526004016122d891906001600160a01b0391909116815260200190565b602060405180830381865afa1580156122f3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123179190612f01565b6040516363ce721760e11b81526001600160a01b0388811660048301529192505f9183169063c79ce42e90602401608060405180830381865afa158015612360573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123849190612f2f565b80516020820151604083015160609093015161ffff9092169a63ffffffff9182169a5092811698501695509350505050565b5f6001600160ff1b038211156122415760405163123baf0360e11b8152600481018390526024016108f9565b5f808486116123fa576123f58686612b94565b612404565b6124048587612b94565b90505f836124125784612429565b61271061241f8887612fb8565b6124299190612c5f565b90508082111561243d575f92505050612444565b6001925050505b949350505050565b6060826124615761245c826124ab565b6124a4565b815115801561247857506001600160a01b0384163b155b156124a157604051639996b31560e01b81526001600160a01b03851660048201526024016108f9565b50805b9392505050565b8051156124bb5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b8151805164ffffffffff168252602090810151908201526103008101602083810151805164ffffffffff166040850152908101516060840152506040830151805164ffffffffff166080840152602081015160a0840152506060830151805164ffffffffff1660c0840152602081015160e084015250608083015161010061256f81850183805164ffffffffff168252602090810151910152565b60a0850151915061014061259681860184805164ffffffffff168252602090810151910152565b60c0860151805164ffffffffff9081166101808801526020918201516101a088015260e0880151805182166101c08901528201516101e08801529287015180518416610200880152810151610220870152610120870151805184166102408801528101516102608701529086015180519092166102808601528101516102a08501529050506101609290920151805164ffffffffff166102c0830152602001516102e09091015290565b5f8060208385031215612651575f80fd5b823567ffffffffffffffff80821115612668575f80fd5b818501915085601f83011261267b575f80fd5b813581811115612689575f80fd5b86602060c08302850101111561269d575f80fd5b60209290920196919550909350505050565b5f80602083850312156126c0575f80fd5b823567ffffffffffffffff808211156126d7575f80fd5b818501915085601f8301126126ea575f80fd5b8135818111156126f8575f80fd5b8660208260071b850101111561269d575f80fd5b5f806020838503121561271d575f80fd5b823567ffffffffffffffff80821115612734575f80fd5b818501915085601f830112612747575f80fd5b813581811115612755575f80fd5b86602060608302850101111561269d575f80fd5b5f610300828403121561277a575f80fd5b50919050565b6001600160a01b038116811461090b575f80fd5b801515811461090b575f80fd5b5f80604083850312156127b2575f80fd5b82356127bd81612780565b915060208301356127cd81612794565b809150509250929050565b5f602082840312156127e8575f80fd5b81356124a481612780565b815164ffffffffff1681526101608101602083015161281b602084018264ffffffffff169052565b506040830151612834604084018264ffffffffff169052565b50606083015161284d606084018264ffffffffff169052565b506080830151612866608084018264ffffffffff169052565b5060a083015161287f60a084018264ffffffffff169052565b5060c083015161289860c084018264ffffffffff169052565b5060e08301516128b160e084018264ffffffffff169052565b506101008381015164ffffffffff90811691840191909152610120808501518216908401526101409384015116929091019190915290565b5f80602083850312156128fa575f80fd5b823567ffffffffffffffff80821115612911575f80fd5b818501915085601f830112612924575f80fd5b813581811115612932575f80fd5b86602060a08302850101111561269d575f80fd5b5f8060208385031215612957575f80fd5b823567ffffffffffffffff8082111561296e575f80fd5b818501915085601f830112612981575f80fd5b81358181111561298f575f80fd5b8660208260061b850101111561269d575f80fd5b64ffffffffff8116811461090b575f80fd5b81356129c0816129a3565b64ffffffffff811664ffffffffff1983541617825550602082013560018201555050565b6129ee82826129b5565b6129fe60408301600283016129b5565b612a0e60808301600483016129b5565b612a1e60c08301600683016129b5565b612a2f6101008301600883016129b5565b612a406101408301600a83016129b5565b612a516101808301600c83016129b5565b612a626101c08301600e83016129b5565b612a736102008301601083016129b5565b612a846102408301601283016129b5565b612a956102808301601483016129b5565b61068f6102c08301601683016129b5565b5f8135612ab2816129a3565b64ffffffffff168352506020908101359082015260400190565b612b62612b58612b4e612b44612b3a612b30612b26612b1c612b12612b09612b00612af78c8e612aa6565b60408e01612aa6565b60808d01612aa6565b60c08c01612aa6565b6101008b01612aa6565b6101408a01612aa6565b6101808901612aa6565b6101c08801612aa6565b6102008701612aa6565b6102408601612aa6565b6102808501612aa6565b6102c08401612aa6565b5061030001919050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8181038181111561221657612216612b80565b5f805f805f805f805f806101408b8d031215612bc1575f80fd5b8a51995060208b0151985060408b0151975060608b0151965060808b0151955060a08b0151612bef81612794565b60c08c0151909550612c0081612794565b60e08c0151909450612c1181612794565b6101008c0151909350612c2381612794565b6101208c0151909250612c3581612794565b809150509295989b9194979a5092959850565b5f60208284031215612c58575f80fd5b5051919050565b5f82612c7957634e487b7160e01b5f52601260045260245ffd5b500490565b60208082528181018390525f90604080840186845b87811015612cf1578135612ca681612780565b6001600160a01b0316835281850135858401528382013584840152606080830135908401526080808301359084015260a0828101359084015260c09283019290910190600101612c93565b5090979650505050505050565b80356001600160681b0381168114612d14575f80fd5b919050565b5f60208284031215612d29575f80fd5b6124a482612cfe565b803565ffffffffffff81168114612d14575f80fd5b5f60208284031215612d57575f80fd5b6124a482612d32565b61ffff8116811461090b575f80fd5b5f60208284031215612d7f575f80fd5b81356124a481612d60565b606081016001600160681b03612d9f84612cfe565b16825265ffffffffffff612db560208501612d32565b1660208301526040830135612dc981612d60565b61ffff811660408401525092915050565b5f60208284031215612dea575f80fd5b81516124a481612794565b5f8060408385031215612e06575f80fd5b505080516020909101519092909150565b60208082528181018390525f90604080840186845b87811015612cf1578135612e3f81612780565b6001600160a01b031683528185013585840152838201358484015260609283019290910190600101612e2c565b60208082528181018390525f90604080840186845b87811015612cf1578135612e9481612780565b6001600160a01b0316835284820135858401528382013584840152606080830135908401526080808301359084015260a09283019290910190600101612e81565b5f82515f5b81811015612ef45760208186018101518583015201612eda565b505f920191825250919050565b5f60208284031215612f11575f80fd5b81516124a481612780565b805163ffffffff81168114612d14575f80fd5b5f60808284031215612f3f575f80fd5b6040516080810181811067ffffffffffffffff82111715612f6e57634e487b7160e01b5f52604160045260245ffd5b6040528251612f7c81612d60565b8152612f8a60208401612f1c565b6020820152612f9b60408401612f1c565b6040820152612fac60608401612f1c565b60608201529392505050565b808202811582820484141761221657612216612b8056fea2646970667358221220859801d499d58f7054e09b411651322fab28fa7d02cb9150acc1d184d81f0b8d64736f6c63430008160033000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b9000000000000000000000000a119f84bc1b8083f5061e4cf53705cbf1065ba270000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d04000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000003f480000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106100fb575f3560e01c806392ac103e11610093578063bf1e799b11610063578063bf1e799b1461025e578063decec2151461038d578063ec3b79aa146103a0578063f2fde38b146103b3575f80fd5b806392ac103e146101d657806394a85932146101e9578063ab5e16e3146101fc578063ae56764014610237575f80fd5b806355caa163116100ce57806355caa163146101845780635e5eef7a14610197578063715018a6146101be5780638da5cb5b146101c6575f80fd5b806306134fdf146100ff57806309d833281461011d57806311aa1670146101325780632cd77b8014610171575b5f80fd5b6101076103c6565b60405161011491906124d4565b60405180910390f35b61013061012b366004612640565b610632565b005b6101597f0000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d0481565b6040516001600160a01b039091168152602001610114565b61013061017f3660046126af565b610693565b61013061019236600461270c565b6106f0565b6101597f000000000000000000000000a119f84bc1b8083f5061e4cf53705cbf1065ba2781565b61013061074d565b5f546001600160a01b0316610159565b6101306101e4366004612769565b610760565b6101306101f73660046127a1565b6107b7565b61022761020a3660046127d8565b6001600160a01b03165f908152601a602052604090205460ff1690565b6040519015158152602001610114565b6101597f000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b981565b61038061026c3660046127d8565b60408051610160810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810191909152506001600160a01b03165f90815260196020908152604091829020825161016081018452815464ffffffffff8082168352600160281b808304821695840195909552600160501b808304821696840196909652600160781b80830482166060850152600160a01b80840483166080860152600160c81b909304821660a085015260019094015480821660c0850152948504811660e084015294840485166101008301529183048416610120820152910490911661014082015290565b60405161011491906127f3565b61013061039b3660046128e9565b610812565b6101306103ae366004612946565b61086f565b6101306103c13660046127d8565b6108cc565b6104d7604080516101c0810182525f61018082018181526101a0830182905282528251808401845281815260208082018390528084019190915283518085018552828152808201839052838501528351808501855282815280820183905260608401528351808501855282815280820183905260808401528351808501855282815280820183905260a08401528351808501855282815280820183905260c08401528351808501855282815280820183905260e084015283518085018552828152808201839052610100840152835180850185528281528082018390526101208401528351808501855282815280820183905261014084015283518085019094528184528301529061016082015290565b50604080516101c08101825260015464ffffffffff90811661018083019081526002546101a084015282528251808401845260035482168152600454602082810191909152808401919091528351808501855260055483168152600654818301528385015283518085018552600754831681526008548183015260608401528351808501855260095483168152600a5481830152608084015283518085018552600b5483168152600c548183015260a084015283518085018552600d5483168152600e548183015260c084015283518085018552600f54831681526010548183015260e0840152835180850185526011548316815260125481830152610100840152835180850185526013548316815260145481830152610120840152835180850185526015548316815260165481830152610140840152835180850190945260175490911683526018549083015261016081019190915290565b7f0000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d046001600160a01b0316331461067b576040516348f5c3ed60e01b815260040160405180910390fd5b610685828261090e565b61068f8282610e2d565b5050565b7f0000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d046001600160a01b031633146106dc576040516348f5c3ed60e01b815260040160405180910390fd5b6106e6828261107a565b61068f82826113ab565b7f0000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d046001600160a01b03163314610739576040516348f5c3ed60e01b815260040160405180910390fd5b6107438282611509565b61068f82826117d8565b6107556118f6565b61075e5f611922565b565b6107686118f6565b80600161077582826129e4565b5050604051610785908290612acc565b604051908190038120907f35806af6c047aee07a019c95dd9cd844300bad6982aaeb6a6eafb9f73a4d7d1f905f90a250565b6107bf6118f6565b6001600160a01b0382165f818152601a6020526040808220805460ff191685151590811790915590519092917f3b34bc5a3a5e9ef38a88db81f0fb7baf5fbeb0cd6b571745d2d567e99b538bc991a35050565b7f0000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d046001600160a01b0316331461085b576040516348f5c3ed60e01b815260040160405180910390fd5b6108658282611971565b61068f8282611c5c565b7f0000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d046001600160a01b031633146108b8576040516348f5c3ed60e01b815260040160405180910390fd5b6108c28282611e57565b61068f8282612026565b6108d46118f6565b6001600160a01b03811661090257604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61090b81611922565b50565b5f81900361092f5760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f83838381811061094c5761094c612b6c565b61096292602060c09092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff161561099e5760405163a7a64f0d60e01b815260040160405180910390fd5b6109aa602a5f19612b94565b8484848181106109bc576109bc612b6c565b905060c0020160a00135146109e457604051630c2e0be960e11b815260040160405180910390fd5b8383838181106109f6576109f6612b6c565b905060c00201602001355f1480610a275750838383818110610a1a57610a1a612b6c565b905060c00201604001355f145b80610a4c5750838383818110610a3f57610a3f612b6c565b905060c00201606001355f145b80610a715750838383818110610a6457610a64612b6c565b905060c00201608001355f145b15610a8f57604051637e475a0b60e01b815260040160405180910390fd5b604051633e15014160e01b81526001600160a01b0382811660048301525f91829182917f000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b990911690633e1501419060240161014060405180830381865afa158015610afc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b209190612ba7565b505050505050935093509350505f7f000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b96001600160a01b0316633c798109866040518263ffffffff1660e01b8152600401610b8991906001600160a01b0391909116815260200190565b602060405180830381865afa158015610ba4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bc89190612c48565b9050610c576040518060a001604052808681526020018a8a8a818110610bf057610bf0612b6c565b602060c0909102929092018201358352506001600160a01b0389165f9081526019825260408082205464ffffffffff600160501b90910481168585015281518083018352600154909116815260025493810193909352830191909152606090910152612115565b610ce66040518060a001604052808581526020018a8a8a818110610c7d57610c7d612b6c565b604060c0909102929092018201358352506001600160a01b0389165f908152601960209081528282205464ffffffffff600160a01b9091048116828601528351808501855260035490911681526004549181019190915291830191909152606090910152612115565b610d7d6040518060a0016040528061271085610d029190612b94565b81526020018a8a8a818110610d1957610d19612b6c565b606060c0909102929092018201358352506001600160a01b0389165f9081526019602090815260408083205464ffffffffff600160781b90910481168387015281518083018352600554909116815260065492810192909252840152910152612115565b610e176040518060a00160405280606484610d989190612c5f565b81526020018a8a8a818110610daf57610daf612b6c565b60c00291909101608001358252506001600160a01b0388165f9081526019602090815260409182902054600160c81b900464ffffffffff9081168285015282518084018452600b549091168152600c5491810191909152908201526001606090910152612115565b505060019093019250610931915050565b505050565b5f5b81811015610ff7575f838383818110610e4a57610e4a612b6c565b610e6092602060c09092020190810191506127d8565b9050610e6e602a5f19612b94565b848484818110610e8057610e80612b6c565b905060c002016020013514610ec5576001600160a01b0381165f908152601960205260409020805464ffffffffff60501b1916600160501b4264ffffffffff16021790555b610ed1602a5f19612b94565b848484818110610ee357610ee3612b6c565b905060c002016040013514610f28576001600160a01b0381165f908152601960205260409020805464ffffffffff60a01b1916600160a01b4264ffffffffff16021790555b610f34602a5f19612b94565b848484818110610f4657610f46612b6c565b905060c002016060013514610f8b576001600160a01b0381165f908152601960205260409020805464ffffffffff60781b1916600160781b4264ffffffffff16021790555b610f97602a5f19612b94565b848484818110610fa957610fa9612b6c565b905060c002016080013514610fee576001600160a01b0381165f908152601960205260409020805464ffffffffff60c81b1916600160c81b4264ffffffffff16021790555b50600101610e2f565b50604051610e289063013b066560e31b906110189085908590602401612c7e565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526001600160a01b037f000000000000000000000000a119f84bc1b8083f5061e4cf53705cbf1065ba2716906121a8565b5f81900361109b5760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f8383838181106110b8576110b8612b6c565b6110ce92602060809092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff161561110a57604051630346c27b60e41b815260040160405180910390fd5b83838381811061111c5761111c612b6c565b6111359260406080909202019081019150602001612d19565b6001600160681b0316158061117a575083838381811061115757611157612b6c565b6111709260606080909202019081019150604001612d47565b65ffffffffffff16155b806111af575083838381811061119257611192612b6c565b6111a9926080918202019081019150606001612d6f565b61ffff16155b156111cd57604051637e475a0b60e01b815260040160405180910390fd5b5f816001600160a01b031663caa4cdcf6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061122e9190612c48565b90505f6112a161129c846001600160a01b031663ec1ebd7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611273573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112979190612c48565b61221c565b612245565b9050806001600160681b03168686868181106112bf576112bf612b6c565b6112d89260406080909202019081019150602001612d19565b6001600160681b031611156113005760405163c7b8653960e01b815260040160405180910390fd5b6113a06040518060a0016040528084815260200188888881811061132657611326612b6c565b61133d926080918202019081019150606001612d6f565b61ffff1681526001600160a01b0386165f9081526019602090815260409182902060019081015464ffffffffff600160a01b9091048116838601528351808501855260155490911681526016549281019290925291830152606090910152612115565b50505060010161109d565b5f5b81811015610e28575f8383838181106113c8576113c8612b6c565b6113de92602060809092020190810191506127d8565b6001600160a01b0381165f818152601960205260409020600101805464ffffffffff60a01b1916600160a01b4264ffffffffff160217905590915063c1b8c2e085858581811061143057611430612b6c565b9050608002016020016040518263ffffffff1660e01b81526004016114559190612d8a565b5f604051808303815f87803b15801561146c575f80fd5b505af115801561147e573d5f803e3d5ffd5b50505050806001600160a01b031663671528d46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114be573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114e29190612dda565b1561150057604051630408a0d560e21b815260040160405180910390fd5b506001016113ad565b5f81900361152a5760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f83838381811061154757611547612b6c565b61155d92602060609092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff16156115995760405163a7a64f0d60e01b815260040160405180910390fd5b8383838181106115ab576115ab612b6c565b905060600201602001355f14806115dc57508383838181106115cf576115cf612b6c565b905060600201604001355f145b156115fa57604051637e475a0b60e01b815260040160405180910390fd5b5f807f000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b96001600160a01b03166346fbe55887878781811061163d5761163d612b6c565b61165392602060609092020190810191506127d8565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024016040805180830381865afa158015611694573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116b89190612df5565b915091506117406040518060a001604052808381526020018888888181106116e2576116e2612b6c565b60609081029290920160209081013584526001600160a01b0389165f908152601982526040908190205464ffffffffff9081168684015281518083018352600754909116815260085492810192909252840152506001910152612115565b6117cd6040518060a0016040528084815260200188888881811061176657611766612b6c565b60609081029290920160409081013584526001600160a01b0389165f908152601960209081529082902054600160281b900464ffffffffff90811682870152825180840184526009549091168152600a549181019190915290840152506001910152612115565b50505060010161152c565b5f5b818110156118d5575f8383838181106117f5576117f5612b6c565b61180b92602060609092020190810191506127d8565b9050611819602a5f19612b94565b84848481811061182b5761182b612b6c565b9050606002016020013514611867576001600160a01b0381165f908152601960205260409020805464ffffffffff19164264ffffffffff161790555b611873602a5f19612b94565b84848481811061188557611885612b6c565b90506060020160400135146118cc576001600160a01b0381165f908152601960205260409020805469ffffffffff00000000001916600160281b4264ffffffffff16021790555b506001016117da565b50604051610e28906355caa16360e01b906110189085908590602401612e17565b5f546001600160a01b0316331461075e5760405163118cdaa760e01b81523360048201526024016108f9565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f8190036119925760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f8383838181106119af576119af612b6c565b6119c592602060a09092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff1615611a015760405163a7a64f0d60e01b815260040160405180910390fd5b5f805f80611a0e85612278565b9350935093509350611aa66040518060a001604052808681526020018a8a8a818110611a3c57611a3c612b6c565b602060a0909102929092018201358352506001600160a01b0389165f9081526019825260408082206001015464ffffffffff600160781b90910481168585015281518083018352601354909116815260145493810193909352830191909152606090910152612115565b611b316040518060a001604052808581526020018a8a8a818110611acc57611acc612b6c565b604060a0909102929092018201358352506001600160a01b0389165f908152601960209081528282206001015464ffffffffff9081168583015283518085018552600d549091168152600e549181019190915291830191909152606090910152612115565b611bbe6040518060a001604052808481526020018a8a8a818110611b5757611b57612b6c565b606060a0909102929092018201358352506001600160a01b0389165f9081526019602090815260408083206001015464ffffffffff600160281b90910481168684015281518083018352600f54909116815260105492810192909252840152910152612115565b611c4b6040518060a001604052808381526020018a8a8a818110611be457611be4612b6c565b60a00291909101608001358252506001600160a01b0388165f90815260196020908152604080832060010154600160501b900464ffffffffff9081168386015281518083018352601154909116815260125492810192909252830152606090910152612115565b505060019093019250611994915050565b5f5b81811015611e36575f838383818110611c7957611c79612b6c565b611c8f92602060a09092020190810191506127d8565b9050611c9d602a5f19612b94565b848484818110611caf57611caf612b6c565b905060a002016020015f013514611cf9576001600160a01b0381165f908152601960205260409020600101805464ffffffffff60781b1916600160781b4264ffffffffff16021790555b611d05602a5f19612b94565b848484818110611d1757611d17612b6c565b905060a002016020016020013514611d59576001600160a01b0381165f908152601960205260409020600101805464ffffffffff19164264ffffffffff161790555b611d65602a5f19612b94565b848484818110611d7757611d77612b6c565b905060a002016020016040013514611dc4576001600160a01b0381165f908152601960205260409020600101805469ffffffffff00000000001916600160281b4264ffffffffff16021790555b611dd0602a5f19612b94565b848484818110611de257611de2612b6c565b905060a002016020016060013514611e2d576001600160a01b0381165f908152601960205260409020600101805464ffffffffff60501b1916600160501b4264ffffffffff16021790555b50600101611c5e565b50604051610e289063b79421eb60e01b906110189085908590602401612e6c565b5f819003611e785760405163350342fb60e21b815260040160405180910390fd5b5f5b81811015610e28575f838383818110611e9557611e95612b6c565b611eab92602060409092020190810191506127d8565b6001600160a01b0381165f908152601a602052604090205490915060ff1615611ee757604051630346c27b60e41b815260040160405180910390fd5b838383818110611ef957611ef9612b6c565b905060400201602001355f03611f2257604051637e475a0b60e01b815260040160405180910390fd5b5f816001600160a01b0316634c7afe606040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f5f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f839190612c48565b905061201c6040518060a00160405280611f9c8461221c565b8152602001878787818110611fb357611fb3612b6c565b60409081029290920160209081013584526001600160a01b0388165f90815260198252839020600190810154600160a01b900464ffffffffff90811686840152845180860186526017549091168152601854928101929092529284015250606090910152612115565b5050600101611e7a565b5f5b81811015610e28575f83838381811061204357612043612b6c565b61205992602060409092020190810191506127d8565b6001600160a01b0381165f818152601960205260409020600101805464ffffffffff60a01b1916600160a01b4264ffffffffff160217905590915063030c96c06120bd8686868181106120ae576120ae612b6c565b905060400201602001356123b6565b6040518263ffffffff1660e01b81526004016120db91815260200190565b5f604051808303815f87803b1580156120f2575f80fd5b505af1158015612104573d5f803e3d5ffd5b505060019093019250612028915050565b612121602a5f19612b94565b81602001510361212e5750565b606081015151604082015164ffffffffff9182169161214e911642612b94565b101561216c5760405162ab607360e81b815260040160405180910390fd5b61218b815f0151826020015183606001516020015184608001516123e2565b61090b5760405163c7b8653960e01b815260040160405180910390fd5b60605f80846001600160a01b0316846040516121c49190612ed5565b5f60405180830381855af49150503d805f81146121fc576040519150601f19603f3d011682016040523d82523d5f602084013e612201565b606091505b509150915061221185838361244c565b925050505b92915050565b5f8082121561224157604051635467221960e11b8152600481018390526024016108f9565b5090565b5f6001600160681b03821115612241576040516306dfcc6560e41b815260686004820152602481018390526044016108f9565b5f805f805f7f000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b96001600160a01b0316636744362a876040518263ffffffff1660e01b81526004016122d891906001600160a01b0391909116815260200190565b602060405180830381865afa1580156122f3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123179190612f01565b6040516363ce721760e11b81526001600160a01b0388811660048301529192505f9183169063c79ce42e90602401608060405180830381865afa158015612360573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123849190612f2f565b80516020820151604083015160609093015161ffff9092169a63ffffffff9182169a5092811698501695509350505050565b5f6001600160ff1b038211156122415760405163123baf0360e11b8152600481018390526024016108f9565b5f808486116123fa576123f58686612b94565b612404565b6124048587612b94565b90505f836124125784612429565b61271061241f8887612fb8565b6124299190612c5f565b90508082111561243d575f92505050612444565b6001925050505b949350505050565b6060826124615761245c826124ab565b6124a4565b815115801561247857506001600160a01b0384163b155b156124a157604051639996b31560e01b81526001600160a01b03851660048201526024016108f9565b50805b9392505050565b8051156124bb5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b8151805164ffffffffff168252602090810151908201526103008101602083810151805164ffffffffff166040850152908101516060840152506040830151805164ffffffffff166080840152602081015160a0840152506060830151805164ffffffffff1660c0840152602081015160e084015250608083015161010061256f81850183805164ffffffffff168252602090810151910152565b60a0850151915061014061259681860184805164ffffffffff168252602090810151910152565b60c0860151805164ffffffffff9081166101808801526020918201516101a088015260e0880151805182166101c08901528201516101e08801529287015180518416610200880152810151610220870152610120870151805184166102408801528101516102608701529086015180519092166102808601528101516102a08501529050506101609290920151805164ffffffffff166102c0830152602001516102e09091015290565b5f8060208385031215612651575f80fd5b823567ffffffffffffffff80821115612668575f80fd5b818501915085601f83011261267b575f80fd5b813581811115612689575f80fd5b86602060c08302850101111561269d575f80fd5b60209290920196919550909350505050565b5f80602083850312156126c0575f80fd5b823567ffffffffffffffff808211156126d7575f80fd5b818501915085601f8301126126ea575f80fd5b8135818111156126f8575f80fd5b8660208260071b850101111561269d575f80fd5b5f806020838503121561271d575f80fd5b823567ffffffffffffffff80821115612734575f80fd5b818501915085601f830112612747575f80fd5b813581811115612755575f80fd5b86602060608302850101111561269d575f80fd5b5f610300828403121561277a575f80fd5b50919050565b6001600160a01b038116811461090b575f80fd5b801515811461090b575f80fd5b5f80604083850312156127b2575f80fd5b82356127bd81612780565b915060208301356127cd81612794565b809150509250929050565b5f602082840312156127e8575f80fd5b81356124a481612780565b815164ffffffffff1681526101608101602083015161281b602084018264ffffffffff169052565b506040830151612834604084018264ffffffffff169052565b50606083015161284d606084018264ffffffffff169052565b506080830151612866608084018264ffffffffff169052565b5060a083015161287f60a084018264ffffffffff169052565b5060c083015161289860c084018264ffffffffff169052565b5060e08301516128b160e084018264ffffffffff169052565b506101008381015164ffffffffff90811691840191909152610120808501518216908401526101409384015116929091019190915290565b5f80602083850312156128fa575f80fd5b823567ffffffffffffffff80821115612911575f80fd5b818501915085601f830112612924575f80fd5b813581811115612932575f80fd5b86602060a08302850101111561269d575f80fd5b5f8060208385031215612957575f80fd5b823567ffffffffffffffff8082111561296e575f80fd5b818501915085601f830112612981575f80fd5b81358181111561298f575f80fd5b8660208260061b850101111561269d575f80fd5b64ffffffffff8116811461090b575f80fd5b81356129c0816129a3565b64ffffffffff811664ffffffffff1983541617825550602082013560018201555050565b6129ee82826129b5565b6129fe60408301600283016129b5565b612a0e60808301600483016129b5565b612a1e60c08301600683016129b5565b612a2f6101008301600883016129b5565b612a406101408301600a83016129b5565b612a516101808301600c83016129b5565b612a626101c08301600e83016129b5565b612a736102008301601083016129b5565b612a846102408301601283016129b5565b612a956102808301601483016129b5565b61068f6102c08301601683016129b5565b5f8135612ab2816129a3565b64ffffffffff168352506020908101359082015260400190565b612b62612b58612b4e612b44612b3a612b30612b26612b1c612b12612b09612b00612af78c8e612aa6565b60408e01612aa6565b60808d01612aa6565b60c08c01612aa6565b6101008b01612aa6565b6101408a01612aa6565b6101808901612aa6565b6101c08801612aa6565b6102008701612aa6565b6102408601612aa6565b6102808501612aa6565b6102c08401612aa6565b5061030001919050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b8181038181111561221657612216612b80565b5f805f805f805f805f806101408b8d031215612bc1575f80fd5b8a51995060208b0151985060408b0151975060608b0151965060808b0151955060a08b0151612bef81612794565b60c08c0151909550612c0081612794565b60e08c0151909450612c1181612794565b6101008c0151909350612c2381612794565b6101208c0151909250612c3581612794565b809150509295989b9194979a5092959850565b5f60208284031215612c58575f80fd5b5051919050565b5f82612c7957634e487b7160e01b5f52601260045260245ffd5b500490565b60208082528181018390525f90604080840186845b87811015612cf1578135612ca681612780565b6001600160a01b0316835281850135858401528382013584840152606080830135908401526080808301359084015260a0828101359084015260c09283019290910190600101612c93565b5090979650505050505050565b80356001600160681b0381168114612d14575f80fd5b919050565b5f60208284031215612d29575f80fd5b6124a482612cfe565b803565ffffffffffff81168114612d14575f80fd5b5f60208284031215612d57575f80fd5b6124a482612d32565b61ffff8116811461090b575f80fd5b5f60208284031215612d7f575f80fd5b81356124a481612d60565b606081016001600160681b03612d9f84612cfe565b16825265ffffffffffff612db560208501612d32565b1660208301526040830135612dc981612d60565b61ffff811660408401525092915050565b5f60208284031215612dea575f80fd5b81516124a481612794565b5f8060408385031215612e06575f80fd5b505080516020909101519092909150565b60208082528181018390525f90604080840186845b87811015612cf1578135612e3f81612780565b6001600160a01b031683528185013585840152838201358484015260609283019290910190600101612e2c565b60208082528181018390525f90604080840186845b87811015612cf1578135612e9481612780565b6001600160a01b0316835284820135858401528382013584840152606080830135908401526080808301359084015260a09283019290910190600101612e81565b5f82515f5b81811015612ef45760208186018101518583015201612eda565b505f920191825250919050565b5f60208284031215612f11575f80fd5b81516124a481612780565b805163ffffffff81168114612d14575f80fd5b5f60808284031215612f3f575f80fd5b6040516080810181811067ffffffffffffffff82111715612f6e57634e487b7160e01b5f52604160045260245ffd5b6040528251612f7c81612d60565b8152612f8a60208401612f1c565b6020820152612f9b60408401612f1c565b6040820152612fac60608401612f1c565b60608201529392505050565b808202811582820484141761221657612216612b8056fea2646970667358221220859801d499d58f7054e09b411651322fab28fa7d02cb9150acc1d184d81f0b8d64736f6c63430008160033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b9000000000000000000000000a119f84bc1b8083f5061e4cf53705cbf1065ba270000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d04000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000003f480000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000032
-----Decoded View---------------
Arg [0] : poolDataProvider (address): 0x306c124fFba5f2Bc0BcAf40D249cf19D492440b9
Arg [1] : engine (address): 0xa119F84bC1b8083F5061E4cf53705cBf1065bA27
Arg [2] : riskCouncil (address): 0x1dE39A17a9Fa8c76899fff37488482EEb7835d04
Arg [3] : riskConfig (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
27 Constructor Arguments found :
Arg [0] : 000000000000000000000000306c124ffba5f2bc0bcaf40d249cf19d492440b9
Arg [1] : 000000000000000000000000a119f84bc1b8083f5061e4cf53705cbf1065ba27
Arg [2] : 0000000000000000000000001de39a17a9fa8c76899fff37488482eeb7835d04
Arg [3] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [5] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [7] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [9] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [10] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [11] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [12] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [13] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [14] : 00000000000000000000000000000000000000000000000000000000000007d0
Arg [15] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [17] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [18] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [19] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [20] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [21] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [22] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [23] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [24] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [25] : 000000000000000000000000000000000000000000000000000000000003f480
Arg [26] : 0000000000000000000000000000000000000000000000000000000000000032
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.