Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- LendingPoolConfigurator
- Optimization enabled
- true
- Compiler version
- v0.7.6+commit.7338295f
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2023-07-16T06:26:09.104487Z
contracts/protocol/lendingpool/LendingPoolConfigurator.sol
// 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 {IERC20Metadata} from "../../dependencies/openzeppelin/contracts/IERC20Metadata.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 {ILendingPoolConfigurator} from "../../interfaces/ILendingPoolConfigurator.sol";
interface IPhiatFeeDistribution {
function addReward(address rewardsToken) external;
}
/**
* @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
{
address aTokenProxyAddress = _initTokenWithProxy(
input.aTokenImpl,
abi.encodeWithSelector(
IInitializableAToken.initialize.selector,
pool,
input.treasury,
input.underlyingAsset,
input.underlyingAssetDecimals,
input.aTokenName,
input.aTokenSymbol,
input.params
)
);
IPhiatFeeDistribution(input.treasury).addReward(aTokenProxyAddress);
address stableDebtTokenProxyAddress = _initTokenWithProxy(
input.stableDebtTokenImpl,
abi.encodeWithSelector(
IInitializableDebtToken.initialize.selector,
pool,
input.underlyingAsset,
input.underlyingAssetDecimals,
input.stableDebtTokenName,
input.stableDebtTokenSymbol,
input.params
)
);
address variableDebtTokenProxyAddress = _initTokenWithProxy(
input.variableDebtTokenImpl,
abi.encodeWithSelector(
IInitializableDebtToken.initialize.selector,
pool,
input.underlyingAsset,
input.underlyingAssetDecimals,
input.variableDebtTokenName,
input.variableDebtTokenSymbol,
input.params
)
);
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);
DataTypes.ReserveLimits memory currentLimits = pool.getReserveLimits(
input.underlyingAsset
);
currentLimits.maxGlobalDepositSize = input.maxGlobalDepositSize;
currentLimits.maxIndividualDepositSize = input.maxIndividualDepositSize;
currentLimits.minIndividualDepositSize = input.minIndividualDepositSize;
currentLimits.maxGlobalBorrowSize = input.maxGlobalBorrowSize;
currentLimits.maxIndividualBorrowSize = input.maxIndividualBorrowSize;
currentLimits.maxBorrowBps = input.maxBorrowBps;
pool.setLimits(input.underlyingAsset, currentLimits);
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,
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,
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,
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 Updates the maximum global deposit size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxGlobalDepositSize The new maximum global deposit size of the reserve
**/
function setMaxGlobalDepositSize(
address asset,
uint256 maxGlobalDepositSize
) external override onlyPoolAdmin {
DataTypes.ReserveLimits memory currentLimits = pool.getReserveLimits(
asset
);
currentLimits.maxGlobalDepositSize = maxGlobalDepositSize;
pool.setLimits(asset, currentLimits);
emit ReserveMaxGlobalDepositSizeChanged(asset, maxGlobalDepositSize);
}
/**
* @dev Updates the maximum individual deposit size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxIndividualDepositSize The new maximum individual deposit size of the reserve
**/
function setMaxIndividualDepositSize(
address asset,
uint256 maxIndividualDepositSize
) external override onlyPoolAdmin {
DataTypes.ReserveLimits memory currentLimits = pool.getReserveLimits(
asset
);
currentLimits.maxIndividualDepositSize = maxIndividualDepositSize;
pool.setLimits(asset, currentLimits);
emit ReserveMaxIndividualDepositSizeChanged(
asset,
maxIndividualDepositSize
);
}
/**
* @dev Updates the minimum individual deposit size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param minIndividualDepositSize The new minimum individual deposit size of the reserve
**/
function setMinIndividualDepositSize(
address asset,
uint256 minIndividualDepositSize
) external onlyPoolAdmin {
DataTypes.ReserveLimits memory currentLimits = pool.getReserveLimits(
asset
);
currentLimits.minIndividualDepositSize = minIndividualDepositSize;
pool.setLimits(asset, currentLimits);
emit ReserveMinIndividualDepositSizeChanged(
asset,
minIndividualDepositSize
);
}
/**
* @dev Updates the maximum global borrow size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxGlobalBorrowSize The new maximum global borrow size of the reserve
**/
function setMaxGlobalBorrowSize(address asset, uint256 maxGlobalBorrowSize)
external
override
onlyPoolAdmin
{
DataTypes.ReserveLimits memory currentLimits = pool.getReserveLimits(
asset
);
currentLimits.maxGlobalBorrowSize = maxGlobalBorrowSize;
pool.setLimits(asset, currentLimits);
emit ReserveMaxGlobalBorrowSizeChanged(asset, maxGlobalBorrowSize);
}
/**
* @dev Updates the maximum individual borrow size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxIndividualBorrowSize The new maximum individual borrow size of the reserve
**/
function setMaxIndividualBorrowSize(
address asset,
uint256 maxIndividualBorrowSize
) external override onlyPoolAdmin {
DataTypes.ReserveLimits memory currentLimits = pool.getReserveLimits(
asset
);
currentLimits.maxIndividualBorrowSize = maxIndividualBorrowSize;
pool.setLimits(asset, currentLimits);
emit ReserveMaxIndividualBorrowSizeChanged(
asset,
maxIndividualBorrowSize
);
}
/**
* @dev Updates the maximum borrow bps of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxBorrowBps The new maximum borrow bps of the reserve
**/
function setMaxBorrowBps(address asset, uint256 maxBorrowBps)
external
onlyPoolAdmin
{
require(
maxBorrowBps <= 10000,
Errors.AVL_INVALID_BORROW_MAX_PERCENTAGE
);
DataTypes.ReserveLimits memory currentLimits = pool.getReserveLimits(
asset
);
currentLimits.maxBorrowBps = maxBorrowBps;
pool.setLimits(asset, currentLimits);
emit ReserveMaxBorrowBpsChanged(asset, maxBorrowBps);
}
/**
* @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 = IERC20Metadata(asset).balanceOf(
reserveData.aTokenAddress
);
require(
availableLiquidity == 0 && reserveData.currentLiquidityRate == 0,
Errors.LPC_RESERVE_LIQUIDITY_NOT_0
);
}
}
contracts/dependencies/openzeppelin/contracts/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @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) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @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"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contracts/dependencies/openzeppelin/contracts/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contracts/dependencies/openzeppelin/contracts/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity 0.7.6;
import "./IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
contracts/dependencies/openzeppelin/contracts/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @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, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b)
internal
pure
returns (bool, 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 (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @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) {
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, reverting 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) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting 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) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* 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);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* 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) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* 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;
}
}
contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol
// 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)
}
}
}
contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol
// 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);
}
}
}
contracts/dependencies/openzeppelin/upgradeability/Proxy.sol
// 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());
}
}
contracts/interfaces/IInitializableAToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
import {ILendingPool} from "./ILendingPool.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 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,
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 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,
uint8 aTokenDecimals,
string calldata aTokenName,
string calldata aTokenSymbol,
bytes calldata params
) external;
}
contracts/interfaces/IInitializableDebtToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
import {ILendingPool} from "./ILendingPool.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 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,
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 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,
uint8 debtTokenDecimals,
string memory debtTokenName,
string memory debtTokenSymbol,
bytes calldata params
) external;
}
contracts/interfaces/ILendingPool.sol
// 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 a borrower is blacklisted.
* @param user The address of the borrower getting liquidated
**/
event Blacklist(address indexed user);
/**
* @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
);
function isBlacklisted(address user) external returns (bool);
/**
* @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);
/**
* @notice Repay all debts of the user and blacklist that user.
* @param user Address of the user who will get his debt 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
**/
function repayAllAndBlacklist(address user) external;
/**
* @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 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,
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;
function setLimits(
address reserve,
DataTypes.ReserveLimits calldata reserveLimits
) 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);
/**
* @dev Returns the limits of the reserve
* @param asset The address of the underlying asset of the reserve
* @return The limits of the reserve
**/
function getReserveLimits(address asset)
external
view
returns (DataTypes.ReserveLimits 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);
function FLASHLOAN_PREMIUM_TOTAL() external view returns (uint256);
}
contracts/interfaces/ILendingPoolAddressesProvider.sol
// 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 IncentivesControllerUpdated(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;
function getIncentivesController() external view returns (address);
function setIncentivesController(address lendingRateOracle) external;
}
contracts/interfaces/ILendingPoolConfigurator.sol
// 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;
string underlyingAssetName;
string aTokenName;
string aTokenSymbol;
string variableDebtTokenName;
string variableDebtTokenSymbol;
string stableDebtTokenName;
string stableDebtTokenSymbol;
uint256 maxGlobalDepositSize;
uint256 maxIndividualDepositSize;
uint256 minIndividualDepositSize;
uint256 maxGlobalBorrowSize;
uint256 maxIndividualBorrowSize;
uint256 maxBorrowBps;
bytes params;
}
struct UpdateATokenInput {
address asset;
address treasury;
string name;
string symbol;
address implementation;
bytes params;
}
struct UpdateDebtTokenInput {
address asset;
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 the reserve maximum global deposit size is updated
* @param asset The address of the underlying asset of the reserve
* @param maxGlobalDepositSize The new maximum global deposit size
**/
event ReserveMaxGlobalDepositSizeChanged(
address indexed asset,
uint256 maxGlobalDepositSize
);
/**
* @dev Emitted when the reserve maximum individual deposit size is updated
* @param asset The address of the underlying asset of the reserve
* @param maxIndividualDepositSize The new maximum individual deposit size
**/
event ReserveMaxIndividualDepositSizeChanged(
address indexed asset,
uint256 maxIndividualDepositSize
);
/**
* @dev Emitted when the reserve minimum individual deposit size is updated
* @param asset The address of the underlying asset of the reserve
* @param minIndividualDepositSize The new minimum individual deposit size
**/
event ReserveMinIndividualDepositSizeChanged(
address indexed asset,
uint256 minIndividualDepositSize
);
/**
* @dev Emitted when the reserve maximum global borrow size is updated
* @param asset The address of the underlying asset of the reserve
* @param maxGlobalBorrowSize The new maximum global borrow size
**/
event ReserveMaxGlobalBorrowSizeChanged(
address indexed asset,
uint256 maxGlobalBorrowSize
);
/**
* @dev Emitted when the reserve maximum individual borrow size is updated
* @param asset The address of the underlying asset of the reserve
* @param maxIndividualBorrowSize The new maximum individual borrow size
**/
event ReserveMaxIndividualBorrowSizeChanged(
address indexed asset,
uint256 maxIndividualBorrowSize
);
/**
* @dev Emitted when the reserve maximum borrow bps is updated
* @param asset The address of the underlying asset of the reserve
* @param maxBorrowBps The new maximum borrow bps
**/
event ReserveMaxBorrowBpsChanged(
address indexed asset,
uint256 maxBorrowBps
);
/**
* @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
);
/**
* @dev Updates the maximum global deposit size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxGlobalDepositSize The new maximum global deposit size of the reserve
**/
function setMaxGlobalDepositSize(
address asset,
uint256 maxGlobalDepositSize
) external;
/**
* @dev Updates the maximum individual deposit size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxIndividualDepositSize The new maximum individual deposit size of the reserve
**/
function setMaxIndividualDepositSize(
address asset,
uint256 maxIndividualDepositSize
) external;
/**
* @dev Updates the maximum global borrow size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxGlobalBorrowSize The new maximum global borrow size of the reserve
**/
function setMaxGlobalBorrowSize(address asset, uint256 maxGlobalBorrowSize)
external;
/**
* @dev Updates the maximum individual borrow size of a reserve
* @param asset The address of the underlying asset of the reserve
* @param maxIndividualBorrowSize The new maximum individual borrow size of the reserve
**/
function setMaxIndividualBorrowSize(
address asset,
uint256 maxIndividualBorrowSize
) external;
}
contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
// 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) {
require(admin != address(0), "Admin can not be zero address");
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, "Call on new implementation failed");
}
/**
* @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();
}
}
contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
// 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();
}
}
contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol
// 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;
}
contracts/protocol/libraries/configuration/ReserveConfiguration.sol
// 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
);
}
}
contracts/protocol/libraries/helpers/Errors.sol
// 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
* - AVL = Additional 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";
string public constant AVL_EXCEED_MAX_GLOBAL_DEPOSIT_SIZE = "81";
string public constant AVL_EXCEED_MAX_INDIVIDUAL_DEPOSIT_SIZE = "82";
string public constant AVL_BELOW_MIN_INDIVIDUAL_DEPOSIT_SIZE = "83";
string public constant AVL_EXCEED_MAX_GLOBAL_BORROW_SIZE = "84";
string public constant AVL_EXCEED_MAX_INDIVIDUAL_BORROW_SIZE = "85";
string public constant AVL_EXCEED_BORROW_MAX_PERCENTAGE = "86";
string public constant AVL_INVALID_BORROW_MAX_PERCENTAGE = "87";
string public constant LP_USER_IS_BLACKLISTED = "88";
string public constant LP_USER_NOT_ELIGIBLE_FOR_BLACKLIST = "89";
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
}
}
contracts/protocol/libraries/math/PercentageMath.sol
// 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;
}
}
contracts/protocol/libraries/types/DataTypes.sol
// 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 ReserveLimits {
uint256 maxGlobalDepositSize;
uint256 maxIndividualDepositSize;
uint256 minIndividualDepositSize;
uint256 maxGlobalBorrowSize;
uint256 maxIndividualBorrowSize;
uint256 maxBorrowBps;
}
struct UserConfigurationMap {
uint256 data;
}
enum InterestRateMode {
NONE,
STABLE,
VARIABLE
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"istanbul"}
Contract ABI
[{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"activateReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchInitReserve","inputs":[{"type":"tuple[]","name":"input","internalType":"struct ILendingPoolConfigurator.InitReserveInput[]","components":[{"type":"address"},{"type":"address"},{"type":"address"},{"type":"uint8"},{"type":"address"},{"type":"address"},{"type":"address"},{"type":"string"},{"type":"string"},{"type":"string"},{"type":"string"},{"type":"string"},{"type":"string"},{"type":"string"},{"type":"uint256"},{"type":"uint256"},{"type":"uint256"},{"type":"uint256"},{"type":"uint256"},{"type":"uint256"},{"type":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureReserveAsCollateral","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"ltv","internalType":"uint256"},{"type":"uint256","name":"liquidationThreshold","internalType":"uint256"},{"type":"uint256","name":"liquidationBonus","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deactivateReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableBorrowingOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableReserveStableRate","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableBorrowingOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"bool","name":"stableBorrowRateEnabled","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableReserveStableRate","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"freezeReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"provider","internalType":"contract ILendingPoolAddressesProvider"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxBorrowBps","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"maxBorrowBps","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxGlobalBorrowSize","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"maxGlobalBorrowSize","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxGlobalDepositSize","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"maxGlobalDepositSize","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxIndividualBorrowSize","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"maxIndividualBorrowSize","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMaxIndividualDepositSize","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"maxIndividualDepositSize","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinIndividualDepositSize","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"minIndividualDepositSize","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPoolPause","inputs":[{"type":"bool","name":"val","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReserveFactor","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"reserveFactor","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReserveInterestRateStrategyAddress","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"address","name":"rateStrategyAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unfreezeReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateAToken","inputs":[{"type":"tuple","name":"input","internalType":"struct ILendingPoolConfigurator.UpdateATokenInput","components":[{"type":"address"},{"type":"address"},{"type":"string"},{"type":"string"},{"type":"address"},{"type":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateStableDebtToken","inputs":[{"type":"tuple","name":"input","internalType":"struct ILendingPoolConfigurator.UpdateDebtTokenInput","components":[{"type":"address"},{"type":"string"},{"type":"string"},{"type":"address"},{"type":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateVariableDebtToken","inputs":[{"type":"tuple","name":"input","internalType":"struct ILendingPoolConfigurator.UpdateDebtTokenInput","components":[{"type":"address"},{"type":"string"},{"type":"string"},{"type":"address"},{"type":"bytes"}]}]},{"type":"event","name":"ATokenUpgraded","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"address","name":"proxy","indexed":true},{"type":"address","name":"implementation","indexed":true}],"anonymous":false},{"type":"event","name":"BorrowingDisabledOnReserve","inputs":[{"type":"address","name":"asset","indexed":true}],"anonymous":false},{"type":"event","name":"BorrowingEnabledOnReserve","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"bool","name":"stableRateEnabled","indexed":false}],"anonymous":false},{"type":"event","name":"CollateralConfigurationChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"ltv","indexed":false},{"type":"uint256","name":"liquidationThreshold","indexed":false},{"type":"uint256","name":"liquidationBonus","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveActivated","inputs":[{"type":"address","name":"asset","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveDeactivated","inputs":[{"type":"address","name":"asset","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveDecimalsChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"decimals","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveFactorChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"factor","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveFrozen","inputs":[{"type":"address","name":"asset","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveInitialized","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"address","name":"aToken","indexed":true},{"type":"address","name":"stableDebtToken","indexed":false},{"type":"address","name":"variableDebtToken","indexed":false},{"type":"address","name":"interestRateStrategyAddress","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveInterestRateStrategyChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"address","name":"strategy","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveMaxBorrowBpsChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"maxBorrowBps","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveMaxGlobalBorrowSizeChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"maxGlobalBorrowSize","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveMaxGlobalDepositSizeChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"maxGlobalDepositSize","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveMaxIndividualBorrowSizeChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"maxIndividualBorrowSize","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveMaxIndividualDepositSizeChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"maxIndividualDepositSize","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveMinIndividualDepositSizeChanged","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"uint256","name":"minIndividualDepositSize","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveUnfrozen","inputs":[{"type":"address","name":"asset","indexed":true}],"anonymous":false},{"type":"event","name":"StableDebtTokenUpgraded","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"address","name":"proxy","indexed":true},{"type":"address","name":"implementation","indexed":true}],"anonymous":false},{"type":"event","name":"StableRateDisabledOnReserve","inputs":[{"type":"address","name":"asset","indexed":true}],"anonymous":false},{"type":"event","name":"StableRateEnabledOnReserve","inputs":[{"type":"address","name":"asset","indexed":true}],"anonymous":false},{"type":"event","name":"VariableDebtTokenUpgraded","inputs":[{"type":"address","name":"asset","indexed":true},{"type":"address","name":"proxy","indexed":true},{"type":"address","name":"implementation","indexed":true}],"anonymous":false}]
Contract Creation Code
0x60806040526000805534801561001457600080fd5b506150bc806100246000396000f3fe60806040523480156200001157600080fd5b50600436106200016c5760003560e01c8063b0d6f54011620000d5578063cbad55d61162000087578063cbad55d614620002fa578063d1e6ee511462000311578063eede87c11462000328578063ef1f9373146200033f578063f5022e7a1462000356578063f53a2515146200036d576200016c565b8063b0d6f5401462000270578063b60a2a2e1462000287578063b75d6f34146200029e578063bf34418314620002b5578063bfbc47ff14620002cc578063c4d66de814620002e3576200016c565b80635b12adc3116200012f5780635b12adc314620001e65780637641f3d914620001fd5780637aca76eb14620002145780637c4e560b146200022b5780637dc867411462000242578063a8dc0f451462000259576200016c565b80630def47b714620001715780631d2118f9146200018a5780633e72a45414620001a157806341946e7014620001b85780634b4e675314620001cf575b600080fd5b620001886200018236600462004114565b62000384565b005b620001886200019b3660046200409e565b62000593565b62000188620001b236600462004059565b62000709565b62000188620001c9366004620043ae565b62000912565b62000188620001e036600462004114565b62000c52565b62000188620001f736600462004114565b62000e52565b620001886200020e366004620041f3565b6200104b565b620001886200022536600462004059565b6200117b565b620001886200023c36600462004142565b62001379565b6200018862000253366004620043e9565b620016c6565b620001886200026a36600462004059565b62001976565b620001886200028136600462004114565b62001b74565b620001886200029836600462004114565b62001d6d565b62000188620002af36600462004059565b62001fa6565b62000188620002c636600462004059565b620021a4565b62000188620002dd366004620043e9565b620023a2565b62000188620002f436600462004059565b62002652565b620001886200030b3660046200417f565b620027b1565b620001886200032236600462004114565b620028cb565b6200018862000339366004620040db565b62002ac4565b620001886200035036600462004059565b62002cd1565b620001886200036736600462004114565b62002ecf565b620001886200037e36600462004059565b620030c4565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620003c957600080fd5b505afa158015620003de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200040491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620004535760405162461bcd60e51b81526004016200044a919062004761565b60405180910390fd5b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062000487908690600401620044d4565b60c06040518083038186803b158015620004a057600080fd5b505afa158015620004b5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004db919062004339565b604080820184905260355490516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062000517908690859060040162004585565b600060405180830381600087803b1580156200053257600080fd5b505af115801562000547573d6000803e3d6000fd5b50505050826001600160a01b03167fb487e44090c3c2cd2cc42d82b272613f1ea58f24136aad125c0ea111838106468360405162000586919062004776565b60405180910390a2505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620005d857600080fd5b505afa158015620005ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200061391906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620006595760405162461bcd60e51b81526004016200044a919062004761565b50603554604051631d2118f960e01b81526001600160a01b0390911690631d2118f9906200068e9085908590600401620044e8565b600060405180830381600087803b158015620006a957600080fd5b505af1158015620006be573d6000803e3d6000fd5b50505050816001600160a01b03167f5644b64ebb0ce18c4032248ca52f58355469092ff072866c3dcd8640e817d6a582604051620006fd9190620044d4565b60405180910390a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200074e57600080fd5b505afa15801562000763573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200078991906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620007cf5760405162461bcd60e51b81526004016200044a919062004761565b50620007db81620032c2565b60355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906200080e908590600401620044d4565b60206040518083038186803b1580156200082757600080fd5b505afa1580156200083c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000862919062004210565b9050620008718160006200342c565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691620008a691869190600401620045d8565b600060405180830381600087803b158015620008c157600080fd5b505af1158015620008d6573d6000803e3d6000fd5b50506040516001600160a01b03851692507f6f60cf8bd0f218cabe1ea3150bd07b0b758c35c4cfdf7138017a283e65564d5e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200095757600080fd5b505afa1580156200096c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200099291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620009d85760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b03166000816335ea6a75620009fc602086018662004059565b6040518263ffffffff1660e01b815260040162000a1a9190620044d4565b6101806040518083038186803b15801562000a3457600080fd5b505afa15801562000a49573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a6f91906200422e565b9050600062000b0d6001600160a01b03841663c44b11f762000a95602088018862004059565b6040518263ffffffff1660e01b815260040162000ab39190620044d4565b60206040518083038186803b15801562000acc57600080fd5b505afa15801562000ae1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b07919062004210565b6200345c565b50935060009250636111764560e11b915085905062000b33604088016020890162004059565b62000b42602089018962004059565b8562000b5260408b018b620047e4565b62000b6160608d018d620047e4565b62000b7060a08f018f62004795565b60405160240162000b8b9a99989796959493929190620045fc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260e084015190915062000be39062000bdc60a088016080890162004059565b8362003487565b62000bf560a086016080870162004059565b60e08401516001600160a01b03918216911662000c16602088018862004059565b6001600160a01b03167fa76f65411ec66a7fb6bc467432eb14767900449ae4469fa295e4441fe5e1cb7360405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562000c9757600080fd5b505afa15801562000cac573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000cd291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062000d185760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062000d4c908690600401620044d4565b60206040518083038186803b15801562000d6557600080fd5b505afa15801562000d7a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000da0919062004210565b905062000dae8183620034f3565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162000de391879190600401620045d8565b600060405180830381600087803b15801562000dfe57600080fd5b505af115801562000e13573d6000803e3d6000fd5b50505050826001600160a01b03167f2694ccb0b585b6a54b8d8b4a47aa874b05c257b43d34e98aee50838be00d34058360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562000e9757600080fd5b505afa15801562000eac573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ed291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062000f185760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062000f4c908690600401620044d4565b60c06040518083038186803b15801562000f6557600080fd5b505afa15801562000f7a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000fa0919062004339565b608081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062000fdc908690859060040162004585565b600060405180830381600087803b15801562000ff757600080fd5b505af11580156200100c573d6000803e3d6000fd5b50505050826001600160a01b03167f77d686791a22596dd569fa2dab484388d2d1d26a37cb938a873f732255c70e898360405162000586919062004776565b60345460408051636ee554f560e11b8152905133926001600160a01b03169163ddcaa9ea916004808301926020929190829003018186803b1580156200109057600080fd5b505afa158015620010a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010cb91906200407f565b6001600160a01b031614604051806040016040528060028152602001611b9b60f11b81525090620011115760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163bedb86fb60e01b81526001600160a01b039091169063bedb86fb9062001144908490600401620045f1565b600060405180830381600087803b1580156200115f57600080fd5b505af115801562001174573d6000803e3d6000fd5b5050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620011c057600080fd5b505afa158015620011d5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011fb91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620012415760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062001275908590600401620044d4565b60206040518083038186803b1580156200128e57600080fd5b505afa158015620012a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012c9919062004210565b9050620012d8816001620035b9565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200130d91869190600401620045d8565b600060405180830381600087803b1580156200132857600080fd5b505af11580156200133d573d6000803e3d6000fd5b50506040516001600160a01b03851692507f85dc710add8a0914461a7dc5a63f6fc529a7700f8c6089a3faf5e93256ccf12a9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620013be57600080fd5b505afa158015620013d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013f991906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200143f5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062001473908890600401620044d4565b60206040518083038186803b1580156200148c57600080fd5b505afa158015620014a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014c7919062004210565b90508284111560405180604001604052806002815260200161373560f01b81525090620015095760405162461bcd60e51b81526004016200044a919062004761565b508215620015a457604080518082019091526002815261373560f01b602082015261271083116200154f5760405162461bcd60e51b81526004016200044a919062004761565b506127106200155f8484620035e9565b111560405180604001604052806002815260200161373560f01b815250906200159d5760405162461bcd60e51b81526004016200044a919062004761565b50620015eb565b604080518082019091526002815261373560f01b60208201528215620015df5760405162461bcd60e51b81526004016200044a919062004761565b50620015eb85620032c2565b620015f7818562003695565b6200160381846200370f565b6200160f818362003791565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200164491899190600401620045d8565b600060405180830381600087803b1580156200165f57600080fd5b505af115801562001674573d6000803e3d6000fd5b50505050846001600160a01b03167f637febbda9275aea2e85c0ff690444c8d87eb2e8339bbede9715abcc89cb0995858585604051620016b7939291906200477f565b60405180910390a25050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200170b57600080fd5b505afa15801562001720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200174691906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200178c5760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b03166000816335ea6a75620017b0602086018662004059565b6040518263ffffffff1660e01b8152600401620017ce9190620044d4565b6101806040518083038186803b158015620017e857600080fd5b505afa158015620017fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200182391906200422e565b90506000620018496001600160a01b03841663c44b11f762000a95602088018862004059565b50935060009250637fdd585f60e01b91508590506200186c602088018862004059565b846200187c60208a018a620047e4565b6200188b60408c018c620047e4565b6200189a60808e018e62004795565b604051602401620018b499989796959493929190620046b7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610100840151909150620019069062000bdc608088016060890162004059565b62001918608086016060870162004059565b6101008401516001600160a01b0391821691166200193a602088018862004059565b6001600160a01b03167f7a943a5b6c214bf7726c069a878b1e2a8e7371981d516048b84e03743e67bc2860405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620019bb57600080fd5b505afa158015620019d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019f691906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062001a3c5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062001a70908590600401620044d4565b60206040518083038186803b15801562001a8957600080fd5b505afa15801562001a9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ac4919062004210565b905062001ad381600062003815565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162001b0891869190600401620045d8565b600060405180830381600087803b15801562001b2357600080fd5b505af115801562001b38573d6000803e3d6000fd5b50506040516001600160a01b03851692507fe9a7e5fd4fc8ea18e602350324bf48e8f05d12434af0ce0be05743e6a5fdcb9e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562001bb957600080fd5b505afa15801562001bce573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001bf491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062001c3a5760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062001c6e908690600401620044d4565b60c06040518083038186803b15801562001c8757600080fd5b505afa15801562001c9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001cc2919062004339565b602081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062001cfe908690859060040162004585565b600060405180830381600087803b15801562001d1957600080fd5b505af115801562001d2e573d6000803e3d6000fd5b50505050826001600160a01b03167f6116a63ad83a65103566519e65fd91b7f7e8fcafca84cf10c3ce9cfc12801ef08360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562001db257600080fd5b505afa15801562001dc7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ded91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062001e335760405162461bcd60e51b81526004016200044a919062004761565b50604080518082019091526002815261383760f01b602082015261271082111562001e735760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062001ea7908690600401620044d4565b60c06040518083038186803b15801562001ec057600080fd5b505afa15801562001ed5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001efb919062004339565b60a081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062001f37908690859060040162004585565b600060405180830381600087803b15801562001f5257600080fd5b505af115801562001f67573d6000803e3d6000fd5b50505050826001600160a01b03167f75c9af915784147a8f239ee7e8f97510a4a8812c46697cebaa406f2f99c5275b8360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562001feb57600080fd5b505afa15801562002000573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200202691906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200206c5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790620020a0908590600401620044d4565b60206040518083038186803b158015620020b957600080fd5b505afa158015620020ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020f4919062004210565b9050620021038160016200342c565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200213891869190600401620045d8565b600060405180830381600087803b1580156200215357600080fd5b505af115801562002168573d6000803e3d6000fd5b50506040516001600160a01b03851692507f35b80cd8ea3440e9a8454f116fa658b858da1b64c86c48451f4559cefcdfb56c9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620021e957600080fd5b505afa158015620021fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200222491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200226a5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906200229e908590600401620044d4565b60206040518083038186803b158015620022b757600080fd5b505afa158015620022cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620022f2919062004210565b90506200230181600162003845565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200233691869190600401620045d8565b600060405180830381600087803b1580156200235157600080fd5b505af115801562002366573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8dee2b2f3e98319ae6347eda521788f73f4086c9be9a594942b370b137fb8cb19150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620023e757600080fd5b505afa158015620023fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200242291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620024685760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b03166000816335ea6a756200248c602086018662004059565b6040518263ffffffff1660e01b8152600401620024aa9190620044d4565b6101806040518083038186803b158015620024c457600080fd5b505afa158015620024d9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620024ff91906200422e565b90506000620025256001600160a01b03841663c44b11f762000a95602088018862004059565b50935060009250637fdd585f60e01b915085905062002548602088018862004059565b846200255860208a018a620047e4565b6200256760408c018c620047e4565b6200257660808e018e62004795565b6040516024016200259099989796959493929190620046b7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610120840151909150620025e29062000bdc608088016060890162004059565b620025f4608086016060870162004059565b6101208401516001600160a01b03918216911662002616602088018862004059565b6001600160a01b03167f9439658a562a5c46b1173589df89cf001483d685bad28aedaff4a88656292d8160405160405180910390a45050505050565b60006200265e62003875565b60015490915060ff1680620026785750620026786200387a565b8062002685575060005481115b620026c25760405162461bcd60e51b815260040180806020018281038252602e81526020018062005059602e913960400191505060405180910390fd5b60015460ff16158015620026e2576001805460ff19168117905560008290555b603480546001600160a01b0319166001600160a01b03858116919091179182905560408051630261bf8b60e01b815290519290911691630261bf8b91600480820192602092909190829003018186803b1580156200273f57600080fd5b505afa15801562002754573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200277a91906200407f565b603580546001600160a01b0319166001600160a01b03929092169190911790558015620027ac576001805460ff191690555b505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620027f657600080fd5b505afa1580156200280b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200283191906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620028775760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b031660005b82811015620028c557620028bc82858584818110620028a257fe5b9050602002810190620028b69190620047fb565b62003880565b60010162002887565b50505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200291057600080fd5b505afa15801562002925573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200294b91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620029915760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc90620029c5908690600401620044d4565b60c06040518083038186803b158015620029de57600080fd5b505afa158015620029f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002a19919062004339565b606081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062002a55908690859060040162004585565b600060405180830381600087803b15801562002a7057600080fd5b505af115801562002a85573d6000803e3d6000fd5b50505050826001600160a01b03167f035847e252d29e2b1328081d7ecfde48925995c4ad01463e33b939e6f876ae798360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562002b0957600080fd5b505afa15801562002b1e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002b4491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062002b8a5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062002bbe908690600401620044d4565b60206040518083038186803b15801562002bd757600080fd5b505afa15801562002bec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002c12919062004210565b905062002c2181600162003815565b62002c2d818362003845565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162002c6291879190600401620045d8565b600060405180830381600087803b15801562002c7d57600080fd5b505af115801562002c92573d6000803e3d6000fd5b50505050826001600160a01b03167fab2f7f9e5ca2772fafa94f355c1842a80ae6b9e41f83083098d81f67d7a0b50883604051620005869190620045f1565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562002d1657600080fd5b505afa15801562002d2b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002d5191906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062002d975760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062002dcb908590600401620044d4565b60206040518083038186803b15801562002de457600080fd5b505afa15801562002df9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002e1f919062004210565b905062002e2e816000620035b9565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162002e6391869190600401620045d8565b600060405180830381600087803b15801562002e7e57600080fd5b505af115801562002e93573d6000803e3d6000fd5b50506040516001600160a01b03851692507f838ecdc4709a31a26db48b0c853212cedde3f725f07030079d793fb0719647609150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562002f1457600080fd5b505afa15801562002f29573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002f4f91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062002f955760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062002fc9908690600401620044d4565b60c06040518083038186803b15801562002fe257600080fd5b505afa15801562002ff7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200301d919062004339565b8281526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062003055908690859060040162004585565b600060405180830381600087803b1580156200307057600080fd5b505af115801562003085573d6000803e3d6000fd5b50505050826001600160a01b03167f4a6f722ec135c549b5db6af0306cc9c63a23cc83f0ee44d79c522e8ab2fc879e8360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200310957600080fd5b505afa1580156200311e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200314491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200318a5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790620031be908590600401620044d4565b60206040518083038186803b158015620031d757600080fd5b505afa158015620031ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062003212919062004210565b90506200322181600062003845565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200325691869190600401620045d8565b600060405180830381600087803b1580156200327157600080fd5b505af115801562003286573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8bbf35441ac2c607ddecadd3d8ee58636d32f217fad201fb2655581502dd84e39150600090a25050565b6035546040516335ea6a7560e01b81526000916001600160a01b0316906335ea6a7590620032f5908590600401620044d4565b6101806040518083038186803b1580156200330f57600080fd5b505afa15801562003324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200334a91906200422e565b90506000826001600160a01b03166370a082318360e001516040518263ffffffff1660e01b8152600401620033809190620044d4565b60206040518083038186803b1580156200339957600080fd5b505afa158015620033ae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620033d4919062004424565b905080158015620033f0575060608201516001600160801b0316155b604051806040016040528060028152602001610ccd60f21b81525090620028c55760405162461bcd60e51b81526004016200044a919062004761565b6038816200343c5760006200343f565b60015b8351670100000000000000191660ff9190911690911b1790915250565b5161ffff80821692601083901c821692602081901c831692603082901c60ff169260409290921c1690565b60405163278f794360e11b815283906001600160a01b03821690634f1ef28690620034b9908690869060040162004557565b600060405180830381600087803b158015620034d457600080fd5b505af1158015620034e9573d6000803e3d6000fd5b5050505050505050565b604080518082019091526002815261373160f01b602082015261ffff8211156200359e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200356257818101518382015260200162003548565b50505050905090810190601f168015620035905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50815169ffff0000000000000000191660409190911b179052565b603981620035c9576000620035cc565b60015b8351670200000000000000191660ff9190911690911b1790915250565b6000821580620035f7575081155b1562003606575060006200368f565b8161138819816200361357fe5b0483111560405180604001604052806002815260200161068760f31b81525090620036815760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b505061271061138882840201045b92915050565b604080518082019091526002815261363760f01b602082015261ffff821115620037025760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815161ffff1916179052565b60408051808201909152600281526106c760f31b602082015261ffff8211156200377c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815163ffff0000191660109190911b179052565b604080518082019091526002815261363960f01b602082015261ffff821115620037fe5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815165ffff00000000191660209190911b179052565b603a816200382557600062003828565b60015b8351670400000000000000191660ff9190911690911b1790915250565b603b816200385557600062003858565b60015b8351670800000000000000191660ff9190911690911b1790915250565b600190565b303b1590565b60006200395762003895602084018462004059565b636111764560e11b85620038b060e0870160c0880162004059565b620038c260c0880160a0890162004059565b620038d46080890160608a016200443d565b620038e46101008a018a620047e4565b620038f46101208c018c620047e4565b620039046102808e018e62004795565b6040516024016200391f9a9998979695949392919062004677565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262003e81565b90506200396b60e0830160c0840162004059565b6001600160a01b0316639c9b2e21826040518263ffffffff1660e01b8152600401620039989190620044d4565b600060405180830381600087803b158015620039b357600080fd5b505af1158015620039c8573d6000803e3d6000fd5b50505050600062003a5e836020016020810190620039e7919062004059565b637fdd585f60e01b8662003a0260c0880160a0890162004059565b62003a146080890160608a016200443d565b62003a246101808a018a620047e4565b62003a346101a08c018c620047e4565b62003a446102808e018e62004795565b6040516024016200391f9998979695949392919062004729565b9050600062003ad562003a78606086016040870162004059565b637fdd585f60e01b8762003a9360c0890160a08a0162004059565b62003aa560808a0160608b016200443d565b62003ab56101408b018b620047e4565b62003ac56101608d018d620047e4565b62003a446102808f018f62004795565b90506001600160a01b038516637a708e9262003af860c0870160a0880162004059565b85858562003b0d60a08b0160808c0162004059565b6040518663ffffffff1660e01b815260040162003b2f95949392919062004525565b600060405180830381600087803b15801562003b4a57600080fd5b505af115801562003b5f573d6000803e3d6000fd5b506000925050506001600160a01b03861663c44b11f762003b8760c0880160a0890162004059565b6040518263ffffffff1660e01b815260040162003ba59190620044d4565b60206040518083038186803b15801562003bbe57600080fd5b505afa15801562003bd3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062003bf9919062004210565b905062003c1c62003c1160808701606088016200443d565b829060ff1662003f2c565b62003c298160016200342c565b62003c36816000620035b9565b6001600160a01b03861663b8d2927662003c5760c0880160a0890162004059565b83516040516001600160e01b031960e085901b16815262003c7d929190600401620045d8565b600060405180830381600087803b15801562003c9857600080fd5b505af115801562003cad573d6000803e3d6000fd5b506000925050506001600160a01b03871663845e79bc62003cd560c0890160a08a0162004059565b6040518263ffffffff1660e01b815260040162003cf39190620044d4565b60c06040518083038186803b15801562003d0c57600080fd5b505afa15801562003d21573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062003d47919062004339565b6101c087013581526101e0870135602082015261020087013560408201526102208701356060820152610240870135608082015261026087013560a0808301919091529091506001600160a01b038816906363a5d53b9062003db09060c08a01908a0162004059565b836040518363ffffffff1660e01b815260040162003dd092919062004585565b600060405180830381600087803b15801562003deb57600080fd5b505af115801562003e00573d6000803e3d6000fd5b5050506001600160a01b038616905062003e2160c0880160a0890162004059565b6001600160a01b03167f3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f868662003e5f60a08c0160808d0162004059565b60405162003e709392919062004502565b60405180910390a350505050505050565b6000803060405162003e939062003fb0565b62003e9f9190620044d4565b604051809103906000f08015801562003ebc573d6000803e3d6000fd5b5060405163347d5e2560e21b81529091506001600160a01b0382169063d1f578949062003ef0908790879060040162004557565b600060405180830381600087803b15801562003f0b57600080fd5b505af115801562003f20573d6000803e3d6000fd5b50929695505050505050565b604080518082019091526002815261037360f41b602082015260ff82111562003f985760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815166ff000000000000191660309190911b179052565b6107ee806200486b83390190565b805162003fcb8162004841565b919050565b8035801515811462003fcb57600080fd5b60006020828403121562003ff3578081fd5b6040516020810181811067ffffffffffffffff821117156200401157fe5b6040529151825250919050565b80516001600160801b038116811462003fcb57600080fd5b805164ffffffffff8116811462003fcb57600080fd5b805162003fcb816200485a565b6000602082840312156200406b578081fd5b8135620040788162004841565b9392505050565b60006020828403121562004091578081fd5b8151620040788162004841565b60008060408385031215620040b1578081fd5b8235620040be8162004841565b91506020830135620040d08162004841565b809150509250929050565b60008060408385031215620040ee578182fd5b8235620040fb8162004841565b91506200410b6020840162003fd0565b90509250929050565b6000806040838503121562004127578182fd5b8235620041348162004841565b946020939093013593505050565b6000806000806080858703121562004158578182fd5b8435620041658162004841565b966020860135965060408601359560600135945092505050565b6000806020838503121562004192578182fd5b823567ffffffffffffffff80821115620041aa578384fd5b818501915085601f830112620041be578384fd5b813581811115620041cd578485fd5b8660208083028501011115620041e1578485fd5b60209290920196919550909350505050565b60006020828403121562004205578081fd5b620040788262003fd0565b60006020828403121562004222578081fd5b62004078838362003fe1565b600061018080838503121562004242578182fd5b6200424d816200481c565b90506200425b848462003fe1565b81526200426b602084016200401e565b60208201526200427e604084016200401e565b604082015262004291606084016200401e565b6060820152620042a4608084016200401e565b6080820152620042b760a084016200401e565b60a0820152620042ca60c0840162004036565b60c0820152620042dd60e0840162003fbe565b60e0820152610100620042f281850162003fbe565b908201526101206200430684820162003fbe565b908201526101406200431a84820162003fbe565b908201526101606200432e8482016200404c565b908201529392505050565b600060c082840312156200434b578081fd5b60405160c0810181811067ffffffffffffffff821117156200436957fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201528091505092915050565b600060208284031215620043c0578081fd5b813567ffffffffffffffff811115620043d7578182fd5b820160c0818503121562004078578182fd5b600060208284031215620043fb578081fd5b813567ffffffffffffffff81111562004412578182fd5b820160a0818503121562004078578182fd5b60006020828403121562004436578081fd5b5051919050565b6000602082840312156200444f578081fd5b813562004078816200485a565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452815b81811015620044ad576020818501810151868301820152016200448f565b81811115620044bf5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b6001600160a01b03831681526040602082018190526000906200457d9083018462004486565b949350505050565b600060e08201905060018060a01b038416825282516020830152602083015160408301526040830151606083015260608301516080830152608083015160a083015260a083015160c08301529392505050565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6001600160a01b038b811682528a81166020830152891660408201526060810188905260e0608082018190526000906200463a908301888a6200445c565b82810360a08401526200464f8187896200445c565b905082810360c0840152620046668185876200445c565b9d9c50505050505050505050505050565b6001600160a01b038b811682528a811660208301528916604082015260ff8816606082015260e0608082018190526000906200463a908301888a6200445c565b6001600160a01b038a81168252891660208201526040810188905260c060608201819052600090620046ed908301888a6200445c565b8281036080840152620047028187896200445c565b905082810360a0840152620047198185876200445c565b9c9b505050505050505050505050565b6001600160a01b038a811682528916602082015260ff8816604082015260c060608201819052600090620046ed908301888a6200445c565b60006020825262004078602083018462004486565b90815260200190565b9283526020830191909152604082015260600190565b6000808335601e19843603018112620047ac578283fd5b83018035915067ffffffffffffffff821115620047c7578283fd5b602001915036819003821315620047dd57600080fd5b9250929050565b6000808335601e19843603018112620047ac578182fd5b6000823561029e1983360301811262004812578182fd5b9190910192915050565b60405181810167ffffffffffffffff811182821017156200483957fe5b604052919050565b6001600160a01b03811681146200485757600080fd5b50565b60ff811681146200485757600080fdfe60a060405234801561001057600080fd5b506040516107ee3803806107ee8339818101604052602081101561003357600080fd5b5051806001600160a01b038116610091576040805162461bcd60e51b815260206004820152601d60248201527f41646d696e2063616e206e6f74206265207a65726f2061646472657373000000604482015290519081900360640190fd5b606081901b6001600160601b0319166080526001600160a01b031690506107106100de6000398061022852806102725280610363528061049052806104b952806105e152506107106000f3fe60806040526004361061004a5760003560e01c80633659cfe6146100545780634f1ef286146100875780635c60da1b14610107578063d1f5789414610138578063f851a440146101ee575b610052610203565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661021d565b6100526004803603604081101561009d57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b509092509050610267565b34801561011357600080fd5b5061011c610356565b604080516001600160a01b039092168252519081900360200190f35b6100526004803603604081101561014e57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103a3945050505050565b3480156101fa57600080fd5b5061011c610483565b61020b6104dd565b61021b6102166104e5565b61050a565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561025c576102578161052e565b610264565b610264610203565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610349576102a18361052e565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b50509050806103435760405162461bcd60e51b815260040180806020018281038252602181526020018061067f6021913960400191505060405180910390fd5b50610351565b610351610203565b505050565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610398576103916104e5565b90506103a0565b6103a0610203565b90565b60006103ad6104e5565b6001600160a01b0316146103c057600080fd5b6103c98261056e565b80511561047f576000826001600160a01b0316826040518082805190602001908083835b6020831061040c5780518252601f1990920191602091820191016103ed565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461046c576040519150601f19603f3d011682016040523d82523d6000602084013e610471565b606091505b505090508061035157600080fd5b5050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561039857507f00000000000000000000000000000000000000000000000000000000000000006103a0565b61021b6105d6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610529573d6000f35b3d6000fd5b6105378161056e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61057781610646565b6105b25760405162461bcd60e51b815260040180806020018281038252603b8152602001806106a0603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561063e5760405162461bcd60e51b815260040180806020018281038252603281526020018061064d6032913960400191505060405180910390fd5b61021b61021b565b3b15159056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616c6c206f6e206e657720696d706c656d656e746174696f6e206661696c656443616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212209c50b5838b1b84381df7b2464c9a76546c7d18cf1c0ec6e3b6b0e91d66b1074664736f6c63430007060033436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a2646970667358221220b15327f04b9d7b7d37b6f03c0ae942e62231f0aab2eead66c6d503cb856e7df464736f6c63430007060033
Deployed ByteCode
0x60806040523480156200001157600080fd5b50600436106200016c5760003560e01c8063b0d6f54011620000d5578063cbad55d61162000087578063cbad55d614620002fa578063d1e6ee511462000311578063eede87c11462000328578063ef1f9373146200033f578063f5022e7a1462000356578063f53a2515146200036d576200016c565b8063b0d6f5401462000270578063b60a2a2e1462000287578063b75d6f34146200029e578063bf34418314620002b5578063bfbc47ff14620002cc578063c4d66de814620002e3576200016c565b80635b12adc3116200012f5780635b12adc314620001e65780637641f3d914620001fd5780637aca76eb14620002145780637c4e560b146200022b5780637dc867411462000242578063a8dc0f451462000259576200016c565b80630def47b714620001715780631d2118f9146200018a5780633e72a45414620001a157806341946e7014620001b85780634b4e675314620001cf575b600080fd5b620001886200018236600462004114565b62000384565b005b620001886200019b3660046200409e565b62000593565b62000188620001b236600462004059565b62000709565b62000188620001c9366004620043ae565b62000912565b62000188620001e036600462004114565b62000c52565b62000188620001f736600462004114565b62000e52565b620001886200020e366004620041f3565b6200104b565b620001886200022536600462004059565b6200117b565b620001886200023c36600462004142565b62001379565b6200018862000253366004620043e9565b620016c6565b620001886200026a36600462004059565b62001976565b620001886200028136600462004114565b62001b74565b620001886200029836600462004114565b62001d6d565b62000188620002af36600462004059565b62001fa6565b62000188620002c636600462004059565b620021a4565b62000188620002dd366004620043e9565b620023a2565b62000188620002f436600462004059565b62002652565b620001886200030b3660046200417f565b620027b1565b620001886200032236600462004114565b620028cb565b6200018862000339366004620040db565b62002ac4565b620001886200035036600462004059565b62002cd1565b620001886200036736600462004114565b62002ecf565b620001886200037e36600462004059565b620030c4565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620003c957600080fd5b505afa158015620003de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200040491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620004535760405162461bcd60e51b81526004016200044a919062004761565b60405180910390fd5b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062000487908690600401620044d4565b60c06040518083038186803b158015620004a057600080fd5b505afa158015620004b5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004db919062004339565b604080820184905260355490516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062000517908690859060040162004585565b600060405180830381600087803b1580156200053257600080fd5b505af115801562000547573d6000803e3d6000fd5b50505050826001600160a01b03167fb487e44090c3c2cd2cc42d82b272613f1ea58f24136aad125c0ea111838106468360405162000586919062004776565b60405180910390a2505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620005d857600080fd5b505afa158015620005ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200061391906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620006595760405162461bcd60e51b81526004016200044a919062004761565b50603554604051631d2118f960e01b81526001600160a01b0390911690631d2118f9906200068e9085908590600401620044e8565b600060405180830381600087803b158015620006a957600080fd5b505af1158015620006be573d6000803e3d6000fd5b50505050816001600160a01b03167f5644b64ebb0ce18c4032248ca52f58355469092ff072866c3dcd8640e817d6a582604051620006fd9190620044d4565b60405180910390a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200074e57600080fd5b505afa15801562000763573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200078991906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620007cf5760405162461bcd60e51b81526004016200044a919062004761565b50620007db81620032c2565b60355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906200080e908590600401620044d4565b60206040518083038186803b1580156200082757600080fd5b505afa1580156200083c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000862919062004210565b9050620008718160006200342c565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691620008a691869190600401620045d8565b600060405180830381600087803b158015620008c157600080fd5b505af1158015620008d6573d6000803e3d6000fd5b50506040516001600160a01b03851692507f6f60cf8bd0f218cabe1ea3150bd07b0b758c35c4cfdf7138017a283e65564d5e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200095757600080fd5b505afa1580156200096c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200099291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620009d85760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b03166000816335ea6a75620009fc602086018662004059565b6040518263ffffffff1660e01b815260040162000a1a9190620044d4565b6101806040518083038186803b15801562000a3457600080fd5b505afa15801562000a49573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a6f91906200422e565b9050600062000b0d6001600160a01b03841663c44b11f762000a95602088018862004059565b6040518263ffffffff1660e01b815260040162000ab39190620044d4565b60206040518083038186803b15801562000acc57600080fd5b505afa15801562000ae1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b07919062004210565b6200345c565b50935060009250636111764560e11b915085905062000b33604088016020890162004059565b62000b42602089018962004059565b8562000b5260408b018b620047e4565b62000b6160608d018d620047e4565b62000b7060a08f018f62004795565b60405160240162000b8b9a99989796959493929190620045fc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260e084015190915062000be39062000bdc60a088016080890162004059565b8362003487565b62000bf560a086016080870162004059565b60e08401516001600160a01b03918216911662000c16602088018862004059565b6001600160a01b03167fa76f65411ec66a7fb6bc467432eb14767900449ae4469fa295e4441fe5e1cb7360405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562000c9757600080fd5b505afa15801562000cac573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000cd291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062000d185760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062000d4c908690600401620044d4565b60206040518083038186803b15801562000d6557600080fd5b505afa15801562000d7a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000da0919062004210565b905062000dae8183620034f3565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162000de391879190600401620045d8565b600060405180830381600087803b15801562000dfe57600080fd5b505af115801562000e13573d6000803e3d6000fd5b50505050826001600160a01b03167f2694ccb0b585b6a54b8d8b4a47aa874b05c257b43d34e98aee50838be00d34058360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562000e9757600080fd5b505afa15801562000eac573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ed291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062000f185760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062000f4c908690600401620044d4565b60c06040518083038186803b15801562000f6557600080fd5b505afa15801562000f7a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000fa0919062004339565b608081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062000fdc908690859060040162004585565b600060405180830381600087803b15801562000ff757600080fd5b505af11580156200100c573d6000803e3d6000fd5b50505050826001600160a01b03167f77d686791a22596dd569fa2dab484388d2d1d26a37cb938a873f732255c70e898360405162000586919062004776565b60345460408051636ee554f560e11b8152905133926001600160a01b03169163ddcaa9ea916004808301926020929190829003018186803b1580156200109057600080fd5b505afa158015620010a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010cb91906200407f565b6001600160a01b031614604051806040016040528060028152602001611b9b60f11b81525090620011115760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163bedb86fb60e01b81526001600160a01b039091169063bedb86fb9062001144908490600401620045f1565b600060405180830381600087803b1580156200115f57600080fd5b505af115801562001174573d6000803e3d6000fd5b5050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620011c057600080fd5b505afa158015620011d5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620011fb91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620012415760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062001275908590600401620044d4565b60206040518083038186803b1580156200128e57600080fd5b505afa158015620012a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620012c9919062004210565b9050620012d8816001620035b9565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200130d91869190600401620045d8565b600060405180830381600087803b1580156200132857600080fd5b505af11580156200133d573d6000803e3d6000fd5b50506040516001600160a01b03851692507f85dc710add8a0914461a7dc5a63f6fc529a7700f8c6089a3faf5e93256ccf12a9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620013be57600080fd5b505afa158015620013d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013f991906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200143f5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062001473908890600401620044d4565b60206040518083038186803b1580156200148c57600080fd5b505afa158015620014a1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620014c7919062004210565b90508284111560405180604001604052806002815260200161373560f01b81525090620015095760405162461bcd60e51b81526004016200044a919062004761565b508215620015a457604080518082019091526002815261373560f01b602082015261271083116200154f5760405162461bcd60e51b81526004016200044a919062004761565b506127106200155f8484620035e9565b111560405180604001604052806002815260200161373560f01b815250906200159d5760405162461bcd60e51b81526004016200044a919062004761565b50620015eb565b604080518082019091526002815261373560f01b60208201528215620015df5760405162461bcd60e51b81526004016200044a919062004761565b50620015eb85620032c2565b620015f7818562003695565b6200160381846200370f565b6200160f818362003791565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200164491899190600401620045d8565b600060405180830381600087803b1580156200165f57600080fd5b505af115801562001674573d6000803e3d6000fd5b50505050846001600160a01b03167f637febbda9275aea2e85c0ff690444c8d87eb2e8339bbede9715abcc89cb0995858585604051620016b7939291906200477f565b60405180910390a25050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200170b57600080fd5b505afa15801562001720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200174691906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200178c5760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b03166000816335ea6a75620017b0602086018662004059565b6040518263ffffffff1660e01b8152600401620017ce9190620044d4565b6101806040518083038186803b158015620017e857600080fd5b505afa158015620017fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200182391906200422e565b90506000620018496001600160a01b03841663c44b11f762000a95602088018862004059565b50935060009250637fdd585f60e01b91508590506200186c602088018862004059565b846200187c60208a018a620047e4565b6200188b60408c018c620047e4565b6200189a60808e018e62004795565b604051602401620018b499989796959493929190620046b7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610100840151909150620019069062000bdc608088016060890162004059565b62001918608086016060870162004059565b6101008401516001600160a01b0391821691166200193a602088018862004059565b6001600160a01b03167f7a943a5b6c214bf7726c069a878b1e2a8e7371981d516048b84e03743e67bc2860405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620019bb57600080fd5b505afa158015620019d0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019f691906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062001a3c5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062001a70908590600401620044d4565b60206040518083038186803b15801562001a8957600080fd5b505afa15801562001a9e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ac4919062004210565b905062001ad381600062003815565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162001b0891869190600401620045d8565b600060405180830381600087803b15801562001b2357600080fd5b505af115801562001b38573d6000803e3d6000fd5b50506040516001600160a01b03851692507fe9a7e5fd4fc8ea18e602350324bf48e8f05d12434af0ce0be05743e6a5fdcb9e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562001bb957600080fd5b505afa15801562001bce573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001bf491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062001c3a5760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062001c6e908690600401620044d4565b60c06040518083038186803b15801562001c8757600080fd5b505afa15801562001c9c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001cc2919062004339565b602081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062001cfe908690859060040162004585565b600060405180830381600087803b15801562001d1957600080fd5b505af115801562001d2e573d6000803e3d6000fd5b50505050826001600160a01b03167f6116a63ad83a65103566519e65fd91b7f7e8fcafca84cf10c3ce9cfc12801ef08360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562001db257600080fd5b505afa15801562001dc7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001ded91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062001e335760405162461bcd60e51b81526004016200044a919062004761565b50604080518082019091526002815261383760f01b602082015261271082111562001e735760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062001ea7908690600401620044d4565b60c06040518083038186803b15801562001ec057600080fd5b505afa15801562001ed5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001efb919062004339565b60a081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062001f37908690859060040162004585565b600060405180830381600087803b15801562001f5257600080fd5b505af115801562001f67573d6000803e3d6000fd5b50505050826001600160a01b03167f75c9af915784147a8f239ee7e8f97510a4a8812c46697cebaa406f2f99c5275b8360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562001feb57600080fd5b505afa15801562002000573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200202691906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200206c5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790620020a0908590600401620044d4565b60206040518083038186803b158015620020b957600080fd5b505afa158015620020ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020f4919062004210565b9050620021038160016200342c565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200213891869190600401620045d8565b600060405180830381600087803b1580156200215357600080fd5b505af115801562002168573d6000803e3d6000fd5b50506040516001600160a01b03851692507f35b80cd8ea3440e9a8454f116fa658b858da1b64c86c48451f4559cefcdfb56c9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620021e957600080fd5b505afa158015620021fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200222491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200226a5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f7906200229e908590600401620044d4565b60206040518083038186803b158015620022b757600080fd5b505afa158015620022cc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620022f2919062004210565b90506200230181600162003845565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200233691869190600401620045d8565b600060405180830381600087803b1580156200235157600080fd5b505af115801562002366573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8dee2b2f3e98319ae6347eda521788f73f4086c9be9a594942b370b137fb8cb19150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620023e757600080fd5b505afa158015620023fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200242291906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620024685760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b03166000816335ea6a756200248c602086018662004059565b6040518263ffffffff1660e01b8152600401620024aa9190620044d4565b6101806040518083038186803b158015620024c457600080fd5b505afa158015620024d9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620024ff91906200422e565b90506000620025256001600160a01b03841663c44b11f762000a95602088018862004059565b50935060009250637fdd585f60e01b915085905062002548602088018862004059565b846200255860208a018a620047e4565b6200256760408c018c620047e4565b6200257660808e018e62004795565b6040516024016200259099989796959493929190620046b7565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610120840151909150620025e29062000bdc608088016060890162004059565b620025f4608086016060870162004059565b6101208401516001600160a01b03918216911662002616602088018862004059565b6001600160a01b03167f9439658a562a5c46b1173589df89cf001483d685bad28aedaff4a88656292d8160405160405180910390a45050505050565b60006200265e62003875565b60015490915060ff1680620026785750620026786200387a565b8062002685575060005481115b620026c25760405162461bcd60e51b815260040180806020018281038252602e81526020018062005059602e913960400191505060405180910390fd5b60015460ff16158015620026e2576001805460ff19168117905560008290555b603480546001600160a01b0319166001600160a01b03858116919091179182905560408051630261bf8b60e01b815290519290911691630261bf8b91600480820192602092909190829003018186803b1580156200273f57600080fd5b505afa15801562002754573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200277a91906200407f565b603580546001600160a01b0319166001600160a01b03929092169190911790558015620027ac576001805460ff191690555b505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015620027f657600080fd5b505afa1580156200280b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200283191906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620028775760405162461bcd60e51b81526004016200044a919062004761565b506035546001600160a01b031660005b82811015620028c557620028bc82858584818110620028a257fe5b9050602002810190620028b69190620047fb565b62003880565b60010162002887565b50505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200291057600080fd5b505afa15801562002925573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200294b91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090620029915760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc90620029c5908690600401620044d4565b60c06040518083038186803b158015620029de57600080fd5b505afa158015620029f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002a19919062004339565b606081018390526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062002a55908690859060040162004585565b600060405180830381600087803b15801562002a7057600080fd5b505af115801562002a85573d6000803e3d6000fd5b50505050826001600160a01b03167f035847e252d29e2b1328081d7ecfde48925995c4ad01463e33b939e6f876ae798360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562002b0957600080fd5b505afa15801562002b1e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002b4491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062002b8a5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062002bbe908690600401620044d4565b60206040518083038186803b15801562002bd757600080fd5b505afa15801562002bec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002c12919062004210565b905062002c2181600162003815565b62002c2d818362003845565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162002c6291879190600401620045d8565b600060405180830381600087803b15801562002c7d57600080fd5b505af115801562002c92573d6000803e3d6000fd5b50505050826001600160a01b03167fab2f7f9e5ca2772fafa94f355c1842a80ae6b9e41f83083098d81f67d7a0b50883604051620005869190620045f1565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562002d1657600080fd5b505afa15801562002d2b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002d5191906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062002d975760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f79062002dcb908590600401620044d4565b60206040518083038186803b15801562002de457600080fd5b505afa15801562002df9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002e1f919062004210565b905062002e2e816000620035b9565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769162002e6391869190600401620045d8565b600060405180830381600087803b15801562002e7e57600080fd5b505af115801562002e93573d6000803e3d6000fd5b50506040516001600160a01b03851692507f838ecdc4709a31a26db48b0c853212cedde3f725f07030079d793fb0719647609150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801562002f1457600080fd5b505afa15801562002f29573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062002f4f91906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509062002f955760405162461bcd60e51b81526004016200044a919062004761565b506035546040516321179e6f60e21b81526000916001600160a01b03169063845e79bc9062002fc9908690600401620044d4565b60c06040518083038186803b15801562002fe257600080fd5b505afa15801562002ff7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200301d919062004339565b8281526035546040516363a5d53b60e01b81529192506001600160a01b0316906363a5d53b9062003055908690859060040162004585565b600060405180830381600087803b1580156200307057600080fd5b505af115801562003085573d6000803e3d6000fd5b50505050826001600160a01b03167f4a6f722ec135c549b5db6af0306cc9c63a23cc83f0ee44d79c522e8ab2fc879e8360405162000586919062004776565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156200310957600080fd5b505afa1580156200311e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200314491906200407f565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906200318a5760405162461bcd60e51b81526004016200044a919062004761565b5060355460405163c44b11f760e01b81526000916001600160a01b03169063c44b11f790620031be908590600401620044d4565b60206040518083038186803b158015620031d757600080fd5b505afa158015620031ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062003212919062004210565b90506200322181600062003845565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916200325691869190600401620045d8565b600060405180830381600087803b1580156200327157600080fd5b505af115801562003286573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8bbf35441ac2c607ddecadd3d8ee58636d32f217fad201fb2655581502dd84e39150600090a25050565b6035546040516335ea6a7560e01b81526000916001600160a01b0316906335ea6a7590620032f5908590600401620044d4565b6101806040518083038186803b1580156200330f57600080fd5b505afa15801562003324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200334a91906200422e565b90506000826001600160a01b03166370a082318360e001516040518263ffffffff1660e01b8152600401620033809190620044d4565b60206040518083038186803b1580156200339957600080fd5b505afa158015620033ae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620033d4919062004424565b905080158015620033f0575060608201516001600160801b0316155b604051806040016040528060028152602001610ccd60f21b81525090620028c55760405162461bcd60e51b81526004016200044a919062004761565b6038816200343c5760006200343f565b60015b8351670100000000000000191660ff9190911690911b1790915250565b5161ffff80821692601083901c821692602081901c831692603082901c60ff169260409290921c1690565b60405163278f794360e11b815283906001600160a01b03821690634f1ef28690620034b9908690869060040162004557565b600060405180830381600087803b158015620034d457600080fd5b505af1158015620034e9573d6000803e3d6000fd5b5050505050505050565b604080518082019091526002815261373160f01b602082015261ffff8211156200359e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200356257818101518382015260200162003548565b50505050905090810190601f168015620035905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50815169ffff0000000000000000191660409190911b179052565b603981620035c9576000620035cc565b60015b8351670200000000000000191660ff9190911690911b1790915250565b6000821580620035f7575081155b1562003606575060006200368f565b8161138819816200361357fe5b0483111560405180604001604052806002815260200161068760f31b81525090620036815760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b505061271061138882840201045b92915050565b604080518082019091526002815261363760f01b602082015261ffff821115620037025760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815161ffff1916179052565b60408051808201909152600281526106c760f31b602082015261ffff8211156200377c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815163ffff0000191660109190911b179052565b604080518082019091526002815261363960f01b602082015261ffff821115620037fe5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815165ffff00000000191660209190911b179052565b603a816200382557600062003828565b60015b8351670400000000000000191660ff9190911690911b1790915250565b603b816200385557600062003858565b60015b8351670800000000000000191660ff9190911690911b1790915250565b600190565b303b1590565b60006200395762003895602084018462004059565b636111764560e11b85620038b060e0870160c0880162004059565b620038c260c0880160a0890162004059565b620038d46080890160608a016200443d565b620038e46101008a018a620047e4565b620038f46101208c018c620047e4565b620039046102808e018e62004795565b6040516024016200391f9a9998979695949392919062004677565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262003e81565b90506200396b60e0830160c0840162004059565b6001600160a01b0316639c9b2e21826040518263ffffffff1660e01b8152600401620039989190620044d4565b600060405180830381600087803b158015620039b357600080fd5b505af1158015620039c8573d6000803e3d6000fd5b50505050600062003a5e836020016020810190620039e7919062004059565b637fdd585f60e01b8662003a0260c0880160a0890162004059565b62003a146080890160608a016200443d565b62003a246101808a018a620047e4565b62003a346101a08c018c620047e4565b62003a446102808e018e62004795565b6040516024016200391f9998979695949392919062004729565b9050600062003ad562003a78606086016040870162004059565b637fdd585f60e01b8762003a9360c0890160a08a0162004059565b62003aa560808a0160608b016200443d565b62003ab56101408b018b620047e4565b62003ac56101608d018d620047e4565b62003a446102808f018f62004795565b90506001600160a01b038516637a708e9262003af860c0870160a0880162004059565b85858562003b0d60a08b0160808c0162004059565b6040518663ffffffff1660e01b815260040162003b2f95949392919062004525565b600060405180830381600087803b15801562003b4a57600080fd5b505af115801562003b5f573d6000803e3d6000fd5b506000925050506001600160a01b03861663c44b11f762003b8760c0880160a0890162004059565b6040518263ffffffff1660e01b815260040162003ba59190620044d4565b60206040518083038186803b15801562003bbe57600080fd5b505afa15801562003bd3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062003bf9919062004210565b905062003c1c62003c1160808701606088016200443d565b829060ff1662003f2c565b62003c298160016200342c565b62003c36816000620035b9565b6001600160a01b03861663b8d2927662003c5760c0880160a0890162004059565b83516040516001600160e01b031960e085901b16815262003c7d929190600401620045d8565b600060405180830381600087803b15801562003c9857600080fd5b505af115801562003cad573d6000803e3d6000fd5b506000925050506001600160a01b03871663845e79bc62003cd560c0890160a08a0162004059565b6040518263ffffffff1660e01b815260040162003cf39190620044d4565b60c06040518083038186803b15801562003d0c57600080fd5b505afa15801562003d21573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062003d47919062004339565b6101c087013581526101e0870135602082015261020087013560408201526102208701356060820152610240870135608082015261026087013560a0808301919091529091506001600160a01b038816906363a5d53b9062003db09060c08a01908a0162004059565b836040518363ffffffff1660e01b815260040162003dd092919062004585565b600060405180830381600087803b15801562003deb57600080fd5b505af115801562003e00573d6000803e3d6000fd5b5050506001600160a01b038616905062003e2160c0880160a0890162004059565b6001600160a01b03167f3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f868662003e5f60a08c0160808d0162004059565b60405162003e709392919062004502565b60405180910390a350505050505050565b6000803060405162003e939062003fb0565b62003e9f9190620044d4565b604051809103906000f08015801562003ebc573d6000803e3d6000fd5b5060405163347d5e2560e21b81529091506001600160a01b0382169063d1f578949062003ef0908790879060040162004557565b600060405180830381600087803b15801562003f0b57600080fd5b505af115801562003f20573d6000803e3d6000fd5b50929695505050505050565b604080518082019091526002815261037360f41b602082015260ff82111562003f985760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156200356257818101518382015260200162003548565b50815166ff000000000000191660309190911b179052565b6107ee806200486b83390190565b805162003fcb8162004841565b919050565b8035801515811462003fcb57600080fd5b60006020828403121562003ff3578081fd5b6040516020810181811067ffffffffffffffff821117156200401157fe5b6040529151825250919050565b80516001600160801b038116811462003fcb57600080fd5b805164ffffffffff8116811462003fcb57600080fd5b805162003fcb816200485a565b6000602082840312156200406b578081fd5b8135620040788162004841565b9392505050565b60006020828403121562004091578081fd5b8151620040788162004841565b60008060408385031215620040b1578081fd5b8235620040be8162004841565b91506020830135620040d08162004841565b809150509250929050565b60008060408385031215620040ee578182fd5b8235620040fb8162004841565b91506200410b6020840162003fd0565b90509250929050565b6000806040838503121562004127578182fd5b8235620041348162004841565b946020939093013593505050565b6000806000806080858703121562004158578182fd5b8435620041658162004841565b966020860135965060408601359560600135945092505050565b6000806020838503121562004192578182fd5b823567ffffffffffffffff80821115620041aa578384fd5b818501915085601f830112620041be578384fd5b813581811115620041cd578485fd5b8660208083028501011115620041e1578485fd5b60209290920196919550909350505050565b60006020828403121562004205578081fd5b620040788262003fd0565b60006020828403121562004222578081fd5b62004078838362003fe1565b600061018080838503121562004242578182fd5b6200424d816200481c565b90506200425b848462003fe1565b81526200426b602084016200401e565b60208201526200427e604084016200401e565b604082015262004291606084016200401e565b6060820152620042a4608084016200401e565b6080820152620042b760a084016200401e565b60a0820152620042ca60c0840162004036565b60c0820152620042dd60e0840162003fbe565b60e0820152610100620042f281850162003fbe565b908201526101206200430684820162003fbe565b908201526101406200431a84820162003fbe565b908201526101606200432e8482016200404c565b908201529392505050565b600060c082840312156200434b578081fd5b60405160c0810181811067ffffffffffffffff821117156200436957fe5b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201528091505092915050565b600060208284031215620043c0578081fd5b813567ffffffffffffffff811115620043d7578182fd5b820160c0818503121562004078578182fd5b600060208284031215620043fb578081fd5b813567ffffffffffffffff81111562004412578182fd5b820160a0818503121562004078578182fd5b60006020828403121562004436578081fd5b5051919050565b6000602082840312156200444f578081fd5b813562004078816200485a565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452815b81811015620044ad576020818501810151868301820152016200448f565b81811115620044bf5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b6001600160a01b03831681526040602082018190526000906200457d9083018462004486565b949350505050565b600060e08201905060018060a01b038416825282516020830152602083015160408301526040830151606083015260608301516080830152608083015160a083015260a083015160c08301529392505050565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6001600160a01b038b811682528a81166020830152891660408201526060810188905260e0608082018190526000906200463a908301888a6200445c565b82810360a08401526200464f8187896200445c565b905082810360c0840152620046668185876200445c565b9d9c50505050505050505050505050565b6001600160a01b038b811682528a811660208301528916604082015260ff8816606082015260e0608082018190526000906200463a908301888a6200445c565b6001600160a01b038a81168252891660208201526040810188905260c060608201819052600090620046ed908301888a6200445c565b8281036080840152620047028187896200445c565b905082810360a0840152620047198185876200445c565b9c9b505050505050505050505050565b6001600160a01b038a811682528916602082015260ff8816604082015260c060608201819052600090620046ed908301888a6200445c565b60006020825262004078602083018462004486565b90815260200190565b9283526020830191909152604082015260600190565b6000808335601e19843603018112620047ac578283fd5b83018035915067ffffffffffffffff821115620047c7578283fd5b602001915036819003821315620047dd57600080fd5b9250929050565b6000808335601e19843603018112620047ac578182fd5b6000823561029e1983360301811262004812578182fd5b9190910192915050565b60405181810167ffffffffffffffff811182821017156200483957fe5b604052919050565b6001600160a01b03811681146200485757600080fd5b50565b60ff811681146200485757600080fdfe60a060405234801561001057600080fd5b506040516107ee3803806107ee8339818101604052602081101561003357600080fd5b5051806001600160a01b038116610091576040805162461bcd60e51b815260206004820152601d60248201527f41646d696e2063616e206e6f74206265207a65726f2061646472657373000000604482015290519081900360640190fd5b606081901b6001600160601b0319166080526001600160a01b031690506107106100de6000398061022852806102725280610363528061049052806104b952806105e152506107106000f3fe60806040526004361061004a5760003560e01c80633659cfe6146100545780634f1ef286146100875780635c60da1b14610107578063d1f5789414610138578063f851a440146101ee575b610052610203565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661021d565b6100526004803603604081101561009d57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b509092509050610267565b34801561011357600080fd5b5061011c610356565b604080516001600160a01b039092168252519081900360200190f35b6100526004803603604081101561014e57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103a3945050505050565b3480156101fa57600080fd5b5061011c610483565b61020b6104dd565b61021b6102166104e5565b61050a565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561025c576102578161052e565b610264565b610264610203565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610349576102a18361052e565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b50509050806103435760405162461bcd60e51b815260040180806020018281038252602181526020018061067f6021913960400191505060405180910390fd5b50610351565b610351610203565b505050565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610398576103916104e5565b90506103a0565b6103a0610203565b90565b60006103ad6104e5565b6001600160a01b0316146103c057600080fd5b6103c98261056e565b80511561047f576000826001600160a01b0316826040518082805190602001908083835b6020831061040c5780518252601f1990920191602091820191016103ed565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461046c576040519150601f19603f3d011682016040523d82523d6000602084013e610471565b606091505b505090508061035157600080fd5b5050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561039857507f00000000000000000000000000000000000000000000000000000000000000006103a0565b61021b6105d6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610529573d6000f35b3d6000fd5b6105378161056e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61057781610646565b6105b25760405162461bcd60e51b815260040180806020018281038252603b8152602001806106a0603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561063e5760405162461bcd60e51b815260040180806020018281038252603281526020018061064d6032913960400191505060405180910390fd5b61021b61021b565b3b15159056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616c6c206f6e206e657720696d706c656d656e746174696f6e206661696c656443616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212209c50b5838b1b84381df7b2464c9a76546c7d18cf1c0ec6e3b6b0e91d66b1074664736f6c63430007060033436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a2646970667358221220b15327f04b9d7b7d37b6f03c0ae942e62231f0aab2eead66c6d503cb856e7df464736f6c63430007060033