My Name Tag:
Not Available, login to update
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0xd1c6bacde655526d5afb09c69c05389c0ba3ab30a6318e05fbb998e1454538f9 | _become | 26312593 | 433 days 20 hrs ago | 0x4b1d76f16d4342799ccfd2dfb3074591faad75f1 | IN | OVIX: Comptroller | 0 MATIC | 0.001212696 | |
0xea8db70f7638bf999bae08fb3b666f329e8023102ac29d8b7973b79ed781d9b0 | _become | 26312417 | 433 days 21 hrs ago | 0x4b1d76f16d4342799ccfd2dfb3074591faad75f1 | IN | OVIX: Comptroller | 0 MATIC | 0.001929096 | |
0xaa1d5eb441865c6a6d790c56b587291ac0df2087bac1246b6d7b5dc83cf4dc24 | 0x60806040 | 26312393 | 433 days 21 hrs ago | 0x4b1d76f16d4342799ccfd2dfb3074591faad75f1 | IN | Create: Comptroller | 0 MATIC | 0.188550072 |
[ Download CSV Export ]
Contract Name:
Comptroller
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 400 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./libraries/ErrorReporter.sol"; import "./libraries/ExponentialNoError.sol"; import "./interfaces/IComptroller.sol"; import "./ComptrollerStorage.sol"; interface I0vix { function transfer(address, uint256) external; function balanceOf(address) external view returns (uint256); } interface IUnitroller { function admin() external view returns (address); function _acceptImplementation() external returns (uint256); } /** * @title Comptroller Contract * @author 0VIX Protocol * @notice Based on Compound's Comptroller with some changes inspired by BENQi.fi */ contract Comptroller is ComptrollerV7Storage, ComptrollerErrorReporter, ExponentialNoError { /// @notice Emitted when an admin modifies a reward updater event RewardUpdaterModified(address _rewardUpdater); /// @notice Emitted when an admin supports a market event MarketListed(IOToken oToken); /// @notice Emitted when market autoCollaterize flag is set event MarketAutoCollateralized(bool isAutoCollateralized); /// @notice Emitted when an account enters a market event MarketEntered(IOToken oToken, address account); /// @notice Emitted when an account exits a market event MarketExited(IOToken oToken, address account); /// @notice Emitted when close factor is changed by admin event NewCloseFactor( uint256 oldCloseFactorMantissa, uint256 newCloseFactorMantissa ); /// @notice Emitted when a collateral factor is changed by admin event NewCollateralFactor( IOToken oToken, uint256 oldCollateralFactorMantissa, uint256 newCollateralFactorMantissa ); /// @notice Emitted when liquidation incentive is changed by admin event NewLiquidationIncentive( uint256 oldLiquidationIncentiveMantissa, uint256 newLiquidationIncentiveMantissa ); /// @notice Emitted when price oracle is changed event NewPriceOracle( PriceOracle oldPriceOracle, PriceOracle newPriceOracle ); /// @notice Emitted when pause guardian is changed event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian); /// @notice Emitted when an action is paused globally event ActionPausedGlobally(string action, bool pauseState); /// @notice Emitted when an action is paused on a market event ActionPaused(IOToken oToken, string action, bool pauseState); /// @notice Emitted when a new borrow-side Reward speed is calculated for a market event RewardBorrowSpeedUpdated(IOToken indexed oToken, uint256 newSpeed); /// @notice Emitted when a new supply-side Reward speed is calculated for a market event RewardSupplySpeedUpdated(IOToken indexed oToken, uint256 newSpeed); /// @notice Emitted when a new Reward speed is set for a contributor event ContributorRewardSpeedUpdated( address indexed contributor, uint256 newSpeed ); /// @notice Emitted when VIX is distributed to a supplier event DistributedSupplierReward( IOToken indexed oToken, address indexed supplier, uint256 tokenDelta, uint256 tokenSupplyIndex ); /// @notice Emitted when VIX is distributed to a borrower event DistributedBorrowerReward( IOToken indexed oToken, address indexed borrower, uint256 tokenDelta, uint256 tokenBorrowIndex ); /// @notice Emitted when borrow cap for a oToken is changed event NewBorrowCap(IOToken indexed oToken, uint256 newBorrowCap); /// @notice Emitted when borrow cap guardian is changed event NewBorrowCapGuardian( address oldBorrowCapGuardian, address newBorrowCapGuardian ); /// @notice Emitted when VIX is granted by admin event VixGranted(address recipient, uint256 amount); /// @notice Emitted when VIX rewards are being claimed for a user event VixClaimed(address recipient, uint256 amount); bool public constant override isComptroller = true; /// @notice The initial Reward index for a market uint224 public constant marketInitialIndex = 1e36; // closeFactorMantissa must be strictly greater than this value uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05 // closeFactorMantissa must not exceed this value uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9 // No collateralFactorMantissa may exceed this value uint256 internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9 address vixAddress; address public rewardUpdater; modifier onlyAdmin() { require(msg.sender == admin); _; } constructor() { admin = msg.sender; } /*** Assets You Are In ***/ /** * @notice Returns the assets an account has entered * @param account The address of the account to pull assets for * @return A dynamic list with the assets the account has entered */ function getAssetsIn(address account) external view returns (IOToken[] memory) { return accountAssets[account]; } /** * @notice Returns whether the given token is listed market * @param oToken The oToken to check * @return True if is market, otherwise false. */ function isMarket(address oToken) external view override returns (bool) { return markets[oToken].isListed; } /** * @notice Returns whether the given account is entered in the given asset * @param account The address of the account to check * @param oToken The oToken to check * @return True if the account is in the asset, otherwise false. */ function checkMembership(address account, IOToken oToken) external view returns (bool) { return accountMembership[address(oToken)][account]; } /** * @notice Add assets to be included in account liquidity calculation * @param oTokens The list of addresses of the oToken markets to be enabled * @return Success indicator for whether each corresponding market was entered */ function enterMarkets(address[] memory oTokens) public override returns (uint256[] memory) { uint256 len = oTokens.length; uint256[] memory results = new uint256[](len); for (uint256 i = 0; i < len; i++) { results[i] = uint256( addToMarketInternal(IOToken(oTokens[i]), msg.sender) ); } return results; } /** * @notice Add the market to the borrower's "assets in" for liquidity calculations * @param oToken The market to enter * @param borrower The address of the account to modify * @return Success indicator for whether the market was entered */ function addToMarketInternal(IOToken oToken, address borrower) internal returns (Error) { if (!markets[address(oToken)].isListed) { // market is not listed, cannot join return Error.MARKET_NOT_LISTED; } if (accountMembership[address(oToken)][borrower]) { // already joined return Error.NO_ERROR; } // survived the gauntlet, add to list // NOTE: we store these somewhat redundantly as a significant optimization // this avoids having to iterate through the list for the most common use cases // that is, only when we need to perform liquidity checks // and not whenever we want to check if an account is in a particular market accountMembership[address(oToken)][borrower] = true; accountAssets[borrower].push(oToken); emit MarketEntered(oToken, borrower); return Error.NO_ERROR; } /** * @notice Removes asset from sender's account liquidity calculation * @dev Sender must not have an outstanding borrow balance in the asset, * or be providing necessary collateral for an outstanding borrow. * @param oTokenAddress The address of the asset to be removed * @return Whether or not the account successfully exited the market */ function exitMarket(address oTokenAddress) external override returns (uint256) { IOToken oToken = IOToken(oTokenAddress); /* Get sender tokensHeld and amountOwed underlying from the oToken */ (uint256 oErr, uint256 tokensHeld, uint256 amountOwed, ) = oToken .getAccountSnapshot(msg.sender); require(oErr == 0, "exitMarket: getAccountSnapshot failed"); // semi-opaque error code /* Fail if the sender has a borrow balance */ if (amountOwed != 0) { return fail( Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED ); } /* Fail if the sender is not permitted to redeem all of their tokens */ uint256 allowed = redeemAllowedInternal( oTokenAddress, msg.sender, tokensHeld ); if (allowed != 0) { return failOpaque( Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed ); } /* Return true if the sender is not already ‘in’ the market */ if (!accountMembership[address(oToken)][msg.sender]) { return uint256(Error.NO_ERROR); } /* Set oToken account membership to false */ delete accountMembership[address(oToken)][msg.sender]; /* Delete oToken from the account’s list of assets */ // load into memory for faster iteration IOToken[] memory userAssetList = accountAssets[msg.sender]; uint256 len = userAssetList.length; uint256 assetIndex = len; for (uint256 i = 0; i < len; i++) { if (userAssetList[i] == oToken) { assetIndex = i; break; } } // We *must* have found the asset in the list or our redundant data structure is broken assert(assetIndex < len); // copy last item in list to location of item to be removed, reduce length by 1 IOToken[] storage storedList = accountAssets[msg.sender]; storedList[assetIndex] = storedList[storedList.length - 1]; storedList.pop(); emit MarketExited(oToken, msg.sender); return uint256(Error.NO_ERROR); } /*** Policy Hooks ***/ /** * @notice Checks if the account should be allowed to mint tokens in the given market * @param oToken The market to verify the mint against * @param minter The account which would get the minted tokens * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function mintAllowed( address oToken, address minter, uint256 mintAmount ) external override returns (uint256) { // Pausing is a very serious situation - we revert to sound the alarms mintAmount; // not used yet require(!guardianPaused[oToken].mint, "mint is paused"); if (!markets[oToken].isListed) { return uint256(Error.MARKET_NOT_LISTED); } if ( IOToken(oToken).balanceOf(minter) == 0 && markets[oToken].autoCollaterize ) { addToMarketInternal(IOToken(oToken), minter); } updateAndDistributeSupplierRewardsForToken(oToken, minter); return uint256(Error.NO_ERROR); } /** * @notice Validates mint and reverts on rejection. May emit logs. * @param oToken Asset being minted * @param minter The address minting the tokens * @param actualMintAmount The amount of the underlying asset being minted * @param mintTokens The number of tokens being minted */ function mintVerify( address oToken, address minter, uint256 actualMintAmount, uint256 mintTokens ) external override { // Shh - currently unused oToken; minter; actualMintAmount; mintTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the account should be allowed to redeem tokens in the given market * @param oToken The market to verify the redeem against * @param redeemer The account which would redeem the tokens * @param redeemTokens The number of oTokens to exchange for the underlying asset in the market * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function redeemAllowed( address oToken, address redeemer, uint256 redeemTokens ) external override returns (uint256) { uint256 allowed = redeemAllowedInternal(oToken, redeemer, redeemTokens); if (allowed != uint256(Error.NO_ERROR)) { return allowed; } updateAndDistributeSupplierRewardsForToken(oToken, redeemer); return uint256(Error.NO_ERROR); } function redeemAllowedInternal( address oToken, address redeemer, uint256 redeemTokens ) internal view returns (uint256) { if (!markets[oToken].isListed) { return uint256(Error.MARKET_NOT_LISTED); } /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */ if (!accountMembership[oToken][redeemer]) { return uint256(Error.NO_ERROR); } /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */ ( Error err, , uint256 shortfall ) = getHypotheticalAccountLiquidityInternal( redeemer, IOToken(oToken), redeemTokens, 0 ); if (err != Error.NO_ERROR) { return uint256(err); } if (shortfall > 0) { return uint256(Error.INSUFFICIENT_LIQUIDITY); } return uint256(Error.NO_ERROR); } /** * @notice Validates redeem and reverts on rejection. May emit logs. * @param oToken Asset being redeemed * @param redeemer The address redeeming the tokens * @param redeemAmount The amount of the underlying asset being redeemed * @param redeemTokens The number of tokens being redeemed */ function redeemVerify( address oToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens ) external pure override { // Shh - currently unused oToken; redeemer; // Require tokens is zero or amount is also zero require(redeemTokens != 0 || redeemAmount == 0, "redeemTokens zero"); } /** * @notice Checks if the account should be allowed to borrow the underlying asset of the given market * @param oToken The market to verify the borrow against * @param borrower The account which would borrow the asset * @param borrowAmount The amount of underlying the account would borrow * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function borrowAllowed( address oToken, address borrower, uint256 borrowAmount ) external override returns (uint256) { // Pausing is a very serious situation - we revert to sound the alarms require(!guardianPaused[oToken].borrow, "borrow is paused"); if (!markets[oToken].isListed) { return uint256(Error.MARKET_NOT_LISTED); } if (!accountMembership[oToken][borrower]) { // only oTokens may call borrowAllowed if borrower not in market require(msg.sender == oToken, "sender must be oToken"); // attempt to add borrower to the market Error err = addToMarketInternal(IOToken(msg.sender), borrower); if (err != Error.NO_ERROR) { return uint256(err); } // it should be impossible to break the important invariant assert(accountMembership[oToken][borrower]); } if (oracle.getUnderlyingPrice(IOToken(oToken)) == 0) { return uint256(Error.PRICE_ERROR); } uint256 borrowCap = borrowCaps[oToken]; // Borrow cap of 0 corresponds to unlimited borrowing if (borrowCap != 0) { require( (IOToken(oToken).totalBorrows() + borrowAmount) < borrowCap, "borrow cap reached" ); } ( Error err, , uint256 shortfall ) = getHypotheticalAccountLiquidityInternal( borrower, IOToken(oToken), 0, borrowAmount ); if (err != Error.NO_ERROR) { return uint256(err); } if (shortfall > 0) { return uint256(Error.INSUFFICIENT_LIQUIDITY); } // Keep the flywheel moving updateAndDistributeBorrowerRewardsForToken(oToken, borrower); return uint256(Error.NO_ERROR); } /** * @notice Validates borrow and reverts on rejection. May emit logs. * @param oToken Asset whose underlying is being borrowed * @param borrower The address borrowing the underlying * @param borrowAmount The amount of the underlying asset requested to borrow */ function borrowVerify( address oToken, address borrower, uint256 borrowAmount ) external override { // Shh - currently unused oToken; borrower; borrowAmount; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the account should be allowed to repay a borrow in the given market * @param oToken The market to verify the repay against * @param payer The account which would repay the asset * @param borrower The account which would borrowed the asset * @param repayAmount The amount of the underlying asset the account would repay * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function repayBorrowAllowed( address oToken, address payer, address borrower, uint256 repayAmount ) external override returns (uint256) { // Shh - currently unused payer; borrower; repayAmount; if (!markets[oToken].isListed) { return uint256(Error.MARKET_NOT_LISTED); } // Keep the flywheel moving updateAndDistributeBorrowerRewardsForToken(oToken, borrower); return uint256(Error.NO_ERROR); } /** * @notice Validates repayBorrow and reverts on rejection. May emit logs. * @param oToken Asset being repaid * @param payer The address repaying the borrow * @param borrower The address of the borrower * @param actualRepayAmount The amount of underlying being repaid */ function repayBorrowVerify( address oToken, address payer, address borrower, uint256 actualRepayAmount, uint256 borrowerIndex ) external { // Shh - currently unused oToken; payer; borrower; actualRepayAmount; borrowerIndex; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the liquidation should be allowed to occur * @param oTokenBorrowed Asset which was borrowed by the borrower * @param oTokenCollateral Asset which was used as collateral and will be seized * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param repayAmount The amount of underlying being repaid */ function liquidateBorrowAllowed( address oTokenBorrowed, address oTokenCollateral, address liquidator, address borrower, uint256 repayAmount ) external view override returns (uint256) { // Shh - currently unused liquidator; if ( !markets[oTokenBorrowed].isListed || !markets[oTokenCollateral].isListed ) { return uint256(Error.MARKET_NOT_LISTED); } uint256 borrowBalance = IOToken(oTokenBorrowed).borrowBalanceStored( borrower ); /* allow accounts to be liquidated if the market is deprecated */ if (isDeprecated(IOToken(oTokenBorrowed))) { require( borrowBalance >= repayAmount, "Can not repay more than the total borrow" ); } else { /* The borrower must have shortfall in order to be liquidatable */ ( Error err, , uint256 shortfall ) = getHypotheticalAccountLiquidityInternal( borrower, IOToken(address(0)), 0, 0 ); if (err != Error.NO_ERROR) { return uint256(err); } if (shortfall == 0) { return uint256(Error.INSUFFICIENT_SHORTFALL); } /* The liquidator may not repay more than what is allowed by the closeFactor */ uint256 maxClose = mul_ScalarTruncate( Exp({mantissa: closeFactorMantissa}), borrowBalance ); if (repayAmount > maxClose) { return uint256(Error.TOO_MUCH_REPAY); } } return uint256(Error.NO_ERROR); } /** * @notice Validates liquidateBorrow and reverts on rejection. May emit logs. * @param oTokenBorrowed Asset which was borrowed by the borrower * @param oTokenCollateral Asset which was used as collateral and will be seized * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param actualRepayAmount The amount of underlying being repaid */ function liquidateBorrowVerify( address oTokenBorrowed, address oTokenCollateral, address liquidator, address borrower, uint256 actualRepayAmount, uint256 seizeTokens ) external { // Shh - currently unused oTokenBorrowed; oTokenCollateral; liquidator; borrower; actualRepayAmount; seizeTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the seizing of assets should be allowed to occur * @param oTokenCollateral Asset which was used as collateral and will be seized * @param oTokenBorrowed Asset which was borrowed by the borrower * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param seizeTokens The number of collateral tokens to seize */ function seizeAllowed( address oTokenCollateral, address oTokenBorrowed, address liquidator, address borrower, uint256 seizeTokens ) external override returns (uint256) { // Pausing is a very serious situation - we revert to sound the alarms require(!seizeGuardianPaused, "seize is paused"); // Shh - currently unused seizeTokens; if ( !markets[oTokenCollateral].isListed || !markets[oTokenBorrowed].isListed ) { return uint256(Error.MARKET_NOT_LISTED); } if ( IOToken(oTokenCollateral).comptroller() != IOToken(oTokenBorrowed).comptroller() ) { return uint256(Error.COMPTROLLER_MISMATCH); } // Keep the flywheel moving updateRewardSupplyIndex(oTokenCollateral); distributeSupplierReward(oTokenCollateral, borrower); distributeSupplierReward(oTokenCollateral, liquidator); return uint256(Error.NO_ERROR); } /** * @notice Validates seize and reverts on rejection. May emit logs. * @param oTokenCollateral Asset which was used as collateral and will be seized * @param oTokenBorrowed Asset which was borrowed by the borrower * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param seizeTokens The number of collateral tokens to seize */ function seizeVerify( address oTokenCollateral, address oTokenBorrowed, address liquidator, address borrower, uint256 seizeTokens ) external override { // Shh - currently unused oTokenCollateral; oTokenBorrowed; liquidator; borrower; seizeTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the account should be allowed to transfer tokens in the given market * @param oToken The market to verify the transfer against * @param src The account which sources the tokens * @param dst The account which receives the tokens * @param transferTokens The number of oTokens to transfer * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function transferAllowed( address oToken, address src, address dst, uint256 transferTokens ) external override returns (uint256) { // Pausing is a very serious situation - we revert to sound the alarms require(!transferGuardianPaused, "transfer is paused"); // Currently the only consideration is whether or not // the src is allowed to redeem this many tokens uint256 allowed = redeemAllowedInternal(oToken, src, transferTokens); if (allowed != uint256(Error.NO_ERROR)) { return allowed; } // Keep the flywheel moving updateRewardSupplyIndex(oToken); distributeSupplierReward(oToken, src); distributeSupplierReward(oToken, dst); return uint256(Error.NO_ERROR); } /** * @notice Validates transfer and reverts on rejection. May emit logs. * @param oToken Asset being transferred * @param src The account which sources the tokens * @param dst The account which receives the tokens * @param transferTokens The number of oTokens to transfer */ function transferVerify( address oToken, address src, address dst, uint256 transferTokens ) external override { // Shh - currently unused oToken; src; dst; transferTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /*** Liquidity/Liquidation Calculations ***/ /** * @dev Local vars for avoiding stack-depth limits in calculating account liquidity. * Note that `oTokenBalance` is the number of oTokens the account owns in the market, * whereas `borrowBalance` is the amount of underlying that the account has borrowed. */ struct AccountLiquidityLocalVars { uint256 sumCollateral; uint256 sumBorrowPlusEffects; uint256 oTokenBalance; uint256 borrowBalance; uint256 exchangeRateMantissa; uint256 oraclePriceMantissa; Exp collateralFactor; Exp exchangeRate; Exp oraclePrice; Exp tokensToDenom; } /** * @notice Determine the current account liquidity wrt collateral requirements * @return (possible error code (semi-opaque), account liquidity in excess of collateral requirements, * account shortfall below collateral requirements) */ function getAccountLiquidity(address account) public view returns ( uint256, uint256, uint256 ) { ( Error err, uint256 liquidity, uint256 shortfall ) = getHypotheticalAccountLiquidityInternal( account, IOToken(address(0)), 0, 0 ); return (uint256(err), liquidity, shortfall); } /** * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed * @param oTokenModify The market to hypothetically redeem/borrow in * @param account The account to determine liquidity for * @param redeemTokens The number of tokens to hypothetically redeem * @param borrowAmount The amount of underlying to hypothetically borrow * @return (possible error code (semi-opaque), hypothetical account liquidity in excess of collateral requirements, * hypothetical account shortfall below collateral requirements) */ function getHypotheticalAccountLiquidity( address account, address oTokenModify, uint256 redeemTokens, uint256 borrowAmount ) public view returns ( uint256, uint256, uint256 ) { ( Error err, uint256 liquidity, uint256 shortfall ) = getHypotheticalAccountLiquidityInternal( account, IOToken(oTokenModify), redeemTokens, borrowAmount ); return (uint256(err), liquidity, shortfall); } /** * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed * @param oTokenModify The market to hypothetically redeem/borrow in * @param account The account to determine liquidity for * @param redeemTokens The number of tokens to hypothetically redeem * @param borrowAmount The amount of underlying to hypothetically borrow * @dev Note that we calculate the exchangeRateStored for each collateral oToken using stored data, * without calculating accumulated interest. * @return (possible error code, hypothetical account liquidity in excess of collateral requirements, * hypothetical account shortfall below collateral requirements) */ function getHypotheticalAccountLiquidityInternal( address account, IOToken oTokenModify, uint256 redeemTokens, uint256 borrowAmount ) internal view returns ( Error, uint256, uint256 ) { AccountLiquidityLocalVars memory vars; // Holds all our calculation results uint256 oErr; // For each asset the account is in IOToken[] memory assets = accountAssets[account]; for (uint256 i = 0; i < assets.length; i++) { IOToken asset = assets[i]; // Read the balances and exchange rate from the oToken ( oErr, vars.oTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa ) = asset.getAccountSnapshot(account); if (oErr != 0) { // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades return (Error.SNAPSHOT_ERROR, 0, 0); } vars.collateralFactor = Exp({ mantissa: markets[address(asset)].collateralFactorMantissa }); vars.exchangeRate = Exp({mantissa: vars.exchangeRateMantissa}); // Get the normalized price of the asset vars.oraclePriceMantissa = oracle.getUnderlyingPrice(asset); if (vars.oraclePriceMantissa == 0) { return (Error.PRICE_ERROR, 0, 0); } vars.oraclePrice = Exp({mantissa: vars.oraclePriceMantissa}); // Pre-compute a conversion factor from tokens -> ether (normalized price value) vars.tokensToDenom = mul_( mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice ); // sumCollateral += tokensToDenom * oTokenBalance vars.sumCollateral = mul_ScalarTruncateAddUInt( vars.tokensToDenom, vars.oTokenBalance, vars.sumCollateral ); // sumBorrowPlusEffects += oraclePrice * borrowBalance vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt( vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects ); // Calculate effects of interacting with oTokenModify if (asset == oTokenModify) { // redeem effect // sumBorrowPlusEffects += tokensToDenom * redeemTokens vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt( vars.tokensToDenom, redeemTokens, vars.sumBorrowPlusEffects ); // borrow effect // sumBorrowPlusEffects += oraclePrice * borrowAmount vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt( vars.oraclePrice, borrowAmount, vars.sumBorrowPlusEffects ); } } // These are safe, as the underflow condition is checked first unchecked { if (vars.sumCollateral > vars.sumBorrowPlusEffects) { return ( Error.NO_ERROR, vars.sumCollateral - vars.sumBorrowPlusEffects, 0 ); } else { return ( Error.NO_ERROR, 0, vars.sumBorrowPlusEffects - vars.sumCollateral ); } } } /** * @notice Calculate number of tokens of collateral asset to seize given an underlying amount * @dev Used in liquidation (called in oToken.liquidateBorrowFresh) * @param oTokenBorrowed The address of the borrowed oToken * @param oTokenCollateral The address of the collateral oToken * @param actualRepayAmount The amount of oTokenBorrowed underlying to convert into oTokenCollateral tokens * @return (errorCode, number of oTokenCollateral tokens to be seized in a liquidation) */ function liquidateCalculateSeizeTokens( address oTokenBorrowed, address oTokenCollateral, uint256 actualRepayAmount ) external view override returns (uint256, uint256) { /* Read oracle prices for borrowed and collateral markets */ uint256 priceBorrowedMantissa = oracle.getUnderlyingPrice( IOToken(oTokenBorrowed) ); uint256 priceCollateralMantissa = oracle.getUnderlyingPrice( IOToken(oTokenCollateral) ); if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) { return (uint256(Error.PRICE_ERROR), 0); } /* * Get the exchange rate and calculate the number of collateral tokens to seize: * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral * seizeTokens = seizeAmount / exchangeRate * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate) */ uint256 exchangeRateMantissa = IOToken(oTokenCollateral) .exchangeRateStored(); // Note: reverts on error Exp memory numerator = mul_( Exp({mantissa: liquidationIncentiveMantissa}), Exp({mantissa: priceBorrowedMantissa}) ); Exp memory denominator = mul_( Exp({mantissa: priceCollateralMantissa}), Exp({mantissa: exchangeRateMantissa}) ); Exp memory ratio = div_(numerator, denominator); uint256 seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount); return (uint256(Error.NO_ERROR), seizeTokens); } /*** Admin Functions ***/ /** * @notice Sets a new price oracle for the comptroller * @dev Admin function to set a new price oracle * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setPriceOracle(PriceOracle newOracle) public returns (uint256) { // Check caller is admin if (msg.sender != admin) { return fail( Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK ); } // Track the old oracle for the comptroller PriceOracle oldOracle = oracle; // Set comptroller's oracle to newOracle oracle = newOracle; // Emit NewPriceOracle(oldOracle, newOracle) emit NewPriceOracle(oldOracle, newOracle); return uint256(Error.NO_ERROR); } /** * @notice Sets the closeFactor used when liquidating borrows * @dev Admin function to set closeFactor * @param newCloseFactorMantissa New close factor, scaled by 1e18 * @return uint 0=success, otherwise a failure */ function _setCloseFactor(uint256 newCloseFactorMantissa) external onlyAdmin returns (uint256) { uint256 oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint256(Error.NO_ERROR); } /** * @notice Sets the collateralFactor for a market * @dev Admin function to set per-market collateralFactor * @param oToken The market to set the factor on * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18 * @return uint 0=success, otherwise a failure. (See ErrorReporter for details) */ function _setCollateralFactor( IOToken oToken, uint256 newCollateralFactorMantissa ) external returns (uint256) { // Check caller is admin if (msg.sender != admin) { return fail( Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK ); } // Verify market is listed Market storage market = markets[address(oToken)]; if (!market.isListed) { return fail( Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS ); } Exp memory newCollateralFactorExp = Exp({ mantissa: newCollateralFactorMantissa }); // Check collateral factor <= 0.9 Exp memory highLimit = Exp({mantissa: collateralFactorMaxMantissa}); if (lessThanExp(highLimit, newCollateralFactorExp)) { return fail( Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION ); } // If collateral factor != 0, fail if price == 0 if ( newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(oToken) == 0 ) { return fail( Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE ); } // Set market's collateral factor to new collateral factor, remember old value uint256 oldCollateralFactorMantissa = market.collateralFactorMantissa; market.collateralFactorMantissa = newCollateralFactorMantissa; // Emit event with asset, old collateral factor, and new collateral factor emit NewCollateralFactor( oToken, oldCollateralFactorMantissa, newCollateralFactorMantissa ); return uint256(Error.NO_ERROR); } /** * @notice Sets liquidationIncentive * @dev Admin function to set liquidationIncentive * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18 * @return uint 0=success, otherwise a failure. (See ErrorReporter for details) */ function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256) { // Check caller is admin if (msg.sender != admin) { return fail( Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK ); } // Save current value for use in log uint256 oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa; // Set liquidation incentive to new incentive liquidationIncentiveMantissa = newLiquidationIncentiveMantissa; // Emit event with old incentive, new incentive emit NewLiquidationIncentive( oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa ); return uint256(Error.NO_ERROR); } /** * @notice Add the market to the markets mapping and set it as listed * @dev Admin function to set isListed and add support for the market * @param oToken The address of the market (token) to list * @param _autoCollaterize Boolean value representing whether the market should have auto-collateralisation enabled * @return uint 0=success, otherwise a failure. (See enum Error for details) */ function _supportMarket(IOToken oToken, bool _autoCollaterize) external returns (uint256) { if (msg.sender != admin) { return fail( Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK ); } if (markets[address(oToken)].isListed) { return fail( Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS ); } oToken.isOToken(); // Sanity check to make sure its really a IOToken markets[address(oToken)] = Market({ isListed: true, autoCollaterize: _autoCollaterize, collateralFactorMantissa: 0 }); emit MarketAutoCollateralized(_autoCollaterize); allMarkets.push(oToken); _initializeMarket(address(oToken)); emit MarketListed(oToken); return uint256(Error.NO_ERROR); } function _initializeMarket(address oToken) internal { uint32 timestamp = safe32(getTimestamp()); MarketState storage supplyState = supplyState[oToken]; MarketState storage borrowState = borrowState[oToken]; /* * Update market state indices */ if (supplyState.index == 0) { // Initialize supply state index with default value supplyState.index = marketInitialIndex; } if (borrowState.index == 0) { // Initialize borrow state index with default value borrowState.index = marketInitialIndex; } /* * Update market state timestamps */ supplyState.timestamp = borrowState.timestamp = timestamp; } /** * @notice Set the given borrow caps for the given oToken markets. Borrowing that brings total borrows to or above borrow cap will revert. * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing. * @param oTokens The addresses of the markets (tokens) to change the borrow caps for * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing. */ function _setMarketBorrowCaps( IOToken[] calldata oTokens, uint256[] calldata newBorrowCaps ) external { require( msg.sender == admin || msg.sender == borrowCapGuardian, "only admin or borrowCapGuardian" ); uint256 numMarkets = oTokens.length; uint256 numBorrowCaps = newBorrowCaps.length; require( numMarkets != 0 && numMarkets == numBorrowCaps, "invalid input" ); for (uint256 i = 0; i < numMarkets; i++) { borrowCaps[address(oTokens[i])] = newBorrowCaps[i]; emit NewBorrowCap(oTokens[i], newBorrowCaps[i]); } } /** * @notice Admin function to change the Borrow Cap Guardian * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian */ function _setBorrowCapGuardian(address newBorrowCapGuardian) external onlyAdmin { // Save current value for inclusion in log address oldBorrowCapGuardian = borrowCapGuardian; // Store borrowCapGuardian with value newBorrowCapGuardian borrowCapGuardian = newBorrowCapGuardian; // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian) emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian); } /** * @notice Admin function to change the Pause Guardian * @param newPauseGuardian The address of the new Pause Guardian * @return uint 0=success, otherwise a failure. (See enum Error for details) */ function _setPauseGuardian(address newPauseGuardian) public returns (uint256) { if (msg.sender != admin) { return fail( Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK ); } // Save current value for inclusion in log address oldPauseGuardian = pauseGuardian; // Store pauseGuardian with value newPauseGuardian pauseGuardian = newPauseGuardian; // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian) emit NewPauseGuardian(oldPauseGuardian, pauseGuardian); return uint256(Error.NO_ERROR); } function onlyAdminOrGuardian() internal view { require( msg.sender == admin || msg.sender == pauseGuardian, "only pause guardian and admin" ); } function _setMintPaused(IOToken oToken, bool state) public returns (bool) { require( markets[address(oToken)].isListed, "cannot pause: market not listed" ); onlyAdminOrGuardian(); require(msg.sender == admin || state, "only admin can unpause"); guardianPaused[address(oToken)].mint = state; emit ActionPaused(oToken, "Mint", state); return state; } function _setBorrowPaused(IOToken oToken, bool state) public returns (bool) { require( markets[address(oToken)].isListed, "cannot pause: market not listed" ); onlyAdminOrGuardian(); require(msg.sender == admin || state, "only admin can unpause"); guardianPaused[address(oToken)].borrow = state; emit ActionPaused(oToken, "Borrow", state); return state; } function _setTransferPaused(bool state) public returns (bool) { onlyAdminOrGuardian(); require(msg.sender == admin || state, "only admin can unpause"); transferGuardianPaused = state; emit ActionPausedGlobally("Transfer", state); return state; } function _setSeizePaused(bool state) public returns (bool) { onlyAdminOrGuardian(); require(msg.sender == admin || state, "only admin can unpause"); seizeGuardianPaused = state; emit ActionPausedGlobally("Seize", state); return state; } function _become(IUnitroller unitroller) public { require( msg.sender == unitroller.admin(), "only unitroller admin can _become" ); require( unitroller._acceptImplementation() == 0, "change not authorized" ); } /** * @notice Checks caller is admin, or this contract is becoming the new implementation */ function adminOrInitializing() internal view returns (bool) { return msg.sender == admin || msg.sender == comptrollerImplementation; } /*** VIX Distribution ***/ /** * @notice Set Reward speed for a single market * @param oToken The market whose Reward speed to update * @param supplySpeed New supply-side Reward speed for market * @param borrowSpeed New borrow-side Reward speed for market */ function setRewardSpeedInternal( IOToken oToken, uint256 supplySpeed, uint256 borrowSpeed ) internal { require(markets[address(oToken)].isListed, "0VIX market is not listed"); if (rewardSupplySpeeds[address(oToken)] != supplySpeed) { // Supply speed updated so let's update supply state to ensure that // 1. Reward accrued properly for the old speed, and // 2. Reward accrued at the new speed starts after this block. updateRewardSupplyIndex(address(oToken)); // Update speed and emit event rewardSupplySpeeds[address(oToken)] = supplySpeed; emit RewardSupplySpeedUpdated(oToken, supplySpeed); } if (rewardBorrowSpeeds[address(oToken)] != borrowSpeed) { // Borrow speed updated so let's update borrow state to ensure that // 1. Reward accrued properly for the old speed, and // 2. Reward accrued at the new speed starts after this block. Exp memory borrowIndex = Exp({mantissa: oToken.borrowIndex()}); updateRewardBorrowIndex(address(oToken), borrowIndex); // Update speed and emit event rewardBorrowSpeeds[address(oToken)] = borrowSpeed; emit RewardBorrowSpeedUpdated(oToken, borrowSpeed); } } function updateAndDistributeSupplierRewardsForToken( address oToken, address account ) public override { updateRewardSupplyIndex(oToken); distributeSupplierReward(oToken, account); } function updateAndDistributeBorrowerRewardsForToken( address oToken, address borrower ) public override { Exp memory marketBorrowIndex = Exp({ mantissa: IOToken(oToken).borrowIndex() }); updateRewardBorrowIndex(oToken, marketBorrowIndex); distributeBorrowerReward(oToken, borrower, marketBorrowIndex); } /** * @notice Accrue Reward to the market by updating the supply index * @param oToken The market whose supply index to update * @dev Index is a cumulative sum of the Reward per oToken accrued. */ function updateRewardSupplyIndex(address oToken) internal { MarketState storage supplyState = supplyState[oToken]; uint256 supplySpeed = rewardSupplySpeeds[oToken]; uint32 timestamp = safe32(getTimestamp()); uint256 deltaBlocks = uint256(timestamp) - uint256(supplyState.timestamp); if (deltaBlocks > 0) { if (supplySpeed > 0) { uint256 supplyTokens = address(boostManager) == address(0) ? IOToken(oToken).totalSupply() : boostManager.boostedTotalSupply(oToken); uint256 rewardAccrued = deltaBlocks * supplySpeed; Double memory ratio = supplyTokens > 0 ? fraction(rewardAccrued, supplyTokens) : Double({mantissa: 0}); supplyState.index = safe224( add_(Double({mantissa: supplyState.index}), ratio).mantissa ); } supplyState.timestamp = timestamp; } } /** * @notice Accrue Reward to the market by updating the borrow index * @param oToken The market whose borrow index to update * @dev Index is a cumulative sum of the Reward per oToken accrued. */ function updateRewardBorrowIndex( address oToken, Exp memory marketBorrowIndex ) internal { MarketState storage borrowState = borrowState[oToken]; uint256 borrowSpeed = rewardBorrowSpeeds[oToken]; uint32 timestamp = safe32(getTimestamp()); uint256 deltaBlocks = uint256(timestamp) - uint256(borrowState.timestamp); if (deltaBlocks > 0) { if (borrowSpeed > 0) { uint256 borrowAmount = div_( address(boostManager) == address(0) ? IOToken(oToken).totalBorrows() : boostManager.boostedTotalBorrows(oToken), marketBorrowIndex ); uint256 rewardAccrued = deltaBlocks * borrowSpeed; Double memory ratio = borrowAmount > 0 ? fraction(rewardAccrued, borrowAmount) : Double({mantissa: 0}); borrowState.index = safe224( add_(Double({mantissa: borrowState.index}), ratio).mantissa ); } borrowState.timestamp = timestamp; } } /** * @notice Calculate Reward accrued by a supplier * @param oToken The market in which the supplier is interacting * @param supplier The address of the supplier to distribute Reward to */ function distributeSupplierReward(address oToken, address supplier) internal { // TODO: Don't distribute supplier Reward if the user is not in the supplier market. // This check should be as gas efficient as possible as distributeSupplierReward is called in many places. // - We really don't want to call an external contract as that's quite expensive. MarketState storage supplyState = supplyState[oToken]; uint256 supplyIndex = supplyState.index; uint256 supplierIndex = rewardSupplierIndex[oToken][supplier]; // Update supplier's index to the current index since we are distributing accrued VIX rewardSupplierIndex[oToken][supplier] = supplyIndex; if (supplierIndex == 0 && supplyIndex >= marketInitialIndex) { // Covers the case where users supplied tokens before the market's supply state index was set. // Rewards the user with Reward accrued from the start of when supplier rewards were first // set for the market. supplierIndex = marketInitialIndex; } // Calculate change in the cumulative sum of the Reward per oToken accrued Double memory deltaIndex = Double({ mantissa: supplyIndex - supplierIndex }); uint256 supplierTokens = address(boostManager) == address(0) ? IOToken(oToken).balanceOf(supplier) : boostManager.boostedSupplyBalanceOf( oToken, supplier ); // Calculate Reward accrued: oTokenAmount * accruedPerOToken uint256 supplierDelta = mul_(supplierTokens, deltaIndex); uint256 supplierAccrued = rewardAccrued[supplier] + supplierDelta; rewardAccrued[supplier] = supplierAccrued; emit DistributedSupplierReward( IOToken(oToken), supplier, supplierDelta, supplyIndex ); } /** * @notice Calculate Reward accrued by a borrower * @dev Borrowers will not begin to accrue until after the first interaction with the protocol. * @param oToken The market in which the borrower is interacting * @param borrower The address of the borrower to distribute Reward to */ function distributeBorrowerReward( address oToken, address borrower, Exp memory marketBorrowIndex ) internal { // TODO: Don't distribute supplier Reward if the user is not in the borrower market. // This check should be as gas efficient as possible as distributeBorrowerReward is called in many places. // - We really don't want to call an external contract as that's quite expensive. MarketState storage borrowState = borrowState[oToken]; uint256 borrowIndex = borrowState.index; uint256 borrowerIndex = rewardBorrowerIndex[oToken][borrower]; // Update borrowers's index to the current index since we are distributing accrued VIX rewardBorrowerIndex[oToken][borrower] = borrowIndex; if (borrowerIndex == 0 && borrowIndex >= marketInitialIndex) { // Covers the case where users borrowed tokens before the market's borrow state index was set. // Rewards the user with Reward accrued from the start of when borrower rewards were first // set for the market. borrowerIndex = marketInitialIndex; } // Calculate change in the cumulative sum of the Reward per borrowed unit accrued Double memory deltaIndex = Double({ mantissa: borrowIndex - borrowerIndex }); uint256 borrowerAmount = div_( address(boostManager) == address(0) ? IOToken(oToken).borrowBalanceStored(borrower) : boostManager.boostedBorrowBalanceOf(oToken, borrower), marketBorrowIndex ); // Calculate Reward accrued: oTokenAmount * accruedPerBorrowedUnit uint256 borrowerDelta = mul_(borrowerAmount, deltaIndex); uint256 borrowerAccrued = rewardAccrued[borrower] + borrowerDelta; rewardAccrued[borrower] = borrowerAccrued; emit DistributedBorrowerReward( IOToken(oToken), borrower, borrowerDelta, borrowIndex ); } /** * @notice Calculate additional accrued Reward for a contributor since last accrual * @param contributor The address to calculate contributor rewards for */ function updateContributorRewards(address contributor) public { uint256 rewardSpeed = rewardContributorSpeeds[contributor]; uint256 timestamp = getTimestamp(); uint256 deltaBlocks = timestamp - lastContributorTimestamp[contributor]; if (deltaBlocks > 0 && rewardSpeed > 0) { uint256 newAccrued = deltaBlocks * rewardSpeed; uint256 contributorAccrued = rewardAccrued[contributor] + newAccrued; rewardAccrued[contributor] = contributorAccrued; lastContributorTimestamp[contributor] = timestamp; } } /** * @notice Claim all the reward accrued by holder in all markets * @param holder The address to claim Reward for */ function claimReward(address holder) public returns (uint256) { for (uint256 i = 0; i < allMarkets.length; i++) { IOToken oToken = allMarkets[i]; require(markets[address(oToken)].isListed, "market must be listed"); updateAndDistributeBorrowerRewardsForToken(address(oToken), holder); updateAndDistributeSupplierRewardsForToken(address(oToken), holder); } uint256 totalReward = rewardAccrued[holder]; rewardAccrued[holder] = grantRewardInternal(holder, totalReward); return totalReward; } /** * @notice Claim all the reward accrued by holder in the specified markets * @param holder The address to claim Reward for * @param oTokens The list of markets to claim Reward in */ function claimRewards(address holder, IOToken[] memory oTokens) public { // todo: undo _ address[] memory holders = new address[](1); holders[0] = holder; claimRewards(holders, oTokens, true, true); } /** * @notice Claim all reward accrued by the holders * @param holders The addresses to claim Reward for * @param oTokens The list of markets to claim Reward in * @param borrowers Whether or not to claim Reward earned by borrowing * @param suppliers Whether or not to claim Reward earned by supplying */ function claimRewards( address[] memory holders, IOToken[] memory oTokens, bool borrowers, bool suppliers ) public { for (uint256 i = 0; i < oTokens.length; i++) { IOToken oToken = oTokens[i]; require(markets[address(oToken)].isListed, "market must be listed"); if (borrowers) { Exp memory borrowIndex = Exp({mantissa: oToken.borrowIndex()}); updateRewardBorrowIndex(address(oToken), borrowIndex); for (uint256 j = 0; j < holders.length; j++) { distributeBorrowerReward( address(oToken), holders[j], borrowIndex ); } } if (suppliers) { updateRewardSupplyIndex(address(oToken)); for (uint256 j = 0; j < holders.length; j++) { distributeSupplierReward(address(oToken), holders[j]); } } } for (uint256 j = 0; j < holders.length; j++) { rewardAccrued[holders[j]] = grantRewardInternal( holders[j], rewardAccrued[holders[j]] ); } } /** * @notice Transfer Reward to the user * @dev Note: If there is not enough VIX, we do not perform the transfer all. * @param user The address of the user to transfer Reward to * @param amount The amount of Reward to (possibly) transfer * @return The amount of Reward which was NOT transferred to the user */ function grantRewardInternal(address user, uint256 amount) internal returns (uint256) { I0vix vix = I0vix(getVixAddress()); if (address(vix) != address(0)) { uint256 rewardRemaining = vix.balanceOf(address(this)); if (amount > 0 && amount <= rewardRemaining) { vix.transfer(user, amount); emit VixClaimed(user, amount); return 0; } } return amount; } /*** VIX Distribution Admin ***/ /** * @notice Transfer Reward to the recipient * @dev Note: If there is not enough VIX, we do not perform the transfer all. * @param recipient The address of the recipient to transfer Reward to * @param amount The amount of Reward to (possibly) transfer */ function _grantReward(address recipient, uint256 amount) public { require(adminOrInitializing(), "only admin can grant reward"); uint256 amountLeft = grantRewardInternal(recipient, amount); require(amountLeft == 0, "insufficient token for grant"); emit VixGranted(recipient, amount); } /** * @notice Set Reward borrow and supply speeds for the specified markets. * @param oTokens The markets whose Reward speed to update. * @param supplySpeeds New supply-side Reward speed for the corresponding market. * @param borrowSpeeds New borrow-side Reward speed for the corresponding market. */ function _setRewardSpeeds( address[] memory oTokens, uint256[] memory supplySpeeds, uint256[] memory borrowSpeeds ) public override { require( msg.sender == admin || msg.sender == rewardUpdater, "only admin can set reward speed" ); uint256 numTokens = oTokens.length; require( numTokens == supplySpeeds.length && numTokens == borrowSpeeds.length, "Comptroller::_setRewardSpeeds invalid input" ); for (uint256 i = 0; i < numTokens; ++i) { setRewardSpeedInternal( IOToken(oTokens[i]), supplySpeeds[i], borrowSpeeds[i] ); } } /** * @notice Set Reward speed for a single contributor * @param contributor The contributor whose Reward speed to update * @param rewardSpeed New Reward speed for contributor */ function _setContributorRewardSpeed( address contributor, uint256 rewardSpeed ) public { require( msg.sender == admin || msg.sender == rewardUpdater, "only admin can set reward speed" ); // note that Reward speed could be set to 0 to halt liquidity rewards for a contributor updateContributorRewards(contributor); if (rewardSpeed == 0) { // release storage delete lastContributorTimestamp[contributor]; } else { lastContributorTimestamp[contributor] = getTimestamp(); } rewardContributorSpeeds[contributor] = rewardSpeed; emit ContributorRewardSpeedUpdated(contributor, rewardSpeed); } /** * @notice Return all of the markets * @dev The automatic getter may be used to access an individual market. * @return The list of market addresses */ function getAllMarkets() public view override returns (IOToken[] memory) { return allMarkets; } /** * @notice Returns true if the given oToken market has been deprecated * @dev All borrows in a deprecated oToken market can be immediately liquidated * @param oToken The market to check if deprecated */ function isDeprecated(IOToken oToken) public view returns (bool) { return markets[address(oToken)].collateralFactorMantissa == 0 && guardianPaused[address(oToken)].borrow == true && oToken.reserveFactorMantissa() == 1e18; } function getTimestamp() public view returns (uint256) { return block.timestamp; } /** * @notice Return the address of the 0VIX token * @return The address of VIX */ function getVixAddress() public view returns (address) { return vixAddress; } /** * @notice Set the 0VIX token address */ function setVixAddress(address newVixAddress) public onlyAdmin { vixAddress = newVixAddress; } /** * @notice Set the booster manager address */ function setBoostManager(address newBoostManager) public onlyAdmin { boostManager = IBoostManager(newBoostManager); } function getBoostManager() external view override returns (address) { return address(boostManager); } function setRewardUpdater(address _rewardUpdater) public onlyAdmin { rewardUpdater = _rewardUpdater; emit RewardUpdaterModified(_rewardUpdater); } function setAutoCollaterize(address market, bool flag) external onlyAdmin { markets[market].autoCollaterize = flag; emit MarketAutoCollateralized(flag); } /** * @notice payable function needed to receive MATIC */ receive() external payable {} }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; contract ComptrollerErrorReporter { enum Error { NO_ERROR, UNAUTHORIZED, COMPTROLLER_MISMATCH, INSUFFICIENT_SHORTFALL, INSUFFICIENT_LIQUIDITY, INVALID_CLOSE_FACTOR, INVALID_COLLATERAL_FACTOR, INVALID_LIQUIDATION_INCENTIVE, MARKET_NOT_ENTERED, // no longer possible MARKET_NOT_LISTED, MARKET_ALREADY_LISTED, MATH_ERROR, NONZERO_BORROW_BALANCE, PRICE_ERROR, REJECTION, SNAPSHOT_ERROR, TOO_MANY_ASSETS, TOO_MUCH_REPAY } enum FailureInfo { ACCEPT_ADMIN_PENDING_ADMIN_CHECK, ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK, EXIT_MARKET_BALANCE_OWED, EXIT_MARKET_REJECTION, SET_CLOSE_FACTOR_OWNER_CHECK, SET_CLOSE_FACTOR_VALIDATION, SET_COLLATERAL_FACTOR_OWNER_CHECK, SET_COLLATERAL_FACTOR_NO_EXISTS, SET_COLLATERAL_FACTOR_VALIDATION, SET_COLLATERAL_FACTOR_WITHOUT_PRICE, SET_IMPLEMENTATION_OWNER_CHECK, SET_LIQUIDATION_INCENTIVE_OWNER_CHECK, SET_LIQUIDATION_INCENTIVE_VALIDATION, SET_MAX_ASSETS_OWNER_CHECK, SET_PENDING_ADMIN_OWNER_CHECK, SET_PENDING_IMPLEMENTATION_OWNER_CHECK, SET_PRICE_ORACLE_OWNER_CHECK, SUPPORT_MARKET_EXISTS, SUPPORT_MARKET_OWNER_CHECK, SET_PAUSE_GUARDIAN_OWNER_CHECK } /** * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary * contract-specific code that enables us to report opaque error codes from upgradeable contracts. **/ event Failure(uint error, uint info, uint detail); /** * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator */ function fail(Error err, FailureInfo info) internal returns (uint) { emit Failure(uint(err), uint(info), 0); return uint(err); } /** * @dev use this when reporting an opaque error from an upgradeable collaborator contract */ function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) { emit Failure(uint(err), uint(info), opaqueError); return uint(err); } } contract TokenErrorReporter { enum Error { NO_ERROR, UNAUTHORIZED, BAD_INPUT, COMPTROLLER_REJECTION, COMPTROLLER_CALCULATION_ERROR, INTEREST_RATE_MODEL_ERROR, INVALID_ACCOUNT_PAIR, INVALID_CLOSE_AMOUNT_REQUESTED, INVALID_COLLATERAL_FACTOR, MATH_ERROR, MARKET_NOT_FRESH, MARKET_NOT_LISTED, TOKEN_INSUFFICIENT_ALLOWANCE, TOKEN_INSUFFICIENT_BALANCE, TOKEN_INSUFFICIENT_CASH, TOKEN_TRANSFER_IN_FAILED, TOKEN_TRANSFER_OUT_FAILED } /* * Note: FailureInfo (but not Error) is kept in alphabetical order * This is because FailureInfo grows significantly faster, and * the order of Error has some meaning, while the order of FailureInfo * is entirely arbitrary. */ enum FailureInfo { ACCEPT_ADMIN_PENDING_ADMIN_CHECK, ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED, ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED, ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED, ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED, ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED, ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED, BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, BORROW_ACCRUE_INTEREST_FAILED, BORROW_CASH_NOT_AVAILABLE, BORROW_FRESHNESS_CHECK, BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED, BORROW_MARKET_NOT_LISTED, BORROW_COMPTROLLER_REJECTION, LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED, LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED, LIQUIDATE_COLLATERAL_FRESHNESS_CHECK, LIQUIDATE_COMPTROLLER_REJECTION, LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED, LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX, LIQUIDATE_CLOSE_AMOUNT_IS_ZERO, LIQUIDATE_FRESHNESS_CHECK, LIQUIDATE_LIQUIDATOR_IS_BORROWER, LIQUIDATE_REPAY_BORROW_FRESH_FAILED, LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER, LIQUIDATE_SEIZE_TOO_MUCH, MINT_ACCRUE_INTEREST_FAILED, MINT_COMPTROLLER_REJECTION, MINT_EXCHANGE_CALCULATION_FAILED, MINT_EXCHANGE_RATE_READ_FAILED, MINT_FRESHNESS_CHECK, MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, MINT_TRANSFER_IN_FAILED, MINT_TRANSFER_IN_NOT_POSSIBLE, REDEEM_ACCRUE_INTEREST_FAILED, REDEEM_COMPTROLLER_REJECTION, REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED, REDEEM_EXCHANGE_RATE_READ_FAILED, REDEEM_FRESHNESS_CHECK, REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, REDEEM_TRANSFER_OUT_NOT_POSSIBLE, REDUCE_RESERVES_ACCRUE_INTEREST_FAILED, REDUCE_RESERVES_ADMIN_CHECK, REDUCE_RESERVES_CASH_NOT_AVAILABLE, REDUCE_RESERVES_FRESH_CHECK, REDUCE_RESERVES_VALIDATION, REPAY_BEHALF_ACCRUE_INTEREST_FAILED, REPAY_BORROW_ACCRUE_INTEREST_FAILED, REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, REPAY_BORROW_COMPTROLLER_REJECTION, REPAY_BORROW_FRESHNESS_CHECK, REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED, REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE, SET_COLLATERAL_FACTOR_OWNER_CHECK, SET_COLLATERAL_FACTOR_VALIDATION, SET_COMPTROLLER_OWNER_CHECK, SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED, SET_INTEREST_RATE_MODEL_FRESH_CHECK, SET_INTEREST_RATE_MODEL_OWNER_CHECK, SET_MAX_ASSETS_OWNER_CHECK, SET_ORACLE_MARKET_NOT_LISTED, SET_PENDING_ADMIN_OWNER_CHECK, SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED, SET_RESERVE_FACTOR_ADMIN_CHECK, SET_RESERVE_FACTOR_FRESH_CHECK, SET_RESERVE_FACTOR_BOUNDS_CHECK, TRANSFER_COMPTROLLER_REJECTION, TRANSFER_NOT_ALLOWED, TRANSFER_NOT_ENOUGH, TRANSFER_TOO_MUCH, ADD_RESERVES_ACCRUE_INTEREST_FAILED, ADD_RESERVES_FRESH_CHECK, ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE, SET_PROTOCOL_SEIZE_SHARE_ACCRUE_INTEREST_FAILED, SET_PROTOCOL_SEIZE_SHARE_OWNER_CHECK, SET_PROTOCOL_SEIZE_SHARE_FRESH_CHECK } /** * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary * contract-specific code that enables us to report opaque error codes from upgradeable contracts. **/ event Failure(uint error, uint info, uint detail); /** * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator */ function fail(Error err, FailureInfo info) internal returns (uint) { emit Failure(uint(err), uint(info), 0); return uint(err); } /** * @dev use this when reporting an opaque error from an upgradeable collaborator contract */ function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) { emit Failure(uint(err), uint(info), opaqueError); return uint(err); } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title Exponential module for storing fixed-precision decimals * @author 0VIX * @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places. * Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is: * `Exp({mantissa: 5100000000000000000})`. */ contract ExponentialNoError { uint constant expScale = 1e18; uint constant doubleScale = 1e36; uint constant halfExpScale = expScale/2; uint constant mantissaOne = expScale; struct Exp { uint mantissa; } struct Double { uint mantissa; } /** * @dev Truncates the given exp to a whole number value. * For example, truncate(Exp{mantissa: 15 * expScale}) = 15 */ function truncate(Exp memory exp) pure internal returns (uint) { // Note: We are not using careful math here as we're performing a division that cannot fail return exp.mantissa / expScale; } /** * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer. */ function mul_ScalarTruncate(Exp memory a, uint scalar) pure internal returns (uint) { return truncate(mul_(a, scalar)); } /** * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer. */ function mul_ScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) pure internal returns (uint) { return truncate(mul_(a, scalar)) + addend; } /** * @dev Checks if first Exp is less than second Exp. */ function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa < right.mantissa; } /** * @dev Checks if left Exp <= right Exp. */ function lessThanOrEqualExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa <= right.mantissa; } /** * @dev Checks if left Exp > right Exp. */ function greaterThanExp(Exp memory left, Exp memory right) pure internal returns (bool) { return left.mantissa > right.mantissa; } /** * @dev returns true if Exp is exactly zero */ function isZeroExp(Exp memory value) pure internal returns (bool) { return value.mantissa == 0; } function safe224(uint n) pure internal returns (uint224) { require(n < 2**224, "safe224 overflow"); return uint224(n); } function safe32(uint n) pure internal returns (uint32) { require(n < 2**32, "safe32 overflow"); return uint32(n); } function add_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: a.mantissa + b.mantissa}); } function add_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: a.mantissa + b.mantissa}); } function add_(uint a, uint b, string memory errorMessage) pure internal returns (uint c) { unchecked { require((c = a + b ) >= a, errorMessage); } } function sub_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: a.mantissa - b.mantissa}); } function sub_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: a.mantissa - b.mantissa}); } function sub_(uint a, uint b, string memory errorMessage) pure internal returns (uint c) { unchecked { require((c = a - b) <= a, errorMessage); } } function mul_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: (a.mantissa * b.mantissa) / expScale}); } function mul_(Exp memory a, uint b) pure internal returns (Exp memory) { return Exp({mantissa: a.mantissa * b}); } function mul_(uint a, Exp memory b) pure internal returns (uint) { return (a * b.mantissa) / expScale; } function mul_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: (a.mantissa * b.mantissa) / doubleScale}); } function mul_(Double memory a, uint b) pure internal returns (Double memory) { return Double({mantissa: a.mantissa * b}); } function mul_(uint a, Double memory b) pure internal returns (uint) { return (a * b.mantissa) / doubleScale; } function mul_(uint a, uint b, string memory errorMessage) pure internal returns (uint c) { unchecked { require(a == 0 || (c = a * b) / a == b, errorMessage); } } function div_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: (a.mantissa * expScale) / b.mantissa}); } function div_(Exp memory a, uint b) pure internal returns (Exp memory) { return Exp({mantissa: a.mantissa / b}); } function div_(uint a, Exp memory b) pure internal returns (uint) { return (a * expScale) / b.mantissa; } function div_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: (a.mantissa * doubleScale) / b.mantissa}); } function div_(Double memory a, uint b) pure internal returns (Double memory) { return Double({mantissa: a.mantissa / b}); } function div_(uint a, Double memory b) pure internal returns (uint) { return (a * doubleScale) / b.mantissa; } function div_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { unchecked { require(b > 0, errorMessage); return a / b; } } function fraction(uint a, uint b) pure internal returns (Double memory) { return Double({mantissa: (a * doubleScale) / b}); } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "../otokens/interfaces/IOToken.sol"; import "../PriceOracle.sol"; interface IComptroller { /// @notice Indicator that this is a Comptroller contract (for inspection) function isComptroller() external view returns(bool); /*** Assets You Are In ***/ function enterMarkets(address[] calldata oTokens) external returns (uint[] memory); function exitMarket(address oToken) external returns (uint); /*** Policy Hooks ***/ function mintAllowed(address oToken, address minter, uint mintAmount) external returns (uint); function mintVerify(address oToken, address minter, uint mintAmount, uint mintTokens) external; function redeemAllowed(address oToken, address redeemer, uint redeemTokens) external returns (uint); function redeemVerify(address oToken, address redeemer, uint redeemAmount, uint redeemTokens) external; function borrowAllowed(address oToken, address borrower, uint borrowAmount) external returns (uint); function borrowVerify(address oToken, address borrower, uint borrowAmount) external; function repayBorrowAllowed( address oToken, address payer, address borrower, uint repayAmount) external returns (uint); function liquidateBorrowAllowed( address oTokenBorrowed, address oTokenCollateral, address liquidator, address borrower, uint repayAmount) external returns (uint); function seizeAllowed( address oTokenCollateral, address oTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external returns (uint); function seizeVerify( address oTokenCollateral, address oTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external; function transferAllowed(address oToken, address src, address dst, uint transferTokens) external returns (uint); function transferVerify(address oToken, address src, address dst, uint transferTokens) external; /*** Liquidity/Liquidation Calculations ***/ function liquidateCalculateSeizeTokens( address oTokenBorrowed, address oTokenCollateral, uint repayAmount) external view returns (uint, uint); function isMarket(address market) external view returns(bool); function getBoostManager() external view returns(address); function getAllMarkets() external view returns(IOToken[] memory); function oracle() external view returns(PriceOracle); function updateAndDistributeSupplierRewardsForToken( address oToken, address account ) external; function updateAndDistributeBorrowerRewardsForToken( address oToken, address borrower ) external; function _setRewardSpeeds( address[] memory oTokens, uint256[] memory supplySpeeds, uint256[] memory borrowSpeeds ) external; }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./otokens/interfaces/IOToken.sol"; import "./PriceOracle.sol"; import "./vote-escrow/interfaces/IBoostManager.sol"; import "./interfaces/IComptroller.sol"; import "./UnitrollerAdminStorage.sol"; abstract contract ComptrollerV1Storage is IComptroller, UnitrollerAdminStorage { /** * @notice Oracle which gives the price of any given asset */ PriceOracle public override oracle; /** * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow */ uint public closeFactorMantissa; /** * @notice Multiplier representing the discount on collateral that a liquidator receives */ uint public liquidationIncentiveMantissa; /** * @notice Max number of assets a single account can participate in (borrow or use as collateral) */ uint public maxAssets; /** * @notice Per-account mapping of "assets you are in", capped by maxAssets */ mapping(address => IOToken[]) public accountAssets; /// @notice Per-market mapping of "accounts in this asset" mapping(address => mapping(address => bool)) public accountMembership; } abstract contract ComptrollerV2Storage is ComptrollerV1Storage { struct Market { /// @notice Whether or not this market is listed bool isListed; bool autoCollaterize; /** * @notice Multiplier representing the most one can borrow against their collateral in this market. * For instance, 0.9 to allow borrowing 90% of collateral value. * Must be between 0 and 1, and stored as a mantissa. */ uint collateralFactorMantissa; } /** * @notice Official mapping of oTokens -> Market metadata * @dev Used e.g. to determine if a market is supported */ mapping(address => Market) public markets; /** * @notice The Pause Guardian can pause certain actions as a safety mechanism. * Actions which allow users to remove their own assets cannot be paused. * Liquidation / seizing / transfer can only be paused globally, not by market. */ address public pauseGuardian; bool public _mintGuardianPaused; bool public _borrowGuardianPaused; bool public transferGuardianPaused; bool public seizeGuardianPaused; struct PauseData { bool mint; bool borrow; } mapping(address => PauseData) public guardianPaused; } abstract contract ComptrollerV3Storage is ComptrollerV2Storage { struct MarketState { /// @notice The market's last updated tokenBorrowIndex or tokenSupplyIndex uint224 index; /// @notice The timestamp the index was last updated at uint32 timestamp; } /// @notice A list of all markets IOToken[] public allMarkets; /// @notice The rate at which the flywheel distributes VIX, per second uint public compRate; /// @notice The portion of compRate that each market currently receives mapping(address => uint) public rewardSpeeds; /// @notice The 0VIX market supply state for each market mapping(address => MarketState) public supplyState; /// @notice The 0VIX market borrow state for each market mapping(address => MarketState) public borrowState; /// @notice The 0VIX borrow index for each market for each supplier as of the last time they accrued VIX mapping(address => mapping(address => uint)) public rewardSupplierIndex; /// @notice The 0VIX borrow index for each market for each borrower as of the last time they accrued VIX mapping(address => mapping(address => uint)) public rewardBorrowerIndex; /// @notice The VIX accrued but not yet transferred to each user mapping(address => uint) public rewardAccrued; } abstract contract ComptrollerV4Storage is ComptrollerV3Storage { // @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market. address public borrowCapGuardian; // @notice Borrow caps enforced by borrowAllowed for each oToken address. Defaults to zero which corresponds to unlimited borrowing. mapping(address => uint) public borrowCaps; } abstract contract ComptrollerV5Storage is ComptrollerV4Storage { /// @notice The portion of VIX that each contributor receives per second mapping(address => uint) public rewardContributorSpeeds; /// @notice Last timestamp at which a contributor's VIX rewards have been allocated mapping(address => uint) public lastContributorTimestamp; } abstract contract ComptrollerV6Storage is ComptrollerV5Storage { /// @notice The rate at which VIX is distributed to the corresponding borrow market (per second) mapping(address => uint) public rewardBorrowSpeeds; /// @notice The rate at which VIX is distributed to the corresponding supply market (per second) mapping(address => uint) public rewardSupplySpeeds; } abstract contract ComptrollerV7Storage is ComptrollerV6Storage { /// @notice Accounting storage mapping account addresses to how much VIX they owe the protocol. mapping(address => uint) public rewardReceivable; IBoostManager public boostManager; }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "../../interfaces/IComptroller.sol"; import "../../interest-rate-models/interfaces/IInterestRateModel.sol"; import "./IEIP20NonStandard.sol"; import "./IEIP20.sol"; interface IOToken is IEIP20{ /** * @notice Indicator that this is a OToken contract (for inspection) */ function isOToken() external view returns(bool); /*** Market Events ***/ /** * @notice Event emitted when interest is accrued */ event AccrueInterest(uint cashPrior, uint interestAccumulated, uint borrowIndex, uint totalBorrows); /** * @notice Event emitted when tokens are minted */ event Mint(address minter, uint mintAmount, uint mintTokens); /** * @notice Event emitted when tokens are redeemed */ event Redeem(address redeemer, uint redeemAmount, uint redeemTokens); /** * @notice Event emitted when underlying is borrowed */ event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows); /** * @notice Event emitted when a borrow is repaid */ event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows); /** * @notice Event emitted when a borrow is liquidated */ event LiquidateBorrow(address liquidator, address borrower, uint repayAmount, address oTokenCollateral, uint seizeTokens); /*** Admin Events ***/ /** * @notice Event emitted when pendingAdmin is changed */ event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin); /** * @notice Event emitted when pendingAdmin is accepted, which means admin is updated */ event NewAdmin(address oldAdmin, address newAdmin); /** * @notice Event emitted when comptroller is changed */ event NewComptroller(IComptroller oldComptroller, IComptroller newComptroller); /** * @notice Event emitted when interestRateModel is changed */ event NewMarketInterestRateModel(IInterestRateModel oldInterestRateModel, IInterestRateModel newInterestRateModel); /** * @notice Event emitted when the reserve factor is changed */ event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa); /** * @notice Event emitted when the protocol seize share is changed */ event NewProtocolSeizeShare(uint oldProtocolSeizeShareMantissa, uint newProtocolSeizeShareMantissa); /** * @notice Event emitted when the reserves are added */ event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves); /** * @notice Event emitted when the reserves are reduced */ event ReservesReduced(address admin, uint reduceAmount, uint newTotalReserves); function accrualBlockTimestamp() external returns(uint256); /*** User Interface ***/ function balanceOfUnderlying(address owner) external returns (uint); function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint); function borrowRatePerTimestamp() external view returns (uint); function supplyRatePerTimestamp() external view returns (uint); function totalBorrowsCurrent() external returns (uint); function borrowBalanceCurrent(address account) external returns (uint); function borrowBalanceStored(address account) external view returns (uint); function exchangeRateCurrent() external returns (uint); function exchangeRateStored() external view returns (uint); function getCash() external view returns (uint); function accrueInterest() external returns (uint); function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint); function totalBorrows() external view returns(uint); function comptroller() external view returns(IComptroller); function borrowIndex() external view returns(uint); function reserveFactorMantissa() external view returns(uint); /*** Admin Functions ***/ function _setPendingAdmin(address payable newPendingAdmin) external returns (uint); function _acceptAdmin() external returns (uint); function _setComptroller(IComptroller newComptroller) external returns (uint); function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint); function _reduceReserves(uint reduceAmount) external returns (uint); function _setInterestRateModel(IInterestRateModel newInterestRateModel) external returns (uint); function _setProtocolSeizeShare(uint newProtocolSeizeShareMantissa) external returns (uint); }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./otokens/interfaces/IOToken.sol"; abstract contract PriceOracle { /// @notice Indicator that this is a PriceOracle contract (for inspection) bool public constant isPriceOracle = true; /** * @notice Get the underlying price of a oToken asset * @param oToken The oToken to get the underlying price of * @return The underlying asset price mantissa (scaled by 1e18). * Zero means the price is unavailable. */ function getUnderlyingPrice(IOToken oToken) external virtual view returns (uint); }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title 0VIX's IInterestRateModel Interface * @author 0VIX */ interface IInterestRateModel { /// @notice Indicator that this is an InterestRateModel contract (for inspection) function isInterestRateModel() external view returns(bool); /** * @notice Calculates the current borrow interest rate per timestmp * @param cash The total amount of cash the market has * @param borrows The total amount of borrows the market has outstanding * @param reserves The total amount of reserves the market has * @return The borrow rate per timestmp (as a percentage, and scaled by 1e18) */ function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint); /** * @notice Calculates the current supply interest rate per timestmp * @param cash The total amount of cash the market has * @param borrows The total amount of borrows the market has outstanding * @param reserves The total amount of reserves the market has * @param reserveFactorMantissa The current reserve factor the market has * @return The supply rate per timestmp (as a percentage, and scaled by 1e18) */ function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint); }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title IEIP20NonStandard * @dev Version of ERC20 with no return values for `transfer` and `transferFrom` * See https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca */ interface IEIP20NonStandard { /** * @notice Get the total number of tokens in circulation * @return The supply of tokens */ function totalSupply() external view returns (uint256); /** * @notice Gets the balance of the specified address * @param owner The address from which the balance will be retrieved * @return balance The balance */ function balanceOf(address owner) external view returns (uint256 balance); /// /// !!!!!!!!!!!!!! /// !!! NOTICE !!! `transfer` does not return a value, in violation of the ERC-20 specification /// !!!!!!!!!!!!!! /// /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer */ function transfer(address dst, uint256 amount) external; /// /// !!!!!!!!!!!!!! /// !!! NOTICE !!! `transferFrom` does not return a value, in violation of the ERC-20 specification /// !!!!!!!!!!!!!! /// /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer */ function transferFrom(address src, address dst, uint256 amount) external; /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved * @return success Whether or not the approval succeeded */ function approve(address spender, uint256 amount) external returns (bool success); /** * @notice Get the current allowance from `owner` for `spender` * @param owner The address of the account which owns the tokens to be spent * @param spender The address of the account which may transfer tokens * @return remaining The number of tokens allowed to be spent */ function allowance(address owner, address spender) external view returns (uint256 remaining); event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title ERC 20 Token Standard Interface * https://eips.ethereum.org/EIPS/eip-20 */ interface IEIP20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); /** * @notice Get the total number of tokens in circulation * @return The supply of tokens */ function totalSupply() external view returns (uint256); /** * @notice Gets the balance of the specified address * @param owner The address from which the balance will be retrieved * @return balance The balance */ function balanceOf(address owner) external view returns (uint256 balance); /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return success Whether or not the transfer succeeded */ function transfer(address dst, uint256 amount) external returns (bool success); /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return success Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint256 amount) external returns (bool success); /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (-1 means infinite) * @return success Whether or not the approval succeeded */ function approve(address spender, uint256 amount) external returns (bool success); /** * @notice Get the current allowance from `owner` for `spender` * @param owner The address of the account which owns the tokens to be spent * @param spender The address of the account which may transfer tokens * @return remaining The number of tokens allowed to be spent (-1 means infinite) */ function allowance(address owner, address spender) external view returns (uint256 remaining); event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IBoostManager { function updateBoostBasis(address user) external returns (bool); function updateBoostSupplyBalances( address market, address user, uint256 oldBalance, uint256 newBalance ) external; function updateBoostBorrowBalances( address market, address user, uint256 oldBalance, uint256 newBalance ) external; function boostedSupplyBalanceOf(address market, address user) external view returns (uint256); function boostedBorrowBalanceOf(address market, address user) external view returns (uint256); function boostedTotalSupply(address market) external view returns (uint256); function boostedTotalBorrows(address market) external view returns (uint256); function setAuthorized(address addr, bool flag) external; function setVeOVIX(IERC20 ve) external; function isAuthorized(address addr) external view returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; abstract contract UnitrollerAdminStorage { /** * @notice Administrator for this contract */ address public admin; /** * @notice Pending administrator for this contract */ address public pendingAdmin; /** * @notice Active brains of Unitroller */ address public comptrollerImplementation; /** * @notice Pending brains of Unitroller */ address public pendingComptrollerImplementation; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `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); /** * @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); }
{ "optimizer": { "enabled": true, "runs": 400 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPausedGlobally","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"ContributorRewardSpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenBorrowIndex","type":"uint256"}],"name":"DistributedBorrowerReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":true,"internalType":"address","name":"supplier","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenSupplyIndex","type":"uint256"}],"name":"DistributedSupplierReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"error","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"info","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isAutoCollateralized","type":"bool"}],"name":"MarketAutoCollateralized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketExited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IOToken","name":"oToken","type":"address"}],"name":"MarketListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newBorrowCap","type":"uint256"}],"name":"NewBorrowCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldBorrowCapGuardian","type":"address"},{"indexed":false,"internalType":"address","name":"newBorrowCapGuardian","type":"address"}],"name":"NewBorrowCapGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCloseFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"NewCloseFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldCollateralFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"NewCollateralFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldLiquidationIncentiveMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"NewLiquidationIncentive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPauseGuardian","type":"address"},{"indexed":false,"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"NewPauseGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract PriceOracle","name":"oldPriceOracle","type":"address"},{"indexed":false,"internalType":"contract PriceOracle","name":"newPriceOracle","type":"address"}],"name":"NewPriceOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"RewardBorrowSpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOToken","name":"oToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"RewardSupplySpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_rewardUpdater","type":"address"}],"name":"RewardUpdaterModified","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VixClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VixGranted","type":"event"},{"inputs":[{"internalType":"contract IUnitroller","name":"unitroller","type":"address"}],"name":"_become","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_borrowGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"_grantReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_mintGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newBorrowCapGuardian","type":"address"}],"name":"_setBorrowCapGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOToken","name":"oToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setBorrowPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"_setCloseFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOToken","name":"oToken","type":"address"},{"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"_setCollateralFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contributor","type":"address"},{"internalType":"uint256","name":"rewardSpeed","type":"uint256"}],"name":"_setContributorRewardSpeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"_setLiquidationIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOToken[]","name":"oTokens","type":"address[]"},{"internalType":"uint256[]","name":"newBorrowCaps","type":"uint256[]"}],"name":"_setMarketBorrowCaps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOToken","name":"oToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setMintPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"_setPauseGuardian","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract PriceOracle","name":"newOracle","type":"address"}],"name":"_setPriceOracle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"oTokens","type":"address[]"},{"internalType":"uint256[]","name":"supplySpeeds","type":"uint256[]"},{"internalType":"uint256[]","name":"borrowSpeeds","type":"uint256[]"}],"name":"_setRewardSpeeds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setSeizePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setTransferPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOToken","name":"oToken","type":"address"},{"internalType":"bool","name":"_autoCollaterize","type":"bool"}],"name":"_supportMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accountAssets","outputs":[{"internalType":"contract IOToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"accountMembership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allMarkets","outputs":[{"internalType":"contract IOToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boostManager","outputs":[{"internalType":"contract IBoostManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"borrowCapGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"borrowCaps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"borrowState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"timestamp","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowVerify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"contract IOToken","name":"oToken","type":"address"}],"name":"checkMembership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"claimReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"contract IOToken[]","name":"oTokens","type":"address[]"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"holders","type":"address[]"},{"internalType":"contract IOToken[]","name":"oTokens","type":"address[]"},{"internalType":"bool","name":"borrowers","type":"bool"},{"internalType":"bool","name":"suppliers","type":"bool"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"closeFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"compRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"comptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"oTokens","type":"address[]"}],"name":"enterMarkets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oTokenAddress","type":"address"}],"name":"exitMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","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":"contract IOToken[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAssetsIn","outputs":[{"internalType":"contract IOToken[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBoostManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"oTokenModify","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"getHypotheticalAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVixAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"guardianPaused","outputs":[{"internalType":"bool","name":"mint","type":"bool"},{"internalType":"bool","name":"borrow","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isComptroller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IOToken","name":"oToken","type":"address"}],"name":"isDeprecated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"}],"name":"isMarket","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastContributorTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oTokenBorrowed","type":"address"},{"internalType":"address","name":"oTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"liquidateBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oTokenBorrowed","type":"address"},{"internalType":"address","name":"oTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"liquidateBorrowVerify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oTokenBorrowed","type":"address"},{"internalType":"address","name":"oTokenCollateral","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"}],"name":"liquidateCalculateSeizeTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidationIncentiveMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketInitialIndex","outputs":[{"internalType":"uint224","name":"","type":"uint224"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"markets","outputs":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"bool","name":"autoCollaterize","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mintAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"actualMintAmount","type":"uint256"},{"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"mintVerify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract PriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingComptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemVerify","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"borrowerIndex","type":"uint256"}],"name":"repayBorrowVerify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardBorrowSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewardBorrowerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardContributorSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardReceivable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewardSupplierIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardSupplySpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oTokenCollateral","type":"address"},{"internalType":"address","name":"oTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"seizeGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oTokenCollateral","type":"address"},{"internalType":"address","name":"oTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeVerify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"bool","name":"flag","type":"bool"}],"name":"setAutoCollaterize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newBoostManager","type":"address"}],"name":"setBoostManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardUpdater","type":"address"}],"name":"setRewardUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newVixAddress","type":"address"}],"name":"setVixAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supplyState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"timestamp","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferVerify","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"}],"name":"updateAndDistributeBorrowerRewardsForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oToken","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"updateAndDistributeSupplierRewardsForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contributor","type":"address"}],"name":"updateContributorRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801561001057600080fd5b50600080546001600160a01b03191633179055615d6a80620000336000396000f3fe6080604052600436106105685760003560e01c80636760c075116102d1578063ac0b0bb71161018a578063da3d454c116100ec578063e875544611610095578063ee0905cd1161006f578063ee0905cd1461124c578063f851a4401461126c578063ff278d2d1461128c57600080fd5b8063e8755446146111f6578063eabe7d911461120c578063ede4edd01461122c57600080fd5b8063dcfbc0c7116100c6578063dcfbc0c714611195578063e4028eee146111b5578063e6653f3d146111d557600080fd5b8063da3d454c14611128578063daacd11814611148578063dce154491461117557600080fd5b8063c47a85261161014e578063d02f735111610128578063d02f7351146110c8578063d03a27c5146110e8578063d279c1911461110857600080fd5b8063c47a85261461102e578063c488847b14611073578063ca7d5a15146110a857600080fd5b8063ac0b0bb714610f8b578063b0772d0b14610fac578063bb82aa5e14610fc1578063bdcdc25814610fe1578063c29982381461100157600080fd5b80638e8f294b1161023357806394b2294b116101f7578063a8a5564a116101d1578063a8a5564a14610f10578063aa90075414610f48578063abfceffc14610f5e57600080fd5b806394b2294b14610e9f5780639ace3ada14610eb5578063a7b1986c14610ef057600080fd5b80638e8f294b14610d975780638ebf636414610df55780638fc67c2614610e15578063929fe9a114610e3557806394543c1514610e7f57600080fd5b80637388dcff1161029557806385e706941161026f57806385e7069414610d1b57806387f7630314610d565780638b3f9c3b14610d7757600080fd5b80637388dcff14610cbd578063741b252514610cdb5780637dc0d1d014610cfb57600080fd5b80636760c07514610bc55780636a56947e14610c2e5780636b1e85c514610c495780636d35bf9114610c695780636ec934da14610c8457600080fd5b80633bcf7ec1116104235780634fd42e17116103855780635c778605116103495780635fc7e71e116103235780635fc7e71e14610b65578063607ef6c114610b85578063670e8afd14610ba557600080fd5b80635c77860514610b055780635ec88c7914610b255780635f5af1aa14610b4557600080fd5b80634fd42e1714610a6557806351dff98914610a8557806352d84d1e14610aa557806354eb76fa14610ac557806355ee1fe114610ae557600080fd5b806347ef3b3b116103e75780634ada90af116103c15780634ada90af146109f45780634e79238f14610a0a5780634ef4c3e114610a4557600080fd5b806347ef3b3b146109865780634a584432146109a95780634aacbabc146109d657600080fd5b80633bcf7ec1146108b45780633c94786f146108d45780633cb61d4d146108f557806341c728b914610915578063447a13661461093657600080fd5b8063239a4237116104cc5780632c1d6c561161049057806336301f1f1161046a57806336301f1f1461082f578063391957d7146108675780633b593a451461088757600080fd5b80632c1d6c56146107c25780632d70db78146107ef578063317b0b771461080f57600080fd5b8063239a42371461071557806324008a621461073557806324a3d62214610755578063267822471461077557806328bd3c851461079557600080fd5b8063188ec3561161052e5780631ededc91116105085780631ededc911461069b5780632026ffa3146106bd57806321af4569146106dd57600080fd5b8063188ec3561461064857806318c882a51461065b5780631d504dc61461067b57600080fd5b80627e3c46146105745780627e3dd2146105b45780630346ef2a146105d95780630dd1cc88146105fb57806312e1e8c41461062857600080fd5b3661056f57005b600080fd5b34801561058057600080fd5b506105a161058f366004615618565b60146020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156105c057600080fd5b506105c9600181565b60405190151581526020016105ab565b3480156105e557600080fd5b506105f96105f4366004615914565b6112b9565b005b34801561060757600080fd5b506105a1610616366004615618565b60186020526000908152604090205481565b34801561063457600080fd5b506105f9610643366004615650565b6113b5565b34801561065457600080fd5b50426105a1565b34801561066757600080fd5b506105c96106763660046158d5565b61144c565b34801561068757600080fd5b506105f9610696366004615618565b6115aa565b3480156106a757600080fd5b506105f96106b63660046157a8565b5050505050565b3480156106c957600080fd5b506105f96106d8366004615887565b611748565b3480156106e957600080fd5b506015546106fd906001600160a01b031681565b6040516001600160a01b0390911681526020016105ab565b34801561072157600080fd5b506105f9610730366004615618565b6117b9565b34801561074157600080fd5b506105a1610750366004615758565b6117f2565b34801561076157600080fd5b50600b546106fd906001600160a01b031681565b34801561078157600080fd5b506001546106fd906001600160a01b031681565b3480156107a157600080fd5b506105a16107b0366004615618565b601b6020526000908152604090205481565b3480156107ce57600080fd5b506105a16107dd366004615618565b60196020526000908152604090205481565b3480156107fb57600080fd5b506105c961080a366004615ae5565b611830565b34801561081b57600080fd5b506105a161082a366004615b1d565b61190c565b34801561083b57600080fd5b506105a161084a366004615650565b601260209081526000928352604080842090915290825290205481565b34801561087357600080fd5b506105f9610882366004615618565b61196f565b34801561089357600080fd5b506105a16108a2366004615618565b601a6020526000908152604090205481565b3480156108c057600080fd5b506105c96108cf3660046158d5565b6119e8565b3480156108e057600080fd5b50600b546105c990600160a01b900460ff1681565b34801561090157600080fd5b50601e546106fd906001600160a01b031681565b34801561092157600080fd5b506105f9610930366004615842565b50505050565b34801561094257600080fd5b5061096f610951366004615618565b600c6020526000908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152016105ab565b34801561099257600080fd5b506105f96109a13660046156eb565b505050505050565b3480156109b557600080fd5b506105a16109c4366004615618565b60166020526000908152604090205481565b3480156109e257600080fd5b50601c546001600160a01b03166106fd565b348015610a0057600080fd5b506105a160065481565b348015610a1657600080fd5b50610a2a610a25366004615842565b611b2f565b604080519384526020840192909252908201526060016105ab565b348015610a5157600080fd5b506105a1610a60366004615802565b611b7d565b348015610a7157600080fd5b506105a1610a80366004615b1d565b611ccc565b348015610a9157600080fd5b506105f9610aa0366004615842565b611d29565b348015610ab157600080fd5b506106fd610ac0366004615b1d565b611d81565b348015610ad157600080fd5b506105f9610ae0366004615972565b611dab565b348015610af157600080fd5b506105a1610b00366004615618565b61208e565b348015610b1157600080fd5b506105f9610b20366004615802565b505050565b348015610b3157600080fd5b50610a2a610b40366004615618565b612107565b348015610b5157600080fd5b506105a1610b60366004615618565b612150565b348015610b7157600080fd5b506105a1610b80366004615688565b6121c9565b348015610b9157600080fd5b506105f9610ba0366004615a7c565b6123c8565b348015610bb157600080fd5b506105f9610bc0366004615650565b6125c0565b348015610bd157600080fd5b50610c0a610be0366004615618565b6010602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b604080516001600160e01b03909316835263ffffffff9091166020830152016105ab565b348015610c3a57600080fd5b506105f9610930366004615758565b348015610c5557600080fd5b506105f9610c64366004615618565b6125d7565b348015610c7557600080fd5b506105f96106b6366004615688565b348015610c9057600080fd5b506105c9610c9f366004615618565b6001600160a01b03166000908152600a602052604090205460ff1690565b348015610cc957600080fd5b50601d546001600160a01b03166106fd565b348015610ce757600080fd5b506105f9610cf6366004615618565b612610565b348015610d0757600080fd5b506004546106fd906001600160a01b031681565b348015610d2757600080fd5b50610d3e6ec097ce7bc90715b34b9f100000000081565b6040516001600160e01b0390911681526020016105ab565b348015610d6257600080fd5b50600b546105c990600160b01b900460ff1681565b348015610d8357600080fd5b506105f9610d923660046159f8565b6126bc565b348015610da357600080fd5b50610dd8610db2366004615618565b600a602052600090815260409020805460019091015460ff808316926101009004169083565b6040805193151584529115156020840152908201526060016105ab565b348015610e0157600080fd5b506105c9610e10366004615ae5565b612838565b348015610e2157600080fd5b506105f9610e30366004615618565b61290b565b348015610e4157600080fd5b506105c9610e50366004615902565b6001600160a01b0380821660009081526009602090815260408083209386168352929052205460ff1692915050565b348015610e8b57600080fd5b506105c9610e9a366004615618565b612976565b348015610eab57600080fd5b506105a160075481565b348015610ec157600080fd5b506105c9610ed0366004615650565b600960209081526000928352604080842090915290825290205460ff1681565b348015610efc57600080fd5b506105f9610f0b3660046158d5565b612a4a565b348015610f1c57600080fd5b506105a1610f2b366004615650565b601360209081526000928352604080842090915290825290205481565b348015610f5457600080fd5b506105a1600e5481565b348015610f6a57600080fd5b50610f7e610f79366004615618565b612ac0565b6040516105ab9190615b82565b348015610f9757600080fd5b50600b546105c990600160b81b900460ff1681565b348015610fb857600080fd5b50610f7e612b36565b348015610fcd57600080fd5b506002546106fd906001600160a01b031681565b348015610fed57600080fd5b506105a1610ffc366004615758565b612b98565b34801561100d57600080fd5b5061102161101c36600461593f565b612c3a565b6040516105ab9190615bcf565b34801561103a57600080fd5b50610c0a611049366004615618565b6011602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b34801561107f57600080fd5b5061109361108e366004615802565b612d34565b604080519283526020830191909152016105ab565b3480156110b457600080fd5b506105a16110c33660046158d5565b612f5b565b3480156110d457600080fd5b506105a16110e3366004615688565b61314e565b3480156110f457600080fd5b50601c546106fd906001600160a01b031681565b34801561111457600080fd5b506105a1611123366004615618565b6132fd565b34801561113457600080fd5b506105a1611143366004615802565b613409565b34801561115457600080fd5b506105a1611163366004615618565b60176020526000908152604090205481565b34801561118157600080fd5b506106fd611190366004615914565b6137b8565b3480156111a157600080fd5b506003546106fd906001600160a01b031681565b3480156111c157600080fd5b506105a16111d0366004615914565b6137f0565b3480156111e157600080fd5b50600b546105c990600160a81b900460ff1681565b34801561120257600080fd5b506105a160055481565b34801561121857600080fd5b506105a1611227366004615802565b61398a565b34801561123857600080fd5b506105a1611247366004615618565b6139bc565b34801561125857600080fd5b506105f9611267366004615914565b613d79565b34801561127857600080fd5b506000546106fd906001600160a01b031681565b34801561129857600080fd5b506105a16112a7366004615618565b600f6020526000908152604090205481565b6112c1613e88565b6113125760405162461bcd60e51b815260206004820152601b60248201527f6f6e6c792061646d696e2063616e206772616e7420726577617264000000000060448201526064015b60405180910390fd5b600061131e8383613eb1565b9050801561136e5760405162461bcd60e51b815260206004820152601c60248201527f696e73756666696369656e7420746f6b656e20666f72206772616e74000000006044820152606401611309565b604080516001600160a01b0385168152602081018490527f16be5776def5b9fc98f7848c5fe8811ac9e187f5d864466387d38c58c399ea5d910160405180910390a1505050565b60006040518060200160405280846001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156113fb57600080fd5b505afa15801561140f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114339190615b35565b905290506114418382614022565b610b2083838361423e565b6001600160a01b0382166000908152600a602052604081205460ff166114b45760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f742070617573653a206d61726b6574206e6f74206c6973746564006044820152606401611309565b6114bc614408565b6000546001600160a01b03163314806114d25750815b6115175760405162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b6044820152606401611309565b6001600160a01b0383166000818152600c6020908152604091829020805461ff001916610100871515908102919091179091558251938452606091840182905260069184019190915265426f72726f7760d01b6080840152908201527f71aec636243f9709bb0007ae15e9afb8150ab01716d75fd7573be5cc096e03b09060a0015b60405180910390a150805b92915050565b806001600160a01b031663f851a4406040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e357600080fd5b505afa1580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b9190615634565b6001600160a01b0316336001600160a01b0316146116855760405162461bcd60e51b815260206004820152602160248201527f6f6e6c7920756e6974726f6c6c65722061646d696e2063616e205f6265636f6d6044820152606560f81b6064820152608401611309565b806001600160a01b031663c1e803346040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156116c057600080fd5b505af11580156116d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f89190615b35565b156117455760405162461bcd60e51b815260206004820152601560248201527f6368616e6765206e6f7420617574686f72697a656400000000000000000000006044820152606401611309565b50565b60408051600180825281830190925260009160208083019080368337019050509050828160008151811061178c57634e487b7160e01b600052603260045260246000fd5b60200260200101906001600160a01b031690816001600160a01b031681525050610b208183600180611dab565b6000546001600160a01b031633146117d057600080fd5b601c80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0384166000908152600a602052604081205460ff1661181a57506009611828565b61182485846113b5565b5060005b949350505050565b600061183a614408565b6000546001600160a01b03163314806118505750815b6118955760405162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b6044820152606401611309565b600b8054831515600160b81b0260ff60b81b199091161790556040517f27ee2b767de43e8b48d1666d8c451a273fbf857e760fda6e95d0d582f68534bc906119009084906040808252600590820152645365697a6560d81b6060820152901515602082015260800190565b60405180910390a15090565b600080546001600160a01b0316331461192457600080fd5b600580549083905560408051828152602081018590527f3b9670cf975d26958e754b57098eaa2ac914d8d2a31b83257997b9f346110fd991015b60405180910390a160009392505050565b6000546001600160a01b0316331461198657600080fd5b601580546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527feda98690e518e9a05f8ec6837663e188211b2da8f4906648b323f2c1d4434e2991015b60405180910390a15050565b6001600160a01b0382166000908152600a602052604081205460ff16611a505760405162461bcd60e51b815260206004820152601f60248201527f63616e6e6f742070617573653a206d61726b6574206e6f74206c6973746564006044820152606401611309565b611a58614408565b6000546001600160a01b0316331480611a6e5750815b611ab35760405162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b6044820152606401611309565b6001600160a01b0383166000818152600c6020908152604091829020805460ff19168615159081179091558251938452606091840182905260049184019190915263135a5b9d60e21b6080840152908201527f71aec636243f9709bb0007ae15e9afb8150ab01716d75fd7573be5cc096e03b09060a001611599565b600080600080600080611b448a8a8a8a614479565b925092509250826011811115611b6a57634e487b7160e01b600052602160045260246000fd5b95509093509150505b9450945094915050565b6001600160a01b0383166000908152600c602052604081205460ff1615611bd75760405162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b6044820152606401611309565b6001600160a01b0384166000908152600a602052604090205460ff16611c015760095b9050611cc5565b6040516370a0823160e01b81526001600160a01b0384811660048301528516906370a082319060240160206040518083038186803b158015611c4257600080fd5b505afa158015611c56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7a9190615b35565b158015611ca457506001600160a01b0384166000908152600a6020526040902054610100900460ff165b15611cb557611cb384846147bc565b505b611cbf84846125c0565b60005b90505b9392505050565b600080546001600160a01b03163314611ceb576115a46001600b6148b6565b600680549083905560408051828152602081018590527faeba5a6c40a8ac138134bff1aaa65debf25971188a58804bad717f82f0ec1316910161195e565b80151580611d35575081155b6109305760405162461bcd60e51b815260206004820152601160248201527f72656465656d546f6b656e73207a65726f0000000000000000000000000000006044820152606401611309565b600d8181548110611d9157600080fd5b6000918252602090912001546001600160a01b0316905081565b60005b8351811015611fa1576000848281518110611dd957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b0381166000908152600a90925260409091205490915060ff16611e495760405162461bcd60e51b81526020600482015260156024820152741b585c9ad95d081b5d5cdd081899481b1a5cdd1959605a1b6044820152606401611309565b8315611f2e5760006040518060200160405280836001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611e9557600080fd5b505afa158015611ea9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecd9190615b35565b90529050611edb8282614022565b60005b8751811015611f2b57611f1983898381518110611f0b57634e487b7160e01b600052603260045260246000fd5b60200260200101518461423e565b80611f2381615cca565b915050611ede565b50505b8215611f8e57611f3d81614959565b60005b8651811015611f8c57611f7a82888381518110611f6d57634e487b7160e01b600052603260045260246000fd5b6020026020010151614b63565b80611f8481615cca565b915050611f40565b505b5080611f9981615cca565b915050611dae565b5060005b84518110156106b65761202b858281518110611fd157634e487b7160e01b600052603260045260246000fd5b602002602001015160146000888581518110611ffd57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054613eb1565b6014600087848151811061204f57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061208690615cca565b915050611fa5565b600080546001600160a01b031633146120ad576115a4600160106148b6565b600480546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22910161195e565b60008060008060008061211e876000806000614479565b92509250925082601181111561214457634e487b7160e01b600052602160045260246000fd5b97919650945092505050565b600080546001600160a01b0316331461216f576115a4600160136148b6565b600b80546001600160a01b038481166001600160a01b031983168117909355604080519190921680825260208201939093527f0613b6ee6a04f0d09f390e4d9318894b9f6ac7fd83897cd8d18896ba579c401e910161195e565b6001600160a01b0385166000908152600a602052604081205460ff16158061220a57506001600160a01b0385166000908152600a602052604090205460ff16155b156122195760095b90506123bf565b6040516395dd919360e01b81526001600160a01b038481166004830152600091908816906395dd91939060240160206040518083038186803b15801561225e57600080fd5b505afa158015612272573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122969190615b35565b90506122a187612976565b1561230c57828110156123075760405162461bcd60e51b815260206004820152602860248201527f43616e206e6f74207265706179206d6f7265207468616e2074686520746f74616044820152676c20626f72726f7760c01b6064820152608401611309565b6123b9565b60008061231d866000806000614479565b9193509091506000905082601181111561234757634e487b7160e01b600052602160045260246000fd5b146123765781601181111561236c57634e487b7160e01b600052602160045260246000fd5b93505050506123bf565b8061238257600361236c565b600061239e604051806020016040528060055481525085614db0565b9050808611156123b55760119450505050506123bf565b5050505b60009150505b95945050505050565b6000546001600160a01b03163314806123eb57506015546001600160a01b031633145b6124375760405162461bcd60e51b815260206004820152601f60248201527f6f6e6c792061646d696e206f7220626f72726f77436170477561726469616e006044820152606401611309565b8281811580159061244757508082145b6124835760405162461bcd60e51b815260206004820152600d60248201526c1a5b9d985b1a59081a5b9c1d5d609a1b6044820152606401611309565b60005b828110156125b7578484828181106124ae57634e487b7160e01b600052603260045260246000fd5b90506020020135601660008989858181106124d957634e487b7160e01b600052603260045260246000fd5b90506020020160208101906124ee9190615618565b6001600160a01b0316815260208101919091526040016000205586868281811061252857634e487b7160e01b600052603260045260246000fd5b905060200201602081019061253d9190615618565b6001600160a01b03167f6f1951b2aad10f3fc81b86d91105b413a5b3f847a34bbc5ce1904201b14438f686868481811061258757634e487b7160e01b600052603260045260246000fd5b9050602002013560405161259d91815260200190565b60405180910390a2806125af81615cca565b915050612486565b50505050505050565b6125c982614959565b6125d38282614b63565b5050565b6000546001600160a01b031633146125ee57600080fd5b601d80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152601760209081526040808320546018909252822054909142916126429083615cb3565b90506000811180156126545750600083115b156109305760006126658483615c94565b6001600160a01b0386166000908152601460205260408120549192509061268d908390615c5c565b6001600160a01b0387166000908152601460209081526040808320939093556018905220849055505050505050565b6000546001600160a01b03163314806126df5750601e546001600160a01b031633145b61272b5760405162461bcd60e51b815260206004820152601f60248201527f6f6e6c792061646d696e2063616e2073657420726577617264207370656564006044820152606401611309565b825182518114801561273d5750815181145b61279d5760405162461bcd60e51b815260206004820152602b60248201527f436f6d7074726f6c6c65723a3a5f73657452657761726453706565647320696e60448201526a1d985b1a59081a5b9c1d5d60aa1b6064820152608401611309565b60005b818110156106b6576128288582815181106127cb57634e487b7160e01b600052603260045260246000fd5b60200260200101518583815181106127f357634e487b7160e01b600052603260045260246000fd5b602002602001015185848151811061281b57634e487b7160e01b600052603260045260246000fd5b6020026020010151614dc4565b61283181615cca565b90506127a0565b6000612842614408565b6000546001600160a01b03163314806128585750815b61289d5760405162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b6044820152606401611309565b600b8054831515600160b01b0260ff60b01b199091161790556040517f27ee2b767de43e8b48d1666d8c451a273fbf857e760fda6e95d0d582f68534bc906119009084906040808252600890820152672a3930b739b332b960c11b6060820152901515602082015260800190565b6000546001600160a01b0316331461292257600080fd5b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fbea39469363910457d9c890c8148cf384c00faf61147f6e40a39ddafa26fc2099060200160405180910390a150565b6001600160a01b0381166000908152600a60205260408120600101541580156129c257506001600160a01b0382166000908152600c602052604090205460ff6101009091041615156001145b80156115a45750816001600160a01b031663173b99046040518163ffffffff1660e01b815260040160206040518083038186803b158015612a0257600080fd5b505afa158015612a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3a9190615b35565b670de0b6b3a76400001492915050565b6000546001600160a01b03163314612a6157600080fd5b6001600160a01b0382166000908152600a60205260409081902080548315156101000261ff0019909116179055517f31abd22c3c8d5f4796be5f21843042b53e07dcda713c78eb2751d9bd12aaba86906119dc90831515815260200190565b6001600160a01b038116600090815260086020908152604091829020805483518184028101840190945280845260609392830182828015612b2a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612b0c575b50505050509050919050565b6060600d805480602002602001604051908101604052809291908181526020018280548015612b8e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612b70575b5050505050905090565b600b54600090600160b01b900460ff1615612bf55760405162461bcd60e51b815260206004820152601260248201527f7472616e736665722069732070617573656400000000000000000000000000006044820152606401611309565b6000612c02868685614fb0565b90508015612c11579050611828565b612c1a86614959565b612c248686614b63565b612c2e8685614b63565b60009695505050505050565b805160609060008167ffffffffffffffff811115612c6857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612c91578160200160208202803683370190505b50905060005b82811015612d2c57612cd0858281518110612cc257634e487b7160e01b600052603260045260246000fd5b6020026020010151336147bc565b6011811115612cef57634e487b7160e01b600052602160045260246000fd5b828281518110612d0f57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280612d2481615cca565b915050612c97565b509392505050565b6004805460405163fc57d4df60e01b81526001600160a01b03868116938201939093526000928392839291169063fc57d4df9060240160206040518083038186803b158015612d8257600080fd5b505afa158015612d96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dba9190615b35565b6004805460405163fc57d4df60e01b81526001600160a01b038981169382019390935292935060009291169063fc57d4df9060240160206040518083038186803b158015612e0757600080fd5b505afa158015612e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3f9190615b35565b9050811580612e4c575080155b15612e6057600d6000935093505050612f53565b6000866001600160a01b031663182df0f56040518163ffffffff1660e01b815260040160206040518083038186803b158015612e9b57600080fd5b505afa158015612eaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ed39190615b35565b90506000612eff6040518060200160405280600654815250604051806020016040528087815250615080565b90506000612f29604051806020016040528086815250604051806020016040528086815250615080565b90506000612f3783836150ca565b90506000612f45828b614db0565b600099509750505050505050505b935093915050565b600080546001600160a01b03163314612f8157612f7a600160126148b6565b90506115a4565b6001600160a01b0383166000908152600a602052604090205460ff1615612fae57612f7a600a60116148b6565b826001600160a01b03166397de9d116040518163ffffffff1660e01b815260040160206040518083038186803b158015612fe757600080fd5b505afa158015612ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301f9190615b01565b50604080516060810182526001808252841515602080840182815260008587018181526001600160a01b038b168252600a84529087902095518654925161ffff1990931690151561ff001916176101009215159290920291909117855551939092019290925591519081527f31abd22c3c8d5f4796be5f21843042b53e07dcda713c78eb2751d9bd12aaba86910160405180910390a1600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b0319166001600160a01b03851617905561310983615101565b6040516001600160a01b03841681527fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f9060200160405180910390a160009392505050565b600b54600090600160b81b900460ff161561319d5760405162461bcd60e51b815260206004820152600f60248201526e1cd95a5e99481a5cc81c185d5cd959608a1b6044820152606401611309565b6001600160a01b0386166000908152600a602052604090205460ff1615806131de57506001600160a01b0385166000908152600a602052604090205460ff16155b156131ea576009612212565b846001600160a01b0316635fe3b5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561322357600080fd5b505afa158015613237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325b9190615634565b6001600160a01b0316866001600160a01b0316635fe3b5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561329d57600080fd5b505afa1580156132b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132d59190615634565b6001600160a01b0316146132ea576002612212565b6132f386614959565b612c248684614b63565b6000805b600d548110156133c4576000600d828154811061332e57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316808352600a90915260409091205490915060ff1661339d5760405162461bcd60e51b81526020600482015260156024820152741b585c9ad95d081b5d5cdd081899481b1a5cdd1959605a1b6044820152606401611309565b6133a781856113b5565b6133b181856125c0565b50806133bc81615cca565b915050613301565b506001600160a01b0382166000908152601460205260409020546133e88382613eb1565b6001600160a01b039093166000908152601460205260409020929092555090565b6001600160a01b0383166000908152600c6020526040812054610100900460ff161561346a5760405162461bcd60e51b815260206004820152601060248201526f189bdc9c9bddc81a5cc81c185d5cd95960821b6044820152606401611309565b6001600160a01b0384166000908152600a602052604090205460ff16613491576009611bfa565b6001600160a01b0380851660009081526009602090815260408083209387168352929052205460ff166135b857336001600160a01b038516146135165760405162461bcd60e51b815260206004820152601560248201527f73656e646572206d757374206265206f546f6b656e00000000000000000000006044820152606401611309565b600061352233856147bc565b9050600081601181111561354657634e487b7160e01b600052602160045260246000fd5b146135735780601181111561356b57634e487b7160e01b600052602160045260246000fd5b915050611cc5565b6001600160a01b0380861660009081526009602090815260408083209388168352929052205460ff166135b657634e487b7160e01b600052600160045260246000fd5b505b6004805460405163fc57d4df60e01b81526001600160a01b038781169382019390935291169063fc57d4df9060240160206040518083038186803b1580156135ff57600080fd5b505afa158015613613573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136379190615b35565b61364257600d611bfa565b6001600160a01b038416600090815260166020526040902054801561372b578083866001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b15801561369c57600080fd5b505afa1580156136b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136d49190615b35565b6136de9190615c5c565b1061372b5760405162461bcd60e51b815260206004820152601260248201527f626f72726f7720636170207265616368656400000000000000000000000000006044820152606401611309565b60008061373b8688600088614479565b9193509091506000905082601181111561376557634e487b7160e01b600052602160045260246000fd5b146137945781601181111561378a57634e487b7160e01b600052602160045260246000fd5b9350505050611cc5565b80156137a157600461378a565b6137ab87876113b5565b6000979650505050505050565b600860205281600052604060002081815481106137d457600080fd5b6000918252602090912001546001600160a01b03169150829050565b600080546001600160a01b0316331461380f57612f7a600160066148b6565b6001600160a01b0383166000908152600a60205260409020805460ff166138445761383c600960076148b6565b9150506115a4565b60408051602080820183528582528251908101909252670c7d713b49da000082529061387281835190511090565b1561388d57613883600660086148b6565b93505050506115a4565b841580159061391857506004805460405163fc57d4df60e01b81526001600160a01b038981169382019390935291169063fc57d4df9060240160206040518083038186803b1580156138de57600080fd5b505afa1580156138f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139169190615b35565b155b1561392957613883600d60096148b6565b60018301805490869055604080516001600160a01b0389168152602081018390529081018790527f70483e6592cd5182d45ac970e05bc62cdcc90e9d8ef2c2dbe686cf383bcd7fc59060600160405180910390a16000979650505050505050565b600080613998858585614fb0565b905080156139a7579050611cc5565b6139b185856125c0565b600095945050505050565b6040516361bfb47160e11b815233600482015260009082908290819081906001600160a01b0385169063c37f68e29060240160806040518083038186803b158015613a0657600080fd5b505afa158015613a1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a3e9190615b4d565b5092509250925082600014613aa35760405162461bcd60e51b815260206004820152602560248201527f657869744d61726b65743a206765744163636f756e74536e617073686f742066604482015264185a5b195960da1b6064820152608401611309565b8015613abf57613ab5600c60026148b6565b9695505050505050565b6000613acc873385614fb0565b90508015613aec57613ae1600e6003836151bf565b979650505050505050565b6001600160a01b038516600090815260096020908152604080832033845290915290205460ff16613b1e576000613ae1565b6001600160a01b03851660009081526009602090815260408083203384528252808320805460ff191690556008825280832080548251818502810185019093528083529192909190830182828015613b9f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613b81575b5050835193945083925060009150505b82811015613c1257886001600160a01b0316848281518110613be157634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415613c0057809150613c12565b80613c0a81615cca565b915050613baf565b50818110613c3057634e487b7160e01b600052600160045260246000fd5b33600090815260086020526040902080548190613c4f90600190615cb3565b81548110613c6d57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160009054906101000a90046001600160a01b0316818381548110613cab57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080805480613cf757634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190556040517fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d90613d60908b9033906001600160a01b0392831681529116602082015260400190565b60405180910390a160009b9a5050505050505050505050565b6000546001600160a01b0316331480613d9c5750601e546001600160a01b031633145b613de85760405162461bcd60e51b815260206004820152601f60248201527f6f6e6c792061646d696e2063616e2073657420726577617264207370656564006044820152606401611309565b613df182612610565b80613e14576001600160a01b038216600090815260186020526040812055613e2f565b426001600160a01b0383166000908152601860205260409020555b6001600160a01b03821660008181526017602052604090819020839055517f85eecf30a97533335aac0dc394c47a6600a5107038a0c967102478d9fe568dab90613e7c9084815260200190565b60405180910390a25050565b600080546001600160a01b0316331480613eac57506002546001600160a01b031633145b905090565b600080613ec6601d546001600160a01b031690565b90506001600160a01b0381161561401a576040516370a0823160e01b81523060048201526000906001600160a01b038316906370a082319060240160206040518083038186803b158015613f1957600080fd5b505afa158015613f2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f519190615b35565b9050600084118015613f635750808411155b156140185760405163a9059cbb60e01b81526001600160a01b0386811660048301526024820186905283169063a9059cbb90604401600060405180830381600087803b158015613fb257600080fd5b505af1158015613fc6573d6000803e3d6000fd5b5050604080516001600160a01b0389168152602081018890527fdc38f4aaaf6d37c4ae151051029aff3215faa3c2aceabbed1c30c5252f139af1935001905060405180910390a16000925050506115a4565b505b509092915050565b6001600160a01b03821660009081526011602090815260408083206019909252822054909161405042615261565b83549091506000906140739063ffffffff600160e01b9091048116908416615cb3565b905080156109a157821561421957601c54600090614193906001600160a01b03161561411c57601c546040516301cd4a6960e11b81526001600160a01b038a811660048301529091169063039a94d2906024015b60206040518083038186803b1580156140df57600080fd5b505afa1580156140f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141179190615b35565b61418d565b876001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b15801561415557600080fd5b505afa158015614169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061418d9190615b35565b876152ad565b905060006141a18584615c94565b905060008083116141c157604051806020016040528060008152506141cb565b6141cb82846152ce565b604080516020810190915288546001600160e01b031681529091506141fa906141f49083615304565b5161532d565b87546001600160e01b0319166001600160e01b03919091161787555050505b835463ffffffff8316600160e01b026001600160e01b03909116178455505050505050565b6001600160a01b03838116600090815260116020908152604080832080546013845282852095881685529490925290912080546001600160e01b039093169081905590918015801561429f57506ec097ce7bc90715b34b9f10000000008210155b156142b657506ec097ce7bc90715b34b9f10000000005b6000604051806020016040528083856142cf9190615cb3565b9052601c54909150600090614367906001600160a01b03161561432657601c54604051632777dd6960e11b81526001600160a01b038b811660048301528a8116602483015290911690634eefbad2906044016140c7565b6040516395dd919360e01b81526001600160a01b0389811660048301528a16906395dd91939060240160206040518083038186803b15801561415557600080fd5b905060006143758284615375565b6001600160a01b0389166000908152601460205260408120549192509061439d908390615c5c565b6001600160a01b038a811660008181526014602090815260409182902085905581518781529081018b90529394509092918d16917f140436893bf94456b060bcba4ad537b98c6bea5fb2f5badef8904e98bbd78bd7910160405180910390a350505050505050505050565b6000546001600160a01b031633148061442b5750600b546001600160a01b031633145b6144775760405162461bcd60e51b815260206004820152601d60248201527f6f6e6c7920706175736520677561726469616e20616e642061646d696e0000006044820152606401611309565b565b60008060006144866153f1565b6001600160a01b0388166000908152600860209081526040808320805482518185028101850190935280835284938301828280156144ed57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116144cf575b5050505050905060005b815181101561477d57600082828151811061452257634e487b7160e01b600052603260045260246000fd5b60209081029190910101516040516361bfb47160e11b81526001600160a01b038e811660048301529192509082169063c37f68e29060240160806040518083038186803b15801561457257600080fd5b505afa158015614586573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145aa9190615b4d565b608089015260608801526040870152935083156145d657600f6000809750975097505050505050611b73565b60408051602080820183526001600160a01b038481166000818152600a845285902060010154845260c08a01939093528351808301855260808a0151815260e08a015260048054855163fc57d4df60e01b815291820194909452935192169263fc57d4df9260248083019392829003018186803b15801561465657600080fd5b505afa15801561466a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061468e9190615b35565b60a086018190526146ae57600d6000809750975097505050505050611b73565b604080516020810190915260a0860151815261010086015260c085015160e08601516146e8916146dd91615080565b866101000151615080565b610120860181905260408601518651614702929190615395565b85526101008501516060860151602087015161471f929190615395565b60208601526001600160a01b03818116908c16141561476a5761474c8561012001518b8760200151615395565b60208601819052610100860151614764918b90615395565b60208601525b508061477581615cca565b9150506144f7565b506020830151835111156147a35750506020810151905160009450039150829050611b73565b5050805160209091015160009450849350039050611b73565b6001600160a01b0382166000908152600a602052604081205460ff166147e4575060096115a4565b6001600160a01b0380841660009081526009602090815260408083209386168352929052205460ff161561481a575060006115a4565b6001600160a01b038381166000818152600960209081526040808320948716808452948252808320805460ff19166001908117909155600883528184208054918201815584529282902090920180546001600160a01b0319168417905581519283528201929092527f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a5910160405180910390a150600092915050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa08360118111156148f957634e487b7160e01b600052602160045260246000fd5b83601381111561491957634e487b7160e01b600052602160045260246000fd5b60408051928352602083019190915260009082015260600160405180910390a1826011811115611cc557634e487b7160e01b600052602160045260246000fd5b6001600160a01b0381166000908152601060209081526040808320601a909252822054909161498742615261565b83549091506000906149aa9063ffffffff600160e01b9091048116908416615cb3565b905080156106b6578215614b3f57601c546000906001600160a01b031615614a4e57601c54604051631e1932fb60e01b81526001600160a01b03888116600483015290911690631e1932fb9060240160206040518083038186803b158015614a1157600080fd5b505afa158015614a25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a499190615b35565b614abf565b856001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015614a8757600080fd5b505afa158015614a9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614abf9190615b35565b90506000614acd8584615c94565b90506000808311614aed5760405180602001604052806000815250614af7565b614af782846152ce565b604080516020810190915288546001600160e01b03168152909150614b20906141f49083615304565b87546001600160e01b0319166001600160e01b03919091161787555050505b835463ffffffff8316600160e01b026001600160e01b039091161784555050505050565b6001600160a01b03828116600090815260106020908152604080832080546012845282852095871685529490925290912080546001600160e01b0390931690819055909180158015614bc457506ec097ce7bc90715b34b9f10000000008210155b15614bdb57506ec097ce7bc90715b34b9f10000000005b600060405180602001604052808385614bf49190615cb3565b9052601c549091506000906001600160a01b031615614c9757601c546040516301693b2560e41b81526001600160a01b038981166004830152888116602483015290911690631693b2509060440160206040518083038186803b158015614c5a57600080fd5b505afa158015614c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c929190615b35565b614d10565b6040516370a0823160e01b81526001600160a01b0387811660048301528816906370a082319060240160206040518083038186803b158015614cd857600080fd5b505afa158015614cec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d109190615b35565b90506000614d1e8284615375565b6001600160a01b03881660009081526014602052604081205491925090614d46908390615c5c565b6001600160a01b0389811660008181526014602090815260409182902085905581518781529081018b90529394509092918c16917f1b63b3b859428434d99569695315fa35918c5a2bce714acb147f4c3019808bdd910160405180910390a3505050505050505050565b6000611cc5614dbf84846153af565b6153d9565b6001600160a01b0383166000908152600a602052604090205460ff16614e2c5760405162461bcd60e51b815260206004820152601960248201527f30564958206d61726b6574206973206e6f74206c6973746564000000000000006044820152606401611309565b6001600160a01b0383166000908152601a60205260409020548214614eaa57614e5483614959565b6001600160a01b0383166000818152601a602052604090819020849055517ff720735fa76f84bc32ace1df447c03b6acef6e4b238ff71722ebaa93f9c1cdc090614ea19085815260200190565b60405180910390a25b6001600160a01b0383166000908152601960205260409020548114610b205760006040518060200160405280856001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015614f0f57600080fd5b505afa158015614f23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614f479190615b35565b90529050614f558482614022565b6001600160a01b03841660008181526019602052604090819020849055517ff386f4abe5d857960f167a80b4dbb954055f412561afb755f97406c675be98c390614fa29085815260200190565b60405180910390a250505050565b6001600160a01b0383166000908152600a602052604081205460ff16614fd7576009611bfa565b6001600160a01b0380851660009081526009602090815260408083209387168352929052205460ff1661500b576000611bfa565b60008061501b8587866000614479565b9193509091506000905082601181111561504557634e487b7160e01b600052602160045260246000fd5b146150735781601181111561506a57634e487b7160e01b600052602160045260246000fd5b92505050611cc5565b8015612c2e57600461506a565b6040805160208101909152600081526040518060200160405280670de0b6b3a7640000846000015186600001516150b79190615c94565b6150c19190615c74565b90529392505050565b60408051602081019091526000815260405180602001604052808360000151670de0b6b3a764000086600001516150b79190615c94565b600061510c42615261565b6001600160a01b03831660009081526010602090815260408083206011909252909120815492935090916001600160e01b03166151635781546001600160e01b0319166ec097ce7bc90715b34b9f10000000001782555b80546001600160e01b03166151925780546001600160e01b0319166ec097ce7bc90715b34b9f10000000001781555b805463ffffffff909316600160e01b026001600160e01b0393841681179091558154909216909117905550565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa084601181111561520257634e487b7160e01b600052602160045260246000fd5b84601381111561522257634e487b7160e01b600052602160045260246000fd5b604080519283526020830191909152810184905260600160405180910390a1836011811115611cc257634e487b7160e01b600052602160045260246000fd5b600064010000000082106152a95760405162461bcd60e51b815260206004820152600f60248201526e736166653332206f766572666c6f7760881b6044820152606401611309565b5090565b80516000906152c4670de0b6b3a764000085615c94565b611cc59190615c74565b6040805160208101909152600081526040518060200160405280836ec097ce7bc90715b34b9f1000000000866150b79190615c94565b60408051602081019091526000815260408051602081019091528251845182916150c191615c5c565b6000600160e01b82106152a95760405162461bcd60e51b815260206004820152601060248201526f73616665323234206f766572666c6f7760801b6044820152606401611309565b80516000906ec097ce7bc90715b34b9f1000000000906152c49085615c94565b6000816153a5614dbf86866153af565b611cc29190615c5c565b60408051602081019091526000815260405180602001604052808385600001516150c19190615c94565b80516000906115a490670de0b6b3a764000090615c74565b60405180610140016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200161543d6040518060200160405280600081525090565b81526020016154586040518060200160405280600081525090565b81526020016154736040518060200160405280600081525090565b815260200161548e6040518060200160405280600081525090565b905290565b600082601f8301126154a3578081fd5b813560206154b86154b383615c38565b615c07565b80838252828201915082860187848660051b89010111156154d7578586fd5b855b858110156154fe5781356154ec81615d11565b845292840192908401906001016154d9565b5090979650505050505050565b60008083601f84011261551c578182fd5b50813567ffffffffffffffff811115615533578182fd5b6020830191508360208260051b850101111561554e57600080fd5b9250929050565b600082601f830112615565578081fd5b813560206155756154b383615c38565b80838252828201915082860187848660051b8901011115615594578586fd5b855b858110156154fe5781356155a981615d11565b84529284019290840190600101615596565b600082601f8301126155cb578081fd5b813560206155db6154b383615c38565b80838252828201915082860187848660051b89010111156155fa578586fd5b855b858110156154fe578135845292840192908401906001016155fc565b600060208284031215615629578081fd5b8135611cc581615d11565b600060208284031215615645578081fd5b8151611cc581615d11565b60008060408385031215615662578081fd5b823561566d81615d11565b9150602083013561567d81615d11565b809150509250929050565b600080600080600060a0868803121561569f578081fd5b85356156aa81615d11565b945060208601356156ba81615d11565b935060408601356156ca81615d11565b925060608601356156da81615d11565b949793965091946080013592915050565b60008060008060008060c08789031215615703578081fd5b863561570e81615d11565b9550602087013561571e81615d11565b9450604087013561572e81615d11565b9350606087013561573e81615d11565b9598949750929560808101359460a0909101359350915050565b6000806000806080858703121561576d578182fd5b843561577881615d11565b9350602085013561578881615d11565b9250604085013561579881615d11565b9396929550929360600135925050565b600080600080600060a086880312156157bf578283fd5b85356157ca81615d11565b945060208601356157da81615d11565b935060408601356157ea81615d11565b94979396509394606081013594506080013592915050565b600080600060608486031215615816578081fd5b833561582181615d11565b9250602084013561583181615d11565b929592945050506040919091013590565b60008060008060808587031215615857578182fd5b843561586281615d11565b9350602085013561587281615d11565b93969395505050506040820135916060013590565b60008060408385031215615899578182fd5b82356158a481615d11565b9150602083013567ffffffffffffffff8111156158bf578182fd5b6158cb85828601615555565b9150509250929050565b600080604083850312156158e7578182fd5b82356158f281615d11565b9150602083013561567d81615d26565b60008060408385031215615662578182fd5b60008060408385031215615926578182fd5b823561593181615d11565b946020939093013593505050565b600060208284031215615950578081fd5b813567ffffffffffffffff811115615966578182fd5b61182884828501615493565b60008060008060808587031215615987578182fd5b843567ffffffffffffffff8082111561599e578384fd5b6159aa88838901615493565b955060208701359150808211156159bf578384fd5b506159cc87828801615555565b93505060408501356159dd81615d26565b915060608501356159ed81615d26565b939692955090935050565b600080600060608486031215615a0c578081fd5b833567ffffffffffffffff80821115615a23578283fd5b615a2f87838801615493565b94506020860135915080821115615a44578283fd5b615a50878388016155bb565b93506040860135915080821115615a65578283fd5b50615a72868287016155bb565b9150509250925092565b60008060008060408587031215615a91578182fd5b843567ffffffffffffffff80821115615aa8578384fd5b615ab48883890161550b565b90965094506020870135915080821115615acc578384fd5b50615ad98782880161550b565b95989497509550505050565b600060208284031215615af6578081fd5b8135611cc581615d26565b600060208284031215615b12578081fd5b8151611cc581615d26565b600060208284031215615b2e578081fd5b5035919050565b600060208284031215615b46578081fd5b5051919050565b60008060008060808587031215615b62578182fd5b505082516020840151604085015160609095015191969095509092509050565b6020808252825182820181905260009190848201906040850190845b81811015615bc35783516001600160a01b031683529284019291840191600101615b9e565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015615bc357835183529284019291840191600101615beb565b604051601f8201601f1916810167ffffffffffffffff81118282101715615c3057615c30615cfb565b604052919050565b600067ffffffffffffffff821115615c5257615c52615cfb565b5060051b60200190565b60008219821115615c6f57615c6f615ce5565b500190565b600082615c8f57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615615cae57615cae615ce5565b500290565b600082821015615cc557615cc5615ce5565b500390565b6000600019821415615cde57615cde615ce5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461174557600080fd5b801515811461174557600080fdfea2646970667358221220649ab77d91a8ab456299dc15e031a5cc86135ab8190cebb21256cfbbabb4db7a64736f6c63430008040033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.