Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
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:
AlienFinance
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 "./AlienFinanceStorage.sol";
import "../../interfaces/IAlienFinance.sol";
import "../../interfaces/IAToken.sol";
import "../../interfaces/IBlast.sol";
import "../../interfaces/IBlastPoints.sol";
import "../../interfaces/IDeferLiquidityCheck.sol";
import "../../interfaces/IERC20Rebasing.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 AlienFinance is
Initializable,
UUPSUpgradeable,
Ownable2StepUpgradeable,
ReentrancyGuard,
AlienFinanceStorage,
IAlienFinance
{
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
* @param _gasStation The address of the gas station
* @param _pointsOperator The address of the points operator
*/
function initialize(address _admin, address _gasStation, address _pointsOperator) public initializer {
__Ownable_init();
__UUPSUpgradeable_init();
transferOwnership(_admin);
// Blast mainnet
if (block.chainid == 81457) {
// Configure gas mode to claimable.
IBlast(BLAST).configureClaimableGas();
IBlast(BLAST).configureGovernor(_gasStation);
// Configure points operator.
IBlastPoints(BLAST_POINTS).configurePointsOperator(_pointsOperator);
}
}
/**
* @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];
(uint256 aTokenAmount,) =
_getLiquidationSeizeAmount(marketBorrow, marketCollateral, mBorrow, mCollateral, repayAmount);
return aTokenAmount;
}
/* ========== 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 Alien.
* @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 Alien.
* @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 Alien.
* @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 Alien.
* @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, uint256 exchangeRate) =
_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, exchangeRate);
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);
}
/* ========== 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, the collateral exchange rate
*/
function _getLiquidationSeizeAmount(
address marketBorrow,
address marketCollateral,
DataTypes.Market storage mBorrow,
DataTypes.Market storage mCollateral,
uint256 repayAmount
) internal view returns (uint256, uint256) {
uint256 borrowMarketPrice = _getMarketPrice(mBorrow, marketBorrow);
uint256 collateralMarketPrice = _getMarketPrice(mCollateral, marketCollateral);
uint256 exchangeRate = _getExchangeRate(mCollateral);
// 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 = (exchangeRate * collateralMarketPrice) / 1e18;
return ((repayAmount * numerator) / denominator, exchangeRate);
}
/**
* @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 Alien.
* @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 AlienFinanceStorage 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;
import "../libraries/DataTypes.sol";
interface IAlienFinance {
/* ========== 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 IBlast {
function configureClaimableGas() external;
function configureGovernor(address governor) external;
function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external;
function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256);
function isGovernor(address contractAddress) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IBlastPoints {
function configurePointsOperator(address operator) external;
}// 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 IERC20Rebasing {
enum YieldMode {
AUTOMATIC,
VOID,
CLAIMABLE
}
// changes the yield mode of the caller and update the balance
// to reflect the configuration
function configure(YieldMode) external returns (uint256);
// "claimable" yield mode accounts can call this this claim their yield
// to another address
function claim(address recipient, uint256 amount) external returns (uint256);
// read the claimable amount for an account
function getClaimableAmount(address account) external view returns (uint256);
}// 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 {
address internal constant BLAST = 0x4300000000000000000000000000000000000002;
address internal constant BLAST_POINTS = 0x2536FE9ab3F511540F2f9e2eC2A805005C3Dd800;
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;
}// 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,
uint256 exchangeRate
);
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": [
"chainlink/=lib/chainlink/",
"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/",
"v2-core/=lib/v2-core/contracts/",
"v2-periphery/=lib/v2-periphery/contracts/",
"v3-core/=lib/v3-core/contracts/",
"v3-periphery/=lib/v3-periphery/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
Contract ABI
API[{"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"},{"indexed":false,"internalType":"uint256","name":"exchangeRate","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":"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"},{"internalType":"address","name":"_gasStation","type":"address"},{"internalType":"address","name":"_pointsOperator","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
60a06040523060805234801561001457600080fd5b50600160fb55608051615e106200005260003960008181611481015281816114c101528181611669015281816116a9015261173c0152615e106000f3fe6080604052600436106103b85760003560e01c80638da5cb5b116101f2578063c0c53b8b1161010d578063df7da754116100a0578063efb7601d1161006f578063efb7601d14610f5d578063f2fde38b14610f7d578063fcc0c68014610f9d578063fe1e50a314610fbd57600080fd5b8063df7da75414610edf578063dfd5265b14610eff578063e1fb436814610f1f578063e30c397814610f3f57600080fd5b8063cdb66f7c116100dc578063cdb66f7c14610e5f578063d1456d4f14610e7f578063d49f8be014610e9f578063d82ecc4814610ebf57600080fd5b8063c0c53b8b14610ddf578063c2a5448114610dff578063c2cc27a614610e1f578063c4109c0114610e3f57600080fd5b8063b0772d0b11610185578063bb004abc11610154578063bb004abc14610d5e578063bc15830d14610d7f578063be88ea3214610d9f578063c035bd2114610dbf57600080fd5b8063b0772d0b14610ce9578063b666d84b14610cfe578063ba036b4014610d1e578063ba37773114610d3e57600080fd5b80639b990d72116101c15780639b990d7214610c3b5780639f9f794f14610c74578063a928fe1014610c94578063afef7efd14610cc957600080fd5b80638da5cb5b14610a925780638e8f294b14610ab05780639198e51514610bfa5780639414efc714610c1a57600080fd5b80634f1ef286116102e25780636da82584116102755780637e982c4b116102445780637e982c4b146109ba5780638538d14e146109f657806389b7b7a614610a2f5780638b4f33ee14610a4f57600080fd5b80636da82584146109435780636e64684714610970578063715018a61461099057806379ba5097146109a557600080fd5b80635a208d52116102b15780635a208d52146106ff5780635db22de6146108885780635ec88c79146108cf57806368da10ae1461090a57600080fd5b80634f1ef2861461069757806352d1902d146106aa57806352d84d1e146106bf578063530e784f146106df57600080fd5b80632630c12f1161035a57806341d15f6d1161032957806341d15f6d146105d25780634492ba9e146105f25780634ac511891461063c5780634e05cbb31461065c57600080fd5b80632630c12f146105285780633659cfe6146105495780633a1181d9146105695780633d98a1e51461058957600080fd5b8063118e31b711610396578063118e31b714610464578063178de7eb146104845780631a7370cc146104bd578063203660df146104dd57600080fd5b80630445254d146103bd578063050e570514610409578063107c8ed714610442575b600080fd5b3480156103c957600080fd5b506103f66103d83660046150c4565b61010260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b34801561041557600080fd5b506103f66104243660046150fd565b6001600160a01b0316600090815260fc60205260409020600a015490565b34801561044e57600080fd5b5061046261045d36600461511a565b610fdd565b005b34801561047057600080fd5b506103f661047f3660046150c4565b611411565b34801561049057600080fd5b50610107546104a5906001600160a01b031681565b6040516001600160a01b039091168152602001610400565b3480156104c957600080fd5b506104a56104d836600461516b565b61143d565b3480156104e957600080fd5b506103f66104f83660046150c4565b6001600160a01b03808216600090815260fc602090815260408083209386168352600d9093019052205492915050565b34801561053457600080fd5b50610105546104a5906001600160a01b031681565b34801561055557600080fd5b506104626105643660046150fd565b611476565b34801561057557600080fd5b50610462610584366004615197565b611556565b34801561059557600080fd5b506105c26105a43660046150fd565b6001600160a01b0316600090815260fc602052604090205460ff1690565b6040519015158152602001610400565b3480156105de57600080fd5b506103f66105ed3660046151da565b6115cb565b3480156105fe57600080fd5b506105c261060d3660046150c4565b6001600160a01b0391821660009081526101006020908152604080832093909416825291909152205460ff1690565b34801561064857600080fd5b506104626106573660046150fd565b611600565b34801561066857600080fd5b506105c26106773660046150c4565b60fe60209081526000928352604080842090915290825290205460ff1681565b6104626106a5366004615231565b61165e565b3480156106b657600080fd5b506103f661172f565b3480156106cb57600080fd5b506104a56106da3660046152f5565b6117e2565b3480156106eb57600080fd5b506104626106fa3660046150fd565b61180c565b34801561070b57600080fd5b5061087b61071a3660046150fd565b604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a0810191909152506001600160a01b03908116600090815260fc602090815260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955261ffff620100008304811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b909304841691830191909152600181015483166101208301526002810154909216610140820152600382015461016082015260048201546101808201526005909101546101a082015290565b60405161040091906153ff565b34801561089457600080fd5b506103f66108a33660046150c4565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205490565b3480156108db57600080fd5b506108ef6108ea3660046150fd565b611863565b60408051938452602084019290925290820152606001610400565b34801561091657600080fd5b506103f66109253660046150fd565b6001600160a01b0316600090815260fc602052604090206009015490565b34801561094f57600080fd5b5061096361095e3660046150fd565b61187e565b604051610400919061540e565b34801561097c57600080fd5b5061046261098b3660046150fd565b6118f5565b34801561099c57600080fd5b506104626118fe565b3480156109b157600080fd5b50610462611912565b3480156109c657600080fd5b506105c26109d53660046150c4565b61010060209081526000928352604080842090915290825290205460ff1681565b348015610a0257600080fd5b506103f6610a113660046150fd565b6001600160a01b0316600090815260fc602052604090206008015490565b348015610a3b57600080fd5b50610462610a4a366004615231565b611989565b348015610a5b57600080fd5b50610a80610a6a3660046150fd565b6101046020526000908152604090205460ff1681565b60405160ff9091168152602001610400565b348015610a9e57600080fd5b506097546001600160a01b03166104a5565b348015610abc57600080fd5b50610be7610acb3660046150fd565b60fc6020908152600091825260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955262010000820461ffff90811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b9093046001600160a01b03908116928401929092526001810154821661012084015260028101549091166101408301526003810154610160830152600481015461018083015260058101546101a08301526006810154600782015460088301546009840154600a850154600b9095015464ffffffffff9094169492939192909187565b604051610400979695949392919061545b565b348015610c0657600080fd5b50610462610c153660046150fd565b611b19565b348015610c2657600080fd5b50610106546104a5906001600160a01b031681565b348015610c4757600080fd5b506103f6610c563660046150fd565b6001600160a01b0316600090815260fc602052604090206007015490565b348015610c8057600080fd5b50610462610c8f3660046154c0565b611b5c565b348015610ca057600080fd5b50610cb4610caf366004615502565b611b90565b60408051928352602083019190915201610400565b348015610cd557600080fd5b50610462610ce436600461511a565b611f14565b348015610cf557600080fd5b506109636122fb565b348015610d0a57600080fd5b50610462610d193660046150fd565b61235d565b348015610d2a57600080fd5b506103f6610d3936600461511a565b6123d9565b348015610d4a57600080fd5b506103f6610d593660046150c4565b6126e0565b348015610d6a57600080fd5b50610108546104a5906001600160a01b031681565b348015610d8b57600080fd5b50610462610d9a366004615566565b612739565b348015610dab57600080fd5b506104a5610dba36600461516b565b612744565b348015610dcb57600080fd5b506103f6610dda36600461511a565b612761565b348015610deb57600080fd5b50610462610dfa366004615594565b612854565b348015610e0b57600080fd5b50610462610e1a3660046150fd565b612aab565b348015610e2b57600080fd5b50610462610e3a366004615197565b612b02565b348015610e4b57600080fd5b50610462610e5a3660046150fd565b612bf1565b348015610e6b57600080fd5b50610963610e7a3660046150fd565b612d67565b348015610e8b57600080fd5b50610462610e9a3660046155d4565b612ddc565b348015610eab57600080fd5b506104a5610eba36600461516b565b612f48565b348015610ecb57600080fd5b506105c2610eda3660046150fd565b612f64565b348015610eeb57600080fd5b50610462610efa3660046150fd565b612f82565b348015610f0b57600080fd5b50610462610f1a36600461511a565b612fd9565b348015610f2b57600080fd5b506105c2610f3a3660046150fd565b613255565b348015610f4b57600080fd5b5060c9546001600160a01b03166104a5565b348015610f6957600080fd5b506103f6610f783660046150fd565b613260565b348015610f8957600080fd5b50610462610f983660046150fd565b613281565b348015610fa957600080fd5b50610462610fb83660046150c4565b6132f2565b348015610fc957600080fd5b50610462610fd83660046151da565b61343e565b610fe56135ef565b83610ff08133613649565b6001600160a01b038316600090815260fc60205260409020805460ff166110325760405162461bcd60e51b81526004016110299061560b565b60405180910390fd5b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261110f906136da565b1561114c5760405162461bcd60e51b815260206004820152600d60248201526c1cdd5c1c1b1e481c185d5cd959609a1b6044820152606401611029565b61115585612f64565b156111a25760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f7420737570706c7920746f20637265646974206163636f756e74006044820152606401611029565b6111ac84826136ec565b60038101541561123a576000670de0b6b3a76400006111ca83613930565b83600901546111d99190615645565b6111e39190615664565b60038301549091506111f58583615686565b11156112385760405162461bcd60e51b81526020600482015260126024820152711cdd5c1c1b1e4818d85c081c995858da195960721b6044820152606401611029565b505b600061124582613930565b61125785670de0b6b3a7640000615645565b6112619190615664565b9050600081116112a85760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611029565b838260070160008282546112bc9190615686565b92505081905550808260090160008282546112d79190615686565b90915550506001600160a01b0386166000908152600d8301602052604081208054839290611306908490615686565b9091555050831561131b5761131b8587613988565b81546040516340c10f1960e01b81526001600160a01b03888116600483015260248201849052600160601b909204909116906340c10f1990604401600060405180830381600087803b15801561137057600080fd5b505af1158015611384573d6000803e3d6000fd5b5061139e925050506001600160a01b038616883087613a45565b856001600160a01b0316876001600160a01b0316866001600160a01b03167fe751baae971614714a5055ecbc0892f68c0e2d70c56550cb65a76bc840fa5f6e87856040516113f6929190918252602082015260400190565b60405180910390a450505061140b600160fb55565b50505050565b6001600160a01b038116600090815260fc602052604081206114338185613ab0565b9150505b92915050565b610101602052816000526040600020818154811061145a57600080fd5b6000918252602090912001546001600160a01b03169150829050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156114bf5760405162461bcd60e51b81526004016110299061569e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611508600080516020615d94833981519152546001600160a01b031690565b6001600160a01b03161461152e5760405162461bcd60e51b8152600401611029906156ea565b61153781613b0c565b6040805160008082526020820190925261155391839190613b14565b50565b61155e613c7f565b6001600160a01b038216600090815260fc60205260409020818161158282826157a9565b905050826001600160a01b03167fdcd3ac9b517302fa7d6db6d2ae9265b3d65ccc4d3030130620d7a1701b74b2a4836040516115be91906159ab565b60405180910390a2505050565b6001600160a01b038216600090815260fc6020526040812080826115f28787848089613cca565b5093505050505b9392505050565b611608613d6a565b61010680546001600160a01b0319166001600160a01b0383169081179091556040519081527fdca89ce6f30fe0a23d88a5467a028ce35ba1b7b5b8d9e9e50dbc151fe55c82ad906020015b60405180910390a150565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156116a75760405162461bcd60e51b81526004016110299061569e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166116f0600080516020615d94833981519152546001600160a01b031690565b6001600160a01b0316146117165760405162461bcd60e51b8152600401611029906156ea565b61171f82613b0c565b61172b82826001613b14565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146117cf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611029565b50600080516020615d9483398151915290565b60fd81815481106117f257600080fd5b6000918252602090912001546001600160a01b0316905081565b611814613d6a565b61010580546001600160a01b0319166001600160a01b0383169081179091556040519081527f6536690106168bdf4ba72c128a053d817999b1db90cae23f139b293bf862cb7590602001611653565b600080600061187184613dc4565b9250925092509193909250565b6001600160a01b038116600090815261010360209081526040918290208054835181840281018401909452808452606093928301828280156118e957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116118cb575b50505050509050919050565b6115538161402e565b611906613d6a565b61191060006140e5565b565b60c95433906001600160a01b031681146119805760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401611029565b611553816140e5565b816119948133613649565b61199d83612f64565b156119fe5760405162461bcd60e51b815260206004820152602b60248201527f637265646974206163636f756e742063616e6e6f74206465666572206c69717560448201526a696469747920636865636b60a81b6064820152608401611029565b6001600160a01b0383166000908152610104602052604090205460ff1615611a685760405162461bcd60e51b815260206004820152601d60248201527f7265656e747279206465666572206c697175696469747920636865636b0000006044820152606401611029565b6001600160a01b0383166000908152610104602052604090819020805460ff191660011790555163a15db5c560e01b8152339063a15db5c590611aaf908590600401615b22565b600060405180830381600087803b158015611ac957600080fd5b505af1158015611add573d6000803e3d6000fd5b505050506001600160a01b038316600090815261010460205260409020805460ff19811690915560ff16600281141561140b5761140b8461402e565b6001600160a01b038116600090815260fc60205260409020805460ff16611b525760405162461bcd60e51b81526004016110299061560b565b61172b82826136ec565b82611b678133613649565b6000611b7c6001600160a01b038616856140fe565b9050611b8981338561414f565b5050505050565b600080611b9b6135ef565b86611ba68133613649565b6001600160a01b03808716600090815260fc602052604080822092881682529020815460ff16611c185760405162461bcd60e51b815260206004820152601860248201527f626f72726f77206d61726b6574206e6f74206c697374656400000000000000006044820152606401611029565b805460ff16611c695760405162461bcd60e51b815260206004820152601c60248201527f636f6c6c61746572616c206d61726b6574206e6f74206c6973746564000000006044820152606401611029565b611c72816142d5565b611cc95760405162461bcd60e51b815260206004820152602260248201527f636f6c6c61746572616c206d61726b65742063616e6e6f74206265207365697a604482015261195960f21b6064820152608401611029565b611cd28a612f64565b158015611ce55750611ce389612f64565b155b611d315760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f74206c697175696461746520637265646974206163636f756e74006044820152606401611029565b886001600160a01b03168a6001600160a01b03161415611d8b5760405162461bcd60e51b815260206004820152601560248201527463616e6e6f742073656c66206c697175696461746560581b6044820152606401611029565b611d9588836136ec565b611d9f87826136ec565b611da8896143cf565b611df45760405162461bcd60e51b815260206004820152601960248201527f626f72726f776572206e6f74206c6971756964617461626c65000000000000006044820152606401611029565b611e01828b8b8b8a6143e7565b9550600080611e138a8a86868c613cca565b91509150611e2489848d8f8661455d565b825460405163b2a02ff160e01b81526001600160a01b038d811660048301528e8116602483015260448201859052600160601b9092049091169063b2a02ff190606401600060405180830381600087803b158015611e8157600080fd5b505af1158015611e95573d6000803e3d6000fd5b5050604080516001600160a01b038d81168252602082018d905291810186905260608101859052818e1693508e82169250908f16907fdbabdf9adef27405369c36a9f64d42dd1761a85c1e8798fab2eb8d31b6eb95319060800160405180910390a4508695509350505050611f0a600160fb55565b9550959350505050565b611f1c6135ef565b83611f278133613649565b6001600160a01b038316600090815260fc60205260409020805460ff16611f605760405162461bcd60e51b81526004016110299061560b565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261203d90614774565b1561207a5760405162461bcd60e51b815260206004820152600d60248201526c189bdc9c9bddc81c185d5cd959609a1b6044820152606401611029565b828160070154101561209e5760405162461bcd60e51b815260040161102990615b35565b6120a884826136ec565b60008382600801546120ba9190615686565b90506000846120c9848a613ab0565b6120d39190615686565b6004840154909150156121295760048301548211156121295760405162461bcd60e51b8152602060048201526012602482015271189bdc9c9bddc818d85c081c995858da195960721b6044820152606401611029565b8483600701600082825461213d9190615b60565b9091555050600883018290556001600160a01b0388166000908152600c840160205260409020818155600b8401546001909101558415612181576121818689613988565b6121956001600160a01b0387168887614786565b61219e88612f64565b1561229057866001600160a01b0316886001600160a01b0316146122155760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920626f72726f772074604482015267379034ba39b2b63360c11b6064820152608401611029565b6001600160a01b03808916600090815261010260209081526040808320938a168352929052205481111561228b5760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e7420637265646974206c696d6974000000000000006044820152606401611029565b612299565b6122998861402e565b60408051868152602081018390529081018390526001600160a01b03808916918a8216918916907f4bc4b08d677fc59195d56e346dcb5cc5dc3b78b90d59f5d36740ae1b3d225db89060600160405180910390a45050505061140b600160fb55565b606060fd80548060200260200160405190810160405280929190818152602001828054801561235357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612335575b5050505050905090565b612365613c7f565b6001600160a01b038116600090815260fc6020526040902080546bff00000000000000000000ff1916600160581b1781556123a160fd836147b6565b6040516001600160a01b038316907f9710c341258431a6380fd1febe8985e6b6221e8398c287ea971f2ba85a6e1a1090600090a25050565b60006123e36135ef565b846123ee8133613649565b6001600160a01b038416600090815260fc60205260409020805460ff166124275760405162461bcd60e51b81526004016110299061560b565b61243185826136ec565b6001600160a01b0387166000908152600d820160205260408120546007830154909160001987141561248c575081670de0b6b3a764000061247185613930565b61247b9083615645565b6124859190615664565b96506124b4565b61249584613930565b6124a788670de0b6b3a7640000615645565b6124b19190615664565b90505b600081116124f95760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611029565b808310156125405760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401611029565b868210156125605760405162461bcd60e51b815260040161102990615b35565b600061256c8285615b60565b6001600160a01b038c166000908152600d87016020526040902081905590506125958884615b60565b8560070181905550818560090160008282546125b19190615b60565b9091555050801580156125cb57506125c9858c613ab0565b155b156125da576125da898c6148c5565b8454604051632770a7eb60e21b81526001600160a01b038d8116600483015260248201859052600160601b90920490911690639dc29fac90604401600060405180830381600087803b15801561262f57600080fd5b505af1158015612643573d6000803e3d6000fd5b5061265c925050506001600160a01b038a168b8a614786565b6126658b61402e565b896001600160a01b03168b6001600160a01b03168a6001600160a01b03167faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c8b866040516126bd929190918252602082015260400190565b60405180910390a48796505050505050506126d8600160fb55565b949350505050565b6001600160a01b038116600090815260fc60205260408120670de0b6b3a764000061270a82613930565b6001600160a01b0386166000908152600d8401602052604090205461272f9190615645565b6114339190615664565b61172b33838361414f565b610103602052816000526040600020818154811061145a57600080fd5b600061276b6135ef565b846127768133613649565b6001600160a01b038416600090815260fc60205260409020805460ff166127af5760405162461bcd60e51b81526004016110299061560b565b6127b886612f64565b1561282f57856001600160a01b0316876001600160a01b03161461282f5760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920726570617920666f604482015267391034ba39b2b63360c11b6064820152608401611029565b61283985826136ec565b61284681888888886143e7565b925050506126d8600160fb55565b600054610100900460ff16158080156128745750600054600160ff909116105b8061288e5750303b15801561288e575060005460ff166001145b6128f15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611029565b6000805460ff191660011790558015612914576000805461ff0019166101001790555b61291c61497c565b6129246149ab565b61292d84613281565b4662013e311415612a60576002604360981b016001600160a01b0316634e606c476040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561297a57600080fd5b505af115801561298e573d6000803e3d6000fd5b5050604051631d70c8d360e31b81526001600160a01b03861660048201526002604360981b01925063eb8646989150602401600060405180830381600087803b1580156129da57600080fd5b505af11580156129ee573d6000803e3d6000fd5b50506040516336b91f2b60e01b81526001600160a01b0385166004820152732536fe9ab3f511540f2f9e2ec2a805005c3dd80092506336b91f2b9150602401600060405180830381600087803b158015612a4757600080fd5b505af1158015612a5b573d6000803e3d6000fd5b505050505b801561140b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b612ab3613d6a565b61010780546001600160a01b0319166001600160a01b0383169081179091556040519081527f517371384ca8a07b7ae4697507862b5200ce0a12158170259cebe2cb63d33f3290602001611653565b612b0a613c7f565b6001600160a01b038216600090815260fc60205260409020612b2a6149d2565b60068201805464ffffffffff191664ffffffffff92909216919091179055670de0b6b3a7640000600b8201558181612b6282826157a9565b505060fd80546001810182556000919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800180546001600160a01b0319166001600160a01b03851690811790915560068201546040517fbefee0150f4933331fcee3972b8a74be870d590ef30e21f8830c9b2a9d04c987916115be9164ffffffffff909116908590615b77565b612bf9614a24565b6001600160a01b038116600090815260fc60205260409020805460ff16612c325760405162461bcd60e51b81526004016110299061560b565b612c3c82826136ec565b60078101546040516370a0823160e01b8152306004820152600091906001600160a01b038516906370a0823190602401602060405180830381865afa158015612c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cad9190615c6c565b612cb79190615b60565b90508015612d62576000612cca83613930565b612cdc83670de0b6b3a7640000615645565b612ce69190615664565b905081836007016000828254612cfc9190615686565b925050819055508083600a016000828254612d179190615686565b909155505060408051828152602081018490526001600160a01b038616917fe08e52dead7793dd3e1f1b8c081a9d196fb9a1f26939c240e3660e9badd466b3910160405180910390a2505b505050565b6001600160a01b038116600090815261010160209081526040918290208054835181840281018401909452808452606093928301828280156118e9576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116118cb5750505050509050919050565b612de4614a24565b6001600160a01b038316600090815260fc60205260409020805460ff16612e1d5760405162461bcd60e51b81526004016110299061560b565b612e2784826136ec565b6000670de0b6b3a7640000612e3b83613930565b612e459086615645565b612e4f9190615664565b90508082600701541015612e755760405162461bcd60e51b815260040161102990615b35565b8382600a01541015612ec15760405162461bcd60e51b8152602060048201526015602482015274696e73756666696369656e7420726573657276657360581b6044820152606401611029565b6007820180548290039055600a820180548590039055612eeb6001600160a01b0386168483614786565b826001600160a01b0316856001600160a01b03167f85d7d5527903b3bdc93c2e97283c443822adba607371569d40047426532c9c388684604051612f39929190918252602082015260400190565b60405180910390a35050505050565b60ff602052816000526040600020818154811061145a57600080fd5b6001600160a01b031660009081526101036020526040902054151590565b612f8a613d6a565b61010880546001600160a01b0319166001600160a01b0383169081179091556040519081527f7e84f9bb34064cde550792818395eb9c2f7766113ce1c301d35c19cbe2e187ac90602001611653565b6001600160a01b038416600090815260fc60205260409020805460ff166130125760405162461bcd60e51b81526004016110299061560b565b8054600160601b90046001600160a01b031633146130605760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611029565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261313d90614a71565b1561317c5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c881c185d5cd959608a1b6044820152606401611029565b826001600160a01b0316846001600160a01b031614156131d55760405162461bcd60e51b815260206004820152601460248201527331b0b73737ba1039b2b633103a3930b739b332b960611b6044820152606401611029565b6131de83612f64565b156132355760405162461bcd60e51b815260206004820152602160248201527f63616e6e6f74207472616e7366657220746f20637265646974206163636f756e6044820152601d60fa1b6064820152608401611029565b61323f85826136ec565b61324c858286868661455d565b611b898461402e565b6000611437826143cf565b6001600160a01b038116600090815260fc602052604081206115f981613930565b613289613d6a565b60c980546001600160a01b0383166001600160a01b031990911681179091556132ba6097546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6132fa613d6a565b6001600160a01b038216600090815260fc60205260409020805460ff16156133645760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f74207365697a65206c6973746564206d61726b65740000000000006044820152606401611029565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156133ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133cf9190615c6c565b9050801561140b576133eb6001600160a01b0385168483614786565b826001600160a01b0316846001600160a01b03167feac344312e08a6e34d3cb14733c432e8b20995a316e9abf4bc59640dc90d10ca8360405161343091815260200190565b60405180910390a350505050565b610107546001600160a01b031633146134845760405162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b6044820152606401611029565b6001600160a01b038216600090815260fc60205260409020805460ff166134bd5760405162461bcd60e51b81526004016110299061560b565b811580156134f057506001600160a01b038085166000908152610102602090815260408083209387168352929052205415155b1561351d576001600160a01b03841660009081526101036020526040902061351890846147b6565b613595565b811580159061355057506001600160a01b0380851660009081526101026020908152604080832093871683529290522054155b15613595576001600160a01b038481166000908152610103602090815260408220805460018101825590835291200180546001600160a01b0319169185169190911790555b6001600160a01b038481166000818152610102602090815260408083209488168084529482529182902086905590518581527fd2430896b2083037d8bf873ee97e05de0442c7137b4c9413b9e928f7212869e99101613430565b600260fb5414156136425760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611029565b600260fb55565b806001600160a01b0316826001600160a01b031614806136a0575061366d82612f64565b1580156136a057506001600160a01b038083166000908152610100602090815260408083209385168352929052205460ff165b61172b5760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611029565b60208101516000906001161515611437565b60006136f66149d2565b60068301549091506000906137129064ffffffffff1683615c85565b64ffffffffff169050801561140b576007830154600b84015460088501546009860154600a87015460028801546040516329737ea560e21b815260048101879052602481018590526000916001600160a01b03169063a5cdfa9490604401602060405180830381865afa15801561378d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137b19190615c6c565b905060006137bf8883615645565b90506000670de0b6b3a76400006137d68784615645565b6137e09190615664565b8b549091506000906127109061380190600160401b900461ffff1684615645565b61380b9190615664565b9050600081156138545761381f8284615b60565b613829898c615686565b6138339190615686565b61383d8789615686565b6138479084615645565b6138519190615664565b90505b670de0b6b3a76400006138678a86615645565b6138719190615664565b61387b908a615686565b98506138878389615686565b97506138938187615686565b60068e01805464ffffffffff191664ffffffffff8f16908117909155600b8f018b905560088f018a9055600a8f01829055604080519182526020820188905281018b9052606081018a9052608081018290529096506001600160a01b038f16907f854365e2056d048a4a9980a18729a7e79f432f9142ee48311a63d7b64e46edeb9060a00160405180910390a25050505050505050505050505050565b60008082600a015483600901546139479190615686565b9050806139575750506005015490565b808360080154846007015461396c9190615686565b61397e90670de0b6b3a7640000615645565b6115f99190615664565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff16156139ba575050565b6001600160a01b03808216600081815260fe60209081526040808320948716808452948252808320805460ff1916600190811790915584845260ff835281842080549182018155845291832090910180546001600160a01b03191685179055519192917f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a59190a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261140b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614a83565b6001600160a01b0381166000908152600c830160209081526040808320815180830190925280548083526001909101549282019290925290613af6576000915050611437565b6020810151600b850154825161272f9190615645565b611553613d6a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613b4757612d6283614b55565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613ba1575060408051601f3d908101601f19168201909252613b9e91810190615c6c565b60015b613c045760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611029565b600080516020615d948339815191528114613c735760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611029565b50612d62838383614bf1565b610106546001600160a01b031633146119105760405162461bcd60e51b815260206004820152600d60248201526c10b1b7b73334b3bab930ba37b960991b6044820152606401611029565b6000806000613cd98689614c16565b90506000613ce78689614c16565b90506000613cf487613930565b875490915060009061271090613d16908690600160301b900461ffff16615645565b613d209190615664565b90506000670de0b6b3a7640000613d378585615645565b613d419190615664565b905080613d4e838a615645565b613d589190615664565b9c929b50919950505050505050505050565b6097546001600160a01b031633146119105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611029565b600080600080600080600060ff6000896001600160a01b03166001600160a01b03168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015613e4857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613e2a575b5050505050905060005b815181101561402057600060fc6000848481518110613e7357613e73615cab565b6020908102919091018101516001600160a01b03168252810191909152604001600020805490915060ff16613ea8575061400e565b6001600160a01b038a166000908152600d8201602052604081205490613ece838d613ab0565b90506000613ef584878781518110613ee857613ee8615cab565b6020026020010151614c16565b845490915061ffff620100008204811691600160201b9004168415801590613f1d5750600082115b15613fd7576000613f2d87613930565b90506127106ec097ce7bc90715b34b9f10000000008486613f4e858b615645565b613f589190615645565b613f629190615645565b613f6c9190615664565b613f769190615664565b613f80908d615686565b9b506127106ec097ce7bc90715b34b9f10000000008386613fa1858b615645565b613fab9190615645565b613fb59190615645565b613fbf9190615664565b613fc99190615664565b613fd3908c615686565b9a50505b831561400757670de0b6b3a7640000613ff08486615645565b613ffa9190615664565b614004908a615686565b98505b5050505050505b8061401881615cc1565b915050613e52565b509297919650945092505050565b6001600160a01b0381166000908152610104602052604090205460ff16806140b15760008061405c84613dc4565b92505091508082101561140b5760405162461bcd60e51b815260206004820152601760248201527f696e73756666696369656e7420636f6c6c61746572616c0000000000000000006044820152606401611029565b60ff81166001141561172b576001600160a01b038216600090815261010460205260409020805460ff191660021790555050565b60c980546001600160a01b031916905561155381614d4a565b6000610100821061414a5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a59081cdd58881858d8dbdd5b9d081a5960521b6044820152606401611029565b501890565b80801561418357506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff16155b15614213576001600160a01b03808416600081815261010060209081526040808320948716808452948252808320805460ff19166001908117909155848452610101835281842080549182018155845291832090910180546001600160a01b03191685179055517fa9e5a03abaf4ebb6969200baf2ad7c42a89f86f7801a1689f0ba767a6e2fd5f09190a3505050565b8015801561424757506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff165b15612d62576001600160a01b038084166000818152610100602090815260408083209487168352938152838220805460ff191690559181526101019091522061429090836147b6565b816001600160a01b0316836001600160a01b03167f6a87827eefdfa1b8651b66ff7c8c5b7e72436f627cd2ecd358b9eeada2e9103460405160405180910390a3505050565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a08201526000906143b590614a71565b15801561143757505054600160201b900461ffff16151590565b60008060006143dd84613dc4565b1195945050505050565b6000806143f48786613ab0565b9050600019831415614404578092505b808311156144455760405162461bcd60e51b815260206004820152600e60248201526d0e4cae0c2f240e8dede40daeac6d60931b6044820152606401611029565b60006144518483615b60565b905060008489600801546144659190615b60565b6001600160a01b0388166000908152600c8b0160205260408120848155600b8c015460019091015560078b01805492935087929091906144a6908490615686565b9091555050600889018190556001600160a01b0387166000908152600d8a0160205260409020541580156144d8575081155b156144e7576144e786886148c5565b6144fc6001600160a01b038716893088613a45565b60408051868152602081018490529081018290526001600160a01b03808916918a8216918916907f0afc5881e4003d86c77497d24dac378e531a0fa70f52e2b9269be723ff66ab4b9060600160405180910390a45092979650505050505050565b6001600160a01b0383166145b35760405162461bcd60e51b815260206004820152601e60248201527f7472616e736665722066726f6d20746865207a65726f206164647265737300006044820152606401611029565b6001600160a01b0382166146095760405162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f2061646472657373000000006044820152606401611029565b6001600160a01b0383166000908152600d85016020526040902054816146685760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c881e995c9bc8185b5bdd5b9d60621b6044820152606401611029565b818110156146b85760405162461bcd60e51b815260206004820152601f60248201527f7472616e7366657220616d6f756e7420657863656564732062616c616e6365006044820152606401611029565b6146c28684613988565b6001600160a01b038085166000818152600d88016020526040808220868603815593871682528120805486019055525415801561470657506147048585613ab0565b155b156147155761471586856148c5565b826001600160a01b0316846001600160a01b0316876001600160a01b03167f88d5565fe2b249a672462d9cdbcdea595ec02e1655b48e9e7920d787aa690ee88560405161476491815260200190565b60405180910390a4505050505050565b60208101516000906002161515611437565b6040516001600160a01b038316602482015260448101829052612d6290849063a9059cbb60e01b90606401613a79565b815460005b8181101561140b57826001600160a01b03168482815481106147df576147df615cab565b6000918252602090912001546001600160a01b031614156148bd57614805600183615b60565b81146148865783614817600184615b60565b8154811061482757614827615cab565b9060005260206000200160009054906101000a90046001600160a01b031684828154811061485757614857615cab565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b8380548061489657614896615cdc565b600082815260209020810160001990810180546001600160a01b031916905501905561140b565b6001016147bb565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff166148f6575050565b6001600160a01b03808216600081815260fe602090815260408083209487168352938152838220805460ff1916905591815260ff9091522061493890836147b6565b806001600160a01b0316826001600160a01b03167fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d60405160405180910390a35050565b600054610100900460ff166149a35760405162461bcd60e51b815260040161102990615cf2565b611910614d9c565b600054610100900460ff166119105760405162461bcd60e51b815260040161102990615cf2565b6000650100000000004210614a1f5760405162461bcd60e51b815260206004820152601360248201527274696d657374616d7020746f6f206c6172676560681b6044820152606401611029565b504290565b610108546001600160a01b031633146119105760405162461bcd60e51b815260206004820152600f60248201526e10b932b9b2b93b32a6b0b730b3b2b960891b6044820152606401611029565b60208101516000906004161515611437565b6000614ad8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614dcc9092919063ffffffff16565b805190915015612d625780806020019051810190614af69190615d3d565b612d625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611029565b6001600160a01b0381163b614bc25760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611029565b600080516020615d9483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614bfa83614ddb565b600082511180614c075750805b15612d625761140b8383614e1b565b81546000908190600160501b900460ff16614c315782614c93565b826001600160a01b0316639816f4736040518163ffffffff1660e01b8152600401602060405180830381865afa158015614c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c939190615d5a565b610105546040516341976e0960e01b81526001600160a01b038084166004830152929350600092909116906341976e0990602401602060405180830381865afa158015614ce4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d089190615c6c565b9050600081116114335760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b6044820152606401611029565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16614dc35760405162461bcd60e51b815260040161102990615cf2565b611910336140e5565b60606126d88484600085614f0f565b614de481614b55565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b614e835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611029565b600080846001600160a01b031684604051614e9e9190615d77565b600060405180830381855af49150503d8060008114614ed9576040519150601f19603f3d011682016040523d82523d6000602084013e614ede565b606091505b5091509150614f068282604051806060016040528060278152602001615db460279139614fea565b95945050505050565b606082471015614f705760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611029565b600080866001600160a01b03168587604051614f8c9190615d77565b60006040518083038185875af1925050503d8060008114614fc9576040519150601f19603f3d011682016040523d82523d6000602084013e614fce565b606091505b5091509150614fdf87838387615003565b979650505050505050565b60608315614ff95750816115f9565b6115f98383615075565b6060831561506f578251615068576001600160a01b0385163b6150685760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611029565b50816126d8565b6126d883835b8151156150855781518083602001fd5b8060405162461bcd60e51b81526004016110299190615b22565b6001600160a01b038116811461155357600080fd5b80356150bf8161509f565b919050565b600080604083850312156150d757600080fd5b82356150e28161509f565b915060208301356150f28161509f565b809150509250929050565b60006020828403121561510f57600080fd5b81356115f98161509f565b6000806000806080858703121561513057600080fd5b843561513b8161509f565b9350602085013561514b8161509f565b9250604085013561515b8161509f565b9396929550929360600135925050565b6000806040838503121561517e57600080fd5b82356151898161509f565b946020939093013593505050565b6000808284036101e08112156151ac57600080fd5b83356151b78161509f565b92506101c0601f19820112156151cc57600080fd5b506020830190509250929050565b6000806000606084860312156151ef57600080fd5b83356151fa8161509f565b9250602084013561520a8161509f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561524457600080fd5b823561524f8161509f565b9150602083013567ffffffffffffffff8082111561526c57600080fd5b818501915085601f83011261528057600080fd5b8135818111156152925761529261521b565b604051601f8201601f19908116603f011681019083821181831017156152ba576152ba61521b565b816040528281528860208487010111156152d357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60006020828403121561530757600080fd5b5035919050565b8051151582526020810151615328602084018260ff169052565b50604081015161533e604084018261ffff169052565b506060810151615354606084018261ffff169052565b50608081015161536a608084018261ffff169052565b5060a081015161538060a084018261ffff169052565b5060c081015161539460c084018215159052565b5060e08101516153a860e084018215159052565b50610100818101516001600160a01b0390811691840191909152610120808301518216908401526101408083015190911690830152610160808201519083015261018080820151908301526101a090810151910152565b6101c08101611437828461530e565b6020808252825182820181905260009190848201906040850190845b8181101561544f5783516001600160a01b03168352928401929184019160010161542a565b50909695505050505050565b610280810161546a828a61530e565b64ffffffffff88166101c0830152866101e08301528561020083015284610220830152836102408301528261026083015298975050505050505050565b801515811461155357600080fd5b80356150bf816154a7565b6000806000606084860312156154d557600080fd5b83356154e08161509f565b92506020840135915060408401356154f7816154a7565b809150509250925092565b600080600080600060a0868803121561551a57600080fd5b85356155258161509f565b945060208601356155358161509f565b935060408601356155458161509f565b925060608601356155558161509f565b949793965091946080013592915050565b6000806040838503121561557957600080fd5b82356155848161509f565b915060208301356150f2816154a7565b6000806000606084860312156155a957600080fd5b83356155b48161509f565b925060208401356155c48161509f565b915060408401356154f78161509f565b6000806000606084860312156155e957600080fd5b83356155f48161509f565b92506020840135915060408401356154f78161509f565b6020808252600a90820152691b9bdd081b1a5cdd195960b21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561565f5761565f61562f565b500290565b60008261568157634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156156995761569961562f565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60008135611437816154a7565b60ff8116811461155357600080fd5b6000813561143781615743565b61ffff8116811461155357600080fd5b600081356114378161575f565b600081356114378161509f565b80546001600160a01b0319166001600160a01b0392909216919091179055565b6157c96157b583615736565b825490151560ff1660ff1991909116178255565b6157ee6157d860208401615752565b825461ff00191660089190911b61ff0016178255565b6158176157fd6040840161576f565b825463ffff0000191660109190911b63ffff000016178255565b6158446158266060840161576f565b825465ffff00000000191660209190911b65ffff0000000016178255565b6158756158536080840161576f565b825467ffff000000000000191660309190911b67ffff00000000000016178255565b6158aa61588460a0840161576f565b825469ffff0000000000000000191660409190911b69ffff000000000000000016178255565b6158d76158b960c08401615736565b82805460ff60501b191691151560501b60ff60501b16919091179055565b6159046158e660e08401615736565b82805460ff60581b191691151560581b60ff60581b16919091179055565b61593e615914610100840161577c565b82546bffffffffffffffffffffffff1660609190911b6bffffffffffffffffffffffff1916178255565b61595761594e610120840161577c565b60018301615789565b615970615967610140840161577c565b60028301615789565b610160820135600382015561018082013560048201556101a082013560058201555050565b80356150bf81615743565b80356150bf8161575f565b6101c081016159c3826159bd856154b5565b15159052565b6159cf60208401615995565b60ff1660208301526159e3604084016159a0565b61ffff1660408301526159f8606084016159a0565b61ffff166060830152615a0d608084016159a0565b61ffff166080830152615a2260a084016159a0565b61ffff1660a0830152615a3760c084016154b5565b151560c0830152615a4a60e084016154b5565b151560e0830152610100615a5f8482016150b4565b6001600160a01b031690830152610120615a7a8482016150b4565b6001600160a01b031690830152610140615a958482016150b4565b6001600160a01b031690830152610160838101359083015261018080840135908301526101a092830135929091019190915290565b60005b83811015615ae5578181015183820152602001615acd565b8381111561140b5750506000910152565b60008151808452615b0e816020860160208601615aca565b601f01601f19169290920160200192915050565b6020815260006115f96020830184615af6565b6020808252601190820152700d2dce6eaccccd2c6d2cadce840c6c2e6d607b1b604082015260600190565b600082821015615b7257615b7261562f565b500390565b64ffffffffff83168152815460ff8116151560208301526101e0820190600881901c60ff16604084015261ffff601082901c81166060850152615bc560808501828460201c1661ffff169052565b615bda60a08501828460301c1661ffff169052565b615bef60c08501828460401c1661ffff169052565b50615c0460e0840160ff8360501c1615159052565b615c19610100840160ff8360581c1615159052565b60601c61012083015260018301546001600160a01b03908116610140840152600284015416610160830152600383015461018083015260048301546101a08301526005909201546101c090910152919050565b600060208284031215615c7e57600080fd5b5051919050565b600064ffffffffff83811690831681811015615ca357615ca361562f565b039392505050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415615cd557615cd561562f565b5060010190565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215615d4f57600080fd5b81516115f9816154a7565b600060208284031215615d6c57600080fd5b81516115f98161509f565b60008251615d89818460208701615aca565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220db736a5882d00195b11a0c01f23c396a272074c67a1c7df8e54be9bcb6e5ff2a64736f6c634300080a0033
Deployed Bytecode
0x6080604052600436106103b85760003560e01c80638da5cb5b116101f2578063c0c53b8b1161010d578063df7da754116100a0578063efb7601d1161006f578063efb7601d14610f5d578063f2fde38b14610f7d578063fcc0c68014610f9d578063fe1e50a314610fbd57600080fd5b8063df7da75414610edf578063dfd5265b14610eff578063e1fb436814610f1f578063e30c397814610f3f57600080fd5b8063cdb66f7c116100dc578063cdb66f7c14610e5f578063d1456d4f14610e7f578063d49f8be014610e9f578063d82ecc4814610ebf57600080fd5b8063c0c53b8b14610ddf578063c2a5448114610dff578063c2cc27a614610e1f578063c4109c0114610e3f57600080fd5b8063b0772d0b11610185578063bb004abc11610154578063bb004abc14610d5e578063bc15830d14610d7f578063be88ea3214610d9f578063c035bd2114610dbf57600080fd5b8063b0772d0b14610ce9578063b666d84b14610cfe578063ba036b4014610d1e578063ba37773114610d3e57600080fd5b80639b990d72116101c15780639b990d7214610c3b5780639f9f794f14610c74578063a928fe1014610c94578063afef7efd14610cc957600080fd5b80638da5cb5b14610a925780638e8f294b14610ab05780639198e51514610bfa5780639414efc714610c1a57600080fd5b80634f1ef286116102e25780636da82584116102755780637e982c4b116102445780637e982c4b146109ba5780638538d14e146109f657806389b7b7a614610a2f5780638b4f33ee14610a4f57600080fd5b80636da82584146109435780636e64684714610970578063715018a61461099057806379ba5097146109a557600080fd5b80635a208d52116102b15780635a208d52146106ff5780635db22de6146108885780635ec88c79146108cf57806368da10ae1461090a57600080fd5b80634f1ef2861461069757806352d1902d146106aa57806352d84d1e146106bf578063530e784f146106df57600080fd5b80632630c12f1161035a57806341d15f6d1161032957806341d15f6d146105d25780634492ba9e146105f25780634ac511891461063c5780634e05cbb31461065c57600080fd5b80632630c12f146105285780633659cfe6146105495780633a1181d9146105695780633d98a1e51461058957600080fd5b8063118e31b711610396578063118e31b714610464578063178de7eb146104845780631a7370cc146104bd578063203660df146104dd57600080fd5b80630445254d146103bd578063050e570514610409578063107c8ed714610442575b600080fd5b3480156103c957600080fd5b506103f66103d83660046150c4565b61010260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b34801561041557600080fd5b506103f66104243660046150fd565b6001600160a01b0316600090815260fc60205260409020600a015490565b34801561044e57600080fd5b5061046261045d36600461511a565b610fdd565b005b34801561047057600080fd5b506103f661047f3660046150c4565b611411565b34801561049057600080fd5b50610107546104a5906001600160a01b031681565b6040516001600160a01b039091168152602001610400565b3480156104c957600080fd5b506104a56104d836600461516b565b61143d565b3480156104e957600080fd5b506103f66104f83660046150c4565b6001600160a01b03808216600090815260fc602090815260408083209386168352600d9093019052205492915050565b34801561053457600080fd5b50610105546104a5906001600160a01b031681565b34801561055557600080fd5b506104626105643660046150fd565b611476565b34801561057557600080fd5b50610462610584366004615197565b611556565b34801561059557600080fd5b506105c26105a43660046150fd565b6001600160a01b0316600090815260fc602052604090205460ff1690565b6040519015158152602001610400565b3480156105de57600080fd5b506103f66105ed3660046151da565b6115cb565b3480156105fe57600080fd5b506105c261060d3660046150c4565b6001600160a01b0391821660009081526101006020908152604080832093909416825291909152205460ff1690565b34801561064857600080fd5b506104626106573660046150fd565b611600565b34801561066857600080fd5b506105c26106773660046150c4565b60fe60209081526000928352604080842090915290825290205460ff1681565b6104626106a5366004615231565b61165e565b3480156106b657600080fd5b506103f661172f565b3480156106cb57600080fd5b506104a56106da3660046152f5565b6117e2565b3480156106eb57600080fd5b506104626106fa3660046150fd565b61180c565b34801561070b57600080fd5b5061087b61071a3660046150fd565b604080516101c081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a0810191909152506001600160a01b03908116600090815260fc602090815260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955261ffff620100008304811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b909304841691830191909152600181015483166101208301526002810154909216610140820152600382015461016082015260048201546101808201526005909101546101a082015290565b60405161040091906153ff565b34801561089457600080fd5b506103f66108a33660046150c4565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205490565b3480156108db57600080fd5b506108ef6108ea3660046150fd565b611863565b60408051938452602084019290925290820152606001610400565b34801561091657600080fd5b506103f66109253660046150fd565b6001600160a01b0316600090815260fc602052604090206009015490565b34801561094f57600080fd5b5061096361095e3660046150fd565b61187e565b604051610400919061540e565b34801561097c57600080fd5b5061046261098b3660046150fd565b6118f5565b34801561099c57600080fd5b506104626118fe565b3480156109b157600080fd5b50610462611912565b3480156109c657600080fd5b506105c26109d53660046150c4565b61010060209081526000928352604080842090915290825290205460ff1681565b348015610a0257600080fd5b506103f6610a113660046150fd565b6001600160a01b0316600090815260fc602052604090206008015490565b348015610a3b57600080fd5b50610462610a4a366004615231565b611989565b348015610a5b57600080fd5b50610a80610a6a3660046150fd565b6101046020526000908152604090205460ff1681565b60405160ff9091168152602001610400565b348015610a9e57600080fd5b506097546001600160a01b03166104a5565b348015610abc57600080fd5b50610be7610acb3660046150fd565b60fc6020908152600091825260409182902082516101c081018452815460ff8082161515835261010080830482169584019590955262010000820461ffff90811696840196909652600160201b820486166060840152600160301b820486166080840152600160401b820490951660a0830152600160501b81048516151560c0830152600160581b8104909416151560e0820152600160601b9093046001600160a01b03908116928401929092526001810154821661012084015260028101549091166101408301526003810154610160830152600481015461018083015260058101546101a08301526006810154600782015460088301546009840154600a850154600b9095015464ffffffffff9094169492939192909187565b604051610400979695949392919061545b565b348015610c0657600080fd5b50610462610c153660046150fd565b611b19565b348015610c2657600080fd5b50610106546104a5906001600160a01b031681565b348015610c4757600080fd5b506103f6610c563660046150fd565b6001600160a01b0316600090815260fc602052604090206007015490565b348015610c8057600080fd5b50610462610c8f3660046154c0565b611b5c565b348015610ca057600080fd5b50610cb4610caf366004615502565b611b90565b60408051928352602083019190915201610400565b348015610cd557600080fd5b50610462610ce436600461511a565b611f14565b348015610cf557600080fd5b506109636122fb565b348015610d0a57600080fd5b50610462610d193660046150fd565b61235d565b348015610d2a57600080fd5b506103f6610d3936600461511a565b6123d9565b348015610d4a57600080fd5b506103f6610d593660046150c4565b6126e0565b348015610d6a57600080fd5b50610108546104a5906001600160a01b031681565b348015610d8b57600080fd5b50610462610d9a366004615566565b612739565b348015610dab57600080fd5b506104a5610dba36600461516b565b612744565b348015610dcb57600080fd5b506103f6610dda36600461511a565b612761565b348015610deb57600080fd5b50610462610dfa366004615594565b612854565b348015610e0b57600080fd5b50610462610e1a3660046150fd565b612aab565b348015610e2b57600080fd5b50610462610e3a366004615197565b612b02565b348015610e4b57600080fd5b50610462610e5a3660046150fd565b612bf1565b348015610e6b57600080fd5b50610963610e7a3660046150fd565b612d67565b348015610e8b57600080fd5b50610462610e9a3660046155d4565b612ddc565b348015610eab57600080fd5b506104a5610eba36600461516b565b612f48565b348015610ecb57600080fd5b506105c2610eda3660046150fd565b612f64565b348015610eeb57600080fd5b50610462610efa3660046150fd565b612f82565b348015610f0b57600080fd5b50610462610f1a36600461511a565b612fd9565b348015610f2b57600080fd5b506105c2610f3a3660046150fd565b613255565b348015610f4b57600080fd5b5060c9546001600160a01b03166104a5565b348015610f6957600080fd5b506103f6610f783660046150fd565b613260565b348015610f8957600080fd5b50610462610f983660046150fd565b613281565b348015610fa957600080fd5b50610462610fb83660046150c4565b6132f2565b348015610fc957600080fd5b50610462610fd83660046151da565b61343e565b610fe56135ef565b83610ff08133613649565b6001600160a01b038316600090815260fc60205260409020805460ff166110325760405162461bcd60e51b81526004016110299061560b565b60405180910390fd5b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261110f906136da565b1561114c5760405162461bcd60e51b815260206004820152600d60248201526c1cdd5c1c1b1e481c185d5cd959609a1b6044820152606401611029565b61115585612f64565b156111a25760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f7420737570706c7920746f20637265646974206163636f756e74006044820152606401611029565b6111ac84826136ec565b60038101541561123a576000670de0b6b3a76400006111ca83613930565b83600901546111d99190615645565b6111e39190615664565b60038301549091506111f58583615686565b11156112385760405162461bcd60e51b81526020600482015260126024820152711cdd5c1c1b1e4818d85c081c995858da195960721b6044820152606401611029565b505b600061124582613930565b61125785670de0b6b3a7640000615645565b6112619190615664565b9050600081116112a85760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611029565b838260070160008282546112bc9190615686565b92505081905550808260090160008282546112d79190615686565b90915550506001600160a01b0386166000908152600d8301602052604081208054839290611306908490615686565b9091555050831561131b5761131b8587613988565b81546040516340c10f1960e01b81526001600160a01b03888116600483015260248201849052600160601b909204909116906340c10f1990604401600060405180830381600087803b15801561137057600080fd5b505af1158015611384573d6000803e3d6000fd5b5061139e925050506001600160a01b038616883087613a45565b856001600160a01b0316876001600160a01b0316866001600160a01b03167fe751baae971614714a5055ecbc0892f68c0e2d70c56550cb65a76bc840fa5f6e87856040516113f6929190918252602082015260400190565b60405180910390a450505061140b600160fb55565b50505050565b6001600160a01b038116600090815260fc602052604081206114338185613ab0565b9150505b92915050565b610101602052816000526040600020818154811061145a57600080fd5b6000918252602090912001546001600160a01b03169150829050565b306001600160a01b037f0000000000000000000000000767497e26e3569812a31cb56c9d15a15843c3281614156114bf5760405162461bcd60e51b81526004016110299061569e565b7f0000000000000000000000000767497e26e3569812a31cb56c9d15a15843c3286001600160a01b0316611508600080516020615d94833981519152546001600160a01b031690565b6001600160a01b03161461152e5760405162461bcd60e51b8152600401611029906156ea565b61153781613b0c565b6040805160008082526020820190925261155391839190613b14565b50565b61155e613c7f565b6001600160a01b038216600090815260fc60205260409020818161158282826157a9565b905050826001600160a01b03167fdcd3ac9b517302fa7d6db6d2ae9265b3d65ccc4d3030130620d7a1701b74b2a4836040516115be91906159ab565b60405180910390a2505050565b6001600160a01b038216600090815260fc6020526040812080826115f28787848089613cca565b5093505050505b9392505050565b611608613d6a565b61010680546001600160a01b0319166001600160a01b0383169081179091556040519081527fdca89ce6f30fe0a23d88a5467a028ce35ba1b7b5b8d9e9e50dbc151fe55c82ad906020015b60405180910390a150565b306001600160a01b037f0000000000000000000000000767497e26e3569812a31cb56c9d15a15843c3281614156116a75760405162461bcd60e51b81526004016110299061569e565b7f0000000000000000000000000767497e26e3569812a31cb56c9d15a15843c3286001600160a01b03166116f0600080516020615d94833981519152546001600160a01b031690565b6001600160a01b0316146117165760405162461bcd60e51b8152600401611029906156ea565b61171f82613b0c565b61172b82826001613b14565b5050565b6000306001600160a01b037f0000000000000000000000000767497e26e3569812a31cb56c9d15a15843c32816146117cf5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611029565b50600080516020615d9483398151915290565b60fd81815481106117f257600080fd5b6000918252602090912001546001600160a01b0316905081565b611814613d6a565b61010580546001600160a01b0319166001600160a01b0383169081179091556040519081527f6536690106168bdf4ba72c128a053d817999b1db90cae23f139b293bf862cb7590602001611653565b600080600061187184613dc4565b9250925092509193909250565b6001600160a01b038116600090815261010360209081526040918290208054835181840281018401909452808452606093928301828280156118e957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116118cb575b50505050509050919050565b6115538161402e565b611906613d6a565b61191060006140e5565b565b60c95433906001600160a01b031681146119805760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401611029565b611553816140e5565b816119948133613649565b61199d83612f64565b156119fe5760405162461bcd60e51b815260206004820152602b60248201527f637265646974206163636f756e742063616e6e6f74206465666572206c69717560448201526a696469747920636865636b60a81b6064820152608401611029565b6001600160a01b0383166000908152610104602052604090205460ff1615611a685760405162461bcd60e51b815260206004820152601d60248201527f7265656e747279206465666572206c697175696469747920636865636b0000006044820152606401611029565b6001600160a01b0383166000908152610104602052604090819020805460ff191660011790555163a15db5c560e01b8152339063a15db5c590611aaf908590600401615b22565b600060405180830381600087803b158015611ac957600080fd5b505af1158015611add573d6000803e3d6000fd5b505050506001600160a01b038316600090815261010460205260409020805460ff19811690915560ff16600281141561140b5761140b8461402e565b6001600160a01b038116600090815260fc60205260409020805460ff16611b525760405162461bcd60e51b81526004016110299061560b565b61172b82826136ec565b82611b678133613649565b6000611b7c6001600160a01b038616856140fe565b9050611b8981338561414f565b5050505050565b600080611b9b6135ef565b86611ba68133613649565b6001600160a01b03808716600090815260fc602052604080822092881682529020815460ff16611c185760405162461bcd60e51b815260206004820152601860248201527f626f72726f77206d61726b6574206e6f74206c697374656400000000000000006044820152606401611029565b805460ff16611c695760405162461bcd60e51b815260206004820152601c60248201527f636f6c6c61746572616c206d61726b6574206e6f74206c6973746564000000006044820152606401611029565b611c72816142d5565b611cc95760405162461bcd60e51b815260206004820152602260248201527f636f6c6c61746572616c206d61726b65742063616e6e6f74206265207365697a604482015261195960f21b6064820152608401611029565b611cd28a612f64565b158015611ce55750611ce389612f64565b155b611d315760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f74206c697175696461746520637265646974206163636f756e74006044820152606401611029565b886001600160a01b03168a6001600160a01b03161415611d8b5760405162461bcd60e51b815260206004820152601560248201527463616e6e6f742073656c66206c697175696461746560581b6044820152606401611029565b611d9588836136ec565b611d9f87826136ec565b611da8896143cf565b611df45760405162461bcd60e51b815260206004820152601960248201527f626f72726f776572206e6f74206c6971756964617461626c65000000000000006044820152606401611029565b611e01828b8b8b8a6143e7565b9550600080611e138a8a86868c613cca565b91509150611e2489848d8f8661455d565b825460405163b2a02ff160e01b81526001600160a01b038d811660048301528e8116602483015260448201859052600160601b9092049091169063b2a02ff190606401600060405180830381600087803b158015611e8157600080fd5b505af1158015611e95573d6000803e3d6000fd5b5050604080516001600160a01b038d81168252602082018d905291810186905260608101859052818e1693508e82169250908f16907fdbabdf9adef27405369c36a9f64d42dd1761a85c1e8798fab2eb8d31b6eb95319060800160405180910390a4508695509350505050611f0a600160fb55565b9550959350505050565b611f1c6135ef565b83611f278133613649565b6001600160a01b038316600090815260fc60205260409020805460ff16611f605760405162461bcd60e51b81526004016110299061560b565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261203d90614774565b1561207a5760405162461bcd60e51b815260206004820152600d60248201526c189bdc9c9bddc81c185d5cd959609a1b6044820152606401611029565b828160070154101561209e5760405162461bcd60e51b815260040161102990615b35565b6120a884826136ec565b60008382600801546120ba9190615686565b90506000846120c9848a613ab0565b6120d39190615686565b6004840154909150156121295760048301548211156121295760405162461bcd60e51b8152602060048201526012602482015271189bdc9c9bddc818d85c081c995858da195960721b6044820152606401611029565b8483600701600082825461213d9190615b60565b9091555050600883018290556001600160a01b0388166000908152600c840160205260409020818155600b8401546001909101558415612181576121818689613988565b6121956001600160a01b0387168887614786565b61219e88612f64565b1561229057866001600160a01b0316886001600160a01b0316146122155760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920626f72726f772074604482015267379034ba39b2b63360c11b6064820152608401611029565b6001600160a01b03808916600090815261010260209081526040808320938a168352929052205481111561228b5760405162461bcd60e51b815260206004820152601960248201527f696e73756666696369656e7420637265646974206c696d6974000000000000006044820152606401611029565b612299565b6122998861402e565b60408051868152602081018390529081018390526001600160a01b03808916918a8216918916907f4bc4b08d677fc59195d56e346dcb5cc5dc3b78b90d59f5d36740ae1b3d225db89060600160405180910390a45050505061140b600160fb55565b606060fd80548060200260200160405190810160405280929190818152602001828054801561235357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612335575b5050505050905090565b612365613c7f565b6001600160a01b038116600090815260fc6020526040902080546bff00000000000000000000ff1916600160581b1781556123a160fd836147b6565b6040516001600160a01b038316907f9710c341258431a6380fd1febe8985e6b6221e8398c287ea971f2ba85a6e1a1090600090a25050565b60006123e36135ef565b846123ee8133613649565b6001600160a01b038416600090815260fc60205260409020805460ff166124275760405162461bcd60e51b81526004016110299061560b565b61243185826136ec565b6001600160a01b0387166000908152600d820160205260408120546007830154909160001987141561248c575081670de0b6b3a764000061247185613930565b61247b9083615645565b6124859190615664565b96506124b4565b61249584613930565b6124a788670de0b6b3a7640000615645565b6124b19190615664565b90505b600081116124f95760405162461bcd60e51b81526020600482015260126024820152711e995c9bc818551bdad95b88185b5bdd5b9d60721b6044820152606401611029565b808310156125405760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401611029565b868210156125605760405162461bcd60e51b815260040161102990615b35565b600061256c8285615b60565b6001600160a01b038c166000908152600d87016020526040902081905590506125958884615b60565b8560070181905550818560090160008282546125b19190615b60565b9091555050801580156125cb57506125c9858c613ab0565b155b156125da576125da898c6148c5565b8454604051632770a7eb60e21b81526001600160a01b038d8116600483015260248201859052600160601b90920490911690639dc29fac90604401600060405180830381600087803b15801561262f57600080fd5b505af1158015612643573d6000803e3d6000fd5b5061265c925050506001600160a01b038a168b8a614786565b6126658b61402e565b896001600160a01b03168b6001600160a01b03168a6001600160a01b03167faee47cdf925cf525fdae94f9777ee5a06cac37e1c41220d0a8a89ed154f62d1c8b866040516126bd929190918252602082015260400190565b60405180910390a48796505050505050506126d8600160fb55565b949350505050565b6001600160a01b038116600090815260fc60205260408120670de0b6b3a764000061270a82613930565b6001600160a01b0386166000908152600d8401602052604090205461272f9190615645565b6114339190615664565b61172b33838361414f565b610103602052816000526040600020818154811061145a57600080fd5b600061276b6135ef565b846127768133613649565b6001600160a01b038416600090815260fc60205260409020805460ff166127af5760405162461bcd60e51b81526004016110299061560b565b6127b886612f64565b1561282f57856001600160a01b0316876001600160a01b03161461282f5760405162461bcd60e51b815260206004820152602860248201527f637265646974206163636f756e742063616e206f6e6c7920726570617920666f604482015267391034ba39b2b63360c11b6064820152608401611029565b61283985826136ec565b61284681888888886143e7565b925050506126d8600160fb55565b600054610100900460ff16158080156128745750600054600160ff909116105b8061288e5750303b15801561288e575060005460ff166001145b6128f15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611029565b6000805460ff191660011790558015612914576000805461ff0019166101001790555b61291c61497c565b6129246149ab565b61292d84613281565b4662013e311415612a60576002604360981b016001600160a01b0316634e606c476040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561297a57600080fd5b505af115801561298e573d6000803e3d6000fd5b5050604051631d70c8d360e31b81526001600160a01b03861660048201526002604360981b01925063eb8646989150602401600060405180830381600087803b1580156129da57600080fd5b505af11580156129ee573d6000803e3d6000fd5b50506040516336b91f2b60e01b81526001600160a01b0385166004820152732536fe9ab3f511540f2f9e2ec2a805005c3dd80092506336b91f2b9150602401600060405180830381600087803b158015612a4757600080fd5b505af1158015612a5b573d6000803e3d6000fd5b505050505b801561140b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b612ab3613d6a565b61010780546001600160a01b0319166001600160a01b0383169081179091556040519081527f517371384ca8a07b7ae4697507862b5200ce0a12158170259cebe2cb63d33f3290602001611653565b612b0a613c7f565b6001600160a01b038216600090815260fc60205260409020612b2a6149d2565b60068201805464ffffffffff191664ffffffffff92909216919091179055670de0b6b3a7640000600b8201558181612b6282826157a9565b505060fd80546001810182556000919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800180546001600160a01b0319166001600160a01b03851690811790915560068201546040517fbefee0150f4933331fcee3972b8a74be870d590ef30e21f8830c9b2a9d04c987916115be9164ffffffffff909116908590615b77565b612bf9614a24565b6001600160a01b038116600090815260fc60205260409020805460ff16612c325760405162461bcd60e51b81526004016110299061560b565b612c3c82826136ec565b60078101546040516370a0823160e01b8152306004820152600091906001600160a01b038516906370a0823190602401602060405180830381865afa158015612c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cad9190615c6c565b612cb79190615b60565b90508015612d62576000612cca83613930565b612cdc83670de0b6b3a7640000615645565b612ce69190615664565b905081836007016000828254612cfc9190615686565b925050819055508083600a016000828254612d179190615686565b909155505060408051828152602081018490526001600160a01b038616917fe08e52dead7793dd3e1f1b8c081a9d196fb9a1f26939c240e3660e9badd466b3910160405180910390a2505b505050565b6001600160a01b038116600090815261010160209081526040918290208054835181840281018401909452808452606093928301828280156118e9576020028201919060005260206000209081546001600160a01b031681526001909101906020018083116118cb5750505050509050919050565b612de4614a24565b6001600160a01b038316600090815260fc60205260409020805460ff16612e1d5760405162461bcd60e51b81526004016110299061560b565b612e2784826136ec565b6000670de0b6b3a7640000612e3b83613930565b612e459086615645565b612e4f9190615664565b90508082600701541015612e755760405162461bcd60e51b815260040161102990615b35565b8382600a01541015612ec15760405162461bcd60e51b8152602060048201526015602482015274696e73756666696369656e7420726573657276657360581b6044820152606401611029565b6007820180548290039055600a820180548590039055612eeb6001600160a01b0386168483614786565b826001600160a01b0316856001600160a01b03167f85d7d5527903b3bdc93c2e97283c443822adba607371569d40047426532c9c388684604051612f39929190918252602082015260400190565b60405180910390a35050505050565b60ff602052816000526040600020818154811061145a57600080fd5b6001600160a01b031660009081526101036020526040902054151590565b612f8a613d6a565b61010880546001600160a01b0319166001600160a01b0383169081179091556040519081527f7e84f9bb34064cde550792818395eb9c2f7766113ce1c301d35c19cbe2e187ac90602001611653565b6001600160a01b038416600090815260fc60205260409020805460ff166130125760405162461bcd60e51b81526004016110299061560b565b8054600160601b90046001600160a01b031633146130605760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611029565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a082015261313d90614a71565b1561317c5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c881c185d5cd959608a1b6044820152606401611029565b826001600160a01b0316846001600160a01b031614156131d55760405162461bcd60e51b815260206004820152601460248201527331b0b73737ba1039b2b633103a3930b739b332b960611b6044820152606401611029565b6131de83612f64565b156132355760405162461bcd60e51b815260206004820152602160248201527f63616e6e6f74207472616e7366657220746f20637265646974206163636f756e6044820152601d60fa1b6064820152608401611029565b61323f85826136ec565b61324c858286868661455d565b611b898461402e565b6000611437826143cf565b6001600160a01b038116600090815260fc602052604081206115f981613930565b613289613d6a565b60c980546001600160a01b0383166001600160a01b031990911681179091556132ba6097546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6132fa613d6a565b6001600160a01b038216600090815260fc60205260409020805460ff16156133645760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f74207365697a65206c6973746564206d61726b65740000000000006044820152606401611029565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156133ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133cf9190615c6c565b9050801561140b576133eb6001600160a01b0385168483614786565b826001600160a01b0316846001600160a01b03167feac344312e08a6e34d3cb14733c432e8b20995a316e9abf4bc59640dc90d10ca8360405161343091815260200190565b60405180910390a350505050565b610107546001600160a01b031633146134845760405162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b6044820152606401611029565b6001600160a01b038216600090815260fc60205260409020805460ff166134bd5760405162461bcd60e51b81526004016110299061560b565b811580156134f057506001600160a01b038085166000908152610102602090815260408083209387168352929052205415155b1561351d576001600160a01b03841660009081526101036020526040902061351890846147b6565b613595565b811580159061355057506001600160a01b0380851660009081526101026020908152604080832093871683529290522054155b15613595576001600160a01b038481166000908152610103602090815260408220805460018101825590835291200180546001600160a01b0319169185169190911790555b6001600160a01b038481166000818152610102602090815260408083209488168084529482529182902086905590518581527fd2430896b2083037d8bf873ee97e05de0442c7137b4c9413b9e928f7212869e99101613430565b600260fb5414156136425760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611029565b600260fb55565b806001600160a01b0316826001600160a01b031614806136a0575061366d82612f64565b1580156136a057506001600160a01b038083166000908152610100602090815260408083209385168352929052205460ff165b61172b5760405162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b6044820152606401611029565b60208101516000906001161515611437565b60006136f66149d2565b60068301549091506000906137129064ffffffffff1683615c85565b64ffffffffff169050801561140b576007830154600b84015460088501546009860154600a87015460028801546040516329737ea560e21b815260048101879052602481018590526000916001600160a01b03169063a5cdfa9490604401602060405180830381865afa15801561378d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137b19190615c6c565b905060006137bf8883615645565b90506000670de0b6b3a76400006137d68784615645565b6137e09190615664565b8b549091506000906127109061380190600160401b900461ffff1684615645565b61380b9190615664565b9050600081156138545761381f8284615b60565b613829898c615686565b6138339190615686565b61383d8789615686565b6138479084615645565b6138519190615664565b90505b670de0b6b3a76400006138678a86615645565b6138719190615664565b61387b908a615686565b98506138878389615686565b97506138938187615686565b60068e01805464ffffffffff191664ffffffffff8f16908117909155600b8f018b905560088f018a9055600a8f01829055604080519182526020820188905281018b9052606081018a9052608081018290529096506001600160a01b038f16907f854365e2056d048a4a9980a18729a7e79f432f9142ee48311a63d7b64e46edeb9060a00160405180910390a25050505050505050505050505050565b60008082600a015483600901546139479190615686565b9050806139575750506005015490565b808360080154846007015461396c9190615686565b61397e90670de0b6b3a7640000615645565b6115f99190615664565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff16156139ba575050565b6001600160a01b03808216600081815260fe60209081526040808320948716808452948252808320805460ff1916600190811790915584845260ff835281842080549182018155845291832090910180546001600160a01b03191685179055519192917f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a59190a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261140b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614a83565b6001600160a01b0381166000908152600c830160209081526040808320815180830190925280548083526001909101549282019290925290613af6576000915050611437565b6020810151600b850154825161272f9190615645565b611553613d6a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613b4757612d6283614b55565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613ba1575060408051601f3d908101601f19168201909252613b9e91810190615c6c565b60015b613c045760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611029565b600080516020615d948339815191528114613c735760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611029565b50612d62838383614bf1565b610106546001600160a01b031633146119105760405162461bcd60e51b815260206004820152600d60248201526c10b1b7b73334b3bab930ba37b960991b6044820152606401611029565b6000806000613cd98689614c16565b90506000613ce78689614c16565b90506000613cf487613930565b875490915060009061271090613d16908690600160301b900461ffff16615645565b613d209190615664565b90506000670de0b6b3a7640000613d378585615645565b613d419190615664565b905080613d4e838a615645565b613d589190615664565b9c929b50919950505050505050505050565b6097546001600160a01b031633146119105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611029565b600080600080600080600060ff6000896001600160a01b03166001600160a01b03168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015613e4857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613e2a575b5050505050905060005b815181101561402057600060fc6000848481518110613e7357613e73615cab565b6020908102919091018101516001600160a01b03168252810191909152604001600020805490915060ff16613ea8575061400e565b6001600160a01b038a166000908152600d8201602052604081205490613ece838d613ab0565b90506000613ef584878781518110613ee857613ee8615cab565b6020026020010151614c16565b845490915061ffff620100008204811691600160201b9004168415801590613f1d5750600082115b15613fd7576000613f2d87613930565b90506127106ec097ce7bc90715b34b9f10000000008486613f4e858b615645565b613f589190615645565b613f629190615645565b613f6c9190615664565b613f769190615664565b613f80908d615686565b9b506127106ec097ce7bc90715b34b9f10000000008386613fa1858b615645565b613fab9190615645565b613fb59190615645565b613fbf9190615664565b613fc99190615664565b613fd3908c615686565b9a50505b831561400757670de0b6b3a7640000613ff08486615645565b613ffa9190615664565b614004908a615686565b98505b5050505050505b8061401881615cc1565b915050613e52565b509297919650945092505050565b6001600160a01b0381166000908152610104602052604090205460ff16806140b15760008061405c84613dc4565b92505091508082101561140b5760405162461bcd60e51b815260206004820152601760248201527f696e73756666696369656e7420636f6c6c61746572616c0000000000000000006044820152606401611029565b60ff81166001141561172b576001600160a01b038216600090815261010460205260409020805460ff191660021790555050565b60c980546001600160a01b031916905561155381614d4a565b6000610100821061414a5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a59081cdd58881858d8dbdd5b9d081a5960521b6044820152606401611029565b501890565b80801561418357506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff16155b15614213576001600160a01b03808416600081815261010060209081526040808320948716808452948252808320805460ff19166001908117909155848452610101835281842080549182018155845291832090910180546001600160a01b03191685179055517fa9e5a03abaf4ebb6969200baf2ad7c42a89f86f7801a1689f0ba767a6e2fd5f09190a3505050565b8015801561424757506001600160a01b038084166000908152610100602090815260408083209386168352929052205460ff165b15612d62576001600160a01b038084166000818152610100602090815260408083209487168352938152838220805460ff191690559181526101019091522061429090836147b6565b816001600160a01b0316836001600160a01b03167f6a87827eefdfa1b8651b66ff7c8c5b7e72436f627cd2ecd358b9eeada2e9103460405160405180910390a3505050565b604080516101c081018252825460ff808216151583526101008083048216602085015261ffff620100008404811695850195909552600160201b830485166060850152600160301b830485166080850152600160401b830490941660a0840152600160501b82048116151560c0840152600160581b820416151560e08301526001600160a01b03600160601b9091048116928201929092526001830154821661012082015260028301549091166101408201526003820154610160820152600482015461018082015260058201546101a08201526000906143b590614a71565b15801561143757505054600160201b900461ffff16151590565b60008060006143dd84613dc4565b1195945050505050565b6000806143f48786613ab0565b9050600019831415614404578092505b808311156144455760405162461bcd60e51b815260206004820152600e60248201526d0e4cae0c2f240e8dede40daeac6d60931b6044820152606401611029565b60006144518483615b60565b905060008489600801546144659190615b60565b6001600160a01b0388166000908152600c8b0160205260408120848155600b8c015460019091015560078b01805492935087929091906144a6908490615686565b9091555050600889018190556001600160a01b0387166000908152600d8a0160205260409020541580156144d8575081155b156144e7576144e786886148c5565b6144fc6001600160a01b038716893088613a45565b60408051868152602081018490529081018290526001600160a01b03808916918a8216918916907f0afc5881e4003d86c77497d24dac378e531a0fa70f52e2b9269be723ff66ab4b9060600160405180910390a45092979650505050505050565b6001600160a01b0383166145b35760405162461bcd60e51b815260206004820152601e60248201527f7472616e736665722066726f6d20746865207a65726f206164647265737300006044820152606401611029565b6001600160a01b0382166146095760405162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f2061646472657373000000006044820152606401611029565b6001600160a01b0383166000908152600d85016020526040902054816146685760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c881e995c9bc8185b5bdd5b9d60621b6044820152606401611029565b818110156146b85760405162461bcd60e51b815260206004820152601f60248201527f7472616e7366657220616d6f756e7420657863656564732062616c616e6365006044820152606401611029565b6146c28684613988565b6001600160a01b038085166000818152600d88016020526040808220868603815593871682528120805486019055525415801561470657506147048585613ab0565b155b156147155761471586856148c5565b826001600160a01b0316846001600160a01b0316876001600160a01b03167f88d5565fe2b249a672462d9cdbcdea595ec02e1655b48e9e7920d787aa690ee88560405161476491815260200190565b60405180910390a4505050505050565b60208101516000906002161515611437565b6040516001600160a01b038316602482015260448101829052612d6290849063a9059cbb60e01b90606401613a79565b815460005b8181101561140b57826001600160a01b03168482815481106147df576147df615cab565b6000918252602090912001546001600160a01b031614156148bd57614805600183615b60565b81146148865783614817600184615b60565b8154811061482757614827615cab565b9060005260206000200160009054906101000a90046001600160a01b031684828154811061485757614857615cab565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b8380548061489657614896615cdc565b600082815260209020810160001990810180546001600160a01b031916905501905561140b565b6001016147bb565b6001600160a01b03808216600090815260fe602090815260408083209386168352929052205460ff166148f6575050565b6001600160a01b03808216600081815260fe602090815260408083209487168352938152838220805460ff1916905591815260ff9091522061493890836147b6565b806001600160a01b0316826001600160a01b03167fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d60405160405180910390a35050565b600054610100900460ff166149a35760405162461bcd60e51b815260040161102990615cf2565b611910614d9c565b600054610100900460ff166119105760405162461bcd60e51b815260040161102990615cf2565b6000650100000000004210614a1f5760405162461bcd60e51b815260206004820152601360248201527274696d657374616d7020746f6f206c6172676560681b6044820152606401611029565b504290565b610108546001600160a01b031633146119105760405162461bcd60e51b815260206004820152600f60248201526e10b932b9b2b93b32a6b0b730b3b2b960891b6044820152606401611029565b60208101516000906004161515611437565b6000614ad8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614dcc9092919063ffffffff16565b805190915015612d625780806020019051810190614af69190615d3d565b612d625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611029565b6001600160a01b0381163b614bc25760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611029565b600080516020615d9483398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614bfa83614ddb565b600082511180614c075750805b15612d625761140b8383614e1b565b81546000908190600160501b900460ff16614c315782614c93565b826001600160a01b0316639816f4736040518163ffffffff1660e01b8152600401602060405180830381865afa158015614c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c939190615d5a565b610105546040516341976e0960e01b81526001600160a01b038084166004830152929350600092909116906341976e0990602401602060405180830381865afa158015614ce4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d089190615c6c565b9050600081116114335760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b6044820152606401611029565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16614dc35760405162461bcd60e51b815260040161102990615cf2565b611910336140e5565b60606126d88484600085614f0f565b614de481614b55565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b614e835760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611029565b600080846001600160a01b031684604051614e9e9190615d77565b600060405180830381855af49150503d8060008114614ed9576040519150601f19603f3d011682016040523d82523d6000602084013e614ede565b606091505b5091509150614f068282604051806060016040528060278152602001615db460279139614fea565b95945050505050565b606082471015614f705760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611029565b600080866001600160a01b03168587604051614f8c9190615d77565b60006040518083038185875af1925050503d8060008114614fc9576040519150601f19603f3d011682016040523d82523d6000602084013e614fce565b606091505b5091509150614fdf87838387615003565b979650505050505050565b60608315614ff95750816115f9565b6115f98383615075565b6060831561506f578251615068576001600160a01b0385163b6150685760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611029565b50816126d8565b6126d883835b8151156150855781518083602001fd5b8060405162461bcd60e51b81526004016110299190615b22565b6001600160a01b038116811461155357600080fd5b80356150bf8161509f565b919050565b600080604083850312156150d757600080fd5b82356150e28161509f565b915060208301356150f28161509f565b809150509250929050565b60006020828403121561510f57600080fd5b81356115f98161509f565b6000806000806080858703121561513057600080fd5b843561513b8161509f565b9350602085013561514b8161509f565b9250604085013561515b8161509f565b9396929550929360600135925050565b6000806040838503121561517e57600080fd5b82356151898161509f565b946020939093013593505050565b6000808284036101e08112156151ac57600080fd5b83356151b78161509f565b92506101c0601f19820112156151cc57600080fd5b506020830190509250929050565b6000806000606084860312156151ef57600080fd5b83356151fa8161509f565b9250602084013561520a8161509f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561524457600080fd5b823561524f8161509f565b9150602083013567ffffffffffffffff8082111561526c57600080fd5b818501915085601f83011261528057600080fd5b8135818111156152925761529261521b565b604051601f8201601f19908116603f011681019083821181831017156152ba576152ba61521b565b816040528281528860208487010111156152d357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60006020828403121561530757600080fd5b5035919050565b8051151582526020810151615328602084018260ff169052565b50604081015161533e604084018261ffff169052565b506060810151615354606084018261ffff169052565b50608081015161536a608084018261ffff169052565b5060a081015161538060a084018261ffff169052565b5060c081015161539460c084018215159052565b5060e08101516153a860e084018215159052565b50610100818101516001600160a01b0390811691840191909152610120808301518216908401526101408083015190911690830152610160808201519083015261018080820151908301526101a090810151910152565b6101c08101611437828461530e565b6020808252825182820181905260009190848201906040850190845b8181101561544f5783516001600160a01b03168352928401929184019160010161542a565b50909695505050505050565b610280810161546a828a61530e565b64ffffffffff88166101c0830152866101e08301528561020083015284610220830152836102408301528261026083015298975050505050505050565b801515811461155357600080fd5b80356150bf816154a7565b6000806000606084860312156154d557600080fd5b83356154e08161509f565b92506020840135915060408401356154f7816154a7565b809150509250925092565b600080600080600060a0868803121561551a57600080fd5b85356155258161509f565b945060208601356155358161509f565b935060408601356155458161509f565b925060608601356155558161509f565b949793965091946080013592915050565b6000806040838503121561557957600080fd5b82356155848161509f565b915060208301356150f2816154a7565b6000806000606084860312156155a957600080fd5b83356155b48161509f565b925060208401356155c48161509f565b915060408401356154f78161509f565b6000806000606084860312156155e957600080fd5b83356155f48161509f565b92506020840135915060408401356154f78161509f565b6020808252600a90820152691b9bdd081b1a5cdd195960b21b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561565f5761565f61562f565b500290565b60008261568157634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156156995761569961562f565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60008135611437816154a7565b60ff8116811461155357600080fd5b6000813561143781615743565b61ffff8116811461155357600080fd5b600081356114378161575f565b600081356114378161509f565b80546001600160a01b0319166001600160a01b0392909216919091179055565b6157c96157b583615736565b825490151560ff1660ff1991909116178255565b6157ee6157d860208401615752565b825461ff00191660089190911b61ff0016178255565b6158176157fd6040840161576f565b825463ffff0000191660109190911b63ffff000016178255565b6158446158266060840161576f565b825465ffff00000000191660209190911b65ffff0000000016178255565b6158756158536080840161576f565b825467ffff000000000000191660309190911b67ffff00000000000016178255565b6158aa61588460a0840161576f565b825469ffff0000000000000000191660409190911b69ffff000000000000000016178255565b6158d76158b960c08401615736565b82805460ff60501b191691151560501b60ff60501b16919091179055565b6159046158e660e08401615736565b82805460ff60581b191691151560581b60ff60581b16919091179055565b61593e615914610100840161577c565b82546bffffffffffffffffffffffff1660609190911b6bffffffffffffffffffffffff1916178255565b61595761594e610120840161577c565b60018301615789565b615970615967610140840161577c565b60028301615789565b610160820135600382015561018082013560048201556101a082013560058201555050565b80356150bf81615743565b80356150bf8161575f565b6101c081016159c3826159bd856154b5565b15159052565b6159cf60208401615995565b60ff1660208301526159e3604084016159a0565b61ffff1660408301526159f8606084016159a0565b61ffff166060830152615a0d608084016159a0565b61ffff166080830152615a2260a084016159a0565b61ffff1660a0830152615a3760c084016154b5565b151560c0830152615a4a60e084016154b5565b151560e0830152610100615a5f8482016150b4565b6001600160a01b031690830152610120615a7a8482016150b4565b6001600160a01b031690830152610140615a958482016150b4565b6001600160a01b031690830152610160838101359083015261018080840135908301526101a092830135929091019190915290565b60005b83811015615ae5578181015183820152602001615acd565b8381111561140b5750506000910152565b60008151808452615b0e816020860160208601615aca565b601f01601f19169290920160200192915050565b6020815260006115f96020830184615af6565b6020808252601190820152700d2dce6eaccccd2c6d2cadce840c6c2e6d607b1b604082015260600190565b600082821015615b7257615b7261562f565b500390565b64ffffffffff83168152815460ff8116151560208301526101e0820190600881901c60ff16604084015261ffff601082901c81166060850152615bc560808501828460201c1661ffff169052565b615bda60a08501828460301c1661ffff169052565b615bef60c08501828460401c1661ffff169052565b50615c0460e0840160ff8360501c1615159052565b615c19610100840160ff8360581c1615159052565b60601c61012083015260018301546001600160a01b03908116610140840152600284015416610160830152600383015461018083015260048301546101a08301526005909201546101c090910152919050565b600060208284031215615c7e57600080fd5b5051919050565b600064ffffffffff83811690831681811015615ca357615ca361562f565b039392505050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415615cd557615cd561562f565b5060010190565b634e487b7160e01b600052603160045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060208284031215615d4f57600080fd5b81516115f9816154a7565b600060208284031215615d6c57600080fd5b81516115f98161509f565b60008251615d89818460208701615aca565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220db736a5882d00195b11a0c01f23c396a272074c67a1c7df8e54be9bcb6e5ff2a64736f6c634300080a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.