Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Initialize | 13625246 | 13 days ago | IN | 0 S | 0.00010662 |
Latest 19 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
13625831 | 13 days ago | 0 S | ||||
13625776 | 13 days ago | 0 S | ||||
13625769 | 13 days ago | 0 S | ||||
13625762 | 13 days ago | 0 S | ||||
13625755 | 13 days ago | 0 S | ||||
13625747 | 13 days ago | 0 S | ||||
13625725 | 13 days ago | 0 S | ||||
13625719 | 13 days ago | 0 S | ||||
13625711 | 13 days ago | 0 S | ||||
13625704 | 13 days ago | 0 S | ||||
13625698 | 13 days ago | 0 S | ||||
13625692 | 13 days ago | 0 S | ||||
13625685 | 13 days ago | 0 S | ||||
13625677 | 13 days ago | 0 S | ||||
13625671 | 13 days ago | 0 S | ||||
13625663 | 13 days ago | 0 S | ||||
13625656 | 13 days ago | 0 S | ||||
13625254 | 13 days ago | 0 S | ||||
13625246 | 13 days ago | 0 S |
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:
LendingPoolConfigurator
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol'; import { InitializableImmutableAdminUpgradeabilityProxy } from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol'; import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol'; import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol'; import {ILendingPool} from '../../interfaces/ILendingPool.sol'; import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol'; import {Errors} from '../libraries/helpers/Errors.sol'; import {PercentageMath} from '../libraries/math/PercentageMath.sol'; import {DataTypes} from '../libraries/types/DataTypes.sol'; import {IInitializableDebtToken} from '../../interfaces/IInitializableDebtToken.sol'; import {IInitializableAToken} from '../../interfaces/IInitializableAToken.sol'; import {IChefIncentivesController} from '../../interfaces/IChefIncentivesController.sol'; import {ILendingPoolConfigurator} from '../../interfaces/ILendingPoolConfigurator.sol'; import {IMultiFeeDistribution} from '../../interfaces/IMultiFeeDistribution.sol'; /** * @title LendingPoolConfigurator contract * @author Aave * @dev Implements the configuration methods for the Aave protocol **/ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigurator { using SafeMath for uint256; using PercentageMath for uint256; using ReserveConfiguration for DataTypes.ReserveConfigurationMap; ILendingPoolAddressesProvider internal addressesProvider; ILendingPool internal pool; modifier onlyPoolAdmin { require(addressesProvider.getPoolAdmin() == msg.sender, Errors.CALLER_NOT_POOL_ADMIN); _; } modifier onlyEmergencyAdmin { require( addressesProvider.getEmergencyAdmin() == msg.sender, Errors.LPC_CALLER_NOT_EMERGENCY_ADMIN ); _; } uint256 internal constant CONFIGURATOR_REVISION = 0x1; function getRevision() internal pure override returns (uint256) { return CONFIGURATOR_REVISION; } function initialize(ILendingPoolAddressesProvider provider) public initializer { addressesProvider = provider; pool = ILendingPool(addressesProvider.getLendingPool()); } /** * @dev Initializes reserves in batch **/ function batchInitReserve(InitReserveInput[] calldata input) external onlyPoolAdmin { ILendingPool cachedPool = pool; for (uint256 i = 0; i < input.length; i++) { _initReserve(cachedPool, input[i]); } } function _initReserve(ILendingPool pool, InitReserveInput calldata input) internal { IChefIncentivesController incentivesController = IChefIncentivesController(input.incentivesController); address aTokenProxyAddress = _initTokenWithProxy( input.aTokenImpl, abi.encodeWithSelector( IInitializableAToken.initialize.selector, pool, input.treasury, input.underlyingAsset, incentivesController, input.underlyingAssetDecimals, input.aTokenName, input.aTokenSymbol, input.params ) ); incentivesController.addPool(aTokenProxyAddress, input.allocPoint); IMultiFeeDistribution(input.treasury).addReward(aTokenProxyAddress); address stableDebtTokenProxyAddress = _initTokenWithProxy( input.stableDebtTokenImpl, abi.encodeWithSelector( IInitializableDebtToken.initialize.selector, pool, input.underlyingAsset, IChefIncentivesController(input.incentivesController), input.underlyingAssetDecimals, input.stableDebtTokenName, input.stableDebtTokenSymbol, input.params ) ); // stableDebt is not added to incentives controller // POLTER does not support stable lending address variableDebtTokenProxyAddress = _initTokenWithProxy( input.variableDebtTokenImpl, abi.encodeWithSelector( IInitializableDebtToken.initialize.selector, pool, input.underlyingAsset, IChefIncentivesController(input.incentivesController), input.underlyingAssetDecimals, input.variableDebtTokenName, input.variableDebtTokenSymbol, input.params ) ); incentivesController.addPool(variableDebtTokenProxyAddress, input.allocPoint); pool.initReserve( input.underlyingAsset, aTokenProxyAddress, stableDebtTokenProxyAddress, variableDebtTokenProxyAddress, input.interestRateStrategyAddress ); DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(input.underlyingAsset); currentConfig.setDecimals(input.underlyingAssetDecimals); currentConfig.setActive(true); currentConfig.setFrozen(false); pool.setConfiguration(input.underlyingAsset, currentConfig.data); emit ReserveInitialized( input.underlyingAsset, aTokenProxyAddress, stableDebtTokenProxyAddress, variableDebtTokenProxyAddress, input.interestRateStrategyAddress ); } /** * @dev Updates the aToken implementation for the reserve **/ function updateAToken(UpdateATokenInput calldata input) external onlyPoolAdmin { ILendingPool cachedPool = pool; DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset); (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory(); bytes memory encodedCall = abi.encodeWithSelector( IInitializableAToken.initialize.selector, cachedPool, input.treasury, input.asset, input.incentivesController, decimals, input.name, input.symbol, input.params ); _upgradeTokenImplementation( reserveData.aTokenAddress, input.implementation, encodedCall ); emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation); } /** * @dev Updates the stable debt token implementation for the reserve **/ function updateStableDebtToken(UpdateDebtTokenInput calldata input) external onlyPoolAdmin { ILendingPool cachedPool = pool; DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset); (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory(); bytes memory encodedCall = abi.encodeWithSelector( IInitializableDebtToken.initialize.selector, cachedPool, input.asset, input.incentivesController, decimals, input.name, input.symbol, input.params ); _upgradeTokenImplementation( reserveData.stableDebtTokenAddress, input.implementation, encodedCall ); emit StableDebtTokenUpgraded( input.asset, reserveData.stableDebtTokenAddress, input.implementation ); } /** * @dev Updates the variable debt token implementation for the asset **/ function updateVariableDebtToken(UpdateDebtTokenInput calldata input) external onlyPoolAdmin { ILendingPool cachedPool = pool; DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset); (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory(); bytes memory encodedCall = abi.encodeWithSelector( IInitializableDebtToken.initialize.selector, cachedPool, input.asset, input.incentivesController, decimals, input.name, input.symbol, input.params ); _upgradeTokenImplementation( reserveData.variableDebtTokenAddress, input.implementation, encodedCall ); emit VariableDebtTokenUpgraded( input.asset, reserveData.variableDebtTokenAddress, input.implementation ); } /** * @dev Enables borrowing on a reserve * @param asset The address of the underlying asset of the reserve * @param stableBorrowRateEnabled True if stable borrow rate needs to be enabled by default on this reserve **/ function enableBorrowingOnReserve(address asset, bool stableBorrowRateEnabled) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setBorrowingEnabled(true); currentConfig.setStableRateBorrowingEnabled(stableBorrowRateEnabled); pool.setConfiguration(asset, currentConfig.data); emit BorrowingEnabledOnReserve(asset, stableBorrowRateEnabled); } /** * @dev Disables borrowing on a reserve * @param asset The address of the underlying asset of the reserve **/ function disableBorrowingOnReserve(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setBorrowingEnabled(false); pool.setConfiguration(asset, currentConfig.data); emit BorrowingDisabledOnReserve(asset); } /** * @dev Configures the reserve collateralization parameters * all the values are expressed in percentages with two decimals of precision. A valid value is 10000, which means 100.00% * @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. The values is always above 100%. A value of 105% * means the liquidator will receive a 5% bonus **/ function configureReserveAsCollateral( address asset, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus ) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); //validation of the parameters: the LTV can //only be lower or equal than the liquidation threshold //(otherwise a loan against the asset would cause instantaneous liquidation) require(ltv <= liquidationThreshold, Errors.LPC_INVALID_CONFIGURATION); if (liquidationThreshold != 0) { //liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less //collateral than needed to cover the debt require( liquidationBonus > PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION ); //if threshold * bonus is less than PERCENTAGE_FACTOR, it's guaranteed that at the moment //a loan is taken there is enough collateral available to cover the liquidation bonus require( liquidationThreshold.percentMul(liquidationBonus) <= PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION ); } else { require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION); //if the liquidation threshold is being set to 0, // the reserve is being disabled as collateral. To do so, //we need to ensure no liquidity is deposited _checkNoLiquidity(asset); } currentConfig.setLtv(ltv); currentConfig.setLiquidationThreshold(liquidationThreshold); currentConfig.setLiquidationBonus(liquidationBonus); pool.setConfiguration(asset, currentConfig.data); emit CollateralConfigurationChanged(asset, ltv, liquidationThreshold, liquidationBonus); } /** * @dev Enable stable rate borrowing on a reserve * @param asset The address of the underlying asset of the reserve **/ function enableReserveStableRate(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setStableRateBorrowingEnabled(true); pool.setConfiguration(asset, currentConfig.data); emit StableRateEnabledOnReserve(asset); } /** * @dev Disable stable rate borrowing on a reserve * @param asset The address of the underlying asset of the reserve **/ function disableReserveStableRate(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setStableRateBorrowingEnabled(false); pool.setConfiguration(asset, currentConfig.data); emit StableRateDisabledOnReserve(asset); } /** * @dev Activates a reserve * @param asset The address of the underlying asset of the reserve **/ function activateReserve(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setActive(true); pool.setConfiguration(asset, currentConfig.data); emit ReserveActivated(asset); } /** * @dev Deactivates a reserve * @param asset The address of the underlying asset of the reserve **/ function deactivateReserve(address asset) external onlyPoolAdmin { _checkNoLiquidity(asset); DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setActive(false); pool.setConfiguration(asset, currentConfig.data); emit ReserveDeactivated(asset); } /** * @dev Freezes a reserve. A frozen reserve doesn't allow any new deposit, borrow or rate swap * but allows repayments, liquidations, rate rebalances and withdrawals * @param asset The address of the underlying asset of the reserve **/ function freezeReserve(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setFrozen(true); pool.setConfiguration(asset, currentConfig.data); emit ReserveFrozen(asset); } /** * @dev Unfreezes a reserve * @param asset The address of the underlying asset of the reserve **/ function unfreezeReserve(address asset) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setFrozen(false); pool.setConfiguration(asset, currentConfig.data); emit ReserveUnfrozen(asset); } /** * @dev Updates the reserve factor of a reserve * @param asset The address of the underlying asset of the reserve * @param reserveFactor The new reserve factor of the reserve **/ function setReserveFactor(address asset, uint256 reserveFactor) external onlyPoolAdmin { DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset); currentConfig.setReserveFactor(reserveFactor); pool.setConfiguration(asset, currentConfig.data); emit ReserveFactorChanged(asset, reserveFactor); } /** * @dev Sets the interest rate strategy of a reserve * @param asset The address of the underlying asset of the reserve * @param rateStrategyAddress The new address of the interest strategy contract **/ function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress) external onlyPoolAdmin { pool.setReserveInterestRateStrategyAddress(asset, rateStrategyAddress); emit ReserveInterestRateStrategyChanged(asset, rateStrategyAddress); } /** * @dev pauses or unpauses all the actions of the protocol, including aToken transfers * @param val true if protocol needs to be paused, false otherwise **/ function setPoolPause(bool val) external onlyEmergencyAdmin { pool.setPause(val); } function _initTokenWithProxy(address implementation, bytes memory initParams) internal returns (address) { InitializableImmutableAdminUpgradeabilityProxy proxy = new InitializableImmutableAdminUpgradeabilityProxy(address(this)); proxy.initialize(implementation, initParams); return address(proxy); } function _upgradeTokenImplementation( address proxyAddress, address implementation, bytes memory initParams ) internal { InitializableImmutableAdminUpgradeabilityProxy proxy = InitializableImmutableAdminUpgradeabilityProxy(payable(proxyAddress)); proxy.upgradeToAndCall(implementation, initParams); } function _checkNoLiquidity(address asset) internal view { DataTypes.ReserveData memory reserveData = pool.getReserveData(asset); uint256 availableLiquidity = IERC20Detailed(asset).balanceOf(reserveData.aTokenAddress); require( availableLiquidity == 0 && reserveData.currentLiquidityRate == 0, Errors.LPC_RESERVE_LIQUIDITY_NOT_0 ); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, 'Address: insufficient balance'); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{value: amount}(''); require(success, 'Address: unable to send value, recipient may have reverted'); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; /** * @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: agpl-3.0 pragma solidity 0.7.6; import {IERC20} from './IERC20.sol'; interface IERC20Detailed is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when 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 SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, 'SafeMath: subtraction overflow'); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, 'SafeMath: multiplication overflow'); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, 'SafeMath: division by zero'); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, 'SafeMath: modulo by zero'); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import './Proxy.sol'; import '../contracts/Address.sol'; /** * @title BaseUpgradeabilityProxy * @dev This contract implements a proxy that allows to change the * implementation address to which it will delegate. * Such a change is called an implementation upgrade. */ contract BaseUpgradeabilityProxy is Proxy { /** * @dev Emitted when the implementation is upgraded. * @param implementation Address of the new implementation. */ event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation. * @return impl Address of the current implementation */ function _implementation() internal view override returns (address impl) { bytes32 slot = IMPLEMENTATION_SLOT; //solium-disable-next-line assembly { impl := sload(slot) } } /** * @dev Upgrades the proxy to a new implementation. * @param newImplementation Address of the new implementation. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation address of the proxy. * @param newImplementation Address of the new implementation. */ function _setImplementation(address newImplementation) internal { require( Address.isContract(newImplementation), 'Cannot set a proxy implementation to a non-contract address' ); bytes32 slot = IMPLEMENTATION_SLOT; //solium-disable-next-line assembly { sstore(slot, newImplementation) } } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import './BaseUpgradeabilityProxy.sol'; /** * @title InitializableUpgradeabilityProxy * @dev Extends BaseUpgradeabilityProxy with an initializer for initializing * implementation and init data. */ contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Contract initializer. * @param _logic Address of the initial implementation. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ function initialize(address _logic, bytes memory _data) public payable { require(_implementation() == address(0)); assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if (_data.length > 0) { (bool success, ) = _logic.delegatecall(_data); require(success); } } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; /** * @title Proxy * @dev Implements delegation of calls to other contracts, with proper * forwarding of return values and bubbling of failures. * It defines a fallback function that delegates all calls to the address * returned by the abstract _implementation() internal function. */ abstract contract Proxy { /** * @dev Fallback function. * Implemented entirely in `_fallback`. */ fallback() external payable { _fallback(); } /** * @return The Address of the implementation. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates execution to an implementation contract. * This is a low level function that doesn't return to its internal call site. * It will return to the external caller whatever the implementation returns. * @param implementation Address to delegate. */ function _delegate(address implementation) internal { //solium-disable-next-line assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev Function that is run as the first thing in the fallback function. * Can be redefined in derived contracts to add functionality. * Redefinitions must call super._willFallback(). */ function _willFallback() internal virtual {} /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; interface IAaveIncentivesController { event RewardsAccrued(address indexed user, uint256 amount); event RewardsClaimed(address indexed user, address indexed to, uint256 amount); event RewardsClaimed( address indexed user, address indexed to, address indexed claimer, uint256 amount ); event ClaimerSet(address indexed user, address indexed claimer); /* * @dev Returns the configuration of the distribution for a certain asset * @param asset The address of the reference asset of the distribution * @return The asset index, the emission per second and the last updated timestamp **/ function getAssetData(address asset) external view returns ( uint256, uint256, uint256 ); /** * @dev Whitelists an address to claim the rewards on behalf of another address * @param user The address of the user * @param claimer The address of the claimer */ function setClaimer(address user, address claimer) external; /** * @dev Returns the whitelisted claimer for a certain address (0x0 if not set) * @param user The address of the user * @return The claimer address */ function getClaimer(address user) external view returns (address); /** * @dev Configure assets for a certain rewards emission * @param assets The assets to incentivize * @param emissionsPerSecond The emission for each asset */ function configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond) external; /** * @dev Called by the corresponding asset on any update that affects the rewards distribution * @param user The address of the user * @param userBalance The balance of the user of the asset in the lending pool * @param totalSupply The total supply of the asset in the lending pool **/ function handleAction( address user, uint256 userBalance, uint256 totalSupply ) external; /** * @dev Returns the total of rewards of an user, already accrued + not yet accrued * @param user The address of the user * @return The rewards **/ function getRewardsBalance(address[] calldata assets, address user) external view returns (uint256); /** * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards * @param amount Amount of rewards to claim * @param to Address that will be receiving the rewards * @return Rewards claimed **/ function claimRewards( address[] calldata assets, uint256 amount, address to ) external returns (uint256); /** * @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must * be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager * @param amount Amount of rewards to claim * @param user Address to check and claim rewards * @param to Address that will be receiving the rewards * @return Rewards claimed **/ function claimRewardsOnBehalf( address[] calldata assets, uint256 amount, address user, address to ) external returns (uint256); /** * @dev returns the unclaimed rewards of the user * @param user the address of the user * @return the unclaimed user rewards */ function getUserUnclaimedRewards(address user) external view returns (uint256); /** * @dev returns the unclaimed rewards of the user * @param user the address of the user * @param asset The asset to incentivize * @return the user index for the asset */ function getUserAssetData(address user, address asset) external view returns (uint256); /** * @dev for backward compatibility with previous implementation of the Incentives controller */ function REWARD_TOKEN() external view returns (address); /** * @dev for backward compatibility with previous implementation of the Incentives controller */ function PRECISION() external view returns (uint8); /** * @dev Gets the distribution end timestamp of the emissions */ function DISTRIBUTION_END() external view returns (uint256); }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; interface IChefIncentivesController { /** * @dev Called by the corresponding asset on any update that affects the rewards distribution * @param user The address of the user * @param userBalance The balance of the user of the asset in the lending pool * @param totalSupply The total supply of the asset in the lending pool **/ function handleAction( address user, uint256 userBalance, uint256 totalSupply ) external; function addPool(address _token, uint256 _allocPoint) external; function claim(address _user, address[] calldata _tokens) external; function setClaimReceiver(address _user, address _receiver) external; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import {ILendingPool} from './ILendingPool.sol'; import {IAaveIncentivesController} from './IAaveIncentivesController.sol'; /** * @title IInitializableAToken * @notice Interface for the initialize function on AToken * @author Aave **/ interface IInitializableAToken { /** * @dev Emitted when an aToken is initialized * @param underlyingAsset The address of the underlying asset * @param pool The address of the associated lending 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 ); /** * @dev Initializes the aToken * @param pool The address of the lending pool where this aToken will be used * @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 */ function initialize( ILendingPool pool, address treasury, address underlyingAsset, IAaveIncentivesController incentivesController, uint8 aTokenDecimals, string calldata aTokenName, string calldata aTokenSymbol, bytes calldata params ) external; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import {ILendingPool} from './ILendingPool.sol'; import {IAaveIncentivesController} from './IAaveIncentivesController.sol'; /** * @title IInitializableDebtToken * @notice Interface for the initialize function common between debt tokens * @author Aave **/ interface IInitializableDebtToken { /** * @dev Emitted when a debt token is initialized * @param underlyingAsset The address of the underlying asset * @param pool The address of the associated lending pool * @param incentivesController The address of the incentives controller for this aToken * @param debtTokenDecimals the decimals of the debt token * @param debtTokenName the name of the debt token * @param debtTokenSymbol the symbol of the debt token * @param params A set of encoded parameters for additional initialization **/ event Initialized( address indexed underlyingAsset, address indexed pool, address incentivesController, uint8 debtTokenDecimals, string debtTokenName, string debtTokenSymbol, bytes params ); /** * @dev Initializes the debt token. * @param pool The address of the lending pool where this aToken will be used * @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 debtTokenDecimals The decimals of the debtToken, same as the underlying asset's * @param debtTokenName The name of the token * @param debtTokenSymbol The symbol of the token */ function initialize( ILendingPool pool, address underlyingAsset, IAaveIncentivesController incentivesController, uint8 debtTokenDecimals, string memory debtTokenName, string memory debtTokenSymbol, bytes calldata params ) external; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import {ILendingPoolAddressesProvider} from './ILendingPoolAddressesProvider.sol'; import {DataTypes} from '../protocol/libraries/types/DataTypes.sol'; interface ILendingPool { /** * @dev Emitted on deposit() * @param reserve The address of the underlying asset of the reserve * @param user The address initiating the deposit * @param onBehalfOf The beneficiary of the deposit, receiving the aTokens * @param amount The amount deposited * @param referral The referral code used **/ event Deposit( address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint16 indexed referral ); /** * @dev Emitted on withdraw() * @param reserve The address of the underlyng asset being withdrawn * @param user The address initiating the withdrawal, owner of aTokens * @param to 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 borrowRateMode The rate mode: 1 for Stable, 2 for Variable * @param borrowRate The numeric rate at which the user has borrowed * @param referral The referral code used **/ event Borrow( address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint256 borrowRateMode, uint256 borrowRate, uint16 indexed referral ); /** * @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 **/ event Repay( address indexed reserve, address indexed user, address indexed repayer, uint256 amount ); /** * @dev Emitted on swapBorrowRateMode() * @param reserve The address of the underlying asset of the reserve * @param user The address of the user swapping his rate mode * @param rateMode The rate mode that the user wants to swap to **/ event Swap(address indexed reserve, address indexed user, uint256 rateMode); /** * @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 rebalanceStableBorrowRate() * @param reserve The address of the underlying asset of the reserve * @param user The address of the user for which the rebalance has been executed **/ event RebalanceStableBorrowRate(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 premium The fee flash borrowed * @param referralCode The referral code used **/ event FlashLoan( address indexed target, address indexed initiator, address indexed asset, uint256 amount, uint256 premium, uint16 referralCode ); /** * @dev Emitted when the pause is triggered. */ event Paused(); /** * @dev Emitted when the pause is lifted. */ event Unpaused(); /** * @dev Emitted when a borrower is liquidated. This event is emitted by the LendingPool via * LendingPoolCollateral manager using a DELEGATECALL * This allows to have the events in the generated ABI for LendingPool. * @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 liiquidator * @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. NOTE: This event is actually declared * in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal, * the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it * gets added to the LendingPool ABI * @param reserve The address of the underlying asset of the reserve * @param liquidityRate The new liquidity rate * @param stableBorrowRate The new stable borrow rate * @param variableBorrowRate The new variable borrow rate * @param liquidityIndex The new liquidity index * @param variableBorrowIndex The new variable borrow index **/ event ReserveDataUpdated( address indexed reserve, uint256 liquidityRate, uint256 stableBorrowRate, uint256 variableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex ); /** * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens. * - E.g. User deposits 100 USDC and gets in return 100 aUSDC * @param asset The address of the underlying asset to deposit * @param amount The amount to be deposited * @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; /** * @dev 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 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); /** * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower * already deposited enough collateral, or he was given enough allowance by a credit delegator on the * corresponding debt token (StableDebtToken or VariableDebtToken) * - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet * and 100 stable/variable debt tokens, depending on the `interestRateMode` * @param asset The address of the underlying asset to borrow * @param amount The amount to be borrowed * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable * @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 onBehalfOf 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/stable 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 rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable * @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 * @return The final amount repaid **/ function repay( address asset, uint256 amount, uint256 rateMode, address onBehalfOf ) external returns (uint256); /** * @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa * @param asset The address of the underlying asset borrowed * @param rateMode The rate mode that the user wants to swap to **/ function swapBorrowRateMode(address asset, uint256 rateMode) external; /** * @dev Rebalances the stable interest rate of a user to the current stable rate defined on the reserve. * - Users can be rebalanced if the following conditions are satisfied: * 1. Usage ratio is above 95% * 2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been * borrowed at a stable rate and depositors are not earning enough * @param asset The address of the underlying asset borrowed * @param user The address of the user to be rebalanced **/ function rebalanceStableBorrowRate(address asset, address user) external; /** * @dev Allows depositors to enable/disable a specific deposited asset as collateral * @param asset The address of the underlying asset deposited * @param useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise **/ function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external; /** * @dev 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; /** * @dev Allows smartcontracts to access the liquidity of the pool within one transaction, * as long as the amount taken plus a fee is returned. * IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. * For further details please visit https://developers.aave.com * @param receiverAddress The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface * @param assets The addresses of the assets being flash-borrowed * @param amounts The amounts amounts being flash-borrowed * @param modes 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 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address * 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 on `modes` 1 or 2 * @param params Variadic packed params to pass to the receiver as extra information * @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 flashLoan( address receiverAddress, address[] calldata assets, uint256[] calldata amounts, uint256[] calldata modes, address onBehalfOf, bytes calldata params, uint16 referralCode ) external; /** * @dev Returns the user account data across all the reserves * @param user The address of the user * @return totalCollateralETH the total collateral in ETH of the user * @return totalDebtETH the total debt in ETH of the user * @return availableBorrowsETH the borrowing power left of the user * @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 totalCollateralETH, uint256 totalDebtETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor ); function initReserve( address reserve, address aTokenAddress, address stableDebtAddress, address variableDebtAddress, address interestRateStrategyAddress ) external; function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) external; function setConfiguration(address reserve, uint256 configuration) external; /** * @dev 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); /** * @dev 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); /** * @dev Returns the normalized income 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); /** * @dev Returns the normalized variable debt per unit of asset * @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); /** * @dev Returns the state and configuration of the reserve * @param asset The address of the underlying asset of the reserve * @return The state of the reserve **/ function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); function finalizeTransfer( address asset, address from, address to, uint256 amount, uint256 balanceFromAfter, uint256 balanceToBefore ) external; function getReservesList() external view returns (address[] memory); function getAddressesProvider() external view returns (ILendingPoolAddressesProvider); function setPause(bool val) external; function paused() external view returns (bool); }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; /** * @title LendingPoolAddressesProvider contract * @dev Main registry of addresses part of or connected to the protocol, including permissioned roles * - Acting also as factory of proxies and admin of those, so with right to change its implementations * - Owned by the Aave Governance * @author Aave **/ interface ILendingPoolAddressesProvider { event MarketIdSet(string newMarketId); event LendingPoolUpdated(address indexed newAddress); event ConfigurationAdminUpdated(address indexed newAddress); event EmergencyAdminUpdated(address indexed newAddress); event LendingPoolConfiguratorUpdated(address indexed newAddress); event LendingPoolCollateralManagerUpdated(address indexed newAddress); event PriceOracleUpdated(address indexed newAddress); event LendingRateOracleUpdated(address indexed newAddress); event ProxyCreated(bytes32 id, address indexed newAddress); event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy); function getMarketId() external view returns (string memory); function setMarketId(string calldata marketId) external; function setAddress(bytes32 id, address newAddress) external; function setAddressAsProxy(bytes32 id, address impl) external; function getAddress(bytes32 id) external view returns (address); function getLendingPool() external view returns (address); function setLendingPoolImpl(address pool) external; function getLendingPoolConfigurator() external view returns (address); function setLendingPoolConfiguratorImpl(address configurator) external; function getLendingPoolCollateralManager() external view returns (address); function setLendingPoolCollateralManager(address manager) external; function getPoolAdmin() external view returns (address); function setPoolAdmin(address admin) external; function getEmergencyAdmin() external view returns (address); function setEmergencyAdmin(address admin) external; function getPriceOracle() external view returns (address); function setPriceOracle(address priceOracle) external; function getLendingRateOracle() external view returns (address); function setLendingRateOracle(address lendingRateOracle) external; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; interface ILendingPoolConfigurator { struct InitReserveInput { address aTokenImpl; address stableDebtTokenImpl; address variableDebtTokenImpl; uint8 underlyingAssetDecimals; address interestRateStrategyAddress; address underlyingAsset; address treasury; address incentivesController; uint256 allocPoint; string underlyingAssetName; string aTokenName; string aTokenSymbol; string variableDebtTokenName; string variableDebtTokenSymbol; string stableDebtTokenName; string stableDebtTokenSymbol; bytes params; } 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; } /** * @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 The address of the associated stable rate debt token * @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 on a reserve * @param asset The address of the underlying asset of the reserve * @param stableRateEnabled True if stable rate borrowing is enabled, false otherwise **/ event BorrowingEnabledOnReserve(address indexed asset, bool stableRateEnabled); /** * @dev Emitted when borrowing is disabled on a reserve * @param asset The address of the underlying asset of the reserve **/ event BorrowingDisabledOnReserve(address indexed asset); /** * @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 stable rate borrowing is enabled on a reserve * @param asset The address of the underlying asset of the reserve **/ event StableRateEnabledOnReserve(address indexed asset); /** * @dev Emitted when stable rate borrowing is disabled on a reserve * @param asset The address of the underlying asset of the reserve **/ event StableRateDisabledOnReserve(address indexed asset); /** * @dev Emitted when a reserve is activated * @param asset The address of the underlying asset of the reserve **/ event ReserveActivated(address indexed asset); /** * @dev Emitted when a reserve is deactivated * @param asset The address of the underlying asset of the reserve **/ event ReserveDeactivated(address indexed asset); /** * @dev Emitted when a reserve is frozen * @param asset The address of the underlying asset of the reserve **/ event ReserveFrozen(address indexed asset); /** * @dev Emitted when a reserve is unfrozen * @param asset The address of the underlying asset of the reserve **/ event ReserveUnfrozen(address indexed asset); /** * @dev Emitted when a reserve factor is updated * @param asset The address of the underlying asset of the reserve * @param factor The new reserve factor **/ event ReserveFactorChanged(address indexed asset, uint256 factor); /** * @dev Emitted when the reserve decimals are updated * @param asset The address of the underlying asset of the reserve * @param decimals The new decimals **/ event ReserveDecimalsChanged(address indexed asset, uint256 decimals); /** * @dev Emitted when a reserve interest strategy contract is updated * @param asset The address of the underlying asset of the reserve * @param strategy The new address of the interest strategy contract **/ event ReserveInterestRateStrategyChanged(address indexed asset, address strategy); /** * @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 stable debt token is upgraded * @param asset The address of the underlying asset of the reserve * @param proxy The stable debt token proxy address * @param implementation The new aToken implementation **/ event StableDebtTokenUpgraded( 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 ); }
pragma solidity 0.7.6; interface IMultiFeeDistribution { function addReward(address rewardsToken) external; function mint(address user, uint256 amount, bool withPenalty) external; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import '../../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol'; /** * @title BaseImmutableAdminUpgradeabilityProxy * @author Aave, inspired by the OpenZeppelin upgradeability proxy pattern * @dev This contract combines an upgradeability proxy with an authorization * mechanism for administrative tasks. The admin role is stored in an immutable, which * helps saving transactions costs * All external functions in this contract must be guarded by the * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity * feature proposal that would enable this to be done automatically. */ contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { address immutable ADMIN; constructor(address admin) { ADMIN = admin; } modifier ifAdmin() { if (msg.sender == ADMIN) { _; } else { _fallback(); } } /** * @return The address of the proxy admin. */ function admin() external ifAdmin returns (address) { return ADMIN; } /** * @return The address of the implementation. */ function implementation() external ifAdmin returns (address) { return _implementation(); } /** * @dev Upgrade the backing implementation of the proxy. * Only the admin can call this function. * @param newImplementation Address of the new implementation. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); } /** * @dev Upgrade the backing implementation of the proxy and call a function * on the new implementation. * This is useful to initialize the proxied contract. * @param newImplementation Address of the new implementation. * @param data Data to send as msg.data in the low level call. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeTo(newImplementation); (bool success, ) = newImplementation.delegatecall(data); require(success); } /** * @dev Only fall back when the sender is not the admin. */ function _willFallback() internal virtual override { require(msg.sender != ADMIN, 'Cannot call fallback function from the proxy admin'); super._willFallback(); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import './BaseImmutableAdminUpgradeabilityProxy.sol'; import '../../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol'; /** * @title InitializableAdminUpgradeabilityProxy * @dev Extends BaseAdminUpgradeabilityProxy with an initializer function */ contract InitializableImmutableAdminUpgradeabilityProxy is BaseImmutableAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy { constructor(address admin) BaseImmutableAdminUpgradeabilityProxy(admin) {} /** * @dev Only fall back when the sender is not the admin. */ function _willFallback() internal override(BaseImmutableAdminUpgradeabilityProxy, Proxy) { BaseImmutableAdminUpgradeabilityProxy._willFallback(); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; /** * @title VersionedInitializable * * @dev Helper contract to implement initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying an Initializable contract, as well * as extending an Initializable contract via inheritance. * WARNING: When used with inheritance, manual care must be taken to not invoke * a parent initializer twice, or ensure that all initializers are idempotent, * because this is not dealt with automatically as with constructors. * * @author Aave, inspired by the OpenZeppelin Initializable contract */ abstract contract VersionedInitializable { /** * @dev Indicates that the contract has been initialized. */ uint256 private lastInitializedRevision = 0; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { uint256 revision = getRevision(); require( initializing || isConstructor() || revision > lastInitializedRevision, 'Contract instance has already been initialized' ); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; lastInitializedRevision = revision; } _; if (isTopLevelCall) { initializing = false; } } /** * @dev returns the revision number of the contract * Needs to be defined in the inherited class as a constant. **/ function getRevision() internal pure virtual returns (uint256); /** * @dev Returns true if and only if the function is running in the constructor **/ function isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. uint256 cs; //solium-disable-next-line assembly { cs := extcodesize(address()) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import {Errors} from '../helpers/Errors.sol'; import {DataTypes} from '../types/DataTypes.sol'; /** * @title ReserveConfiguration library * @author Aave * @notice Implements the bitmap logic to handle the reserve configuration */ library ReserveConfiguration { uint256 constant LTV_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000; // prettier-ignore uint256 constant LIQUIDATION_THRESHOLD_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF; // prettier-ignore uint256 constant LIQUIDATION_BONUS_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF; // prettier-ignore uint256 constant DECIMALS_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFF; // prettier-ignore uint256 constant ACTIVE_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFF; // prettier-ignore uint256 constant FROZEN_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFF; // prettier-ignore uint256 constant BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFF; // prettier-ignore uint256 constant STABLE_BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFF; // prettier-ignore uint256 constant RESERVE_FACTOR_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF; // prettier-ignore /// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16; uint256 constant LIQUIDATION_BONUS_START_BIT_POSITION = 32; uint256 constant RESERVE_DECIMALS_START_BIT_POSITION = 48; uint256 constant IS_ACTIVE_START_BIT_POSITION = 56; uint256 constant IS_FROZEN_START_BIT_POSITION = 57; uint256 constant BORROWING_ENABLED_START_BIT_POSITION = 58; uint256 constant STABLE_BORROWING_ENABLED_START_BIT_POSITION = 59; uint256 constant RESERVE_FACTOR_START_BIT_POSITION = 64; uint256 constant MAX_VALID_LTV = 65535; uint256 constant MAX_VALID_LIQUIDATION_THRESHOLD = 65535; uint256 constant MAX_VALID_LIQUIDATION_BONUS = 65535; uint256 constant MAX_VALID_DECIMALS = 255; uint256 constant MAX_VALID_RESERVE_FACTOR = 65535; /** * @dev Sets the Loan to Value of the reserve * @param self The reserve configuration * @param ltv the new ltv **/ function setLtv(DataTypes.ReserveConfigurationMap memory self, uint256 ltv) internal pure { require(ltv <= MAX_VALID_LTV, Errors.RC_INVALID_LTV); self.data = (self.data & LTV_MASK) | ltv; } /** * @dev Gets the Loan to Value of the reserve * @param self The reserve configuration * @return The loan to value **/ function getLtv(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) { return self.data & ~LTV_MASK; } /** * @dev Sets the liquidation threshold of the reserve * @param self The reserve configuration * @param threshold The new liquidation threshold **/ function setLiquidationThreshold(DataTypes.ReserveConfigurationMap memory self, uint256 threshold) internal pure { require(threshold <= MAX_VALID_LIQUIDATION_THRESHOLD, Errors.RC_INVALID_LIQ_THRESHOLD); self.data = (self.data & LIQUIDATION_THRESHOLD_MASK) | (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION); } /** * @dev Gets the liquidation threshold of the reserve * @param self The reserve configuration * @return The liquidation threshold **/ function getLiquidationThreshold(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) { return (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION; } /** * @dev Sets the liquidation bonus of the reserve * @param self The reserve configuration * @param bonus The new liquidation bonus **/ function setLiquidationBonus(DataTypes.ReserveConfigurationMap memory self, uint256 bonus) internal pure { require(bonus <= MAX_VALID_LIQUIDATION_BONUS, Errors.RC_INVALID_LIQ_BONUS); self.data = (self.data & LIQUIDATION_BONUS_MASK) | (bonus << LIQUIDATION_BONUS_START_BIT_POSITION); } /** * @dev Gets the liquidation bonus of the reserve * @param self The reserve configuration * @return The liquidation bonus **/ function getLiquidationBonus(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) { return (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION; } /** * @dev Sets the decimals of the underlying asset of the reserve * @param self The reserve configuration * @param decimals The decimals **/ function setDecimals(DataTypes.ReserveConfigurationMap memory self, uint256 decimals) internal pure { require(decimals <= MAX_VALID_DECIMALS, Errors.RC_INVALID_DECIMALS); self.data = (self.data & DECIMALS_MASK) | (decimals << RESERVE_DECIMALS_START_BIT_POSITION); } /** * @dev Gets the decimals of the underlying asset of the reserve * @param self The reserve configuration * @return The decimals of the asset **/ function getDecimals(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) { return (self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION; } /** * @dev Sets the active state of the reserve * @param self The reserve configuration * @param active The active state **/ function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure { self.data = (self.data & ACTIVE_MASK) | (uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION); } /** * @dev Gets the active state of the reserve * @param self The reserve configuration * @return The active state **/ function getActive(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) { return (self.data & ~ACTIVE_MASK) != 0; } /** * @dev Sets the frozen state of the reserve * @param self The reserve configuration * @param frozen The frozen state **/ function setFrozen(DataTypes.ReserveConfigurationMap memory self, bool frozen) internal pure { self.data = (self.data & FROZEN_MASK) | (uint256(frozen ? 1 : 0) << IS_FROZEN_START_BIT_POSITION); } /** * @dev Gets the frozen state of the reserve * @param self The reserve configuration * @return The frozen state **/ function getFrozen(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) { return (self.data & ~FROZEN_MASK) != 0; } /** * @dev Enables or disables borrowing on the reserve * @param self The reserve configuration * @param enabled True if the borrowing needs to be enabled, false otherwise **/ function setBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled) internal pure { self.data = (self.data & BORROWING_MASK) | (uint256(enabled ? 1 : 0) << BORROWING_ENABLED_START_BIT_POSITION); } /** * @dev Gets the borrowing state of the reserve * @param self The reserve configuration * @return The borrowing state **/ function getBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) { return (self.data & ~BORROWING_MASK) != 0; } /** * @dev Enables or disables stable rate borrowing on the reserve * @param self The reserve configuration * @param enabled True if the stable rate borrowing needs to be enabled, false otherwise **/ function setStableRateBorrowingEnabled( DataTypes.ReserveConfigurationMap memory self, bool enabled ) internal pure { self.data = (self.data & STABLE_BORROWING_MASK) | (uint256(enabled ? 1 : 0) << STABLE_BORROWING_ENABLED_START_BIT_POSITION); } /** * @dev Gets the stable rate borrowing state of the reserve * @param self The reserve configuration * @return The stable rate borrowing state **/ function getStableRateBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) { return (self.data & ~STABLE_BORROWING_MASK) != 0; } /** * @dev Sets the reserve factor of the reserve * @param self The reserve configuration * @param reserveFactor The reserve factor **/ function setReserveFactor(DataTypes.ReserveConfigurationMap memory self, uint256 reserveFactor) internal pure { require(reserveFactor <= MAX_VALID_RESERVE_FACTOR, Errors.RC_INVALID_RESERVE_FACTOR); self.data = (self.data & RESERVE_FACTOR_MASK) | (reserveFactor << RESERVE_FACTOR_START_BIT_POSITION); } /** * @dev Gets the reserve factor of the reserve * @param self The reserve configuration * @return The reserve factor **/ function getReserveFactor(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) { return (self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION; } /** * @dev Gets the configuration flags of the reserve * @param self The reserve configuration * @return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled **/ function getFlags(DataTypes.ReserveConfigurationMap storage self) internal view returns ( bool, bool, bool, bool ) { uint256 dataLocal = self.data; return ( (dataLocal & ~ACTIVE_MASK) != 0, (dataLocal & ~FROZEN_MASK) != 0, (dataLocal & ~BORROWING_MASK) != 0, (dataLocal & ~STABLE_BORROWING_MASK) != 0 ); } /** * @dev Gets the configuration paramters of the reserve * @param self The reserve configuration * @return The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals **/ function getParams(DataTypes.ReserveConfigurationMap storage self) internal view returns ( uint256, uint256, uint256, uint256, uint256 ) { uint256 dataLocal = self.data; return ( dataLocal & ~LTV_MASK, (dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION, (dataLocal & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION, (dataLocal & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION, (dataLocal & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION ); } /** * @dev Gets the configuration paramters of the reserve from a memory object * @param self The reserve configuration * @return The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals **/ function getParamsMemory(DataTypes.ReserveConfigurationMap memory self) internal pure returns ( uint256, uint256, uint256, uint256, uint256 ) { return ( self.data & ~LTV_MASK, (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION, (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION, (self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION, (self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION ); } /** * @dev Gets the configuration flags of the reserve from a memory object * @param self The reserve configuration * @return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled **/ function getFlagsMemory(DataTypes.ReserveConfigurationMap memory self) internal pure returns ( bool, bool, bool, bool ) { return ( (self.data & ~ACTIVE_MASK) != 0, (self.data & ~FROZEN_MASK) != 0, (self.data & ~BORROWING_MASK) != 0, (self.data & ~STABLE_BORROWING_MASK) != 0 ); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; /** * @title Errors library * @author Aave * @notice Defines the error messages emitted by the different contracts of the Aave protocol * @dev Error messages prefix glossary: * - VL = ValidationLogic * - MATH = Math libraries * - CT = Common errors between tokens (AToken, VariableDebtToken and StableDebtToken) * - AT = AToken * - SDT = StableDebtToken * - VDT = VariableDebtToken * - LP = LendingPool * - LPAPR = LendingPoolAddressesProviderRegistry * - LPC = LendingPoolConfiguration * - RL = ReserveLogic * - LPCM = LendingPoolCollateralManager * - P = Pausable */ library Errors { //common errors string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin' string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small //contract specific errors string public constant VL_INVALID_AMOUNT = '1'; // 'Amount must be greater than 0' string public constant VL_NO_ACTIVE_RESERVE = '2'; // 'Action requires an active reserve' string public constant VL_RESERVE_FROZEN = '3'; // 'Action cannot be performed because the reserve is frozen' string public constant VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = '4'; // 'The current liquidity is not enough' string public constant VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE = '5'; // 'User cannot withdraw more than the available balance' string public constant VL_TRANSFER_NOT_ALLOWED = '6'; // 'Transfer cannot be allowed.' string public constant VL_BORROWING_NOT_ENABLED = '7'; // 'Borrowing is not enabled' string public constant VL_INVALID_INTEREST_RATE_MODE_SELECTED = '8'; // 'Invalid interest rate mode selected' string public constant VL_COLLATERAL_BALANCE_IS_0 = '9'; // 'The collateral balance is 0' string public constant VL_HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = '10'; // 'Health factor is lesser than the liquidation threshold' string public constant VL_COLLATERAL_CANNOT_COVER_NEW_BORROW = '11'; // 'There is not enough collateral to cover a new borrow' string public constant VL_STABLE_BORROWING_NOT_ENABLED = '12'; // stable borrowing not enabled string public constant VL_COLLATERAL_SAME_AS_BORROWING_CURRENCY = '13'; // collateral is (mostly) the same currency that is being borrowed string public constant VL_AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE = '14'; // 'The requested amount is greater than the max loan size in stable rate mode string public constant VL_NO_DEBT_OF_SELECTED_TYPE = '15'; // 'for repayment of stable debt, the user needs to have stable debt, otherwise, he needs to have variable debt' string public constant VL_NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = '16'; // 'To repay on behalf of an user an explicit amount to repay is needed' string public constant VL_NO_STABLE_RATE_LOAN_IN_RESERVE = '17'; // 'User does not have a stable rate loan in progress on this reserve' string public constant VL_NO_VARIABLE_RATE_LOAN_IN_RESERVE = '18'; // 'User does not have a variable rate loan in progress on this reserve' string public constant VL_UNDERLYING_BALANCE_NOT_GREATER_THAN_0 = '19'; // 'The underlying balance needs to be greater than 0' string public constant VL_DEPOSIT_ALREADY_IN_USE = '20'; // 'User deposit is already being used as collateral' string public constant LP_NOT_ENOUGH_STABLE_BORROW_BALANCE = '21'; // 'User does not have any stable rate loan for this reserve' string public constant LP_INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = '22'; // 'Interest rate rebalance conditions were not met' string public constant LP_LIQUIDATION_CALL_FAILED = '23'; // 'Liquidation call failed' string public constant LP_NOT_ENOUGH_LIQUIDITY_TO_BORROW = '24'; // 'There is not enough liquidity available to borrow' string public constant LP_REQUESTED_AMOUNT_TOO_SMALL = '25'; // 'The requested amount is too small for a FlashLoan.' string public constant LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = '26'; // 'The actual balance of the protocol is inconsistent' string public constant LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = '27'; // 'The caller of the function is not the lending pool configurator' string public constant LP_INCONSISTENT_FLASHLOAN_PARAMS = '28'; string public constant CT_CALLER_MUST_BE_LENDING_POOL = '29'; // 'The caller of this function must be a lending pool' string public constant CT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30'; // 'User cannot give allowance to himself' string public constant CT_TRANSFER_AMOUNT_NOT_GT_0 = '31'; // 'Transferred amount needs to be greater than zero' string public constant RL_RESERVE_ALREADY_INITIALIZED = '32'; // 'Reserve has already been initialized' string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = '34'; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_ATOKEN_POOL_ADDRESS = '35'; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS = '36'; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS = '37'; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '38'; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '39'; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_ADDRESSES_PROVIDER_ID = '40'; // 'The liquidity of the reserve needs to be 0' string public constant LPC_INVALID_CONFIGURATION = '75'; // 'Invalid risk parameters for the reserve' string public constant LPC_CALLER_NOT_EMERGENCY_ADMIN = '76'; // 'The caller must be the emergency admin' string public constant LPAPR_PROVIDER_NOT_REGISTERED = '41'; // 'Provider is not registered' string public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '42'; // 'Health factor is not below the threshold' string public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '43'; // 'The collateral chosen cannot be liquidated' string public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '44'; // 'User did not borrow the specified currency' string public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '45'; // "There isn't enough liquidity available to liquidate" string public constant LPCM_NO_ERRORS = '46'; // 'No errors' string public constant LP_INVALID_FLASHLOAN_MODE = '47'; //Invalid flashloan mode selected string public constant MATH_MULTIPLICATION_OVERFLOW = '48'; string public constant MATH_ADDITION_OVERFLOW = '49'; string public constant MATH_DIVISION_BY_ZERO = '50'; string public constant RL_LIQUIDITY_INDEX_OVERFLOW = '51'; // Liquidity index overflows uint128 string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = '52'; // Variable borrow index overflows uint128 string public constant RL_LIQUIDITY_RATE_OVERFLOW = '53'; // Liquidity rate overflows uint128 string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = '54'; // Variable borrow rate overflows uint128 string public constant RL_STABLE_BORROW_RATE_OVERFLOW = '55'; // Stable borrow rate overflows uint128 string public constant CT_INVALID_MINT_AMOUNT = '56'; //invalid amount to mint string public constant LP_FAILED_REPAY_WITH_COLLATERAL = '57'; string public constant CT_INVALID_BURN_AMOUNT = '58'; //invalid amount to burn string public constant LP_FAILED_COLLATERAL_SWAP = '60'; string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61'; string public constant LP_REENTRANCY_NOT_ALLOWED = '62'; string public constant LP_CALLER_MUST_BE_AN_ATOKEN = '63'; string public constant LP_IS_PAUSED = '64'; // 'Pool is paused' string public constant LP_NO_MORE_RESERVES_ALLOWED = '65'; string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66'; string public constant RC_INVALID_LTV = '67'; string public constant RC_INVALID_LIQ_THRESHOLD = '68'; string public constant RC_INVALID_LIQ_BONUS = '69'; string public constant RC_INVALID_DECIMALS = '70'; string public constant RC_INVALID_RESERVE_FACTOR = '71'; string public constant LPAPR_INVALID_ADDRESSES_PROVIDER_ID = '72'; string public constant VL_INCONSISTENT_FLASHLOAN_PARAMS = '73'; string public constant LP_INCONSISTENT_PARAMS_LENGTH = '74'; string public constant UL_INVALID_INDEX = '77'; string public constant LP_NOT_CONTRACT = '78'; string public constant SDT_STABLE_DEBT_OVERFLOW = '79'; string public constant SDT_BURN_EXCEEDS_BALANCE = '80'; enum CollateralManagerErrors { NO_ERROR, NO_COLLATERAL_AVAILABLE, COLLATERAL_CANNOT_BE_LIQUIDATED, CURRRENCY_NOT_BORROWED, HEALTH_FACTOR_ABOVE_THRESHOLD, NOT_ENOUGH_LIQUIDITY, NO_ACTIVE_RESERVE, HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD, INVALID_EQUAL_ASSETS_TO_SWAP, FROZEN_RESERVE } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import {Errors} from '../helpers/Errors.sol'; /** * @title PercentageMath library * @author Aave * @notice Provides functions to perform percentage calculations * @dev Percentages are defined by default with 2 decimals of precision (100.00). The precision is indicated by PERCENTAGE_FACTOR * @dev Operations are rounded half up **/ library PercentageMath { uint256 constant PERCENTAGE_FACTOR = 1e4; //percentage plus two decimals uint256 constant HALF_PERCENT = PERCENTAGE_FACTOR / 2; /** * @dev Executes a percentage multiplication * @param value The value of which the percentage needs to be calculated * @param percentage The percentage of the value to be calculated * @return The percentage of value **/ function percentMul(uint256 value, uint256 percentage) internal pure returns (uint256) { if (value == 0 || percentage == 0) { return 0; } require( value <= (type(uint256).max - HALF_PERCENT) / percentage, Errors.MATH_MULTIPLICATION_OVERFLOW ); return (value * percentage + HALF_PERCENT) / PERCENTAGE_FACTOR; } /** * @dev Executes a percentage division * @param value The value of which the percentage needs to be calculated * @param percentage The percentage of the value to be calculated * @return The value divided the percentage **/ function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256) { require(percentage != 0, Errors.MATH_DIVISION_BY_ZERO); uint256 halfPercentage = percentage / 2; require( value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR, Errors.MATH_MULTIPLICATION_OVERFLOW ); return (value * PERCENTAGE_FACTOR + halfPercentage) / percentage; } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; library DataTypes { // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties. struct ReserveData { //stores the reserve configuration ReserveConfigurationMap configuration; //the liquidity index. Expressed in ray uint128 liquidityIndex; //variable borrow index. Expressed in ray uint128 variableBorrowIndex; //the current supply rate. Expressed in ray uint128 currentLiquidityRate; //the current variable borrow rate. Expressed in ray uint128 currentVariableBorrowRate; //the current stable borrow rate. Expressed in ray uint128 currentStableBorrowRate; uint40 lastUpdateTimestamp; //tokens addresses address aTokenAddress; address stableDebtTokenAddress; address variableDebtTokenAddress; //address of the interest rate strategy address interestRateStrategyAddress; //the id of the reserve. Represents the position in the list of the active reserves uint8 id; } 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: stable rate borrowing enabled //bit 60-63: reserved //bit 64-79: reserve factor uint256 data; } struct UserConfigurationMap { uint256 data; } enum InterestRateMode {NONE, STABLE, VARIABLE} }
{ "optimizer": { "enabled": true, "runs": 2000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"ATokenUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"BorrowingDisabledOnReserve","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"bool","name":"stableRateEnabled","type":"bool"}],"name":"BorrowingEnabledOnReserve","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"ltv","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidationThreshold","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidationBonus","type":"uint256"}],"name":"CollateralConfigurationChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"ReserveActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"ReserveDeactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"decimals","type":"uint256"}],"name":"ReserveDecimalsChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"factor","type":"uint256"}],"name":"ReserveFactorChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"ReserveFrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"address","name":"aToken","type":"address"},{"indexed":false,"internalType":"address","name":"stableDebtToken","type":"address"},{"indexed":false,"internalType":"address","name":"variableDebtToken","type":"address"},{"indexed":false,"internalType":"address","name":"interestRateStrategyAddress","type":"address"}],"name":"ReserveInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"address","name":"strategy","type":"address"}],"name":"ReserveInterestRateStrategyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"ReserveUnfrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"StableDebtTokenUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"StableRateDisabledOnReserve","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"StableRateEnabledOnReserve","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":true,"internalType":"address","name":"proxy","type":"address"},{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"VariableDebtTokenUpgraded","type":"event"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"activateReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"aTokenImpl","type":"address"},{"internalType":"address","name":"stableDebtTokenImpl","type":"address"},{"internalType":"address","name":"variableDebtTokenImpl","type":"address"},{"internalType":"uint8","name":"underlyingAssetDecimals","type":"uint8"},{"internalType":"address","name":"interestRateStrategyAddress","type":"address"},{"internalType":"address","name":"underlyingAsset","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"incentivesController","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"string","name":"underlyingAssetName","type":"string"},{"internalType":"string","name":"aTokenName","type":"string"},{"internalType":"string","name":"aTokenSymbol","type":"string"},{"internalType":"string","name":"variableDebtTokenName","type":"string"},{"internalType":"string","name":"variableDebtTokenSymbol","type":"string"},{"internalType":"string","name":"stableDebtTokenName","type":"string"},{"internalType":"string","name":"stableDebtTokenSymbol","type":"string"},{"internalType":"bytes","name":"params","type":"bytes"}],"internalType":"struct ILendingPoolConfigurator.InitReserveInput[]","name":"input","type":"tuple[]"}],"name":"batchInitReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"ltv","type":"uint256"},{"internalType":"uint256","name":"liquidationThreshold","type":"uint256"},{"internalType":"uint256","name":"liquidationBonus","type":"uint256"}],"name":"configureReserveAsCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"deactivateReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"disableBorrowingOnReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"disableReserveStableRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bool","name":"stableBorrowRateEnabled","type":"bool"}],"name":"enableBorrowingOnReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"enableReserveStableRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"freezeReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILendingPoolAddressesProvider","name":"provider","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"val","type":"bool"}],"name":"setPoolPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"reserveFactor","type":"uint256"}],"name":"setReserveFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"rateStrategyAddress","type":"address"}],"name":"setReserveInterestRateStrategyAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"unfreezeReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"treasury","type":"address"},{"internalType":"address","name":"incentivesController","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"params","type":"bytes"}],"internalType":"struct ILendingPoolConfigurator.UpdateATokenInput","name":"input","type":"tuple"}],"name":"updateAToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"incentivesController","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"params","type":"bytes"}],"internalType":"struct ILendingPoolConfigurator.UpdateDebtTokenInput","name":"input","type":"tuple"}],"name":"updateStableDebtToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"incentivesController","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"implementation","type":"address"},{"internalType":"bytes","name":"params","type":"bytes"}],"internalType":"struct ILendingPoolConfigurator.UpdateDebtTokenInput","name":"input","type":"tuple"}],"name":"updateVariableDebtToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526000805534801561001457600080fd5b50614445806100246000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c8063ab646186116100b2578063bf34418311610081578063eede87c111610066578063eede87c11461022c578063ef1f93731461023f578063f53a2515146102525761011b565b8063bf34418314610206578063c4d66de8146102195761011b565b8063ab646186146101ba578063ad4e6432146101cd578063b75d6f34146101e0578063bb01c37c146101f35761011b565b80637641f3d9116100ee5780637641f3d91461016e5780637aca76eb146101815780637c4e560b14610194578063a8dc0f45146101a75761011b565b80631d2118f9146101205780633e72a454146101355780634b4e6753146101485780637626cde31461015b575b600080fd5b61013361012e366004613528565b610265565b005b6101336101433660046134e9565b6103f0565b610133610156366004613594565b6105e4565b6101336101693660046137c5565b6107dc565b61013361017c366004613668565b610b1e565b61013361018f3660046134e9565b610c90565b6101336101a23660046135bf565b610e7b565b6101336101b53660046134e9565b61119d565b6101336101c83660046135f9565b611388565b6101336101db3660046137c5565b611494565b6101336101ee3660046134e9565b61175f565b61013361020136600461378d565b61194a565b6101336102143660046134e9565b611c40565b6101336102273660046134e9565b611e2b565b61013361023a366004613560565b611fc5565b61013361024d3660046134e9565b6121bb565b6101336102603660046134e9565b6123a6565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156102a957600080fd5b505afa1580156102bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e1919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061032d5760405162461bcd60e51b81526004016103249190613af0565b60405180910390fd5b506035546040517f1d2118f90000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690631d2118f99061037990859085906004016138ba565b600060405180830381600087803b15801561039357600080fd5b505af11580156103a7573d6000803e3d6000fd5b50505050816001600160a01b03167f5644b64ebb0ce18c4032248ca52f58355469092ff072866c3dcd8640e817d6a5826040516103e491906138a6565b60405180910390a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046c919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906104af5760405162461bcd60e51b81526004016103249190613af0565b506104b981612591565b60355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906104ea9085906004016138a6565b60206040518083038186803b15801561050257600080fd5b505afa158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a9190613682565b9050610547816000612728565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161057a91869190600401613953565b600060405180830381600087803b15801561059457600080fd5b505af11580156105a8573d6000803e3d6000fd5b50506040516001600160a01b03851692507f6f60cf8bd0f218cabe1ea3150bd07b0b758c35c4cfdf7138017a283e65564d5e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561062857600080fd5b505afa15801561063c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610660919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906106a35760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906106d59086906004016138a6565b60206040518083038186803b1580156106ed57600080fd5b505afa158015610701573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107259190613682565b9050610731818361276d565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161076491879190600401613953565b600060405180830381600087803b15801561077e57600080fd5b505af1158015610792573d6000803e3d6000fd5b50505050826001600160a01b03167f2694ccb0b585b6a54b8d8b4a47aa874b05c257b43d34e98aee50838be00d3405836040516107cf9190613b03565b60405180910390a2505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561082057600080fd5b505afa158015610834573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610858919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061089b5760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b03166000816335ea6a756108bd60208601866134e9565b6040518263ffffffff1660e01b81526004016108d991906138a6565b6101806040518083038186803b1580156108f257600080fd5b505afa158015610906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092a919061369d565b905060006109be6001600160a01b03841663c44b11f761094d60208801886134e9565b6040518263ffffffff1660e01b815260040161096991906138a6565b60206040518083038186803b15801561098157600080fd5b505afa158015610995573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b99190613682565b61285f565b50935060009250636111764560e11b91508590506109df60208801886134e9565b6109ef6040890160208a016134e9565b856109fd60408b018b613b6e565b610a0a60608d018d613b6e565b610a1760a08f018f613b22565b604051602401610a309a99989796959493929190613a3e565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610100840151909150610ab290610aac60a08801608089016134e9565b8361288a565b610ac260a08601608087016134e9565b6101008401516001600160a01b039182169116610ae260208801886134e9565b6001600160a01b03167f7a943a5b6c214bf7726c069a878b1e2a8e7371981d516048b84e03743e67bc2860405160405180910390a45050505050565b603454604080517fddcaa9ea000000000000000000000000000000000000000000000000000000008152905133926001600160a01b03169163ddcaa9ea916004808301926020929190829003018186803b158015610b7b57600080fd5b505afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb3919061350c565b6001600160a01b0316146040518060400160405280600281526020017f373600000000000000000000000000000000000000000000000000000000000081525090610c115760405162461bcd60e51b81526004016103249190613af0565b506035546040517fbedb86fb0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063bedb86fb90610c5b90849060040161396c565b600060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b5050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610cd457600080fd5b505afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610d4f5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790610d819085906004016138a6565b60206040518083038186803b158015610d9957600080fd5b505afa158015610dad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd19190613682565b9050610dde81600161290b565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691610e1191869190600401613953565b600060405180830381600087803b158015610e2b57600080fd5b505af1158015610e3f573d6000803e3d6000fd5b50506040516001600160a01b03851692507f85dc710add8a0914461a7dc5a63f6fc529a7700f8c6089a3faf5e93256ccf12a9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610ebf57600080fd5b505afa158015610ed3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef7919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610f3a5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790610f6c9088906004016138a6565b60206040518083038186803b158015610f8457600080fd5b505afa158015610f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbc9190613682565b90508284111560405180604001604052806002815260200161373560f01b81525090610ffb5760405162461bcd60e51b81526004016103249190613af0565b50821561108c57604080518082019091526002815261373560f01b6020820152612710831161103d5760405162461bcd60e51b81526004016103249190613af0565b5061271061104b8484612950565b111560405180604001604052806002815260200161373560f01b815250906110865760405162461bcd60e51b81526004016103249190613af0565b506110ce565b604080518082019091526002815261373560f01b602082015282156110c45760405162461bcd60e51b81526004016103249190613af0565b506110ce85612591565b6110d88185612a2d565b6110e28184612adc565b6110ec8183612b91565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161111f91899190600401613953565b600060405180830381600087803b15801561113957600080fd5b505af115801561114d573d6000803e3d6000fd5b50505050846001600160a01b03167f637febbda9275aea2e85c0ff690444c8d87eb2e8339bbede9715abcc89cb099585858560405161118e93929190613b0c565b60405180910390a25050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156111e157600080fd5b505afa1580156111f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611219919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061125c5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79061128e9085906004016138a6565b60206040518083038186803b1580156112a657600080fd5b505afa1580156112ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112de9190613682565b90506112eb816000612c46565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161131e91869190600401613953565b600060405180830381600087803b15801561133857600080fd5b505af115801561134c573d6000803e3d6000fd5b50506040516001600160a01b03851692507fe9a7e5fd4fc8ea18e602350324bf48e8f05d12434af0ce0be05743e6a5fdcb9e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156113cc57600080fd5b505afa1580156113e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611404919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906114475760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b031660005b8281101561148e576114868285858481811061146f57fe5b90506020028101906114819190613b84565b612c8b565b600101611457565b50505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156114d857600080fd5b505afa1580156114ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611510919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906115535760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b03166000816335ea6a7561157560208601866134e9565b6040518263ffffffff1660e01b815260040161159191906138a6565b6101806040518083038186803b1580156115aa57600080fd5b505afa1580156115be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e2919061369d565b905060006116056001600160a01b03841663c44b11f761094d60208801886134e9565b50935060009250636111764560e11b915085905061162660208801886134e9565b6116366040890160208a016134e9565b8561164460408b018b613b6e565b61165160608d018d613b6e565b61165e60a08f018f613b22565b6040516024016116779a99989796959493929190613a3e565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526101208401519091506116f390610aac60a08801608089016134e9565b61170360a08601608087016134e9565b6101208401516001600160a01b03918216911661172360208801886134e9565b6001600160a01b03167f9439658a562a5c46b1173589df89cf001483d685bad28aedaff4a88656292d8160405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156117a357600080fd5b505afa1580156117b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117db919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061181e5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906118509085906004016138a6565b60206040518083038186803b15801561186857600080fd5b505afa15801561187c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a09190613682565b90506118ad816001612728565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916118e091869190600401613953565b600060405180830381600087803b1580156118fa57600080fd5b505af115801561190e573d6000803e3d6000fd5b50506040516001600160a01b03851692507f35b80cd8ea3440e9a8454f116fa658b858da1b64c86c48451f4559cefcdfb56c9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561198e57600080fd5b505afa1580156119a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c6919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611a095760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b03166000816335ea6a75611a2b60208601866134e9565b6040518263ffffffff1660e01b8152600401611a4791906138a6565b6101806040518083038186803b158015611a6057600080fd5b505afa158015611a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a98919061369d565b90506000611abb6001600160a01b03841663c44b11f761094d60208801886134e9565b509350600092507f183fb413000000000000000000000000000000000000000000000000000000009150859050611af860408801602089016134e9565b611b0560208901896134e9565b611b1560608a0160408b016134e9565b86611b2360608c018c613b6e565b611b3060808e018e613b6e565b8e8060c00190611b409190613b22565b604051602401611b5a9b9a99989796959493929190613977565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915260e0840151909150611bd590610aac60c0880160a089016134e9565b611be560c0860160a087016134e9565b60e08401516001600160a01b039182169116611c0460208801886134e9565b6001600160a01b03167fa76f65411ec66a7fb6bc467432eb14767900449ae4469fa295e4441fe5e1cb7360405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611c8457600080fd5b505afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611cff5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790611d319085906004016138a6565b60206040518083038186803b158015611d4957600080fd5b505afa158015611d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d819190613682565b9050611d8e816001613282565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691611dc191869190600401613953565b600060405180830381600087803b158015611ddb57600080fd5b505af1158015611def573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8dee2b2f3e98319ae6347eda521788f73f4086c9be9a594942b370b137fb8cb19150600090a25050565b6000611e356132c7565b60015490915060ff1680611e4c5750611e4c6132cc565b80611e58575060005481115b611e935760405162461bcd60e51b815260040180806020018281038252602e8152602001806143e2602e913960400191505060405180910390fd5b60015460ff16158015611eb2576001805460ff19168117905560008290555b603480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038581169190911791829055604080517f0261bf8b00000000000000000000000000000000000000000000000000000000815290519290911691630261bf8b91600480820192602092909190829003018186803b158015611f3f57600080fd5b505afa158015611f53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f77919061350c565b603580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169190911790558015611fc0576001805460ff191690555b505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561200957600080fd5b505afa15801561201d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612041919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906120845760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906120b69086906004016138a6565b60206040518083038186803b1580156120ce57600080fd5b505afa1580156120e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121069190613682565b9050612113816001612c46565b61211d8183613282565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161215091879190600401613953565b600060405180830381600087803b15801561216a57600080fd5b505af115801561217e573d6000803e3d6000fd5b50505050826001600160a01b03167fab2f7f9e5ca2772fafa94f355c1842a80ae6b9e41f83083098d81f67d7a0b508836040516107cf919061396c565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156121ff57600080fd5b505afa158015612213573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612237919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061227a5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906122ac9085906004016138a6565b60206040518083038186803b1580156122c457600080fd5b505afa1580156122d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fc9190613682565b905061230981600061290b565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161233c91869190600401613953565b600060405180830381600087803b15801561235657600080fd5b505af115801561236a573d6000803e3d6000fd5b50506040516001600160a01b03851692507f838ecdc4709a31a26db48b0c853212cedde3f725f07030079d793fb0719647609150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156123ea57600080fd5b505afa1580156123fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612422919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906124655760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906124979085906004016138a6565b60206040518083038186803b1580156124af57600080fd5b505afa1580156124c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e79190613682565b90506124f4816000613282565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161252791869190600401613953565b600060405180830381600087803b15801561254157600080fd5b505af1158015612555573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8bbf35441ac2c607ddecadd3d8ee58636d32f217fad201fb2655581502dd84e39150600090a25050565b6035546040517f35ea6a750000000000000000000000000000000000000000000000000000000081526000916001600160a01b0316906335ea6a75906125db9085906004016138a6565b6101806040518083038186803b1580156125f457600080fd5b505afa158015612608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262c919061369d565b90506000826001600160a01b03166370a082318360e001516040518263ffffffff1660e01b815260040161266091906138a6565b60206040518083038186803b15801561267857600080fd5b505afa15801561268c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b091906137fd565b9050801580156126d4575060608201516fffffffffffffffffffffffffffffffff16155b6040518060400160405280600281526020017f33340000000000000000000000000000000000000000000000000000000000008152509061148e5760405162461bcd60e51b81526004016103249190613af0565b603881612736576000612739565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffff1660ff9190911690911b1790915250565b60408051808201909152600281527f3731000000000000000000000000000000000000000000000000000000000000602082015261ffff82111561282f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156127f45781810151838201526020016127dc565b50505050905090810190601f1680156128215780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5081517fffffffffffffffffffffffffffffffffffffffffffff0000ffffffffffffffff1660409190911b179052565b5161ffff80821692601083901c821692602081901c831692603082901c60ff169260409290921c1690565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815283906001600160a01b03821690634f1ef286906128d39086908690600401613929565b600060405180830381600087803b1580156128ed57600080fd5b505af1158015612901573d6000803e3d6000fd5b5050505050505050565b60398161291957600061291c565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffffdffffffffffffff1660ff9190911690911b1790915250565b600082158061295d575081155b1561296a57506000612a27565b817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec778161299357fe5b048311156040518060400160405280600281526020017f343800000000000000000000000000000000000000000000000000000000000081525090612a195760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b505061271061138882840201045b92915050565b60408051808201909152600281527f3637000000000000000000000000000000000000000000000000000000000000602082015261ffff821115612ab25760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016179052565b60408051808201909152600281527f3638000000000000000000000000000000000000000000000000000000000000602082015261ffff821115612b615760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffff1660109190911b179052565b60408051808201909152600281527f3639000000000000000000000000000000000000000000000000000000000000602082015261ffff821115612c165760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffffffff1660209190911b179052565b603a81612c54576000612c57565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffffbffffffffffffff1660ff9190911690911b1790915250565b6000612c9e610100830160e084016134e9565b90506000612db0612cb260208501856134e9565b7f183fb4130000000000000000000000000000000000000000000000000000000086612ce460e0880160c089016134e9565b612cf460c0890160a08a016134e9565b87612d0560808b0160608c01613815565b612d136101408c018c613b6e565b612d216101608e018e613b6e565b8e806102000190612d329190613b22565b604051602401612d4c9b9a999897969594939291906139f7565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526132d2565b6040517f32a9caba0000000000000000000000000000000000000000000000000000000081529091506001600160a01b038316906332a9caba90612dff90849061010088013590600401613953565b600060405180830381600087803b158015612e1957600080fd5b505af1158015612e2d573d6000803e3d6000fd5b50612e429250505060e0840160c085016134e9565b6001600160a01b0316639c9b2e21826040518263ffffffff1660e01b8152600401612e6d91906138a6565b600060405180830381600087803b158015612e8757600080fd5b505af1158015612e9b573d6000803e3d6000fd5b505050506000612f37846020016020810190612eb791906134e9565b636111764560e11b87612ed060c0890160a08a016134e9565b612ee16101008a0160e08b016134e9565b612ef160808b0160608c01613815565b612eff6101c08c018c613b6e565b612f0d6101e08e018e613b6e565b8e806102000190612f1e9190613b22565b604051602401612d4c9a99989796959493929190613ab2565b90506000612fb5612f4e60608701604088016134e9565b636111764560e11b88612f6760c08a0160a08b016134e9565b612f786101008b0160e08c016134e9565b612f8860808c0160608d01613815565b612f966101808d018d613b6e565b612fa46101a08f018f613b6e565b8f806102000190612f1e9190613b22565b6040517f32a9caba0000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906332a9caba906130049084906101008a013590600401613953565b600060405180830381600087803b15801561301e57600080fd5b505af1158015613032573d6000803e3d6000fd5b5050506001600160a01b0387169050637a708e9261305660c0880160a089016134e9565b85858561306960a08c0160808d016134e9565b6040518663ffffffff1660e01b81526004016130899594939291906138f7565b600060405180830381600087803b1580156130a357600080fd5b505af11580156130b7573d6000803e3d6000fd5b506000925050506001600160a01b03871663c44b11f76130dd60c0890160a08a016134e9565b6040518263ffffffff1660e01b81526004016130f991906138a6565b60206040518083038186803b15801561311157600080fd5b505afa158015613125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131499190613682565b905061316861315e6080880160608901613815565b829060ff1661338d565b613173816001612728565b61317e81600061290b565b6001600160a01b03871663b8d2927661319d60c0890160a08a016134e9565b83516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526131d9929190600401613953565b600060405180830381600087803b1580156131f357600080fd5b505af1158015613207573d6000803e3d6000fd5b5050506001600160a01b038516905061322660c0880160a089016134e9565b6001600160a01b03167f3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f858561326260a08c0160808d016134e9565b604051613271939291906138d4565b60405180910390a350505050505050565b603b81613290576000613293565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffff7ffffffffffffff1660ff9190911690911b1790915250565b600190565b303b1590565b600080306040516132e290613441565b6132ec91906138a6565b604051809103906000f080158015613308573d6000803e3d6000fd5b506040517fd1f578940000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063d1f57894906133539087908790600401613929565b600060405180830381600087803b15801561336d57600080fd5b505af1158015613381573d6000803e3d6000fd5b50929695505050505050565b60408051808201909152600281527f3730000000000000000000000000000000000000000000000000000000000000602082015260ff8211156134115760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffff1660309190911b179052565b6107d580613c0d83390190565b805161345981613be5565b919050565b8035801515811461345957600080fd5b60006020828403121561347f578081fd5b6040516020810181811067ffffffffffffffff8211171561349c57fe5b6040529151825250919050565b80516fffffffffffffffffffffffffffffffff8116811461345957600080fd5b805164ffffffffff8116811461345957600080fd5b805161345981613bfd565b6000602082840312156134fa578081fd5b813561350581613be5565b9392505050565b60006020828403121561351d578081fd5b815161350581613be5565b6000806040838503121561353a578081fd5b823561354581613be5565b9150602083013561355581613be5565b809150509250929050565b60008060408385031215613572578182fd5b823561357d81613be5565b915061358b6020840161345e565b90509250929050565b600080604083850312156135a6578182fd5b82356135b181613be5565b946020939093013593505050565b600080600080608085870312156135d4578182fd5b84356135df81613be5565b966020860135965060408601359560600135945092505050565b6000806020838503121561360b578182fd5b823567ffffffffffffffff80821115613622578384fd5b818501915085601f830112613635578384fd5b813581811115613643578485fd5b8660208083028501011115613656578485fd5b60209290920196919550909350505050565b600060208284031215613679578081fd5b6135058261345e565b600060208284031215613693578081fd5b613505838361346e565b60006101808083850312156136b0578182fd5b6136b981613bc1565b90506136c5848461346e565b81526136d3602084016134a9565b60208201526136e4604084016134a9565b60408201526136f5606084016134a9565b6060820152613706608084016134a9565b608082015261371760a084016134a9565b60a082015261372860c084016134c9565b60c082015261373960e0840161344e565b60e082015261010061374c81850161344e565b9082015261012061375e84820161344e565b9082015261014061377084820161344e565b908201526101606137828482016134de565b908201529392505050565b60006020828403121561379e578081fd5b813567ffffffffffffffff8111156137b4578182fd5b820160e08185031215613505578182fd5b6000602082840312156137d6578081fd5b813567ffffffffffffffff8111156137ec578182fd5b820160c08185031215613505578182fd5b60006020828403121561380e578081fd5b5051919050565b600060208284031215613826578081fd5b813561350581613bfd565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452815b8181101561388057602081850181015186830182015201613864565b818111156138915782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b60006001600160a01b03841682526040602083015261394b604083018461385b565b949350505050565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b60006101006001600160a01b03808f168452808e166020850152808d166040850152808c166060850152508960808401528060a08401526139bb818401898b613831565b905082810360c08401526139d0818789613831565b905082810360e08401526139e5818587613831565b9e9d5050505050505050505050505050565b60006101006001600160a01b03808f168452808e166020850152808d166040850152808c1660608501525060ff8a1660808401528060a08401526139bb818401898b613831565b60006001600160a01b03808d168352808c166020840152808b1660408401525088606083015260e06080830152613a7960e08301888a613831565b82810360a0840152613a8c818789613831565b905082810360c0840152613aa1818587613831565b9d9c50505050505050505050505050565b60006001600160a01b03808d168352808c166020840152808b1660408401525060ff8916606083015260e06080830152613a7960e08301888a613831565b600060208252613505602083018461385b565b90815260200190565b9283526020830191909152604082015260600190565b6000808335601e19843603018112613b38578283fd5b83018035915067ffffffffffffffff821115613b52578283fd5b602001915036819003821315613b6757600080fd5b9250929050565b6000808335601e19843603018112613b38578182fd5b600082357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffde1833603018112613bb7578182fd5b9190910192915050565b60405181810167ffffffffffffffff81118282101715613bdd57fe5b604052919050565b6001600160a01b0381168114613bfa57600080fd5b50565b60ff81168114613bfa57600080fdfe60a060405234801561001057600080fd5b506040516107d53803806107d58339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b03166107556100806000398061023852806102825280610341528061048c52806104b552806105f752506107556000f3fe60806040526004361061005a5760003560e01c80635c60da1b116100435780635c60da1b14610117578063d1f5789414610148578063f851a440146101fe5761005a565b80633659cfe6146100645780634f1ef28614610097575b610062610213565b005b34801561007057600080fd5b506100626004803603602081101561008757600080fd5b50356001600160a01b031661022d565b610062600480360360408110156100ad57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d857600080fd5b8201836020820111156100ea57600080fd5b8035906020019184600183028401116401000000008311171561010c57600080fd5b509092509050610277565b34801561012357600080fd5b5061012c610334565b604080516001600160a01b039092168252519081900360200190f35b6100626004803603604081101561015e57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561018957600080fd5b82018360208201111561019b57600080fd5b803590602001918460018302840111640100000000831117156101bd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610381945050505050565b34801561020a57600080fd5b5061012c61047f565b61021b6104d9565b61022b6102266104e1565b610506565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561026c576102678161052a565b610274565b610274610213565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610327576102b18361052a565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461030e576040519150601f19603f3d011682016040523d82523d6000602084013e610313565b606091505b505090508061032157600080fd5b5061032f565b61032f610213565b505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156103765761036f6104e1565b905061037e565b61037e610213565b90565b600061038b6104e1565b6001600160a01b03161461039e57600080fd5b6103a78261056a565b80511561047b576000826001600160a01b0316826040518082805190602001908083835b6020831061040857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016103cb565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610468576040519150601f19603f3d011682016040523d82523d6000602084013e61046d565b606091505b505090508061032f57600080fd5b5050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561037657507f000000000000000000000000000000000000000000000000000000000000000061037e565b61022b6105ec565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610525573d6000f35b3d6000fd5b6105338161056a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61057381610676565b6105c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001806106e5603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561066e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806106b36032913960400191505060405180910390fd5b61022b61022b565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906106aa57508115155b94935050505056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212200e600d9f189227522a8b04fbac052a1db14fa6d18e44c1bf5033fc536068b0b764736f6c63430007060033436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a26469706673582212203aeb3a593088f6ff9155b44ccf27ea2a13df25e9133befcd667b401f9808854564736f6c63430007060033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061011b5760003560e01c8063ab646186116100b2578063bf34418311610081578063eede87c111610066578063eede87c11461022c578063ef1f93731461023f578063f53a2515146102525761011b565b8063bf34418314610206578063c4d66de8146102195761011b565b8063ab646186146101ba578063ad4e6432146101cd578063b75d6f34146101e0578063bb01c37c146101f35761011b565b80637641f3d9116100ee5780637641f3d91461016e5780637aca76eb146101815780637c4e560b14610194578063a8dc0f45146101a75761011b565b80631d2118f9146101205780633e72a454146101355780634b4e6753146101485780637626cde31461015b575b600080fd5b61013361012e366004613528565b610265565b005b6101336101433660046134e9565b6103f0565b610133610156366004613594565b6105e4565b6101336101693660046137c5565b6107dc565b61013361017c366004613668565b610b1e565b61013361018f3660046134e9565b610c90565b6101336101a23660046135bf565b610e7b565b6101336101b53660046134e9565b61119d565b6101336101c83660046135f9565b611388565b6101336101db3660046137c5565b611494565b6101336101ee3660046134e9565b61175f565b61013361020136600461378d565b61194a565b6101336102143660046134e9565b611c40565b6101336102273660046134e9565b611e2b565b61013361023a366004613560565b611fc5565b61013361024d3660046134e9565b6121bb565b6101336102603660046134e9565b6123a6565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156102a957600080fd5b505afa1580156102bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e1919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061032d5760405162461bcd60e51b81526004016103249190613af0565b60405180910390fd5b506035546040517f1d2118f90000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690631d2118f99061037990859085906004016138ba565b600060405180830381600087803b15801561039357600080fd5b505af11580156103a7573d6000803e3d6000fd5b50505050816001600160a01b03167f5644b64ebb0ce18c4032248ca52f58355469092ff072866c3dcd8640e817d6a5826040516103e491906138a6565b60405180910390a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046c919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906104af5760405162461bcd60e51b81526004016103249190613af0565b506104b981612591565b60355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906104ea9085906004016138a6565b60206040518083038186803b15801561050257600080fd5b505afa158015610516573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053a9190613682565b9050610547816000612728565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161057a91869190600401613953565b600060405180830381600087803b15801561059457600080fd5b505af11580156105a8573d6000803e3d6000fd5b50506040516001600160a01b03851692507f6f60cf8bd0f218cabe1ea3150bd07b0b758c35c4cfdf7138017a283e65564d5e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561062857600080fd5b505afa15801561063c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610660919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906106a35760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906106d59086906004016138a6565b60206040518083038186803b1580156106ed57600080fd5b505afa158015610701573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107259190613682565b9050610731818361276d565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161076491879190600401613953565b600060405180830381600087803b15801561077e57600080fd5b505af1158015610792573d6000803e3d6000fd5b50505050826001600160a01b03167f2694ccb0b585b6a54b8d8b4a47aa874b05c257b43d34e98aee50838be00d3405836040516107cf9190613b03565b60405180910390a2505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561082057600080fd5b505afa158015610834573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610858919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061089b5760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b03166000816335ea6a756108bd60208601866134e9565b6040518263ffffffff1660e01b81526004016108d991906138a6565b6101806040518083038186803b1580156108f257600080fd5b505afa158015610906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092a919061369d565b905060006109be6001600160a01b03841663c44b11f761094d60208801886134e9565b6040518263ffffffff1660e01b815260040161096991906138a6565b60206040518083038186803b15801561098157600080fd5b505afa158015610995573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b99190613682565b61285f565b50935060009250636111764560e11b91508590506109df60208801886134e9565b6109ef6040890160208a016134e9565b856109fd60408b018b613b6e565b610a0a60608d018d613b6e565b610a1760a08f018f613b22565b604051602401610a309a99989796959493929190613a3e565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610100840151909150610ab290610aac60a08801608089016134e9565b8361288a565b610ac260a08601608087016134e9565b6101008401516001600160a01b039182169116610ae260208801886134e9565b6001600160a01b03167f7a943a5b6c214bf7726c069a878b1e2a8e7371981d516048b84e03743e67bc2860405160405180910390a45050505050565b603454604080517fddcaa9ea000000000000000000000000000000000000000000000000000000008152905133926001600160a01b03169163ddcaa9ea916004808301926020929190829003018186803b158015610b7b57600080fd5b505afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb3919061350c565b6001600160a01b0316146040518060400160405280600281526020017f373600000000000000000000000000000000000000000000000000000000000081525090610c115760405162461bcd60e51b81526004016103249190613af0565b506035546040517fbedb86fb0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063bedb86fb90610c5b90849060040161396c565b600060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b5050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610cd457600080fd5b505afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610d4f5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790610d819085906004016138a6565b60206040518083038186803b158015610d9957600080fd5b505afa158015610dad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd19190613682565b9050610dde81600161290b565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691610e1191869190600401613953565b600060405180830381600087803b158015610e2b57600080fd5b505af1158015610e3f573d6000803e3d6000fd5b50506040516001600160a01b03851692507f85dc710add8a0914461a7dc5a63f6fc529a7700f8c6089a3faf5e93256ccf12a9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610ebf57600080fd5b505afa158015610ed3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef7919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610f3a5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790610f6c9088906004016138a6565b60206040518083038186803b158015610f8457600080fd5b505afa158015610f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbc9190613682565b90508284111560405180604001604052806002815260200161373560f01b81525090610ffb5760405162461bcd60e51b81526004016103249190613af0565b50821561108c57604080518082019091526002815261373560f01b6020820152612710831161103d5760405162461bcd60e51b81526004016103249190613af0565b5061271061104b8484612950565b111560405180604001604052806002815260200161373560f01b815250906110865760405162461bcd60e51b81526004016103249190613af0565b506110ce565b604080518082019091526002815261373560f01b602082015282156110c45760405162461bcd60e51b81526004016103249190613af0565b506110ce85612591565b6110d88185612a2d565b6110e28184612adc565b6110ec8183612b91565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161111f91899190600401613953565b600060405180830381600087803b15801561113957600080fd5b505af115801561114d573d6000803e3d6000fd5b50505050846001600160a01b03167f637febbda9275aea2e85c0ff690444c8d87eb2e8339bbede9715abcc89cb099585858560405161118e93929190613b0c565b60405180910390a25050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156111e157600080fd5b505afa1580156111f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611219919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061125c5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79061128e9085906004016138a6565b60206040518083038186803b1580156112a657600080fd5b505afa1580156112ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112de9190613682565b90506112eb816000612c46565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161131e91869190600401613953565b600060405180830381600087803b15801561133857600080fd5b505af115801561134c573d6000803e3d6000fd5b50506040516001600160a01b03851692507fe9a7e5fd4fc8ea18e602350324bf48e8f05d12434af0ce0be05743e6a5fdcb9e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156113cc57600080fd5b505afa1580156113e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611404919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906114475760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b031660005b8281101561148e576114868285858481811061146f57fe5b90506020028101906114819190613b84565b612c8b565b600101611457565b50505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156114d857600080fd5b505afa1580156114ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611510919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906115535760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b03166000816335ea6a7561157560208601866134e9565b6040518263ffffffff1660e01b815260040161159191906138a6565b6101806040518083038186803b1580156115aa57600080fd5b505afa1580156115be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e2919061369d565b905060006116056001600160a01b03841663c44b11f761094d60208801886134e9565b50935060009250636111764560e11b915085905061162660208801886134e9565b6116366040890160208a016134e9565b8561164460408b018b613b6e565b61165160608d018d613b6e565b61165e60a08f018f613b22565b6040516024016116779a99989796959493929190613a3e565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526101208401519091506116f390610aac60a08801608089016134e9565b61170360a08601608087016134e9565b6101208401516001600160a01b03918216911661172360208801886134e9565b6001600160a01b03167f9439658a562a5c46b1173589df89cf001483d685bad28aedaff4a88656292d8160405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156117a357600080fd5b505afa1580156117b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117db919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061181e5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906118509085906004016138a6565b60206040518083038186803b15801561186857600080fd5b505afa15801561187c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a09190613682565b90506118ad816001612728565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916118e091869190600401613953565b600060405180830381600087803b1580156118fa57600080fd5b505af115801561190e573d6000803e3d6000fd5b50506040516001600160a01b03851692507f35b80cd8ea3440e9a8454f116fa658b858da1b64c86c48451f4559cefcdfb56c9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561198e57600080fd5b505afa1580156119a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c6919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611a095760405162461bcd60e51b81526004016103249190613af0565b506035546001600160a01b03166000816335ea6a75611a2b60208601866134e9565b6040518263ffffffff1660e01b8152600401611a4791906138a6565b6101806040518083038186803b158015611a6057600080fd5b505afa158015611a74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a98919061369d565b90506000611abb6001600160a01b03841663c44b11f761094d60208801886134e9565b509350600092507f183fb413000000000000000000000000000000000000000000000000000000009150859050611af860408801602089016134e9565b611b0560208901896134e9565b611b1560608a0160408b016134e9565b86611b2360608c018c613b6e565b611b3060808e018e613b6e565b8e8060c00190611b409190613b22565b604051602401611b5a9b9a99989796959493929190613977565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915260e0840151909150611bd590610aac60c0880160a089016134e9565b611be560c0860160a087016134e9565b60e08401516001600160a01b039182169116611c0460208801886134e9565b6001600160a01b03167fa76f65411ec66a7fb6bc467432eb14767900449ae4469fa295e4441fe5e1cb7360405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611c8457600080fd5b505afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611cff5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790611d319085906004016138a6565b60206040518083038186803b158015611d4957600080fd5b505afa158015611d5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d819190613682565b9050611d8e816001613282565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691611dc191869190600401613953565b600060405180830381600087803b158015611ddb57600080fd5b505af1158015611def573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8dee2b2f3e98319ae6347eda521788f73f4086c9be9a594942b370b137fb8cb19150600090a25050565b6000611e356132c7565b60015490915060ff1680611e4c5750611e4c6132cc565b80611e58575060005481115b611e935760405162461bcd60e51b815260040180806020018281038252602e8152602001806143e2602e913960400191505060405180910390fd5b60015460ff16158015611eb2576001805460ff19168117905560008290555b603480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038581169190911791829055604080517f0261bf8b00000000000000000000000000000000000000000000000000000000815290519290911691630261bf8b91600480820192602092909190829003018186803b158015611f3f57600080fd5b505afa158015611f53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f77919061350c565b603580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169190911790558015611fc0576001805460ff191690555b505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561200957600080fd5b505afa15801561201d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612041919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906120845760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906120b69086906004016138a6565b60206040518083038186803b1580156120ce57600080fd5b505afa1580156120e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121069190613682565b9050612113816001612c46565b61211d8183613282565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161215091879190600401613953565b600060405180830381600087803b15801561216a57600080fd5b505af115801561217e573d6000803e3d6000fd5b50505050826001600160a01b03167fab2f7f9e5ca2772fafa94f355c1842a80ae6b9e41f83083098d81f67d7a0b508836040516107cf919061396c565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156121ff57600080fd5b505afa158015612213573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612237919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061227a5760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906122ac9085906004016138a6565b60206040518083038186803b1580156122c457600080fd5b505afa1580156122d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fc9190613682565b905061230981600061290b565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161233c91869190600401613953565b600060405180830381600087803b15801561235657600080fd5b505af115801561236a573d6000803e3d6000fd5b50506040516001600160a01b03851692507f838ecdc4709a31a26db48b0c853212cedde3f725f07030079d793fb0719647609150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156123ea57600080fd5b505afa1580156123fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612422919061350c565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906124655760405162461bcd60e51b81526004016103249190613af0565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906124979085906004016138a6565b60206040518083038186803b1580156124af57600080fd5b505afa1580156124c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e79190613682565b90506124f4816000613282565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161252791869190600401613953565b600060405180830381600087803b15801561254157600080fd5b505af1158015612555573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8bbf35441ac2c607ddecadd3d8ee58636d32f217fad201fb2655581502dd84e39150600090a25050565b6035546040517f35ea6a750000000000000000000000000000000000000000000000000000000081526000916001600160a01b0316906335ea6a75906125db9085906004016138a6565b6101806040518083038186803b1580156125f457600080fd5b505afa158015612608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262c919061369d565b90506000826001600160a01b03166370a082318360e001516040518263ffffffff1660e01b815260040161266091906138a6565b60206040518083038186803b15801561267857600080fd5b505afa15801561268c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b091906137fd565b9050801580156126d4575060608201516fffffffffffffffffffffffffffffffff16155b6040518060400160405280600281526020017f33340000000000000000000000000000000000000000000000000000000000008152509061148e5760405162461bcd60e51b81526004016103249190613af0565b603881612736576000612739565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffff1660ff9190911690911b1790915250565b60408051808201909152600281527f3731000000000000000000000000000000000000000000000000000000000000602082015261ffff82111561282f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156127f45781810151838201526020016127dc565b50505050905090810190601f1680156128215780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5081517fffffffffffffffffffffffffffffffffffffffffffff0000ffffffffffffffff1660409190911b179052565b5161ffff80821692601083901c821692602081901c831692603082901c60ff169260409290921c1690565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815283906001600160a01b03821690634f1ef286906128d39086908690600401613929565b600060405180830381600087803b1580156128ed57600080fd5b505af1158015612901573d6000803e3d6000fd5b5050505050505050565b60398161291957600061291c565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffffdffffffffffffff1660ff9190911690911b1790915250565b600082158061295d575081155b1561296a57506000612a27565b817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec778161299357fe5b048311156040518060400160405280600281526020017f343800000000000000000000000000000000000000000000000000000000000081525090612a195760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b505061271061138882840201045b92915050565b60408051808201909152600281527f3637000000000000000000000000000000000000000000000000000000000000602082015261ffff821115612ab25760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016179052565b60408051808201909152600281527f3638000000000000000000000000000000000000000000000000000000000000602082015261ffff821115612b615760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffff1660109190911b179052565b60408051808201909152600281527f3639000000000000000000000000000000000000000000000000000000000000602082015261ffff821115612c165760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffffffff1660209190911b179052565b603a81612c54576000612c57565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffffbffffffffffffff1660ff9190911690911b1790915250565b6000612c9e610100830160e084016134e9565b90506000612db0612cb260208501856134e9565b7f183fb4130000000000000000000000000000000000000000000000000000000086612ce460e0880160c089016134e9565b612cf460c0890160a08a016134e9565b87612d0560808b0160608c01613815565b612d136101408c018c613b6e565b612d216101608e018e613b6e565b8e806102000190612d329190613b22565b604051602401612d4c9b9a999897969594939291906139f7565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526132d2565b6040517f32a9caba0000000000000000000000000000000000000000000000000000000081529091506001600160a01b038316906332a9caba90612dff90849061010088013590600401613953565b600060405180830381600087803b158015612e1957600080fd5b505af1158015612e2d573d6000803e3d6000fd5b50612e429250505060e0840160c085016134e9565b6001600160a01b0316639c9b2e21826040518263ffffffff1660e01b8152600401612e6d91906138a6565b600060405180830381600087803b158015612e8757600080fd5b505af1158015612e9b573d6000803e3d6000fd5b505050506000612f37846020016020810190612eb791906134e9565b636111764560e11b87612ed060c0890160a08a016134e9565b612ee16101008a0160e08b016134e9565b612ef160808b0160608c01613815565b612eff6101c08c018c613b6e565b612f0d6101e08e018e613b6e565b8e806102000190612f1e9190613b22565b604051602401612d4c9a99989796959493929190613ab2565b90506000612fb5612f4e60608701604088016134e9565b636111764560e11b88612f6760c08a0160a08b016134e9565b612f786101008b0160e08c016134e9565b612f8860808c0160608d01613815565b612f966101808d018d613b6e565b612fa46101a08f018f613b6e565b8f806102000190612f1e9190613b22565b6040517f32a9caba0000000000000000000000000000000000000000000000000000000081529091506001600160a01b038516906332a9caba906130049084906101008a013590600401613953565b600060405180830381600087803b15801561301e57600080fd5b505af1158015613032573d6000803e3d6000fd5b5050506001600160a01b0387169050637a708e9261305660c0880160a089016134e9565b85858561306960a08c0160808d016134e9565b6040518663ffffffff1660e01b81526004016130899594939291906138f7565b600060405180830381600087803b1580156130a357600080fd5b505af11580156130b7573d6000803e3d6000fd5b506000925050506001600160a01b03871663c44b11f76130dd60c0890160a08a016134e9565b6040518263ffffffff1660e01b81526004016130f991906138a6565b60206040518083038186803b15801561311157600080fd5b505afa158015613125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131499190613682565b905061316861315e6080880160608901613815565b829060ff1661338d565b613173816001612728565b61317e81600061290b565b6001600160a01b03871663b8d2927661319d60c0890160a08a016134e9565b83516040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526131d9929190600401613953565b600060405180830381600087803b1580156131f357600080fd5b505af1158015613207573d6000803e3d6000fd5b5050506001600160a01b038516905061322660c0880160a089016134e9565b6001600160a01b03167f3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f858561326260a08c0160808d016134e9565b604051613271939291906138d4565b60405180910390a350505050505050565b603b81613290576000613293565b60015b83517ffffffffffffffffffffffffffffffffffffffffffffffffff7ffffffffffffff1660ff9190911690911b1790915250565b600190565b303b1590565b600080306040516132e290613441565b6132ec91906138a6565b604051809103906000f080158015613308573d6000803e3d6000fd5b506040517fd1f578940000000000000000000000000000000000000000000000000000000081529091506001600160a01b0382169063d1f57894906133539087908790600401613929565b600060405180830381600087803b15801561336d57600080fd5b505af1158015613381573d6000803e3d6000fd5b50929695505050505050565b60408051808201909152600281527f3730000000000000000000000000000000000000000000000000000000000000602082015260ff8211156134115760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156127f45781810151838201526020016127dc565b5081517fffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffff1660309190911b179052565b6107d580613c0d83390190565b805161345981613be5565b919050565b8035801515811461345957600080fd5b60006020828403121561347f578081fd5b6040516020810181811067ffffffffffffffff8211171561349c57fe5b6040529151825250919050565b80516fffffffffffffffffffffffffffffffff8116811461345957600080fd5b805164ffffffffff8116811461345957600080fd5b805161345981613bfd565b6000602082840312156134fa578081fd5b813561350581613be5565b9392505050565b60006020828403121561351d578081fd5b815161350581613be5565b6000806040838503121561353a578081fd5b823561354581613be5565b9150602083013561355581613be5565b809150509250929050565b60008060408385031215613572578182fd5b823561357d81613be5565b915061358b6020840161345e565b90509250929050565b600080604083850312156135a6578182fd5b82356135b181613be5565b946020939093013593505050565b600080600080608085870312156135d4578182fd5b84356135df81613be5565b966020860135965060408601359560600135945092505050565b6000806020838503121561360b578182fd5b823567ffffffffffffffff80821115613622578384fd5b818501915085601f830112613635578384fd5b813581811115613643578485fd5b8660208083028501011115613656578485fd5b60209290920196919550909350505050565b600060208284031215613679578081fd5b6135058261345e565b600060208284031215613693578081fd5b613505838361346e565b60006101808083850312156136b0578182fd5b6136b981613bc1565b90506136c5848461346e565b81526136d3602084016134a9565b60208201526136e4604084016134a9565b60408201526136f5606084016134a9565b6060820152613706608084016134a9565b608082015261371760a084016134a9565b60a082015261372860c084016134c9565b60c082015261373960e0840161344e565b60e082015261010061374c81850161344e565b9082015261012061375e84820161344e565b9082015261014061377084820161344e565b908201526101606137828482016134de565b908201529392505050565b60006020828403121561379e578081fd5b813567ffffffffffffffff8111156137b4578182fd5b820160e08185031215613505578182fd5b6000602082840312156137d6578081fd5b813567ffffffffffffffff8111156137ec578182fd5b820160c08185031215613505578182fd5b60006020828403121561380e578081fd5b5051919050565b600060208284031215613826578081fd5b813561350581613bfd565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452815b8181101561388057602081850181015186830182015201613864565b818111156138915782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b60006001600160a01b03841682526040602083015261394b604083018461385b565b949350505050565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b60006101006001600160a01b03808f168452808e166020850152808d166040850152808c166060850152508960808401528060a08401526139bb818401898b613831565b905082810360c08401526139d0818789613831565b905082810360e08401526139e5818587613831565b9e9d5050505050505050505050505050565b60006101006001600160a01b03808f168452808e166020850152808d166040850152808c1660608501525060ff8a1660808401528060a08401526139bb818401898b613831565b60006001600160a01b03808d168352808c166020840152808b1660408401525088606083015260e06080830152613a7960e08301888a613831565b82810360a0840152613a8c818789613831565b905082810360c0840152613aa1818587613831565b9d9c50505050505050505050505050565b60006001600160a01b03808d168352808c166020840152808b1660408401525060ff8916606083015260e06080830152613a7960e08301888a613831565b600060208252613505602083018461385b565b90815260200190565b9283526020830191909152604082015260600190565b6000808335601e19843603018112613b38578283fd5b83018035915067ffffffffffffffff821115613b52578283fd5b602001915036819003821315613b6757600080fd5b9250929050565b6000808335601e19843603018112613b38578182fd5b600082357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffde1833603018112613bb7578182fd5b9190910192915050565b60405181810167ffffffffffffffff81118282101715613bdd57fe5b604052919050565b6001600160a01b0381168114613bfa57600080fd5b50565b60ff81168114613bfa57600080fdfe60a060405234801561001057600080fd5b506040516107d53803806107d58339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b03166107556100806000398061023852806102825280610341528061048c52806104b552806105f752506107556000f3fe60806040526004361061005a5760003560e01c80635c60da1b116100435780635c60da1b14610117578063d1f5789414610148578063f851a440146101fe5761005a565b80633659cfe6146100645780634f1ef28614610097575b610062610213565b005b34801561007057600080fd5b506100626004803603602081101561008757600080fd5b50356001600160a01b031661022d565b610062600480360360408110156100ad57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d857600080fd5b8201836020820111156100ea57600080fd5b8035906020019184600183028401116401000000008311171561010c57600080fd5b509092509050610277565b34801561012357600080fd5b5061012c610334565b604080516001600160a01b039092168252519081900360200190f35b6100626004803603604081101561015e57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561018957600080fd5b82018360208201111561019b57600080fd5b803590602001918460018302840111640100000000831117156101bd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610381945050505050565b34801561020a57600080fd5b5061012c61047f565b61021b6104d9565b61022b6102266104e1565b610506565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561026c576102678161052a565b610274565b610274610213565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610327576102b18361052a565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461030e576040519150601f19603f3d011682016040523d82523d6000602084013e610313565b606091505b505090508061032157600080fd5b5061032f565b61032f610213565b505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156103765761036f6104e1565b905061037e565b61037e610213565b90565b600061038b6104e1565b6001600160a01b03161461039e57600080fd5b6103a78261056a565b80511561047b576000826001600160a01b0316826040518082805190602001908083835b6020831061040857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016103cb565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610468576040519150601f19603f3d011682016040523d82523d6000602084013e61046d565b606091505b505090508061032f57600080fd5b5050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561037657507f000000000000000000000000000000000000000000000000000000000000000061037e565b61022b6105ec565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610525573d6000f35b3d6000fd5b6105338161056a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61057381610676565b6105c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001806106e5603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561066e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806106b36032913960400191505060405180910390fd5b61022b61022b565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906106aa57508115155b94935050505056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212200e600d9f189227522a8b04fbac052a1db14fa6d18e44c1bf5033fc536068b0b764736f6c63430007060033436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a26469706673582212203aeb3a593088f6ff9155b44ccf27ea2a13df25e9133befcd667b401f9808854564736f6c63430007060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ 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.