Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ApeFinance
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "openzeppelin-contracts/contracts/security/ReentrancyGuard.sol"; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import "openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol"; import "openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"; import "openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol"; import "./ApeFinanceStorage.sol"; import "../../interfaces/IArbInfo.sol"; import "../../interfaces/IApeFinance.sol"; import "../../interfaces/IAToken.sol"; import "../../interfaces/IDeferLiquidityCheck.sol"; import "../../interfaces/IInterestRateModel.sol"; import "../../interfaces/IPriceOracle.sol"; import "../../interfaces/IPToken.sol"; import "../../libraries/Arrays.sol"; import "../../libraries/DataTypes.sol"; import "../../libraries/PauseFlags.sol"; import "../../libraries/SubAccounts.sol"; contract ApeFinance is Initializable, UUPSUpgradeable, Ownable2StepUpgradeable, ReentrancyGuard, ApeFinanceStorage, IApeFinance { using SafeERC20 for IERC20; using Arrays for address[]; using PauseFlags for DataTypes.MarketConfig; using SubAccounts for address; /** * @notice Initialize the contract. * @param _admin The address of the admin */ function initialize(address _admin) public initializer { __Ownable_init(); __UUPSUpgradeable_init(); transferOwnership(_admin); } /** * @notice Check if the caller is the market configurator. */ modifier onlyMarketConfigurator() { _checkMarketConfigurator(); _; } /** * @notice Check if the caller is the reserve manager. */ modifier onlyReserveManager() { _checkReserveManager(); _; } /** * @notice Check if the caller is the credit limit manager. */ modifier onlyCreditLimitManager() { require(msg.sender == creditLimitManager, "!manager"); _; } /** * @notice Check if the user has authorized the caller. */ modifier isAuthorized(address from) { _checkAuthorized(from, msg.sender); _; } /* ========== VIEW FUNCTIONS ========== */ /** * @notice Get all markets. * @return The list of all markets */ function getAllMarkets() public view returns (address[] memory) { return allMarkets; } /** * @notice Whether or not a market is listed. * @param market The address of the market to check * @return true if the market is listed, false otherwise */ function isMarketListed(address market) public view returns (bool) { DataTypes.Market storage m = markets[market]; return m.config.isListed; } /** * @notice Get the exchange rate of a market. * @param market The address of the market * @return The exchange rate */ function getExchangeRate(address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return _getExchangeRate(m); } /** * @notice Get the total supply of a market. * @param market The address of the market * @return The total supply */ function getTotalSupply(address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return m.totalSupply; } /** * @notice Get the total borrow of a market. * @param market The address of the market * @return The total borrow */ function getTotalBorrow(address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return m.totalBorrow; } /** * @notice Get the total cash of a market. * @param market The address of the market * @return The total cash */ function getTotalCash(address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return m.totalCash; } /** * @notice Get the total reserves of a market. * @param market The address of the market * @return The total reserves */ function getTotalReserves(address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return m.totalReserves; } /** * @notice Get the borrow balance of a user in a market. * @param user The address of the user * @param market The address of the market * @return The borrow balance */ function getBorrowBalance(address user, address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return _getBorrowBalance(m, user); } /** * @notice Get the AToken balance of a user in a market. * @param user The address of the user * @param market The address of the market * @return The AToken balance */ function getATokenBalance(address user, address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return m.userSupplies[user]; } /** * @notice Get the supply balance of a user in a market. * @param user The address of the user * @param market The address of the market * @return The supply balance */ function getSupplyBalance(address user, address market) public view returns (uint256) { DataTypes.Market storage m = markets[market]; return (m.userSupplies[user] * _getExchangeRate(m)) / 1e18; } /** * @notice Get the account liquidity of a user. * @param user The address of the user * @return The total collateral value, liquidation collateral value, and total debt value of the user */ function getAccountLiquidity(address user) public view returns (uint256, uint256, uint256) { return _getAccountLiquidity(user); } /** * @notice Get the user's allowed extensions. * @param user The address of the user * @return The list of allowed extensions */ function getUserAllowedExtensions(address user) public view returns (address[] memory) { return allAllowedExtensions[user]; } /** * @notice Whether or not a user has allowed an extension. * @param user The address of the user * @param extension The address of the extension * @return true if the user has allowed the extension, false otherwise */ function isAllowedExtension(address user, address extension) public view returns (bool) { return allowedExtensions[user][extension]; } /** * @notice Get the credit limit of a user in a market. * @param user The address of the user * @param market The address of the market * @return The credit limit */ function getCreditLimit(address user, address market) public view returns (uint256) { return creditLimits[user][market]; } /** * @notice Get the list of all credit markets for a user. * @param user The address of the user * @return The list of all credit markets */ function getUserCreditMarkets(address user) public view returns (address[] memory) { return allCreditMarkets[user]; } /** * @notice Whether or not an account is a credit account. * @param user The address of the user * @return true if the account is a credit account, false otherwise */ function isCreditAccount(address user) public view returns (bool) { return allCreditMarkets[user].length > 0; } /** * @notice Get the configuration of a market. * @param market The address of the market * @return The market configuration */ function getMarketConfiguration(address market) public view returns (DataTypes.MarketConfig memory) { return markets[market].config; } /** * @notice Check if an account is liquidatable. * @param user The address of the account to check * @return true if the account is liquidatable, false otherwise */ function isUserLiquidatable(address user) public view returns (bool) { return _isLiquidatable(user); } /** * @notice Calculate the amount of aToken that can be seized in a liquidation. * @param marketBorrow The address of the market being borrowed from * @param marketCollateral The address of the market being used as collateral * @param repayAmount The amount of the borrowed asset being repaid * @return The amount of aToken that can be seized */ function calculateLiquidationOpportunity(address marketBorrow, address marketCollateral, uint256 repayAmount) public view returns (uint256) { DataTypes.Market storage mCollateral = markets[marketCollateral]; DataTypes.Market storage mBorrow = markets[marketCollateral]; return _getLiquidationSeizeAmount(marketBorrow, marketCollateral, mBorrow, mCollateral, repayAmount); } /* ========== MUTATIVE FUNCTIONS ========== */ /** * @notice Accrue the interest of a market. * @param market The address of the market */ function accrueInterest(address market) external { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); _accrueInterest(market, m); } /** * @notice Check the account liquidity of a user. * @param user The address of the user */ function checkAccountLiquidity(address user) public { _checkAccountLiquidity(user); } /** * @notice Supply an amount of asset to ApeFinance. * @param from The address which will supply the asset * @param to The address which will hold the balance * @param market The address of the market * @param amount The amount of asset to supply */ function supply(address from, address to, address market, uint256 amount) external nonReentrant isAuthorized(from) { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); require(!m.config.isSupplyPaused(), "supply paused"); require(!isCreditAccount(to), "cannot supply to credit account"); _accrueInterest(market, m); if (m.config.supplyCap != 0) { uint256 totalSupplyUnderlying = m.totalSupply * _getExchangeRate(m) / 1e18; require(totalSupplyUnderlying + amount <= m.config.supplyCap, "supply cap reached"); } uint256 aTokenAmount = (amount * 1e18) / _getExchangeRate(m); require(aTokenAmount > 0, "zero aToken amount"); // Update storage. m.totalCash += amount; m.totalSupply += aTokenAmount; m.userSupplies[to] += aTokenAmount; // Enter the market. if (amount > 0) { _enterMarket(market, to); } IAToken(m.config.aTokenAddress).mint(to, aTokenAmount); // Only emits Transfer event. IERC20(market).safeTransferFrom(from, address(this), amount); emit Supply(market, from, to, amount, aTokenAmount); } /** * @notice Borrow an amount of asset from ApeFinance. * @param from The address which will borrow the asset * @param to The address which will receive the token * @param market The address of the market * @param amount The amount of asset to borrow */ function borrow(address from, address to, address market, uint256 amount) external nonReentrant isAuthorized(from) { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); require(!m.config.isBorrowPaused(), "borrow paused"); require(m.totalCash >= amount, "insufficient cash"); _accrueInterest(market, m); uint256 newTotalBorrow = m.totalBorrow + amount; uint256 newUserBorrowBalance = _getBorrowBalance(m, from) + amount; if (m.config.borrowCap != 0) { require(newTotalBorrow <= m.config.borrowCap, "borrow cap reached"); } // Update storage. m.totalCash -= amount; m.totalBorrow = newTotalBorrow; m.userBorrows[from].borrowBalance = newUserBorrowBalance; m.userBorrows[from].borrowIndex = m.borrowIndex; // Enter the market. if (amount > 0) { _enterMarket(market, from); } IERC20(market).safeTransfer(to, amount); if (isCreditAccount(from)) { require(from == to, "credit account can only borrow to itself"); require(creditLimits[from][market] >= newUserBorrowBalance, "insufficient credit limit"); } else { _checkAccountLiquidity(from); } emit Borrow(market, from, to, amount, newUserBorrowBalance, newTotalBorrow); } /** * @notice Redeem an amount of asset from ApeFinance. * @param from The address which will redeem the asset * @param to The address which will receive the token * @param market The address of the market * @param amount The amount of asset to redeem, or type(uint256).max for max * @return The actual amount of asset redeemed */ function redeem(address from, address to, address market, uint256 amount) external nonReentrant isAuthorized(from) returns (uint256) { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); _accrueInterest(market, m); uint256 userSupply = m.userSupplies[from]; uint256 totalCash = m.totalCash; uint256 aTokenAmount; if (amount == type(uint256).max) { aTokenAmount = userSupply; amount = (aTokenAmount * _getExchangeRate(m)) / 1e18; } else { aTokenAmount = (amount * 1e18) / _getExchangeRate(m); } require(aTokenAmount > 0, "zero aToken amount"); require(userSupply >= aTokenAmount, "insufficient balance"); require(totalCash >= amount, "insufficient cash"); uint256 newUserSupply = userSupply - aTokenAmount; // Update storage. m.userSupplies[from] = newUserSupply; m.totalCash = totalCash - amount; m.totalSupply -= aTokenAmount; // Check if need to exit the market. if (newUserSupply == 0 && _getBorrowBalance(m, from) == 0) { _exitMarket(market, from); } IAToken(m.config.aTokenAddress).burn(from, aTokenAmount); // Only emits Transfer event. IERC20(market).safeTransfer(to, amount); _checkAccountLiquidity(from); emit Redeem(market, from, to, amount, aTokenAmount); return amount; } /** * @notice Repay an amount of asset to ApeFinance. * @param from The address which will repay the asset * @param to The address which will hold the balance * @param market The address of the market * @param amount The amount of asset to repay, or type(uint256).max for max * @return The actual amount of asset repaid */ function repay(address from, address to, address market, uint256 amount) external nonReentrant isAuthorized(from) returns (uint256) { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); if (isCreditAccount(to)) { require(from == to, "credit account can only repay for itself"); } _accrueInterest(market, m); return _repay(m, from, to, market, amount); } /** * @notice Liquidate an undercollateralized borrower. * @param liquidator The address which will liquidate the borrower * @param borrower The address of the borrower * @param marketBorrow The address of the borrow market * @param marketCollateral The address of the collateral market * @param repayAmount The amount of asset to repay, or type(uint256).max for max * @return The actual amount of asset repaid and the amount of collateral seized */ function liquidate( address liquidator, address borrower, address marketBorrow, address marketCollateral, uint256 repayAmount ) external nonReentrant isAuthorized(liquidator) returns (uint256, uint256) { DataTypes.Market storage mBorrow = markets[marketBorrow]; DataTypes.Market storage mCollateral = markets[marketCollateral]; require(mBorrow.config.isListed, "borrow market not listed"); require(mCollateral.config.isListed, "collateral market not listed"); require(_isMarketSeizable(mCollateral), "collateral market cannot be seized"); require(!isCreditAccount(liquidator) && !isCreditAccount(borrower), "cannot liquidate credit account"); require(liquidator != borrower, "cannot self liquidate"); _accrueInterest(marketBorrow, mBorrow); _accrueInterest(marketCollateral, mCollateral); // Check if the borrower is actually liquidatable. require(_isLiquidatable(borrower), "borrower not liquidatable"); // Repay the debt. repayAmount = _repay(mBorrow, liquidator, borrower, marketBorrow, repayAmount); // Seize the collateral. uint256 aTokenAmount = _getLiquidationSeizeAmount(marketBorrow, marketCollateral, mBorrow, mCollateral, repayAmount); _transferAToken(marketCollateral, mCollateral, borrower, liquidator, aTokenAmount); IAToken(mCollateral.config.aTokenAddress).seize(borrower, liquidator, aTokenAmount); // Only emits Transfer event. emit Liquidate(liquidator, borrower, marketBorrow, marketCollateral, repayAmount, aTokenAmount); return (repayAmount, aTokenAmount); } /** * @notice Defer the liquidity check to a user. * @dev The message sender must implement the IDeferLiquidityCheck. * @param user The address of the user * @param data The data to pass to the callback */ function deferLiquidityCheck(address user, bytes memory data) external isAuthorized(user) { require(!isCreditAccount(user), "credit account cannot defer liquidity check"); require(liquidityCheckStatus[user] == LIQUIDITY_CHECK_NORMAL, "reentry defer liquidity check"); liquidityCheckStatus[user] = LIQUIDITY_CHECK_DEFERRED; IDeferLiquidityCheck(msg.sender).onDeferredLiquidityCheck(data); uint8 status = liquidityCheckStatus[user]; liquidityCheckStatus[user] = LIQUIDITY_CHECK_NORMAL; if (status == LIQUIDITY_CHECK_DIRTY) { _checkAccountLiquidity(user); } } /** * @notice User enables or disables an extension. * @param extension The address of the extension * @param allowed Whether to allow or disallow the extension */ function setUserExtension(address extension, bool allowed) external { _setAccountExtension(msg.sender, extension, allowed); } /** * @notice Set the extension for a sub account. * @param primary The address of the primary account * @param subAccountId The ID of the sub account * @param allowed Whether to allow or disallow the extension */ function setSubAccountExtension(address primary, uint256 subAccountId, bool allowed) external isAuthorized(primary) { address account = primary.getSubAccount(subAccountId); _setAccountExtension(account, msg.sender, allowed); } /** * @notice Transfer AToken from one account to another. * @dev This function is callable by the AToken contract only. * @param market The address of the market * @param from The address to transfer from * @param to The address to transfer to * @param amount The amount to transfer */ function transferAToken(address market, address from, address to, uint256 amount) external { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); require(msg.sender == m.config.aTokenAddress, "!authorized"); require(!m.config.isTransferPaused(), "transfer paused"); require(from != to, "cannot self transfer"); require(!isCreditAccount(to), "cannot transfer to credit account"); _accrueInterest(market, m); _transferAToken(market, m, from, to, amount); _checkAccountLiquidity(from); } function configureYieldMode() external { IArbInfo(ARB_INFO_CONTRACT).configureAutomaticYield(); } /* ========== RESTRICTED FUNCTIONS ========== */ /** * @notice List a market. * @dev This function is callable by the market configurator only. * @param market The address of the market * @param config The market configuration */ function listMarket(address market, DataTypes.MarketConfig calldata config) external onlyMarketConfigurator { DataTypes.Market storage m = markets[market]; m.lastUpdateTimestamp = _getNow(); m.borrowIndex = INITIAL_BORROW_INDEX; m.config = config; allMarkets.push(market); emit MarketListed(market, m.lastUpdateTimestamp, m.config); } /** * @notice Delist a market. * @dev This function is callable by the market configurator only. * @param market The address of the market */ function delistMarket(address market) external onlyMarketConfigurator { DataTypes.Market storage m = markets[market]; // The nested mapping like userBorrows can't be deleted completely, so we just set `isListed` to false. m.config.isListed = false; // `isDelisted` is needed to distinguish delisted markets from markets that have never been listed before. m.config.isDelisted = true; allMarkets.deleteElement(market); emit MarketDelisted(market); } /** * @notice Set the market configuration. * @dev This function is callable by the market configurator only. * @param market The address of the market * @param config The market configuration */ function setMarketConfiguration(address market, DataTypes.MarketConfig calldata config) external onlyMarketConfigurator { DataTypes.Market storage m = markets[market]; m.config = config; emit MarketConfigurationChanged(market, config); } /** * @notice Set the credit limit for a user in a market. * @dev This function is callable by the credit limit manager only. * @param user The address of the user * @param market The address of the market * @param credit The credit limit */ function setCreditLimit(address user, address market, uint256 credit) external onlyCreditLimitManager { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); if (credit == 0 && creditLimits[user][market] != 0) { allCreditMarkets[user].deleteElement(market); } else if (credit != 0 && creditLimits[user][market] == 0) { allCreditMarkets[user].push(market); } creditLimits[user][market] = credit; emit CreditLimitChanged(user, market, credit); } /** * @notice Increase reserves by absorbing the surplus cash. * @dev This function is callable by the reserve manager only. * @param market The address of the market */ function absorbToReserves(address market) external onlyReserveManager { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); _accrueInterest(market, m); uint256 amount = IERC20(market).balanceOf(address(this)) - m.totalCash; if (amount > 0) { uint256 aTokenAmount = (amount * 1e18) / _getExchangeRate(m); // Update internal cash, and total reserves. m.totalCash += amount; m.totalReserves += aTokenAmount; emit ReservesIncreased(market, aTokenAmount, amount); } } /** * @notice Reduce reserves by withdrawing the requested amount. * @dev This function is callable by the reserve manager only. * @param market The address of the market * @param aTokenAmount The amount of aToken to withdraw * @param recipient The address which will receive the underlying asset */ function reduceReserves(address market, uint256 aTokenAmount, address recipient) external onlyReserveManager { DataTypes.Market storage m = markets[market]; require(m.config.isListed, "not listed"); _accrueInterest(market, m); uint256 amount = (aTokenAmount * _getExchangeRate(m)) / 1e18; require(m.totalCash >= amount, "insufficient cash"); require(m.totalReserves >= aTokenAmount, "insufficient reserves"); // Update internal cash, and total reserves. unchecked { m.totalCash -= amount; m.totalReserves -= aTokenAmount; } IERC20(market).safeTransfer(recipient, amount); emit ReservesDecreased(market, recipient, aTokenAmount, amount); } /** * @notice Set the price oracle. * @param oracle The address of the price oracle */ function setPriceOracle(address oracle) external onlyOwner { priceOracle = oracle; emit PriceOracleSet(oracle); } /** * @notice Set the market configurator. * @param configurator The address of the market configurator */ function setMarketConfigurator(address configurator) external onlyOwner { marketConfigurator = configurator; emit MarketConfiguratorSet(configurator); } /** * @notice Set the credit limit manager. * @param manager The address of the credit limit manager */ function setCreditLimitManager(address manager) external onlyOwner { creditLimitManager = manager; emit CreditLimitManagerSet(manager); } /** * @notice Set the reserve manager. * @param manager The address of the reserve manager */ function setReserveManager(address manager) external onlyOwner { reserveManager = manager; emit ReserveManagerSet(manager); } /** * @notice Seize the unlisted token. * @param token The address of the token * @param recipient The address which will receive the token */ function seize(address token, address recipient) external onlyOwner { DataTypes.Market storage m = markets[token]; require(!m.config.isListed, "cannot seize listed market"); uint256 balance = IERC20(token).balanceOf(address(this)); if (balance > 0) { IERC20(token).safeTransfer(recipient, balance); emit TokenSeized(token, recipient, balance); } } /* ========== INTERNAL FUNCTIONS ========== */ /** * @dev _authorizeUpgrade is used by UUPSUpgradeable to determine if it's allowed to upgrade a proxy implementation. * @param newImplementation The new implementation * * Ref: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/utils/UUPSUpgradeable.sol */ function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} /** * @dev Get the current timestamp. * @return The current timestamp, casted to uint40 */ function _getNow() internal view virtual returns (uint40) { require(block.timestamp < 2 ** 40, "timestamp too large"); return uint40(block.timestamp); } /** * @dev Check if the operator is authorized. * @param from The address of the user * @param operator The address of the operator */ function _checkAuthorized(address from, address operator) internal view { require(from == operator || (!isCreditAccount(from) && isAllowedExtension(from, operator)), "!authorized"); } /** * @dev Check if the message sender is the market configurator. */ function _checkMarketConfigurator() internal view { require(msg.sender == marketConfigurator, "!configurator"); } /** * @dev Check if the message sender is the credit limit manager. */ function _checkReserveManager() internal view { require(msg.sender == reserveManager, "!reserveManager"); } /** * @dev Get the exchange rate. * @param m The storage of the market * @return The exchange rate */ function _getExchangeRate(DataTypes.Market storage m) internal view returns (uint256) { uint256 totalSupplyPlusReserves = m.totalSupply + m.totalReserves; if (totalSupplyPlusReserves == 0) { return m.config.initialExchangeRate; } return ((m.totalCash + m.totalBorrow) * 1e18) / totalSupplyPlusReserves; } /** * @dev Get the amount of aToken that can be seized in a liquidation. * @param marketBorrow The address of the market being borrowed from * @param marketCollateral The address of the market being used as collateral * @param mBorrow The storage of the borrow market * @param mCollateral The storage of the collateral market * @param repayAmount The amount of the borrowed asset being repaid * @return The amount of aToken that can be seized */ function _getLiquidationSeizeAmount( address marketBorrow, address marketCollateral, DataTypes.Market storage mBorrow, DataTypes.Market storage mCollateral, uint256 repayAmount ) internal view returns (uint256) { uint256 borrowMarketPrice = _getMarketPrice(mBorrow, marketBorrow); uint256 collateralMarketPrice = _getMarketPrice(mCollateral, marketCollateral); // collateral amount = repayAmount * liquidationBonus * borrowMarketPrice / collateralMarketPrice // AToken amount = collateral amount / exchangeRate // = repayAmount * (liquidationBonus * borrowMarketPrice) / (collateralMarketPrice * exchangeRate) uint256 numerator = (mCollateral.config.liquidationBonus * borrowMarketPrice) / FACTOR_SCALE; uint256 denominator = (_getExchangeRate(mCollateral) * collateralMarketPrice) / 1e18; return (repayAmount * numerator) / denominator; } /** * @dev Get the borrow balance of a user. * @param m The storage of the market * @param user The address of the user * @return The borrow balance */ function _getBorrowBalance(DataTypes.Market storage m, address user) internal view returns (uint256) { DataTypes.UserBorrow memory b = m.userBorrows[user]; if (b.borrowBalance == 0) { return 0; } // borrowBalanceWithInterests = borrowBalance * marketBorrowIndex / userBorrowIndex return (b.borrowBalance * m.borrowIndex) / b.borrowIndex; } /** * @dev Transfer AToken from one account to another. * @param market The address of the market * @param m The storage of the market * @param from The address to transfer from * @param to The address to transfer to * @param amount The amount to transfer */ function _transferAToken(address market, DataTypes.Market storage m, address from, address to, uint256 amount) internal { require(from != address(0), "transfer from the zero address"); require(to != address(0), "transfer to the zero address"); uint256 fromBalance = m.userSupplies[from]; require(amount > 0, "transfer zero amount"); require(fromBalance >= amount, "transfer amount exceeds balance"); _enterMarket(market, to); unchecked { m.userSupplies[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. m.userSupplies[to] += amount; } if (m.userSupplies[from] == 0 && _getBorrowBalance(m, from) == 0) { _exitMarket(market, from); } emit TransferAToken(market, from, to, amount); } /** * @dev Accrue interest to the current timestamp. * @param market The address of the market * @param m The storage of the market */ function _accrueInterest(address market, DataTypes.Market storage m) internal { uint40 timestamp = _getNow(); uint256 timeElapsed = uint256(timestamp - m.lastUpdateTimestamp); if (timeElapsed > 0) { uint256 totalCash = m.totalCash; uint256 borrowIndex = m.borrowIndex; uint256 totalBorrow = m.totalBorrow; uint256 totalSupply = m.totalSupply; uint256 totalReserves = m.totalReserves; uint256 borrowRatePerSecond = IInterestRateModel(m.config.interestRateModelAddress).getBorrowRate(totalCash, totalBorrow); uint256 interestFactor = borrowRatePerSecond * timeElapsed; uint256 interestIncreased = (interestFactor * totalBorrow) / 1e18; uint256 feeIncreased = (interestIncreased * m.config.reserveFactor) / FACTOR_SCALE; // Compute reservesIncreased. uint256 reservesIncreased = 0; if (feeIncreased > 0) { reservesIncreased = (feeIncreased * (totalSupply + totalReserves)) / (totalCash + totalBorrow + (interestIncreased - feeIncreased)); } // Compute new states. borrowIndex += (interestFactor * borrowIndex) / 1e18; totalBorrow += interestIncreased; totalReserves += reservesIncreased; // Update state variables. m.lastUpdateTimestamp = timestamp; m.borrowIndex = borrowIndex; m.totalBorrow = totalBorrow; m.totalReserves = totalReserves; emit InterestAccrued(market, timestamp, borrowRatePerSecond, borrowIndex, totalBorrow, totalReserves); } } /** * @dev Enter a market. * @param market The address of the market * @param user The address of the user */ function _enterMarket(address market, address user) internal { if (enteredMarkets[user][market]) { // Skip if user has entered the market. return; } enteredMarkets[user][market] = true; allEnteredMarkets[user].push(market); emit MarketEntered(market, user); } /** * @dev Exit a market. * @param market The address of the market * @param user The address of the user */ function _exitMarket(address market, address user) internal { if (!enteredMarkets[user][market]) { // Skip if user has not entered the market. return; } enteredMarkets[user][market] = false; allEnteredMarkets[user].deleteElement(market); emit MarketExited(market, user); } /** * @dev Repay an amount of asset to ApeFinance. * @param m The market object * @param from The address which will repay the asset * @param to The address which will hold the balance * @param market The address of the market * @param amount The amount of asset to repay, or type(uint256).max for max * @return The actual amount repaid */ function _repay(DataTypes.Market storage m, address from, address to, address market, uint256 amount) internal returns (uint256) { uint256 borrowBalance = _getBorrowBalance(m, to); if (amount == type(uint256).max) { amount = borrowBalance; } require(amount <= borrowBalance, "repay too much"); uint256 newUserBorrowBalance = borrowBalance - amount; uint256 newTotalBorrow = m.totalBorrow - amount; // Update storage. m.userBorrows[to].borrowBalance = newUserBorrowBalance; m.userBorrows[to].borrowIndex = m.borrowIndex; m.totalCash += amount; m.totalBorrow = newTotalBorrow; // Check if need to exit the market. if (m.userSupplies[to] == 0 && newUserBorrowBalance == 0) { _exitMarket(market, to); } IERC20(market).safeTransferFrom(from, address(this), amount); emit Repay(market, from, to, amount, newUserBorrowBalance, newTotalBorrow); return amount; } /** * @dev Check the account liquidity of a user. If the account liquidity check is deferred, mark the status to dirty. It must be checked later. * @param user The address of the user */ function _checkAccountLiquidity(address user) internal { uint8 status = liquidityCheckStatus[user]; if (status == LIQUIDITY_CHECK_NORMAL) { (uint256 collateralValue,, uint256 debtValue) = _getAccountLiquidity(user); require(collateralValue >= debtValue, "insufficient collateral"); } else if (status == LIQUIDITY_CHECK_DEFERRED) { liquidityCheckStatus[user] = LIQUIDITY_CHECK_DIRTY; } } /** * @dev Get the account liquidity of a user. * @param user The address of the user * @return The total collateral value, liquidation collateral value, and total debt value of the user */ function _getAccountLiquidity(address user) internal view returns (uint256, uint256, uint256) { uint256 collateralValue; uint256 liquidationCollateralValue; uint256 debtValue; address[] memory userEnteredMarkets = allEnteredMarkets[user]; for (uint256 i = 0; i < userEnteredMarkets.length; i++) { DataTypes.Market storage m = markets[userEnteredMarkets[i]]; if (!m.config.isListed) { continue; } uint256 supplyBalance = m.userSupplies[user]; uint256 borrowBalance = _getBorrowBalance(m, user); uint256 assetPrice = _getMarketPrice(m, userEnteredMarkets[i]); uint256 collateralFactor = m.config.collateralFactor; uint256 liquidationThreshold = m.config.liquidationThreshold; if (supplyBalance > 0 && collateralFactor > 0) { uint256 exchangeRate = _getExchangeRate(m); collateralValue += (supplyBalance * exchangeRate * assetPrice * collateralFactor) / 1e36 / FACTOR_SCALE; liquidationCollateralValue += (supplyBalance * exchangeRate * assetPrice * liquidationThreshold) / 1e36 / FACTOR_SCALE; } if (borrowBalance > 0) { debtValue += (borrowBalance * assetPrice) / 1e18; } } return (collateralValue, liquidationCollateralValue, debtValue); } /** * @dev Check if an account is liquidatable. * @param user The address of the account to check * @return true if the account is liquidatable, false otherwise */ function _isLiquidatable(address user) internal view returns (bool) { (, uint256 liquidationCollateralValue, uint256 debtValue) = _getAccountLiquidity(user); return debtValue > liquidationCollateralValue; } /** * @dev Check if a market is seizable when a liquidation happens. * @param m The market object * @return true if the market is seizable, false otherwise */ function _isMarketSeizable(DataTypes.Market storage m) internal view returns (bool) { return !m.config.isTransferPaused() && m.config.liquidationThreshold > 0; } /** * @dev Get the market price from the price oracle. If the market is a pToken, use its underlying to get the price. * @param m The market object * @param market The address of the market * @return The market price */ function _getMarketPrice(DataTypes.Market storage m, address market) internal view returns (uint256) { address asset = m.config.isPToken ? IPToken(market).getUnderlying() : market; uint256 assetPrice = IPriceOracle(priceOracle).getPrice(asset); require(assetPrice > 0, "invalid price"); return assetPrice; } /** * @dev Set the extension for an account. * @param account The address of the account * @param extension The address of the extension * @param allowed Whether to allow or disallow the extension */ function _setAccountExtension(address account, address extension, bool allowed) internal { if (allowed && !allowedExtensions[account][extension]) { allowedExtensions[account][extension] = true; allAllowedExtensions[account].push(extension); emit ExtensionAdded(account, extension); } else if (!allowed && allowedExtensions[account][extension]) { allowedExtensions[account][extension] = false; allAllowedExtensions[account].deleteElement(extension); emit ExtensionRemoved(account, extension); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./OwnableUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable { function __Ownable2Step_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable2Step_init_unchained() internal onlyInitializing { } address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() external { address sender = _msgSender(); require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); _transferOwnership(sender); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Constants.sol"; import "./Events.sol"; import "../../libraries/DataTypes.sol"; contract ApeFinanceStorage is Constants, Events { /// @notice The mapping of the supported markets mapping(address => DataTypes.Market) public markets; /// @notice The list of all supported markets address[] public allMarkets; /// @notice The mapping of a user's entered markets mapping(address => mapping(address => bool)) public enteredMarkets; /// @notice The list of all markets a user has entered mapping(address => address[]) public allEnteredMarkets; /// @notice The mapping of a user's allowed extensions mapping(address => mapping(address => bool)) public allowedExtensions; /// @notice The list of all allowed extensions for a user mapping(address => address[]) public allAllowedExtensions; /// @notice The mapping of the credit limits mapping(address => mapping(address => uint256)) public creditLimits; /// @notice The list of a user's credit markets mapping(address => address[]) public allCreditMarkets; /// @notice The mapping of the liquidity check status mapping(address => uint8) public liquidityCheckStatus; /// @notice The price oracle address address public priceOracle; /// @notice The market configurator address address public marketConfigurator; /// @notice The credit limit manager address address public creditLimitManager; /// @notice The reserve manager address address public reserveManager; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IArbInfo { function configureAutomaticYield() external; function configureVoidYield() external; function configureDelegateYield(address delegate) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../libraries/DataTypes.sol"; interface IApeFinance { /* ========== USER INTERFACES ========== */ function accrueInterest(address market) external; function supply(address from, address to, address market, uint256 amount) external; function borrow(address from, address to, address asset, uint256 amount) external; function redeem(address from, address to, address asset, uint256 amount) external returns (uint256); function repay(address from, address to, address asset, uint256 amount) external returns (uint256); function liquidate( address liquidator, address borrower, address marketBorrow, address marketCollateral, uint256 repayAmount ) external returns (uint256, uint256); function deferLiquidityCheck(address user, bytes memory data) external; function getBorrowBalance(address user, address market) external view returns (uint256); function getATokenBalance(address user, address market) external view returns (uint256); function getSupplyBalance(address user, address market) external view returns (uint256); function isMarketListed(address market) external view returns (bool); function getExchangeRate(address market) external view returns (uint256); function getTotalSupply(address market) external view returns (uint256); function getTotalBorrow(address market) external view returns (uint256); function getTotalCash(address market) external view returns (uint256); function getTotalReserves(address market) external view returns (uint256); function getAccountLiquidity(address user) external view returns (uint256, uint256, uint256); function isAllowedExtension(address user, address extension) external view returns (bool); function transferAToken(address market, address from, address to, uint256 amount) external; function setSubAccountExtension(address primary, uint256 subAccountId, bool allowed) external; /* ========== MARKET CONFIGURATOR INTERFACES ========== */ function getMarketConfiguration(address market) external view returns (DataTypes.MarketConfig memory); function listMarket(address market, DataTypes.MarketConfig calldata config) external; function delistMarket(address market) external; function setMarketConfiguration(address market, DataTypes.MarketConfig calldata config) external; /* ========== CREDIT LIMIT MANAGER INTERFACES ========== */ function getCreditLimit(address user, address market) external view returns (uint256); function getUserCreditMarkets(address user) external view returns (address[] memory); function isCreditAccount(address user) external view returns (bool); function setCreditLimit(address user, address market, uint256 credit) external; /* ========== RESERVE MANAGER INTERFACES ========== */ function absorbToReserves(address market) external; function reduceReserves(address market, uint256 aTokenAmount, address recipient) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IAToken { function mint(address account, uint256 amount) external; function burn(address account, uint256 amount) external; function seize(address from, address to, uint256 amount) external; function asset() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IDeferLiquidityCheck { /** * @dev The callback function that deferLiquidityCheck will invoke. * @param data The arbitrary data that was passed in by the caller */ function onDeferredLiquidityCheck(bytes memory data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IInterestRateModel { function getUtilization(uint256 cash, uint256 borrow) external pure returns (uint256); function getBorrowRate(uint256 cash, uint256 borrow) external view returns (uint256); function getSupplyRate(uint256 cash, uint256 borrow) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPriceOracle { function getPrice(address asset) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; interface IPToken is IERC20 { function getUnderlying() external view returns (address); function wrap(uint256 amount) external; function unwrap(uint256 amount) external; function absorb(address user) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Arrays { /** * @dev Delete an element from an array. * @param self The array to delete from * @param element The element to delete */ function deleteElement(address[] storage self, address element) internal { uint256 count = self.length; for (uint256 i = 0; i < count;) { if (self[i] == element) { if (i != count - 1) { self[i] = self[count - 1]; } self.pop(); break; } unchecked { i++; } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library DataTypes { struct UserBorrow { uint256 borrowBalance; uint256 borrowIndex; } struct MarketConfig { // 1 + 1 + 2 + 2 + 2 + 2 + 1 + 1 = 12 bool isListed; uint8 pauseFlags; uint16 collateralFactor; uint16 liquidationThreshold; uint16 liquidationBonus; uint16 reserveFactor; bool isPToken; bool isDelisted; // 20 + 20 + 20 + 32 + 32 + 32 address aTokenAddress; address debtTokenAddress; address interestRateModelAddress; uint256 supplyCap; uint256 borrowCap; uint256 initialExchangeRate; } struct Market { MarketConfig config; uint40 lastUpdateTimestamp; uint256 totalCash; uint256 totalBorrow; uint256 totalSupply; uint256 totalReserves; uint256 borrowIndex; mapping(address => UserBorrow) userBorrows; mapping(address => uint256) userSupplies; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./DataTypes.sol"; library PauseFlags { /// @dev Mask for specific actions in the pause flag bit array uint8 internal constant PAUSE_SUPPLY_MASK = 0xFE; uint8 internal constant PAUSE_BORROW_MASK = 0xFD; uint8 internal constant PAUSE_TRANSFER_MASK = 0xFB; /// @dev Offsets for specific actions in the pause flag bit array uint8 internal constant PAUSE_SUPPLY_OFFSET = 0; uint8 internal constant PAUSE_BORROW_OFFSET = 1; uint8 internal constant PAUSE_TRANSFER_OFFSET = 2; /// @dev Sets the market supply paused. function setSupplyPaused(DataTypes.MarketConfig memory self, bool paused) internal pure { self.pauseFlags = (self.pauseFlags & PAUSE_SUPPLY_MASK) | (toUInt8(paused) << PAUSE_SUPPLY_OFFSET); } /// @dev Returns true if the market supply is paused, and false otherwise. function isSupplyPaused(DataTypes.MarketConfig memory self) internal pure returns (bool) { return toBool(self.pauseFlags & ~PAUSE_SUPPLY_MASK); } /// @dev Sets the market borrow paused. function setBorrowPaused(DataTypes.MarketConfig memory self, bool paused) internal pure { self.pauseFlags = (self.pauseFlags & PAUSE_BORROW_MASK) | (toUInt8(paused) << PAUSE_BORROW_OFFSET); } /// @dev Returns true if the market borrow is paused, and false otherwise. function isBorrowPaused(DataTypes.MarketConfig memory self) internal pure returns (bool) { return toBool(self.pauseFlags & ~PAUSE_BORROW_MASK); } /// @dev Sets the market transfer paused. function setTransferPaused(DataTypes.MarketConfig memory self, bool paused) internal pure { self.pauseFlags = (self.pauseFlags & PAUSE_TRANSFER_MASK) | (toUInt8(paused) << PAUSE_TRANSFER_OFFSET); } /// @dev Returns true if the market transfer is paused, and false otherwise. function isTransferPaused(DataTypes.MarketConfig memory self) internal pure returns (bool) { return toBool(self.pauseFlags & ~PAUSE_TRANSFER_MASK); } /// @dev Casts a boolean to uint8. function toUInt8(bool x) internal pure returns (uint8) { return x ? 1 : 0; } /// @dev Casts a uint8 to boolean. function toBool(uint8 x) internal pure returns (bool) { return x != 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SubAccounts { function getSubAccount(address primary, uint256 subAccountId) internal pure returns (address) { require(subAccountId < 256, "invalid sub account id"); return address(uint160(primary) ^ uint160(subAccountId)); } function isSubAccountOf(address subAccount, address primary) internal pure returns (bool) { return (uint160(primary) | 0xFF) == (uint160(subAccount) | 0xFF); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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"); (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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @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 Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.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 AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract Constants { uint256 internal constant INITIAL_BORROW_INDEX = 1e18; uint256 internal constant INITIAL_EXCHANGE_RATE = 1e18; uint256 internal constant FACTOR_SCALE = 10000; uint16 internal constant MAX_COLLATERAL_FACTOR = 9000; // 90% uint16 internal constant MAX_LIQUIDATION_THRESHOLD = 10000; // 100% uint16 internal constant MIN_LIQUIDATION_BONUS = 10000; // 100% uint16 internal constant MAX_LIQUIDATION_BONUS = 12500; // 125% uint16 internal constant MAX_LIQUIDATION_THRESHOLD_X_BONUS = 10000; // 100% uint16 internal constant MAX_RESERVE_FACTOR = 10000; // 100% uint8 internal constant LIQUIDITY_CHECK_NORMAL = 0; uint8 internal constant LIQUIDITY_CHECK_DEFERRED = 1; uint8 internal constant LIQUIDITY_CHECK_DIRTY = 2; address internal constant ARB_INFO_CONTRACT = 0x0000000000000000000000000000000000000065; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../libraries/DataTypes.sol"; abstract contract Events { event MarketConfiguratorSet(address configurator); event CreditLimitManagerSet(address manager); event ReserveManagerSet(address manager); event CreditLimitChanged(address indexed user, address indexed market, uint256 credit); event PriceOracleSet(address priceOracle); event MarketListed(address indexed market, uint40 timestamp, DataTypes.MarketConfig config); event MarketDelisted(address indexed market); event MarketConfigurationChanged(address indexed market, DataTypes.MarketConfig config); event MarketEntered(address indexed market, address indexed user); event MarketExited(address indexed market, address indexed user); event InterestAccrued( address indexed market, uint40 timestamp, uint256 borrowRatePerSecond, uint256 borrowIndex, uint256 totalBorrow, uint256 totalReserves ); event Supply( address indexed market, address indexed from, address indexed to, uint256 amount, uint256 aTokenAmount ); event Borrow( address indexed market, address indexed from, address indexed to, uint256 amount, uint256 accountBorrow, uint256 totalBorrow ); event Redeem( address indexed market, address indexed from, address indexed to, uint256 amount, uint256 aTokenAmount ); event Repay( address indexed market, address indexed from, address indexed to, uint256 amount, uint256 accountBorrow, uint256 totalBorrow ); event Liquidate( address indexed liquidator, address indexed borrower, address indexed marketBorrow, address marketCollateral, uint256 repayAmount, uint256 seizedAmount ); event TransferAToken(address indexed market, address indexed from, address indexed to, uint256 aTokenAmount); event TokenSeized(address indexed token, address indexed recipient, uint256 amount); event ReservesIncreased(address indexed market, uint256 aTokenAmount, uint256 amount); event ReservesDecreased(address indexed market, address indexed recipient, uint256 aTokenAmount, uint256 amount); event ExtensionAdded(address indexed account, address indexed extension); event ExtensionRemoved(address indexed account, address indexed extension); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrow","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrow","type":"uint256"}],"name":"Borrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"uint256","name":"credit","type":"uint256"}],"name":"CreditLimitChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"manager","type":"address"}],"name":"CreditLimitManagerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"extension","type":"address"}],"name":"ExtensionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"extension","type":"address"}],"name":"ExtensionRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"uint40","name":"timestamp","type":"uint40"},{"indexed":false,"internalType":"uint256","name":"borrowRatePerSecond","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrow","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalReserves","type":"uint256"}],"name":"InterestAccrued","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"liquidator","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":true,"internalType":"address","name":"marketBorrow","type":"address"},{"indexed":false,"internalType":"address","name":"marketCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seizedAmount","type":"uint256"}],"name":"Liquidate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"components":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint8","name":"pauseFlags","type":"uint8"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint16","name":"liquidationThreshold","type":"uint16"},{"internalType":"uint16","name":"liquidationBonus","type":"uint16"},{"internalType":"uint16","name":"reserveFactor","type":"uint16"},{"internalType":"bool","name":"isPToken","type":"bool"},{"internalType":"bool","name":"isDelisted","type":"bool"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"debtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateModelAddress","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"initialExchangeRate","type":"uint256"}],"indexed":false,"internalType":"struct DataTypes.MarketConfig","name":"config","type":"tuple"}],"name":"MarketConfigurationChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"configurator","type":"address"}],"name":"MarketConfiguratorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"}],"name":"MarketDelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"MarketEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"MarketExited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"uint40","name":"timestamp","type":"uint40"},{"components":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint8","name":"pauseFlags","type":"uint8"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint16","name":"liquidationThreshold","type":"uint16"},{"internalType":"uint16","name":"liquidationBonus","type":"uint16"},{"internalType":"uint16","name":"reserveFactor","type":"uint16"},{"internalType":"bool","name":"isPToken","type":"bool"},{"internalType":"bool","name":"isDelisted","type":"bool"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"debtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateModelAddress","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"initialExchangeRate","type":"uint256"}],"indexed":false,"internalType":"struct DataTypes.MarketConfig","name":"config","type":"tuple"}],"name":"MarketListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"priceOracle","type":"address"}],"name":"PriceOracleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"aTokenAmount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrow","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrow","type":"uint256"}],"name":"Repay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"manager","type":"address"}],"name":"ReserveManagerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"aTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReservesDecreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"uint256","name":"aTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ReservesIncreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"aTokenAmount","type":"uint256"}],"name":"Supply","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenSeized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"market","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"aTokenAmount","type":"uint256"}],"name":"TransferAToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"absorbToReserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"accrueInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"allAllowedExtensions","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"allCreditMarkets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"allEnteredMarkets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allMarkets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowedExtensions","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"borrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"marketBorrow","type":"address"},{"internalType":"address","name":"marketCollateral","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"calculateLiquidationOpportunity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"checkAccountLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"configureYieldMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"creditLimitManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"creditLimits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"deferLiquidityCheck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"delistMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"enteredMarkets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"market","type":"address"}],"name":"getATokenBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllMarkets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"market","type":"address"}],"name":"getBorrowBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"market","type":"address"}],"name":"getCreditLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getExchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getMarketConfiguration","outputs":[{"components":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint8","name":"pauseFlags","type":"uint8"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint16","name":"liquidationThreshold","type":"uint16"},{"internalType":"uint16","name":"liquidationBonus","type":"uint16"},{"internalType":"uint16","name":"reserveFactor","type":"uint16"},{"internalType":"bool","name":"isPToken","type":"bool"},{"internalType":"bool","name":"isDelisted","type":"bool"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"debtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateModelAddress","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"initialExchangeRate","type":"uint256"}],"internalType":"struct DataTypes.MarketConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"market","type":"address"}],"name":"getSupplyBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getTotalBorrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getTotalCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getTotalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"getTotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserAllowedExtensions","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserCreditMarkets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"extension","type":"address"}],"name":"isAllowedExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isCreditAccount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"isMarketListed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isUserLiquidatable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"address","name":"marketBorrow","type":"address"},{"internalType":"address","name":"marketCollateral","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"liquidate","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"liquidityCheckStatus","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"components":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint8","name":"pauseFlags","type":"uint8"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint16","name":"liquidationThreshold","type":"uint16"},{"internalType":"uint16","name":"liquidationBonus","type":"uint16"},{"internalType":"uint16","name":"reserveFactor","type":"uint16"},{"internalType":"bool","name":"isPToken","type":"bool"},{"internalType":"bool","name":"isDelisted","type":"bool"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"debtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateModelAddress","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"initialExchangeRate","type":"uint256"}],"internalType":"struct DataTypes.MarketConfig","name":"config","type":"tuple"}],"name":"listMarket","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"marketConfigurator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"markets","outputs":[{"components":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint8","name":"pauseFlags","type":"uint8"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint16","name":"liquidationThreshold","type":"uint16"},{"internalType":"uint16","name":"liquidationBonus","type":"uint16"},{"internalType":"uint16","name":"reserveFactor","type":"uint16"},{"internalType":"bool","name":"isPToken","type":"bool"},{"internalType":"bool","name":"isDelisted","type":"bool"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"debtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateModelAddress","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"initialExchangeRate","type":"uint256"}],"internalType":"struct DataTypes.MarketConfig","name":"config","type":"tuple"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"uint256","name":"totalCash","type":"uint256"},{"internalType":"uint256","name":"totalBorrow","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"totalReserves","type":"uint256"},{"internalType":"uint256","name":"borrowIndex","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"aTokenAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"reduceReserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"repay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"seize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"credit","type":"uint256"}],"name":"setCreditLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"manager","type":"address"}],"name":"setCreditLimitManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"components":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint8","name":"pauseFlags","type":"uint8"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint16","name":"liquidationThreshold","type":"uint16"},{"internalType":"uint16","name":"liquidationBonus","type":"uint16"},{"internalType":"uint16","name":"reserveFactor","type":"uint16"},{"internalType":"bool","name":"isPToken","type":"bool"},{"internalType":"bool","name":"isDelisted","type":"bool"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"debtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateModelAddress","type":"address"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"initialExchangeRate","type":"uint256"}],"internalType":"struct DataTypes.MarketConfig","name":"config","type":"tuple"}],"name":"setMarketConfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"configurator","type":"address"}],"name":"setMarketConfigurator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oracle","type":"address"}],"name":"setPriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"manager","type":"address"}],"name":"setReserveManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"primary","type":"address"},{"internalType":"uint256","name":"subAccountId","type":"uint256"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"setSubAccountExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"extension","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"setUserExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"supply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a06040523060805234801561001457600080fd5b50600160fb55608051615cf462000052600039600081816114a1015281816114e101528181611686015281816116c601526117590152615cf46000f3fe6080604052600436106103c35760003560e01c80638e8f294b116101f2578063c2a544811161010d578063df7da754116100a0578063efb7601d1161006f578063efb7601d14610f7d578063f2fde38b14610f9d578063fcc0c68014610fbd578063fe1e50a314610fdd57600080fd5b8063df7da75414610eff578063dfd5265b14610f1f578063e1fb436814610f3f578063e30c397814610f5f57600080fd5b8063cdb66f7c116100dc578063cdb66f7c14610e7f578063d1456d4f14610e9f578063d49f8be014610ebf578063d82ecc4814610edf57600080fd5b8063c2a5448114610dff578063c2cc27a614610e1f578063c4109c0114610e3f578063c4d66de814610e5f57600080fd5b8063b666d84b11610185578063bc15830d11610154578063bc15830d14610d8a578063be88ea3214610daa578063c00d370914610dca578063c035bd2114610ddf57600080fd5b8063b666d84b14610d09578063ba036b4014610d29578063ba37773114610d49578063bb004abc14610d6957600080fd5b80639f9f794f116101c15780639f9f794f14610c7f578063a928fe1014610c9f578063afef7efd14610cd4578063b0772d0b14610cf457600080fd5b80638e8f294b14610abb5780639198e51514610c055780639414efc714610c255780639b990d7214610c4657600080fd5b806352d1902d116102e25780636e646847116102755780638538d14e116102445780638538d14e14610a0157806389b7b7a614610a3a5780638b4f33ee14610a5a5780638da5cb5b14610a9d57600080fd5b80636e6468471461097b578063715018a61461099b57806379ba5097146109b05780637e982c4b146109c557600080fd5b80635db22de6116102b15780635db22de6146108935780635ec88c79146108da57806368da10ae146109155780636da825841461094e57600080fd5b806352d1902d146106b557806352d84d1e146106ca578063530e784f146106ea5780635a208d521461070a57600080fd5b80633659cfe61161035a5780634492ba9e116103295780634492ba9e146105fd5780634ac51189146106475780634e05cbb3146106675780634f1ef286146106a257600080fd5b80633659cfe6146105545780633a1181d9146105745780633d98a1e51461059457806341d15f6d146105dd57600080fd5b8063178de7eb11610396578063178de7eb1461048f5780631a7370cc146104c8578063203660df146104e85780632630c12f1461053357600080fd5b80630445254d146103c8578063050e570514610414578063107c8ed71461044d578063118e31b71461046f575b600080fd5b3480156103d457600080fd5b506104016103e3366004614fe8565b61010260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b34801561042057600080fd5b5061040161042f366004615021565b6001600160a01b0316600090815260fc60205260409020600a015490565b34801561045957600080fd5b5061046d61046836600461503e565b610ffd565b005b34801561047b57600080fd5b5061040161048a366004614fe8565b611431565b34801561049b57600080fd5b50610107546104b0906001600160a01b031681565b6040516001600160a01b03909116815260200161040b565b3480156104d457600080fd5b506104b06104e336600461508f565b61145d565b3480156104f457600080fd5b50610401610503366004614fe8565b6001600160a01b03808216600090815260fc602090815260408083209386168352600d9093019052205492915050565b34801561053f57600080fd5b50610105546104b0906001600160a01b031681565b34801561056057600080fd5b5061046d61056f366004615021565b611496565b34801561058057600080fd5b5061046d61058f3660046150bb565b611576565b3480156105a057600080fd5b506105cd6105af366004615021565b6001600160a01b0316600090815260fc602052604090205460ff1690565b604051901515815260200161040b565b3480156105e957600080fd5b506104016105f83660046150fe565b6115eb565b34801561060957600080fd5b506105cd610618366004614fe8565b6001600160a01b0391821660009081526101006020908152604080832093909416825291909152205460ff1690565b34801561065357600080fd5b5061046d610662366004615021565b61161d565b34801561067357600080fd5b506105cd610682366004614fe8565b60fe60209081526000928352604080842090915290825290205460ff1681565b61046d6106b0366004615155565b61167b565b3480156106c157600080fd5b5061040161174c565b3480156106d657600080fd5b506104b06106e5366004615219565b6117ff565b3480156106f657600080fd5b5061046d610705366004615021565b611829565b34801561071657600080fd5b50610886610725366004615021565b604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a0810191909152506001600160a01b03908116600090815260fc602090815260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955261ffff620100008304811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b909304841691830191909152600181015483166101208301526002810154909216610140820152600382015461016082015260048201546101808201526005909101546101a082015290565b60405161040b9190615323565b34801561089f57600080fd5b506104016108ae366004614fe8565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205490565b3480156108e657600080fd5b506108fa6108f5366004615021565b611880565b6040805193845260208401929092529082015260600161040b565b34801561092157600080fd5b50610401610930366004615021565b6001600160a01b0316600090815260fc602052604090206009015490565b34801561095a57600080fd5b5061096e610969366004615021565b61189b565b60405161040b9190615332565b34801561098757600080fd5b5061046d610996366004615021565b611912565b3480156109a757600080fd5b5061046d61191b565b3480156109bc57600080fd5b5061046d61192f565b3480156109d157600080fd5b506105cd6109e0366004614fe8565b61010060209081526000928352604080842090915290825290205460ff1681565b348015610a0d57600080fd5b50610401610a1c366004615021565b6001600160a01b0316600090815260fc602052604090206008015490565b348015610a4657600080fd5b5061046d610a55366004615155565b6119a6565b348015610a6657600080fd5b50610a8b610a75366004615021565b6101046020526000908152604090205460ff1681565b60405160ff909116815260200161040b565b348015610aa957600080fd5b506097546001600160a01b03166104b0565b348015610ac757600080fd5b50610bf2610ad6366004615021565b60fc6020908152600091825260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955262010000820461ffff90811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b9093046001600160a01b03908116928401929092526001810154821661012084015260028101549091166101408301526003810154610160830152600481015461018083015260058101546101a08301526006810154600782015460088301546009840154600a850154600b9095015464ffffffffff9094169492939192909187565b60405161040b979695949392919061537f565b348015610c1157600080fd5b5061046d610c20366004615021565b611b36565b348015610c3157600080fd5b50610106546104b0906001600160a01b031681565b348015610c5257600080fd5b50610401610c61366004615021565b6001600160a01b0316600090815260fc602052604090206007015490565b348015610c8b57600080fd5b5061046d610c9a3660046153e4565b611b79565b348015610cab57600080fd5b50610cbf610cba366004615426565b611bad565b6040805192835260208301919091520161040b565b348015610ce057600080fd5b5061046d610cef36600461503e565b611f26565b348015610d0057600080fd5b5061096e61230d565b348015610d1557600080fd5b5061046d610d24366004615021565b61236f565b348015610d3557600080fd5b50610401610d4436600461503e565b6123eb565b348015610d5557600080fd5b50610401610d64366004614fe8565b6126f2565b348015610d7557600080fd5b50610108546104b0906001600160a01b031681565b348015610d9657600080fd5b5061046d610da536600461548a565b61274b565b348015610db657600080fd5b506104b0610dc536600461508f565b612756565b348015610dd657600080fd5b5061046d612773565b348015610deb57600080fd5b50610401610dfa36600461503e565b6127c3565b348015610e0b57600080fd5b5061046d610e1a366004615021565b6128b6565b348015610e2b57600080fd5b5061046d610e3a3660046150bb565b61290d565b348015610e4b57600080fd5b5061046d610e5a366004615021565b6129fc565b348015610e6b57600080fd5b5061046d610e7a366004615021565b612b72565b348015610e8b57600080fd5b5061096e610e9a366004615021565b612c94565b348015610eab57600080fd5b5061046d610eba3660046154b8565b612d09565b348015610ecb57600080fd5b506104b0610eda36600461508f565b612e75565b348015610eeb57600080fd5b506105cd610efa366004615021565b612e91565b348015610f0b57600080fd5b5061046d610f1a366004615021565b612eaf565b348015610f2b57600080fd5b5061046d610f3a36600461503e565b612f06565b348015610f4b57600080fd5b506105cd610f5a366004615021565b613182565b348015610f6b57600080fd5b5060c9546001600160a01b03166104b0565b348015610f8957600080fd5b50610401610f98366004615021565b61318d565b348015610fa957600080fd5b5061046d610fb8366004615021565b6131ae565b348015610fc957600080fd5b5061046d610fd8366004614fe8565b61321f565b348015610fe957600080fd5b5061046d610ff83660046150fe565b61336b565b61100561351c565b836110108133613576565b6001600160a01b038316600090815260fc60205260409020805460ff166110525760405162461bcd60e51b8152600401611049906154ef565b60405180910390fd5b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261112f90613607565b1561116c5760405162461bcd60e51b815260206004820152600d60248201526c1cdd5c1c1b1e481c185d5cd959609a1b6044820152606401611049565b61117585612e91565b156111c25760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f7420737570706c7920746f20637265646974206163636f756e74006044820152606401611049565b6111cc8482613619565b60038101541561125a576000670de0b6b3a76400006111ea8361385d565b83600901546111f99190615529565b6112039190615548565b6003830154909150611215858361556a565b11156112585760405162461bcd60e51b81526020600482015260126024820152711cdd5c1c1b1e4818d85c081c995858da195960721b6044820152606401611049565b505b60006112658261385d565b61127785670de0b6b3a7640000615529565b6112819190615548565b9050600081116112c85760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611049565b838260070160008282546112dc919061556a565b92505081905550808260090160008282546112f7919061556a565b90915550506001600160a01b0386166000908152600d830160205260408120805483929061132690849061556a565b9091555050831561133b5761133b85876138b5565b81546040516340c10f1960e01b81526001600160a01b03888116600483015260248201849052600160601b909204909116906340c10f1990604401600060405180830381600087803b15801561139057600080fd5b505af11580156113a4573d6000803e3d6000fd5b506113be925050506001600160a01b038616883087613972565b856001600160a01b0316876001600160a01b0316866001600160a01b03167fe751baae971614714a5055ecbc0892f68c0e2d70c56550cb65a76bc840fa5f6e8785604051611416929190918252602082015260400190565b60405180910390a450505061142b600160fb55565b50505050565b6001600160a01b038116600090815260fc6020526040812061145381856139dd565b9150505b92915050565b610101602052816000526040600020818154811061147a57600080fd5b6000918252602090912001546001600160a01b03169150829050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156114df5760405162461bcd60e51b815260040161104990615582565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611528600080516020615c78833981519152546001600160a01b031690565b6001600160a01b03161461154e5760405162461bcd60e51b8152600401611049906155ce565b61155781613a39565b6040805160008082526020820190925261157391839190613a41565b50565b61157e613bac565b6001600160a01b038216600090815260fc6020526040902081816115a2828261568d565b905050826001600160a01b03167fdcd3ac9b517302fa7d6db6d2ae9265b3d65ccc4d3030130620d7a1701b74b2a4836040516115de919061588f565b60405180910390a2505050565b6001600160a01b038216600090815260fc60205260408120806116118686838088613bf7565b925050505b9392505050565b611625613c8e565b61010680546001600160a01b0319166001600160a01b0383169081179091556040519081527fdca89ce6f30fe0a23d88a5467a028ce35ba1b7b5b8d9e9e50dbc151fe55c82ad906020015b60405180910390a150565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156116c45760405162461bcd60e51b815260040161104990615582565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661170d600080516020615c78833981519152546001600160a01b031690565b6001600160a01b0316146117335760405162461bcd60e51b8152600401611049906155ce565b61173c82613a39565b61174882826001613a41565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146117ec5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611049565b50600080516020615c7883398151915290565b60fd818154811061180f57600080fd5b6000918252602090912001546001600160a01b0316905081565b611831613c8e565b61010580546001600160a01b0319166001600160a01b0383169081179091556040519081527f6536690106168bdf4ba72c128a053d817999b1db90cae23f139b293bf862cb7590602001611670565b600080600061188e84613ce8565b9250925092509193909250565b6001600160a01b0381166000908152610103602090815260409182902080548351818402810184019094528084526060939283018282801561190657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116118e8575b50505050509050919050565b61157381613f52565b611923613c8e565b61192d6000614009565b565b60c95433906001600160a01b0316811461199d5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401611049565b61157381614009565b816119b18133613576565b6119ba83612e91565b15611a1b5760405162461bcd60e51b815260206004820152602b60248201527f637265646974206163636f756e742063616e6e6f74206465666572206c69717560448201526a696469747920636865636b60a81b6064820152608401611049565b6001600160a01b0383166000908152610104602052604090205460ff1615611a855760405162461bcd60e51b815260206004820152601d60248201527f7265656e747279206465666572206c697175696469747920636865636b0000006044820152606401611049565b6001600160a01b0383166000908152610104602052604090819020805460ff191660011790555163a15db5c560e01b8152339063a15db5c590611acc908590600401615a06565b600060405180830381600087803b158015611ae657600080fd5b505af1158015611afa573d6000803e3d6000fd5b505050506001600160a01b038316600090815261010460205260409020805460ff19811690915560ff16600281141561142b5761142b84613f52565b6001600160a01b038116600090815260fc60205260409020805460ff16611b6f5760405162461bcd60e51b8152600401611049906154ef565b6117488282613619565b82611b848133613576565b6000611b996001600160a01b03861685614022565b9050611ba6813385614073565b5050505050565b600080611bb861351c565b86611bc38133613576565b6001600160a01b03808716600090815260fc602052604080822092881682529020815460ff16611c355760405162461bcd60e51b815260206004820152601860248201527f626f72726f77206d61726b6574206e6f74206c697374656400000000000000006044820152606401611049565b805460ff16611c865760405162461bcd60e51b815260206004820152601c60248201527f636f6c6c61746572616c206d61726b6574206e6f74206c6973746564000000006044820152606401611049565b611c8f816141f9565b611ce65760405162461bcd60e51b815260206004820152602260248201527f636f6c6c61746572616c206d61726b65742063616e6e6f74206265207365697a604482015261195960f21b6064820152608401611049565b611cef8a612e91565b158015611d025750611d0089612e91565b155b611d4e5760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f74206c697175696461746520637265646974206163636f756e74006044820152606401611049565b886001600160a01b03168a6001600160a01b03161415611da85760405162461bcd60e51b815260206004820152601560248201527463616e6e6f742073656c66206c697175696461746560581b6044820152606401611049565b611db28883613619565b611dbc8782613619565b611dc5896142f3565b611e115760405162461bcd60e51b815260206004820152601960248201527f626f72726f776572206e6f74206c6971756964617461626c65000000000000006044820152606401611049565b611e1e828b8b8b8a61430b565b95506000611e2f898985858b613bf7565b9050611e3e88838c8e85614481565b815460405163b2a02ff160e01b81526001600160a01b038c811660048301528d8116602483015260448201849052600160601b9092049091169063b2a02ff190606401600060405180830381600087803b158015611e9b57600080fd5b505af1158015611eaf573d6000803e3d6000fd5b5050604080516001600160a01b038c81168252602082018c9052918101859052818d1693508d82169250908e16907fac8bbd8fb7420b3123cf9e24d34551e40514ea69c5a1e97c10e513aaf06e7e429060600160405180910390a48695509350505050611f1c600160fb55565b9550959350505050565b611f2e61351c565b83611f398133613576565b6001600160a01b038316600090815260fc60205260409020805460ff16611f725760405162461bcd60e51b8152600401611049906154ef565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261204f90614698565b1561208c5760405162461bcd60e51b815260206004820152600d60248201526c189bdc9c9bddc81c185d5cd959609a1b6044820152606401611049565b82816007015410156120b05760405162461bcd60e51b815260040161104990615a19565b6120ba8482613619565b60008382600801546120cc919061556a565b90506000846120db848a6139dd565b6120e5919061556a565b60048401549091501561213b57600483015482111561213b5760405162461bcd60e51b8152602060048201526012602482015271189bdc9c9bddc818d85c081c995858da195960721b6044820152606401611049565b8483600701600082825461214f9190615a44565b9091555050600883018290556001600160a01b0388166000908152600c840160205260409020818155600b84015460019091015584156121935761219386896138b5565b6121a76001600160a01b03871688876146aa565b6121b088612e91565b156122a257866001600160a01b0316886001600160a01b0316146122275760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920626f72726f772074604482015267379034ba39b2b63360c11b6064820152608401611049565b6001600160a01b03808916600090815261010260209081526040808320938a168352929052205481111561229d5760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e7420637265646974206c696d6974000000000000006044820152606401611049565b6122ab565b6122ab88613f52565b60408051868152602081018390529081018390526001600160a01b03808916918a8216918916907f4bc4b08d677fc59195d56e346dcb5cc5dc3b78b90d59f5d36740ae1b3d225db89060600160405180910390a45050505061142b600160fb55565b606060fd80548060200260200160405190810160405280929190818152602001828054801561236557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612347575b5050505050905090565b612377613bac565b6001600160a01b038116600090815260fc6020526040902080546bff00000000000000000000ff1916600160581b1781556123b360fd836146da565b6040516001600160a01b038316907f9710c341258431a6380fd1febe8985e6b6221e8398c287ea971f2ba85a6e1a1090600090a25050565b60006123f561351c565b846124008133613576565b6001600160a01b038416600090815260fc60205260409020805460ff166124395760405162461bcd60e51b8152600401611049906154ef565b6124438582613619565b6001600160a01b0387166000908152600d820160205260408120546007830154909160001987141561249e575081670de0b6b3a76400006124838561385d565b61248d9083615529565b6124979190615548565b96506124c6565b6124a78461385d565b6124b988670de0b6b3a7640000615529565b6124c39190615548565b90505b6000811161250b5760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611049565b808310156125525760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401611049565b868210156125725760405162461bcd60e51b815260040161104990615a19565b600061257e8285615a44565b6001600160a01b038c166000908152600d87016020526040902081905590506125a78884615a44565b8560070181905550818560090160008282546125c39190615a44565b9091555050801580156125dd57506125db858c6139dd565b155b156125ec576125ec898c6147e9565b8454604051632770a7eb60e21b81526001600160a01b038d8116600483015260248201859052600160601b90920490911690639dc29fac90604401600060405180830381600087803b15801561264157600080fd5b505af1158015612655573d6000803e3d6000fd5b5061266e925050506001600160a01b038a168b8a6146aa565b6126778b613f52565b896001600160a01b03168b6001600160a01b03168a6001600160a01b03167faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c8b866040516126cf929190918252602082015260400190565b60405180910390a48796505050505050506126ea600160fb55565b949350505050565b6001600160a01b038116600090815260fc60205260408120670de0b6b3a764000061271c8261385d565b6001600160a01b0386166000908152600d840160205260409020546127419190615529565b6114539190615548565b611748338383614073565b610103602052816000526040600020818154811061147a57600080fd5b60656001600160a01b0316637114177a6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156127af57600080fd5b505af115801561142b573d6000803e3d6000fd5b60006127cd61351c565b846127d88133613576565b6001600160a01b038416600090815260fc60205260409020805460ff166128115760405162461bcd60e51b8152600401611049906154ef565b61281a86612e91565b1561289157856001600160a01b0316876001600160a01b0316146128915760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920726570617920666f604482015267391034ba39b2b63360c11b6064820152608401611049565b61289b8582613619565b6128a8818888888861430b565b925050506126ea600160fb55565b6128be613c8e565b61010780546001600160a01b0319166001600160a01b0383169081179091556040519081527f517371384ca8a07b7ae4697507862b5200ce0a12158170259cebe2cb63d33f3290602001611670565b612915613bac565b6001600160a01b038216600090815260fc602052604090206129356148a0565b60068201805464ffffffffff191664ffffffffff92909216919091179055670de0b6b3a7640000600b820155818161296d828261568d565b505060fd80546001810182556000919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800180546001600160a01b0319166001600160a01b03851690811790915560068201546040517fbefee0150f4933331fcee3972b8a74be870d590ef30e21f8830c9b2a9d04c987916115de9164ffffffffff909116908590615a5b565b612a046148f2565b6001600160a01b038116600090815260fc60205260409020805460ff16612a3d5760405162461bcd60e51b8152600401611049906154ef565b612a478282613619565b60078101546040516370a0823160e01b8152306004820152600091906001600160a01b038516906370a0823190602401602060405180830381865afa158015612a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab89190615b50565b612ac29190615a44565b90508015612b6d576000612ad58361385d565b612ae783670de0b6b3a7640000615529565b612af19190615548565b905081836007016000828254612b07919061556a565b925050819055508083600a016000828254612b22919061556a565b909155505060408051828152602081018490526001600160a01b038616917fe08e52dead7793dd3e1f1b8c081a9d196fb9a1f26939c240e3660e9badd466b3910160405180910390a2505b505050565b600054610100900460ff1615808015612b925750600054600160ff909116105b80612bac5750303b158015612bac575060005460ff166001145b612c0f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611049565b6000805460ff191660011790558015612c32576000805461ff0019166101001790555b612c3a61493f565b612c4261496e565b612c4b826131ae565b8015611748576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6001600160a01b03811660009081526101016020908152604091829020805483518184028101840190945280845260609392830182828015611906576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116118e85750505050509050919050565b612d116148f2565b6001600160a01b038316600090815260fc60205260409020805460ff16612d4a5760405162461bcd60e51b8152600401611049906154ef565b612d548482613619565b6000670de0b6b3a7640000612d688361385d565b612d729086615529565b612d7c9190615548565b90508082600701541015612da25760405162461bcd60e51b815260040161104990615a19565b8382600a01541015612dee5760405162461bcd60e51b8152602060048201526015602482015274696e73756666696369656e7420726573657276657360581b6044820152606401611049565b6007820180548290039055600a820180548590039055612e186001600160a01b03861684836146aa565b826001600160a01b0316856001600160a01b03167f85d7d5527903b3bdc93c2e97283c443822adba607371569d40047426532c9c388684604051612e66929190918252602082015260400190565b60405180910390a35050505050565b60ff602052816000526040600020818154811061147a57600080fd5b6001600160a01b031660009081526101036020526040902054151590565b612eb7613c8e565b61010880546001600160a01b0319166001600160a01b0383169081179091556040519081527f7e84f9bb34064cde550792818395eb9c2f7766113ce1c301d35c19cbe2e187ac90602001611670565b6001600160a01b038416600090815260fc60205260409020805460ff16612f3f5760405162461bcd60e51b8152600401611049906154ef565b8054600160601b90046001600160a01b03163314612f8d5760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611049565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261306a90614995565b156130a95760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c881c185d5cd959608a1b6044820152606401611049565b826001600160a01b0316846001600160a01b031614156131025760405162461bcd60e51b815260206004820152601460248201527331b0b73737ba1039b2b633103a3930b739b332b960611b6044820152606401611049565b61310b83612e91565b156131625760405162461bcd60e51b815260206004820152602160248201527f63616e6e6f74207472616e7366657220746f20637265646974206163636f756e6044820152601d60fa1b6064820152608401611049565b61316c8582613619565b6131798582868686614481565b611ba684613f52565b6000611457826142f3565b6001600160a01b038116600090815260fc602052604081206116168161385d565b6131b6613c8e565b60c980546001600160a01b0383166001600160a01b031990911681179091556131e76097546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b613227613c8e565b6001600160a01b038216600090815260fc60205260409020805460ff16156132915760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f74207365697a65206c6973746564206d61726b65740000000000006044820152606401611049565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156132d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132fc9190615b50565b9050801561142b576133186001600160a01b03851684836146aa565b826001600160a01b0316846001600160a01b03167feac344312e08a6e34d3cb14733c432e8b20995a316e9abf4bc59640dc90d10ca8360405161335d91815260200190565b60405180910390a350505050565b610107546001600160a01b031633146133b15760405162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b6044820152606401611049565b6001600160a01b038216600090815260fc60205260409020805460ff166133ea5760405162461bcd60e51b8152600401611049906154ef565b8115801561341d57506001600160a01b038085166000908152610102602090815260408083209387168352929052205415155b1561344a576001600160a01b03841660009081526101036020526040902061344590846146da565b6134c2565b811580159061347d57506001600160a01b0380851660009081526101026020908152604080832093871683529290522054155b156134c2576001600160a01b038481166000908152610103602090815260408220805460018101825590835291200180546001600160a01b0319169185169190911790555b6001600160a01b038481166000818152610102602090815260408083209488168084529482529182902086905590518581527fd2430896b2083037d8bf873ee97e05de0442c7137b4c9413b9e928f7212869e9910161335d565b600260fb54141561356f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611049565b600260fb55565b806001600160a01b0316826001600160a01b031614806135cd575061359a82612e91565b1580156135cd57506001600160a01b038083166000908152610100602090815260408083209385168352929052205460ff165b6117485760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611049565b60208101516000906001161515611457565b60006136236148a0565b600683015490915060009061363f9064ffffffffff1683615b69565b64ffffffffff169050801561142b576007830154600b84015460088501546009860154600a87015460028801546040516329737ea560e21b815260048101879052602481018590526000916001600160a01b03169063a5cdfa9490604401602060405180830381865afa1580156136ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136de9190615b50565b905060006136ec8883615529565b90506000670de0b6b3a76400006137038784615529565b61370d9190615548565b8b549091506000906127109061372e90600160401b900461ffff1684615529565b6137389190615548565b9050600081156137815761374c8284615a44565b613756898c61556a565b613760919061556a565b61376a878961556a565b6137749084615529565b61377e9190615548565b90505b670de0b6b3a76400006137948a86615529565b61379e9190615548565b6137a8908a61556a565b98506137b4838961556a565b97506137c0818761556a565b60068e01805464ffffffffff191664ffffffffff8f16908117909155600b8f018b905560088f018a9055600a8f01829055604080519182526020820188905281018b9052606081018a9052608081018290529096506001600160a01b038f16907f854365e2056d048a4a9980a18729a7e79f432f9142ee48311a63d7b64e46edeb9060a00160405180910390a25050505050505050505050505050565b60008082600a01548360090154613874919061556a565b9050806138845750506005015490565b8083600801548460070154613899919061556a565b6138ab90670de0b6b3a7640000615529565b6116169190615548565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff16156138e7575050565b6001600160a01b03808216600081815260fe60209081526040808320948716808452948252808320805460ff1916600190811790915584845260ff835281842080549182018155845291832090910180546001600160a01b03191685179055519192917f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a59190a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261142b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526149a7565b6001600160a01b0381166000908152600c830160209081526040808320815180830190925280548083526001909101549282019290925290613a23576000915050611457565b6020810151600b85015482516127419190615529565b611573613c8e565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613a7457612b6d83614a79565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613ace575060408051601f3d908101601f19168201909252613acb91810190615b50565b60015b613b315760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611049565b600080516020615c788339815191528114613ba05760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611049565b50612b6d838383614b15565b610106546001600160a01b0316331461192d5760405162461bcd60e51b815260206004820152600d60248201526c10b1b7b73334b3bab930ba37b960991b6044820152606401611049565b600080613c048588614b3a565b90506000613c128588614b3a565b855490915060009061271090613c34908590600160301b900461ffff16615529565b613c3e9190615548565b90506000670de0b6b3a764000083613c558961385d565b613c5f9190615529565b613c699190615548565b905080613c768388615529565b613c809190615548565b9a9950505050505050505050565b6097546001600160a01b0316331461192d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611049565b600080600080600080600060ff6000896001600160a01b03166001600160a01b03168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015613d6c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613d4e575b5050505050905060005b8151811015613f4457600060fc6000848481518110613d9757613d97615b8f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805490915060ff16613dcc5750613f32565b6001600160a01b038a166000908152600d8201602052604081205490613df2838d6139dd565b90506000613e1984878781518110613e0c57613e0c615b8f565b6020026020010151614b3a565b845490915061ffff620100008204811691600160201b9004168415801590613e415750600082115b15613efb576000613e518761385d565b90506127106ec097ce7bc90715b34b9f10000000008486613e72858b615529565b613e7c9190615529565b613e869190615529565b613e909190615548565b613e9a9190615548565b613ea4908d61556a565b9b506127106ec097ce7bc90715b34b9f10000000008386613ec5858b615529565b613ecf9190615529565b613ed99190615529565b613ee39190615548565b613eed9190615548565b613ef7908c61556a565b9a50505b8315613f2b57670de0b6b3a7640000613f148486615529565b613f1e9190615548565b613f28908a61556a565b98505b5050505050505b80613f3c81615ba5565b915050613d76565b509297919650945092505050565b6001600160a01b0381166000908152610104602052604090205460ff1680613fd557600080613f8084613ce8565b92505091508082101561142b5760405162461bcd60e51b815260206004820152601760248201527f696e73756666696369656e7420636f6c6c61746572616c0000000000000000006044820152606401611049565b60ff811660011415611748576001600160a01b038216600090815261010460205260409020805460ff191660021790555050565b60c980546001600160a01b031916905561157381614c6e565b6000610100821061406e5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a59081cdd58881858d8dbdd5b9d081a5960521b6044820152606401611049565b501890565b8080156140a757506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff16155b15614137576001600160a01b03808416600081815261010060209081526040808320948716808452948252808320805460ff19166001908117909155848452610101835281842080549182018155845291832090910180546001600160a01b03191685179055517fa9e5a03abaf4ebb6969200baf2ad7c42a89f86f7801a1689f0ba767a6e2fd5f09190a3505050565b8015801561416b57506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff165b15612b6d576001600160a01b038084166000818152610100602090815260408083209487168352938152838220805460ff19169055918152610101909152206141b490836146da565b816001600160a01b0316836001600160a01b03167f6a87827eefdfa1b8651b66ff7c8c5b7e72436f627cd2ecd358b9eeada2e9103460405160405180910390a3505050565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a08201526000906142d990614995565b15801561145757505054600160201b900461ffff16151590565b600080600061430184613ce8565b1195945050505050565b60008061431887866139dd565b9050600019831415614328578092505b808311156143695760405162461bcd60e51b815260206004820152600e60248201526d0e4cae0c2f240e8dede40daeac6d60931b6044820152606401611049565b60006143758483615a44565b905060008489600801546143899190615a44565b6001600160a01b0388166000908152600c8b0160205260408120848155600b8c015460019091015560078b01805492935087929091906143ca90849061556a565b9091555050600889018190556001600160a01b0387166000908152600d8a0160205260409020541580156143fc575081155b1561440b5761440b86886147e9565b6144206001600160a01b038716893088613972565b60408051868152602081018490529081018290526001600160a01b03808916918a8216918916907f0afc5881e4003d86c77497d24dac378e531a0fa70f52e2b9269be723ff66ab4b9060600160405180910390a45092979650505050505050565b6001600160a01b0383166144d75760405162461bcd60e51b815260206004820152601e60248201527f7472616e736665722066726f6d20746865207a65726f206164647265737300006044820152606401611049565b6001600160a01b03821661452d5760405162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f2061646472657373000000006044820152606401611049565b6001600160a01b0383166000908152600d850160205260409020548161458c5760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c881e995c9bc8185b5bdd5b9d60621b6044820152606401611049565b818110156145dc5760405162461bcd60e51b815260206004820152601f60248201527f7472616e7366657220616d6f756e7420657863656564732062616c616e6365006044820152606401611049565b6145e686846138b5565b6001600160a01b038085166000818152600d88016020526040808220868603815593871682528120805486019055525415801561462a575061462885856139dd565b155b156146395761463986856147e9565b826001600160a01b0316846001600160a01b0316876001600160a01b03167f88d5565fe2b249a672462d9cdbcdea595ec02e1655b48e9e7920d787aa690ee88560405161468891815260200190565b60405180910390a4505050505050565b60208101516000906002161515611457565b6040516001600160a01b038316602482015260448101829052612b6d90849063a9059cbb60e01b906064016139a6565b815460005b8181101561142b57826001600160a01b031684828154811061470357614703615b8f565b6000918252602090912001546001600160a01b031614156147e157614729600183615a44565b81146147aa578361473b600184615a44565b8154811061474b5761474b615b8f565b9060005260206000200160009054906101000a90046001600160a01b031684828154811061477b5761477b615b8f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b838054806147ba576147ba615bc0565b600082815260209020810160001990810180546001600160a01b031916905501905561142b565b6001016146df565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff1661481a575050565b6001600160a01b03808216600081815260fe602090815260408083209487168352938152838220805460ff1916905591815260ff9091522061485c90836146da565b806001600160a01b0316826001600160a01b03167fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d60405160405180910390a35050565b60006501000000000042106148ed5760405162461bcd60e51b815260206004820152601360248201527274696d657374616d7020746f6f206c6172676560681b6044820152606401611049565b504290565b610108546001600160a01b0316331461192d5760405162461bcd60e51b815260206004820152600f60248201526e10b932b9b2b93b32a6b0b730b3b2b960891b6044820152606401611049565b600054610100900460ff166149665760405162461bcd60e51b815260040161104990615bd6565b61192d614cc0565b600054610100900460ff1661192d5760405162461bcd60e51b815260040161104990615bd6565b60208101516000906004161515611457565b60006149fc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cf09092919063ffffffff16565b805190915015612b6d5780806020019051810190614a1a9190615c21565b612b6d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611049565b6001600160a01b0381163b614ae65760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611049565b600080516020615c7883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614b1e83614cff565b600082511180614b2b5750805b15612b6d5761142b8383614d3f565b81546000908190600160501b900460ff16614b555782614bb7565b826001600160a01b0316639816f4736040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614bb79190615c3e565b610105546040516341976e0960e01b81526001600160a01b038084166004830152929350600092909116906341976e0990602401602060405180830381865afa158015614c08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c2c9190615b50565b9050600081116114535760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b6044820152606401611049565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16614ce75760405162461bcd60e51b815260040161104990615bd6565b61192d33614009565b60606126ea8484600085614e33565b614d0881614a79565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b614da75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611049565b600080846001600160a01b031684604051614dc29190615c5b565b600060405180830381855af49150503d8060008114614dfd576040519150601f19603f3d011682016040523d82523d6000602084013e614e02565b606091505b5091509150614e2a8282604051806060016040528060278152602001615c9860279139614f0e565b95945050505050565b606082471015614e945760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611049565b600080866001600160a01b03168587604051614eb09190615c5b565b60006040518083038185875af1925050503d8060008114614eed576040519150601f19603f3d011682016040523d82523d6000602084013e614ef2565b606091505b5091509150614f0387838387614f27565b979650505050505050565b60608315614f1d575081611616565b6116168383614f99565b60608315614f93578251614f8c576001600160a01b0385163b614f8c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611049565b50816126ea565b6126ea83835b815115614fa95781518083602001fd5b8060405162461bcd60e51b81526004016110499190615a06565b6001600160a01b038116811461157357600080fd5b8035614fe381614fc3565b919050565b60008060408385031215614ffb57600080fd5b823561500681614fc3565b9150602083013561501681614fc3565b809150509250929050565b60006020828403121561503357600080fd5b813561161681614fc3565b6000806000806080858703121561505457600080fd5b843561505f81614fc3565b9350602085013561506f81614fc3565b9250604085013561507f81614fc3565b9396929550929360600135925050565b600080604083850312156150a257600080fd5b82356150ad81614fc3565b946020939093013593505050565b6000808284036101e08112156150d057600080fd5b83356150db81614fc3565b92506101c0601f19820112156150f057600080fd5b506020830190509250929050565b60008060006060848603121561511357600080fd5b833561511e81614fc3565b9250602084013561512e81614fc3565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561516857600080fd5b823561517381614fc3565b9150602083013567ffffffffffffffff8082111561519057600080fd5b818501915085601f8301126151a457600080fd5b8135818111156151b6576151b661513f565b604051601f8201601f19908116603f011681019083821181831017156151de576151de61513f565b816040528281528860208487010111156151f757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60006020828403121561522b57600080fd5b5035919050565b805115158252602081015161524c602084018260ff169052565b506040810151615262604084018261ffff169052565b506060810151615278606084018261ffff169052565b50608081015161528e608084018261ffff169052565b5060a08101516152a460a084018261ffff169052565b5060c08101516152b860c084018215159052565b5060e08101516152cc60e084018215159052565b50610100818101516001600160a01b0390811691840191909152610120808301518216908401526101408083015190911690830152610160808201519083015261018080820151908301526101a090810151910152565b6101c081016114578284615232565b6020808252825182820181905260009190848201906040850190845b818110156153735783516001600160a01b03168352928401929184019160010161534e565b50909695505050505050565b610280810161538e828a615232565b64ffffffffff88166101c0830152866101e08301528561020083015284610220830152836102408301528261026083015298975050505050505050565b801515811461157357600080fd5b8035614fe3816153cb565b6000806000606084860312156153f957600080fd5b833561540481614fc3565b925060208401359150604084013561541b816153cb565b809150509250925092565b600080600080600060a0868803121561543e57600080fd5b853561544981614fc3565b9450602086013561545981614fc3565b9350604086013561546981614fc3565b9250606086013561547981614fc3565b949793965091946080013592915050565b6000806040838503121561549d57600080fd5b82356154a881614fc3565b91506020830135615016816153cb565b6000806000606084860312156154cd57600080fd5b83356154d881614fc3565b925060208401359150604084013561541b81614fc3565b6020808252600a90820152691b9bdd081b1a5cdd195960b21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561554357615543615513565b500290565b60008261556557634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561557d5761557d615513565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60008135611457816153cb565b60ff8116811461157357600080fd5b6000813561145781615627565b61ffff8116811461157357600080fd5b6000813561145781615643565b6000813561145781614fc3565b80546001600160a01b0319166001600160a01b0392909216919091179055565b6156ad6156998361561a565b825490151560ff1660ff1991909116178255565b6156d26156bc60208401615636565b825461ff00191660089190911b61ff0016178255565b6156fb6156e160408401615653565b825463ffff0000191660109190911b63ffff000016178255565b61572861570a60608401615653565b825465ffff00000000191660209190911b65ffff0000000016178255565b61575961573760808401615653565b825467ffff000000000000191660309190911b67ffff00000000000016178255565b61578e61576860a08401615653565b825469ffff0000000000000000191660409190911b69ffff000000000000000016178255565b6157bb61579d60c0840161561a565b82805460ff60501b191691151560501b60ff60501b16919091179055565b6157e86157ca60e0840161561a565b82805460ff60581b191691151560581b60ff60581b16919091179055565b6158226157f86101008401615660565b82546bffffffffffffffffffffffff1660609190911b6bffffffffffffffffffffffff1916178255565b61583b6158326101208401615660565b6001830161566d565b61585461584b6101408401615660565b6002830161566d565b610160820135600382015561018082013560048201556101a082013560058201555050565b8035614fe381615627565b8035614fe381615643565b6101c081016158a7826158a1856153d9565b15159052565b6158b360208401615879565b60ff1660208301526158c760408401615884565b61ffff1660408301526158dc60608401615884565b61ffff1660608301526158f160808401615884565b61ffff16608083015261590660a08401615884565b61ffff1660a083015261591b60c084016153d9565b151560c083015261592e60e084016153d9565b151560e0830152610100615943848201614fd8565b6001600160a01b03169083015261012061595e848201614fd8565b6001600160a01b031690830152610140615979848201614fd8565b6001600160a01b031690830152610160838101359083015261018080840135908301526101a092830135929091019190915290565b60005b838110156159c95781810151838201526020016159b1565b8381111561142b5750506000910152565b600081518084526159f28160208601602086016159ae565b601f01601f19169290920160200192915050565b60208152600061161660208301846159da565b6020808252601190820152700d2dce6eaccccd2c6d2cadce840c6c2e6d607b1b604082015260600190565b600082821015615a5657615a56615513565b500390565b64ffffffffff83168152815460ff8116151560208301526101e0820190600881901c60ff16604084015261ffff601082901c81166060850152615aa960808501828460201c1661ffff169052565b615abe60a08501828460301c1661ffff169052565b615ad360c08501828460401c1661ffff169052565b50615ae860e0840160ff8360501c1615159052565b615afd610100840160ff8360581c1615159052565b60601c61012083015260018301546001600160a01b03908116610140840152600284015416610160830152600383015461018083015260048301546101a08301526005909201546101c090910152919050565b600060208284031215615b6257600080fd5b5051919050565b600064ffffffffff83811690831681811015615b8757615b87615513565b039392505050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415615bb957615bb9615513565b5060010190565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215615c3357600080fd5b8151611616816153cb565b600060208284031215615c5057600080fd5b815161161681614fc3565b60008251615c6d8184602087016159ae565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b07b920a098d0a53aab87320563987be44aad113efeaec1037e80bc687b36c1664736f6c634300080a0033
Deployed Bytecode
0x6080604052600436106103c35760003560e01c80638e8f294b116101f2578063c2a544811161010d578063df7da754116100a0578063efb7601d1161006f578063efb7601d14610f7d578063f2fde38b14610f9d578063fcc0c68014610fbd578063fe1e50a314610fdd57600080fd5b8063df7da75414610eff578063dfd5265b14610f1f578063e1fb436814610f3f578063e30c397814610f5f57600080fd5b8063cdb66f7c116100dc578063cdb66f7c14610e7f578063d1456d4f14610e9f578063d49f8be014610ebf578063d82ecc4814610edf57600080fd5b8063c2a5448114610dff578063c2cc27a614610e1f578063c4109c0114610e3f578063c4d66de814610e5f57600080fd5b8063b666d84b11610185578063bc15830d11610154578063bc15830d14610d8a578063be88ea3214610daa578063c00d370914610dca578063c035bd2114610ddf57600080fd5b8063b666d84b14610d09578063ba036b4014610d29578063ba37773114610d49578063bb004abc14610d6957600080fd5b80639f9f794f116101c15780639f9f794f14610c7f578063a928fe1014610c9f578063afef7efd14610cd4578063b0772d0b14610cf457600080fd5b80638e8f294b14610abb5780639198e51514610c055780639414efc714610c255780639b990d7214610c4657600080fd5b806352d1902d116102e25780636e646847116102755780638538d14e116102445780638538d14e14610a0157806389b7b7a614610a3a5780638b4f33ee14610a5a5780638da5cb5b14610a9d57600080fd5b80636e6468471461097b578063715018a61461099b57806379ba5097146109b05780637e982c4b146109c557600080fd5b80635db22de6116102b15780635db22de6146108935780635ec88c79146108da57806368da10ae146109155780636da825841461094e57600080fd5b806352d1902d146106b557806352d84d1e146106ca578063530e784f146106ea5780635a208d521461070a57600080fd5b80633659cfe61161035a5780634492ba9e116103295780634492ba9e146105fd5780634ac51189146106475780634e05cbb3146106675780634f1ef286146106a257600080fd5b80633659cfe6146105545780633a1181d9146105745780633d98a1e51461059457806341d15f6d146105dd57600080fd5b8063178de7eb11610396578063178de7eb1461048f5780631a7370cc146104c8578063203660df146104e85780632630c12f1461053357600080fd5b80630445254d146103c8578063050e570514610414578063107c8ed71461044d578063118e31b71461046f575b600080fd5b3480156103d457600080fd5b506104016103e3366004614fe8565b61010260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b34801561042057600080fd5b5061040161042f366004615021565b6001600160a01b0316600090815260fc60205260409020600a015490565b34801561045957600080fd5b5061046d61046836600461503e565b610ffd565b005b34801561047b57600080fd5b5061040161048a366004614fe8565b611431565b34801561049b57600080fd5b50610107546104b0906001600160a01b031681565b6040516001600160a01b03909116815260200161040b565b3480156104d457600080fd5b506104b06104e336600461508f565b61145d565b3480156104f457600080fd5b50610401610503366004614fe8565b6001600160a01b03808216600090815260fc602090815260408083209386168352600d9093019052205492915050565b34801561053f57600080fd5b50610105546104b0906001600160a01b031681565b34801561056057600080fd5b5061046d61056f366004615021565b611496565b34801561058057600080fd5b5061046d61058f3660046150bb565b611576565b3480156105a057600080fd5b506105cd6105af366004615021565b6001600160a01b0316600090815260fc602052604090205460ff1690565b604051901515815260200161040b565b3480156105e957600080fd5b506104016105f83660046150fe565b6115eb565b34801561060957600080fd5b506105cd610618366004614fe8565b6001600160a01b0391821660009081526101006020908152604080832093909416825291909152205460ff1690565b34801561065357600080fd5b5061046d610662366004615021565b61161d565b34801561067357600080fd5b506105cd610682366004614fe8565b60fe60209081526000928352604080842090915290825290205460ff1681565b61046d6106b0366004615155565b61167b565b3480156106c157600080fd5b5061040161174c565b3480156106d657600080fd5b506104b06106e5366004615219565b6117ff565b3480156106f657600080fd5b5061046d610705366004615021565b611829565b34801561071657600080fd5b50610886610725366004615021565b604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a0810191909152506001600160a01b03908116600090815260fc602090815260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955261ffff620100008304811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b909304841691830191909152600181015483166101208301526002810154909216610140820152600382015461016082015260048201546101808201526005909101546101a082015290565b60405161040b9190615323565b34801561089f57600080fd5b506104016108ae366004614fe8565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205490565b3480156108e657600080fd5b506108fa6108f5366004615021565b611880565b6040805193845260208401929092529082015260600161040b565b34801561092157600080fd5b50610401610930366004615021565b6001600160a01b0316600090815260fc602052604090206009015490565b34801561095a57600080fd5b5061096e610969366004615021565b61189b565b60405161040b9190615332565b34801561098757600080fd5b5061046d610996366004615021565b611912565b3480156109a757600080fd5b5061046d61191b565b3480156109bc57600080fd5b5061046d61192f565b3480156109d157600080fd5b506105cd6109e0366004614fe8565b61010060209081526000928352604080842090915290825290205460ff1681565b348015610a0d57600080fd5b50610401610a1c366004615021565b6001600160a01b0316600090815260fc602052604090206008015490565b348015610a4657600080fd5b5061046d610a55366004615155565b6119a6565b348015610a6657600080fd5b50610a8b610a75366004615021565b6101046020526000908152604090205460ff1681565b60405160ff909116815260200161040b565b348015610aa957600080fd5b506097546001600160a01b03166104b0565b348015610ac757600080fd5b50610bf2610ad6366004615021565b60fc6020908152600091825260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955262010000820461ffff90811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b9093046001600160a01b03908116928401929092526001810154821661012084015260028101549091166101408301526003810154610160830152600481015461018083015260058101546101a08301526006810154600782015460088301546009840154600a850154600b9095015464ffffffffff9094169492939192909187565b60405161040b979695949392919061537f565b348015610c1157600080fd5b5061046d610c20366004615021565b611b36565b348015610c3157600080fd5b50610106546104b0906001600160a01b031681565b348015610c5257600080fd5b50610401610c61366004615021565b6001600160a01b0316600090815260fc602052604090206007015490565b348015610c8b57600080fd5b5061046d610c9a3660046153e4565b611b79565b348015610cab57600080fd5b50610cbf610cba366004615426565b611bad565b6040805192835260208301919091520161040b565b348015610ce057600080fd5b5061046d610cef36600461503e565b611f26565b348015610d0057600080fd5b5061096e61230d565b348015610d1557600080fd5b5061046d610d24366004615021565b61236f565b348015610d3557600080fd5b50610401610d4436600461503e565b6123eb565b348015610d5557600080fd5b50610401610d64366004614fe8565b6126f2565b348015610d7557600080fd5b50610108546104b0906001600160a01b031681565b348015610d9657600080fd5b5061046d610da536600461548a565b61274b565b348015610db657600080fd5b506104b0610dc536600461508f565b612756565b348015610dd657600080fd5b5061046d612773565b348015610deb57600080fd5b50610401610dfa36600461503e565b6127c3565b348015610e0b57600080fd5b5061046d610e1a366004615021565b6128b6565b348015610e2b57600080fd5b5061046d610e3a3660046150bb565b61290d565b348015610e4b57600080fd5b5061046d610e5a366004615021565b6129fc565b348015610e6b57600080fd5b5061046d610e7a366004615021565b612b72565b348015610e8b57600080fd5b5061096e610e9a366004615021565b612c94565b348015610eab57600080fd5b5061046d610eba3660046154b8565b612d09565b348015610ecb57600080fd5b506104b0610eda36600461508f565b612e75565b348015610eeb57600080fd5b506105cd610efa366004615021565b612e91565b348015610f0b57600080fd5b5061046d610f1a366004615021565b612eaf565b348015610f2b57600080fd5b5061046d610f3a36600461503e565b612f06565b348015610f4b57600080fd5b506105cd610f5a366004615021565b613182565b348015610f6b57600080fd5b5060c9546001600160a01b03166104b0565b348015610f8957600080fd5b50610401610f98366004615021565b61318d565b348015610fa957600080fd5b5061046d610fb8366004615021565b6131ae565b348015610fc957600080fd5b5061046d610fd8366004614fe8565b61321f565b348015610fe957600080fd5b5061046d610ff83660046150fe565b61336b565b61100561351c565b836110108133613576565b6001600160a01b038316600090815260fc60205260409020805460ff166110525760405162461bcd60e51b8152600401611049906154ef565b60405180910390fd5b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261112f90613607565b1561116c5760405162461bcd60e51b815260206004820152600d60248201526c1cdd5c1c1b1e481c185d5cd959609a1b6044820152606401611049565b61117585612e91565b156111c25760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f7420737570706c7920746f20637265646974206163636f756e74006044820152606401611049565b6111cc8482613619565b60038101541561125a576000670de0b6b3a76400006111ea8361385d565b83600901546111f99190615529565b6112039190615548565b6003830154909150611215858361556a565b11156112585760405162461bcd60e51b81526020600482015260126024820152711cdd5c1c1b1e4818d85c081c995858da195960721b6044820152606401611049565b505b60006112658261385d565b61127785670de0b6b3a7640000615529565b6112819190615548565b9050600081116112c85760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611049565b838260070160008282546112dc919061556a565b92505081905550808260090160008282546112f7919061556a565b90915550506001600160a01b0386166000908152600d830160205260408120805483929061132690849061556a565b9091555050831561133b5761133b85876138b5565b81546040516340c10f1960e01b81526001600160a01b03888116600483015260248201849052600160601b909204909116906340c10f1990604401600060405180830381600087803b15801561139057600080fd5b505af11580156113a4573d6000803e3d6000fd5b506113be925050506001600160a01b038616883087613972565b856001600160a01b0316876001600160a01b0316866001600160a01b03167fe751baae971614714a5055ecbc0892f68c0e2d70c56550cb65a76bc840fa5f6e8785604051611416929190918252602082015260400190565b60405180910390a450505061142b600160fb55565b50505050565b6001600160a01b038116600090815260fc6020526040812061145381856139dd565b9150505b92915050565b610101602052816000526040600020818154811061147a57600080fd5b6000918252602090912001546001600160a01b03169150829050565b306001600160a01b037f0000000000000000000000008179e2d1e4feea11ceb50119242ae96b3b23f1de1614156114df5760405162461bcd60e51b815260040161104990615582565b7f0000000000000000000000008179e2d1e4feea11ceb50119242ae96b3b23f1de6001600160a01b0316611528600080516020615c78833981519152546001600160a01b031690565b6001600160a01b03161461154e5760405162461bcd60e51b8152600401611049906155ce565b61155781613a39565b6040805160008082526020820190925261157391839190613a41565b50565b61157e613bac565b6001600160a01b038216600090815260fc6020526040902081816115a2828261568d565b905050826001600160a01b03167fdcd3ac9b517302fa7d6db6d2ae9265b3d65ccc4d3030130620d7a1701b74b2a4836040516115de919061588f565b60405180910390a2505050565b6001600160a01b038216600090815260fc60205260408120806116118686838088613bf7565b925050505b9392505050565b611625613c8e565b61010680546001600160a01b0319166001600160a01b0383169081179091556040519081527fdca89ce6f30fe0a23d88a5467a028ce35ba1b7b5b8d9e9e50dbc151fe55c82ad906020015b60405180910390a150565b306001600160a01b037f0000000000000000000000008179e2d1e4feea11ceb50119242ae96b3b23f1de1614156116c45760405162461bcd60e51b815260040161104990615582565b7f0000000000000000000000008179e2d1e4feea11ceb50119242ae96b3b23f1de6001600160a01b031661170d600080516020615c78833981519152546001600160a01b031690565b6001600160a01b0316146117335760405162461bcd60e51b8152600401611049906155ce565b61173c82613a39565b61174882826001613a41565b5050565b6000306001600160a01b037f0000000000000000000000008179e2d1e4feea11ceb50119242ae96b3b23f1de16146117ec5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611049565b50600080516020615c7883398151915290565b60fd818154811061180f57600080fd5b6000918252602090912001546001600160a01b0316905081565b611831613c8e565b61010580546001600160a01b0319166001600160a01b0383169081179091556040519081527f6536690106168bdf4ba72c128a053d817999b1db90cae23f139b293bf862cb7590602001611670565b600080600061188e84613ce8565b9250925092509193909250565b6001600160a01b0381166000908152610103602090815260409182902080548351818402810184019094528084526060939283018282801561190657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116118e8575b50505050509050919050565b61157381613f52565b611923613c8e565b61192d6000614009565b565b60c95433906001600160a01b0316811461199d5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401611049565b61157381614009565b816119b18133613576565b6119ba83612e91565b15611a1b5760405162461bcd60e51b815260206004820152602b60248201527f637265646974206163636f756e742063616e6e6f74206465666572206c69717560448201526a696469747920636865636b60a81b6064820152608401611049565b6001600160a01b0383166000908152610104602052604090205460ff1615611a855760405162461bcd60e51b815260206004820152601d60248201527f7265656e747279206465666572206c697175696469747920636865636b0000006044820152606401611049565b6001600160a01b0383166000908152610104602052604090819020805460ff191660011790555163a15db5c560e01b8152339063a15db5c590611acc908590600401615a06565b600060405180830381600087803b158015611ae657600080fd5b505af1158015611afa573d6000803e3d6000fd5b505050506001600160a01b038316600090815261010460205260409020805460ff19811690915560ff16600281141561142b5761142b84613f52565b6001600160a01b038116600090815260fc60205260409020805460ff16611b6f5760405162461bcd60e51b8152600401611049906154ef565b6117488282613619565b82611b848133613576565b6000611b996001600160a01b03861685614022565b9050611ba6813385614073565b5050505050565b600080611bb861351c565b86611bc38133613576565b6001600160a01b03808716600090815260fc602052604080822092881682529020815460ff16611c355760405162461bcd60e51b815260206004820152601860248201527f626f72726f77206d61726b6574206e6f74206c697374656400000000000000006044820152606401611049565b805460ff16611c865760405162461bcd60e51b815260206004820152601c60248201527f636f6c6c61746572616c206d61726b6574206e6f74206c6973746564000000006044820152606401611049565b611c8f816141f9565b611ce65760405162461bcd60e51b815260206004820152602260248201527f636f6c6c61746572616c206d61726b65742063616e6e6f74206265207365697a604482015261195960f21b6064820152608401611049565b611cef8a612e91565b158015611d025750611d0089612e91565b155b611d4e5760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f74206c697175696461746520637265646974206163636f756e74006044820152606401611049565b886001600160a01b03168a6001600160a01b03161415611da85760405162461bcd60e51b815260206004820152601560248201527463616e6e6f742073656c66206c697175696461746560581b6044820152606401611049565b611db28883613619565b611dbc8782613619565b611dc5896142f3565b611e115760405162461bcd60e51b815260206004820152601960248201527f626f72726f776572206e6f74206c6971756964617461626c65000000000000006044820152606401611049565b611e1e828b8b8b8a61430b565b95506000611e2f898985858b613bf7565b9050611e3e88838c8e85614481565b815460405163b2a02ff160e01b81526001600160a01b038c811660048301528d8116602483015260448201849052600160601b9092049091169063b2a02ff190606401600060405180830381600087803b158015611e9b57600080fd5b505af1158015611eaf573d6000803e3d6000fd5b5050604080516001600160a01b038c81168252602082018c9052918101859052818d1693508d82169250908e16907fac8bbd8fb7420b3123cf9e24d34551e40514ea69c5a1e97c10e513aaf06e7e429060600160405180910390a48695509350505050611f1c600160fb55565b9550959350505050565b611f2e61351c565b83611f398133613576565b6001600160a01b038316600090815260fc60205260409020805460ff16611f725760405162461bcd60e51b8152600401611049906154ef565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261204f90614698565b1561208c5760405162461bcd60e51b815260206004820152600d60248201526c189bdc9c9bddc81c185d5cd959609a1b6044820152606401611049565b82816007015410156120b05760405162461bcd60e51b815260040161104990615a19565b6120ba8482613619565b60008382600801546120cc919061556a565b90506000846120db848a6139dd565b6120e5919061556a565b60048401549091501561213b57600483015482111561213b5760405162461bcd60e51b8152602060048201526012602482015271189bdc9c9bddc818d85c081c995858da195960721b6044820152606401611049565b8483600701600082825461214f9190615a44565b9091555050600883018290556001600160a01b0388166000908152600c840160205260409020818155600b84015460019091015584156121935761219386896138b5565b6121a76001600160a01b03871688876146aa565b6121b088612e91565b156122a257866001600160a01b0316886001600160a01b0316146122275760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920626f72726f772074604482015267379034ba39b2b63360c11b6064820152608401611049565b6001600160a01b03808916600090815261010260209081526040808320938a168352929052205481111561229d5760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e7420637265646974206c696d6974000000000000006044820152606401611049565b6122ab565b6122ab88613f52565b60408051868152602081018390529081018390526001600160a01b03808916918a8216918916907f4bc4b08d677fc59195d56e346dcb5cc5dc3b78b90d59f5d36740ae1b3d225db89060600160405180910390a45050505061142b600160fb55565b606060fd80548060200260200160405190810160405280929190818152602001828054801561236557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612347575b5050505050905090565b612377613bac565b6001600160a01b038116600090815260fc6020526040902080546bff00000000000000000000ff1916600160581b1781556123b360fd836146da565b6040516001600160a01b038316907f9710c341258431a6380fd1febe8985e6b6221e8398c287ea971f2ba85a6e1a1090600090a25050565b60006123f561351c565b846124008133613576565b6001600160a01b038416600090815260fc60205260409020805460ff166124395760405162461bcd60e51b8152600401611049906154ef565b6124438582613619565b6001600160a01b0387166000908152600d820160205260408120546007830154909160001987141561249e575081670de0b6b3a76400006124838561385d565b61248d9083615529565b6124979190615548565b96506124c6565b6124a78461385d565b6124b988670de0b6b3a7640000615529565b6124c39190615548565b90505b6000811161250b5760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611049565b808310156125525760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401611049565b868210156125725760405162461bcd60e51b815260040161104990615a19565b600061257e8285615a44565b6001600160a01b038c166000908152600d87016020526040902081905590506125a78884615a44565b8560070181905550818560090160008282546125c39190615a44565b9091555050801580156125dd57506125db858c6139dd565b155b156125ec576125ec898c6147e9565b8454604051632770a7eb60e21b81526001600160a01b038d8116600483015260248201859052600160601b90920490911690639dc29fac90604401600060405180830381600087803b15801561264157600080fd5b505af1158015612655573d6000803e3d6000fd5b5061266e925050506001600160a01b038a168b8a6146aa565b6126778b613f52565b896001600160a01b03168b6001600160a01b03168a6001600160a01b03167faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c8b866040516126cf929190918252602082015260400190565b60405180910390a48796505050505050506126ea600160fb55565b949350505050565b6001600160a01b038116600090815260fc60205260408120670de0b6b3a764000061271c8261385d565b6001600160a01b0386166000908152600d840160205260409020546127419190615529565b6114539190615548565b611748338383614073565b610103602052816000526040600020818154811061147a57600080fd5b60656001600160a01b0316637114177a6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156127af57600080fd5b505af115801561142b573d6000803e3d6000fd5b60006127cd61351c565b846127d88133613576565b6001600160a01b038416600090815260fc60205260409020805460ff166128115760405162461bcd60e51b8152600401611049906154ef565b61281a86612e91565b1561289157856001600160a01b0316876001600160a01b0316146128915760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920726570617920666f604482015267391034ba39b2b63360c11b6064820152608401611049565b61289b8582613619565b6128a8818888888861430b565b925050506126ea600160fb55565b6128be613c8e565b61010780546001600160a01b0319166001600160a01b0383169081179091556040519081527f517371384ca8a07b7ae4697507862b5200ce0a12158170259cebe2cb63d33f3290602001611670565b612915613bac565b6001600160a01b038216600090815260fc602052604090206129356148a0565b60068201805464ffffffffff191664ffffffffff92909216919091179055670de0b6b3a7640000600b820155818161296d828261568d565b505060fd80546001810182556000919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800180546001600160a01b0319166001600160a01b03851690811790915560068201546040517fbefee0150f4933331fcee3972b8a74be870d590ef30e21f8830c9b2a9d04c987916115de9164ffffffffff909116908590615a5b565b612a046148f2565b6001600160a01b038116600090815260fc60205260409020805460ff16612a3d5760405162461bcd60e51b8152600401611049906154ef565b612a478282613619565b60078101546040516370a0823160e01b8152306004820152600091906001600160a01b038516906370a0823190602401602060405180830381865afa158015612a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab89190615b50565b612ac29190615a44565b90508015612b6d576000612ad58361385d565b612ae783670de0b6b3a7640000615529565b612af19190615548565b905081836007016000828254612b07919061556a565b925050819055508083600a016000828254612b22919061556a565b909155505060408051828152602081018490526001600160a01b038616917fe08e52dead7793dd3e1f1b8c081a9d196fb9a1f26939c240e3660e9badd466b3910160405180910390a2505b505050565b600054610100900460ff1615808015612b925750600054600160ff909116105b80612bac5750303b158015612bac575060005460ff166001145b612c0f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611049565b6000805460ff191660011790558015612c32576000805461ff0019166101001790555b612c3a61493f565b612c4261496e565b612c4b826131ae565b8015611748576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6001600160a01b03811660009081526101016020908152604091829020805483518184028101840190945280845260609392830182828015611906576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116118e85750505050509050919050565b612d116148f2565b6001600160a01b038316600090815260fc60205260409020805460ff16612d4a5760405162461bcd60e51b8152600401611049906154ef565b612d548482613619565b6000670de0b6b3a7640000612d688361385d565b612d729086615529565b612d7c9190615548565b90508082600701541015612da25760405162461bcd60e51b815260040161104990615a19565b8382600a01541015612dee5760405162461bcd60e51b8152602060048201526015602482015274696e73756666696369656e7420726573657276657360581b6044820152606401611049565b6007820180548290039055600a820180548590039055612e186001600160a01b03861684836146aa565b826001600160a01b0316856001600160a01b03167f85d7d5527903b3bdc93c2e97283c443822adba607371569d40047426532c9c388684604051612e66929190918252602082015260400190565b60405180910390a35050505050565b60ff602052816000526040600020818154811061147a57600080fd5b6001600160a01b031660009081526101036020526040902054151590565b612eb7613c8e565b61010880546001600160a01b0319166001600160a01b0383169081179091556040519081527f7e84f9bb34064cde550792818395eb9c2f7766113ce1c301d35c19cbe2e187ac90602001611670565b6001600160a01b038416600090815260fc60205260409020805460ff16612f3f5760405162461bcd60e51b8152600401611049906154ef565b8054600160601b90046001600160a01b03163314612f8d5760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611049565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261306a90614995565b156130a95760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c881c185d5cd959608a1b6044820152606401611049565b826001600160a01b0316846001600160a01b031614156131025760405162461bcd60e51b815260206004820152601460248201527331b0b73737ba1039b2b633103a3930b739b332b960611b6044820152606401611049565b61310b83612e91565b156131625760405162461bcd60e51b815260206004820152602160248201527f63616e6e6f74207472616e7366657220746f20637265646974206163636f756e6044820152601d60fa1b6064820152608401611049565b61316c8582613619565b6131798582868686614481565b611ba684613f52565b6000611457826142f3565b6001600160a01b038116600090815260fc602052604081206116168161385d565b6131b6613c8e565b60c980546001600160a01b0383166001600160a01b031990911681179091556131e76097546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b613227613c8e565b6001600160a01b038216600090815260fc60205260409020805460ff16156132915760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f74207365697a65206c6973746564206d61726b65740000000000006044820152606401611049565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156132d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132fc9190615b50565b9050801561142b576133186001600160a01b03851684836146aa565b826001600160a01b0316846001600160a01b03167feac344312e08a6e34d3cb14733c432e8b20995a316e9abf4bc59640dc90d10ca8360405161335d91815260200190565b60405180910390a350505050565b610107546001600160a01b031633146133b15760405162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b6044820152606401611049565b6001600160a01b038216600090815260fc60205260409020805460ff166133ea5760405162461bcd60e51b8152600401611049906154ef565b8115801561341d57506001600160a01b038085166000908152610102602090815260408083209387168352929052205415155b1561344a576001600160a01b03841660009081526101036020526040902061344590846146da565b6134c2565b811580159061347d57506001600160a01b0380851660009081526101026020908152604080832093871683529290522054155b156134c2576001600160a01b038481166000908152610103602090815260408220805460018101825590835291200180546001600160a01b0319169185169190911790555b6001600160a01b038481166000818152610102602090815260408083209488168084529482529182902086905590518581527fd2430896b2083037d8bf873ee97e05de0442c7137b4c9413b9e928f7212869e9910161335d565b600260fb54141561356f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611049565b600260fb55565b806001600160a01b0316826001600160a01b031614806135cd575061359a82612e91565b1580156135cd57506001600160a01b038083166000908152610100602090815260408083209385168352929052205460ff165b6117485760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611049565b60208101516000906001161515611457565b60006136236148a0565b600683015490915060009061363f9064ffffffffff1683615b69565b64ffffffffff169050801561142b576007830154600b84015460088501546009860154600a87015460028801546040516329737ea560e21b815260048101879052602481018590526000916001600160a01b03169063a5cdfa9490604401602060405180830381865afa1580156136ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136de9190615b50565b905060006136ec8883615529565b90506000670de0b6b3a76400006137038784615529565b61370d9190615548565b8b549091506000906127109061372e90600160401b900461ffff1684615529565b6137389190615548565b9050600081156137815761374c8284615a44565b613756898c61556a565b613760919061556a565b61376a878961556a565b6137749084615529565b61377e9190615548565b90505b670de0b6b3a76400006137948a86615529565b61379e9190615548565b6137a8908a61556a565b98506137b4838961556a565b97506137c0818761556a565b60068e01805464ffffffffff191664ffffffffff8f16908117909155600b8f018b905560088f018a9055600a8f01829055604080519182526020820188905281018b9052606081018a9052608081018290529096506001600160a01b038f16907f854365e2056d048a4a9980a18729a7e79f432f9142ee48311a63d7b64e46edeb9060a00160405180910390a25050505050505050505050505050565b60008082600a01548360090154613874919061556a565b9050806138845750506005015490565b8083600801548460070154613899919061556a565b6138ab90670de0b6b3a7640000615529565b6116169190615548565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff16156138e7575050565b6001600160a01b03808216600081815260fe60209081526040808320948716808452948252808320805460ff1916600190811790915584845260ff835281842080549182018155845291832090910180546001600160a01b03191685179055519192917f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a59190a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261142b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526149a7565b6001600160a01b0381166000908152600c830160209081526040808320815180830190925280548083526001909101549282019290925290613a23576000915050611457565b6020810151600b85015482516127419190615529565b611573613c8e565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613a7457612b6d83614a79565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613ace575060408051601f3d908101601f19168201909252613acb91810190615b50565b60015b613b315760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611049565b600080516020615c788339815191528114613ba05760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611049565b50612b6d838383614b15565b610106546001600160a01b0316331461192d5760405162461bcd60e51b815260206004820152600d60248201526c10b1b7b73334b3bab930ba37b960991b6044820152606401611049565b600080613c048588614b3a565b90506000613c128588614b3a565b855490915060009061271090613c34908590600160301b900461ffff16615529565b613c3e9190615548565b90506000670de0b6b3a764000083613c558961385d565b613c5f9190615529565b613c699190615548565b905080613c768388615529565b613c809190615548565b9a9950505050505050505050565b6097546001600160a01b0316331461192d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611049565b600080600080600080600060ff6000896001600160a01b03166001600160a01b03168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015613d6c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613d4e575b5050505050905060005b8151811015613f4457600060fc6000848481518110613d9757613d97615b8f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805490915060ff16613dcc5750613f32565b6001600160a01b038a166000908152600d8201602052604081205490613df2838d6139dd565b90506000613e1984878781518110613e0c57613e0c615b8f565b6020026020010151614b3a565b845490915061ffff620100008204811691600160201b9004168415801590613e415750600082115b15613efb576000613e518761385d565b90506127106ec097ce7bc90715b34b9f10000000008486613e72858b615529565b613e7c9190615529565b613e869190615529565b613e909190615548565b613e9a9190615548565b613ea4908d61556a565b9b506127106ec097ce7bc90715b34b9f10000000008386613ec5858b615529565b613ecf9190615529565b613ed99190615529565b613ee39190615548565b613eed9190615548565b613ef7908c61556a565b9a50505b8315613f2b57670de0b6b3a7640000613f148486615529565b613f1e9190615548565b613f28908a61556a565b98505b5050505050505b80613f3c81615ba5565b915050613d76565b509297919650945092505050565b6001600160a01b0381166000908152610104602052604090205460ff1680613fd557600080613f8084613ce8565b92505091508082101561142b5760405162461bcd60e51b815260206004820152601760248201527f696e73756666696369656e7420636f6c6c61746572616c0000000000000000006044820152606401611049565b60ff811660011415611748576001600160a01b038216600090815261010460205260409020805460ff191660021790555050565b60c980546001600160a01b031916905561157381614c6e565b6000610100821061406e5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a59081cdd58881858d8dbdd5b9d081a5960521b6044820152606401611049565b501890565b8080156140a757506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff16155b15614137576001600160a01b03808416600081815261010060209081526040808320948716808452948252808320805460ff19166001908117909155848452610101835281842080549182018155845291832090910180546001600160a01b03191685179055517fa9e5a03abaf4ebb6969200baf2ad7c42a89f86f7801a1689f0ba767a6e2fd5f09190a3505050565b8015801561416b57506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff165b15612b6d576001600160a01b038084166000818152610100602090815260408083209487168352938152838220805460ff19169055918152610101909152206141b490836146da565b816001600160a01b0316836001600160a01b03167f6a87827eefdfa1b8651b66ff7c8c5b7e72436f627cd2ecd358b9eeada2e9103460405160405180910390a3505050565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a08201526000906142d990614995565b15801561145757505054600160201b900461ffff16151590565b600080600061430184613ce8565b1195945050505050565b60008061431887866139dd565b9050600019831415614328578092505b808311156143695760405162461bcd60e51b815260206004820152600e60248201526d0e4cae0c2f240e8dede40daeac6d60931b6044820152606401611049565b60006143758483615a44565b905060008489600801546143899190615a44565b6001600160a01b0388166000908152600c8b0160205260408120848155600b8c015460019091015560078b01805492935087929091906143ca90849061556a565b9091555050600889018190556001600160a01b0387166000908152600d8a0160205260409020541580156143fc575081155b1561440b5761440b86886147e9565b6144206001600160a01b038716893088613972565b60408051868152602081018490529081018290526001600160a01b03808916918a8216918916907f0afc5881e4003d86c77497d24dac378e531a0fa70f52e2b9269be723ff66ab4b9060600160405180910390a45092979650505050505050565b6001600160a01b0383166144d75760405162461bcd60e51b815260206004820152601e60248201527f7472616e736665722066726f6d20746865207a65726f206164647265737300006044820152606401611049565b6001600160a01b03821661452d5760405162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f2061646472657373000000006044820152606401611049565b6001600160a01b0383166000908152600d850160205260409020548161458c5760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c881e995c9bc8185b5bdd5b9d60621b6044820152606401611049565b818110156145dc5760405162461bcd60e51b815260206004820152601f60248201527f7472616e7366657220616d6f756e7420657863656564732062616c616e6365006044820152606401611049565b6145e686846138b5565b6001600160a01b038085166000818152600d88016020526040808220868603815593871682528120805486019055525415801561462a575061462885856139dd565b155b156146395761463986856147e9565b826001600160a01b0316846001600160a01b0316876001600160a01b03167f88d5565fe2b249a672462d9cdbcdea595ec02e1655b48e9e7920d787aa690ee88560405161468891815260200190565b60405180910390a4505050505050565b60208101516000906002161515611457565b6040516001600160a01b038316602482015260448101829052612b6d90849063a9059cbb60e01b906064016139a6565b815460005b8181101561142b57826001600160a01b031684828154811061470357614703615b8f565b6000918252602090912001546001600160a01b031614156147e157614729600183615a44565b81146147aa578361473b600184615a44565b8154811061474b5761474b615b8f565b9060005260206000200160009054906101000a90046001600160a01b031684828154811061477b5761477b615b8f565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b838054806147ba576147ba615bc0565b600082815260209020810160001990810180546001600160a01b031916905501905561142b565b6001016146df565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff1661481a575050565b6001600160a01b03808216600081815260fe602090815260408083209487168352938152838220805460ff1916905591815260ff9091522061485c90836146da565b806001600160a01b0316826001600160a01b03167fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d60405160405180910390a35050565b60006501000000000042106148ed5760405162461bcd60e51b815260206004820152601360248201527274696d657374616d7020746f6f206c6172676560681b6044820152606401611049565b504290565b610108546001600160a01b0316331461192d5760405162461bcd60e51b815260206004820152600f60248201526e10b932b9b2b93b32a6b0b730b3b2b960891b6044820152606401611049565b600054610100900460ff166149665760405162461bcd60e51b815260040161104990615bd6565b61192d614cc0565b600054610100900460ff1661192d5760405162461bcd60e51b815260040161104990615bd6565b60208101516000906004161515611457565b60006149fc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614cf09092919063ffffffff16565b805190915015612b6d5780806020019051810190614a1a9190615c21565b612b6d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611049565b6001600160a01b0381163b614ae65760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611049565b600080516020615c7883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614b1e83614cff565b600082511180614b2b5750805b15612b6d5761142b8383614d3f565b81546000908190600160501b900460ff16614b555782614bb7565b826001600160a01b0316639816f4736040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614bb79190615c3e565b610105546040516341976e0960e01b81526001600160a01b038084166004830152929350600092909116906341976e0990602401602060405180830381865afa158015614c08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c2c9190615b50565b9050600081116114535760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b6044820152606401611049565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16614ce75760405162461bcd60e51b815260040161104990615bd6565b61192d33614009565b60606126ea8484600085614e33565b614d0881614a79565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b614da75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611049565b600080846001600160a01b031684604051614dc29190615c5b565b600060405180830381855af49150503d8060008114614dfd576040519150601f19603f3d011682016040523d82523d6000602084013e614e02565b606091505b5091509150614e2a8282604051806060016040528060278152602001615c9860279139614f0e565b95945050505050565b606082471015614e945760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611049565b600080866001600160a01b03168587604051614eb09190615c5b565b60006040518083038185875af1925050503d8060008114614eed576040519150601f19603f3d011682016040523d82523d6000602084013e614ef2565b606091505b5091509150614f0387838387614f27565b979650505050505050565b60608315614f1d575081611616565b6116168383614f99565b60608315614f93578251614f8c576001600160a01b0385163b614f8c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611049565b50816126ea565b6126ea83835b815115614fa95781518083602001fd5b8060405162461bcd60e51b81526004016110499190615a06565b6001600160a01b038116811461157357600080fd5b8035614fe381614fc3565b919050565b60008060408385031215614ffb57600080fd5b823561500681614fc3565b9150602083013561501681614fc3565b809150509250929050565b60006020828403121561503357600080fd5b813561161681614fc3565b6000806000806080858703121561505457600080fd5b843561505f81614fc3565b9350602085013561506f81614fc3565b9250604085013561507f81614fc3565b9396929550929360600135925050565b600080604083850312156150a257600080fd5b82356150ad81614fc3565b946020939093013593505050565b6000808284036101e08112156150d057600080fd5b83356150db81614fc3565b92506101c0601f19820112156150f057600080fd5b506020830190509250929050565b60008060006060848603121561511357600080fd5b833561511e81614fc3565b9250602084013561512e81614fc3565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561516857600080fd5b823561517381614fc3565b9150602083013567ffffffffffffffff8082111561519057600080fd5b818501915085601f8301126151a457600080fd5b8135818111156151b6576151b661513f565b604051601f8201601f19908116603f011681019083821181831017156151de576151de61513f565b816040528281528860208487010111156151f757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60006020828403121561522b57600080fd5b5035919050565b805115158252602081015161524c602084018260ff169052565b506040810151615262604084018261ffff169052565b506060810151615278606084018261ffff169052565b50608081015161528e608084018261ffff169052565b5060a08101516152a460a084018261ffff169052565b5060c08101516152b860c084018215159052565b5060e08101516152cc60e084018215159052565b50610100818101516001600160a01b0390811691840191909152610120808301518216908401526101408083015190911690830152610160808201519083015261018080820151908301526101a090810151910152565b6101c081016114578284615232565b6020808252825182820181905260009190848201906040850190845b818110156153735783516001600160a01b03168352928401929184019160010161534e565b50909695505050505050565b610280810161538e828a615232565b64ffffffffff88166101c0830152866101e08301528561020083015284610220830152836102408301528261026083015298975050505050505050565b801515811461157357600080fd5b8035614fe3816153cb565b6000806000606084860312156153f957600080fd5b833561540481614fc3565b925060208401359150604084013561541b816153cb565b809150509250925092565b600080600080600060a0868803121561543e57600080fd5b853561544981614fc3565b9450602086013561545981614fc3565b9350604086013561546981614fc3565b9250606086013561547981614fc3565b949793965091946080013592915050565b6000806040838503121561549d57600080fd5b82356154a881614fc3565b91506020830135615016816153cb565b6000806000606084860312156154cd57600080fd5b83356154d881614fc3565b925060208401359150604084013561541b81614fc3565b6020808252600a90820152691b9bdd081b1a5cdd195960b21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561554357615543615513565b500290565b60008261556557634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561557d5761557d615513565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60008135611457816153cb565b60ff8116811461157357600080fd5b6000813561145781615627565b61ffff8116811461157357600080fd5b6000813561145781615643565b6000813561145781614fc3565b80546001600160a01b0319166001600160a01b0392909216919091179055565b6156ad6156998361561a565b825490151560ff1660ff1991909116178255565b6156d26156bc60208401615636565b825461ff00191660089190911b61ff0016178255565b6156fb6156e160408401615653565b825463ffff0000191660109190911b63ffff000016178255565b61572861570a60608401615653565b825465ffff00000000191660209190911b65ffff0000000016178255565b61575961573760808401615653565b825467ffff000000000000191660309190911b67ffff00000000000016178255565b61578e61576860a08401615653565b825469ffff0000000000000000191660409190911b69ffff000000000000000016178255565b6157bb61579d60c0840161561a565b82805460ff60501b191691151560501b60ff60501b16919091179055565b6157e86157ca60e0840161561a565b82805460ff60581b191691151560581b60ff60581b16919091179055565b6158226157f86101008401615660565b82546bffffffffffffffffffffffff1660609190911b6bffffffffffffffffffffffff1916178255565b61583b6158326101208401615660565b6001830161566d565b61585461584b6101408401615660565b6002830161566d565b610160820135600382015561018082013560048201556101a082013560058201555050565b8035614fe381615627565b8035614fe381615643565b6101c081016158a7826158a1856153d9565b15159052565b6158b360208401615879565b60ff1660208301526158c760408401615884565b61ffff1660408301526158dc60608401615884565b61ffff1660608301526158f160808401615884565b61ffff16608083015261590660a08401615884565b61ffff1660a083015261591b60c084016153d9565b151560c083015261592e60e084016153d9565b151560e0830152610100615943848201614fd8565b6001600160a01b03169083015261012061595e848201614fd8565b6001600160a01b031690830152610140615979848201614fd8565b6001600160a01b031690830152610160838101359083015261018080840135908301526101a092830135929091019190915290565b60005b838110156159c95781810151838201526020016159b1565b8381111561142b5750506000910152565b600081518084526159f28160208601602086016159ae565b601f01601f19169290920160200192915050565b60208152600061161660208301846159da565b6020808252601190820152700d2dce6eaccccd2c6d2cadce840c6c2e6d607b1b604082015260600190565b600082821015615a5657615a56615513565b500390565b64ffffffffff83168152815460ff8116151560208301526101e0820190600881901c60ff16604084015261ffff601082901c81166060850152615aa960808501828460201c1661ffff169052565b615abe60a08501828460301c1661ffff169052565b615ad360c08501828460401c1661ffff169052565b50615ae860e0840160ff8360501c1615159052565b615afd610100840160ff8360581c1615159052565b60601c61012083015260018301546001600160a01b03908116610140840152600284015416610160830152600383015461018083015260048301546101a08301526005909201546101c090910152919050565b600060208284031215615b6257600080fd5b5051919050565b600064ffffffffff83811690831681811015615b8757615b87615513565b039392505050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415615bb957615bb9615513565b5060010190565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215615c3357600080fd5b8151611616816153cb565b600060208284031215615c5057600080fd5b815161161681614fc3565b60008251615c6d8184602087016159ae565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b07b920a098d0a53aab87320563987be44aad113efeaec1037e80bc687b36c1664736f6c634300080a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.