More Info
Private Name Tags
ContractCreator:
Latest 25 from a total of 1,104 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Claim Comp | 22306899 | 863 days ago | IN | 0 FTM | 0.0818097 | ||||
Claim Comp | 22303384 | 863 days ago | IN | 0 FTM | 0.06603436 | ||||
Claim Comp | 22282332 | 863 days ago | IN | 0 FTM | 0.11742315 | ||||
Claim Comp | 22198096 | 864 days ago | IN | 0 FTM | 0.11830487 | ||||
Claim Comp | 21860039 | 867 days ago | IN | 0 FTM | 0.11337943 | ||||
Claim Comp | 21729764 | 868 days ago | IN | 0 FTM | 0.05801147 | ||||
Claim Comp | 21625637 | 870 days ago | IN | 0 FTM | 0.08379212 | ||||
Claim Comp | 21562805 | 870 days ago | IN | 0 FTM | 0.13696674 | ||||
Claim Comp | 21554390 | 870 days ago | IN | 0 FTM | 0.15137247 | ||||
Claim Comp | 21436217 | 871 days ago | IN | 0 FTM | 0.08355723 | ||||
Claim Comp | 21248533 | 873 days ago | IN | 0 FTM | 0.1128581 | ||||
Claim Comp | 21190692 | 874 days ago | IN | 0 FTM | 0.11731049 | ||||
Claim Comp | 21143470 | 874 days ago | IN | 0 FTM | 0.12447352 | ||||
Claim Comp | 21052536 | 875 days ago | IN | 0 FTM | 0.07096369 | ||||
Claim Comp | 20859710 | 877 days ago | IN | 0 FTM | 0.44837869 | ||||
Claim Comp | 20859693 | 877 days ago | IN | 0 FTM | 0.14469873 | ||||
Claim Comp | 20773406 | 878 days ago | IN | 0 FTM | 0.30039267 | ||||
Claim Comp | 20706441 | 879 days ago | IN | 0 FTM | 0.0898863 | ||||
Claim Comp | 20599397 | 880 days ago | IN | 0 FTM | 0.07650454 | ||||
Claim Comp | 20599316 | 880 days ago | IN | 0 FTM | 0.08120759 | ||||
Claim Comp | 20584108 | 880 days ago | IN | 0 FTM | 0.0955945 | ||||
Claim Comp | 20351176 | 882 days ago | IN | 0 FTM | 0.08416983 | ||||
Claim Comp | 20319110 | 883 days ago | IN | 0 FTM | 0.17184719 | ||||
Claim Comp | 20274866 | 883 days ago | IN | 0 FTM | 0.22647339 | ||||
Claim Comp | 20262475 | 883 days ago | IN | 0 FTM | 0.0628011 |
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
17012300 | 927 days ago | Contract Creation | 0 FTM |
Loading...
Loading
Contract Name:
SingleAssetDynamicRainMaker
Compiler Version
v0.5.16+commit.9c3226ce
Contract Source Code (Solidity)
/** *Submitted for verification at ftmscan.com on 2021-09-13 */ pragma solidity ^0.5.16; /** * @title Compound's InterestRateModel Interface * @author Compound */ contract InterestRateModel { /// @notice Indicator that this is an InterestRateModel contract (for inspection) bool public constant isInterestRateModel = true; /** * @notice Calculates the current borrow interest rate per block * @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 block (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 block * @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 block (as a percentage, and scaled by 1e18) */ function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint); } /** * @title EIP20NonStandardInterface * @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 EIP20NonStandardInterface { /** * @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 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 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 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); } /** * OLA_ADDITIONS : This base admin storage. */ contract CTokenAdminStorage { /** * @notice Administrator for this contract */ address payable public admin; /** * @notice Pending administrator for this contract */ address payable public pendingAdmin; /** * @notice Contract which oversees inter-cToken operations */ ComptrollerInterface public comptroller; /** * @notice Implementation address for this contract */ address public implementation; // OLA_ADDITIONS : Contract hash name bytes32 public contractNameHash; } /** * @notice DO NOT ADD ANY MORE STORAGE VARIABLES HERE (add them to their respective type storage) */ contract CTokenStorage is CTokenAdminStorage { /** * @dev Guard variable for re-entrancy checks */ bool internal _notEntered; /** * @notice EIP-20 token name for this token */ string public name; /** * @notice EIP-20 token symbol for this token */ string public symbol; /** * @notice EIP-20 token decimals for this token */ uint8 public decimals; /** * @notice Underlying asset for this CToken */ address public underlying; // @notice Indicates if the calculations should be blocks or time based bool public blocksBased; /** * @notice Model which tells what the current interest rate should be */ InterestRateModel public interestRateModel; /** * @notice Initial exchange rate used when minting the first CTokens (used when totalSupply = 0) */ uint internal initialExchangeRateMantissa; /** * @notice Fraction of interest currently set aside for reserves */ uint public reserveFactorMantissa; /** * @notice Block number that interest was last accrued at */ uint public accrualBlockNumber; /** * @notice Block number that interest was last accrued at */ uint public accrualBlockTimestamp; /** * @notice Accumulator of the total earned interest rate since the opening of the market */ uint public borrowIndex; /** * @notice Total amount of outstanding borrows of the underlying in this market */ uint public totalBorrows; /** * OLA_ADDITIONS : Removed option to 'add reserves' as it makes no sense when reducing reserves * sends a part to Ola Bank. * @notice Total amount of reserves of the underlying held in this market */ uint public totalReserves; /** * @notice Total number of tokens in circulation */ uint public totalSupply; /** * @notice Official record of token balances for each account */ mapping (address => uint) internal accountTokens; /** * @notice Approved token transfer amounts on behalf of others */ mapping (address => mapping (address => uint)) internal transferAllowances; /** * @notice Container for borrow balance information * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action * @member interestIndex Global borrowIndex as of the most recent balance-changing action */ struct BorrowSnapshot { uint principal; uint interestIndex; } /** * @notice Mapping of account addresses to outstanding borrow balances */ mapping(address => BorrowSnapshot) internal accountBorrows; // IMPORTANT : DO NOT ADD ANY MORE STORAGE VARIABLES HERE (add them to their respective type storage) } contract CTokenDelegatorInterface { /*** Implementation Events ***/ /** * @notice Emitted when implementation is changed */ event NewImplementation(address indexed oldImplementation, address indexed newImplementation); /** * @notice Emitted when implementation is not changed under a system version update */ event ImplementationDidNotChange(address indexed implementation); /*** Implementation functions ***/ // OLA_ADDITIONS : Update implementation from the Registry function updateImplementationFromRegistry(bool allowResign, bytes calldata becomeImplementationData) external returns (bool); } contract CTokenInterface { // OLA_ADDITIONS : "Underlying field" address constant public nativeCoinUnderlying = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); /** * OLA_ADDITIONS : This field * @notice This value is hard coded to 0.5 (50% for the Ola ecosystem and the LeN owner each) */ uint constant public olaReserveFactorMantissa = 0.5e18; /** * @notice Indicator that this is a CToken contract (for inspection) */ bool public constant isCToken = true; /** * @notice Maximum borrow rate that can ever be applied (.0005% / block) */ uint internal constant borrowRateMaxMantissa = 0.0005e16; /** * @notice Maximum fraction of interest that can be set aside for reserves */ uint internal constant reserveFactorMaxMantissa = 0.3e18; /** * OLA_ADDITIONS : This value * @notice Minimum fraction of interest that can be set aside for reserves */ uint internal constant reserveFactorMinMantissa = 0.05e18; /*** 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 cTokenCollateral, 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(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller); /** * @notice Event emitted when interestRateModel is changed */ event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel); /** * @notice Event emitted when the reserve factor is changed */ event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa); /** * @notice Event emitted when the reserves are reduced */ event ReservesReduced(address admin, uint adminPart, address olaBank, uint olaPart, uint newTotalReserves); /** * @notice EIP20 Transfer event */ event Transfer(address indexed from, address indexed to, uint amount); /** * @notice EIP20 Approval event */ event Approval(address indexed owner, address indexed spender, uint amount); /** * @notice Failure event */ event Failure(uint error, uint info, uint detail); /*** User Interface ***/ function transfer(address dst, uint amount) external returns (bool); function transferFrom(address src, address dst, uint amount) external returns (bool); function approve(address spender, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function balanceOf(address owner) external view returns (uint); function balanceOfUnderlying(address owner) external returns (uint); function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint); function borrowBalanceStored(address account) public view returns (uint); function exchangeRateStored() public view returns (uint); function getAccrualBlockNumber() external view returns (uint); function accrueInterest() public returns (uint); function seize(address liquidator, address borrower, uint seizeTokens) external returns (uint); /*** Admin Functions ***/ function _setPendingAdmin(address payable newPendingAdmin) external returns (uint); function _acceptAdmin() external returns (uint); function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint); function _reduceReserves(uint reduceAmount) external returns (uint); function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint); } /** * View functions that are not used by the core contracts. */ contract CTokenViewInterface { /*** View Interface ***/ function borrowRatePerBlock() external view returns (uint); function supplyRatePerBlock() external view returns (uint); function totalBorrowsCurrent() external returns (uint); /** * @notice Used by the Maximilion */ function borrowBalanceCurrent(address account) external returns (uint); function exchangeRateCurrent() public returns (uint); function getCash() external view returns (uint); } contract CErc20Interface { /*** User Interface ***/ function mint(uint mintAmount) external returns (uint); function redeem(uint redeemTokens) external returns (uint); function redeemUnderlying(uint redeemAmount) external returns (uint); function borrow(uint borrowAmount) external returns (uint); function repayBorrow(uint repayAmount) external returns (uint); function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint); function liquidateBorrow(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) external returns (uint); function sweepToken(EIP20NonStandardInterface token) external; } contract CErc20StorageV0_01 {} contract CErc20StorageV0_02 is CErc20StorageV0_01 {} contract ONativeInterface { /*** User Interface ***/ function mint() external payable; function redeem(uint redeemTokens) external returns (uint); function redeemUnderlying(uint redeemAmount) external returns (uint); function borrow(uint borrowAmount) external returns (uint); function repayBorrow() external payable; function repayBorrowBehalf(address borrower) external payable; function liquidateBorrow(address borrower, CTokenInterface cTokenCollateral) external payable; function sweepToken(EIP20NonStandardInterface token) external; } contract CEtherStorageV0_01 {} contract CEtherStorageV0_02 is CEtherStorageV0_01 {} contract CDelegateInterface { /** * @notice Called by the delegator on a delegate to initialize it for duty * @dev Should revert if any issues arise which make it unfit for delegation * @param data The encoded bytes data for any initialization */ function _becomeImplementation(bytes memory data) public; /** * @notice Called by the delegator on a delegate to forfeit its responsibility */ function _resignImplementation() public; } 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, // OLA_ADDITIONS : All Enums from here NOT_IN_MARKET, TOO_LITTLE_BORROW, IN_FRESH_LIQUIDATION_LIMITED_PERIOD, INVALID_LIQUIDATION_FACTOR, BORROWED_AGAINST_FAILED, TOTAL_BORROWED_AGAINST_TOO_HIGH, TOO_MUCH_COLLATERAL_ACTIVATION, // V0.02 NOT_APPROVED_TO_MINT, NOT_APPROVED_TO_BORROW } 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, // OLA_ADDITIONS : All Enums from here SET_LIQUIDATION_INCENTIVE_NO_EXISTS, SET_LIQUIDATION_INCENTIVE_WITHOUT_PRICE, SET_LIQUIDATION_FACTOR_OWNER_CHECK, SET_LIQUIDATION_FACTOR_NO_EXISTS, SET_LIQUIDATION_FACTOR_VALIDATION, SET_LIQUIDATION_FACTOR_WITHOUT_PRICE, SET_LIQUIDATION_FACTOR_LOWER_THAN_COLLATERAL_FACTOR, SET_LIQUIDATION_FACTOR_LOWER_THAN_EXISTING_FACTOR, SET_COLLATERAL_FACTOR_HIGHER_THAN_LIQUIDATION_FACTOR, SET_RAIN_MAKER_OWNER_CHECK, ENTER_MARKET_NOT_ALLOWED, UPDATE_LN_VERSION_ADMIN_OWNER_CHECK, // V0.002 SET_BOUNCER_OWNER_CHECK, SET_LIMIT_MINTING_OWNER_CHECK, SET_LIMIT_BORROWING_OWNER_CHECK, SET_MIN_BORROW_AMOUNT_USD_OWNER_CHECK, SUPPORT_NEW_MARKET_OWNER_CHECK, SUPPORT_NEW_MARKET_COMBINATION_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, // OLA_ADDITIONS : All Enums from here BAD_SYSTEM_PARAMS } /* * Notice: 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, // OLA_ADDITIONS : All Enums from here REDUCE_RESERVES_OLA_PART_CALCULATION_FAILED } /** * @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); } } /** * @title Careful Math * @author Compound * @notice Derived from OpenZeppelin's SafeMath library * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract CarefulMath { /** * @dev Possible error codes that we can return */ enum MathError { NO_ERROR, DIVISION_BY_ZERO, INTEGER_OVERFLOW, INTEGER_UNDERFLOW } /** * @dev Multiplies two numbers, returns an error on overflow. */ function mulUInt(uint a, uint b) internal pure returns (MathError, uint) { if (a == 0) { return (MathError.NO_ERROR, 0); } uint c = a * b; if (c / a != b) { return (MathError.INTEGER_OVERFLOW, 0); } else { return (MathError.NO_ERROR, c); } } /** * @dev Integer division of two numbers, truncating the quotient. */ function divUInt(uint a, uint b) internal pure returns (MathError, uint) { if (b == 0) { return (MathError.DIVISION_BY_ZERO, 0); } return (MathError.NO_ERROR, a / b); } /** * @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend). */ function subUInt(uint a, uint b) internal pure returns (MathError, uint) { if (b <= a) { return (MathError.NO_ERROR, a - b); } else { return (MathError.INTEGER_UNDERFLOW, 0); } } /** * @dev Adds two numbers, returns an error on overflow. */ function addUInt(uint a, uint b) internal pure returns (MathError, uint) { uint c = a + b; if (c >= a) { return (MathError.NO_ERROR, c); } else { return (MathError.INTEGER_OVERFLOW, 0); } } /** * @dev add a and b and then subtract c */ function addThenSubUInt(uint a, uint b, uint c) internal pure returns (MathError, uint) { (MathError err0, uint sum) = addUInt(a, b); if (err0 != MathError.NO_ERROR) { return (err0, 0); } return subUInt(sum, c); } } /** * @title Exponential module for storing fixed-precision decimals * @author Compound * @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) { Exp memory product = mul_(a, scalar); return truncate(product); } /** * @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) { Exp memory product = mul_(a, scalar); return add_(truncate(product), 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, string memory errorMessage) pure internal returns (uint224) { require(n < 2**224, errorMessage); return uint224(n); } function safe32(uint n, string memory errorMessage) pure internal returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function add_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: add_(a.mantissa, b.mantissa)}); } function add_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: add_(a.mantissa, b.mantissa)}); } function add_(uint a, uint b) pure internal returns (uint) { return add_(a, b, "addition overflow"); } function add_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { uint c = a + b; require(c >= a, errorMessage); return c; } function sub_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: sub_(a.mantissa, b.mantissa)}); } function sub_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: sub_(a.mantissa, b.mantissa)}); } function sub_(uint a, uint b) pure internal returns (uint) { return sub_(a, b, "subtraction underflow"); } function sub_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { require(b <= a, errorMessage); return a - b; } function mul_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: mul_(a.mantissa, b.mantissa) / expScale}); } function mul_(Exp memory a, uint b) pure internal returns (Exp memory) { return Exp({mantissa: mul_(a.mantissa, b)}); } function mul_(uint a, Exp memory b) pure internal returns (uint) { return mul_(a, b.mantissa) / expScale; } function mul_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: mul_(a.mantissa, b.mantissa) / doubleScale}); } function mul_(Double memory a, uint b) pure internal returns (Double memory) { return Double({mantissa: mul_(a.mantissa, b)}); } function mul_(uint a, Double memory b) pure internal returns (uint) { return mul_(a, b.mantissa) / doubleScale; } function mul_(uint a, uint b) pure internal returns (uint) { return mul_(a, b, "multiplication overflow"); } function mul_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { if (a == 0 || b == 0) { return 0; } uint c = a * b; require(c / a == b, errorMessage); return c; } function div_(Exp memory a, Exp memory b) pure internal returns (Exp memory) { return Exp({mantissa: div_(mul_(a.mantissa, expScale), b.mantissa)}); } function div_(Exp memory a, uint b) pure internal returns (Exp memory) { return Exp({mantissa: div_(a.mantissa, b)}); } function div_(uint a, Exp memory b) pure internal returns (uint) { return div_(mul_(a, expScale), b.mantissa); } function div_(Double memory a, Double memory b) pure internal returns (Double memory) { return Double({mantissa: div_(mul_(a.mantissa, doubleScale), b.mantissa)}); } function div_(Double memory a, uint b) pure internal returns (Double memory) { return Double({mantissa: div_(a.mantissa, b)}); } function div_(uint a, Double memory b) pure internal returns (uint) { return div_(mul_(a, doubleScale), b.mantissa); } function div_(uint a, uint b) pure internal returns (uint) { return div_(a, b, "divide by zero"); } function div_(uint a, uint b, string memory errorMessage) pure internal returns (uint) { require(b > 0, errorMessage); return a / b; } function fraction(uint a, uint b) pure internal returns (Double memory) { return Double({mantissa: div_(mul_(a, doubleScale), b)}); } } /** * @title Exponential module for storing fixed-precision decimals * @author Compound * @dev Legacy contract for compatibility reasons with existing contracts that still use MathError * @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 Exponential is CarefulMath, ExponentialNoError { /** * @dev Creates an exponential from numerator and denominator values. * Note: Returns an error if (`num` * 10e18) > MAX_INT, * or if `denom` is zero. */ function getExp(uint num, uint denom) pure internal returns (MathError, Exp memory) { (MathError err0, uint scaledNumerator) = mulUInt(num, expScale); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } (MathError err1, uint rational) = divUInt(scaledNumerator, denom); if (err1 != MathError.NO_ERROR) { return (err1, Exp({mantissa: 0})); } return (MathError.NO_ERROR, Exp({mantissa: rational})); } /** * @dev Adds two exponentials, returning a new exponential. */ function addExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError error, uint result) = addUInt(a.mantissa, b.mantissa); return (error, Exp({mantissa: result})); } /** * @dev Subtracts two exponentials, returning a new exponential. */ function subExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError error, uint result) = subUInt(a.mantissa, b.mantissa); return (error, Exp({mantissa: result})); } /** * @dev Multiply an Exp by a scalar, returning a new Exp. */ function mulScalar(Exp memory a, uint scalar) pure internal returns (MathError, Exp memory) { (MathError err0, uint scaledMantissa) = mulUInt(a.mantissa, scalar); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } return (MathError.NO_ERROR, Exp({mantissa: scaledMantissa})); } /** * @dev Multiply an Exp by a scalar, then truncate to return an unsigned integer. */ function mulScalarTruncate(Exp memory a, uint scalar) pure internal returns (MathError, uint) { (MathError err, Exp memory product) = mulScalar(a, scalar); if (err != MathError.NO_ERROR) { return (err, 0); } return (MathError.NO_ERROR, truncate(product)); } /** * @dev Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer. */ function mulScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) pure internal returns (MathError, uint) { (MathError err, Exp memory product) = mulScalar(a, scalar); if (err != MathError.NO_ERROR) { return (err, 0); } return addUInt(truncate(product), addend); } /** * @dev Divide an Exp by a scalar, returning a new Exp. */ function divScalar(Exp memory a, uint scalar) pure internal returns (MathError, Exp memory) { (MathError err0, uint descaledMantissa) = divUInt(a.mantissa, scalar); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } return (MathError.NO_ERROR, Exp({mantissa: descaledMantissa})); } /** * @dev Divide a scalar by an Exp, returning a new Exp. */ function divScalarByExp(uint scalar, Exp memory divisor) pure internal returns (MathError, Exp memory) { /* We are doing this as: getExp(mulUInt(expScale, scalar), divisor.mantissa) How it works: Exp = a / b; Scalar = s; `s / (a / b)` = `b * s / a` and since for an Exp `a = mantissa, b = expScale` */ (MathError err0, uint numerator) = mulUInt(expScale, scalar); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } return getExp(numerator, divisor.mantissa); } /** * @dev Divide a scalar by an Exp, then truncate to return an unsigned integer. */ function divScalarByExpTruncate(uint scalar, Exp memory divisor) pure internal returns (MathError, uint) { (MathError err, Exp memory fraction) = divScalarByExp(scalar, divisor); if (err != MathError.NO_ERROR) { return (err, 0); } return (MathError.NO_ERROR, truncate(fraction)); } /** * @dev Multiplies two exponentials, returning a new exponential. */ function mulExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { (MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa); if (err0 != MathError.NO_ERROR) { return (err0, Exp({mantissa: 0})); } // We add half the scale before dividing so that we get rounding instead of truncation. // See "Listing 6" and text above it at https://accu.org/index.php/journals/1717 // Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18. (MathError err1, uint doubleScaledProductWithHalfScale) = addUInt(halfExpScale, doubleScaledProduct); if (err1 != MathError.NO_ERROR) { return (err1, Exp({mantissa: 0})); } (MathError err2, uint product) = divUInt(doubleScaledProductWithHalfScale, expScale); // The only error `div` can return is MathError.DIVISION_BY_ZERO but we control `expScale` and it is not zero. assert(err2 == MathError.NO_ERROR); return (MathError.NO_ERROR, Exp({mantissa: product})); } /** * @dev Multiplies two exponentials given their mantissas, returning a new exponential. */ function mulExp(uint a, uint b) pure internal returns (MathError, Exp memory) { return mulExp(Exp({mantissa: a}), Exp({mantissa: b})); } /** * @dev Multiplies three exponentials, returning a new exponential. */ function mulExp3(Exp memory a, Exp memory b, Exp memory c) pure internal returns (MathError, Exp memory) { (MathError err, Exp memory ab) = mulExp(a, b); if (err != MathError.NO_ERROR) { return (err, ab); } return mulExp(ab, c); } /** * @dev Divides two exponentials, returning a new exponential. * (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b, * which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa) */ function divExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) { return getExp(a.mantissa, b.mantissa); } } /** * @title ERC 20 Token Standard Interface * https://eips.ethereum.org/EIPS/eip-20 */ interface EIP20Interface { 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 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 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 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 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 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); } interface RegistryForOToken { function isSupportedInterestRateModel(address interestRateModel) external returns (bool); function olaBankAddress() external view returns (address payable); function blocksBased() external view returns (bool); } interface ComptrollerForOToken { function adminBankAddress() external view returns (address payable); } /** * @title Compound's CToken Contract * @notice Abstract base for CTokens * @author Compound */ contract CToken is CTokenStorage, CTokenInterface, CTokenViewInterface, Exponential, TokenErrorReporter { /** * @notice Initialize the money market * @param comptroller_ The address of the Comptroller * @param interestRateModel_ The address of the interest rate model * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18 * @param name_ EIP-20 name of this token * @param symbol_ EIP-20 symbol of this token * @param decimals_ EIP-20 decimal precision of this token */ function initialize(ComptrollerInterface comptroller_, InterestRateModel interestRateModel_, uint initialExchangeRateMantissa_, string memory name_, string memory symbol_, uint8 decimals_) public { require(msg.sender == admin, "only admin may initialize the market"); require(accrualBlockNumber == 0 && borrowIndex == 0, "market may only be initialized once"); // Set initial exchange rate initialExchangeRateMantissa = initialExchangeRateMantissa_; require(initialExchangeRateMantissa > 0, "initial exchange rate must be greater than zero."); // Set the Comptroller uint err = _setComptroller(comptroller_); require(err == uint(Error.NO_ERROR), "setting comptroller failed"); // Initialize block number and borrow index (block number mocks depend on Comptroller being set) accrualBlockNumber = getBlockNumber(); accrualBlockTimestamp = getBlockTimestamp(); borrowIndex = mantissaOne; // Set the calculation based flag from the ministry RegistryForOToken ministry = RegistryForOToken(comptroller.getRegistry()); blocksBased = ministry.blocksBased(); // Set the interest rate model (depends on block number / borrow index) err = _setInterestRateModelFresh(interestRateModel_); require(err == uint(Error.NO_ERROR), "setting interest rate model failed"); name = name_; symbol = symbol_; decimals = decimals_; // The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund) _notEntered = true; } /** * @notice Transfer `tokens` tokens from `src` to `dst` by `spender` * @dev Called by both `transfer` and `transferFrom` internally * @param spender The address of the account performing the transfer * @param src The address of the source account * @param dst The address of the destination account * @param tokens The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) { /* Fail if transfer not allowed */ uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens); if (allowed != 0) { return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed); } /* Do not allow self-transfers */ if (src == dst) { return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED); } /* Get the allowance, infinite for the account owner */ uint startingAllowance = 0; if (spender == src) { startingAllowance = uint(-1); } else { startingAllowance = transferAllowances[src][spender]; } /* Do the calculations, checking for {under,over}flow */ MathError mathErr; uint allowanceNew; uint srcTokensNew; uint dstTokensNew; (mathErr, allowanceNew) = subUInt(startingAllowance, tokens); if (mathErr != MathError.NO_ERROR) { return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED); } (mathErr, srcTokensNew) = subUInt(accountTokens[src], tokens); if (mathErr != MathError.NO_ERROR) { return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH); } (mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens); if (mathErr != MathError.NO_ERROR) { return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) accountTokens[src] = srcTokensNew; accountTokens[dst] = dstTokensNew; /* Eat some of the allowance (if necessary) */ if (startingAllowance != uint(-1)) { transferAllowances[src][spender] = allowanceNew; } /* We emit a Transfer event */ emit Transfer(src, dst, tokens); // unused function comptroller.transferVerify(address(this), src, dst, tokens); return uint(Error.NO_ERROR); } /** * @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 Whether or not the transfer succeeded */ function transfer(address dst, uint256 amount) external nonReentrant returns (bool) { return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR); } /** * @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 Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) { return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR); } /** * @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 Whether or not the approval succeeded */ function approve(address spender, uint256 amount) external returns (bool) { address src = msg.sender; transferAllowances[src][spender] = amount; emit Approval(src, spender, amount); return true; } /** * @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 The number of tokens allowed to be spent (-1 means infinite) */ function allowance(address owner, address spender) external view returns (uint256) { return transferAllowances[owner][spender]; } /** * @notice Get the token balance of the `owner` * @param owner The address of the account to query * @return The number of tokens owned by `owner` */ function balanceOf(address owner) external view returns (uint256) { return accountTokens[owner]; } /** * @notice Get the underlying balance of the `owner` * @dev This also accrues interest in a transaction * @param owner The address of the account to query * @return The amount of underlying owned by `owner` */ function balanceOfUnderlying(address owner) external returns (uint) { Exp memory exchangeRate = Exp({mantissa: exchangeRateCurrent()}); (MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]); require(mErr == MathError.NO_ERROR, "balance could not be calculated"); return balance; } /** * @notice Get a snapshot of the account's balances, and the cached exchange rate * @dev This is used by Comptroller to more efficiently perform liquidity checks. * @param account Address of the account to snapshot * @return (possible error, token balance, borrow balance, exchange rate mantissa) */ function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) { uint cTokenBalance = accountTokens[account]; uint borrowBalance; uint exchangeRateMantissa; MathError mErr; (mErr, borrowBalance) = borrowBalanceStoredInternal(account); if (mErr != MathError.NO_ERROR) { return (uint(Error.MATH_ERROR), 0, 0, 0); } (mErr, exchangeRateMantissa) = exchangeRateStoredInternal(); if (mErr != MathError.NO_ERROR) { return (uint(Error.MATH_ERROR), 0, 0, 0); } return (uint(Error.NO_ERROR), cTokenBalance, borrowBalance, exchangeRateMantissa); } /** * @dev Function to simply retrieve block number * This exists mainly for inheriting test contracts to stub this result. */ function getBlockNumber() internal view returns (uint) { return block.number; } /** * @dev Function to simply retrieve block timestamp * This exists mainly for inheriting test contracts to stub this result. */ function getBlockTimestamp() internal view returns (uint) { return block.timestamp; } /** * @notice Returns the current per-block borrow interest rate for this cToken * @return The borrow interest rate per block, scaled by 1e18 */ function borrowRatePerBlock() external view returns (uint) { return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves); } /** * @notice Returns the current per-block supply interest rate for this cToken * @return The supply interest rate per block, scaled by 1e18 */ function supplyRatePerBlock() external view returns (uint) { return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa); } /** * @notice Returns the current total borrows plus accrued interest * @return The total borrows with interest */ function totalBorrowsCurrent() external nonReentrant returns (uint) { require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed"); return totalBorrows; } /** * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex * @param account The address whose balance should be calculated after updating borrowIndex * @return The calculated balance */ function borrowBalanceCurrent(address account) external nonReentrant returns (uint) { require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed"); return borrowBalanceStored(account); } /** * @notice Return the borrow balance of account based on stored data * @param account The address whose balance should be calculated * @return The calculated balance */ function borrowBalanceStored(address account) public view returns (uint) { (MathError err, uint result) = borrowBalanceStoredInternal(account); require(err == MathError.NO_ERROR, "borrowBalanceStored: borrowBalanceStoredInternal failed"); return result; } /** * @notice Return the borrow balance of account based on stored data * @param account The address whose balance should be calculated * @return (error code, the calculated balance or 0 if error code is non-zero) */ function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) { /* Note: we do not assert that the market is up to date */ MathError mathErr; uint principalTimesIndex; uint result; /* Get borrowBalance and borrowIndex */ BorrowSnapshot storage borrowSnapshot = accountBorrows[account]; /* If borrowBalance = 0 then borrowIndex is likely also 0. * Rather than failing the calculation with a division by 0, we immediately return 0 in this case. */ if (borrowSnapshot.principal == 0) { return (MathError.NO_ERROR, 0); } /* Calculate new borrow balance using the interest index: * recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex */ (mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, borrowIndex); if (mathErr != MathError.NO_ERROR) { return (mathErr, 0); } (mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex); if (mathErr != MathError.NO_ERROR) { return (mathErr, 0); } return (MathError.NO_ERROR, result); } /** * @notice Accrue interest then return the up-to-date exchange rate * @return Calculated exchange rate scaled by 1e18 */ function exchangeRateCurrent() public nonReentrant returns (uint) { require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed"); return exchangeRateStored(); } /** * @notice Calculates the exchange rate from the underlying to the CToken * @dev This function does not accrue interest before calculating the exchange rate * @return Calculated exchange rate scaled by 1e18 */ function exchangeRateStored() public view returns (uint) { (MathError err, uint result) = exchangeRateStoredInternal(); require(err == MathError.NO_ERROR, "exchangeRateStored: exchangeRateStoredInternal failed"); return result; } /** * @notice Calculates the exchange rate from the underlying to the CToken * @dev This function does not accrue interest before calculating the exchange rate * @return (error code, calculated exchange rate scaled by 1e18) */ function exchangeRateStoredInternal() internal view returns (MathError, uint) { uint _totalSupply = totalSupply; if (_totalSupply == 0) { /* * If there are no tokens minted: * exchangeRate = initialExchangeRate */ return (MathError.NO_ERROR, initialExchangeRateMantissa); } else { /* * Otherwise: * exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply */ uint totalCash = getCashPrior(); uint cashPlusBorrowsMinusReserves; Exp memory exchangeRate; MathError mathErr; (mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(totalCash, totalBorrows, totalReserves); if (mathErr != MathError.NO_ERROR) { return (mathErr, 0); } (mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply); if (mathErr != MathError.NO_ERROR) { return (mathErr, 0); } return (MathError.NO_ERROR, exchangeRate.mantissa); } } /** * @notice Get cash balance of this cToken in the underlying asset * @return The quantity of underlying asset owned by this contract */ function getCash() external view returns (uint) { return getCashPrior(); } /** * @notice Get the accrual block number of this cToken * @return The accrual block number */ function getAccrualBlockNumber() external view returns (uint) { return accrualBlockNumber; } /** * @notice Applies accrued interest to total borrows and reserves * @dev This calculates interest accrued from the last checkpointed block * up to the current block and writes new checkpoint to storage. */ function accrueInterest() public returns (uint) { /* Remember the initial block number */ uint currentBlockNumber = getBlockNumber(); uint accrualBlockNumberPrior = accrualBlockNumber; uint currentBlockTimestamp = getBlockTimestamp(); /* Short-circuit accumulating 0 interest */ if (accrualBlockNumberPrior == currentBlockNumber) { return uint(Error.NO_ERROR); } // OLA_ADDITIONS : Distinction between time and block based calculations /* Calculate the number of blocks elapsed since the last accrual */ MathError mathErr; uint delta; if (blocksBased) { (mathErr, delta) = subUInt(currentBlockNumber, accrualBlockNumberPrior); } else { // This variable is defined here due to solidity limits uint accrualBlockTimestampPrior = accrualBlockTimestamp; /* Short-circuit accumulating 0 interest on time based chains + extra safety for weird timestamps */ if (currentBlockTimestamp <= accrualBlockTimestampPrior) { return uint(Error.NO_ERROR); } (mathErr, delta) = subUInt(currentBlockTimestamp, accrualBlockTimestampPrior); } require(mathErr == MathError.NO_ERROR, "could not calculate delta"); /* Read the previous values out of storage */ uint cashPrior = getCashPrior(); uint borrowsPrior = totalBorrows; uint reservesPrior = totalReserves; uint borrowIndexPrior = borrowIndex; /* Calculate the current borrow interest rate */ uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, borrowsPrior, reservesPrior); require(borrowRateMantissa <= borrowRateMaxMantissa, "borrow rate is absurdly high"); /* * Calculate the interest accumulated into borrows and reserves and the new index: * simpleInterestFactor = borrowRate * delta * interestAccumulated = simpleInterestFactor * totalBorrows * totalBorrowsNew = interestAccumulated + totalBorrows * totalReservesNew = interestAccumulated * reserveFactor + totalReserves * borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex */ Exp memory simpleInterestFactor; uint interestAccumulated; uint totalBorrowsNew; uint totalReservesNew; uint borrowIndexNew; (mathErr, simpleInterestFactor) = mulScalar(Exp({mantissa: borrowRateMantissa}), delta); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED, uint(mathErr)); } (mathErr, interestAccumulated) = mulScalarTruncate(simpleInterestFactor, borrowsPrior); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED, uint(mathErr)); } (mathErr, totalBorrowsNew) = addUInt(interestAccumulated, borrowsPrior); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED, uint(mathErr)); } (mathErr, totalReservesNew) = mulScalarTruncateAddUInt(Exp({mantissa: reserveFactorMantissa}), interestAccumulated, reservesPrior); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED, uint(mathErr)); } (mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndexPrior, borrowIndexPrior); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED, uint(mathErr)); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* We write the previously calculated values into storage */ accrualBlockNumber = currentBlockNumber; accrualBlockTimestamp = currentBlockTimestamp; borrowIndex = borrowIndexNew; totalBorrows = totalBorrowsNew; totalReserves = totalReservesNew; /* We emit an AccrueInterest event */ emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew); return uint(Error.NO_ERROR); } /** * @notice Sender supplies assets into the market and receives cTokens in exchange * @dev Accrues interest whether or not the operation succeeds, unless reverted * @param mintAmount The amount of the underlying asset to supply * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount. */ function mintInternal(uint mintAmount) internal nonReentrant returns (uint, uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0); } // mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to return mintFresh(msg.sender, mintAmount); } struct MintLocalVars { Error err; MathError mathErr; uint exchangeRateMantissa; uint mintTokens; uint totalSupplyNew; uint accountTokensNew; uint actualMintAmount; } /** * @notice User supplies assets into the market and receives cTokens in exchange * @dev Assumes interest has already been accrued up to the current block * @param minter The address of the account which is supplying the assets * @param mintAmount The amount of the underlying asset to supply * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount. */ function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) { /* Fail if mint not allowed */ uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0); } MintLocalVars memory vars; (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal(); if (vars.mathErr != MathError.NO_ERROR) { return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* * We call `doTransferIn` for the minter and the mintAmount. * Note: The cToken must handle variations between ERC-20 and ETH underlying. * `doTransferIn` reverts if anything goes wrong, since we can't be sure if * side-effects occurred. The function returns the amount actually transferred, * in case of a fee. On success, the cToken holds an additional `actualMintAmount` * of cash. */ vars.actualMintAmount = doTransferIn(minter, mintAmount); /* * We get the current exchange rate and calculate the number of cTokens to be minted: * mintTokens = actualMintAmount / exchangeRate */ (vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(vars.actualMintAmount, Exp({mantissa: vars.exchangeRateMantissa})); require(vars.mathErr == MathError.NO_ERROR, "MINT_EXCHANGE_CALCULATION_FAILED"); /* * We calculate the new total supply of cTokens and minter token balance, checking for overflow: * totalSupplyNew = totalSupply + mintTokens * accountTokensNew = accountTokens[minter] + mintTokens */ (vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens); require(vars.mathErr == MathError.NO_ERROR, "MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED"); (vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens); require(vars.mathErr == MathError.NO_ERROR, "MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED"); /* We write previously calculated values into storage */ totalSupply = vars.totalSupplyNew; accountTokens[minter] = vars.accountTokensNew; /* We emit a Mint event, and a Transfer event */ emit Mint(minter, vars.actualMintAmount, vars.mintTokens); emit Transfer(address(this), minter, vars.mintTokens); /* We call the defense hook */ // unused function comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens); return (uint(Error.NO_ERROR), vars.actualMintAmount); } /** * @notice Sender redeems cTokens in exchange for the underlying asset * @dev Accrues interest whether or not the operation succeeds, unless reverted * @param redeemTokens The number of cTokens to redeem into underlying * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function redeemInternal(uint redeemTokens) internal nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED); } // redeemFresh emits redeem-specific logs on errors, so we don't need to return redeemFresh(msg.sender, redeemTokens, 0); } /** * @notice Sender redeems cTokens in exchange for a specified amount of underlying asset * @dev Accrues interest whether or not the operation succeeds, unless reverted * @param redeemAmount The amount of underlying to receive from redeeming cTokens * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function redeemUnderlyingInternal(uint redeemAmount) internal nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED); } // redeemFresh emits redeem-specific logs on errors, so we don't need to return redeemFresh(msg.sender, 0, redeemAmount); } struct RedeemLocalVars { Error err; MathError mathErr; uint exchangeRateMantissa; uint redeemTokens; uint redeemAmount; uint totalSupplyNew; uint accountTokensNew; } /** * @notice User redeems cTokens in exchange for the underlying asset * @dev Assumes interest has already been accrued up to the current block * @param redeemer The address of the account which is redeeming the tokens * @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) * @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero) * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) { require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero"); RedeemLocalVars memory vars; /* exchangeRate = invoke Exchange Rate Stored() */ (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal(); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)); } /* If redeemTokensIn > 0: */ if (redeemTokensIn > 0) { /* * We calculate the exchange rate and the amount of underlying to be redeemed: * redeemTokens = redeemTokensIn * redeemAmount = redeemTokensIn x exchangeRateCurrent */ vars.redeemTokens = redeemTokensIn; (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), redeemTokensIn); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint(vars.mathErr)); } } else { /* * We get the current exchange rate and calculate the amount to be redeemed: * redeemTokens = redeemAmountIn / exchangeRate * redeemAmount = redeemAmountIn */ (vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(redeemAmountIn, Exp({mantissa: vars.exchangeRateMantissa})); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED, uint(vars.mathErr)); } vars.redeemAmount = redeemAmountIn; } /* Fail if redeem not allowed */ uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens); if (allowed != 0) { return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK); } /* * We calculate the new total supply and redeemer balance, checking for underflow: * totalSupplyNew = totalSupply - redeemTokens * accountTokensNew = accountTokens[redeemer] - redeemTokens */ (vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint(vars.mathErr)); } (vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint(vars.mathErr)); } /* Fail gracefully if protocol has insufficient cash */ if (getCashPrior() < vars.redeemAmount) { return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* * We invoke doTransferOut for the redeemer and the redeemAmount. * Note: The cToken must handle variations between ERC-20 and ETH underlying. * On success, the cToken has redeemAmount less of cash. * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred. */ doTransferOut(redeemer, vars.redeemAmount); /* We write previously calculated values into storage */ totalSupply = vars.totalSupplyNew; accountTokens[redeemer] = vars.accountTokensNew; /* We emit a Transfer event, and a Redeem event */ emit Transfer(redeemer, address(this), vars.redeemTokens); emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens); /* We call the defense hook */ comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens); return uint(Error.NO_ERROR); } /** * @notice Sender borrows assets from the protocol to their own address * @param borrowAmount The amount of the underlying asset to borrow * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function borrowInternal(uint borrowAmount) internal nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed return fail(Error(error), FailureInfo.BORROW_ACCRUE_INTEREST_FAILED); } // borrowFresh emits borrow-specific logs on errors, so we don't need to return borrowFresh(msg.sender, borrowAmount); } struct BorrowLocalVars { MathError mathErr; uint accountBorrows; uint accountBorrowsNew; uint totalBorrowsNew; } /** * @notice Users borrow assets from the protocol to their own address * @param borrowAmount The amount of the underlying asset to borrow * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function borrowFresh(address payable borrower, uint borrowAmount) internal returns (uint) { /* Fail if borrow not allowed */ uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount); if (allowed != 0) { return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK); } /* Fail gracefully if protocol has insufficient underlying cash */ if (getCashPrior() < borrowAmount) { return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.BORROW_CASH_NOT_AVAILABLE); } BorrowLocalVars memory vars; /* * We calculate the new borrower and total borrow balances, failing on overflow: * accountBorrowsNew = accountBorrows + borrowAmount * totalBorrowsNew = totalBorrows + borrowAmount */ (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, uint(vars.mathErr)); } (vars.mathErr, vars.accountBorrowsNew) = addUInt(vars.accountBorrows, borrowAmount); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED, uint(vars.mathErr)); } (vars.mathErr, vars.totalBorrowsNew) = addUInt(totalBorrows, borrowAmount); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, uint(vars.mathErr)); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* * We invoke doTransferOut for the borrower and the borrowAmount. * Note: The cToken must handle variations between ERC-20 and ETH underlying. * On success, the cToken borrowAmount less of cash. * doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred. */ doTransferOut(borrower, borrowAmount); /* We write the previously calculated values into storage */ accountBorrows[borrower].principal = vars.accountBorrowsNew; accountBorrows[borrower].interestIndex = borrowIndex; totalBorrows = vars.totalBorrowsNew; /* We emit a Borrow event */ emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew); /* We call the defense hook */ // unused function // Comptroller.borrowVerify(address(this), borrower, borrowAmount); return uint(Error.NO_ERROR); } /** * @notice Sender repays their own borrow * @param repayAmount The amount to repay * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount. */ function repayBorrowInternal(uint repayAmount) internal nonReentrant returns (uint, uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed return (fail(Error(error), FailureInfo.REPAY_BORROW_ACCRUE_INTEREST_FAILED), 0); } // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to return repayBorrowFresh(msg.sender, msg.sender, repayAmount); } /** * @notice Sender repays a borrow belonging to borrower * @param borrower the account with the debt being payed off * @param repayAmount The amount to repay * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount. */ function repayBorrowBehalfInternal(address borrower, uint repayAmount) internal nonReentrant returns (uint, uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed return (fail(Error(error), FailureInfo.REPAY_BEHALF_ACCRUE_INTEREST_FAILED), 0); } // repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to return repayBorrowFresh(msg.sender, borrower, repayAmount); } struct RepayBorrowLocalVars { Error err; MathError mathErr; uint repayAmount; uint borrowerIndex; uint accountBorrows; uint accountBorrowsNew; uint totalBorrowsNew; uint actualRepayAmount; } /** * @notice Borrows are repaid by another user (possibly the borrower). * @param payer the account paying off the borrow * @param borrower the account with the debt being payed off * @param repayAmount the amount of undelrying tokens being returned * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount. */ function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) { /* Fail if repayBorrow not allowed */ uint allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0); } RepayBorrowLocalVars memory vars; /* We remember the original borrowerIndex for verification purposes */ vars.borrowerIndex = accountBorrows[borrower].interestIndex; /* We fetch the amount the borrower owes, with accumulated interest */ (vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower); if (vars.mathErr != MathError.NO_ERROR) { return (failOpaque(Error.MATH_ERROR, FailureInfo.REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, uint(vars.mathErr)), 0); } /* If repayAmount == -1, repayAmount = accountBorrows */ if (repayAmount == uint(-1)) { vars.repayAmount = vars.accountBorrows; } else { vars.repayAmount = repayAmount; } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* * We call doTransferIn for the payer and the repayAmount * Note: The cToken must handle variations between ERC-20 and ETH underlying. * On success, the cToken holds an additional repayAmount of cash. * doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred. * it returns the amount actually transferred, in case of a fee. */ vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount); /* * We calculate the new borrower and total borrow balances, failing on underflow: * accountBorrowsNew = accountBorrows - actualRepayAmount * totalBorrowsNew = totalBorrows - actualRepayAmount */ (vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount); require(vars.mathErr == MathError.NO_ERROR, "REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED"); (vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount); require(vars.mathErr == MathError.NO_ERROR, "REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED"); /* We write the previously calculated values into storage */ accountBorrows[borrower].principal = vars.accountBorrowsNew; accountBorrows[borrower].interestIndex = borrowIndex; totalBorrows = vars.totalBorrowsNew; /* We emit a RepayBorrow event */ emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew); /* We call the defense hook */ // unused function // Comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount, vars.borrowerIndex); return (uint(Error.NO_ERROR), vars.actualRepayAmount); } /** * @notice The sender liquidates the borrowers collateral. * The collateral seized is transferred to the liquidator. * @param borrower The borrower of this cToken to be liquidated * @param cTokenCollateral The market in which to seize collateral from the borrower * @param repayAmount The amount of the underlying borrowed asset to repay * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount. */ function liquidateBorrowInternal(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal nonReentrant returns (uint, uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED), 0); } error = cTokenCollateral.accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED), 0); } // liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral); } /** * @notice The liquidator liquidates the borrowers collateral. * The collateral seized is transferred to the liquidator. * @param borrower The borrower of this cToken to be liquidated * @param liquidator The address repaying the borrow and seizing collateral * @param cTokenCollateral The market in which to seize collateral from the borrower * @param repayAmount The amount of the underlying borrowed asset to repay * @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount. */ function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal returns (uint, uint) { /* Fail if liquidate not allowed */ uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(cTokenCollateral), liquidator, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0); } /* Verify market's block number equals current block number */ if (accrualBlockNumber != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0); } /* Verify cTokenCollateral market's block number equals current block number */ if (cTokenCollateral.getAccrualBlockNumber() != getBlockNumber()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0); } /* Fail if borrower = liquidator */ if (borrower == liquidator) { return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0); } /* Fail if repayAmount = 0 */ if (repayAmount == 0) { return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0); } /* Fail if repayAmount = -1 */ if (repayAmount == uint(-1)) { return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0); } /* Fail if repayBorrow fails */ (uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount); if (repayBorrowError != uint(Error.NO_ERROR)) { return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* We calculate the number of collateral tokens that will be seized */ (uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(address(this), address(cTokenCollateral), actualRepayAmount); require(amountSeizeError == uint(Error.NO_ERROR), "LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED"); /* Revert if borrower collateral token balance < seizeTokens */ require(cTokenCollateral.balanceOf(borrower) >= seizeTokens, "LIQUIDATE_SEIZE_TOO_MUCH"); // If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call uint seizeError; if (address(cTokenCollateral) == address(this)) { seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens); } else { seizeError = cTokenCollateral.seize(liquidator, borrower, seizeTokens); } /* Revert if seize tokens fails (since we cannot be sure of side effects) */ require(seizeError == uint(Error.NO_ERROR), "token seizure failed"); /* We emit a LiquidateBorrow event */ emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(cTokenCollateral), seizeTokens); /* We call the defense hook */ // unused function // Comptroller.liquidateBorrowVerify(address(this), address(cTokenCollateral), liquidator, borrower, actualRepayAmount, seizeTokens); return (uint(Error.NO_ERROR), actualRepayAmount); } /** * @notice Transfers collateral tokens (this market) to the liquidator. * @dev Will fail unless called by another cToken during the process of liquidation. * Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter. * @param liquidator The account receiving seized collateral * @param borrower The account having collateral seized * @param seizeTokens The number of cTokens to seize * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) { return seizeInternal(msg.sender, liquidator, borrower, seizeTokens); } /** * @notice Transfers collateral tokens (this market) to the liquidator. * @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken. * Its absolutely critical to use msg.sender as the seizer cToken and not a parameter. * @param seizerToken The contract seizing the collateral (i.e. borrowed cToken) * @param liquidator The account receiving seized collateral * @param borrower The account having collateral seized * @param seizeTokens The number of cTokens to seize * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) { /* Fail if seize not allowed */ uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens); if (allowed != 0) { return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed); } /* Fail if borrower = liquidator */ if (borrower == liquidator) { return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER); } MathError mathErr; uint borrowerTokensNew; uint liquidatorTokensNew; /* * We calculate the new borrower and liquidator token balances, failing on underflow/overflow: * borrowerTokensNew = accountTokens[borrower] - seizeTokens * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens */ (mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr)); } (mathErr, liquidatorTokensNew) = addUInt(accountTokens[liquidator], seizeTokens); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(mathErr)); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* We write the previously calculated values into storage */ accountTokens[borrower] = borrowerTokensNew; accountTokens[liquidator] = liquidatorTokensNew; /* Emit a Transfer event */ emit Transfer(borrower, liquidator, seizeTokens); /* We call the defense hook */ // Transfer verify is required here due to tokens being transferred, and have to keep the // ACC accounting in check // This works, because the 'borrower' has to be in this market. and so, the active collateral usage can either remain unchanged // (if the liquidator is also in the market) or reduce (if the liquidator is not in the market) comptroller.transferVerify(address(this), borrower, liquidator, seizeTokens); /* We call the defense hook */ // unused function // Comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens); return uint(Error.NO_ERROR); } /*** Admin Functions ***/ /** * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. * @param newPendingAdmin New pending admin. * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) { // Check caller = admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK); } // Save current value, if any, for inclusion in log address oldPendingAdmin = pendingAdmin; // Store pendingAdmin with value newPendingAdmin pendingAdmin = newPendingAdmin; // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin) emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin); return uint(Error.NO_ERROR); } /** * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin * @dev Admin function for pending admin to accept role and update admin * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _acceptAdmin() external returns (uint) { // Check caller is pendingAdmin and pendingAdmin ≠ address(0) if (msg.sender != pendingAdmin || msg.sender == address(0)) { return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK); } // Save current values for inclusion in log address oldAdmin = admin; address oldPendingAdmin = pendingAdmin; // Store admin with value pendingAdmin admin = pendingAdmin; // Clear the pending value pendingAdmin = address(0); emit NewAdmin(oldAdmin, admin); emit NewPendingAdmin(oldPendingAdmin, pendingAdmin); return uint(Error.NO_ERROR); } /** * OLA_ADDITIONS : Made internal and removes Admin check. * @notice Sets a new Comptroller for the market * @dev Admin function to set a new Comptroller * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setComptroller(ComptrollerInterface newComptroller) internal returns (uint) { ComptrollerInterface oldComptroller = comptroller; // Ensure invoke Comptroller.isComptroller() returns true require(newComptroller.isComptroller(), "marker method returned false"); // Set market's Comptroller to newComptroller comptroller = newComptroller; // Emit NewComptroller(oldComptroller, newComptroller) emit NewComptroller(oldComptroller, newComptroller); return uint(Error.NO_ERROR); } /** * @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh * @dev Admin function to accrue interest and set a new reserve factor * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setReserveFactor(uint newReserveFactorMantissa) external nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reserve factor change failed. return fail(Error(error), FailureInfo.SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED); } // _setReserveFactorFresh emits reserve-factor-specific logs on errors, so we don't need to. return _setReserveFactorFresh(newReserveFactorMantissa); } /** * @notice Sets a new reserve factor for the protocol (*requires fresh interest accrual) * @dev Admin function to set a new reserve factor * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setReserveFactorFresh(uint newReserveFactorMantissa) internal returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK); } // Verify market's block number equals current block number if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK); } // Check newReserveFactor ≤ maxReserveFactor if (newReserveFactorMantissa > reserveFactorMaxMantissa) { return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK); } // OLA_ADDITIONS :This constraint // Check newReserveFactor >= minReserveFactor if (newReserveFactorMantissa < reserveFactorMinMantissa) { return fail(Error.BAD_INPUT, FailureInfo.SET_RESERVE_FACTOR_BOUNDS_CHECK); } uint oldReserveFactorMantissa = reserveFactorMantissa; reserveFactorMantissa = newReserveFactorMantissa; emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa); return uint(Error.NO_ERROR); } /** * @notice Accrues interest and reduces reserves by transferring to admin * @param reduceAmount Amount of reduction to reserves * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _reduceReserves(uint reduceAmount) external nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed. return fail(Error(error), FailureInfo.REDUCE_RESERVES_ACCRUE_INTEREST_FAILED); } // _reduceReservesFresh emits reserve-reduction-specific logs on errors, so we don't need to. return _reduceReservesFresh(reduceAmount); } /** * @notice Reduces reserves by transferring to the LeN admin and to Ola bank their respective shares * @dev Requires fresh interest accrual * @param reduceAmount Amount of reduction to reserves * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _reduceReservesFresh(uint reduceAmount) internal returns (uint) { // totalReserves - reduceAmount uint totalReservesNew; // OLA_ADDITIONS : Allowing anyone to reduce reserves // Check caller is admin // if (msg.sender != admin) { // return fail(Error.UNAUTHORIZED, FailureInfo.REDUCE_RESERVES_ADMIN_CHECK); // } // We fail gracefully unless market's block number equals current block number if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDUCE_RESERVES_FRESH_CHECK); } // Fail gracefully if protocol has insufficient underlying cash if (getCashPrior() < reduceAmount) { return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE); } // Check reduceAmount ≤ reserves[n] (totalReserves) if (reduceAmount > totalReserves) { return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION); } // OLA_ADDITIONS : Dividing the reduced amount between the Admin and Ola (+validations) // Important to notice that we have added Math calculations to this function. // Where as before, it only used pre-calculated numbers. MathError mathErr; uint adminPart; uint olaPart; uint olaReserveFactorMantissa = fetchOlaReserveFactorMantissa(); address payable olaBankAddress = fetchOlaBankAddress(); address payable adminBankAddress = fetchAdminBankAddress(); // Calculate olaPart (mathErr, olaPart) = mulScalarTruncate(Exp({mantissa: olaReserveFactorMantissa}), reduceAmount); if (mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.REDUCE_RESERVES_OLA_PART_CALCULATION_FAILED, uint(mathErr)); } // Sanity check, should never be a problem in a well parameterized system if (olaPart >= reduceAmount) { return fail(Error.BAD_SYSTEM_PARAMS, FailureInfo.REDUCE_RESERVES_OLA_PART_CALCULATION_FAILED); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) // Calculate admin part adminPart = reduceAmount - olaPart; // We checked olaPart < reduceAmount above, so this should never revert. require(adminPart < reduceAmount, "reduce reserves unexpected adminPart underflow"); totalReservesNew = totalReserves - reduceAmount; // We checked reduceAmount <= totalReserves above, so this should never revert. require(totalReservesNew <= totalReserves, "reduce reserves unexpected underflow"); // Store reserves[n+1] = reserves[n] - reduceAmount totalReserves = totalReservesNew; // OLA_ADDITIONS : Transfer reserves to both admin and Ola bank addresses // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred. doTransferOut(adminBankAddress, adminPart); doTransferOut(olaBankAddress, olaPart); emit ReservesReduced(adminBankAddress, adminPart, olaBankAddress, olaPart, totalReservesNew); return uint(Error.NO_ERROR); } /** * @notice accrues interest and updates the interest rate model using _setInterestRateModelFresh * @dev Admin function to accrue interest and update the interest rate model * @param newInterestRateModel the new interest rate model to use * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted change of interest rate model failed return fail(Error(error), FailureInfo.SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED); } // _setInterestRateModelFresh emits interest-rate-model-update-specific logs on errors, so we don't need to. return _setInterestRateModelFresh(newInterestRateModel); } /** * @notice updates the interest rate model (*requires fresh interest accrual) * @dev Admin function to update the interest rate model * @param newInterestRateModel the new interest rate model to use * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setInterestRateModelFresh(InterestRateModel newInterestRateModel) internal returns (uint) { // Used to store old model for use in the event that is emitted on success InterestRateModel oldInterestRateModel; // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_INTEREST_RATE_MODEL_OWNER_CHECK); } // We fail gracefully unless market's block number equals current block number if (accrualBlockNumber != getBlockNumber()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK); } // Ensure interest rate model is an approved contracts RegistryForOToken registry = RegistryForOToken(comptroller.getRegistry()); // TODO : CRITICAL : Add tests for 'only supported interest rate models are allowed' require(registry.isSupportedInterestRateModel(address(newInterestRateModel)), "Unapproved interest rate model"); // Track the market's current interest rate model oldInterestRateModel = interestRateModel; // Ensure invoke newInterestRateModel.isInterestRateModel() returns true require(newInterestRateModel.isInterestRateModel(), "marker method returned false"); // Set the interest rate model to newInterestRateModel interestRateModel = newInterestRateModel; // Emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel) emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel); return uint(Error.NO_ERROR); } /*** Safe Token ***/ /** * @notice Gets balance of this contract in terms of the underlying * @dev This excludes the value of the current message, if any * @return The quantity of underlying owned by this contract */ function getCashPrior() internal view returns (uint); /** * @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee. * This may revert due to insufficient balance or insufficient allowance. */ function doTransferIn(address from, uint amount) internal returns (uint); /** * @dev Performs a transfer out, ideally returning an explanatory error code upon failure tather than reverting. * If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract. * If caller has checked protocol's balance, and verified it is >= amount, this should not revert in normal conditions. */ function doTransferOut(address payable to, uint amount) internal; /** * OLA_ADDITIONS: This function * @dev Returns the ola reserves factor. */ function fetchOlaReserveFactorMantissa() internal pure returns (uint) { return olaReserveFactorMantissa; } /** * OLA_ADDITIONS: This function * @dev Fetches the ola bank address. */ function fetchOlaBankAddress() internal returns (address payable) { return RegistryForOToken(comptroller.getRegistry()).olaBankAddress(); } /** * OLA_ADDITIONS: This function * @dev Fetches the admin bank address. */ function fetchAdminBankAddress() internal view returns (address payable) { return ComptrollerForOToken(address(comptroller)).adminBankAddress(); } /*** Reentrancy Guard ***/ /** * @dev Prevents a contract from calling itself, directly or indirectly. */ modifier nonReentrant() { require(_notEntered, "re-entered"); _notEntered = false; _; _notEntered = true; // get a gas-refund post-Istanbul } } // SPDX-License-Identifier: MIT contract ComptrollerInterface { /// @notice Indicator that this is a Comptroller contract (for inspection) bool public constant isComptroller = true; /*** OLA_ADDITIONS : registry getter ***/ /*** Registry ***/ function getRegistry() external view returns (address); /*** Assets supported by the Comptroller ***/ function getAllMarkets() public view returns (CToken[] memory); /*** OLA_ADDITIONS : peripheral checkers ***/ /*** Peripherals ***/ function hasRainMaker() view public returns (bool); function hasBouncer() view public returns (bool); /*** Assets You Are In ***/ function enterMarkets(address[] calldata cTokens) external returns (uint[] memory); function exitMarket(address cToken) external returns (uint); /*** Policy Hooks ***/ function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint); function mintVerify(address cToken, address minter, uint mintAmount, uint mintTokens) external; function redeemAllowed(address cToken, address redeemer, uint redeemTokens) external returns (uint); function redeemVerify(address cToken, address redeemer, uint redeemAmount, uint redeemTokens) external; function borrowAllowed(address cToken, address borrower, uint borrowAmount) external returns (uint); function borrowVerify(address cToken, address borrower, uint borrowAmount) external; function repayBorrowAllowed( address cToken, address payer, address borrower, uint repayAmount) external returns (uint); function repayBorrowVerify( address cToken, address payer, address borrower, uint repayAmount, uint borrowerIndex) external; function liquidateBorrowAllowed( address cTokenBorrowed, address cTokenCollateral, address liquidator, address borrower, uint repayAmount) external returns (uint); function liquidateBorrowVerify( address cTokenBorrowed, address cTokenCollateral, address liquidator, address borrower, uint repayAmount, uint seizeTokens) external; function seizeAllowed( address cTokenCollateral, address cTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external returns (uint); function seizeVerify( address cTokenCollateral, address cTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external; function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint); function transferVerify(address cToken, address src, address dst, uint transferTokens) external; /*** Liquidity/Liquidation Calculations ***/ function liquidateCalculateSeizeTokens( address cTokenBorrowed, address cTokenCollateral, uint repayAmount) external view returns (uint, uint); } contract RainMakerAdminStorage { /** * @notice Administrator for this contract */ address public admin; /** * @notice Comptroller for this contract */ ComptrollerInterface public comptroller; /** * @notice Pending administrator for this contract */ address public pendingAdmin; } contract SingleAssetRainMakerStorage is RainMakerAdminStorage { /** * @notice If true - stops updating supply and borrow indexes */ bool public isRetired; struct CompMarketState { /// @notice The market's last updated compBorrowIndex or compSupplyIndex uint224 index; /// @notice The block number the index was last updated at uint32 block; } /// @notice A list of all markets CToken[] public allMarkets; /// @notice OToken => is market listed by Comptroller mapping(address => bool) public isListed; /// @notice The amount of incentive tokens each side (supply and borrow) receives per block. mapping(address => uint) public compSpeeds; /// @notice The COMP market supply state for each market mapping(address => CompMarketState) public compSupplyState; /// @notice The COMP market borrow state for each market mapping(address => CompMarketState) public compBorrowState; /// @notice The COMP borrow index for each market for each supplier as of the last time they accrued COMP mapping(address => mapping(address => uint)) public compSupplierIndex; /// @notice The COMP borrow index for each market for each borrower as of the last time they accrued COMP mapping(address => mapping(address => uint)) public compBorrowerIndex; /// @notice The COMP accrued but not yet transferred to each user mapping(address => uint) public compAccrued; /// @notice The address of the erc20 token used by the network for participation incentive. address public lnIncentiveTokenAddress; } contract SingleAssetDynamicRainMakerStorage is RainMakerAdminStorage { /** * @notice If true - stops updating supply and borrow indexes */ bool public isRetired; struct CompMarketState { /// @notice The market's last updated compBorrowIndex or compSupplyIndex uint224 index; /// @notice The block number the index was last updated at uint32 block; } /// @notice A list of all markets CToken[] public allMarkets; /// @notice OToken => is market listed by Comptroller mapping(address => bool) public isListed; /// @notice The amount of incentive tokens the whole supply side receives per block. mapping(address => uint) public compSupplySpeeds; /// @notice The amount of incentive tokens the whole borrow side receives per block. mapping(address => uint) public compBorrowSpeeds; /// @notice The COMP market supply state for each market mapping(address => CompMarketState) public compSupplyState; /// @notice The COMP market borrow state for each market mapping(address => CompMarketState) public compBorrowState; /// @notice The COMP borrow index for each market for each supplier as of the last time they accrued COMP mapping(address => mapping(address => uint)) public compSupplierIndex; /// @notice The COMP borrow index for each market for each borrower as of the last time they accrued COMP mapping(address => mapping(address => uint)) public compBorrowerIndex; /// @notice The COMP accrued but not yet transferred to each user mapping(address => uint) public compAccrued; /// @notice The address of the erc20 token used by the network for participation incentive. address public lnIncentiveTokenAddress; } contract RainMakerInterface { bool public isRainMaker = true; bytes32 public contractNameHash; /*** Market support ***/ function _supportMarket(address cToken) external; /*** Comp Distribution ***/ function updateCompSupplyIndex(address cToken) external; function updateCompBorrowIndex(address cToken, uint marketBorrowIndex_) external; function distributeSupplierComp(address cToken, address supplier) external; function distributeBorrowerComp(address cToken, address borrower, uint marketBorrowIndex_) external; } contract SingleAssetRainMakerInterface is RainMakerInterface { /*** Comp claiming ***/ function claimComp(address holder) external; function claimComp(address holder, CToken[] calldata cTokens) external; function claimComp(address[] calldata holders, CToken[] calldata cTokens, bool borrowers, bool suppliers) external; } interface IComptrollerPeripheral { /** * Called when the contract is connected to the comptroller */ function connect(bytes calldata params) external; /** * Called when the contract is disconnected from the comptroller */ function retire(bytes calldata params) external; } interface IMinistryForSingleAssetDynamicRainMaker { function isAssetSupported(address asset) external view returns (bool); } contract SingleAssetDynamicRainMaker is SingleAssetDynamicRainMakerStorage, SingleAssetRainMakerInterface, ExponentialNoError, IComptrollerPeripheral { bytes32 constant public SingleAssetDynamicRainMakerContractHash = keccak256("SingleAssetDynamicRainMaker"); /// @notice The initial COMP index for a market uint224 public constant compInitialIndex = 1e36; /// @notice Emitted when an admin supports a market event MarketListed(CToken cToken); /** * @notice Emitted when pendingAdmin is changed */ event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin); /** * @notice Emitted when pendingAdmin is accepted, which means admin is updated */ event NewAdmin(address oldAdmin, address newAdmin); /// @notice Emitted when lnIncentiveTokenAddress is set by admin event LnIncentiveTokenUpdated(address lnIncentiveToken, uint blockNumber); /// @notice Emitted when a new COMP supply speed is calculated for a market event CompSupplySpeedUpdated(CToken indexed cToken, uint newSpeed); /// @notice Emitted when a new COMP borrow speed is calculated for a market event CompBorrowSpeedUpdated(CToken indexed cToken, uint newSpeed); /// @notice Emitted when COMP is distributed to a supplier event DistributedSupplierComp(CToken indexed cToken, address indexed supplier, uint compDelta, uint compSupplyIndex); /// @notice Emitted when COMP is distributed to a borrower event DistributedBorrowerComp(CToken indexed cToken, address indexed borrower, uint compDelta, uint compBorrowIndex); /*** Constructor ***/ constructor(address _comptroller, address _admin) public { admin = _admin; comptroller = ComptrollerInterface(_comptroller); contractNameHash = SingleAssetDynamicRainMakerContractHash; // Ensure supported markets are synced with the Comptroller CToken[] memory markets = comptroller.getAllMarkets(); uint marketsCount = markets.length; for (uint i = 0; i < marketsCount; i++) { CToken market = markets[i]; _supportMarketInternal(address(market)); } } /** * @notice Return the address of the COMP token * @return The address of COMP */ function getLnIncentiveTokenAddress() public view returns (address) { return lnIncentiveTokenAddress; } /*** Comp claiming ***/ /** * @notice Claim all the comp accrued by holder in all markets * @param holder The address to claim COMP for */ function claimComp(address holder) public { return claimComp(holder, allMarkets); } /** * @notice Claim all the comp accrued by holder in the specified markets * @param holder The address to claim COMP for * @param cTokens The list of markets to claim COMP in */ function claimComp(address holder, CToken[] memory cTokens) public { address[] memory holders = new address[](1); holders[0] = holder; claimComp(holders, cTokens, true, true); } /** * @notice Claim all comp accrued by the holders * @param holders The addresses to claim COMP for * @param cTokens The list of markets to claim COMP in * @param borrowers Whether or not to claim COMP earned by borrowing * @param suppliers Whether or not to claim COMP earned by supplying */ function claimComp(address[] memory holders, CToken[] memory cTokens, bool borrowers, bool suppliers) public { for (uint i = 0; i < cTokens.length; i++) { CToken cToken = cTokens[i]; require(isListed[address(cToken)], "market must be listed"); if (borrowers == true) { Exp memory borrowIndex = Exp({mantissa: cToken.borrowIndex()}); updateCompBorrowIndexInternal(address(cToken), borrowIndex); for (uint j = 0; j < holders.length; j++) { distributeBorrowerCompInternal(address(cToken), holders[j], borrowIndex); compAccrued[holders[j]] = grantCompInternal(holders[j], compAccrued[holders[j]]); } } if (suppliers == true) { updateCompSupplyIndexInternal(address(cToken)); for (uint j = 0; j < holders.length; j++) { distributeSupplierCompInternal(address(cToken), holders[j]); compAccrued[holders[j]] = grantCompInternal(holders[j], compAccrued[holders[j]]); } } } } /*** Comp Distribution ***/ function updateCompSupplyIndex(address cToken) external { require(isComptroller(), "Not comptroller"); updateCompSupplyIndexInternal(cToken); } function updateCompBorrowIndex(address cToken, uint marketBorrowIndex_) external { require(isComptroller(), "Not comptroller"); Exp memory marketBorrowIndex = Exp({mantissa: marketBorrowIndex_}); updateCompBorrowIndexInternal(cToken, marketBorrowIndex); } function distributeSupplierComp(address cToken, address supplier) external { require(isComptroller(), "Not comptroller"); distributeSupplierCompInternal(cToken, supplier); } function distributeBorrowerComp(address cToken, address borrower, uint marketBorrowIndex_) external { require(isComptroller(), "Not comptroller"); Exp memory marketBorrowIndex = Exp({mantissa: marketBorrowIndex_}); distributeBorrowerCompInternal(cToken, borrower, marketBorrowIndex); } /*** Comp Distribution internal ***/ /** * @notice Accrue COMP to the market by updating the supply index * @param cToken The market whose supply index to update */ function updateCompSupplyIndexInternal(address cToken) internal { if (isRetired) { return; } CompMarketState storage supplyState = compSupplyState[cToken]; uint supplySpeed = compSupplySpeeds[cToken]; uint blockNumber = getBlockNumber(); uint deltaBlocks = sub_(blockNumber, uint(supplyState.block)); if (deltaBlocks > 0 && supplySpeed > 0) { uint supplyTokens = CToken(cToken).totalSupply(); uint compAccrued = mul_(deltaBlocks, supplySpeed); Double memory ratio = supplyTokens > 0 ? fraction(compAccrued, supplyTokens) : Double({mantissa: 0}); Double memory index = add_(Double({mantissa: supplyState.index}), ratio); compSupplyState[cToken] = CompMarketState({ index: safe224(index.mantissa, "new index exceeds 224 bits"), block: safe32(blockNumber, "block number exceeds 32 bits") }); } else if (deltaBlocks > 0) { supplyState.block = safe32(blockNumber, "block number exceeds 32 bits"); } } /** * @notice Accrue COMP to the market by updating the borrow index * @param cToken The market whose borrow index to update */ function updateCompBorrowIndexInternal(address cToken, Exp memory marketBorrowIndex) internal { if (isRetired) { return; } CompMarketState storage borrowState = compBorrowState[cToken]; uint borrowSpeed = compBorrowSpeeds[cToken]; uint blockNumber = getBlockNumber(); uint deltaBlocks = sub_(blockNumber, uint(borrowState.block)); if (deltaBlocks > 0 && borrowSpeed > 0) { uint borrowAmount = div_(CToken(cToken).totalBorrows(), marketBorrowIndex); uint compAccrued = mul_(deltaBlocks, borrowSpeed); Double memory ratio = borrowAmount > 0 ? fraction(compAccrued, borrowAmount) : Double({mantissa: 0}); Double memory index = add_(Double({mantissa: borrowState.index}), ratio); compBorrowState[cToken] = CompMarketState({ index: safe224(index.mantissa, "new index exceeds 224 bits"), block: safe32(blockNumber, "block number exceeds 32 bits") }); } else if (deltaBlocks > 0) { borrowState.block = safe32(blockNumber, "block number exceeds 32 bits"); } } /** * @notice Calculate COMP accrued by a supplier and possibly transfer it to them * @param cToken The market in which the supplier is interacting * @param supplier The address of the supplier to distribute COMP to */ function distributeSupplierCompInternal(address cToken, address supplier) internal { CompMarketState storage supplyState = compSupplyState[cToken]; Double memory supplyIndex = Double({mantissa: supplyState.index}); Double memory supplierIndex = Double({mantissa: compSupplierIndex[cToken][supplier]}); compSupplierIndex[cToken][supplier] = supplyIndex.mantissa; if (supplierIndex.mantissa == 0 && supplyIndex.mantissa > 0) { supplierIndex.mantissa = compInitialIndex; } Double memory deltaIndex = sub_(supplyIndex, supplierIndex); uint supplierTokens = CToken(cToken).balanceOf(supplier); uint supplierDelta = mul_(supplierTokens, deltaIndex); uint supplierAccrued = add_(compAccrued[supplier], supplierDelta); compAccrued[supplier] = supplierAccrued; emit DistributedSupplierComp(CToken(cToken), supplier, supplierDelta, supplyIndex.mantissa); } /** * @notice Calculate COMP accrued by a borrower and possibly transfer it to them * @dev Borrowers will not begin to accrue until after the first interaction with the protocol. * @param cToken The market in which the borrower is interacting * @param borrower The address of the borrower to distribute COMP to */ function distributeBorrowerCompInternal(address cToken, address borrower, Exp memory marketBorrowIndex) internal { CompMarketState storage borrowState = compBorrowState[cToken]; Double memory borrowIndex = Double({mantissa: borrowState.index}); Double memory borrowerIndex = Double({mantissa: compBorrowerIndex[cToken][borrower]}); compBorrowerIndex[cToken][borrower] = borrowIndex.mantissa; // if (borrowerIndex.mantissa == 0 && borrowIndex.mantissa > 0) { // borrowerIndex.mantissa = compInitialIndex; // } if (borrowIndex.mantissa > 0) { Double memory deltaIndex = sub_(borrowIndex, borrowerIndex); uint borrowerAmount = div_(CToken(cToken).borrowBalanceStored(borrower), marketBorrowIndex); uint borrowerDelta = mul_(borrowerAmount, deltaIndex); uint borrowerAccrued = add_(compAccrued[borrower], borrowerDelta); compAccrued[borrower] = borrowerAccrued; emit DistributedBorrowerComp(CToken(cToken), borrower, borrowerDelta, borrowIndex.mantissa); } } /** * OLA_ADDITIONS : Changes from 'Comp' to the generic ERC20. * @notice Transfer COMP to the user * @dev Note: If there is not enough COMP, we do not perform the transfer all. * @param user The address of the user to transfer COMP to * @param amount The amount of COMP to (possibly) transfer * @return The amount of COMP which was NOT transferred to the user */ function grantCompInternal(address user, uint amount) internal returns (uint) { EIP20Interface lnToken = EIP20Interface(getLnIncentiveTokenAddress()); uint lnTokenRemaining = lnToken.balanceOf(address(this)); if (amount > 0 && amount <= lnTokenRemaining) { lnToken.transfer(user, amount); return 0; } return amount; } /** * @notice Set COMP supply speed for a single market * @param cToken The market whose COMP speed to update * @param compSupplySpeed New COMP supply speed for market */ function setCompSupplySpeedInternal(CToken cToken, uint compSupplySpeed) internal { uint currentCompSupplySpeed = compSupplySpeeds[address(cToken)]; if (currentCompSupplySpeed != 0) { // note that COMP speed could be set to 0 to halt liquidity rewards for a market updateCompSupplyIndexInternal(address(cToken)); } else if (compSupplySpeed != 0) { // Add the COMP market require(isListed[address(cToken)] == true, "comp market is not listed"); if (compSupplyState[address(cToken)].index == 0 && compSupplyState[address(cToken)].block == 0) { compSupplyState[address(cToken)] = CompMarketState({ index: compInitialIndex, block: safe32(getBlockNumber(), "block number exceeds 32 bits") }); } } if (currentCompSupplySpeed != compSupplySpeed) { compSupplySpeeds[address(cToken)] = compSupplySpeed; emit CompSupplySpeedUpdated(cToken, compSupplySpeed); } } /** * @notice Set COMP speed for a single market * @param cToken The market whose COMP speed to update * @param compBorrowSpeed New COMP borrow speed for market */ function setCompBorrowSpeedInternal(CToken cToken, uint compBorrowSpeed) internal { uint currentCompBorrowSpeed = compBorrowSpeeds[address(cToken)]; if (currentCompBorrowSpeed != 0) { // note that COMP speed could be set to 0 to halt liquidity rewards for a market Exp memory borrowIndex = Exp({mantissa: cToken.borrowIndex()}); updateCompBorrowIndexInternal(address(cToken), borrowIndex); } else if (compBorrowSpeed != 0) { // Add the COMP market require(isListed[address(cToken)] == true, "comp market is not listed"); if (compBorrowState[address(cToken)].index == 0 && compBorrowState[address(cToken)].block == 0) { compBorrowState[address(cToken)] = CompMarketState({ index: compInitialIndex, block: safe32(getBlockNumber(), "block number exceeds 32 bits") }); } } if (currentCompBorrowSpeed != compBorrowSpeed) { compBorrowSpeeds[address(cToken)] = compBorrowSpeed; emit CompBorrowSpeedUpdated(cToken, compBorrowSpeed); } } /*** Comp Distribution Admin ***/ /** * @notice Set COMP speeds for a multiple markets * @param _cTokens The markets whose COMP speeds to update * @param _compSupplySpeeds New COMP speed per market * @param _compBorrowSpeeds New COMP speed per market */ function _setDynamicCompSpeeds(CToken[] calldata _cTokens, uint[] calldata _compSupplySpeeds, uint[] calldata _compBorrowSpeeds) external { require(_cTokens.length == _compSupplySpeeds.length, "markets and supply speeds should be 1:1"); require(_cTokens.length == _compBorrowSpeeds.length, "markets and borrow speeds should be 1:1"); require(isAdmin(), "only admin can set comp speed"); for (uint i = 0; i < _cTokens.length; i++) { CToken cToken = _cTokens[i]; setCompSupplySpeedInternal(cToken, _compSupplySpeeds[i]); setCompBorrowSpeedInternal(cToken, _compBorrowSpeeds[i]); } } /** * @notice Set COMP speed for a single market * @param cToken The market whose COMP speed to update * @param compSupplySpeed New COMP supply speed for market * @param compBorrowSpeed New COMP borrow speed for market */ function _setDynamicCompSpeed(CToken cToken, uint compSupplySpeed, uint compBorrowSpeed) public { require(isAdmin(), "only admin can set comp speed"); setCompSupplySpeedInternal(cToken, compSupplySpeed); setCompBorrowSpeedInternal(cToken, compBorrowSpeed); } /*** Comptroller Functions ***/ function _supportMarket(address cToken) external { require(isComptroller(), "Not comptroller"); require(!isListed[cToken], "Already listed"); _supportMarketInternal(address(cToken)); } function _supportMarketInternal(address cToken) internal { CToken(cToken).isCToken(); // Sanity check to make sure its really a CToken allMarkets.push(CToken(cToken)); isListed[cToken] = true; emit MarketListed(CToken(cToken)); } /*** Admin Functions ***/ /** * @notice Periphery hook. Does nothing at the moment. */ function connect(bytes calldata params) external { // Shh -- currently unused params; } /** * @notice Periphery hook. Syncs for the last time for all supported markets and prevents this RainMaker from updating any more. */ function retire(bytes calldata params) external { // Shh -- currently unused params; retireInternal(); } /** * Legacy function */ function retireRainMaker() external { retireInternal(); } function retireInternal() internal { require(isComptroller(), "Not comptroller"); for (uint i = 0; i < allMarkets.length; i ++) { CToken cToken = allMarkets[i]; // Extra sanity if (isListed[address(cToken)]) { // Update supply incentive index updateCompSupplyIndexInternal(address(cToken)); // Update borrow incentive index uint borrowIndex = cToken.borrowIndex(); Exp memory marketBorrowIndex = Exp({mantissa: borrowIndex}); updateCompBorrowIndexInternal(address(cToken), marketBorrowIndex); } } // This basically locks the supply and borrow indexes to their current values // and by thus, stops the accumulating. isRetired = true; } /** * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer. * @param newPendingAdmin New pending admin. * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setPendingAdmin(address newPendingAdmin) public returns (uint) { // Check caller = admin require(msg.sender == admin, "Not Admin"); // Save current value, if any, for inclusion in log address oldPendingAdmin = pendingAdmin; // Store pendingAdmin with value newPendingAdmin pendingAdmin = newPendingAdmin; // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin) emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin); return 0; } /** * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin * @dev Admin function for pending admin to accept role and update admin * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _acceptAdmin() public returns (uint) { // Check caller is pendingAdmin and pendingAdmin ≠ address(0) require(msg.sender == pendingAdmin && msg.sender != address(0), "Not the EXISTING pending admin"); // Save current values for inclusion in log address oldAdmin = admin; address oldPendingAdmin = pendingAdmin; // Store admin with value pendingAdmin admin = pendingAdmin; // Clear the pending value pendingAdmin = address(0); emit NewAdmin(oldAdmin, admin); emit NewPendingAdmin(oldPendingAdmin, pendingAdmin); return 0; } /** * @notice Set lnTokenAddress. * @param incentiveTokenAddress The ERC20 compatible token to be used for incentivizing the system. */ function _setLnIncentiveToken(address incentiveTokenAddress) public { require(isAdmin(), "only admin can set comp speed"); require(incentiveTokenAddress != address(0), "LN incentive token must have a proper address"); require(getLnIncentiveTokenAddress() == address(0), "Cannot change the LN incentive token once it is set"); require(IMinistryForSingleAssetDynamicRainMaker(comptroller.getRegistry()).isAssetSupported(incentiveTokenAddress), "Token not supported"); lnIncentiveTokenAddress = incentiveTokenAddress; emit LnIncentiveTokenUpdated(lnIncentiveTokenAddress, block.number); } /** * @notice Checks caller is Comptroller */ function isComptroller() internal view returns (bool) { return msg.sender == address(comptroller); } /** * @notice Checks caller is admin */ function isAdmin() internal view returns (bool) { return msg.sender == admin; } /*** Compound Lens Compatibility ***/ /** * Keeping this to be somewhat compatible with the uniform rainmaker */ function compSpeeds(address market) public view returns (uint) { return compSupplySpeeds[market]; } /*** Utils ***/ function getBlockNumber() public view returns (uint) { return block.number; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_comptroller","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract CToken","name":"cToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"CompBorrowSpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract CToken","name":"cToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"CompSupplySpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract CToken","name":"cToken","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"compDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"compBorrowIndex","type":"uint256"}],"name":"DistributedBorrowerComp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract CToken","name":"cToken","type":"address"},{"indexed":true,"internalType":"address","name":"supplier","type":"address"},{"indexed":false,"internalType":"uint256","name":"compDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"compSupplyIndex","type":"uint256"}],"name":"DistributedSupplierComp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"lnIncentiveToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"LnIncentiveTokenUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"MarketListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"NewPendingAdmin","type":"event"},{"constant":true,"inputs":[],"name":"SingleAssetDynamicRainMakerContractHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"_acceptAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"},{"internalType":"uint256","name":"compSupplySpeed","type":"uint256"},{"internalType":"uint256","name":"compBorrowSpeed","type":"uint256"}],"name":"_setDynamicCompSpeed","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"_cTokens","type":"address[]"},{"internalType":"uint256[]","name":"_compSupplySpeeds","type":"uint256[]"},{"internalType":"uint256[]","name":"_compBorrowSpeeds","type":"uint256[]"}],"name":"_setDynamicCompSpeeds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"incentiveTokenAddress","type":"address"}],"name":"_setLnIncentiveToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"_supportMarket","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allMarkets","outputs":[{"internalType":"contract CToken","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"}],"name":"claimComp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"holders","type":"address[]"},{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"},{"internalType":"bool","name":"borrowers","type":"bool"},{"internalType":"bool","name":"suppliers","type":"bool"}],"name":"claimComp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"claimComp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"compAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"compBorrowSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"compBorrowState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"block","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"compBorrowerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"compInitialIndex","outputs":[{"internalType":"uint224","name":"","type":"uint224"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"market","type":"address"}],"name":"compSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"compSupplierIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"compSupplySpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"compSupplyState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"block","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"params","type":"bytes"}],"name":"connect","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"contractNameHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"marketBorrowIndex_","type":"uint256"}],"name":"distributeBorrowerComp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"address","name":"supplier","type":"address"}],"name":"distributeSupplierComp","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLnIncentiveTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isListed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isRainMaker","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isRetired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lnIncentiveTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"params","type":"bytes"}],"name":"retire","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"retireRainMaker","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"marketBorrowIndex_","type":"uint256"}],"name":"updateCompBorrowIndex","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"updateCompSupplyIndex","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052600c805460ff60a01b1916600160a01b1790553480156200002457600080fd5b50604051620030bd380380620030bd833981810160405260408110156200004a57600080fd5b508051602090910151600080546001600160a01b038084166001600160a01b03199283161783556001805482871693169290921791829055604080517f53696e676c65417373657444796e616d69635261696e4d616b657200000000008152815190819003601b018120600d5563b0772d0b60e01b81529051606094939092169263b0772d0b92600480840193829003018186803b158015620000ec57600080fd5b505afa15801562000101573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156200012b57600080fd5b81019080805160405193929190846401000000008211156200014c57600080fd5b9083019060208201858111156200016257600080fd5b82518660208202830111640100000000821117156200018057600080fd5b82525081516020918201928201910280838360005b83811015620001af57818101518382015260200162000195565b50505050919091016040525050825192935060009150505b8181101562000204576000838281518110620001df57fe5b60200260200101519050620001fa816200020f60201b60201c565b50600101620001c7565b505050505062000313565b806001600160a01b031663fe9c44ae6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200024957600080fd5b505afa1580156200025e573d6000803e3d6000fd5b505050506040513d60208110156200027557600080fd5b50506003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b038416908117909155600081815260046020908152604091829020805460ff19169094179093558051918252517fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f929181900390910190a150565b612d9a80620003236000396000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c80636b79c38d11610130578063ca0af043116100b8578063e9c714f21161007c578063e9c714f214610982578063f4a433c01461098a578063f606c86b146109b0578063f794062e146109b8578063f851a440146109de57610227565b8063ca0af043146108d4578063cc7ebdc414610902578063e394bd6014610928578063e3f96ae714610930578063e9af02921461095c57610227565b8063a76b3fda116100ff578063a76b3fda14610728578063a7f0e2311461074e578063a9ea1def14610772578063b21be7fd14610880578063b71d1a0c146108ae57610227565b80636b79c38d14610614578063829d83a0146106625780638c57804e146106945780639cd47128146106ba57610227565b80634f54b3c0116101b35780635fe3b567116101825780635fe3b5671461048c5780636312d0ef14610494578063641cbbcd146104ba5780636810dfa6146104c25780636aa875b5146105ee57610227565b80634f54b3c01461043157806352d84d1e1461045f5780635ad7b9361461047c5780635dbf1fa11461048457610227565b806326782247116101fa5780632678224714610373578063343b286f1461039757806342cbb15c14610405578063469ab1e31461040d57806349343cee1461041557610227565b8063082bc0ab1461022c5780631c3db2e0146102545780631d7b33d7146103055780632100550e1461033d575b600080fd5b6102526004803603602081101561024257600080fd5b50356001600160a01b03166109e6565b005b6102526004803603604081101561026a57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561029457600080fd5b8201836020820111156102a657600080fd5b803590602001918460208302840111600160201b831117156102c757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610a3d945050505050565b61032b6004803603602081101561031b57600080fd5b50356001600160a01b0316610a9f565b60408051918252519081900360200190f35b6102526004803603606081101561035357600080fd5b506001600160a01b03813581169160208101359091169060400135610aba565b61037b610b2d565b604080516001600160a01b039092168252519081900360200190f35b610252600480360360208110156103ad57600080fd5b810190602081018135600160201b8111156103c757600080fd5b8201836020820111156103d957600080fd5b803590602001918460018302840111600160201b831117156103fa57600080fd5b509092509050610b3c565b61032b610b48565b61032b610b4c565b61041d610b52565b604080519115158252519081900360200190f35b6102526004803603604081101561044757600080fd5b506001600160a01b0381358116916020013516610b62565b61037b6004803603602081101561047557600080fd5b5035610bb7565b610252610bde565b61037b610be8565b61037b610bf7565b610252600480360360208110156104aa57600080fd5b50356001600160a01b0316610c06565b61041d610e8a565b610252600480360360808110156104d857600080fd5b810190602081018135600160201b8111156104f257600080fd5b82018360208201111561050457600080fd5b803590602001918460208302840111600160201b8311171561052557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561057457600080fd5b82018360208201111561058657600080fd5b803590602001918460208302840111600160201b831117156105a757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505050803515159150602001351515610e9a565b61032b6004803603602081101561060457600080fd5b50356001600160a01b031661112a565b61063a6004803603602081101561062a57600080fd5b50356001600160a01b031661113c565b604080516001600160e01b03909316835263ffffffff90911660208301528051918290030190f35b6102526004803603606081101561067857600080fd5b506001600160a01b038135169060208101359060400135611166565b61063a600480360360208110156106aa57600080fd5b50356001600160a01b03166111d3565b610252600480360360208110156106d057600080fd5b810190602081018135600160201b8111156106ea57600080fd5b8201836020820111156106fc57600080fd5b803590602001918460018302840111600160201b8311171561071d57600080fd5b509092509050610b44565b6102526004803603602081101561073e57600080fd5b50356001600160a01b03166111fd565b6107566112b0565b604080516001600160e01b039092168252519081900360200190f35b6102526004803603606081101561078857600080fd5b810190602081018135600160201b8111156107a257600080fd5b8201836020820111156107b457600080fd5b803590602001918460208302840111600160201b831117156107d557600080fd5b919390929091602081019035600160201b8111156107f257600080fd5b82018360208201111561080457600080fd5b803590602001918460208302840111600160201b8311171561082557600080fd5b919390929091602081019035600160201b81111561084257600080fd5b82018360208201111561085457600080fd5b803590602001918460208302840111600160201b8311171561087557600080fd5b5090925090506112c3565b61032b6004803603604081101561089657600080fd5b506001600160a01b038135811691602001351661140d565b61032b600480360360208110156108c457600080fd5b50356001600160a01b031661142a565b61032b600480360360408110156108ea57600080fd5b506001600160a01b03813581169160200135166114de565b61032b6004803603602081101561091857600080fd5b50356001600160a01b03166114fb565b61032b61150d565b6102526004803603604081101561094657600080fd5b506001600160a01b038135169060200135611542565b6102526004803603602081101561097257600080fd5b50356001600160a01b03166115ae565b61032b611612565b61032b600480360360208110156109a057600080fd5b50356001600160a01b031661173b565b61037b61174d565b61041d600480360360208110156109ce57600080fd5b50356001600160a01b031661175c565b61037b611771565b6109ee611780565b610a31576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b610a3a81611791565b50565b604080516001808252818301909252606091602080830190803883390190505090508281600081518110610a6d57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050610a9a8183600180610e9a565b505050565b6001600160a01b031660009081526005602052604090205490565b610ac2611780565b610b05576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b610b0d612c84565b506040805160208101909152818152610b27848483611a26565b50505050565b6002546001600160a01b031681565b610b44611bf0565b5050565b4390565b600d5481565b600254600160a01b900460ff1681565b610b6a611780565b610bad576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b610b448282611d3c565b60038181548110610bc457fe5b6000918252602090912001546001600160a01b0316905081565b610be6611bf0565b565b600c546001600160a01b031681565b6001546001600160a01b031681565b610c0e611f1b565b610c5f576040805162461bcd60e51b815260206004820152601d60248201527f6f6e6c792061646d696e2063616e2073657420636f6d70207370656564000000604482015290519081900360640190fd5b6001600160a01b038116610ca45760405162461bcd60e51b815260040180806020018281038252602d815260200180612ce6602d913960400191505060405180910390fd5b6000610cae61174d565b6001600160a01b031614610cf35760405162461bcd60e51b8152600401808060200182810382526033815260200180612d336033913960400191505060405180910390fd5b600160009054906101000a90046001600160a01b03166001600160a01b0316635ab1bd536040518163ffffffff1660e01b815260040160206040518083038186803b158015610d4157600080fd5b505afa158015610d55573d6000803e3d6000fd5b505050506040513d6020811015610d6b57600080fd5b5051604080516308c9682b60e31b81526001600160a01b0384811660048301529151919092169163464b4158916024808301926020929190829003018186803b158015610db757600080fd5b505afa158015610dcb573d6000803e3d6000fd5b505050506040513d6020811015610de157600080fd5b5051610e2a576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0383811691909117918290556040805192909116825243602083015280517f1eaff93288e717d271fbb0007322e12295058d72b4324e5fef1c27327b2e22749281900390910190a150565b600c54600160a01b900460ff1681565b60005b8351811015611123576000848281518110610eb457fe5b6020908102919091018101516001600160a01b0381166000908152600490925260409091205490915060ff16610f29576040805162461bcd60e51b81526020600482015260156024820152741b585c9ad95d081b5d5cdd081899481b1a5cdd1959605a1b604482015290519081900360640190fd5b6001841515141561107857610f3c612c84565b6040518060200160405280836001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8057600080fd5b505afa158015610f94573d6000803e3d6000fd5b505050506040513d6020811015610faa57600080fd5b505190529050610fba8282611f2c565b60005b875181101561107557610fe483898381518110610fd657fe5b602002602001015184611a26565b611039888281518110610ff357fe5b6020026020010151600b60008b858151811061100b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054612199565b600b60008a848151811061104957fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002055600101610fbd565b50505b6001831515141561111a5761108c81611791565b60005b8651811015611118576110b5828883815181106110a857fe5b6020026020010151611d3c565b6110dc8782815181106110c457fe5b6020026020010151600b60008a858151811061100b57fe5b600b60008984815181106110ec57fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205560010161108f565b505b50600101610e9d565b5050505050565b60056020526000908152604090205481565b6007602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b61116e611f1b565b6111bf576040805162461bcd60e51b815260206004820152601d60248201527f6f6e6c792061646d696e2063616e2073657420636f6d70207370656564000000604482015290519081900360640190fd5b6111c983836122d6565b610a9a83826124e2565b6008602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b611205611780565b611248576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b6001600160a01b03811660009081526004602052604090205460ff16156112a7576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b1a5cdd195960921b604482015290519081900360640190fd5b610a3a81612743565b6ec097ce7bc90715b34b9f100000000081565b8483146113015760405162461bcd60e51b8152600401808060200182810382526027815260200180612cbf6027913960400191505060405180910390fd5b84811461133f5760405162461bcd60e51b8152600401808060200182810382526027815260200180612c986027913960400191505060405180910390fd5b611347611f1b565b611398576040805162461bcd60e51b815260206004820152601d60248201527f6f6e6c792061646d696e2063616e2073657420636f6d70207370656564000000604482015290519081900360640190fd5b60005b858110156114045760008787838181106113b157fe5b905060200201356001600160a01b031690506113df818787858181106113d357fe5b905060200201356122d6565b6113fb818585858181106113ef57fe5b905060200201356124e2565b5060010161139b565b50505050505050565b600960209081526000928352604080842090915290825290205481565b600080546001600160a01b03163314611476576040805162461bcd60e51b81526020600482015260096024820152682737ba1020b236b4b760b91b604482015290519081900360640190fd5b600280546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a150600092915050565b600a60209081526000928352604080842090915290825290205481565b600b6020526000908152604090205481565b604080517f53696e676c65417373657444796e616d69635261696e4d616b657200000000008152905190819003601b01902081565b61154a611780565b61158d576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b611595612c84565b506040805160208101909152818152610a9a8382611f2c565b610a3a81600380548060200260200160405190810160405280929190818152602001828054801561160857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115ea575b5050505050610a3d565b6002546000906001600160a01b03163314801561162e57503315155b61167f576040805162461bcd60e51b815260206004820152601e60248201527f4e6f7420746865204558495354494e472070656e64696e672061646d696e0000604482015290519081900360640190fd5b60008054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a160009250505090565b60066020526000908152604090205481565b600c546001600160a01b031690565b60046020526000908152604090205460ff1681565b6000546001600160a01b031681565b6001546001600160a01b0316331490565b600254600160a01b900460ff16156117a857610a3a565b6001600160a01b0381166000908152600760209081526040808320600590925282205490916117d5610b48565b83549091506000906117f5908390600160e01b900463ffffffff16612844565b90506000811180156118075750600083115b156119cd576000856001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561184757600080fd5b505afa15801561185b573d6000803e3d6000fd5b505050506040513d602081101561187157600080fd5b5051905060006118818386612885565b905061188b612c84565b600083116118a857604051806020016040528060008152506118b2565b6118b282846128c7565b90506118bc612c84565b604080516020810190915288546001600160e01b031681526118de9083612905565b9050604051806040016040528061192e83600001516040518060400160405280601a81526020017f6e657720696e646578206578636565647320323234206269747300000000000081525061292a565b6001600160e01b03168152602001611969886040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b63ffffffff9081169091526001600160a01b038b166000908152600760209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555061112392505050565b801561112357611a00826040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b845463ffffffff91909116600160e01b026001600160e01b039091161784555050505050565b6001600160a01b0383166000908152600860205260409020611a46612c84565b50604080516020810190915281546001600160e01b03168152611a67612c84565b5060408051602080820183526001600160a01b038089166000908152600a835284812091891680825282845294812080548552865195909152915291909155815115611be857611ab5612c84565b611abf8383612a19565b90506000611b4e886001600160a01b03166395dd9193896040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611b1c57600080fd5b505afa158015611b30573d6000803e3d6000fd5b505050506040513d6020811015611b4657600080fd5b505187612a3e565b90506000611b5c8284612a5c565b6001600160a01b0389166000908152600b602052604081205491925090611b839083612a8b565b6001600160a01b03808b166000818152600b60209081526040918290208590558a5182518881529182015281519495509193928e16927f1fc3ecc087d8d2d15e23d0032af5a47059c3892d003d8e139fdcb6bb327c99a69281900390910190a3505050505b505050505050565b611bf8611780565b611c3b576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b60005b600354811015611d2657600060038281548110611c5757fe5b60009182526020808320909101546001600160a01b0316808352600490915260409091205490915060ff1615611d1d57611c9081611791565b6000816001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ccb57600080fd5b505afa158015611cdf573d6000803e3d6000fd5b505050506040513d6020811015611cf557600080fd5b50519050611d01612c84565b506040805160208101909152818152611d1a8382611f2c565b50505b50600101611c3e565b506002805460ff60a01b1916600160a01b179055565b6001600160a01b0382166000908152600760205260409020611d5c612c84565b50604080516020810190915281546001600160e01b03168152611d7d612c84565b5060408051602080820183526001600160a01b03808816600090815260098352848120918816808252828452948120805485528651959091529152919091558051158015611dcb5750815115155b15611de3576ec097ce7bc90715b34b9f100000000081525b611deb612c84565b611df58383612a19565b90506000866001600160a01b03166370a08231876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611e4f57600080fd5b505afa158015611e63573d6000803e3d6000fd5b505050506040513d6020811015611e7957600080fd5b505190506000611e898284612a5c565b6001600160a01b0388166000908152600b602052604081205491925090611eb09083612a8b565b6001600160a01b03808a166000818152600b60209081526040918290208590558a5182518881529182015281519495509193928d16927f2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a9281900390910190a3505050505050505050565b6000546001600160a01b0316331490565b600254600160a01b900460ff1615611f4357610b44565b6001600160a01b038216600090815260086020908152604080832060069092528220549091611f70610b48565b8354909150600090611f90908390600160e01b900463ffffffff16612844565b9050600081118015611fa25750600083115b1561213f576000611fe5876001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b158015611b1c57600080fd5b90506000611ff38386612885565b9050611ffd612c84565b6000831161201a5760405180602001604052806000815250612024565b61202482846128c7565b905061202e612c84565b604080516020810190915288546001600160e01b031681526120509083612905565b905060405180604001604052806120a083600001516040518060400160405280601a81526020017f6e657720696e646578206578636565647320323234206269747300000000000081525061292a565b6001600160e01b031681526020016120db886040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b63ffffffff9081169091526001600160a01b038c166000908152600860209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b0319909416939093171691909117905550611be892505050565b8015611be857612172826040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b845463ffffffff91909116600160e01b026001600160e01b03909116178455505050505050565b6000806121a461174d565b604080516370a0823160e01b815230600482015290519192506000916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156121f057600080fd5b505afa158015612204573d6000803e3d6000fd5b505050506040513d602081101561221a57600080fd5b50519050831580159061222d5750808411155b156122ca57816001600160a01b031663a9059cbb86866040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561229257600080fd5b505af11580156122a6573d6000803e3d6000fd5b505050506040513d60208110156122bc57600080fd5b50600093506122d092505050565b83925050505b92915050565b6001600160a01b0382166000908152600560205260409020548015612303576122fe83611791565b612486565b8115612486576001600160a01b03831660009081526004602052604090205460ff161515600114612377576040805162461bcd60e51b815260206004820152601960248201527818dbdb5c081b585c9ad95d081a5cc81b9bdd081b1a5cdd1959603a1b604482015290519081900360640190fd5b6001600160a01b0383166000908152600760205260409020546001600160e01b03161580156123c957506001600160a01b038316600090815260076020526040902054600160e01b900463ffffffff16155b156124865760405180604001604052806ec097ce7bc90715b34b9f10000000006001600160e01b0316815260200161242b612402610b48565b6040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b63ffffffff9081169091526001600160a01b0385166000908152600760209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555b818114610a9a576001600160a01b038316600081815260056020908152604091829020859055815185815291517fdeafccd0c0b768b2529f7dcbbe58e155d6023059150b7490ed4535cc3744b92d9281900390910190a2505050565b6001600160a01b038216600090815260066020526040902054801561258d57612509612c84565b6040518060200160405280856001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561254d57600080fd5b505afa158015612561573d6000803e3d6000fd5b505050506040513d602081101561257757600080fd5b5051905290506125878482611f2c565b506126e7565b81156126e7576001600160a01b03831660009081526004602052604090205460ff161515600114612601576040805162461bcd60e51b815260206004820152601960248201527818dbdb5c081b585c9ad95d081a5cc81b9bdd081b1a5cdd1959603a1b604482015290519081900360640190fd5b6001600160a01b0383166000908152600860205260409020546001600160e01b031615801561265357506001600160a01b038316600090815260086020526040902054600160e01b900463ffffffff16155b156126e75760405180604001604052806ec097ce7bc90715b34b9f10000000006001600160e01b0316815260200161268c612402610b48565b63ffffffff9081169091526001600160a01b0385166000908152600860209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555b818114610a9a576001600160a01b038316600081815260066020908152604091829020859055815185815291517f20af8e791cc98f74b2d7a391c80980ca8e5aebf3d4060bf581997b6acae2e5379281900390910190a2505050565b806001600160a01b031663fe9c44ae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561277c57600080fd5b505afa158015612790573d6000803e3d6000fd5b505050506040513d60208110156127a657600080fd5b50506003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b038416908117909155600081815260046020908152604091829020805460ff19169094179093558051918252517fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f929181900390910190a150565b600061287e8383604051806040016040528060158152602001747375627472616374696f6e20756e646572666c6f7760581b815250612ac1565b9392505050565b600061287e83836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f77000000000000000000815250612b1b565b6128cf612c84565b60405180602001604052806128fc6128f6866ec097ce7bc90715b34b9f1000000000612885565b85612b9a565b90529392505050565b61290d612c84565b60405180602001604052806128fc85600001518560000151612a8b565b600081600160e01b84106129bc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612981578181015183820152602001612969565b50505050905090810190601f1680156129ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b600081600160201b84106129bc5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b612a21612c84565b60405180602001604052806128fc85600001518560000151612844565b600061287e612a5584670de0b6b3a7640000612885565b8351612b9a565b60006ec097ce7bc90715b34b9f1000000000612a7c848460000151612885565b81612a8357fe5b049392505050565b600061287e8383604051806040016040528060118152602001706164646974696f6e206f766572666c6f7760781b815250612bcd565b60008184841115612b135760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b505050900390565b6000831580612b28575082155b15612b355750600061287e565b83830283858281612b4257fe5b04148390612b915760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b50949350505050565b600061287e83836040518060400160405280600e81526020016d646976696465206279207a65726f60901b815250612c22565b60008383018285821015612b915760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b60008183612c715760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b50828481612c7b57fe5b04949350505050565b604051806020016040528060008152509056fe6d61726b65747320616e6420626f72726f77207370656564732073686f756c6420626520313a316d61726b65747320616e6420737570706c79207370656564732073686f756c6420626520313a314c4e20696e63656e7469766520746f6b656e206d757374206861766520612070726f7065722061646472657373626c6f636b206e756d626572206578636565647320333220626974730000000043616e6e6f74206368616e676520746865204c4e20696e63656e7469766520746f6b656e206f6e636520697420697320736574a265627a7a7231582006012e5355b85d665b008c517d821407c7ac4c9051a966fe571725322ab4f6c264736f6c63430005100032000000000000000000000000892701d128d63c9856a9eb5d967982f78fd3f2ae0000000000000000000000007c1d6e7c7240f9218a71cf54c1908f1713093a32
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102275760003560e01c80636b79c38d11610130578063ca0af043116100b8578063e9c714f21161007c578063e9c714f214610982578063f4a433c01461098a578063f606c86b146109b0578063f794062e146109b8578063f851a440146109de57610227565b8063ca0af043146108d4578063cc7ebdc414610902578063e394bd6014610928578063e3f96ae714610930578063e9af02921461095c57610227565b8063a76b3fda116100ff578063a76b3fda14610728578063a7f0e2311461074e578063a9ea1def14610772578063b21be7fd14610880578063b71d1a0c146108ae57610227565b80636b79c38d14610614578063829d83a0146106625780638c57804e146106945780639cd47128146106ba57610227565b80634f54b3c0116101b35780635fe3b567116101825780635fe3b5671461048c5780636312d0ef14610494578063641cbbcd146104ba5780636810dfa6146104c25780636aa875b5146105ee57610227565b80634f54b3c01461043157806352d84d1e1461045f5780635ad7b9361461047c5780635dbf1fa11461048457610227565b806326782247116101fa5780632678224714610373578063343b286f1461039757806342cbb15c14610405578063469ab1e31461040d57806349343cee1461041557610227565b8063082bc0ab1461022c5780631c3db2e0146102545780631d7b33d7146103055780632100550e1461033d575b600080fd5b6102526004803603602081101561024257600080fd5b50356001600160a01b03166109e6565b005b6102526004803603604081101561026a57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561029457600080fd5b8201836020820111156102a657600080fd5b803590602001918460208302840111600160201b831117156102c757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610a3d945050505050565b61032b6004803603602081101561031b57600080fd5b50356001600160a01b0316610a9f565b60408051918252519081900360200190f35b6102526004803603606081101561035357600080fd5b506001600160a01b03813581169160208101359091169060400135610aba565b61037b610b2d565b604080516001600160a01b039092168252519081900360200190f35b610252600480360360208110156103ad57600080fd5b810190602081018135600160201b8111156103c757600080fd5b8201836020820111156103d957600080fd5b803590602001918460018302840111600160201b831117156103fa57600080fd5b509092509050610b3c565b61032b610b48565b61032b610b4c565b61041d610b52565b604080519115158252519081900360200190f35b6102526004803603604081101561044757600080fd5b506001600160a01b0381358116916020013516610b62565b61037b6004803603602081101561047557600080fd5b5035610bb7565b610252610bde565b61037b610be8565b61037b610bf7565b610252600480360360208110156104aa57600080fd5b50356001600160a01b0316610c06565b61041d610e8a565b610252600480360360808110156104d857600080fd5b810190602081018135600160201b8111156104f257600080fd5b82018360208201111561050457600080fd5b803590602001918460208302840111600160201b8311171561052557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561057457600080fd5b82018360208201111561058657600080fd5b803590602001918460208302840111600160201b831117156105a757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505050803515159150602001351515610e9a565b61032b6004803603602081101561060457600080fd5b50356001600160a01b031661112a565b61063a6004803603602081101561062a57600080fd5b50356001600160a01b031661113c565b604080516001600160e01b03909316835263ffffffff90911660208301528051918290030190f35b6102526004803603606081101561067857600080fd5b506001600160a01b038135169060208101359060400135611166565b61063a600480360360208110156106aa57600080fd5b50356001600160a01b03166111d3565b610252600480360360208110156106d057600080fd5b810190602081018135600160201b8111156106ea57600080fd5b8201836020820111156106fc57600080fd5b803590602001918460018302840111600160201b8311171561071d57600080fd5b509092509050610b44565b6102526004803603602081101561073e57600080fd5b50356001600160a01b03166111fd565b6107566112b0565b604080516001600160e01b039092168252519081900360200190f35b6102526004803603606081101561078857600080fd5b810190602081018135600160201b8111156107a257600080fd5b8201836020820111156107b457600080fd5b803590602001918460208302840111600160201b831117156107d557600080fd5b919390929091602081019035600160201b8111156107f257600080fd5b82018360208201111561080457600080fd5b803590602001918460208302840111600160201b8311171561082557600080fd5b919390929091602081019035600160201b81111561084257600080fd5b82018360208201111561085457600080fd5b803590602001918460208302840111600160201b8311171561087557600080fd5b5090925090506112c3565b61032b6004803603604081101561089657600080fd5b506001600160a01b038135811691602001351661140d565b61032b600480360360208110156108c457600080fd5b50356001600160a01b031661142a565b61032b600480360360408110156108ea57600080fd5b506001600160a01b03813581169160200135166114de565b61032b6004803603602081101561091857600080fd5b50356001600160a01b03166114fb565b61032b61150d565b6102526004803603604081101561094657600080fd5b506001600160a01b038135169060200135611542565b6102526004803603602081101561097257600080fd5b50356001600160a01b03166115ae565b61032b611612565b61032b600480360360208110156109a057600080fd5b50356001600160a01b031661173b565b61037b61174d565b61041d600480360360208110156109ce57600080fd5b50356001600160a01b031661175c565b61037b611771565b6109ee611780565b610a31576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b610a3a81611791565b50565b604080516001808252818301909252606091602080830190803883390190505090508281600081518110610a6d57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050610a9a8183600180610e9a565b505050565b6001600160a01b031660009081526005602052604090205490565b610ac2611780565b610b05576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b610b0d612c84565b506040805160208101909152818152610b27848483611a26565b50505050565b6002546001600160a01b031681565b610b44611bf0565b5050565b4390565b600d5481565b600254600160a01b900460ff1681565b610b6a611780565b610bad576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b610b448282611d3c565b60038181548110610bc457fe5b6000918252602090912001546001600160a01b0316905081565b610be6611bf0565b565b600c546001600160a01b031681565b6001546001600160a01b031681565b610c0e611f1b565b610c5f576040805162461bcd60e51b815260206004820152601d60248201527f6f6e6c792061646d696e2063616e2073657420636f6d70207370656564000000604482015290519081900360640190fd5b6001600160a01b038116610ca45760405162461bcd60e51b815260040180806020018281038252602d815260200180612ce6602d913960400191505060405180910390fd5b6000610cae61174d565b6001600160a01b031614610cf35760405162461bcd60e51b8152600401808060200182810382526033815260200180612d336033913960400191505060405180910390fd5b600160009054906101000a90046001600160a01b03166001600160a01b0316635ab1bd536040518163ffffffff1660e01b815260040160206040518083038186803b158015610d4157600080fd5b505afa158015610d55573d6000803e3d6000fd5b505050506040513d6020811015610d6b57600080fd5b5051604080516308c9682b60e31b81526001600160a01b0384811660048301529151919092169163464b4158916024808301926020929190829003018186803b158015610db757600080fd5b505afa158015610dcb573d6000803e3d6000fd5b505050506040513d6020811015610de157600080fd5b5051610e2a576040805162461bcd60e51b8152602060048201526013602482015272151bdad95b881b9bdd081cdd5c1c1bdc9d1959606a1b604482015290519081900360640190fd5b600c80546001600160a01b0319166001600160a01b0383811691909117918290556040805192909116825243602083015280517f1eaff93288e717d271fbb0007322e12295058d72b4324e5fef1c27327b2e22749281900390910190a150565b600c54600160a01b900460ff1681565b60005b8351811015611123576000848281518110610eb457fe5b6020908102919091018101516001600160a01b0381166000908152600490925260409091205490915060ff16610f29576040805162461bcd60e51b81526020600482015260156024820152741b585c9ad95d081b5d5cdd081899481b1a5cdd1959605a1b604482015290519081900360640190fd5b6001841515141561107857610f3c612c84565b6040518060200160405280836001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f8057600080fd5b505afa158015610f94573d6000803e3d6000fd5b505050506040513d6020811015610faa57600080fd5b505190529050610fba8282611f2c565b60005b875181101561107557610fe483898381518110610fd657fe5b602002602001015184611a26565b611039888281518110610ff357fe5b6020026020010151600b60008b858151811061100b57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054612199565b600b60008a848151811061104957fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002055600101610fbd565b50505b6001831515141561111a5761108c81611791565b60005b8651811015611118576110b5828883815181106110a857fe5b6020026020010151611d3c565b6110dc8782815181106110c457fe5b6020026020010151600b60008a858151811061100b57fe5b600b60008984815181106110ec57fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205560010161108f565b505b50600101610e9d565b5050505050565b60056020526000908152604090205481565b6007602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b61116e611f1b565b6111bf576040805162461bcd60e51b815260206004820152601d60248201527f6f6e6c792061646d696e2063616e2073657420636f6d70207370656564000000604482015290519081900360640190fd5b6111c983836122d6565b610a9a83826124e2565b6008602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b611205611780565b611248576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b6001600160a01b03811660009081526004602052604090205460ff16156112a7576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481b1a5cdd195960921b604482015290519081900360640190fd5b610a3a81612743565b6ec097ce7bc90715b34b9f100000000081565b8483146113015760405162461bcd60e51b8152600401808060200182810382526027815260200180612cbf6027913960400191505060405180910390fd5b84811461133f5760405162461bcd60e51b8152600401808060200182810382526027815260200180612c986027913960400191505060405180910390fd5b611347611f1b565b611398576040805162461bcd60e51b815260206004820152601d60248201527f6f6e6c792061646d696e2063616e2073657420636f6d70207370656564000000604482015290519081900360640190fd5b60005b858110156114045760008787838181106113b157fe5b905060200201356001600160a01b031690506113df818787858181106113d357fe5b905060200201356122d6565b6113fb818585858181106113ef57fe5b905060200201356124e2565b5060010161139b565b50505050505050565b600960209081526000928352604080842090915290825290205481565b600080546001600160a01b03163314611476576040805162461bcd60e51b81526020600482015260096024820152682737ba1020b236b4b760b91b604482015290519081900360640190fd5b600280546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a9929181900390910190a150600092915050565b600a60209081526000928352604080842090915290825290205481565b600b6020526000908152604090205481565b604080517f53696e676c65417373657444796e616d69635261696e4d616b657200000000008152905190819003601b01902081565b61154a611780565b61158d576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b611595612c84565b506040805160208101909152818152610a9a8382611f2c565b610a3a81600380548060200260200160405190810160405280929190818152602001828054801561160857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115ea575b5050505050610a3d565b6002546000906001600160a01b03163314801561162e57503315155b61167f576040805162461bcd60e51b815260206004820152601e60248201527f4e6f7420746865204558495354494e472070656e64696e672061646d696e0000604482015290519081900360640190fd5b60008054600280546001600160a01b038082166001600160a01b031980861682179687905590921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600254604080516001600160a01b038085168252909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a160009250505090565b60066020526000908152604090205481565b600c546001600160a01b031690565b60046020526000908152604090205460ff1681565b6000546001600160a01b031681565b6001546001600160a01b0316331490565b600254600160a01b900460ff16156117a857610a3a565b6001600160a01b0381166000908152600760209081526040808320600590925282205490916117d5610b48565b83549091506000906117f5908390600160e01b900463ffffffff16612844565b90506000811180156118075750600083115b156119cd576000856001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561184757600080fd5b505afa15801561185b573d6000803e3d6000fd5b505050506040513d602081101561187157600080fd5b5051905060006118818386612885565b905061188b612c84565b600083116118a857604051806020016040528060008152506118b2565b6118b282846128c7565b90506118bc612c84565b604080516020810190915288546001600160e01b031681526118de9083612905565b9050604051806040016040528061192e83600001516040518060400160405280601a81526020017f6e657720696e646578206578636565647320323234206269747300000000000081525061292a565b6001600160e01b03168152602001611969886040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b63ffffffff9081169091526001600160a01b038b166000908152600760209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555061112392505050565b801561112357611a00826040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b845463ffffffff91909116600160e01b026001600160e01b039091161784555050505050565b6001600160a01b0383166000908152600860205260409020611a46612c84565b50604080516020810190915281546001600160e01b03168152611a67612c84565b5060408051602080820183526001600160a01b038089166000908152600a835284812091891680825282845294812080548552865195909152915291909155815115611be857611ab5612c84565b611abf8383612a19565b90506000611b4e886001600160a01b03166395dd9193896040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611b1c57600080fd5b505afa158015611b30573d6000803e3d6000fd5b505050506040513d6020811015611b4657600080fd5b505187612a3e565b90506000611b5c8284612a5c565b6001600160a01b0389166000908152600b602052604081205491925090611b839083612a8b565b6001600160a01b03808b166000818152600b60209081526040918290208590558a5182518881529182015281519495509193928e16927f1fc3ecc087d8d2d15e23d0032af5a47059c3892d003d8e139fdcb6bb327c99a69281900390910190a3505050505b505050505050565b611bf8611780565b611c3b576040805162461bcd60e51b815260206004820152600f60248201526e2737ba1031b7b6b83a3937b63632b960891b604482015290519081900360640190fd5b60005b600354811015611d2657600060038281548110611c5757fe5b60009182526020808320909101546001600160a01b0316808352600490915260409091205490915060ff1615611d1d57611c9081611791565b6000816001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ccb57600080fd5b505afa158015611cdf573d6000803e3d6000fd5b505050506040513d6020811015611cf557600080fd5b50519050611d01612c84565b506040805160208101909152818152611d1a8382611f2c565b50505b50600101611c3e565b506002805460ff60a01b1916600160a01b179055565b6001600160a01b0382166000908152600760205260409020611d5c612c84565b50604080516020810190915281546001600160e01b03168152611d7d612c84565b5060408051602080820183526001600160a01b03808816600090815260098352848120918816808252828452948120805485528651959091529152919091558051158015611dcb5750815115155b15611de3576ec097ce7bc90715b34b9f100000000081525b611deb612c84565b611df58383612a19565b90506000866001600160a01b03166370a08231876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611e4f57600080fd5b505afa158015611e63573d6000803e3d6000fd5b505050506040513d6020811015611e7957600080fd5b505190506000611e898284612a5c565b6001600160a01b0388166000908152600b602052604081205491925090611eb09083612a8b565b6001600160a01b03808a166000818152600b60209081526040918290208590558a5182518881529182015281519495509193928d16927f2caecd17d02f56fa897705dcc740da2d237c373f70686f4e0d9bd3bf0400ea7a9281900390910190a3505050505050505050565b6000546001600160a01b0316331490565b600254600160a01b900460ff1615611f4357610b44565b6001600160a01b038216600090815260086020908152604080832060069092528220549091611f70610b48565b8354909150600090611f90908390600160e01b900463ffffffff16612844565b9050600081118015611fa25750600083115b1561213f576000611fe5876001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b158015611b1c57600080fd5b90506000611ff38386612885565b9050611ffd612c84565b6000831161201a5760405180602001604052806000815250612024565b61202482846128c7565b905061202e612c84565b604080516020810190915288546001600160e01b031681526120509083612905565b905060405180604001604052806120a083600001516040518060400160405280601a81526020017f6e657720696e646578206578636565647320323234206269747300000000000081525061292a565b6001600160e01b031681526020016120db886040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b63ffffffff9081169091526001600160a01b038c166000908152600860209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b0319909416939093171691909117905550611be892505050565b8015611be857612172826040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b845463ffffffff91909116600160e01b026001600160e01b03909116178455505050505050565b6000806121a461174d565b604080516370a0823160e01b815230600482015290519192506000916001600160a01b038416916370a08231916024808301926020929190829003018186803b1580156121f057600080fd5b505afa158015612204573d6000803e3d6000fd5b505050506040513d602081101561221a57600080fd5b50519050831580159061222d5750808411155b156122ca57816001600160a01b031663a9059cbb86866040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561229257600080fd5b505af11580156122a6573d6000803e3d6000fd5b505050506040513d60208110156122bc57600080fd5b50600093506122d092505050565b83925050505b92915050565b6001600160a01b0382166000908152600560205260409020548015612303576122fe83611791565b612486565b8115612486576001600160a01b03831660009081526004602052604090205460ff161515600114612377576040805162461bcd60e51b815260206004820152601960248201527818dbdb5c081b585c9ad95d081a5cc81b9bdd081b1a5cdd1959603a1b604482015290519081900360640190fd5b6001600160a01b0383166000908152600760205260409020546001600160e01b03161580156123c957506001600160a01b038316600090815260076020526040902054600160e01b900463ffffffff16155b156124865760405180604001604052806ec097ce7bc90715b34b9f10000000006001600160e01b0316815260200161242b612402610b48565b6040518060400160405280601c8152602001600080516020612d138339815191528152506129c4565b63ffffffff9081169091526001600160a01b0385166000908152600760209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555b818114610a9a576001600160a01b038316600081815260056020908152604091829020859055815185815291517fdeafccd0c0b768b2529f7dcbbe58e155d6023059150b7490ed4535cc3744b92d9281900390910190a2505050565b6001600160a01b038216600090815260066020526040902054801561258d57612509612c84565b6040518060200160405280856001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561254d57600080fd5b505afa158015612561573d6000803e3d6000fd5b505050506040513d602081101561257757600080fd5b5051905290506125878482611f2c565b506126e7565b81156126e7576001600160a01b03831660009081526004602052604090205460ff161515600114612601576040805162461bcd60e51b815260206004820152601960248201527818dbdb5c081b585c9ad95d081a5cc81b9bdd081b1a5cdd1959603a1b604482015290519081900360640190fd5b6001600160a01b0383166000908152600860205260409020546001600160e01b031615801561265357506001600160a01b038316600090815260086020526040902054600160e01b900463ffffffff16155b156126e75760405180604001604052806ec097ce7bc90715b34b9f10000000006001600160e01b0316815260200161268c612402610b48565b63ffffffff9081169091526001600160a01b0385166000908152600860209081526040909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555b818114610a9a576001600160a01b038316600081815260066020908152604091829020859055815185815291517f20af8e791cc98f74b2d7a391c80980ca8e5aebf3d4060bf581997b6acae2e5379281900390910190a2505050565b806001600160a01b031663fe9c44ae6040518163ffffffff1660e01b815260040160206040518083038186803b15801561277c57600080fd5b505afa158015612790573d6000803e3d6000fd5b505050506040513d60208110156127a657600080fd5b50506003805460018082019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b038416908117909155600081815260046020908152604091829020805460ff19169094179093558051918252517fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f929181900390910190a150565b600061287e8383604051806040016040528060158152602001747375627472616374696f6e20756e646572666c6f7760581b815250612ac1565b9392505050565b600061287e83836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f77000000000000000000815250612b1b565b6128cf612c84565b60405180602001604052806128fc6128f6866ec097ce7bc90715b34b9f1000000000612885565b85612b9a565b90529392505050565b61290d612c84565b60405180602001604052806128fc85600001518560000151612a8b565b600081600160e01b84106129bc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612981578181015183820152602001612969565b50505050905090810190601f1680156129ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b600081600160201b84106129bc5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b612a21612c84565b60405180602001604052806128fc85600001518560000151612844565b600061287e612a5584670de0b6b3a7640000612885565b8351612b9a565b60006ec097ce7bc90715b34b9f1000000000612a7c848460000151612885565b81612a8357fe5b049392505050565b600061287e8383604051806040016040528060118152602001706164646974696f6e206f766572666c6f7760781b815250612bcd565b60008184841115612b135760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b505050900390565b6000831580612b28575082155b15612b355750600061287e565b83830283858281612b4257fe5b04148390612b915760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b50949350505050565b600061287e83836040518060400160405280600e81526020016d646976696465206279207a65726f60901b815250612c22565b60008383018285821015612b915760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b60008183612c715760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612981578181015183820152602001612969565b50828481612c7b57fe5b04949350505050565b604051806020016040528060008152509056fe6d61726b65747320616e6420626f72726f77207370656564732073686f756c6420626520313a316d61726b65747320616e6420737570706c79207370656564732073686f756c6420626520313a314c4e20696e63656e7469766520746f6b656e206d757374206861766520612070726f7065722061646472657373626c6f636b206e756d626572206578636565647320333220626974730000000043616e6e6f74206368616e676520746865204c4e20696e63656e7469766520746f6b656e206f6e636520697420697320736574a265627a7a7231582006012e5355b85d665b008c517d821407c7ac4c9051a966fe571725322ab4f6c264736f6c63430005100032
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000892701d128d63c9856a9eb5d967982f78fd3f2ae0000000000000000000000007c1d6e7c7240f9218a71cf54c1908f1713093a32
-----Decoded View---------------
Arg [0] : _comptroller (address): 0x892701d128d63c9856A9Eb5d967982F78FD3F2AE
Arg [1] : _admin (address): 0x7c1d6e7C7240f9218a71cf54C1908f1713093A32
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000892701d128d63c9856a9eb5d967982f78fd3f2ae
Arg [1] : 0000000000000000000000007c1d6e7c7240f9218a71cf54c1908f1713093a32
Deployed Bytecode Sourcemap
121109:21545:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;121109:21545:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;125813:166;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;125813:166:0;-1:-1:-1;;;;;125813:166:0;;:::i;:::-;;124051:209;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;124051:209:0;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;124051:209:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;124051:209:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;-1:-1;;;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;124051:209:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;124051:209:0;;-1:-1:-1;124051:209:0;;-1:-1:-1;;;;;124051:209:0:i;142411:113::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;142411:113:0;-1:-1:-1;;;;;142411:113:0;;:::i;:::-;;;;;;;;;;;;;;;;126486:317;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;126486:317:0;;;;;;;;;;;;;;;;;:::i;116232:27::-;;;:::i;:::-;;;;-1:-1:-1;;;;;116232:27:0;;;;;;;;;;;;;;138109:138;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;138109:138:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;138109:138:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;138109:138:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;-1:-1;;;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;-1:-1;138109:138:0;;-1:-1:-1;138109:138:0;-1:-1:-1;138109:138:0;:::i;142555:96::-;;;:::i;119803:31::-;;;:::i;118079:21::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;126282:196;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;126282:196:0;;;;;;;;;;:::i;118386:26::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;118386:26:0;;:::i;138297:71::-;;;:::i;119679:38::-;;;:::i;116112:39::-;;;:::i;141275:648::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;141275:648:0;-1:-1:-1;;;;;141275:648:0;;:::i;119766:30::-;;;:::i;124603:1169::-;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;124603:1169:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;124603:1169:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;124603:1169:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;-1:-1;;;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;124603:1169:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;124603:1169:0;;;;;;;;-1:-1:-1;124603:1169:0;;-1:-1:-1;;;;;5:28;;2:2;;;46:1;43;36:12;2:2;124603:1169:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;124603:1169:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;-1:-1;;;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;124603:1169:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;124603:1169:0;;-1:-1:-1;;;;124603:1169:0;;;;;-1:-1:-1;124603:1169:0;;;;;;:::i;118619:48::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;118619:48:0;-1:-1:-1;;;;;118619:48:0;;:::i;118885:58::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;118885:58:0;-1:-1:-1;;;;;118885:58:0;;:::i;:::-;;;;-1:-1:-1;;;;;118885:58:0;;;;;;;;;;;;;;;;;;;;;;136886:290;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;136886:290:0;;;;;;;;;;;;;:::i;119014:58::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;119014:58:0;-1:-1:-1;;;;;119014:58:0;;:::i;137839:110::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;137839:110:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;137839:110:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;137839:110:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;-1:-1;;;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;-1:-1;137839:110:0;;-1:-1:-1;137839:110:0;-1:-1:-1;137839:110:0;:::i;137221:219::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;137221:219:0;-1:-1:-1;;;;;137221:219:0;;:::i;121434:47::-;;;:::i;:::-;;;;-1:-1:-1;;;;;121434:47:0;;;;;;;;;;;;;;135950:671;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;135950:671:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;135950:671:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;135950:671:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;-1:-1;;;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;135950:671:0;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;135950:671:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;135950:671:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;-1:-1;;;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;135950:671:0;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;135950:671:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;135950:671:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;-1:-1;;;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;-1:-1;135950:671:0;;-1:-1:-1;135950:671:0;-1:-1:-1;135950:671:0;:::i;119192:69::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;119192:69:0;;;;;;;;;;:::i;139641:534::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;139641:534:0;-1:-1:-1;;;;;139641:534:0;;:::i;119381:69::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;119381:69:0;;;;;;;;;;:::i;119530:43::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;119530:43:0;-1:-1:-1;;;;;119530:43:0;;:::i;121266:106::-;;;:::i;125987:287::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;125987:287:0;;;;;;;;:::i;123738:97::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;123738:97:0;-1:-1:-1;;;;;123738:97:0;;:::i;140453:655::-;;;:::i;118766:48::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;118766:48:0;-1:-1:-1;;;;;118766:48:0;;:::i;123444:117::-;;;:::i;118480:40::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;118480:40:0;-1:-1:-1;;;;;118480:40:0;;:::i;116021:20::-;;;:::i;125813:166::-;125888:15;:13;:15::i;:::-;125880:43;;;;;-1:-1:-1;;;125880:43:0;;;;;;;;;;;;-1:-1:-1;;;125880:43:0;;;;;;;;;;;;;;;125934:37;125964:6;125934:29;:37::i;:::-;125813:166;:::o;124051:209::-;124156:16;;;124170:1;124156:16;;;;;;;;;124129:24;;124156:16;;;;;;105:10:-1;124156:16:0;88:34:-1;136:17;;-1:-1;124156:16:0;124129:43;;124196:6;124183:7;124191:1;124183:10;;;;;;;;;;;;;:19;-1:-1:-1;;;;;124183:19:0;;;-1:-1:-1;;;;;124183:19:0;;;;;124213:39;124223:7;124232;124241:4;124247;124213:9;:39::i;:::-;124051:209;;;:::o;142411:113::-;-1:-1:-1;;;;;142492:24:0;142468:4;142492:24;;;:16;:24;;;;;;;142411:113::o;126486:317::-;126605:15;:13;:15::i;:::-;126597:43;;;;;-1:-1:-1;;;126597:43:0;;;;;;;;;;;;-1:-1:-1;;;126597:43:0;;;;;;;;;;;;;;;126651:28;;:::i;:::-;-1:-1:-1;126682:35:0;;;;;;;;;;;;126728:67;126759:6;126767:8;126682:35;126728:30;:67::i;:::-;126486:317;;;;:::o;116232:27::-;;;-1:-1:-1;;;;;116232:27:0;;:::o;138109:138::-;138223:16;:14;:16::i;:::-;138109:138;;:::o;142555:96::-;142631:12;142555:96;:::o;119803:31::-;;;;:::o;118079:21::-;;;-1:-1:-1;;;118079:21:0;;;;;:::o;126282:196::-;126376:15;:13;:15::i;:::-;126368:43;;;;;-1:-1:-1;;;126368:43:0;;;;;;;;;;;;-1:-1:-1;;;126368:43:0;;;;;;;;;;;;;;;126422:48;126453:6;126461:8;126422:30;:48::i;118386:26::-;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;118386:26:0;;-1:-1:-1;118386:26:0;:::o;138297:71::-;138344:16;:14;:16::i;:::-;138297:71::o;119679:38::-;;;-1:-1:-1;;;;;119679:38:0;;:::o;116112:39::-;;;-1:-1:-1;;;;;116112:39:0;;:::o;141275:648::-;141362:9;:7;:9::i;:::-;141354:51;;;;;-1:-1:-1;;;141354:51:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;141424:35:0;;141416:93;;;;-1:-1:-1;;;141416:93:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;141568:1;141528:28;:26;:28::i;:::-;-1:-1:-1;;;;;141528:42:0;;141520:106;;;;-1:-1:-1;;;141520:106:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;141687:11;;;;;;;;;-1:-1:-1;;;;;141687:11:0;-1:-1:-1;;;;;141687:23:0;;:25;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;141687:25:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;141687:25:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;141687:25:0;141647:106;;;-1:-1:-1;;;141647:106:0;;-1:-1:-1;;;;;141647:106:0;;;;;;;;;:83;;;;;;;:106;;;;;141687:25;;141647:106;;;;;;;:83;:106;;;5:2:-1;;;;30:1;27;20:12;5:2;141647:106:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;141647:106:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;141647:106:0;141639:138;;;;;-1:-1:-1;;;141639:138:0;;;;;;;;;;;;-1:-1:-1;;;141639:138:0;;;;;;;;;;;;;;;141790:23;:47;;-1:-1:-1;;;;;;141790:47:0;-1:-1:-1;;;;;141790:47:0;;;;;;;;;;;141853:62;;;141877:23;;;;141853:62;;141902:12;141853:62;;;;;;;;;;;;;;;;141275:648;:::o;119766:30::-;;;-1:-1:-1;;;119766:30:0;;;;;:::o;124603:1169::-;124728:6;124723:1042;124744:7;:14;124740:1;:18;124723:1042;;;124780:13;124796:7;124804:1;124796:10;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;124829:25:0;;;;;;:8;:25;;;;;;;;124796:10;;-1:-1:-1;124829:25:0;;124821:59;;;;;-1:-1:-1;;;124821:59:0;;;;;;;;;;;;-1:-1:-1;;;124821:59:0;;;;;;;;;;;;;;;124912:4;124899:17;;;;124895:476;;;124937:22;;:::i;:::-;124962:37;;;;;;;;124977:6;-1:-1:-1;;;;;124977:18:0;;:20;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;124977:20:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;124977:20:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;124977:20:0;124962:37;;124937:62;-1:-1:-1;125018:59:0;125056:6;124937:62;125018:29;:59::i;:::-;125101:6;125096:260;125117:7;:14;125113:1;:18;125096:260;;;125161:72;125200:6;125209:7;125217:1;125209:10;;;;;;;;;;;;;;125221:11;125161:30;:72::i;:::-;125282:54;125300:7;125308:1;125300:10;;;;;;;;;;;;;;125312:11;:23;125324:7;125332:1;125324:10;;;;;;;;;;;;;;-1:-1:-1;;;;;125312:23:0;-1:-1:-1;;;;;125312:23:0;;;;;;;;;;;;;125282:17;:54::i;:::-;125256:11;:23;125268:7;125276:1;125268:10;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;125256:23:0;;;;;;;;;;;-1:-1:-1;125256:23:0;:80;125133:3;;125096:260;;;;124895:476;;125402:4;125389:17;;;;125385:369;;;125427:46;125465:6;125427:29;:46::i;:::-;125497:6;125492:247;125513:7;:14;125509:1;:18;125492:247;;;125557:59;125596:6;125605:7;125613:1;125605:10;;;;;;;;;;;;;;125557:30;:59::i;:::-;125665:54;125683:7;125691:1;125683:10;;;;;;;;;;;;;;125695:11;:23;125707:7;125715:1;125707:10;;;;;;;125665:54;125639:11;:23;125651:7;125659:1;125651:10;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;125639:23:0;;;;;;;;;;;-1:-1:-1;125639:23:0;:80;125529:3;;125492:247;;;;125385:369;-1:-1:-1;124760:3:0;;124723:1042;;;;124603:1169;;;;:::o;118619:48::-;;;;;;;;;;;;;:::o;118885:58::-;;;;;;;;;;;;-1:-1:-1;;;;;118885:58:0;;;-1:-1:-1;;;118885:58:0;;;;;:::o;136886:290::-;137001:9;:7;:9::i;:::-;136993:51;;;;;-1:-1:-1;;;136993:51:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;137055;137082:6;137090:15;137055:26;:51::i;:::-;137117;137144:6;137152:15;137117:26;:51::i;119014:58::-;;;;;;;;;;;;-1:-1:-1;;;;;119014:58:0;;;-1:-1:-1;;;119014:58:0;;;;;:::o;137221:219::-;137290:15;:13;:15::i;:::-;137282:43;;;;;-1:-1:-1;;;137282:43:0;;;;;;;;;;;;-1:-1:-1;;;137282:43:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;137345:16:0;;;;;;:8;:16;;;;;;;;137344:17;137336:44;;;;;-1:-1:-1;;;137336:44:0;;;;;;;;;;;;-1:-1:-1;;;137336:44:0;;;;;;;;;;;;;;;137393:39;137424:6;137393:22;:39::i;121434:47::-;121477:4;121434:47;:::o;135950:671::-;136107:43;;;136099:95;;;;-1:-1:-1;;;136099:95:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;136213:43;;;136205:95;;;;-1:-1:-1;;;136205:95:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;136319:9;:7;:9::i;:::-;136311:51;;;;;-1:-1:-1;;;136311:51:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;136380:6;136375:239;136392:19;;;136375:239;;;136433:13;136449:8;;136458:1;136449:11;;;;;;;;;;;;;-1:-1:-1;;;;;136449:11:0;136433:27;;136475:56;136502:6;136510:17;;136528:1;136510:20;;;;;;;;;;;;;136475:26;:56::i;:::-;136546;136573:6;136581:17;;136599:1;136581:20;;;;;;;;;;;;;136546:26;:56::i;:::-;-1:-1:-1;136413:3:0;;136375:239;;;;135950:671;;;;;;:::o;119192:69::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;139641:534::-;139708:4;139780:5;;-1:-1:-1;;;;;139780:5:0;139766:10;:19;139758:41;;;;;-1:-1:-1;;;139758:41:0;;;;;;;;;;;;-1:-1:-1;;;139758:41:0;;;;;;;;;;;;;;;139899:12;;;-1:-1:-1;;;;;139982:30:0;;;-1:-1:-1;;;;;;139982:30:0;;;;;;;140097:49;;;139899:12;;;;140097:49;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;140166:1:0;;139641:534;-1:-1:-1;;139641:534:0:o;119381:69::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;119530:43::-;;;;;;;;;;;;;:::o;121266:106::-;121332:40;;;;;;;;;;;;;;;;121266:106;:::o;125987:287::-;126087:15;:13;:15::i;:::-;126079:43;;;;;-1:-1:-1;;;126079:43:0;;;;;;;;;;;;-1:-1:-1;;;126079:43:0;;;;;;;;;;;;;;;126133:28;;:::i;:::-;-1:-1:-1;126164:35:0;;;;;;;;;;;;126210:56;126240:6;126164:35;126210:29;:56::i;123738:97::-;123798:29;123808:6;123816:10;123798:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;123798:29:0;;;;;;;;;;;;;;;;;;;;;:9;:29::i;140453:655::-;140605:12;;140493:4;;-1:-1:-1;;;;;140605:12:0;140591:10;:26;:54;;;;-1:-1:-1;140621:10:0;:24;;140591:54;140583:97;;;;;-1:-1:-1;;;140583:97:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;140746:16;140765:5;;140807:12;;;-1:-1:-1;;;;;140807:12:0;;;-1:-1:-1;;;;;;140880:20:0;;;;;;;;;140949:25;;;;;;140992;;;140765:5;;;140992:25;;;141011:5;;;;140992:25;;;;;;140807:12;;140992:25;;;;;;;;;141066:12;;141033:46;;;-1:-1:-1;;;;;141033:46:0;;;;;141066:12;;;141033:46;;;;;;;;;;;;;;;;141099:1;141092:8;;;;140453:655;:::o;118766:48::-;;;;;;;;;;;;;:::o;123444:117::-;123530:23;;-1:-1:-1;;;;;123530:23:0;123444:117;:::o;118480:40::-;;;;;;;;;;;;;;;:::o;116021:20::-;;;-1:-1:-1;;;;;116021:20:0;;:::o;141994:114::-;142088:11;;-1:-1:-1;;;;;142088:11:0;142066:10;:34;;141994:114::o;127004:1113::-;127083:9;;-1:-1:-1;;;127083:9:0;;;;127079:48;;;127109:7;;127079:48;-1:-1:-1;;;;;127177:23:0;;127139:35;127177:23;;;:15;:23;;;;;;;;127230:16;:24;;;;;;127177:23;;127284:16;:14;:16::i;:::-;127353:17;;127265:35;;-1:-1:-1;127311:16:0;;127330:42;;127265:35;;-1:-1:-1;;;127353:17:0;;;;127330:4;:42::i;:::-;127311:61;;127401:1;127387:11;:15;:34;;;;;127420:1;127406:11;:15;127387:34;127383:727;;;127438:17;127465:6;-1:-1:-1;;;;;127458:26:0;;:28;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;127458:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;127458:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;127458:28:0;;-1:-1:-1;127501:16:0;127520:30;127525:11;127538;127520:4;:30::i;:::-;127501:49;;127565:19;;:::i;:::-;127602:1;127587:12;:16;:78;;127644:21;;;;;;;;127662:1;127644:21;;;127587:78;;;127606:35;127615:11;127628:12;127606:8;:35::i;:::-;127565:100;;127680:19;;:::i;:::-;127707:37;;;;;;;;;127725:17;;-1:-1:-1;;;;;127725:17:0;127707:37;;127702:50;;127746:5;127702:4;:50::i;:::-;127680:72;;127793:180;;;;;;;;127831:53;127839:5;:14;;;127831:53;;;;;;;;;;;;;;;;;:7;:53::i;:::-;-1:-1:-1;;;;;127793:180:0;;;;;127906:51;127913:11;127906:51;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;127906:51:0;;;:6;:51::i;:::-;127793:180;;;;;;;-1:-1:-1;;;;;127767:23:0;;;;;;:15;:23;;;;;;;;:206;;;;;;;;;;;;-1:-1:-1;;;127767:206:0;-1:-1:-1;;;;;127767:206:0;;;-1:-1:-1;;;;;;127767:206:0;;;;;;;;;;;;;;-1:-1:-1;127383:727:0;;-1:-1:-1;;;127383:727:0;;127995:15;;127991:119;;128047:51;128054:11;128047:51;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;128047:51:0;;;:6;:51::i;:::-;128027:71;;;;;;;-1:-1:-1;;;128027:71:0;-1:-1:-1;;;;;128027:71:0;;;;;;127004:1113;;;;;:::o;131034:1123::-;-1:-1:-1;;;;;131196:23:0;;131158:35;131196:23;;;:15;:23;;;;;131230:25;;:::i;:::-;-1:-1:-1;131258:37:0;;;;;;;;;131276:17;;-1:-1:-1;;;;;131276:17:0;131258:37;;131306:27;;:::i;:::-;-1:-1:-1;131336:55:0;;;;;;;;;-1:-1:-1;;;;;131354:25:0;;;-1:-1:-1;131354:25:0;;;:17;:25;;;;;:35;;;;;;;;;;;;;;131336:55;;131440:20;;131402:35;;;;;;:58;;;;131624:20;;:24;131620:530;;131665:24;;:::i;:::-;131692:32;131697:11;131710:13;131692:4;:32::i;:::-;131665:59;;131739:19;131761:69;131773:6;-1:-1:-1;;;;;131766:34:0;;131801:8;131766:44;;;;;;;;;;;;;-1:-1:-1;;;;;131766:44:0;-1:-1:-1;;;;;131766:44:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;131766:44:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;131766:44:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;131766:44:0;131812:17;131761:4;:69::i;:::-;131739:91;;131845:18;131866:32;131871:14;131887:10;131866:4;:32::i;:::-;-1:-1:-1;;;;;131941:21:0;;131913:20;131941:21;;;:11;:21;;;;;;131845:53;;-1:-1:-1;131913:20:0;131936:42;;131845:53;131936:4;:42::i;:::-;-1:-1:-1;;;;;131993:21:0;;;;;;;:11;:21;;;;;;;;;:39;;;132117:20;;132052:86;;;;;;;;;;;131913:65;;-1:-1:-1;131993:21:0;;132052:86;;;;;;;;;;;;;;131620:530;;;;;131034:1123;;;;;;:::o;138376:856::-;138430:15;:13;:15::i;:::-;138422:43;;;;;-1:-1:-1;;;138422:43:0;;;;;;;;;;;;-1:-1:-1;;;138422:43:0;;;;;;;;;;;;;;;138483:6;138478:582;138499:10;:17;138495:21;;138478:582;;;138539:13;138555:10;138566:1;138555:13;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;138555:13:0;138618:25;;;:8;:25;;;;;;;;138555:13;;-1:-1:-1;138618:25:0;;138614:435;;;138715:46;138753:6;138715:29;:46::i;:::-;138832:16;138851:6;-1:-1:-1;;;;;138851:18:0;;:20;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;138851:20:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;138851:20:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;138851:20:0;;-1:-1:-1;138890:28:0;;:::i;:::-;-1:-1:-1;138921:28:0;;;;;;;;;;;;138968:65;139006:6;138921:28;138968:29;:65::i;:::-;138614:435;;;-1:-1:-1;138518:4:0;;138478:582;;;-1:-1:-1;139208:9:0;:16;;-1:-1:-1;;;;139208:16:0;-1:-1:-1;;;139208:16:0;;;138376:856::o;129701:976::-;-1:-1:-1;;;;;129833:23:0;;129795:35;129833:23;;;:15;:23;;;;;129867:25;;:::i;:::-;-1:-1:-1;129895:37:0;;;;;;;;;129913:17;;-1:-1:-1;;;;;129913:17:0;129895:37;;129943:27;;:::i;:::-;-1:-1:-1;129973:55:0;;;;;;;;;-1:-1:-1;;;;;129991:25:0;;;-1:-1:-1;129991:25:0;;;:17;:25;;;;;:35;;;;;;;;;;;;;;129973:55;;130077:20;;130039:35;;;;;;:58;;;;130114:22;;:27;:55;;;;-1:-1:-1;130145:20:0;;:24;;130114:55;130110:129;;;121477:4;130186:41;;130110:129;130251:24;;:::i;:::-;130278:32;130283:11;130296:13;130278:4;:32::i;:::-;130251:59;;130321:19;130350:6;-1:-1:-1;;;;;130343:24:0;;130368:8;130343:34;;;;;;;;;;;;;-1:-1:-1;;;;;130343:34:0;-1:-1:-1;;;;;130343:34:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;130343:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;130343:34:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;130343:34:0;;-1:-1:-1;130388:18:0;130409:32;130343:34;130430:10;130409:4;:32::i;:::-;-1:-1:-1;;;;;130480:21:0;;130452:20;130480:21;;;:11;:21;;;;;;130388:53;;-1:-1:-1;130452:20:0;130475:42;;130388:53;130475:4;:42::i;:::-;-1:-1:-1;;;;;130528:21:0;;;;;;;:11;:21;;;;;;;;;:39;;;130648:20;;130583:86;;;;;;;;;;;130452:65;;-1:-1:-1;130528:21:0;;130583:86;;;;;;;;;;;;;;129701:976;;;;;;;;;:::o;142173:93::-;142215:4;142253:5;-1:-1:-1;;;;;142253:5:0;142239:10;:19;;142173:93::o;128276:1169::-;128385:9;;-1:-1:-1;;;128385:9:0;;;;128381:48;;;128411:7;;128381:48;-1:-1:-1;;;;;128479:23:0;;128441:35;128479:23;;;:15;:23;;;;;;;;128532:16;:24;;;;;;128479:23;;128586:16;:14;:16::i;:::-;128655:17;;128567:35;;-1:-1:-1;128613:16:0;;128632:42;;128567:35;;-1:-1:-1;;;128655:17:0;;;;128632:4;:42::i;:::-;128613:61;;128703:1;128689:11;:15;:34;;;;;128722:1;128708:11;:15;128689:34;128685:753;;;128740:17;128760:54;128772:6;-1:-1:-1;;;;;128765:27:0;;:29;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;128760:54:0;128740:74;;128829:16;128848:30;128853:11;128866;128848:4;:30::i;:::-;128829:49;;128893:19;;:::i;:::-;128930:1;128915:12;:16;:78;;128972:21;;;;;;;;128990:1;128972:21;;;128915:78;;;128934:35;128943:11;128956:12;128934:8;:35::i;:::-;128893:100;;129008:19;;:::i;:::-;129035:37;;;;;;;;;129053:17;;-1:-1:-1;;;;;129053:17:0;129035:37;;129030:50;;129074:5;129030:4;:50::i;:::-;129008:72;;129121:180;;;;;;;;129159:53;129167:5;:14;;;129159:53;;;;;;;;;;;;;;;;;:7;:53::i;:::-;-1:-1:-1;;;;;129121:180:0;;;;;129234:51;129241:11;129234:51;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;129234:51:0;;;:6;:51::i;:::-;129121:180;;;;;;;-1:-1:-1;;;;;129095:23:0;;;;;;:15;:23;;;;;;;;:206;;;;;;;;;;;;-1:-1:-1;;;129095:206:0;-1:-1:-1;;;;;129095:206:0;;;-1:-1:-1;;;;;;129095:206:0;;;;;;;;;;;;;;-1:-1:-1;128685:753:0;;-1:-1:-1;;;128685:753:0;;129323:15;;129319:119;;129375:51;129382:11;129375:51;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;129375:51:0;;;:6;:51::i;:::-;129355:71;;;;;;;-1:-1:-1;;;129355:71:0;-1:-1:-1;;;;;129355:71:0;;;;;;128276:1169;;;;;;:::o;132576:393::-;132648:4;132665:22;132705:28;:26;:28::i;:::-;132769:32;;;-1:-1:-1;;;132769:32:0;;132795:4;132769:32;;;;;;132665:69;;-1:-1:-1;132745:21:0;;-1:-1:-1;;;;;132769:17:0;;;;;:32;;;;;;;;;;;;;;:17;:32;;;5:2:-1;;;;30:1;27;20:12;5:2;132769:32:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;132769:32:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;132769:32:0;;-1:-1:-1;132816:10:0;;;;;:40;;;132840:16;132830:6;:26;;132816:40;132812:126;;;132873:7;-1:-1:-1;;;;;132873:16:0;;132890:4;132896:6;132873:30;;;;;;;;;;;;;-1:-1:-1;;;;;132873:30:0;-1:-1:-1;;;;;132873:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;132873:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;132873:30:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;132925:1:0;;-1:-1:-1;132918:8:0;;-1:-1:-1;;;132918:8:0;132812:126;132955:6;132948:13;;;;132576:393;;;;;:::o;133177:1088::-;-1:-1:-1;;;;;133300:33:0;;133270:27;133300:33;;;:16;:33;;;;;;133350:27;;133346:708;;133488:46;133526:6;133488:29;:46::i;:::-;133346:708;;;133556:20;;133552:502;;-1:-1:-1;;;;;133637:25:0;;;;;;:8;:25;;;;;;;;:33;;:25;:33;133629:71;;;;;-1:-1:-1;;;133629:71:0;;;;;;;;;;;;-1:-1:-1;;;133629:71:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;133721:32:0;;;;;;:15;:32;;;;;:38;-1:-1:-1;;;;;133721:38:0;:43;:90;;;;-1:-1:-1;;;;;;133768:32:0;;;;;;:15;:32;;;;;:38;-1:-1:-1;;;133768:38:0;;;;:43;133721:90;133717:326;;;133867:160;;;;;;;;121477:4;-1:-1:-1;;;;;133867:160:0;;;;;133951:56;133958:16;:14;:16::i;:::-;133951:56;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;133951:56:0;;;:6;:56::i;:::-;133867:160;;;;;;;-1:-1:-1;;;;;133832:32:0;;;;;;:15;:32;;;;;;;;:195;;;;;;;;;;;;-1:-1:-1;;;133832:195:0;-1:-1:-1;;;;;133832:195:0;;;-1:-1:-1;;;;;;133832:195:0;;;;;;;;;;;;;;133717:326;134096:15;134070:22;:41;134066:192;;-1:-1:-1;;;;;134128:33:0;;;;;;:16;:33;;;;;;;;;:51;;;134199:47;;;;;;;;;;;;;;;;;133177:1088;;;:::o;134468:1178::-;-1:-1:-1;;;;;134591:33:0;;134561:27;134591:33;;;:16;:33;;;;;;134641:27;;134637:798;;134779:22;;:::i;:::-;134804:37;;;;;;;;134819:6;-1:-1:-1;;;;;134819:18:0;;:20;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;134819:20:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;134819:20:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;134819:20:0;134804:37;;134779:62;-1:-1:-1;134856:59:0;134894:6;134779:62;134856:29;:59::i;:::-;134637:798;;;;134937:20;;134933:502;;-1:-1:-1;;;;;135018:25:0;;;;;;:8;:25;;;;;;;;:33;;:25;:33;135010:71;;;;;-1:-1:-1;;;135010:71:0;;;;;;;;;;;;-1:-1:-1;;;135010:71:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;135102:32:0;;;;;;:15;:32;;;;;:38;-1:-1:-1;;;;;135102:38:0;:43;:90;;;;-1:-1:-1;;;;;;135149:32:0;;;;;;:15;:32;;;;;:38;-1:-1:-1;;;135149:38:0;;;;:43;135102:90;135098:326;;;135248:160;;;;;;;;121477:4;-1:-1:-1;;;;;135248:160:0;;;;;135332:56;135339:16;:14;:16::i;135332:56::-;135248:160;;;;;;;-1:-1:-1;;;;;135213:32:0;;;;;;:15;:32;;;;;;;;:195;;;;;;;;;;;;-1:-1:-1;;;135213:195:0;-1:-1:-1;;;;;135213:195:0;;;-1:-1:-1;;;;;;135213:195:0;;;;;;;;;;;;;;135098:326;135477:15;135451:22;:41;135447:192;;-1:-1:-1;;;;;135509:33:0;;;;;;:16;:33;;;;;;;;;:51;;;135580:47;;;;;;;;;;;;;;;;;134468:1178;;;:::o;137448:270::-;137523:6;-1:-1:-1;;;;;137516:23:0;;:25;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;137516:25:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;137516:25:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;137601:10:0;27::-1;;39:1;23:18;;;45:23;;;137601:31:0;;;;-1:-1:-1;;;;;;137601:31:0;-1:-1:-1;;;;;137601:31:0;;;;;;;;-1:-1:-1;137643:16:0;;;:8;137516:25;137643:16;;;;;;;;:23;;-1:-1:-1;;137643:23:0;;;;;;;137682:28;;;;;;;;;;;;;;;;;137448:270;:::o;31488:120::-;31541:4;31565:35;31570:1;31573;31565:35;;;;;;;;;;;;;-1:-1:-1;;;31565:35:0;;;:4;:35::i;:::-;31558:42;31488:120;-1:-1:-1;;;31488:120:0:o;32686:122::-;32739:4;32763:37;32768:1;32771;32763:37;;;;;;;;;;;;;;;;;:4;:37::i;34284:147::-;34341:13;;:::i;:::-;34374:49;;;;;;;;34392:29;34397:20;34402:1;28122:4;34397;:20::i;:::-;34419:1;34392:4;:29::i;:::-;34374:49;;34367:56;34284:147;-1:-1:-1;;;34284:147:0:o;30685:160::-;30756:13;;:::i;:::-;30789:48;;;;;;;;30807:28;30812:1;:10;;;30824:1;:10;;;30807:4;:28::i;30187:165::-;30263:7;30303:12;-1:-1:-1;;;30291:10:0;;30283:33;;;;-1:-1:-1;;;30283:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;30283:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;30342:1:0;;30187:165;-1:-1:-1;;30187:165:0:o;30360:161::-;30435:6;30473:12;-1:-1:-1;;;30462:9:0;;30454:32;;;;-1:-1:-1;;;30454:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;31320:160:0;31391:13;;:::i;:::-;31424:48;;;;;;;;31442:28;31447:1;:10;;;31459:1;:10;;;31442:4;:28::i;33387:126::-;33446:4;33470:35;33475:17;33480:1;28083:4;33475;:17::i;:::-;33494:10;;33470:4;:35::i;32551:127::-;32613:4;28122;32637:19;32642:1;32645;:10;;;32637:4;:19::i;:::-;:33;;;;;;;32551:127;-1:-1:-1;;;32551:127:0:o;30853:116::-;30906:4;30930:31;30935:1;30938;30930:31;;;;;;;;;;;;;-1:-1:-1;;;30930:31:0;;;:4;:31::i;31616:158::-;31697:4;31730:12;31722:6;;;;31714:29;;;;-1:-1:-1;;;31714:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;31714:29:0;-1:-1:-1;;;31761:5:0;;;31616:158::o;32816:250::-;32897:4;32918:6;;;:16;;-1:-1:-1;32928:6:0;;32918:16;32914:57;;;-1:-1:-1;32958:1:0;32951:8;;32914:57;32990:5;;;32994:1;32990;:5;:1;33014:5;;;;;:10;33026:12;33006:33;;;;;-1:-1:-1;;;33006:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;33006:33:0;-1:-1:-1;33057:1:0;32816:250;-1:-1:-1;;;;32816:250:0:o;33998:113::-;34051:4;34075:28;34080:1;34083;34075:28;;;;;;;;;;;;;-1:-1:-1;;;34075:28:0;;;:4;:28::i;30977:179::-;31058:4;31084:5;;;31116:12;31108:6;;;;31100:29;;;;-1:-1:-1;;;31100:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;34119:157:0;34200:4;34232:12;34225:5;34217:28;;;;-1:-1:-1;;;34217:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;34217:28:0;;34267:1;34263;:5;;;;;;;34119:157;-1:-1:-1;;;;34119:157:0:o;121109:21545::-;;;;;;;;;;;;;;:::o
Swarm Source
bzzr://06012e5355b85d665b008c517d821407c7ac4c9051a966fe571725322ab4f6c2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 24 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
FTM | 100.00% | $0.00975 | 3,334.0899 | $32.51 |
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.