Contract Overview
Balance:
0 AVAX
AVAX Value:
$0.00
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Name:
Comptroller
Compiler Version
v0.5.17+commit.d19bba13
Contract Source Code (Solidity)
/** *Submitted for verification at snowtrace.io on 2021-11-02 */ // File: contracts/Governance/Qi.sol pragma solidity ^0.5.16; // pragma experimental ABIEncoderV2; contract Qi { /// @notice EIP-20 token name for this token string public constant name = "BENQI"; /// @notice EIP-20 token symbol for this token string public constant symbol = "QI"; /// @notice EIP-20 token decimals for this token uint8 public constant decimals = 18; /// @notice Total number of tokens in circulation uint public constant totalSupply = 7_200_000_000e18; // 7 billion 200 million QI /// @notice Allowance amounts on behalf of others mapping (address => mapping (address => uint96)) internal allowances; /// @notice Official record of token balances for each account mapping (address => uint96) internal balances; /// @notice A record of each accounts delegate mapping (address => address) public delegates; /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint96 votes; } /// @notice A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice The EIP-712 typehash for the permit struct used by the contract bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); /// @notice The standard EIP-20 transfer event event Transfer(address indexed from, address indexed to, uint256 amount); /// @notice The standard EIP-20 approval event event Approval(address indexed owner, address indexed spender, uint256 amount); /** * @notice Construct a new QI token * @param account The initial account to grant all the tokens */ constructor(address account) public { balances[account] = uint96(totalSupply); emit Transfer(address(0), account, totalSupply); } /** * @notice Get the number of tokens `spender` is approved to spend on behalf of `account` * @param account The address of the account holding the funds * @param spender The address of the account spending the funds * @return The number of tokens approved */ function allowance(address account, address spender) external view returns (uint) { return allowances[account][spender]; } /** * @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 rawAmount The number of tokens that are approved (2^256-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); } else { amount = safe96(rawAmount, "Qi::approve: amount exceeds 96 bits"); } allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /** * @notice Triggers an approval from owner to spends * @param owner The address to approve from * @param spender The address to be approved * @param rawAmount The number of tokens that are approved (2^256-1 means infinite) * @param deadline The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); } else { amount = safe96(rawAmount, "Qi::permit: amount exceeds 96 bits"); } bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "Qi::permit: invalid signature"); require(signatory == owner, "Qi::permit: unauthorized"); require(now <= deadline, "Qi::permit: signature expired"); allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @notice Get the number of tokens held by the `account` * @param account The address of the account to get the balance of * @return The number of tokens held */ function balanceOf(address account) external view returns (uint) { return balances[account]; } /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param rawAmount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint rawAmount) external returns (bool) { uint96 amount = safe96(rawAmount, "Qi::transfer: amount exceeds 96 bits"); _transferTokens(msg.sender, dst, amount); return true; } /** * @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 rawAmount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint rawAmount) external returns (bool) { address spender = msg.sender; uint96 spenderAllowance = allowances[src][spender]; uint96 amount = safe96(rawAmount, "Qi::approve: amount exceeds 96 bits"); if (spender != src && spenderAllowance != uint96(-1)) { uint96 newAllowance = sub96(spenderAllowance, amount, "Qi::transferFrom: transfer amount exceeds spender allowance"); allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "Qi::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "Qi::delegateBySig: invalid nonce"); require(now <= expiry, "Qi::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint96) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) public view returns (uint96) { require(blockNumber < block.number, "Qi::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates[delegator]; uint96 delegatorBalance = balances[delegator]; delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _transferTokens(address src, address dst, uint96 amount) internal { require(src != address(0), "Qi::_transferTokens: cannot transfer from the zero address"); require(dst != address(0), "Qi::_transferTokens: cannot transfer to the zero address"); balances[src] = sub96(balances[src], amount, "Qi::_transferTokens: transfer amount exceeds balance"); balances[dst] = add96(balances[dst], amount, "Qi::_transferTokens: transfer amount overflows"); emit Transfer(src, dst, amount); _moveDelegates(delegates[src], delegates[dst], amount); } function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint96 srcRepNew = sub96(srcRepOld, amount, "Qi::_moveVotes: vote amount underflows"); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint96 dstRepNew = add96(dstRepOld, amount, "Qi::_moveVotes: vote amount overflows"); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal { uint32 blockNumber = safe32(block.number, "Qi::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function safe96(uint n, string memory errorMessage) internal pure returns (uint96) { require(n < 2**96, errorMessage); return uint96(n); } function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) { uint96 c = a + b; require(c >= a, errorMessage); return c; } function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) { require(b <= a, errorMessage); return a - b; } function getChainId() internal pure returns (uint) { uint256 chainId; assembly { chainId := chainid() } return chainId; } } // File: contracts/ErrorReporter.sol pragma solidity 0.5.17; contract ComptrollerErrorReporter { enum Error { NO_ERROR, UNAUTHORIZED, COMPTROLLER_MISMATCH, INSUFFICIENT_SHORTFALL, INSUFFICIENT_LIQUIDITY, INVALID_CLOSE_FACTOR, INVALID_COLLATERAL_FACTOR, INVALID_LIQUIDATION_INCENTIVE, MARKET_NOT_ENTERED, // no longer possible MARKET_NOT_LISTED, MARKET_ALREADY_LISTED, MATH_ERROR, NONZERO_BORROW_BALANCE, PRICE_ERROR, REJECTION, SNAPSHOT_ERROR, TOO_MANY_ASSETS, TOO_MUCH_REPAY } enum FailureInfo { ACCEPT_ADMIN_PENDING_ADMIN_CHECK, ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK, EXIT_MARKET_BALANCE_OWED, EXIT_MARKET_REJECTION, SET_CLOSE_FACTOR_OWNER_CHECK, SET_CLOSE_FACTOR_VALIDATION, SET_COLLATERAL_FACTOR_OWNER_CHECK, SET_COLLATERAL_FACTOR_NO_EXISTS, SET_COLLATERAL_FACTOR_VALIDATION, SET_COLLATERAL_FACTOR_WITHOUT_PRICE, SET_IMPLEMENTATION_OWNER_CHECK, SET_LIQUIDATION_INCENTIVE_OWNER_CHECK, SET_LIQUIDATION_INCENTIVE_VALIDATION, SET_MAX_ASSETS_OWNER_CHECK, SET_PENDING_ADMIN_OWNER_CHECK, SET_PENDING_IMPLEMENTATION_OWNER_CHECK, SET_PRICE_ORACLE_OWNER_CHECK, SUPPORT_MARKET_EXISTS, SUPPORT_MARKET_OWNER_CHECK, SET_PAUSE_GUARDIAN_OWNER_CHECK } /** * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary * contract-specific code that enables us to report opaque error codes from upgradeable contracts. **/ event Failure(uint error, uint info, uint detail); /** * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator */ function fail(Error err, FailureInfo info) internal returns (uint) { emit Failure(uint(err), uint(info), 0); return uint(err); } /** * @dev use this when reporting an opaque error from an upgradeable collaborator contract */ function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) { emit Failure(uint(err), uint(info), opaqueError); return uint(err); } } contract TokenErrorReporter { enum Error { NO_ERROR, UNAUTHORIZED, BAD_INPUT, COMPTROLLER_REJECTION, COMPTROLLER_CALCULATION_ERROR, INTEREST_RATE_MODEL_ERROR, INVALID_ACCOUNT_PAIR, INVALID_CLOSE_AMOUNT_REQUESTED, INVALID_COLLATERAL_FACTOR, MATH_ERROR, MARKET_NOT_FRESH, MARKET_NOT_LISTED, TOKEN_INSUFFICIENT_ALLOWANCE, TOKEN_INSUFFICIENT_BALANCE, TOKEN_INSUFFICIENT_CASH, TOKEN_TRANSFER_IN_FAILED, TOKEN_TRANSFER_OUT_FAILED } /* * Note: FailureInfo (but not Error) is kept in alphabetical order * This is because FailureInfo grows significantly faster, and * the order of Error has some meaning, while the order of FailureInfo * is entirely arbitrary. */ enum FailureInfo { ACCEPT_ADMIN_PENDING_ADMIN_CHECK, ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED, ACCRUE_INTEREST_BORROW_RATE_CALCULATION_FAILED, ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED, ACCRUE_INTEREST_NEW_TOTAL_BORROWS_CALCULATION_FAILED, ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED, ACCRUE_INTEREST_SIMPLE_INTEREST_FACTOR_CALCULATION_FAILED, BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, BORROW_ACCRUE_INTEREST_FAILED, BORROW_CASH_NOT_AVAILABLE, BORROW_FRESHNESS_CHECK, BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED, BORROW_MARKET_NOT_LISTED, BORROW_COMPTROLLER_REJECTION, LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED, LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED, LIQUIDATE_COLLATERAL_FRESHNESS_CHECK, LIQUIDATE_COMPTROLLER_REJECTION, LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED, LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX, LIQUIDATE_CLOSE_AMOUNT_IS_ZERO, LIQUIDATE_FRESHNESS_CHECK, LIQUIDATE_LIQUIDATOR_IS_BORROWER, LIQUIDATE_REPAY_BORROW_FRESH_FAILED, LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER, LIQUIDATE_SEIZE_TOO_MUCH, MINT_ACCRUE_INTEREST_FAILED, MINT_COMPTROLLER_REJECTION, MINT_EXCHANGE_CALCULATION_FAILED, MINT_EXCHANGE_RATE_READ_FAILED, MINT_FRESHNESS_CHECK, MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, MINT_TRANSFER_IN_FAILED, MINT_TRANSFER_IN_NOT_POSSIBLE, REDEEM_ACCRUE_INTEREST_FAILED, REDEEM_COMPTROLLER_REJECTION, REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED, REDEEM_EXCHANGE_RATE_READ_FAILED, REDEEM_FRESHNESS_CHECK, REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, REDEEM_TRANSFER_OUT_NOT_POSSIBLE, REDUCE_RESERVES_ACCRUE_INTEREST_FAILED, REDUCE_RESERVES_ADMIN_CHECK, REDUCE_RESERVES_CASH_NOT_AVAILABLE, REDUCE_RESERVES_FRESH_CHECK, REDUCE_RESERVES_VALIDATION, REPAY_BEHALF_ACCRUE_INTEREST_FAILED, REPAY_BORROW_ACCRUE_INTEREST_FAILED, REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, REPAY_BORROW_COMPTROLLER_REJECTION, REPAY_BORROW_FRESHNESS_CHECK, REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED, REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED, REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE, SET_COLLATERAL_FACTOR_OWNER_CHECK, SET_COLLATERAL_FACTOR_VALIDATION, SET_COMPTROLLER_OWNER_CHECK, SET_INTEREST_RATE_MODEL_ACCRUE_INTEREST_FAILED, SET_INTEREST_RATE_MODEL_FRESH_CHECK, SET_INTEREST_RATE_MODEL_OWNER_CHECK, SET_MAX_ASSETS_OWNER_CHECK, SET_ORACLE_MARKET_NOT_LISTED, SET_PENDING_ADMIN_OWNER_CHECK, SET_RESERVE_FACTOR_ACCRUE_INTEREST_FAILED, SET_RESERVE_FACTOR_ADMIN_CHECK, SET_RESERVE_FACTOR_FRESH_CHECK, SET_RESERVE_FACTOR_BOUNDS_CHECK, TRANSFER_COMPTROLLER_REJECTION, TRANSFER_NOT_ALLOWED, TRANSFER_NOT_ENOUGH, TRANSFER_TOO_MUCH, ADD_RESERVES_ACCRUE_INTEREST_FAILED, ADD_RESERVES_FRESH_CHECK, ADD_RESERVES_TRANSFER_IN_NOT_POSSIBLE, SET_PROTOCOL_SEIZE_SHARE_ACCRUE_INTEREST_FAILED, SET_PROTOCOL_SEIZE_SHARE_OWNER_CHECK, SET_PROTOCOL_SEIZE_SHARE_FRESH_CHECK } /** * @dev `error` corresponds to enum Error; `info` corresponds to enum FailureInfo, and `detail` is an arbitrary * contract-specific code that enables us to report opaque error codes from upgradeable contracts. **/ event Failure(uint error, uint info, uint detail); /** * @dev use this when reporting a known error from the money market or a non-upgradeable collaborator */ function fail(Error err, FailureInfo info) internal returns (uint) { emit Failure(uint(err), uint(info), 0); return uint(err); } /** * @dev use this when reporting an opaque error from an upgradeable collaborator contract */ function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) { emit Failure(uint(err), uint(info), opaqueError); return uint(err); } } // File: contracts/ComptrollerStorage.sol pragma solidity 0.5.17; contract UnitrollerAdminStorage { /** * @notice Administrator for this contract */ address public admin; /** * @notice Pending administrator for this contract */ address public pendingAdmin; /** * @notice Active brains of Unitroller */ address public comptrollerImplementation; /** * @notice Pending brains of Unitroller */ address public pendingComptrollerImplementation; } contract ComptrollerVXStorage is UnitrollerAdminStorage { /** * @notice Oracle which gives the price of any given asset */ PriceOracle public oracle; /** * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow */ uint public closeFactorMantissa; /** * @notice Multiplier representing the discount on collateral that a liquidator receives */ uint public liquidationIncentiveMantissa; /** * @notice Max number of assets a single account can participate in (borrow or use as collateral) */ uint public maxAssets; /** * @notice Per-account mapping of "assets you are in", capped by maxAssets */ mapping(address => QiToken[]) public accountAssets; struct Market { /// @notice Whether or not this market is listed bool isListed; /** * @notice Multiplier representing the most one can borrow against their collateral in this market. * For instance, 0.9 to allow borrowing 90% of collateral value. * Must be between 0 and 1, and stored as a mantissa. */ uint collateralFactorMantissa; /// @notice Per-market mapping of "accounts in this asset" mapping(address => bool) accountMembership; /// @notice Whether or not this market receives BENQI bool isQied; } /** * @notice Official mapping of qiTokens -> Market metadata * @dev Used e.g. to determine if a market is supported */ mapping(address => Market) public markets; /** * @notice The Pause Guardian can pause certain actions as a safety mechanism. * Actions which allow users to remove their own assets cannot be paused. * Liquidation / seizing / transfer can only be paused globally, not by market. */ address public pauseGuardian; bool public _mintGuardianPaused; bool public _borrowGuardianPaused; bool public transferGuardianPaused; bool public seizeGuardianPaused; mapping(address => bool) public mintGuardianPaused; mapping(address => bool) public borrowGuardianPaused; /// @notice A list of all markets QiToken[] public allMarkets; // @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market. address public borrowCapGuardian; // @notice Borrow caps enforced by borrowAllowed for each qiToken address. Defaults to zero which corresponds to unlimited borrowing. mapping(address => uint) public borrowCaps; struct RewardMarketState { /// @notice The market's last updated rewardBorrowIndex or rewardSupplyIndex uint224 index; /// @notice The block timestamp the index was last updated at uint32 timestamp; } /// @notice The rate at which the flywheel distributes reward, per timestamp mapping(uint8 => uint) rewardRate; /// @notice The portion of reward rate that each market currently receives mapping(uint8 => mapping(address => uint)) public rewardSpeeds; /// @notice The QI/AVAX market supply state for each market mapping(uint8 => mapping(address => RewardMarketState)) public rewardSupplyState; /// @notice The QI/AVAX market borrow state for each market mapping(uint8 =>mapping(address => RewardMarketState)) public rewardBorrowState; /// @notice The QI/AVAX borrow index for each market for each supplier as of the last time they accrued reward mapping(uint8 => mapping(address => mapping(address => uint))) public rewardSupplierIndex; /// @notice The QI/AVAX borrow index for each market for each borrower as of the last time they accrued reward mapping(uint8 => mapping(address => mapping(address => uint))) public rewardBorrowerIndex; /// @notice The QI/AVAX accrued but not yet transferred to each user mapping(uint8 => mapping(address => uint)) public rewardAccrued; /// @notice QI token contract address address public qiAddress; } // File: contracts/Unitroller.sol pragma solidity 0.5.17; /** * @title ComptrollerCore * @dev Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`. * QiTokens should reference this contract as their comptroller. */ contract Unitroller is UnitrollerAdminStorage, ComptrollerErrorReporter { /** * @notice Emitted when pendingComptrollerImplementation is changed */ event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation); /** * @notice Emitted when pendingComptrollerImplementation is accepted, which means comptroller implementation is updated */ event NewImplementation(address oldImplementation, address newImplementation); /** * @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); constructor() public { // Set admin to caller admin = msg.sender; } /*** Admin Functions ***/ function _setPendingImplementation(address newPendingImplementation) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK); } address oldPendingImplementation = pendingComptrollerImplementation; pendingComptrollerImplementation = newPendingImplementation; emit NewPendingImplementation(oldPendingImplementation, pendingComptrollerImplementation); return uint(Error.NO_ERROR); } /** * @notice Accepts new implementation of comptroller. msg.sender must be pendingImplementation * @dev Admin function for new implementation to accept it's role as implementation * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _acceptImplementation() public returns (uint) { // Check caller is pendingImplementation and pendingImplementation ≠ address(0) if (msg.sender != pendingComptrollerImplementation || pendingComptrollerImplementation == address(0)) { return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK); } // Save current values for inclusion in log address oldImplementation = comptrollerImplementation; address oldPendingImplementation = pendingComptrollerImplementation; comptrollerImplementation = pendingComptrollerImplementation; pendingComptrollerImplementation = address(0); emit NewImplementation(oldImplementation, comptrollerImplementation); emit NewPendingImplementation(oldPendingImplementation, pendingComptrollerImplementation); return uint(Error.NO_ERROR); } /** * @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 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() public 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); } /** * @dev Delegates execution to an implementation contract. * It returns to the external caller whatever the implementation returns * or forwards reverts. */ function () payable external { // delegate all other functions to current implementation (bool success, ) = comptrollerImplementation.delegatecall(msg.data); assembly { let free_mem_ptr := mload(0x40) returndatacopy(free_mem_ptr, 0, returndatasize) switch success case 0 { revert(free_mem_ptr, returndatasize) } default { return(free_mem_ptr, returndatasize) } } } } // File: contracts/PriceOracle.sol pragma solidity 0.5.17; contract PriceOracle { /// @notice Indicator that this is a PriceOracle contract (for inspection) bool public constant isPriceOracle = true; /** * @notice Get the underlying price of a qiToken asset * @param qiToken The qiToken to get the underlying price of * @return The underlying asset price mantissa (scaled by 1e18). * Zero means the price is unavailable. */ function getUnderlyingPrice(QiToken qiToken) external view returns (uint); } // File: contracts/EIP20Interface.sol pragma solidity 0.5.17; /** * @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); } // File: contracts/ExponentialNoError.sol pragma solidity 0.5.17; /** * @title Exponential module for storing fixed-precision decimals * @author Benqi * @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)}); } } // File: contracts/CarefulMath.sol pragma solidity 0.5.17; /** * @title Careful Math * @author Benqi * @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); } } // File: contracts/Exponential.sol pragma solidity 0.5.17; /** * @title Exponential module for storing fixed-precision decimals * @author Benqi * @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); } } // File: contracts/EIP20NonStandardInterface.sol pragma solidity 0.5.17; /** * @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); } // File: contracts/InterestRateModel.sol pragma solidity 0.5.17; /** * @title Benqi's InterestRateModel Interface * @author Benqi */ 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 timestmp * @param cash The total amount of cash the market has * @param borrows The total amount of borrows the market has outstanding * @param reserves The total amount of reserves the market has * @return The borrow rate per timestmp (as a percentage, and scaled by 1e18) */ function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint); /** * @notice Calculates the current supply interest rate per timestmp * @param cash The total amount of cash the market has * @param borrows The total amount of borrows the market has outstanding * @param reserves The total amount of reserves the market has * @param reserveFactorMantissa The current reserve factor the market has * @return The supply rate per timestmp (as a percentage, and scaled by 1e18) */ function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint); } // File: contracts/QiTokenInterfaces.sol pragma solidity 0.5.17; contract QiTokenStorage { /** * @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 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 = 1e18; /** * @notice Administrator for this contract */ address payable public admin; /** * @notice Pending administrator for this contract */ address payable public pendingAdmin; /** * @notice Contract which oversees inter-qiToken operations */ ComptrollerInterface public comptroller; /** * @notice Model which tells what the current interest rate should be */ InterestRateModel public interestRateModel; /** * @notice Initial exchange rate used when minting the first QiTokens (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 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; /** * @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; /** * @notice Share of seized collateral that is added to reserves */ uint public protocolSeizeShareMantissa; } contract QiTokenInterface is QiTokenStorage { /** * @notice Indicator that this is a QiToken contract (for inspection) */ bool public constant isQiToken = true; /*** 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 qiTokenCollateral, 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 protocol seize share is changed */ event NewProtocolSeizeShare(uint oldProtocolSeizeShareMantissa, uint newProtocolSeizeShareMantissa); /** * @notice Event emitted when the reserves are added */ event ReservesAdded(address benefactor, uint addAmount, uint newTotalReserves); /** * @notice Event emitted when the reserves are reduced */ event ReservesReduced(address admin, uint reduceAmount, uint newTotalReserves); /** * @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 borrowRatePerTimestamp() external view returns (uint); function supplyRatePerTimestamp() external view returns (uint); function totalBorrowsCurrent() external returns (uint); function borrowBalanceCurrent(address account) external returns (uint); function borrowBalanceStored(address account) public view returns (uint); function exchangeRateCurrent() public returns (uint); function exchangeRateStored() public view returns (uint); function getCash() 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 _setComptroller(ComptrollerInterface newComptroller) public returns (uint); function _setReserveFactor(uint newReserveFactorMantissa) external returns (uint); function _reduceReserves(uint reduceAmount) external returns (uint); function _setInterestRateModel(InterestRateModel newInterestRateModel) public returns (uint); function _setProtocolSeizeShare(uint newProtocolSeizeShareMantissa) external returns (uint); } contract QiErc20Storage { /** * @notice Underlying asset for this QiToken */ address public underlying; } contract QiErc20Interface is QiErc20Storage { /*** 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, QiTokenInterface qiTokenCollateral) external returns (uint); function sweepToken(EIP20NonStandardInterface token) external; /*** Admin Functions ***/ function _addReserves(uint addAmount) external returns (uint); } contract QiDelegationStorage { /** * @notice Implementation address for this contract */ address public implementation; } contract QiDelegatorInterface is QiDelegationStorage { /** * @notice Emitted when implementation is changed */ event NewImplementation(address oldImplementation, address newImplementation); /** * @notice Called by the admin to update the implementation of the delegator * @param implementation_ The address of the new implementation for delegation * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation */ function _setImplementation(address implementation_, bool allowResign, bytes memory becomeImplementationData) public; } contract QiDelegateInterface is QiDelegationStorage { /** * @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; } // File: contracts/ComptrollerInterface.sol pragma solidity 0.5.17; contract ComptrollerInterface { /// @notice Indicator that this is a Comptroller contract (for inspection) bool public constant isComptroller = true; /*** Assets You Are In ***/ function enterMarkets(address[] calldata qiTokens) external returns (uint[] memory); function exitMarket(address qiToken) external returns (uint); /*** Policy Hooks ***/ function mintAllowed(address qiToken, address minter, uint mintAmount) external returns (uint); function mintVerify(address qiToken, address minter, uint mintAmount, uint mintTokens) external; function redeemAllowed(address qiToken, address redeemer, uint redeemTokens) external returns (uint); function redeemVerify(address qiToken, address redeemer, uint redeemAmount, uint redeemTokens) external; function borrowAllowed(address qiToken, address borrower, uint borrowAmount) external returns (uint); function borrowVerify(address qiToken, address borrower, uint borrowAmount) external; function repayBorrowAllowed( address qiToken, address payer, address borrower, uint repayAmount) external returns (uint); function repayBorrowVerify( address qiToken, address payer, address borrower, uint repayAmount, uint borrowerIndex) external; function liquidateBorrowAllowed( address qiTokenBorrowed, address qiTokenCollateral, address liquidator, address borrower, uint repayAmount) external returns (uint); function liquidateBorrowVerify( address qiTokenBorrowed, address qiTokenCollateral, address liquidator, address borrower, uint repayAmount, uint seizeTokens) external; function seizeAllowed( address qiTokenCollateral, address qiTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external returns (uint); function seizeVerify( address qiTokenCollateral, address qiTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external; function transferAllowed(address qiToken, address src, address dst, uint transferTokens) external returns (uint); function transferVerify(address qiToken, address src, address dst, uint transferTokens) external; /*** Liquidity/Liquidation Calculations ***/ function liquidateCalculateSeizeTokens( address qiTokenBorrowed, address qiTokenCollateral, uint repayAmount) external view returns (uint, uint); } // File: contracts/QiToken.sol pragma solidity 0.5.17; /** * @title Benqi's QiToken Contract * @notice Abstract base for QiTokens * @author Benqi */ contract QiToken is QiTokenInterface, 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(accrualBlockTimestamp == 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 timestamp and borrow index (block timestamp mocks depend on comptroller being set) accrualBlockTimestamp = getBlockTimestamp(); borrowIndex = mantissaOne; // Set the interest rate model (depends on block timestamp / 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 srqiTokensNew; uint dstTokensNew; (mathErr, allowanceNew) = subUInt(startingAllowance, tokens); if (mathErr != MathError.NO_ERROR) { return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED); } (mathErr, srqiTokensNew) = 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] = srqiTokensNew; 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 qiTokenBalance = 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), qiTokenBalance, borrowBalance, exchangeRateMantissa); } /** * @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-timestamp borrow interest rate for this qiToken * @return The borrow interest rate per timestmp, scaled by 1e18 */ function borrowRatePerTimestamp() external view returns (uint) { return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves); } /** * @notice Returns the current per-timestamp supply interest rate for this qiToken * @return The supply interest rate per timestmp, scaled by 1e18 */ function supplyRatePerTimestamp() 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 QiToken * @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 QiToken * @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 qiToken in the underlying asset * @return The quantity of underlying asset owned by this contract */ function getCash() external view returns (uint) { return getCashPrior(); } /** * @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 timestamp */ uint currentBlockTimestamp = getBlockTimestamp(); uint accrualBlockTimestampPrior = accrualBlockTimestamp; /* Short-circuit accumulating 0 interest */ if (accrualBlockTimestampPrior == currentBlockTimestamp) { return uint(Error.NO_ERROR); } /* 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 number of blocks elapsed since the last accrual */ (MathError mathErr, uint blockDelta) = subUInt(currentBlockTimestamp, accrualBlockTimestampPrior); require(mathErr == MathError.NO_ERROR, "could not calculate block delta"); /* * Calculate the interest accumulated into borrows and reserves and the new index: * simpleInterestFactor = borrowRate * blockDelta * 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}), blockDelta); 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 */ 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 qiTokens 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 qiTokens 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 timestamp equals current block timestamp */ if (accrualBlockTimestamp != getBlockTimestamp()) { 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 qiToken must handle variations between ERC-20 and AVAX 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 qiToken holds an additional `actualMintAmount` * of cash. */ vars.actualMintAmount = doTransferIn(minter, mintAmount); /* * We get the current exchange rate and calculate the number of qiTokens 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 qiTokens 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 qiTokens in exchange for the underlying asset * @dev Accrues interest whether or not the operation succeeds, unless reverted * @param redeemTokens The number of qiTokens 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 qiTokens 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 qiTokens * @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 qiTokens 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 qiTokens 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 qiTokens (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 */ if (redeemTokensIn == uint(-1)) { vars.redeemTokens = accountTokens[redeemer]; } else { vars.redeemTokens = redeemTokensIn; } (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), vars.redeemTokens); 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 */ if (redeemAmountIn == uint(-1)) { vars.redeemTokens = accountTokens[redeemer]; (vars.mathErr, vars.redeemAmount) = mulScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), vars.redeemTokens); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint(vars.mathErr)); } } else { vars.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)); } } } /* 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 timestamp equals current block timestamp */ if (accrualBlockTimestamp != getBlockTimestamp()) { 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 qiToken must handle variations between ERC-20 and AVAX underlying. * On success, the qiToken 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 timestamp equals current block timestamp */ if (accrualBlockTimestamp != getBlockTimestamp()) { 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 qiToken must handle variations between ERC-20 and AVAX underlying. * On success, the qiToken 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 timestamp equals current block timestamp */ if (accrualBlockTimestamp != getBlockTimestamp()) { 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 qiToken must handle variations between ERC-20 and AVAX underlying. * On success, the qiToken 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 qiToken to be liquidated * @param qiTokenCollateral 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, QiTokenInterface qiTokenCollateral) 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 = qiTokenCollateral.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, qiTokenCollateral); } /** * @notice The liquidator liquidates the borrowers collateral. * The collateral seized is transferred to the liquidator. * @param borrower The borrower of this qiToken to be liquidated * @param liquidator The address repaying the borrow and seizing collateral * @param qiTokenCollateral 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, QiTokenInterface qiTokenCollateral) internal returns (uint, uint) { /* Fail if liquidate not allowed */ uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(qiTokenCollateral), liquidator, borrower, repayAmount); if (allowed != 0) { return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0); } /* Verify market's block timestamp equals current block timestamp */ if (accrualBlockTimestamp != getBlockTimestamp()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0); } /* Verify qiTokenCollateral market's block timestamp equals current block timestamp */ if (qiTokenCollateral.accrualBlockTimestamp() != getBlockTimestamp()) { 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(qiTokenCollateral), actualRepayAmount); require(amountSeizeError == uint(Error.NO_ERROR), "LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED"); /* Revert if borrower collateral token balance < seizeTokens */ require(qiTokenCollateral.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(qiTokenCollateral) == address(this)) { seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens); } else { seizeError = qiTokenCollateral.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(qiTokenCollateral), seizeTokens); /* We call the defense hook */ // unused function // comptroller.liquidateBorrowVerify(address(this), address(qiTokenCollateral), 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 qiToken during the process of liquidation. * Its absolutely critical to use msg.sender as the borrowed qiToken and not a parameter. * @param liquidator The account receiving seized collateral * @param borrower The account having collateral seized * @param seizeTokens The number of qiTokens 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); } struct SeizeInternalLocalVars { MathError mathErr; uint borrowerTokensNew; uint liquidatorTokensNew; uint liquidatorSeizeTokens; uint protocolSeizeTokens; uint protocolSeizeAmount; uint exchangeRateMantissa; uint totalReservesNew; uint totalSupplyNew; } /** * @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 QiToken. * Its absolutely critical to use msg.sender as the seizer qiToken and not a parameter. * @param seizerToken The contract seizing the collateral (i.e. borrowed qiToken) * @param liquidator The account receiving seized collateral * @param borrower The account having collateral seized * @param seizeTokens The number of qiTokens 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); } SeizeInternalLocalVars memory vars; /* * We calculate the new borrower and liquidator token balances, failing on underflow/overflow: * borrowerTokensNew = accountTokens[borrower] - seizeTokens * liquidatorTokensNew = accountTokens[liquidator] + seizeTokens */ (vars.mathErr, vars.borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(vars.mathErr)); } vars.protocolSeizeTokens = mul_(seizeTokens, Exp({mantissa: protocolSeizeShareMantissa})); vars.liquidatorSeizeTokens = sub_(seizeTokens, vars.protocolSeizeTokens); (vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal(); require(vars.mathErr == MathError.NO_ERROR, "exchange rate math error"); vars.protocolSeizeAmount = mul_ScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), vars.protocolSeizeTokens); vars.totalReservesNew = add_(totalReserves, vars.protocolSeizeAmount); vars.totalSupplyNew = sub_(totalSupply, vars.protocolSeizeTokens); (vars.mathErr, vars.liquidatorTokensNew) = addUInt(accountTokens[liquidator], vars.liquidatorSeizeTokens); if (vars.mathErr != MathError.NO_ERROR) { return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(vars.mathErr)); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* We write the previously calculated values into storage */ totalReserves = vars.totalReservesNew; totalSupply = vars.totalSupplyNew; accountTokens[borrower] = vars.borrowerTokensNew; accountTokens[liquidator] = vars.liquidatorTokensNew; /* Emit a Transfer event */ emit Transfer(borrower, liquidator, vars.liquidatorSeizeTokens); emit Transfer(borrower, address(this), vars.protocolSeizeTokens); emit ReservesAdded(address(this), vars.protocolSeizeAmount, vars.totalReservesNew); /* 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); } /** * @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) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK); } 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 timestamp equals current block timestamp if (accrualBlockTimestamp != getBlockTimestamp()) { 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); } uint oldReserveFactorMantissa = reserveFactorMantissa; reserveFactorMantissa = newReserveFactorMantissa; emit NewReserveFactor(oldReserveFactorMantissa, newReserveFactorMantissa); return uint(Error.NO_ERROR); } /** * @notice Accrues interest and reduces reserves by transferring from msg.sender * @param addAmount Amount of addition to reserves * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _addReservesInternal(uint addAmount) internal 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.ADD_RESERVES_ACCRUE_INTEREST_FAILED); } // _addReservesFresh emits reserve-addition-specific logs on errors, so we don't need to. (error, ) = _addReservesFresh(addAmount); return error; } /** * @notice Add reserves by transferring from caller * @dev Requires fresh interest accrual * @param addAmount Amount of addition to reserves * @return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees */ function _addReservesFresh(uint addAmount) internal returns (uint, uint) { // totalReserves + actualAddAmount uint totalReservesNew; uint actualAddAmount; // We fail gracefully unless market's block timestamp equals current block timestamp if (accrualBlockTimestamp != getBlockTimestamp()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.ADD_RESERVES_FRESH_CHECK), actualAddAmount); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) /* * We call doTransferIn for the caller and the addAmount * Note: The qiToken must handle variations between ERC-20 and AVAX underlying. * On success, the qiToken holds an additional addAmount 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. */ actualAddAmount = doTransferIn(msg.sender, addAmount); totalReservesNew = totalReserves + actualAddAmount; /* Revert on overflow */ require(totalReservesNew >= totalReserves, "add reserves unexpected overflow"); // Store reserves[n+1] = reserves[n] + actualAddAmount totalReserves = totalReservesNew; /* Emit NewReserves(admin, actualAddAmount, reserves[n+1]) */ emit ReservesAdded(msg.sender, actualAddAmount, totalReservesNew); /* Return (NO_ERROR, actualAddAmount) */ return (uint(Error.NO_ERROR), actualAddAmount); } /** * @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 admin * @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; // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.REDUCE_RESERVES_ADMIN_CHECK); } // We fail gracefully unless market's block timestamp equals current block timestamp if (accrualBlockTimestamp != getBlockTimestamp()) { 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); } ///////////////////////// // EFFECTS & INTERACTIONS // (No safe failures beyond this point) 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; // doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred. doTransferOut(admin, reduceAmount); emit ReservesReduced(admin, reduceAmount, 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 timestamp equals current block timestamp if (accrualBlockTimestamp != getBlockTimestamp()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK); } // 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); } /** * @notice accrues interest and updates the protocol seize share using _setProtocolSeizeShareFresh * @dev Admin function to accrue interest and update the protocol seize share * @param newProtocolSeizeShareMantissa the new protocol seize share to use * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setProtocolSeizeShare(uint newProtocolSeizeShareMantissa) 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 change of protocol seize share failed return fail(Error(error), FailureInfo.SET_PROTOCOL_SEIZE_SHARE_ACCRUE_INTEREST_FAILED); } // _setProtocolSeizeShareFresh emits protocol-seize-share-update-specific logs on errors, so we don't need to. return _setProtocolSeizeShareFresh(newProtocolSeizeShareMantissa); } /** * @notice updates the protocol seize share (*requires fresh interest accrual) * @dev Admin function to update the protocol seize share * @param newProtocolSeizeShareMantissa the new protocol seize share to use * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setProtocolSeizeShareFresh(uint newProtocolSeizeShareMantissa) internal returns (uint) { // Used to store old share for use in the event that is emitted on success uint oldProtocolSeizeShareMantissa; // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PROTOCOL_SEIZE_SHARE_OWNER_CHECK); } // We fail gracefully unless market's block timestamp equals current block timestamp if (accrualBlockTimestamp != getBlockTimestamp()) { return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_PROTOCOL_SEIZE_SHARE_FRESH_CHECK); } // Track the market's current protocol seize share oldProtocolSeizeShareMantissa = protocolSeizeShareMantissa; // Set the protocol seize share to newProtocolSeizeShareMantissa protocolSeizeShareMantissa = newProtocolSeizeShareMantissa; // Emit NewProtocolSeizeShareMantissa(oldProtocolSeizeShareMantissa, newProtocolSeizeShareMantissa) emit NewProtocolSeizeShare(oldProtocolSeizeShareMantissa, newProtocolSeizeShareMantissa); 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; /*** 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 } } // File: contracts/Comptroller.sol pragma solidity 0.5.17; /** * @title Benqi's Comptroller Contract * @author Benqi */ contract Comptroller is ComptrollerVXStorage, ComptrollerInterface, ComptrollerErrorReporter, ExponentialNoError { /// @notice Emitted when an admin supports a market event MarketListed(QiToken qiToken); /// @notice Emitted when an account enters a market event MarketEntered(QiToken qiToken, address account); /// @notice Emitted when an account exits a market event MarketExited(QiToken qiToken, address account); /// @notice Emitted when close factor is changed by admin event NewCloseFactor(uint oldCloseFactorMantissa, uint newCloseFactorMantissa); /// @notice Emitted when a collateral factor is changed by admin event NewCollateralFactor(QiToken qiToken, uint oldCollateralFactorMantissa, uint newCollateralFactorMantissa); /// @notice Emitted when liquidation incentive is changed by admin event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa); /// @notice Emitted when price oracle is changed event NewPriceOracle(PriceOracle oldPriceOracle, PriceOracle newPriceOracle); /// @notice Emitted when pause guardian is changed event NewPauseGuardian(address oldPauseGuardian, address newPauseGuardian); /// @notice Emitted when an action is paused globally event ActionPaused(string action, bool pauseState); /// @notice Emitted when an action is paused on a market event ActionPaused(QiToken qiToken, string action, bool pauseState); /// @notice Emitted when a new BENQI or AVAX speed is calculated for a market event SpeedUpdated(uint8 tokenType, QiToken indexed qiToken, uint newSpeed); /// @notice Emitted when a new BENQI speed is set for a contributor event ContributorQiSpeedUpdated(address indexed contributor, uint newSpeed); /// @notice Emitted when BENQI or AVAX is distributed to a borrower event DistributedBorrowerReward(uint8 indexed tokenType, QiToken indexed qiToken, address indexed borrower, uint qiDelta, uint qiBorrowIndex); /// @notice Emitted when BENQI or AVAX is distributed to a supplier event DistributedSupplierReward(uint8 indexed tokenType, QiToken indexed qiToken, address indexed borrower, uint qiDelta, uint qiBorrowIndex); /// @notice Emitted when borrow cap for a qiToken is changed event NewBorrowCap(QiToken indexed qiToken, uint newBorrowCap); /// @notice Emitted when borrow cap guardian is changed event NewBorrowCapGuardian(address oldBorrowCapGuardian, address newBorrowCapGuardian); /// @notice Emitted when BENQI is granted by admin event QiGranted(address recipient, uint amount); /// @notice The initial BENQI and AVAX index for a market uint224 public constant initialIndexConstant = 1e36; // closeFactorMantissa must be strictly greater than this value uint internal constant closeFactorMinMantissa = 0.05e18; // 0.05 // closeFactorMantissa must not exceed this value uint internal constant closeFactorMaxMantissa = 0.9e18; // 0.9 // No collateralFactorMantissa may exceed this value uint internal constant collateralFactorMaxMantissa = 0.9e18; // 0.9 // reward token type to show BENQI or AVAX uint8 public constant rewardQi = 0; uint8 public constant rewardAvax = 1; constructor() public { admin = msg.sender; } /*** Assets You Are In ***/ /** * @notice Returns the assets an account has entered * @param account The address of the account to pull assets for * @return A dynamic list with the assets the account has entered */ function getAssetsIn(address account) external view returns (QiToken[] memory) { QiToken[] memory assetsIn = accountAssets[account]; return assetsIn; } /** * @notice Returns whether the given account is entered in the given asset * @param account The address of the account to check * @param qiToken The qiToken to check * @return True if the account is in the asset, otherwise false. */ function checkMembership(address account, QiToken qiToken) external view returns (bool) { return markets[address(qiToken)].accountMembership[account]; } /** * @notice Add assets to be included in account liquidity calculation * @param qiTokens The list of addresses of the qiToken markets to be enabled * @return Success indicator for whether each corresponding market was entered */ function enterMarkets(address[] memory qiTokens) public returns (uint[] memory) { uint len = qiTokens.length; uint[] memory results = new uint[](len); for (uint i = 0; i < len; i++) { QiToken qiToken = QiToken(qiTokens[i]); results[i] = uint(addToMarketInternal(qiToken, msg.sender)); } return results; } /** * @notice Add the market to the borrower's "assets in" for liquidity calculations * @param qiToken The market to enter * @param borrower The address of the account to modify * @return Success indicator for whether the market was entered */ function addToMarketInternal(QiToken qiToken, address borrower) internal returns (Error) { Market storage marketToJoin = markets[address(qiToken)]; if (!marketToJoin.isListed) { // market is not listed, cannot join return Error.MARKET_NOT_LISTED; } if (marketToJoin.accountMembership[borrower] == true) { // already joined return Error.NO_ERROR; } // survived the gauntlet, add to list // NOTE: we store these somewhat redundantly as a significant optimization // this avoids having to iterate through the list for the most common use cases // that is, only when we need to perform liquidity checks // and not whenever we want to check if an account is in a particular market marketToJoin.accountMembership[borrower] = true; accountAssets[borrower].push(qiToken); emit MarketEntered(qiToken, borrower); return Error.NO_ERROR; } /** * @notice Removes asset from sender's account liquidity calculation * @dev Sender must not have an outstanding borrow balance in the asset, * or be providing necessary collateral for an outstanding borrow. * @param qiTokenAddress The address of the asset to be removed * @return Whether or not the account successfully exited the market */ function exitMarket(address qiTokenAddress) external returns (uint) { QiToken qiToken = QiToken(qiTokenAddress); /* Get sender tokensHeld and amountOwed underlying from the qiToken */ (uint oErr, uint tokensHeld, uint amountOwed, ) = qiToken.getAccountSnapshot(msg.sender); require(oErr == 0, "exitMarket: getAccountSnapshot failed"); // semi-opaque error code /* Fail if the sender has a borrow balance */ if (amountOwed != 0) { return fail(Error.NONZERO_BORROW_BALANCE, FailureInfo.EXIT_MARKET_BALANCE_OWED); } /* Fail if the sender is not permitted to redeem all of their tokens */ uint allowed = redeemAllowedInternal(qiTokenAddress, msg.sender, tokensHeld); if (allowed != 0) { return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed); } Market storage marketToExit = markets[address(qiToken)]; /* Return true if the sender is not already ‘in’ the market */ if (!marketToExit.accountMembership[msg.sender]) { return uint(Error.NO_ERROR); } /* Set qiToken account membership to false */ delete marketToExit.accountMembership[msg.sender]; /* Delete qiToken from the account’s list of assets */ // load into memory for faster iteration QiToken[] memory userAssetList = accountAssets[msg.sender]; uint len = userAssetList.length; uint assetIndex = len; for (uint i = 0; i < len; i++) { if (userAssetList[i] == qiToken) { assetIndex = i; break; } } // We *must* have found the asset in the list or our redundant data structure is broken assert(assetIndex < len); // copy last item in list to location of item to be removed, reduce length by 1 QiToken[] storage storedList = accountAssets[msg.sender]; storedList[assetIndex] = storedList[storedList.length - 1]; storedList.length--; emit MarketExited(qiToken, msg.sender); return uint(Error.NO_ERROR); } /*** Policy Hooks ***/ /** * @notice Checks if the account should be allowed to mint tokens in the given market * @param qiToken The market to verify the mint against * @param minter The account which would get the minted tokens * @param mintAmount The amount of underlying being supplied to the market in exchange for tokens * @return 0 if the mint is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function mintAllowed(address qiToken, address minter, uint mintAmount) external returns (uint) { // Pausing is a very serious situation - we revert to sound the alarms require(!mintGuardianPaused[qiToken], "mint is paused"); // Shh - currently unused mintAmount; if (!markets[qiToken].isListed) { return uint(Error.MARKET_NOT_LISTED); } // Keep the flywheel moving updateAndDistributeSupplierRewardsForToken(qiToken, minter); return uint(Error.NO_ERROR); } /** * @notice Validates mint and reverts on rejection. May emit logs. * @param qiToken Asset being minted * @param minter The address minting the tokens * @param actualMintAmount The amount of the underlying asset being minted * @param mintTokens The number of tokens being minted */ function mintVerify(address qiToken, address minter, uint actualMintAmount, uint mintTokens) external { // Shh - currently unused qiToken; minter; actualMintAmount; mintTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the account should be allowed to redeem tokens in the given market * @param qiToken The market to verify the redeem against * @param redeemer The account which would redeem the tokens * @param redeemTokens The number of qiTokens to exchange for the underlying asset in the market * @return 0 if the redeem is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function redeemAllowed(address qiToken, address redeemer, uint redeemTokens) external returns (uint) { uint allowed = redeemAllowedInternal(qiToken, redeemer, redeemTokens); if (allowed != uint(Error.NO_ERROR)) { return allowed; } // Keep the flywheel moving updateAndDistributeSupplierRewardsForToken(qiToken, redeemer); return uint(Error.NO_ERROR); } function redeemAllowedInternal(address qiToken, address redeemer, uint redeemTokens) internal view returns (uint) { if (!markets[qiToken].isListed) { return uint(Error.MARKET_NOT_LISTED); } /* If the redeemer is not 'in' the market, then we can bypass the liquidity check */ if (!markets[qiToken].accountMembership[redeemer]) { return uint(Error.NO_ERROR); } /* Otherwise, perform a hypothetical liquidity check to guard against shortfall */ (Error err, , uint shortfall) = getHypotheticalAccountLiquidityInternal(redeemer, QiToken(qiToken), redeemTokens, 0); if (err != Error.NO_ERROR) { return uint(err); } if (shortfall > 0) { return uint(Error.INSUFFICIENT_LIQUIDITY); } return uint(Error.NO_ERROR); } /** * @notice Validates redeem and reverts on rejection. May emit logs. * @param qiToken Asset being redeemed * @param redeemer The address redeeming the tokens * @param redeemAmount The amount of the underlying asset being redeemed * @param redeemTokens The number of tokens being redeemed */ function redeemVerify(address qiToken, address redeemer, uint redeemAmount, uint redeemTokens) external { // Shh - currently unused qiToken; redeemer; // Require tokens is zero or amount is also zero if (redeemTokens == 0 && redeemAmount > 0) { revert("redeemTokens zero"); } } /** * @notice Checks if the account should be allowed to borrow the underlying asset of the given market * @param qiToken The market to verify the borrow against * @param borrower The account which would borrow the asset * @param borrowAmount The amount of underlying the account would borrow * @return 0 if the borrow is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function borrowAllowed(address qiToken, address borrower, uint borrowAmount) external returns (uint) { // Pausing is a very serious situation - we revert to sound the alarms require(!borrowGuardianPaused[qiToken], "borrow is paused"); if (!markets[qiToken].isListed) { return uint(Error.MARKET_NOT_LISTED); } if (!markets[qiToken].accountMembership[borrower]) { // only qiTokens may call borrowAllowed if borrower not in market require(msg.sender == qiToken, "sender must be qiToken"); // attempt to add borrower to the market Error err = addToMarketInternal(QiToken(msg.sender), borrower); if (err != Error.NO_ERROR) { return uint(err); } // it should be impossible to break the important invariant assert(markets[qiToken].accountMembership[borrower]); } if (oracle.getUnderlyingPrice(QiToken(qiToken)) == 0) { return uint(Error.PRICE_ERROR); } uint borrowCap = borrowCaps[qiToken]; // Borrow cap of 0 corresponds to unlimited borrowing if (borrowCap != 0) { uint totalBorrows = QiToken(qiToken).totalBorrows(); uint nextTotalBorrows = add_(totalBorrows, borrowAmount); require(nextTotalBorrows < borrowCap, "market borrow cap reached"); } (Error err, , uint shortfall) = getHypotheticalAccountLiquidityInternal(borrower, QiToken(qiToken), 0, borrowAmount); if (err != Error.NO_ERROR) { return uint(err); } if (shortfall > 0) { return uint(Error.INSUFFICIENT_LIQUIDITY); } // Keep the flywheel moving Exp memory borrowIndex = Exp({mantissa: QiToken(qiToken).borrowIndex()}); updateAndDistributeBorrowerRewardsForToken(qiToken, borrower, borrowIndex); return uint(Error.NO_ERROR); } /** * @notice Validates borrow and reverts on rejection. May emit logs. * @param qiToken Asset whose underlying is being borrowed * @param borrower The address borrowing the underlying * @param borrowAmount The amount of the underlying asset requested to borrow */ function borrowVerify(address qiToken, address borrower, uint borrowAmount) external { // Shh - currently unused qiToken; borrower; borrowAmount; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the account should be allowed to repay a borrow in the given market * @param qiToken The market to verify the repay against * @param payer The account which would repay the asset * @param borrower The account which would borrowed the asset * @param repayAmount The amount of the underlying asset the account would repay * @return 0 if the repay is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function repayBorrowAllowed( address qiToken, address payer, address borrower, uint repayAmount) external returns (uint) { // Shh - currently unused payer; borrower; repayAmount; if (!markets[qiToken].isListed) { return uint(Error.MARKET_NOT_LISTED); } // Keep the flywheel moving Exp memory borrowIndex = Exp({mantissa: QiToken(qiToken).borrowIndex()}); updateAndDistributeBorrowerRewardsForToken(qiToken, borrower, borrowIndex); return uint(Error.NO_ERROR); } /** * @notice Validates repayBorrow and reverts on rejection. May emit logs. * @param qiToken Asset being repaid * @param payer The address repaying the borrow * @param borrower The address of the borrower * @param actualRepayAmount The amount of underlying being repaid */ function repayBorrowVerify( address qiToken, address payer, address borrower, uint actualRepayAmount, uint borrowerIndex) external { // Shh - currently unused qiToken; payer; borrower; actualRepayAmount; borrowerIndex; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the liquidation should be allowed to occur * @param qiTokenBorrowed Asset which was borrowed by the borrower * @param qiTokenCollateral Asset which was used as collateral and will be seized * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param repayAmount The amount of underlying being repaid */ function liquidateBorrowAllowed( address qiTokenBorrowed, address qiTokenCollateral, address liquidator, address borrower, uint repayAmount) external returns (uint) { // Shh - currently unused liquidator; if (!markets[qiTokenBorrowed].isListed || !markets[qiTokenCollateral].isListed) { return uint(Error.MARKET_NOT_LISTED); } /* The borrower must have shortfall in order to be liquidatable */ (Error err, , uint shortfall) = getAccountLiquidityInternal(borrower); if (err != Error.NO_ERROR) { return uint(err); } if (shortfall == 0) { return uint(Error.INSUFFICIENT_SHORTFALL); } /* The liquidator may not repay more than what is allowed by the closeFactor */ uint borrowBalance = QiToken(qiTokenBorrowed).borrowBalanceStored(borrower); uint maxClose = mul_ScalarTruncate(Exp({mantissa: closeFactorMantissa}), borrowBalance); if (repayAmount > maxClose) { return uint(Error.TOO_MUCH_REPAY); } return uint(Error.NO_ERROR); } /** * @notice Validates liquidateBorrow and reverts on rejection. May emit logs. * @param qiTokenBorrowed Asset which was borrowed by the borrower * @param qiTokenCollateral Asset which was used as collateral and will be seized * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param actualRepayAmount The amount of underlying being repaid */ function liquidateBorrowVerify( address qiTokenBorrowed, address qiTokenCollateral, address liquidator, address borrower, uint actualRepayAmount, uint seizeTokens) external { // Shh - currently unused qiTokenBorrowed; qiTokenCollateral; liquidator; borrower; actualRepayAmount; seizeTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the seizing of assets should be allowed to occur * @param qiTokenCollateral Asset which was used as collateral and will be seized * @param qiTokenBorrowed Asset which was borrowed by the borrower * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param seizeTokens The number of collateral tokens to seize */ function seizeAllowed( address qiTokenCollateral, address qiTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external returns (uint) { // Pausing is a very serious situation - we revert to sound the alarms require(!seizeGuardianPaused, "seize is paused"); // Shh - currently unused seizeTokens; if (!markets[qiTokenCollateral].isListed || !markets[qiTokenBorrowed].isListed) { return uint(Error.MARKET_NOT_LISTED); } if (QiToken(qiTokenCollateral).comptroller() != QiToken(qiTokenBorrowed).comptroller()) { return uint(Error.COMPTROLLER_MISMATCH); } // Keep the flywheel moving updateAndDistributeSupplierRewardsForToken(qiTokenCollateral, borrower); updateAndDistributeSupplierRewardsForToken(qiTokenCollateral, liquidator); return uint(Error.NO_ERROR); } /** * @notice Validates seize and reverts on rejection. May emit logs. * @param qiTokenCollateral Asset which was used as collateral and will be seized * @param qiTokenBorrowed Asset which was borrowed by the borrower * @param liquidator The address repaying the borrow and seizing the collateral * @param borrower The address of the borrower * @param seizeTokens The number of collateral tokens to seize */ function seizeVerify( address qiTokenCollateral, address qiTokenBorrowed, address liquidator, address borrower, uint seizeTokens) external { // Shh - currently unused qiTokenCollateral; qiTokenBorrowed; liquidator; borrower; seizeTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /** * @notice Checks if the account should be allowed to transfer tokens in the given market * @param qiToken The market to verify the transfer against * @param src The account which sources the tokens * @param dst The account which receives the tokens * @param transferTokens The number of qiTokens to transfer * @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol) */ function transferAllowed(address qiToken, address src, address dst, uint transferTokens) external returns (uint) { // Pausing is a very serious situation - we revert to sound the alarms require(!transferGuardianPaused, "transfer is paused"); // Currently the only consideration is whether or not // the src is allowed to redeem this many tokens uint allowed = redeemAllowedInternal(qiToken, src, transferTokens); if (allowed != uint(Error.NO_ERROR)) { return allowed; } // Keep the flywheel moving updateAndDistributeSupplierRewardsForToken(qiToken, src); updateAndDistributeSupplierRewardsForToken(qiToken, dst); return uint(Error.NO_ERROR); } /** * @notice Validates transfer and reverts on rejection. May emit logs. * @param qiToken Asset being transferred * @param src The account which sources the tokens * @param dst The account which receives the tokens * @param transferTokens The number of qiTokens to transfer */ function transferVerify(address qiToken, address src, address dst, uint transferTokens) external { // Shh - currently unused qiToken; src; dst; transferTokens; // Shh - we don't ever want this hook to be marked pure if (false) { maxAssets = maxAssets; } } /*** Liquidity/Liquidation Calculations ***/ /** * @dev Local vars for avoiding stack-depth limits in calculating account liquidity. * Note that `qiTokenBalance` is the number of qiTokens the account owns in the market, * whereas `borrowBalance` is the amount of underlying that the account has borrowed. */ struct AccountLiquidityLocalVars { uint sumCollateral; uint sumBorrowPlusEffects; uint qiTokenBalance; uint borrowBalance; uint exchangeRateMantissa; uint oraclePriceMantissa; Exp collateralFactor; Exp exchangeRate; Exp oraclePrice; Exp tokensToDenom; } /** * @notice Determine the current account liquidity wrt collateral requirements * @return (possible error code (semi-opaque), account liquidity in excess of collateral requirements, * account shortfall below collateral requirements) */ function getAccountLiquidity(address account) public view returns (uint, uint, uint) { (Error err, uint liquidity, uint shortfall) = getHypotheticalAccountLiquidityInternal(account, QiToken(0), 0, 0); return (uint(err), liquidity, shortfall); } /** * @notice Determine the current account liquidity wrt collateral requirements * @return (possible error code, account liquidity in excess of collateral requirements, * account shortfall below collateral requirements) */ function getAccountLiquidityInternal(address account) internal view returns (Error, uint, uint) { return getHypotheticalAccountLiquidityInternal(account, QiToken(0), 0, 0); } /** * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed * @param qiTokenModify The market to hypothetically redeem/borrow in * @param account The account to determine liquidity for * @param redeemTokens The number of tokens to hypothetically redeem * @param borrowAmount The amount of underlying to hypothetically borrow * @return (possible error code (semi-opaque), hypothetical account liquidity in excess of collateral requirements, * hypothetical account shortfall below collateral requirements) */ function getHypotheticalAccountLiquidity( address account, address qiTokenModify, uint redeemTokens, uint borrowAmount) public view returns (uint, uint, uint) { (Error err, uint liquidity, uint shortfall) = getHypotheticalAccountLiquidityInternal(account, QiToken(qiTokenModify), redeemTokens, borrowAmount); return (uint(err), liquidity, shortfall); } /** * @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed * @param qiTokenModify The market to hypothetically redeem/borrow in * @param account The account to determine liquidity for * @param redeemTokens The number of tokens to hypothetically redeem * @param borrowAmount The amount of underlying to hypothetically borrow * @dev Note that we calculate the exchangeRateStored for each collateral qiToken using stored data, * without calculating accumulated interest. * @return (possible error code, hypothetical account liquidity in excess of collateral requirements, * hypothetical account shortfall below collateral requirements) */ function getHypotheticalAccountLiquidityInternal( address account, QiToken qiTokenModify, uint redeemTokens, uint borrowAmount) internal view returns (Error, uint, uint) { AccountLiquidityLocalVars memory vars; // Holds all our calculation results uint oErr; // For each asset the account is in QiToken[] memory assets = accountAssets[account]; for (uint i = 0; i < assets.length; i++) { QiToken asset = assets[i]; // Read the balances and exchange rate from the qiToken (oErr, vars.qiTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = asset.getAccountSnapshot(account); if (oErr != 0) { // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades return (Error.SNAPSHOT_ERROR, 0, 0); } vars.collateralFactor = Exp({mantissa: markets[address(asset)].collateralFactorMantissa}); vars.exchangeRate = Exp({mantissa: vars.exchangeRateMantissa}); // Get the normalized price of the asset vars.oraclePriceMantissa = oracle.getUnderlyingPrice(asset); if (vars.oraclePriceMantissa == 0) { return (Error.PRICE_ERROR, 0, 0); } vars.oraclePrice = Exp({mantissa: vars.oraclePriceMantissa}); // Pre-compute a conversion factor from tokens -> avax (normalized price value) vars.tokensToDenom = mul_(mul_(vars.collateralFactor, vars.exchangeRate), vars.oraclePrice); // sumCollateral += tokensToDenom * qiTokenBalance vars.sumCollateral = mul_ScalarTruncateAddUInt(vars.tokensToDenom, vars.qiTokenBalance, vars.sumCollateral); // sumBorrowPlusEffects += oraclePrice * borrowBalance vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects); // Calculate effects of interacting with qiTokenModify if (asset == qiTokenModify) { // redeem effect // sumBorrowPlusEffects += tokensToDenom * redeemTokens vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.tokensToDenom, redeemTokens, vars.sumBorrowPlusEffects); // borrow effect // sumBorrowPlusEffects += oraclePrice * borrowAmount vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.oraclePrice, borrowAmount, vars.sumBorrowPlusEffects); } } // These are safe, as the underflow condition is checked first if (vars.sumCollateral > vars.sumBorrowPlusEffects) { return (Error.NO_ERROR, vars.sumCollateral - vars.sumBorrowPlusEffects, 0); } else { return (Error.NO_ERROR, 0, vars.sumBorrowPlusEffects - vars.sumCollateral); } } /** * @notice Calculate number of tokens of collateral asset to seize given an underlying amount * @dev Used in liquidation (called in qiToken.liquidateBorrowFresh) * @param qiTokenBorrowed The address of the borrowed qiToken * @param qiTokenCollateral The address of the collateral qiToken * @param actualRepayAmount The amount of qiTokenBorrowed underlying to convert into qiTokenCollateral tokens * @return (errorCode, number of qiTokenCollateral tokens to be seized in a liquidation) */ function liquidateCalculateSeizeTokens(address qiTokenBorrowed, address qiTokenCollateral, uint actualRepayAmount) external view returns (uint, uint) { /* Read oracle prices for borrowed and collateral markets */ uint priceBorrowedMantissa = oracle.getUnderlyingPrice(QiToken(qiTokenBorrowed)); uint priceCollateralMantissa = oracle.getUnderlyingPrice(QiToken(qiTokenCollateral)); if (priceBorrowedMantissa == 0 || priceCollateralMantissa == 0) { return (uint(Error.PRICE_ERROR), 0); } /* * Get the exchange rate and calculate the number of collateral tokens to seize: * seizeAmount = actualRepayAmount * liquidationIncentive * priceBorrowed / priceCollateral * seizeTokens = seizeAmount / exchangeRate * = actualRepayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate) */ uint exchangeRateMantissa = QiToken(qiTokenCollateral).exchangeRateStored(); // Note: reverts on error uint seizeTokens; Exp memory numerator; Exp memory denominator; Exp memory ratio; numerator = mul_(Exp({mantissa: liquidationIncentiveMantissa}), Exp({mantissa: priceBorrowedMantissa})); denominator = mul_(Exp({mantissa: priceCollateralMantissa}), Exp({mantissa: exchangeRateMantissa})); ratio = div_(numerator, denominator); seizeTokens = mul_ScalarTruncate(ratio, actualRepayAmount); return (uint(Error.NO_ERROR), seizeTokens); } /*** Admin Functions ***/ /** * @notice Sets a new price oracle for the comptroller * @dev Admin function to set a new price oracle * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) */ function _setPriceOracle(PriceOracle newOracle) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the comptroller PriceOracle oldOracle = oracle; // Set comptroller's oracle to newOracle oracle = newOracle; // Emit NewPriceOracle(oldOracle, newOracle) emit NewPriceOracle(oldOracle, newOracle); return uint(Error.NO_ERROR); } /** * @notice Sets the closeFactor used when liquidating borrows * @dev Admin function to set closeFactor * @param newCloseFactorMantissa New close factor, scaled by 1e18 * @return uint 0=success, otherwise a failure */ function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint(Error.NO_ERROR); } /** * @notice Sets the collateralFactor for a market * @dev Admin function to set per-market collateralFactor * @param qiToken The market to set the factor on * @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18 * @return uint 0=success, otherwise a failure. (See ErrorReporter for details) */ function _setCollateralFactor(QiToken qiToken, uint newCollateralFactorMantissa) external returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK); } // Verify market is listed Market storage market = markets[address(qiToken)]; if (!market.isListed) { return fail(Error.MARKET_NOT_LISTED, FailureInfo.SET_COLLATERAL_FACTOR_NO_EXISTS); } Exp memory newCollateralFactorExp = Exp({mantissa: newCollateralFactorMantissa}); // Check collateral factor <= 0.9 Exp memory highLimit = Exp({mantissa: collateralFactorMaxMantissa}); if (lessThanExp(highLimit, newCollateralFactorExp)) { return fail(Error.INVALID_COLLATERAL_FACTOR, FailureInfo.SET_COLLATERAL_FACTOR_VALIDATION); } // If collateral factor != 0, fail if price == 0 if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(qiToken) == 0) { return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE); } // Set market's collateral factor to new collateral factor, remember old value uint oldCollateralFactorMantissa = market.collateralFactorMantissa; market.collateralFactorMantissa = newCollateralFactorMantissa; // Emit event with asset, old collateral factor, and new collateral factor emit NewCollateralFactor(qiToken, oldCollateralFactorMantissa, newCollateralFactorMantissa); return uint(Error.NO_ERROR); } /** * @notice Sets liquidationIncentive * @dev Admin function to set liquidationIncentive * @param newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18 * @return uint 0=success, otherwise a failure. (See ErrorReporter for details) */ function _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK); } // Save current value for use in log uint oldLiquidationIncentiveMantissa = liquidationIncentiveMantissa; // Set liquidation incentive to new incentive liquidationIncentiveMantissa = newLiquidationIncentiveMantissa; // Emit event with old incentive, new incentive emit NewLiquidationIncentive(oldLiquidationIncentiveMantissa, newLiquidationIncentiveMantissa); return uint(Error.NO_ERROR); } /** * @notice Add the market to the markets mapping and set it as listed * @dev Admin function to set isListed and add support for the market * @param qiToken The address of the market (token) to list * @return uint 0=success, otherwise a failure. (See enum Error for details) */ function _supportMarket(QiToken qiToken) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK); } if (markets[address(qiToken)].isListed) { return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS); } qiToken.isQiToken(); // Sanity check to make sure its really a QiToken // Note that isQied is not in active use anymore markets[address(qiToken)] = Market({isListed: true, isQied: false, collateralFactorMantissa: 0}); _addMarketInternal(address(qiToken)); emit MarketListed(qiToken); return uint(Error.NO_ERROR); } function _addMarketInternal(address qiToken) internal { for (uint i = 0; i < allMarkets.length; i ++) { require(allMarkets[i] != QiToken(qiToken), "market already added"); } allMarkets.push(QiToken(qiToken)); } /** * @notice Set the given borrow caps for the given qiToken markets. Borrowing that brings total borrows to or above borrow cap will revert. * @dev Admin or borrowCapGuardian function to set the borrow caps. A borrow cap of 0 corresponds to unlimited borrowing. * @param qiTokens The addresses of the markets (tokens) to change the borrow caps for * @param newBorrowCaps The new borrow cap values in underlying to be set. A value of 0 corresponds to unlimited borrowing. */ function _setMarketBorrowCaps(QiToken[] calldata qiTokens, uint[] calldata newBorrowCaps) external { require(msg.sender == admin || msg.sender == borrowCapGuardian, "only admin or borrow cap guardian can set borrow caps"); uint numMarkets = qiTokens.length; uint numBorrowCaps = newBorrowCaps.length; require(numMarkets != 0 && numMarkets == numBorrowCaps, "invalid input"); for(uint i = 0; i < numMarkets; i++) { borrowCaps[address(qiTokens[i])] = newBorrowCaps[i]; emit NewBorrowCap(qiTokens[i], newBorrowCaps[i]); } } /** * @notice Admin function to change the Borrow Cap Guardian * @param newBorrowCapGuardian The address of the new Borrow Cap Guardian */ function _setBorrowCapGuardian(address newBorrowCapGuardian) external { require(msg.sender == admin, "only admin can set borrow cap guardian"); // Save current value for inclusion in log address oldBorrowCapGuardian = borrowCapGuardian; // Store borrowCapGuardian with value newBorrowCapGuardian borrowCapGuardian = newBorrowCapGuardian; // Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian) emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian); } /** * @notice Admin function to change the Pause Guardian * @param newPauseGuardian The address of the new Pause Guardian * @return uint 0=success, otherwise a failure. (See enum Error for details) */ function _setPauseGuardian(address newPauseGuardian) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSE_GUARDIAN_OWNER_CHECK); } // Save current value for inclusion in log address oldPauseGuardian = pauseGuardian; // Store pauseGuardian with value newPauseGuardian pauseGuardian = newPauseGuardian; // Emit NewPauseGuardian(OldPauseGuardian, NewPauseGuardian) emit NewPauseGuardian(oldPauseGuardian, pauseGuardian); return uint(Error.NO_ERROR); } function _setMintPaused(QiToken qiToken, bool state) public returns (bool) { require(markets[address(qiToken)].isListed, "cannot pause a market that is not listed"); require(msg.sender == pauseGuardian || msg.sender == admin, "only pause guardian and admin can pause"); require(msg.sender == admin || state == true, "only admin can unpause"); mintGuardianPaused[address(qiToken)] = state; emit ActionPaused(qiToken, "Mint", state); return state; } function _setBorrowPaused(QiToken qiToken, bool state) public returns (bool) { require(markets[address(qiToken)].isListed, "cannot pause a market that is not listed"); require(msg.sender == pauseGuardian || msg.sender == admin, "only pause guardian and admin can pause"); require(msg.sender == admin || state == true, "only admin can unpause"); borrowGuardianPaused[address(qiToken)] = state; emit ActionPaused(qiToken, "Borrow", state); return state; } function _setTransferPaused(bool state) public returns (bool) { require(msg.sender == pauseGuardian || msg.sender == admin, "only pause guardian and admin can pause"); require(msg.sender == admin || state == true, "only admin can unpause"); transferGuardianPaused = state; emit ActionPaused("Transfer", state); return state; } function _setSeizePaused(bool state) public returns (bool) { require(msg.sender == pauseGuardian || msg.sender == admin, "only pause guardian and admin can pause"); require(msg.sender == admin || state == true, "only admin can unpause"); seizeGuardianPaused = state; emit ActionPaused("Seize", state); return state; } function _become(Unitroller unitroller) public { require(msg.sender == unitroller.admin(), "only unitroller admin can change brains"); require(unitroller._acceptImplementation() == 0, "change not authorized"); } /** * @notice Checks caller is admin, or this contract is becoming the new implementation */ function adminOrInitializing() internal view returns (bool) { return msg.sender == admin || msg.sender == comptrollerImplementation; } /*** Benqi Distribution ***/ /** * @notice Set BENQI/AVAX speed for a single market * @param rewardType 0: Qi, 1: Avax * @param qiToken The market whose BENQI speed to update * @param newSpeed New BENQI or AVAX speed for market */ function setRewardSpeedInternal(uint8 rewardType, QiToken qiToken, uint newSpeed) internal { uint currentRewardSpeed = rewardSpeeds[rewardType][address(qiToken)]; if (currentRewardSpeed != 0) { // note that BENQI speed could be set to 0 to halt liquidity rewards for a market Exp memory borrowIndex = Exp({mantissa: qiToken.borrowIndex()}); updateRewardSupplyIndex(rewardType,address(qiToken)); updateRewardBorrowIndex(rewardType,address(qiToken), borrowIndex); } else if (newSpeed != 0) { // Add the BENQI market Market storage market = markets[address(qiToken)]; require(market.isListed == true, "benqi market is not listed"); if (rewardSupplyState[rewardType][address(qiToken)].index == 0 && rewardSupplyState[rewardType][address(qiToken)].timestamp == 0) { rewardSupplyState[rewardType][address(qiToken)] = RewardMarketState({ index: initialIndexConstant, timestamp: safe32(getBlockTimestamp(), "block timestamp exceeds 32 bits") }); } if (rewardBorrowState[rewardType][address(qiToken)].index == 0 && rewardBorrowState[rewardType][address(qiToken)].timestamp == 0) { rewardBorrowState[rewardType][address(qiToken)] = RewardMarketState({ index: initialIndexConstant, timestamp: safe32(getBlockTimestamp(), "block timestamp exceeds 32 bits") }); } } if (currentRewardSpeed != newSpeed) { rewardSpeeds[rewardType][address(qiToken)] = newSpeed; emit SpeedUpdated(rewardType, qiToken, newSpeed); } } /** * @notice Accrue BENQI to the market by updating the supply index * @param rewardType 0: Qi, 1: Avax * @param qiToken The market whose supply index to update */ function updateRewardSupplyIndex(uint8 rewardType, address qiToken) internal { require(rewardType <= 1, "rewardType is invalid"); RewardMarketState storage supplyState = rewardSupplyState[rewardType][qiToken]; uint supplySpeed = rewardSpeeds[rewardType][qiToken]; uint blockTimestamp = getBlockTimestamp(); uint deltaTimestamps = sub_(blockTimestamp, uint(supplyState.timestamp)); if (deltaTimestamps > 0 && supplySpeed > 0) { uint supplyTokens = QiToken(qiToken).totalSupply(); uint qiAccrued = mul_(deltaTimestamps, supplySpeed); Double memory ratio = supplyTokens > 0 ? fraction(qiAccrued, supplyTokens) : Double({mantissa: 0}); Double memory index = add_(Double({mantissa: supplyState.index}), ratio); rewardSupplyState[rewardType][qiToken] = RewardMarketState({ index: safe224(index.mantissa, "new index exceeds 224 bits"), timestamp: safe32(blockTimestamp, "block timestamp exceeds 32 bits") }); } else if (deltaTimestamps > 0) { supplyState.timestamp = safe32(blockTimestamp, "block timestamp exceeds 32 bits"); } } /** * @notice Accrue BENQI to the market by updating the borrow index * @param rewardType 0: Qi, 1: Avax * @param qiToken The market whose borrow index to update */ function updateRewardBorrowIndex(uint8 rewardType, address qiToken, Exp memory marketBorrowIndex) internal { require(rewardType <= 1, "rewardType is invalid"); RewardMarketState storage borrowState = rewardBorrowState[rewardType][qiToken]; uint borrowSpeed = rewardSpeeds[rewardType][qiToken]; uint blockTimestamp = getBlockTimestamp(); uint deltaTimestamps = sub_(blockTimestamp, uint(borrowState.timestamp)); if (deltaTimestamps > 0 && borrowSpeed > 0) { uint borrowAmount = div_(QiToken(qiToken).totalBorrows(), marketBorrowIndex); uint qiAccrued = mul_(deltaTimestamps, borrowSpeed); Double memory ratio = borrowAmount > 0 ? fraction(qiAccrued, borrowAmount) : Double({mantissa: 0}); Double memory index = add_(Double({mantissa: borrowState.index}), ratio); rewardBorrowState[rewardType][qiToken] = RewardMarketState({ index: safe224(index.mantissa, "new index exceeds 224 bits"), timestamp: safe32(blockTimestamp, "block timestamp exceeds 32 bits") }); } else if (deltaTimestamps > 0) { borrowState.timestamp = safe32(blockTimestamp, "block timestamp exceeds 32 bits"); } } /** * @notice Refactored function to calc and rewards accounts supplier rewards * @param qiToken The market to verify the mint against * @param account The acount to whom BENQI or AVAX is rewarded */ function updateAndDistributeSupplierRewardsForToken(address qiToken, address account) internal { for (uint8 rewardType = 0; rewardType <= 1; rewardType++) { updateRewardSupplyIndex(rewardType, qiToken); distributeSupplierReward(rewardType, qiToken, account); } } /** * @notice Calculate BENQI/AVAX accrued by a supplier and possibly transfer it to them * @param rewardType 0: Qi, 1: Avax * @param qiToken The market in which the supplier is interacting * @param supplier The address of the supplier to distribute BENQI to */ function distributeSupplierReward(uint8 rewardType, address qiToken, address supplier) internal { require(rewardType <= 1, "rewardType is invalid"); RewardMarketState storage supplyState = rewardSupplyState[rewardType][qiToken]; Double memory supplyIndex = Double({mantissa: supplyState.index}); Double memory supplierIndex = Double({mantissa: rewardSupplierIndex[rewardType][qiToken][supplier]}); rewardSupplierIndex[rewardType][qiToken][supplier] = supplyIndex.mantissa; if (supplierIndex.mantissa == 0 && supplyIndex.mantissa > 0) { supplierIndex.mantissa = initialIndexConstant; } Double memory deltaIndex = sub_(supplyIndex, supplierIndex); uint supplierTokens = QiToken(qiToken).balanceOf(supplier); uint supplierDelta = mul_(supplierTokens, deltaIndex); uint supplierAccrued = add_(rewardAccrued[rewardType][supplier], supplierDelta); rewardAccrued[rewardType][supplier] = supplierAccrued; emit DistributedSupplierReward(rewardType, QiToken(qiToken), supplier, supplierDelta, supplyIndex.mantissa); } /** * @notice Refactored function to calc and rewards accounts supplier rewards * @param qiToken The market to verify the mint against * @param borrower Borrower to be rewarded */ function updateAndDistributeBorrowerRewardsForToken(address qiToken, address borrower, Exp memory marketBorrowIndex) internal { for (uint8 rewardType = 0; rewardType <= 1; rewardType++) { updateRewardBorrowIndex(rewardType, qiToken, marketBorrowIndex); distributeBorrowerReward(rewardType, qiToken, borrower, marketBorrowIndex); } } /** * @notice Calculate BENQI 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 rewardType 0: Qi, 1: Avax * @param qiToken The market in which the borrower is interacting * @param borrower The address of the borrower to distribute BENQI to */ function distributeBorrowerReward(uint8 rewardType, address qiToken, address borrower, Exp memory marketBorrowIndex) internal { require(rewardType <= 1, "rewardType is invalid"); RewardMarketState storage borrowState = rewardBorrowState [rewardType][qiToken]; Double memory borrowIndex = Double({mantissa: borrowState.index}); Double memory borrowerIndex = Double({mantissa: rewardBorrowerIndex[rewardType][qiToken][borrower]}); rewardBorrowerIndex[rewardType][qiToken][borrower] = borrowIndex.mantissa; if (borrowerIndex.mantissa > 0) { Double memory deltaIndex = sub_(borrowIndex, borrowerIndex); uint borrowerAmount = div_(QiToken(qiToken).borrowBalanceStored(borrower), marketBorrowIndex); uint borrowerDelta = mul_(borrowerAmount, deltaIndex); uint borrowerAccrued = add_(rewardAccrued[rewardType][borrower], borrowerDelta); rewardAccrued[rewardType][borrower] = borrowerAccrued; emit DistributedBorrowerReward(rewardType, QiToken(qiToken), borrower, borrowerDelta, borrowIndex.mantissa); } } /** * @notice Claim all the benqi accrued by holder in all markets * @param holder The address to claim BENQI for */ function claimReward(uint8 rewardType, address payable holder) public { return claimReward(rewardType,holder, allMarkets); } /** * @notice Claim all the benqi accrued by holder in the specified markets * @param holder The address to claim BENQI for * @param qiTokens The list of markets to claim BENQI in */ function claimReward(uint8 rewardType, address payable holder, QiToken[] memory qiTokens) public { address payable [] memory holders = new address payable[](1); holders[0] = holder; claimReward(rewardType, holders, qiTokens, true, true); } /** * @notice Claim all Benqi or Avax accrued by the holders * @param rewardType 0 means Qi 1 means Avax * @param holders The addresses to claim AVAX for * @param qiTokens The list of markets to claim AVAX in * @param borrowers Whether or not to claim AVAX earned by borrowing * @param suppliers Whether or not to claim AVAX earned by supplying */ function claimReward(uint8 rewardType, address payable[] memory holders, QiToken[] memory qiTokens, bool borrowers, bool suppliers) public payable { require(rewardType <= 1, "rewardType is invalid"); for (uint i = 0; i < qiTokens.length; i++) { QiToken qiToken = qiTokens[i]; require(markets[address(qiToken)].isListed, "market must be listed"); if (borrowers == true) { Exp memory borrowIndex = Exp({mantissa: qiToken.borrowIndex()}); updateRewardBorrowIndex(rewardType,address(qiToken), borrowIndex); for (uint j = 0; j < holders.length; j++) { distributeBorrowerReward(rewardType,address(qiToken), holders[j], borrowIndex); rewardAccrued[rewardType][holders[j]] = grantRewardInternal(rewardType, holders[j], rewardAccrued[rewardType][holders[j]]); } } if (suppliers == true) { updateRewardSupplyIndex(rewardType,address(qiToken)); for (uint j = 0; j < holders.length; j++) { distributeSupplierReward(rewardType,address(qiToken), holders[j]); rewardAccrued[rewardType][holders[j]] = grantRewardInternal(rewardType, holders[j], rewardAccrued[rewardType][holders[j]]); } } } } /** * @notice Transfer QI/AVAX to the user * @dev Note: If there is not enough BENQI/AVAX, we do not perform the transfer all. * @param user The address of the user to transfer AVAX to * @param amount The amount of AVAX to (possibly) transfer * @return The amount of AVAX which was NOT transferred to the user */ function grantRewardInternal(uint rewardType, address payable user, uint amount) internal returns (uint) { if (rewardType == 0) { Qi benqi = Qi(qiAddress); uint qiRemaining = benqi.balanceOf(address(this)); if (amount > 0 && amount <= qiRemaining) { benqi.transfer(user, amount); return 0; } } else if (rewardType == 1) { uint avaxRemaining = address(this).balance; if (amount > 0 && amount <= avaxRemaining) { user.transfer(amount); return 0; } } return amount; } /*** Benqi Distribution Admin ***/ /** * @notice Transfer BENQI to the recipient * @dev Note: If there is not enough BENQI, we do not perform the transfer all. * @param recipient The address of the recipient to transfer BENQI to * @param amount The amount of BENQI to (possibly) transfer */ function _grantQi(address payable recipient, uint amount) public { require(adminOrInitializing(), "only admin can grant benqi"); uint amountLeft = grantRewardInternal(0, recipient, amount); require(amountLeft == 0, "insufficient benqi for grant"); emit QiGranted(recipient, amount); } /** * @notice Set reward speed for a single market * @param rewardType 0 = QI, 1 = AVAX * @param qiToken The market whose reward speed to update * @param rewardSpeed New reward speed for market */ function _setRewardSpeed(uint8 rewardType, QiToken qiToken, uint rewardSpeed) public { require(rewardType <= 1, "rewardType is invalid"); require(adminOrInitializing(), "only admin can set reward speed"); setRewardSpeedInternal(rewardType, qiToken, rewardSpeed); } /** * @notice Return all of the markets * @dev The automatic getter may be used to access an individual market. * @return The list of market addresses */ function getAllMarkets() public view returns (QiToken[] memory) { return allMarkets; } function getBlockTimestamp() public view returns (uint) { return block.timestamp; } /** * @notice Set the QI token address */ function setQiAddress(address newQiAddress) public { require(msg.sender == admin); qiAddress = newQiAddress; } /** * @notice payable function needed to receive AVAX */ function () payable external { } }
[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"ContributorQiSpeedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"tokenType","type":"uint8"},{"indexed":true,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"qiDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"qiBorrowIndex","type":"uint256"}],"name":"DistributedBorrowerReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"tokenType","type":"uint8"},{"indexed":true,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"qiDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"qiBorrowIndex","type":"uint256"}],"name":"DistributedSupplierReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"error","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"info","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketExited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract QiToken","name":"qiToken","type":"address"}],"name":"MarketListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newBorrowCap","type":"uint256"}],"name":"NewBorrowCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldBorrowCapGuardian","type":"address"},{"indexed":false,"internalType":"address","name":"newBorrowCapGuardian","type":"address"}],"name":"NewBorrowCapGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCloseFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"NewCloseFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldCollateralFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"NewCollateralFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldLiquidationIncentiveMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"NewLiquidationIncentive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPauseGuardian","type":"address"},{"indexed":false,"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"NewPauseGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract PriceOracle","name":"oldPriceOracle","type":"address"},{"indexed":false,"internalType":"contract PriceOracle","name":"newPriceOracle","type":"address"}],"name":"NewPriceOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"QiGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"tokenType","type":"uint8"},{"indexed":true,"internalType":"contract QiToken","name":"qiToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"SpeedUpdated","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"internalType":"contract Unitroller","name":"unitroller","type":"address"}],"name":"_become","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_borrowGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"_grantQi","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_mintGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newBorrowCapGuardian","type":"address"}],"name":"_setBorrowCapGuardian","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract QiToken","name":"qiToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setBorrowPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"_setCloseFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract QiToken","name":"qiToken","type":"address"},{"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"_setCollateralFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"_setLiquidationIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract QiToken[]","name":"qiTokens","type":"address[]"},{"internalType":"uint256[]","name":"newBorrowCaps","type":"uint256[]"}],"name":"_setMarketBorrowCaps","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract QiToken","name":"qiToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setMintPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"_setPauseGuardian","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract PriceOracle","name":"newOracle","type":"address"}],"name":"_setPriceOracle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"rewardType","type":"uint8"},{"internalType":"contract QiToken","name":"qiToken","type":"address"},{"internalType":"uint256","name":"rewardSpeed","type":"uint256"}],"name":"_setRewardSpeed","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setSeizePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setTransferPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract QiToken","name":"qiToken","type":"address"}],"name":"_supportMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accountAssets","outputs":[{"internalType":"contract QiToken","name":"","type":"address"}],"payable":false,"stateMutability":"view","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 QiToken","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"borrowCapGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"borrowCaps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"borrowGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"contract QiToken","name":"qiToken","type":"address"}],"name":"checkMembership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"rewardType","type":"uint8"},{"internalType":"address payable","name":"holder","type":"address"}],"name":"claimReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"rewardType","type":"uint8"},{"internalType":"address payable","name":"holder","type":"address"},{"internalType":"contract QiToken[]","name":"qiTokens","type":"address[]"}],"name":"claimReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint8","name":"rewardType","type":"uint8"},{"internalType":"address payable[]","name":"holders","type":"address[]"},{"internalType":"contract QiToken[]","name":"qiTokens","type":"address[]"},{"internalType":"bool","name":"borrowers","type":"bool"},{"internalType":"bool","name":"suppliers","type":"bool"}],"name":"claimReward","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"closeFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"qiTokens","type":"address[]"}],"name":"enterMarkets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiTokenAddress","type":"address"}],"name":"exitMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAllMarkets","outputs":[{"internalType":"contract QiToken[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAssetsIn","outputs":[{"internalType":"contract QiToken[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBlockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"qiTokenModify","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"getHypotheticalAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"initialIndexConstant","outputs":[{"internalType":"uint224","name":"","type":"uint224"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isComptroller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiTokenBorrowed","type":"address"},{"internalType":"address","name":"qiTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"liquidateBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiTokenBorrowed","type":"address"},{"internalType":"address","name":"qiTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"liquidateBorrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"qiTokenBorrowed","type":"address"},{"internalType":"address","name":"qiTokenCollateral","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"}],"name":"liquidateCalculateSeizeTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"liquidationIncentiveMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"markets","outputs":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"bool","name":"isQied","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mintAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"actualMintAmount","type":"uint256"},{"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"mintVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"oracle","outputs":[{"internalType":"contract PriceOracle","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pauseGuardian","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":true,"inputs":[],"name":"pendingComptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"qiAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"borrowerIndex","type":"uint256"}],"name":"repayBorrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"rewardAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardAvax","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"rewardBorrowState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"timestamp","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewardBorrowerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardQi","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"rewardSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"rewardSupplierIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"rewardSupplyState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"timestamp","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiTokenCollateral","type":"address"},{"internalType":"address","name":"qiTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"seizeGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiTokenCollateral","type":"address"},{"internalType":"address","name":"qiTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newQiAddress","type":"address"}],"name":"setQiAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"transferGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"qiToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50600080546001600160a01b03191633179055615c8c80620000336000396000f3fe6080604052600436106104255760003560e01c80636d154ea511610229578063bb82aa5e1161012e578063dce15449116100b6578063eabe7d911161007a578063eabe7d9114611501578063ed302dfd14611544578063ede4edd014611575578063f0663983146115a8578063f851a440146115ea57610425565b8063dce1544914611450578063dcfbc0c714611489578063e4028eee1461149e578063e6653f3d146114d7578063e8755446146114ec57610425565b8063c488847b116100fd578063c488847b1461130d578063ceeca69314611369578063d02f73511461137e578063d81c5e45146113d1578063da3d454c1461140d57610425565b8063bb82aa5e146111ce578063bd60aac4146111e3578063bdcdc25814611216578063c29982381461125f57610425565b806388e972b8116101b157806394b2294b1161018057806394b2294b146110d9578063a76b3fda146110ee578063abfceffc14611121578063ac0b0bb7146111a4578063b0772d0b146111b957610425565b806388e972b814610fd95780638e8f294b1461101d5780638ebf636414611072578063929fe9a11461109e57610425565b80637937969d116101f85780637937969d14610e20578063796b89b914610e645780637dc0d1d014610e7957806387f7630314610e8e5780638805714b14610ea357610425565b80636d154ea514610ca15780636d35bf9114610cd4578063731f0c2b14610d27578063744532ae14610d5a57610425565b806341c728b91161032f57806351dff989116102b75780635ec88c79116102865780635ec88c7914610ad45780635f5af1aa14610b075780635fc7e71e14610b3a578063607ef6c114610b8d5780636a56947e14610c5857610425565b806351dff989146109eb57806352d84d1e14610a3457806355ee1fe114610a5e5780635c77860514610a9157610425565b80634b3a0a74116102fe5780634b3a0a741461087a5780634c0cc832146108de5780634e79238f146109175780634ef4c3e11461097e5780634fd42e17146109c157610425565b806341c728b91461079057806347ef3b3b146107d95780634a584432146108325780634ada90af1461086557610425565b806324a3d622116103b25780632d70db78116103815780632d70db78146106b7578063317b0b77146106e3578063391957d71461070d5780633bcf7ec1146107405780633c94786f1461077b57610425565b806324a3d6221461063c578063267822471461065157806326d71f1e146106665780632b7e34341461067b57610425565b806318c882a5116103f957806318c882a5146105055780631d504dc6146105405780631ededc911461057357806321af4569146105c257806324008a62146105f357610425565b80627e3dd21461042757806305b9783d146104505780630952c5631461049e5780630b8d87df146104da575b005b34801561043357600080fd5b5061043c6115ff565b604080519115158252519081900360200190f35b34801561045c57600080fd5b5061048c6004803603604081101561047357600080fd5b50803560ff1690602001356001600160a01b0316611604565b60408051918252519081900360200190f35b3480156104aa57600080fd5b50610425600480360360408110156104c157600080fd5b50803560ff1690602001356001600160a01b0316611621565b3480156104e657600080fd5b506104ef6115ff565b6040805160ff9092168252519081900360200190f35b34801561051157600080fd5b5061043c6004803603604081101561052857600080fd5b506001600160a01b038135169060200135151561168a565b34801561054c57600080fd5b506104256004803603602081101561056357600080fd5b50356001600160a01b031661182a565b34801561057f57600080fd5b50610425600480360360a081101561059657600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060800135611989565b3480156105ce57600080fd5b506105d7611990565b604080516001600160a01b039092168252519081900360200190f35b3480156105ff57600080fd5b5061048c6004803603608081101561061657600080fd5b506001600160a01b0381358116916020810135821691604082013516906060013561199f565b34801561064857600080fd5b506105d7611a5c565b34801561065d57600080fd5b506105d7611a6b565b34801561067257600080fd5b506105d7611a7a565b34801561068757600080fd5b5061048c6004803603604081101561069e57600080fd5b50803560ff1690602001356001600160a01b0316611a89565b3480156106c357600080fd5b5061043c600480360360208110156106da57600080fd5b50351515611aa6565b3480156106ef57600080fd5b5061048c6004803603602081101561070657600080fd5b5035611be0565b34801561071957600080fd5b506104256004803603602081101561073057600080fd5b50356001600160a01b0316611c8d565b34801561074c57600080fd5b5061043c6004803603604081101561076357600080fd5b506001600160a01b0381351690602001351515611d39565b34801561078757600080fd5b5061043c611ed4565b34801561079c57600080fd5b50610425600480360360808110156107b357600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135611ee4565b3480156107e557600080fd5b50610425600480360360c08110156107fc57600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060808101359060a00135611eea565b34801561083e57600080fd5b5061048c6004803603602081101561085557600080fd5b50356001600160a01b0316611ef2565b34801561087157600080fd5b5061048c611f04565b34801561088657600080fd5b506108b66004803603604081101561089d57600080fd5b50803560ff1690602001356001600160a01b0316611f0a565b604080516001600160e01b03909316835263ffffffff90911660208301528051918290030190f35b3480156108ea57600080fd5b506104256004803603604081101561090157600080fd5b506001600160a01b038135169060200135611f3f565b34801561092357600080fd5b506109606004803603608081101561093a57600080fd5b506001600160a01b03813581169160208101359091169060408101359060600135612044565b60408051938452602084019290925282820152519081900360600190f35b34801561098a57600080fd5b5061048c600480360360608110156109a157600080fd5b506001600160a01b0381358116916020810135909116906040013561207e565b3480156109cd57600080fd5b5061048c600480360360208110156109e457600080fd5b503561211b565b3480156109f757600080fd5b5061042560048036036080811015610a0e57600080fd5b506001600160a01b0381358116916020810135909116906040810135906060013561218b565b348015610a4057600080fd5b506105d760048036036020811015610a5757600080fd5b50356121df565b348015610a6a57600080fd5b5061048c60048036036020811015610a8157600080fd5b50356001600160a01b0316612206565b348015610a9d57600080fd5b5061042560048036036060811015610ab457600080fd5b506001600160a01b0381358116916020810135909116906040013561228b565b348015610ae057600080fd5b5061096060048036036020811015610af757600080fd5b50356001600160a01b0316612290565b348015610b1357600080fd5b5061048c60048036036020811015610b2a57600080fd5b50356001600160a01b03166122c5565b348015610b4657600080fd5b5061048c600480360360a0811015610b5d57600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060800135612349565b348015610b9957600080fd5b5061042560048036036040811015610bb057600080fd5b810190602081018135600160201b811115610bca57600080fd5b820183602082011115610bdc57600080fd5b803590602001918460208302840111600160201b83111715610bfd57600080fd5b919390929091602081019035600160201b811115610c1a57600080fd5b820183602082011115610c2c57600080fd5b803590602001918460208302840111600160201b83111715610c4d57600080fd5b5090925090506124ae565b348015610c6457600080fd5b5061042560048036036080811015610c7b57600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135611ee4565b348015610cad57600080fd5b5061043c60048036036020811015610cc457600080fd5b50356001600160a01b031661263e565b348015610ce057600080fd5b50610425600480360360a0811015610cf757600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060800135611989565b348015610d3357600080fd5b5061043c60048036036020811015610d4a57600080fd5b50356001600160a01b0316612653565b348015610d6657600080fd5b5061042560048036036060811015610d7d57600080fd5b60ff823516916001600160a01b0360208201351691810190606081016040820135600160201b811115610daf57600080fd5b820183602082011115610dc157600080fd5b803590602001918460208302840111600160201b83111715610de257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612668945050505050565b348015610e2c57600080fd5b5061048c60048036036060811015610e4357600080fd5b5060ff813516906001600160a01b03602082013581169160400135166126c6565b348015610e7057600080fd5b5061048c6126e9565b348015610e8557600080fd5b506105d76126ee565b348015610e9a57600080fd5b5061043c6126fd565b610425600480360360a0811015610eb957600080fd5b60ff8235169190810190604081016020820135600160201b811115610edd57600080fd5b820183602082011115610eef57600080fd5b803590602001918460208302840111600160201b83111715610f1057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610f5f57600080fd5b820183602082011115610f7157600080fd5b803590602001918460208302840111600160201b83111715610f9257600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050505080351515915060200135151561270d565b348015610fe557600080fd5b5061048c60048036036060811015610ffc57600080fd5b5060ff813516906001600160a01b0360208201358116916040013516612a47565b34801561102957600080fd5b506110506004803603602081101561104057600080fd5b50356001600160a01b0316612a6a565b6040805193151584526020840192909252151582820152519081900360600190f35b34801561107e57600080fd5b5061043c6004803603602081101561109557600080fd5b50351515612a90565b3480156110aa57600080fd5b5061043c600480360360408110156110c157600080fd5b506001600160a01b0381358116916020013516612bc9565b3480156110e557600080fd5b5061048c612bfc565b3480156110fa57600080fd5b5061048c6004803603602081101561111157600080fd5b50356001600160a01b0316612c02565b34801561112d57600080fd5b506111546004803603602081101561114457600080fd5b50356001600160a01b0316612d5f565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015611190578181015183820152602001611178565b505050509050019250505060405180910390f35b3480156111b057600080fd5b5061043c612de8565b3480156111c557600080fd5b50611154612df8565b3480156111da57600080fd5b506105d7612e5a565b3480156111ef57600080fd5b506104256004803603602081101561120657600080fd5b50356001600160a01b0316612e69565b34801561122257600080fd5b5061048c6004803603608081101561123957600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135612ea2565b34801561126b57600080fd5b506111546004803603602081101561128257600080fd5b810190602081018135600160201b81111561129c57600080fd5b8201836020820111156112ae57600080fd5b803590602001918460208302840111600160201b831117156112cf57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612f29945050505050565b34801561131957600080fd5b506113506004803603606081101561133057600080fd5b506001600160a01b03813581169160208101359091169060400135612fc0565b6040805192835260208301919091528051918290030190f35b34801561137557600080fd5b506104ef6131e8565b34801561138a57600080fd5b5061048c600480360360a08110156113a157600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013590911690608001356131ed565b3480156113dd57600080fd5b506108b6600480360360408110156113f457600080fd5b50803560ff1690602001356001600160a01b0316613398565b34801561141957600080fd5b5061048c6004803603606081101561143057600080fd5b506001600160a01b038135811691602081013590911690604001356133cd565b34801561145c57600080fd5b506105d76004803603604081101561147357600080fd5b506001600160a01b03813516906020013561379e565b34801561149557600080fd5b506105d76137d3565b3480156114aa57600080fd5b5061048c600480360360408110156114c157600080fd5b506001600160a01b0381351690602001356137e2565b3480156114e357600080fd5b5061043c613992565b3480156114f857600080fd5b5061048c6139a2565b34801561150d57600080fd5b5061048c6004803603606081101561152457600080fd5b506001600160a01b038135811691602081013590911690604001356139a8565b34801561155057600080fd5b506115596139da565b604080516001600160e01b039092168252519081900360200190f35b34801561158157600080fd5b5061048c6004803603602081101561159857600080fd5b50356001600160a01b03166139ed565b3480156115b457600080fd5b50610425600480360360608110156115cb57600080fd5b5060ff813516906001600160a01b036020820135169060400135613d00565b3480156115f657600080fd5b506105d7613db5565b600181565b601660209081526000928352604080842090915290825290205481565b6116868282600d80548060200260200160405190810160405280929190818152602001828054801561167c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161165e575b5050505050612668565b5050565b6001600160a01b03821660009081526009602052604081205460ff166116e15760405162461bcd60e51b8152600401808060200182810382526028815260200180615b426028913960400191505060405180910390fd5b600a546001600160a01b031633148061170457506000546001600160a01b031633145b61173f5760405162461bcd60e51b8152600401808060200182810382526027815260200180615b8a6027913960400191505060405180910390fd5b6000546001600160a01b031633148061175a57506001821515145b6117a4576040805162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b604482015290519081900360640190fd5b6001600160a01b0383166000818152600c6020908152604091829020805486151560ff199091168117909155825193845283830152606090830181905260069083015265426f72726f7760d01b6080830152517f71aec636243f9709bb0007ae15e9afb8150ab01716d75fd7573be5cc096e03b09181900360a00190a150805b92915050565b806001600160a01b031663f851a4406040518163ffffffff1660e01b815260040160206040518083038186803b15801561186357600080fd5b505afa158015611877573d6000803e3d6000fd5b505050506040513d602081101561188d57600080fd5b50516001600160a01b031633146118d55760405162461bcd60e51b8152600401808060200182810382526027815260200180615c316027913960400191505060405180910390fd5b806001600160a01b031663c1e803346040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561191057600080fd5b505af1158015611924573d6000803e3d6000fd5b505050506040513d602081101561193a57600080fd5b505115611986576040805162461bcd60e51b815260206004820152601560248201527418da185b99d9481b9bdd08185d5d1a1bdc9a5e9959605a1b604482015290519081900360640190fd5b50565b5050505050565b600e546001600160a01b031681565b6001600160a01b03841660009081526009602052604081205460ff166119c757506009611a54565b6119cf615a82565b6040518060200160405280876001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1357600080fd5b505afa158015611a27573d6000803e3d6000fd5b505050506040513d6020811015611a3d57600080fd5b505190529050611a4e868583613dc4565b60009150505b949350505050565b600a546001600160a01b031681565b6001546001600160a01b031681565b6017546001600160a01b031681565b601160209081526000928352604080842090915290825290205481565b600a546000906001600160a01b0316331480611acc57506000546001600160a01b031633145b611b075760405162461bcd60e51b8152600401808060200182810382526027815260200180615b8a6027913960400191505060405180910390fd5b6000546001600160a01b0316331480611b2257506001821515145b611b6c576040805162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b604482015290519081900360640190fd5b600a8054831515600160b81b810260ff60b81b1990921691909117909155604080516020810192909252808252600582820152645365697a6560d81b6060830152517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de09181900360800190a150805b919050565b600080546001600160a01b03163314611c40576040805162461bcd60e51b815260206004820152601f60248201527f6f6e6c792061646d696e2063616e2073657420636c6f736520666163746f7200604482015290519081900360640190fd5b6005805490839055604080518281526020810185905281517f3b9670cf975d26958e754b57098eaa2ac914d8d2a31b83257997b9f346110fd9929181900390910190a160005b9392505050565b6000546001600160a01b03163314611cd65760405162461bcd60e51b8152600401808060200182810382526026815260200180615bb16026913960400191505060405180910390fd5b600e80546001600160a01b038381166001600160a01b0319831681179093556040805191909216808252602082019390935281517feda98690e518e9a05f8ec6837663e188211b2da8f4906648b323f2c1d4434e29929181900390910190a15050565b6001600160a01b03821660009081526009602052604081205460ff16611d905760405162461bcd60e51b8152600401808060200182810382526028815260200180615b426028913960400191505060405180910390fd5b600a546001600160a01b0316331480611db357506000546001600160a01b031633145b611dee5760405162461bcd60e51b8152600401808060200182810382526027815260200180615b8a6027913960400191505060405180910390fd5b6000546001600160a01b0316331480611e0957506001821515145b611e53576040805162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b604482015290519081900360640190fd5b6001600160a01b0383166000818152600b6020908152604091829020805486151560ff199091168117909155825193845283830152606090830181905260049083015263135a5b9d60e21b6080830152517f71aec636243f9709bb0007ae15e9afb8150ab01716d75fd7573be5cc096e03b09181900360a00190a150919050565b600a54600160a01b900460ff1681565b50505050565b505050505050565b600f6020526000908152604090205481565b60065481565b60136020908152600092835260408084209091529082529020546001600160e01b03811690600160e01b900463ffffffff1682565b611f47613df1565b611f98576040805162461bcd60e51b815260206004820152601a60248201527f6f6e6c792061646d696e2063616e206772616e742062656e7169000000000000604482015290519081900360640190fd5b6000611fa660008484613e1a565b90508015611ffb576040805162461bcd60e51b815260206004820152601c60248201527f696e73756666696369656e742062656e716920666f72206772616e7400000000604482015290519081900360640190fd5b604080516001600160a01b03851681526020810184905281517f23b40999b12039b28906192443f166517e9b2c60ff1fd6ec74637416e1204417929181900390910190a1505050565b6000806000806000806120598a8a8a8a613fba565b92509250925082601181111561206b57fe5b95509093509150505b9450945094915050565b6001600160a01b0383166000908152600b602052604081205460ff16156120dd576040805162461bcd60e51b815260206004820152600e60248201526d1b5a5b9d081a5cc81c185d5cd95960921b604482015290519081900360640190fd5b6001600160a01b03841660009081526009602052604090205460ff166121075760095b9050611c86565b61211184846142f2565b6000949350505050565b600080546001600160a01b031633146121415761213a6001600b61431d565b9050611bdb565b6006805490839055604080518281526020810185905281517faeba5a6c40a8ac138134bff1aaa65debf25971188a58804bad717f82f0ec1316929181900390910190a16000611c86565b801580156121995750600082115b15611ee4576040805162461bcd60e51b815260206004820152601160248201527072656465656d546f6b656e73207a65726f60781b604482015290519081900360640190fd5b600d81815481106121ec57fe5b6000918252602090912001546001600160a01b0316905081565b600080546001600160a01b031633146122255761213a6001601061431d565b600480546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935281517fd52b2b9b7e9ee655fcb95d2e5b9e0c9f69e7ef2b8e9d2d0ea78402d576d22e22929181900390910190a16000611c86565b505050565b6000806000806000806122a7876000806000613fba565b9250925092508260118111156122b957fe5b97919650945092505050565b600080546001600160a01b031633146122e45761213a6001601361431d565b600a80546001600160a01b038481166001600160a01b0319831617928390556040805192821680845293909116602083015280517f0613b6ee6a04f0d09f390e4d9318894b9f6ac7fd83897cd8d18896ba579c401e9281900390910190a16000611c86565b6001600160a01b03851660009081526009602052604081205460ff16158061238a57506001600160a01b03851660009081526009602052604090205460ff16155b156123995760095b90506124a5565b6000806123a585614383565b919350909150600090508260118111156123bb57fe5b146123d5578160118111156123cc57fe5b925050506124a5565b806123e15760036123cc565b6000886001600160a01b03166395dd9193876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561243957600080fd5b505afa15801561244d573d6000803e3d6000fd5b505050506040513d602081101561246357600080fd5b50516040805160208101909152600554815290915060009061248590836143a3565b90508086111561249c5760119450505050506124a5565b60009450505050505b95945050505050565b6000546001600160a01b03163314806124d15750600e546001600160a01b031633145b61250c5760405162461bcd60e51b8152600401808060200182810382526035815260200180615bd76035913960400191505060405180910390fd5b8281811580159061251c57508082145b61255d576040805162461bcd60e51b815260206004820152600d60248201526c1a5b9d985b1a59081a5b9c1d5d609a1b604482015290519081900360640190fd5b60005b828110156126355784848281811061257457fe5b90506020020135600f600089898581811061258b57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055508686828181106125cb57fe5b905060200201356001600160a01b03166001600160a01b03167f6f1951b2aad10f3fc81b86d91105b413a5b3f847a34bbc5ce1904201b14438f686868481811061261157fe5b905060200201356040518082815260200191505060405180910390a2600101612560565b50505050505050565b600c6020526000908152604090205460ff1681565b600b6020526000908152604090205460ff1681565b60408051600180825281830190925260609160208083019080388339019050509050828160008151811061269857fe5b60200260200101906001600160a01b031690816001600160a01b031681525050611ee484828460018061270d565b601560209081526000938452604080852082529284528284209052825290205481565b425b90565b6004546001600160a01b031681565b600a54600160b01b900460ff1681565b60018560ff16111561275e576040805162461bcd60e51b81526020600482015260156024820152741c995dd85c99151e5c19481a5cc81a5b9d985b1a59605a1b604482015290519081900360640190fd5b60005b8351811015611eea57600084828151811061277857fe5b6020908102919091018101516001600160a01b0381166000908152600990925260409091205490915060ff166127ed576040805162461bcd60e51b81526020600482015260156024820152741b585c9ad95d081b5d5cdd081899481b1a5cdd1959605a1b604482015290519081900360640190fd5b6001841515141561296c57612800615a82565b6040518060200160405280836001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561284457600080fd5b505afa158015612858573d6000803e3d6000fd5b505050506040513d602081101561286e57600080fd5b50519052905061287f8883836143c2565b60005b8751811015612969576128aa89848a848151811061289c57fe5b6020026020010151856146f4565b61291a8960ff168983815181106128bd57fe5b6020026020010151601660008d60ff1660ff16815260200190815260200160002060008c86815181106128ec57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054613e1a565b60ff8a1660009081526016602052604081208a519091908b908590811061293d57fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002055600101612882565b50505b60018315151415612a3e576129818782614944565b60005b8651811015612a3c576129ab888389848151811061299e57fe5b6020026020010151614c36565b6129ed8860ff168883815181106129be57fe5b6020026020010151601660008c60ff1660ff16815260200190815260200160002060008b86815181106128ec57fe5b60ff8916600090815260166020526040812089519091908a9085908110612a1057fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002055600101612984565b505b50600101612761565b601460209081526000938452604080852082529284528284209052825290205481565b60096020526000908152604090208054600182015460039092015460ff91821692911683565b600a546000906001600160a01b0316331480612ab657506000546001600160a01b031633145b612af15760405162461bcd60e51b8152600401808060200182810382526027815260200180615b8a6027913960400191505060405180910390fd5b6000546001600160a01b0316331480612b0c57506001821515145b612b56576040805162461bcd60e51b81526020600482015260166024820152756f6e6c792061646d696e2063616e20756e706175736560501b604482015290519081900360640190fd5b600a8054831515600160b01b810260ff60b01b1990921691909117909155604080516020810192909252808252600882820152672a3930b739b332b960c11b6060830152517fef159d9a32b2472e32b098f954f3ce62d232939f1c207070b584df1814de2de09181900360800190a15090565b6001600160a01b038082166000908152600960209081526040808320938616835260029093019052205460ff1692915050565b60075481565b600080546001600160a01b03163314612c215761213a6001601261431d565b6001600160a01b03821660009081526009602052604090205460ff1615612c4e5761213a600a601161431d565b816001600160a01b031663840bbeac6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c8757600080fd5b505afa158015612c9b573d6000803e3d6000fd5b505050506040513d6020811015612cb157600080fd5b5050604080516060810182526001808252600060208381018281528486018381526001600160a01b03891684526009909252949091209251835490151560ff19918216178455935191830191909155516003909101805491151591909216179055612d1b82614e9d565b604080516001600160a01b038416815290517fcf583bb0c569eb967f806b11601c4cb93c10310485c67add5f8362c2f212321f9181900360200190a1600092915050565b60608060086000846001600160a01b03166001600160a01b03168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015612ddb57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612dbd575b5093979650505050505050565b600a54600160b81b900460ff1681565b6060600d805480602002602001604051908101604052809291908181526020018280548015612e5057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612e32575b5050505050905090565b6002546001600160a01b031681565b6000546001600160a01b03163314612e8057600080fd5b601780546001600160a01b0319166001600160a01b0392909216919091179055565b600a54600090600160b01b900460ff1615612ef9576040805162461bcd60e51b81526020600482015260126024820152711d1c985b9cd9995c881a5cc81c185d5cd95960721b604482015290519081900360640190fd5b6000612f06868685614f7b565b90508015612f15579050611a54565b612f1f86866142f2565b611a4e86856142f2565b6060600082519050606081604051908082528060200260200182016040528015612f5d578160200160208202803883390190505b50905060005b82811015612fb8576000858281518110612f7957fe5b60200260200101519050612f8d8133615027565b6011811115612f9857fe5b838381518110612fa457fe5b602090810291909101015250600101612f63565b509392505050565b600480546040805163fc57d4df60e01b81526001600160a01b038781169482019490945290516000938493849391169163fc57d4df91602480820192602092909190829003018186803b15801561301657600080fd5b505afa15801561302a573d6000803e3d6000fd5b505050506040513d602081101561304057600080fd5b5051600480546040805163fc57d4df60e01b81526001600160a01b038a8116948201949094529051939450600093929091169163fc57d4df91602480820192602092909190829003018186803b15801561309957600080fd5b505afa1580156130ad573d6000803e3d6000fd5b505050506040513d60208110156130c357600080fd5b505190508115806130d2575080155b156130e757600d9350600092506131e0915050565b6000866001600160a01b031663182df0f56040518163ffffffff1660e01b815260040160206040518083038186803b15801561312257600080fd5b505afa158015613136573d6000803e3d6000fd5b505050506040513d602081101561314c57600080fd5b50519050600061315a615a82565b613162615a82565b61316a615a82565b613192604051806020016040528060065481525060405180602001604052808a81525061511d565b92506131ba60405180602001604052808881525060405180602001604052808881525061511d565b91506131c6838361515c565b90506131d2818b6143a3565b600099509750505050505050505b935093915050565b600081565b600a54600090600160b81b900460ff1615613241576040805162461bcd60e51b815260206004820152600f60248201526e1cd95a5e99481a5cc81c185d5cd959608a1b604482015290519081900360640190fd5b6001600160a01b03861660009081526009602052604090205460ff16158061328257506001600160a01b03851660009081526009602052604090205460ff16155b1561328e576009612392565b846001600160a01b0316635fe3b5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156132c757600080fd5b505afa1580156132db573d6000803e3d6000fd5b505050506040513d60208110156132f157600080fd5b505160408051635fe3b56760e01b815290516001600160a01b0392831692891691635fe3b567916004808301926020929190829003018186803b15801561333757600080fd5b505afa15801561334b573d6000803e3d6000fd5b505050506040513d602081101561336157600080fd5b50516001600160a01b031614613378576002612392565b61338286846142f2565b61338c86856142f2565b60009695505050505050565b60126020908152600092835260408084209091529082529020546001600160e01b03811690600160e01b900463ffffffff1682565b6001600160a01b0383166000908152600c602052604081205460ff161561342e576040805162461bcd60e51b815260206004820152601060248201526f189bdc9c9bddc81a5cc81c185d5cd95960821b604482015290519081900360640190fd5b6001600160a01b03841660009081526009602052604090205460ff16613455576009612100565b6001600160a01b038085166000908152600960209081526040808320938716835260029093019052205460ff1661354657336001600160a01b038516146134dc576040805162461bcd60e51b815260206004820152601660248201527539b2b73232b91036bab9ba1031329038b4aa37b5b2b760511b604482015290519081900360640190fd5b60006134e83385615027565b905060008160118111156134f857fe5b146135115780601181111561350957fe5b915050611c86565b6001600160a01b038086166000908152600960209081526040808320938816835260029093019052205460ff1661354457fe5b505b600480546040805163fc57d4df60e01b81526001600160a01b03888116948201949094529051929091169163fc57d4df91602480820192602092909190829003018186803b15801561359757600080fd5b505afa1580156135ab573d6000803e3d6000fd5b505050506040513d60208110156135c157600080fd5b50516135ce57600d612100565b6001600160a01b0384166000908152600f602052604090205480156136bb576000856001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b15801561362857600080fd5b505afa15801561363c573d6000803e3d6000fd5b505050506040513d602081101561365257600080fd5b5051905060006136628286615198565b90508281106136b8576040805162461bcd60e51b815260206004820152601960248201527f6d61726b657420626f72726f7720636170207265616368656400000000000000604482015290519081900360640190fd5b50505b6000806136cb8688600088613fba565b919350909150600090508260118111156136e157fe5b146136fc578160118111156136f257fe5b9350505050611c86565b80156137095760046136f2565b613711615a82565b6040518060200160405280896001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561375557600080fd5b505afa158015613769573d6000803e3d6000fd5b505050506040513d602081101561377f57600080fd5b505190529050613790888883613dc4565b600098975050505050505050565b600860205281600052604060002081815481106137b757fe5b6000918252602090912001546001600160a01b03169150829050565b6003546001600160a01b031681565b600080546001600160a01b03163314613808576138016001600661431d565b9050611824565b6001600160a01b0383166000908152600960205260409020805460ff1661383d576138356009600761431d565b915050611824565b613845615a82565b50604080516020810190915283815261385c615a82565b506040805160208101909152670c7d713b49da0000815261387d81836151ce565b156138985761388e6006600861431d565b9350505050611824565b84158015906139215750600480546040805163fc57d4df60e01b81526001600160a01b038a8116948201949094529051929091169163fc57d4df91602480820192602092909190829003018186803b1580156138f357600080fd5b505afa158015613907573d6000803e3d6000fd5b505050506040513d602081101561391d57600080fd5b5051155b156139325761388e600d600961431d565b60018301805490869055604080516001600160a01b03891681526020810183905280820188905290517f70483e6592cd5182d45ac970e05bc62cdcc90e9d8ef2c2dbe686cf383bcd7fc59181900360600190a16000979650505050505050565b600a54600160a81b900460ff1681565b60055481565b6000806139b6858585614f7b565b905080156139c5579050611c86565b6139cf85856142f2565b600095945050505050565b6ec097ce7bc90715b34b9f100000000081565b6000808290506000806000836001600160a01b031663c37f68e2336040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060806040518083038186803b158015613a4e57600080fd5b505afa158015613a62573d6000803e3d6000fd5b505050506040513d6080811015613a7857600080fd5b508051602082015160409092015190945090925090508215613acb5760405162461bcd60e51b8152600401808060200182810382526025815260200180615c0c6025913960400191505060405180910390fd5b8015613ae857613add600c600261431d565b945050505050611bdb565b6000613af5873385614f7b565b90508015613b1657613b0a600e6003836151d5565b95505050505050611bdb565b6001600160a01b0385166000908152600960209081526040808320338452600281019092529091205460ff16613b555760009650505050505050611bdb565b3360009081526002820160209081526040808320805460ff191690556008825291829020805483518184028101840190945280845260609392830182828015613bc757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613ba9575b5050835193945083925060009150505b82811015613c1c57896001600160a01b0316848281518110613bf557fe5b60200260200101516001600160a01b03161415613c1457809150613c1c565b600101613bd7565b50818110613c2657fe5b336000908152600860205260409020805481906000198101908110613c4757fe5b9060005260206000200160009054906101000a90046001600160a01b0316818381548110613c7157fe5b600091825260209091200180546001600160a01b0319166001600160a01b03929092169190911790558054613caa826000198301615a95565b50604080516001600160a01b038c16815233602082015281517fe699a64c18b07ac5b7301aa273f36a2287239eb9501d81950672794afba29a0d929181900390910190a160009c9b505050505050505050505050565b60018360ff161115613d51576040805162461bcd60e51b81526020600482015260156024820152741c995dd85c99151e5c19481a5cc81a5b9d985b1a59605a1b604482015290519081900360640190fd5b613d59613df1565b613daa576040805162461bcd60e51b815260206004820152601f60248201527f6f6e6c792061646d696e2063616e207365742072657761726420737065656400604482015290519081900360640190fd5b61228b83838361523b565b6000546001600160a01b031681565b60005b60018160ff1611611ee457613ddd8185846143c2565b613de9818585856146f4565b600101613dc7565b600080546001600160a01b0316331480613e1557506002546001600160a01b031633145b905090565b600083613f5257601754604080516370a0823160e01b815230600482015290516001600160a01b039092169160009183916370a0823191602480820192602092909190829003018186803b158015613e7157600080fd5b505afa158015613e85573d6000803e3d6000fd5b505050506040513d6020811015613e9b57600080fd5b505190508315801590613eae5750808411155b15613f4b57816001600160a01b031663a9059cbb86866040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015613f1357600080fd5b505af1158015613f27573d6000803e3d6000fd5b505050506040513d6020811015613f3d57600080fd5b5060009350611c8692505050565b5050613fb3565b8360011415613fb357478215801590613f6b5750808311155b15613fb1576040516001600160a01b0385169084156108fc029085906000818181858888f19350505050158015613fa6573d6000803e3d6000fd5b506000915050611c86565b505b5092915050565b6000806000613fc7615ab9565b6001600160a01b0388166000908152600860209081526040808320805482518185028101850190935280835260609383018282801561402f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311614011575b50939450600093505050505b81518110156142b357600082828151811061405257fe5b60200260200101519050806001600160a01b031663c37f68e28d6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060806040518083038186803b1580156140b257600080fd5b505afa1580156140c6573d6000803e3d6000fd5b505050506040513d60808110156140dc57600080fd5b508051602082015160408084015160609485015160808b01529389019390935291870191909152935083156141215750600f9650600095508594506120749350505050565b60408051602080820183526001600160a01b0380851660008181526009845285902060010154845260c08a01939093528351808301855260808a0151815260e08a015260048054855163fc57d4df60e01b815291820194909452935192169263fc57d4df9260248083019392829003018186803b1580156141a157600080fd5b505afa1580156141b5573d6000803e3d6000fd5b505050506040513d60208110156141cb57600080fd5b505160a086018190526141ee5750600d9650600095508594506120749350505050565b604080516020810190915260a0860151815261010086015260c085015160e08601516142289161421d9161511d565b86610100015161511d565b610120860181905260408601518651614242929190615630565b85526101008501516060860151602087015161425f929190615630565b60208601526001600160a01b03818116908c1614156142aa5761428c8561012001518b8760200151615630565b602086018190526101008601516142a4918b90615630565b60208601525b5060010161403b565b506020830151835111156142d95750506020810151905160009450039150829050612074565b5050805160209091015160009450849350039050612074565b60005b60018160ff161161228b5761430a8184614944565b614315818484614c36565b6001016142f5565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa083601181111561434c57fe5b83601381111561435857fe5b604080519283526020830191909152600082820152519081900360600190a1826011811115611c8657fe5b6000806000614396846000806000613fba565b9250925092509193909250565b60006143ad615a82565b6143b78484615658565b9050611a5481615679565b60018360ff161115614413576040805162461bcd60e51b81526020600482015260156024820152741c995dd85c99151e5c19481a5cc81a5b9d985b1a59605a1b604482015290519081900360640190fd5b60ff831660008181526013602090815260408083206001600160a01b03871680855290835281842094845260118352818420908452909152812054906144576126e9565b8354909150600090614477908390600160e01b900463ffffffff16615688565b90506000811180156144895750600083115b156146995760006144fe876001600160a01b03166347bd37186040518163ffffffff1660e01b815260040160206040518083038186803b1580156144cc57600080fd5b505afa1580156144e0573d6000803e3d6000fd5b505050506040513d60208110156144f657600080fd5b5051876156c2565b9050600061450c83866156e0565b9050614516615a82565b60008311614533576040518060200160405280600081525061453d565b61453d8284615722565b9050614547615a82565b604080516020810190915288546001600160e01b031681526145699083615757565b905060405180604001604052806145b983600001516040518060400160405280601a81526020017f6e657720696e646578206578636565647320323234206269747300000000000081525061577c565b6001600160e01b031681526020016145f4886040518060400160405280601f8152602001600080516020615b6a833981519152815250615816565b63ffffffff16815250601360008d60ff1660ff16815260200190815260200160002060008c6001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160e01b0302191690836001600160e01b03160217905550602082015181600001601c6101000a81548163ffffffff021916908363ffffffff16021790555090505050505050612635565b8015612635576146cc826040518060400160405280601f8152602001600080516020615b6a833981519152815250615816565b845463ffffffff91909116600160e01b026001600160e01b0390911617845550505050505050565b60018460ff161115614745576040805162461bcd60e51b81526020600482015260156024820152741c995dd85c99151e5c19481a5cc81a5b9d985b1a59605a1b604482015290519081900360640190fd5b60ff841660009081526013602090815260408083206001600160a01b03871684529091529020614773615a82565b50604080516020810190915281546001600160e01b03168152614794615a82565b50604080516020808201835260ff89166000908152601582528381206001600160a01b03808b1683529083528482209089168083528184529482208054855286519590925290915291909155805115612635576147ef615a82565b6147f9838361586b565b90506000614856886001600160a01b03166395dd9193896040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156144cc57600080fd5b905060006148648284615890565b60ff8b1660009081526016602090815260408083206001600160a01b038d168452909152812054919250906148999083615198565b905080601660008d60ff1660ff16815260200190815260200160002060008b6001600160a01b03166001600160a01b0316815260200190815260200160002081905550886001600160a01b03168a6001600160a01b03168c60ff167fa1b6a046664a0ecf068059f26de56878f8d0e799907ca2e42d9148ccbdc717a7858a60000151604051808381526020018281526020019250505060405180910390a45050505050505050505050565b60018260ff161115614995576040805162461bcd60e51b81526020600482015260156024820152741c995dd85c99151e5c19481a5cc81a5b9d985b1a59605a1b604482015290519081900360640190fd5b60ff821660008181526012602090815260408083206001600160a01b03861680855290835281842094845260118352818420908452909152812054906149d96126e9565b83549091506000906149f9908390600160e01b900463ffffffff16615688565b9050600081118015614a0b5750600083115b15614bdc576000856001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015614a4b57600080fd5b505afa158015614a5f573d6000803e3d6000fd5b505050506040513d6020811015614a7557600080fd5b505190506000614a8583866156e0565b9050614a8f615a82565b60008311614aac5760405180602001604052806000815250614ab6565b614ab68284615722565b9050614ac0615a82565b604080516020810190915288546001600160e01b03168152614ae29083615757565b90506040518060400160405280614b3283600001516040518060400160405280601a81526020017f6e657720696e646578206578636565647320323234206269747300000000000081525061577c565b6001600160e01b03168152602001614b6d886040518060400160405280601f8152602001600080516020615b6a833981519152815250615816565b63ffffffff90811690915260ff8c1660009081526012602090815260408083206001600160a01b038f1684528252909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b0319909416939093171691909117905550611eea92505050565b8015611eea57614c0f826040518060400160405280601f8152602001600080516020615b6a833981519152815250615816565b845463ffffffff91909116600160e01b026001600160e01b03909116178455505050505050565b60018360ff161115614c87576040805162461bcd60e51b81526020600482015260156024820152741c995dd85c99151e5c19481a5cc81a5b9d985b1a59605a1b604482015290519081900360640190fd5b60ff831660009081526012602090815260408083206001600160a01b03861684529091529020614cb5615a82565b50604080516020810190915281546001600160e01b03168152614cd6615a82565b50604080516020808201835260ff88166000908152601482528381206001600160a01b03808a16835290835284822090881680835281845294822080548552865195909252909152919091558051158015614d315750815115155b15614d49576ec097ce7bc90715b34b9f100000000081525b614d51615a82565b614d5b838361586b565b90506000866001600160a01b03166370a08231876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015614db557600080fd5b505afa158015614dc9573d6000803e3d6000fd5b505050506040513d6020811015614ddf57600080fd5b505190506000614def8284615890565b60ff8a1660009081526016602090815260408083206001600160a01b038c16845290915281205491925090614e249083615198565b60ff8b1660008181526016602090815260408083206001600160a01b03808f16808652918452938290208690558b51825189815293840152815195965094928e1693927faccd035d02c456be35306aecd5a5fe62320713dde09ccd68b0a5e8ed930399999281900390910190a450505050505050505050565b60005b600d54811015614f2857816001600160a01b0316600d8281548110614ec157fe5b6000918252602090912001546001600160a01b03161415614f20576040805162461bcd60e51b81526020600482015260146024820152731b585c9ad95d08185b1c9958591e48185919195960621b604482015290519081900360640190fd5b600101614ea0565b50600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831660009081526009602052604081205460ff16614fa2576009612100565b6001600160a01b038085166000908152600960209081526040808320938716835260029093019052205460ff16614fda576000612100565b600080614fea8587866000613fba565b9193509091506000905082601181111561500057fe5b1461501a5781601181111561501157fe5b92505050611c86565b801561338c576004615011565b6001600160a01b0382166000908152600960205260408120805460ff16615052576009915050611824565b6001600160a01b038316600090815260028201602052604090205460ff16151560011415615084576000915050611824565b6001600160a01b0380841660008181526002840160209081526040808320805460ff19166001908117909155600883528184208054918201815584529282902090920180549489166001600160a01b031990951685179055815193845283019190915280517f3ab23ab0d51cccc0c3085aec51f99228625aa1a922b3a8ca89a26b0f2027a1a59281900390910190a15060009392505050565b615125615a82565b6040518060200160405280670de0b6b3a764000061514b866000015186600001516156e0565b8161515257fe5b0490529392505050565b615164615a82565b604051806020016040528061518f6151888660000151670de0b6b3a76400006156e0565b85516158bf565b90529392505050565b6000611c868383604051806040016040528060118152602001706164646974696f6e206f766572666c6f7760781b8152506158f2565b5190511090565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa084601181111561520457fe5b84601381111561521057fe5b604080519283526020830191909152818101859052519081900360600190a1836011811115611a5457fe5b60ff831660009081526011602090815260408083206001600160a01b038616845290915290205480156152ff57615270615a82565b6040518060200160405280856001600160a01b031663aa5af0fd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156152b457600080fd5b505afa1580156152c8573d6000803e3d6000fd5b505050506040513d60208110156152de57600080fd5b5051905290506152ee8585614944565b6152f98585836143c2565b506155bd565b81156155bd576001600160a01b0383166000908152600960205260409020805460ff161515600114615378576040805162461bcd60e51b815260206004820152601a60248201527f62656e7169206d61726b6574206973206e6f74206c6973746564000000000000604482015290519081900360640190fd5b60ff851660009081526012602090815260408083206001600160a01b03881684529091529020546001600160e01b03161580156153e6575060ff851660009081526012602090815260408083206001600160a01b0388168452909152902054600160e01b900463ffffffff16155b156154ae5760405180604001604052806ec097ce7bc90715b34b9f10000000006001600160e01b0316815260200161544861541f6126e9565b6040518060400160405280601f8152602001600080516020615b6a833981519152815250615816565b63ffffffff90811690915260ff871660009081526012602090815260408083206001600160a01b038a1684528252909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555b60ff851660009081526013602090815260408083206001600160a01b03881684529091529020546001600160e01b031615801561551c575060ff851660009081526013602090815260408083206001600160a01b0388168452909152902054600160e01b900463ffffffff16155b156155bb5760405180604001604052806ec097ce7bc90715b34b9f10000000006001600160e01b0316815260200161555561541f6126e9565b63ffffffff90811690915260ff871660009081526013602090815260408083206001600160a01b038a1684528252909120835181549490920151909216600160e01b026001600160e01b039182166001600160e01b031990941693909317169190911790555b505b818114611ee45760ff841660008181526011602090815260408083206001600160a01b038816808552908352928190208690558051938452908301859052805191927ffab3e36e10faad8967f2935c339d100f2a9967474535409986a1306be31f7b2f929081900390910190a250505050565b600061563a615a82565b6156448585615658565b90506124a561565282615679565b84615198565b615660615a82565b604051806020016040528061518f8560000151856156e0565b51670de0b6b3a7640000900490565b6000611c868383604051806040016040528060158152602001747375627472616374696f6e20756e646572666c6f7760581b815250615950565b6000611c866156d984670de0b6b3a76400006156e0565b83516158bf565b6000611c8683836040518060400160405280601781526020017f6d756c7469706c69636174696f6e206f766572666c6f770000000000000000008152506159aa565b61572a615a82565b604051806020016040528061518f615751866ec097ce7bc90715b34b9f10000000006156e0565b856158bf565b61575f615a82565b604051806020016040528061518f85600001518560000151615198565b600081600160e01b841061580e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156157d35781810151838201526020016157bb565b50505050905090810190601f1680156158005780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b600081600160201b841061580e5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156157d35781810151838201526020016157bb565b615873615a82565b604051806020016040528061518f85600001518560000151615688565b60006ec097ce7bc90715b34b9f10000000006158b08484600001516156e0565b816158b757fe5b049392505050565b6000611c8683836040518060400160405280600e81526020016d646976696465206279207a65726f60901b815250615a20565b600083830182858210156159475760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156157d35781810151838201526020016157bb565b50949350505050565b600081848411156159a25760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156157d35781810151838201526020016157bb565b505050900390565b60008315806159b7575082155b156159c457506000611c86565b838302838582816159d157fe5b041483906159475760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156157d35781810151838201526020016157bb565b60008183615a6f5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156157d35781810151838201526020016157bb565b50828481615a7957fe5b04949350505050565b6040518060200160405280600081525090565b81548183558181111561228b5760008381526020902061228b918101908301615b23565b604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001615af7615a82565b8152602001615b04615a82565b8152602001615b11615a82565b8152602001615b1e615a82565b905290565b6126eb91905b80821115615b3d5760008155600101615b29565b509056fe63616e6e6f742070617573652061206d61726b65742074686174206973206e6f74206c6973746564626c6f636b2074696d657374616d7020657863656564732033322062697473006f6e6c7920706175736520677561726469616e20616e642061646d696e2063616e2070617573656f6e6c792061646d696e2063616e2073657420626f72726f772063617020677561726469616e6f6e6c792061646d696e206f7220626f72726f772063617020677561726469616e2063616e2073657420626f72726f772063617073657869744d61726b65743a206765744163636f756e74536e617073686f74206661696c65646f6e6c7920756e6974726f6c6c65722061646d696e2063616e206368616e676520627261696e73a265627a7a723158201cfaae6e77026b21602c3de8780a5729642ad7e0af45c6d06a71bf5e7473345464736f6c63430005110032
Deployed ByteCode Sourcemap
141450:59170:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;67847:41;;8:9:-1;5:2;;;30:1;27;20:12;5:2;67847:41:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;27318:63;;8:9:-1;5:2;;;30:1;27;20:12;5:2;27318:63:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;27318:63:0;;;;;;;;-1:-1:-1;;;;;27318:63:0;;:::i;:::-;;;;;;;;;;;;;;;;195248:138;;8:9:-1;5:2;;;30:1;27;20:12;5:2;195248:138:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;195248:138:0;;;;;;;;-1:-1:-1;;;;;195248:138:0;;:::i;144752:36::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;144752:36:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;184190:514;;8:9:-1;5:2;;;30:1;27;20:12;5:2;184190:514:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;184190:514:0;;;;;;;;;;:::i;185475:234::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;185475:234:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;185475:234:0;-1:-1:-1;;;;;185475:234:0;;:::i;158996:460::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;158996:460:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;158996:460:0;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;25752:32::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25752:32:0;;;:::i;:::-;;;;-1:-1:-1;;;;;25752:32:0;;;;;;;;;;;;;;158062:611;;8:9:-1;5:2;;;30:1;27;20:12;5:2;158062:611:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;158062:611:0;;;;;;;;;;;;;;;;;;;;;;:::i;25211:28::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25211:28:0;;;:::i;23046:27::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23046:27:0;;;:::i;27433:24::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;27433:24:0;;;:::i;26438:62::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26438:62:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;26438:62:0;;;;;;;;-1:-1:-1;;;;;26438:62:0;;:::i;185098:369::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;185098:369:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;185098:369:0;;;;:::i;176146:423::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;176146:423:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;176146:423:0;;:::i;182264:557::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;182264:557:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;182264:557:0;-1:-1:-1;;;;;182264:557:0;;:::i;183674:508::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;183674:508:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;183674:508:0;;;;;;;;;;:::i;25246:31::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25246:31:0;;;:::i;151659:364::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;151659:364:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;151659:364:0;;;;;;;;;;;;;;;;;;;;;;:::i;161566:550::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;161566:550:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;161566:550:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;25932:42::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25932:42:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;25932:42:0;-1:-1:-1;;;;;25932:42:0;;:::i;23753:40::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23753:40:0;;;:::i;26728:79::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26728:79:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;26728:79:0;;;;;;;;-1:-1:-1;;;;;26728:79:0;;:::i;:::-;;;;-1:-1:-1;;;;;26728:79:0;;;;;;;;;;;;;;;;;;;;;;199040:325;;8:9:-1;5:2;;;30:1;27;20:12;5:2;199040:325:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;199040:325:0;;;;;;;;:::i;168791:411::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;168791:411:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;168791:411:0;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;150765:561;;8:9:-1;5:2;;;30:1;27;20:12;5:2;150765:561:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;150765:561:0;;;;;;;;;;;;;;;;;:::i;178889:742::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;178889:742:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;178889:742:0;;:::i;154131:351::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154131:351:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;154131:351:0;;;;;;;;;;;;;;;;;;;;;;:::i;25560:27::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25560:27:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;25560:27:0;;:::i;175306:572::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;175306:572:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;175306:572:0;-1:-1:-1;;;;;175306:572:0;;:::i;157240:324::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;157240:324:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;157240:324:0;;;;;;;;;;;;;;;;;:::i;167409:269::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;167409:269:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;167409:269:0;-1:-1:-1;;;;;167409:269:0;;:::i;183059:607::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;183059:607:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;183059:607:0;-1:-1:-1;;;;;183059:607:0;;:::i;159912:1178::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;159912:1178:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;159912:1178:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;181485:609::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;181485:609:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;181485:609:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;181485:609:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;181485:609: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;181485:609:0;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;181485:609:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;181485:609: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;181485:609:0;;-1:-1:-1;181485:609:0;-1:-1:-1;181485:609:0;:::i;166059:347::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;166059:347:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;166059:347:0;;;;;;;;;;;;;;;;;;;;;;:::i;25460:52::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25460:52:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;25460:52:0;-1:-1:-1;;;;;25460:52:0;;:::i;164016:479::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;164016:479:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;164016:479:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;25403:50::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25403:50:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;25403:50:0;-1:-1:-1;;;;;25403:50:0;;:::i;195606:271::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;195606:271:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;195606:271:0;;;;;-1:-1:-1;;;;;195606:271:0;;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;195606:271:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;195606:271: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;195606:271:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;195606:271:0;;-1:-1:-1;195606:271:0;;-1:-1:-1;;;;;195606:271:0:i;27146:89::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;27146:89:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;27146:89:0;;;;;-1:-1:-1;;;;;27146:89:0;;;;;;;;;;;;:::i;200201:97::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;200201:97:0;;;:::i;23454:25::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23454:25:0;;;:::i;25324:34::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25324:34:0;;;:::i;196284:1389::-;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;196284:1389:0;;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;196284:1389:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;196284:1389: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;196284:1389:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;196284:1389:0;;;;;;;;-1:-1:-1;196284:1389:0;;-1:-1:-1;;;;;5:28;;2:2;;;46:1;43;36:12;2:2;196284:1389:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;196284:1389: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;196284:1389:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;196284:1389:0;;-1:-1:-1;;;;196284:1389:0;;;;;-1:-1:-1;196284:1389:0;;;;;;:::i;26932:89::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26932:89:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;26932:89:0;;;;;-1:-1:-1;;;;;26932:89:0;;;;;;;;;;;;:::i;24891:41::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;24891:41:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;24891:41:0;-1:-1:-1;;;;;24891:41:0;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;184712:378;;8:9:-1;5:2;;;30:1;27;20:12;5:2;184712:378:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;184712:378:0;;;;:::i;145569:166::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;145569:166:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;145569:166:0;;;;;;;;;;:::i;23923:21::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23923:21:0;;;:::i;179959:737::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;179959:737:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;179959:737:0;-1:-1:-1;;;;;179959:737:0;;:::i;145114:176::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;145114:176:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;145114:176:0;-1:-1:-1;;;;;145114:176:0;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;145114:176:0;;;;;;;;;;;;;;;;;25365:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25365:31:0;;;:::i;200093:100::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;200093:100:0;;;:::i;23142:40::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23142:40:0;;;:::i;200365:133::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;200365:133:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;200365:133:0;-1:-1:-1;;;;;200365:133:0;;:::i;164964:768::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;164964:768:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;164964:768:0;;;;;;;;;;;;;;;;;;;;;;:::i;146003:386::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;146003:386:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;146003:386:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;146003:386:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;146003:386: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;146003:386:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;146003:386:0;;-1:-1:-1;146003:386:0;;-1:-1:-1;;;;;146003:386:0:i;173479:1562::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;173479:1562:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;173479:1562:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;144711:34;;8:9:-1;5:2;;;30:1;27;20:12;5:2;144711:34:0;;;:::i;162581:972::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;162581:972:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;162581:972:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;26574:80::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26574:80:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;26574:80:0;;;;;;;;-1:-1:-1;;;;;26574:80:0;;:::i;154924:2008::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154924:2008:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;154924:2008:0;;;;;;;;;;;;;;;;;:::i;24051:50::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;24051:50:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;24051:50:0;;;;;;;;:::i;23252:47::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23252:47:0;;;:::i;176944:1644::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;176944:1644:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;176944:1644:0;;;;;;;;:::i;25284:33::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25284:33:0;;;:::i;23601:31::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;23601:31:0;;;:::i;152476:428::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;152476:428:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;152476:428:0;;;;;;;;;;;;;;;;;:::i;144204:51::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;144204:51:0;;;:::i;:::-;;;;-1:-1:-1;;;;;144204:51:0;;;;;;;;;;;;;;148093:2192;;8:9:-1;5:2;;;30:1;27;20:12;5:2;148093:2192:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;148093:2192:0;-1:-1:-1;;;;;148093:2192:0;;:::i;199605:297::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;199605:297:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;199605:297:0;;;;;-1:-1:-1;;;;;199605:297:0;;;;;;;;;;:::i;22945:20::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;22945:20:0;;;:::i;67847:41::-;67884:4;67847:41;:::o;27318:63::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;195248:138::-;195336:42;195348:10;195359:6;195367:10;195336:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;195336:42:0;;;;;;;;;;;;;;;;;;;;;:11;:42::i;:::-;195248:138;;:::o;184190:514::-;-1:-1:-1;;;;;184286:25:0;;184261:4;184286:25;;;:7;:25;;;;;:34;;;184278:87;;;;-1:-1:-1;;;184278:87:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;184398:13;;-1:-1:-1;;;;;184398:13:0;184384:10;:27;;:50;;-1:-1:-1;184429:5:0;;-1:-1:-1;;;;;184429:5:0;184415:10;:19;184384:50;184376:102;;;;-1:-1:-1;;;184376:102:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;184511:5;;-1:-1:-1;;;;;184511:5:0;184497:10;:19;;:36;;-1:-1:-1;184529:4:0;184520:13;;;;184497:36;184489:71;;;;;-1:-1:-1;;;184489:71:0;;;;;;;;;;;;-1:-1:-1;;;184489:71:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;184573:38:0;;;;;;:20;:38;;;;;;;;;:46;;;;;-1:-1:-1;;184573:46:0;;;;;;;;184635:38;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;184635:38:0;;;;;;;;;;;;;;-1:-1:-1;184691:5:0;184190:514;;;;;:::o;185475:234::-;185555:10;-1:-1:-1;;;;;185555:16:0;;:18;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;185555:18:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;185555:18:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;185555:18:0;-1:-1:-1;;;;;185541:32:0;:10;:32;185533:84;;;;-1:-1:-1;;;185533:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;185636:10;-1:-1:-1;;;;;185636:32:0;;:34;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;185636:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;185636:34:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;185636:34:0;:39;185628:73;;;;;-1:-1:-1;;;185628:73:0;;;;;;;;;;;;-1:-1:-1;;;185628:73:0;;;;;;;;;;;;;;;185475:234;:::o;158996:460::-;;;;;;:::o;25752:32::-;;;-1:-1:-1;;;;;25752:32:0;;:::o;158062:611::-;-1:-1:-1;;;;;158329:16:0;;158213:4;158329:16;;;:7;:16;;;;;:25;;;158324:95;;-1:-1:-1;158383:23:0;158371:36;;158324:95;158468:22;;:::i;:::-;158493:47;;;;;;;;158516:7;-1:-1:-1;;;;;158508:28:0;;:30;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;158508:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;158508:30:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;158508:30:0;158493:47;;158468:72;-1:-1:-1;158551:74:0;158594:7;158603:8;158468:72;158551:42;:74::i;:::-;158650:14;158638:27;;;158062:611;;;;;;;:::o;25211:28::-;;;-1:-1:-1;;;;;25211:28:0;;:::o;23046:27::-;;;-1:-1:-1;;;;;23046:27:0;;:::o;27433:24::-;;;-1:-1:-1;;;;;27433:24:0;;:::o;26438:62::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;185098:369::-;185190:13;;185151:4;;-1:-1:-1;;;;;185190:13:0;185176:10;:27;;:50;;-1:-1:-1;185221:5:0;;-1:-1:-1;;;;;185221:5:0;185207:10;:19;185176:50;185168:102;;;;-1:-1:-1;;;185168:102:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;185303:5;;-1:-1:-1;;;;;185303:5:0;185289:10;:19;;:36;;-1:-1:-1;185321:4:0;185312:13;;;;185289:36;185281:71;;;;;-1:-1:-1;;;185281:71:0;;;;;;;;;;;;-1:-1:-1;;;185281:71:0;;;;;;;;;;;;;;;185365:19;:27;;;;;-1:-1:-1;;;185365:27:0;;-1:-1:-1;;;;185365:27:0;;;;;;;;;;185408:28;;;;;;;;;;;;;;;;;;-1:-1:-1;;;185408:28:0;;;;;;;;;;;;;;-1:-1:-1;185454:5:0;185098:369;;;;:::o;176146:423::-;176218:4;176288:5;;-1:-1:-1;;;;;176288:5:0;176274:10;:19;176266:63;;;;;-1:-1:-1;;;176266:63:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;176372:19;;;176402:44;;;;176462:59;;;;;;;;;;;;;;;;;;;;;;;;;176546:14;176541:20;176534:27;176146:423;-1:-1:-1;;;176146:423:0:o;182264:557::-;182367:5;;-1:-1:-1;;;;;182367:5:0;182353:10;:19;182345:70;;;;-1:-1:-1;;;182345:70:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;182511:17;;;-1:-1:-1;;;;;182609:40:0;;;-1:-1:-1;;;;;;182609:40:0;;;;;;;182749:64;;;182511:17;;;;182749:64;;;;;;;;;;;;;;;;;;;;;;;182264:557;;:::o;183674:508::-;-1:-1:-1;;;;;183768:25:0;;183743:4;183768:25;;;:7;:25;;;;;:34;;;183760:87;;;;-1:-1:-1;;;183760:87:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;183880:13;;-1:-1:-1;;;;;183880:13:0;183866:10;:27;;:50;;-1:-1:-1;183911:5:0;;-1:-1:-1;;;;;183911:5:0;183897:10;:19;183866:50;183858:102;;;;-1:-1:-1;;;183858:102:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;183993:5;;-1:-1:-1;;;;;183993:5:0;183979:10;:19;;:36;;-1:-1:-1;184011:4:0;184002:13;;;;183979:36;183971:71;;;;;-1:-1:-1;;;183971:71:0;;;;;;;;;;;;-1:-1:-1;;;183971:71:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;184055:36:0;;;;;;:18;:36;;;;;;;;;:44;;;;;-1:-1:-1;;184055:44:0;;;;;;;;184115:36;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;184115:36:0;;;;;;;;;;;;;;-1:-1:-1;184169:5:0;183674:508;-1:-1:-1;183674:508:0:o;25246:31::-;;;-1:-1:-1;;;25246:31:0;;;;;:::o;151659:364::-;;;;;:::o;161566:550::-;;;;;;;:::o;25932:42::-;;;;;;;;;;;;;:::o;23753:40::-;;;;:::o;26728:79::-;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;26728:79:0;;;-1:-1:-1;;;26728:79:0;;;;;:::o;199040:325::-;199124:21;:19;:21::i;:::-;199116:60;;;;;-1:-1:-1;;;199116:60:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;199187:15;199205:41;199225:1;199228:9;199239:6;199205:19;:41::i;:::-;199187:59;-1:-1:-1;199265:15:0;;199257:56;;;;;-1:-1:-1;;;199257:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;199329:28;;;-1:-1:-1;;;;;199329:28:0;;;;;;;;;;;;;;;;;;;;;;;199040:325;;;:::o;168791:411::-;168968:4;168974;168980;168998:9;169009:14;169025;169043:100;169083:7;169100:13;169116:12;169130;169043:39;:100::i;:::-;168997:146;;;;;;169167:3;169162:9;;;;;;;;169154:40;-1:-1:-1;169173:9:0;;-1:-1:-1;169184:9:0;-1:-1:-1;;168791:411:0;;;;;;;;;:::o;150765:561::-;-1:-1:-1;;;;;150960:27:0;;150854:4;150960:27;;;:18;:27;;;;;;;;150959:28;150951:55;;;;;-1:-1:-1;;;150951:55:0;;;;;;;;;;;;-1:-1:-1;;;150951:55:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;151082:16:0;;;;;;:7;:16;;;;;:25;;;151077:95;;151136:23;151131:29;151124:36;;;;151077:95;151221:59;151264:7;151273:6;151221:42;:59::i;:::-;151303:14;151291:27;150765:561;-1:-1:-1;;;;150765:561:0:o;178889:742::-;178979:4;179048:5;;-1:-1:-1;;;;;179048:5:0;179034:10;:19;179030:134;;179077:75;179082:18;179102:49;179077:4;:75::i;:::-;179070:82;;;;179030:134;179261:28;;;179357:62;;;;179494:89;;;;;;;;;;;;;;;;;;;;;;;;;179608:14;179603:20;;154131:351;154382:17;;:37;;;;;154418:1;154403:12;:16;154382:37;154378:97;;;154436:27;;;-1:-1:-1;;;154436:27:0;;;;;;;;;;;;-1:-1:-1;;;154436:27:0;;;;;;;;;;;;;;25560;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;25560:27:0;;-1:-1:-1;25560:27:0;:::o;175306:572::-;175370:4;175439:5;;-1:-1:-1;;;;;175439:5:0;175425:10;:19;175421:125;;175468:66;175473:18;175493:40;175468:4;:66::i;175421:125::-;175635:6;;;-1:-1:-1;;;;;175704:18:0;;;-1:-1:-1;;;;;;175704:18:0;;;;;;;175794:36;;;175635:6;;;;175794:36;;;;;;;;;;;;;;;;;;;;;;;175855:14;175850:20;;157240:324;;;;:::o;167409:269::-;167476:4;167482;167488;167506:9;167517:14;167533;167551:66;167591:7;167608:1;167612;167615;167551:39;:66::i;:::-;167505:112;;;;;;167643:3;167638:9;;;;;;;;167630:40;167649:9;;-1:-1:-1;167649:9:0;-1:-1:-1;167409:269:0;-1:-1:-1;;;167409:269:0:o;183059:607::-;183128:4;183163:5;;-1:-1:-1;;;;;183163:5:0;183149:10;:19;183145:127;;183192:68;183197:18;183217:42;183192:4;:68::i;183145:127::-;183363:13;;;-1:-1:-1;;;;;183449:32:0;;;-1:-1:-1;;;;;;183449:32:0;;;;;;;183569:49;;;183363:13;;;183569:49;;;183604:13;;;;183569:49;;;;;;;;;;;;;;;;183643:14;183638:20;;159912:1178;-1:-1:-1;;;;;160196:24:0;;160116:4;160196:24;;;:7;:24;;;;;:33;;;160195:34;;:74;;-1:-1:-1;;;;;;160234:26:0;;;;;;:7;:26;;;;;:35;;;160233:36;160195:74;160191:143;;;160298:23;160293:29;160286:36;;;;160191:143;160423:9;160436:14;160454:37;160482:8;160454:27;:37::i;:::-;160422:69;;-1:-1:-1;160422:69:0;;-1:-1:-1;160513:14:0;;-1:-1:-1;160506:3:0;:21;;;;;;;;;160502:70;;160556:3;160551:9;;;;;;;;160544:16;;;;;;160502:70;160586:14;160582:88;;160629:28;160624:34;;160582:88;160771:18;160800:15;-1:-1:-1;;;;;160792:44:0;;160837:8;160792:54;;;;;;;;;;;;;-1:-1:-1;;;;;160792:54:0;-1:-1:-1;;;;;160792:54:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;160792:54:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;160792:54:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;160792:54:0;160892:36;;;160792:54;160892:36;;;;;160907:19;;160892:36;;160792:54;;-1:-1:-1;160857:13:0;;160873:71;;160792:54;160873:18;:71::i;:::-;160857:87;;160973:8;160959:11;:22;160955:88;;;161010:20;160998:33;;;;;;;;160955:88;161067:14;161055:27;;;;;;159912:1178;;;;;;;;:::o;181485:609::-;181614:5;;-1:-1:-1;;;;;181614:5:0;181600:10;:19;;:54;;-1:-1:-1;181637:17:0;;-1:-1:-1;;;;;181637:17:0;181623:10;:31;181600:54;181592:120;;;;-1:-1:-1;;;181592:120:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;181744:8;181791:13;181832:15;;;;;:46;;;181865:13;181851:10;:27;181832:46;181824:72;;;;;-1:-1:-1;;;181824:72:0;;;;;;;;;;;;-1:-1:-1;;;181824:72:0;;;;;;;;;;;;;;;181913:6;181909:178;181929:10;181925:1;:14;181909:178;;;181996:13;;182010:1;181996:16;;;;;;;;;;;;;181961:10;:32;181980:8;;181989:1;181980:11;;;;;;;;;;;;;-1:-1:-1;;;;;181980:11:0;-1:-1:-1;;;;;181961:32:0;-1:-1:-1;;;;;181961:32:0;;;;;;;;;;;;:51;;;;182045:8;;182054:1;182045:11;;;;;;;;;;;;;-1:-1:-1;;;;;182045:11:0;-1:-1:-1;;;;;182032:43:0;;182058:13;;182072:1;182058:16;;;;;;;;;;;;;182032:43;;;;;;;;;;;;;;;;;;181941:3;;181909:178;;;;181485:609;;;;;;:::o;25460:52::-;;;;;;;;;;;;;;;:::o;25403:50::-;;;;;;;;;;;;;;;:::o;195606:271::-;195750:24;;;195772:1;195750:24;;;;;;;;;195714:33;;195750:24;;;;;;105:10:-1;195750:24:0;88:34:-1;136:17;;-1:-1;195750:24:0;195714:60;;195798:6;195785:7;195793:1;195785:10;;;;;;;;;;;;;:19;-1:-1:-1;;;;;195785:19:0;;;-1:-1:-1;;;;;195785:19:0;;;;;195815:54;195827:10;195839:7;195848:8;195858:4;195864;195815:11;:54::i;27146:89::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;200201:97::-;200275:15;200201:97;;:::o;23454:25::-;;;-1:-1:-1;;;;;23454:25:0;;:::o;25324:34::-;;;-1:-1:-1;;;25324:34:0;;;;;:::o;196284:1389::-;196464:1;196450:10;:15;;;;196442:49;;;;;-1:-1:-1;;;196442:49:0;;;;;;;;;;;;-1:-1:-1;;;196442:49:0;;;;;;;;;;;;;;;196507:6;196502:1164;196523:8;:15;196519:1;:19;196502:1164;;;196560:15;196578:8;196587:1;196578:11;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;196612:25:0;;;;;;:7;:25;;;;;;;:34;196578:11;;-1:-1:-1;196612:34:0;;196604:68;;;;;-1:-1:-1;;;196604:68:0;;;;;;;;;;;;-1:-1:-1;;;196604:68:0;;;;;;;;;;;;;;;196704:4;196691:17;;;;196687:531;;;196729:22;;:::i;:::-;196754:38;;;;;;;;196769:7;-1:-1:-1;;;;;196769:19:0;;:21;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;196769:21:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;196769:21:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;196769:21:0;196754:38;;196729:63;-1:-1:-1;196811:65:0;196835:10;196854:7;196729:63;196811:23;:65::i;:::-;196900:6;196895:308;196916:7;:14;196912:1;:18;196895:308;;;196960:78;196985:10;197004:7;197014;197022:1;197014:10;;;;;;;;;;;;;;197026:11;196960:24;:78::i;:::-;197101:82;197121:10;197101:82;;197133:7;197141:1;197133:10;;;;;;;;;;;;;;197145:13;:25;197159:10;197145:25;;;;;;;;;;;;;;;:37;197171:7;197179:1;197171:10;;;;;;;;;;;;;;-1:-1:-1;;;;;197145:37:0;-1:-1:-1;;;;;197145:37:0;;;;;;;;;;;;;197101:19;:82::i;:::-;197061:25;;;;;;;:13;:25;;;;;197087:10;;197061:25;;;197087:7;;197095:1;;197087:10;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;197061:37:0;;;;;;;;;;;-1:-1:-1;197061:37:0;:122;196932:3;;196895:308;;;;196687:531;;197249:4;197236:17;;;;197232:423;;;197274:52;197298:10;197317:7;197274:23;:52::i;:::-;197350:6;197345:295;197366:7;:14;197362:1;:18;197345:295;;;197410:65;197435:10;197454:7;197464;197472:1;197464:10;;;;;;;;;;;;;;197410:24;:65::i;:::-;197538:82;197558:10;197538:82;;197570:7;197578:1;197570:10;;;;;;;;;;;;;;197582:13;:25;197596:10;197582:25;;;;;;;;;;;;;;;:37;197608:7;197616:1;197608:10;;;;;;;197538:82;197498:25;;;;;;;:13;:25;;;;;197524:10;;197498:25;;;197524:7;;197532:1;;197524:10;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;197498:37:0;;;;;;;;;;;-1:-1:-1;197498:37:0;:122;197382:3;;197345:295;;;;197232:423;-1:-1:-1;196540:3:0;;196502:1164;;26932:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;24891:41::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;184712:378::-;184807:13;;184768:4;;-1:-1:-1;;;;;184807:13:0;184793:10;:27;;:50;;-1:-1:-1;184838:5:0;;-1:-1:-1;;;;;184838:5:0;184824:10;:19;184793:50;184785:102;;;;-1:-1:-1;;;184785:102:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;184920:5;;-1:-1:-1;;;;;184920:5:0;184906:10;:19;;:36;;-1:-1:-1;184938:4:0;184929:13;;;;184906:36;184898:71;;;;;-1:-1:-1;;;184898:71:0;;;;;;;;;;;;-1:-1:-1;;;184898:71:0;;;;;;;;;;;;;;;184982:22;:30;;;;;-1:-1:-1;;;184982:30:0;;-1:-1:-1;;;;184982:30:0;;;;;;;;;;185028:31;;;;;;;;;;;;;;;;;;-1:-1:-1;;;185028:31:0;;;;;;;;;;;;;;-1:-1:-1;185077:5:0;184712:378::o;145569:166::-;-1:-1:-1;;;;;145675:25:0;;;145651:4;145675:25;;;:7;:25;;;;;;;;:52;;;;;:43;;;;:52;;;;;;145569:166;;;;:::o;23923:21::-;;;;:::o;179959:737::-;180018:4;180053:5;;-1:-1:-1;;;;;180053:5:0;180039:10;:19;180035:123;;180082:64;180087:18;180107:38;180082:4;:64::i;180035:123::-;-1:-1:-1;;;;;180174:25:0;;;;;;:7;:25;;;;;:34;;;180170:142;;;180232:68;180237:27;180266:33;180232:4;:68::i;180170:142::-;180324:7;-1:-1:-1;;;;;180324:17:0;;:19;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;180324:19:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;180324:19:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;180492:68:0;;;;;;;;180510:4;180492:68;;;-1:-1:-1;180324:19:0;180492:68;;;;;;;;;;;;-1:-1:-1;;;;;180464:25:0;;;;:7;:25;;;;;;;:96;;;;;;;-1:-1:-1;;180464:96:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;180573:36;180480:7;180573:18;:36::i;:::-;180627:21;;;-1:-1:-1;;;;;180627:21:0;;;;;;;;;;;;;;;180673:14;180661:27;179959:737;-1:-1:-1;;179959:737:0:o;145114:176::-;145175:16;145204:25;145232:13;:22;145246:7;-1:-1:-1;;;;;145232:22:0;-1:-1:-1;;;;;145232:22:0;;;;;;;;;;;;145204:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;145204:50:0;;;;;;;;;;;;;;;;-1:-1:-1;145204:50:0;;145114:176;-1:-1:-1;;;;;;;145114:176:0:o;25365:31::-;;;-1:-1:-1;;;25365:31:0;;;;;:::o;200093:100::-;200139:16;200175:10;200168:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;200168:17:0;;;;;;;;;;;;;;;;;;;;;;;200093:100;:::o;23142:40::-;;;-1:-1:-1;;;;;23142:40:0;;:::o;200365:133::-;200449:5;;-1:-1:-1;;;;;200449:5:0;200435:10;:19;200427:28;;;;;;200466:9;:24;;-1:-1:-1;;;;;;200466:24:0;-1:-1:-1;;;;;200466:24:0;;;;;;;;;;200365:133::o;164964:768::-;165177:22;;165071:4;;-1:-1:-1;;;165177:22:0;;;;165176:23;165168:54;;;;;-1:-1:-1;;;165168:54:0;;;;;;;;;;;;-1:-1:-1;;;165168:54:0;;;;;;;;;;;;;;;165357:12;165372:51;165394:7;165403:3;165408:14;165372:21;:51::i;:::-;165357:66;-1:-1:-1;165438:31:0;;165434:78;;165493:7;-1:-1:-1;165486:14:0;;165434:78;165561:56;165604:7;165613:3;165561:42;:56::i;:::-;165628;165671:7;165680:3;165628:42;:56::i;146003:386::-;146068:13;146094:8;146105;:15;146094:26;;146133:21;146168:3;146157:15;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;146157:15:0;-1:-1:-1;146133:39:0;-1:-1:-1;146188:6:0;146183:172;146204:3;146200:1;:7;146183:172;;;146229:15;146255:8;146264:1;146255:11;;;;;;;;;;;;;;146229:38;;146302:40;146322:7;146331:10;146302:19;:40::i;:::-;146297:46;;;;;;;;146284:7;146292:1;146284:10;;;;;;;;;;;;;;;;;:59;-1:-1:-1;146209:3:0;;146183:172;;;-1:-1:-1;146374:7:0;146003:386;-1:-1:-1;;;146003:386:0:o;173479:1562::-;173739:6;;;:51;;;-1:-1:-1;;;173739:51:0;;-1:-1:-1;;;;;173739:51:0;;;;;;;;;;;;173617:4;;;;;;173739:6;;;:25;;:51;;;;;;;;;;;;;;;:6;:51;;;5:2:-1;;;;30:1;27;20:12;5:2;173739:51:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;173739:51:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;173739:51:0;173832:6;;;:53;;;-1:-1:-1;;;173832:53:0;;-1:-1:-1;;;;;173832:53:0;;;;;;;;;;;;173739:51;;-1:-1:-1;173801:28:0;;173832:6;;;;;:25;;:53;;;;;173739:51;;173832:53;;;;;;;;:6;:53;;;5:2:-1;;;;30:1;27;20:12;5:2;173832:53:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;173832:53:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;173832:53:0;;-1:-1:-1;173900:26:0;;;:58;;-1:-1:-1;173930:28:0;;173900:58;173896:126;;;173988:17;173975:35;-1:-1:-1;174008:1:0;;-1:-1:-1;173975:35:0;;-1:-1:-1;;173975:35:0;173896:126;174415:25;174451:17;-1:-1:-1;;;;;174443:45:0;;:47;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;174443:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;174443:47:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;174443:47:0;;-1:-1:-1;174527:16:0;174554:20;;:::i;:::-;174585:22;;:::i;:::-;174618:16;;:::i;:::-;174659:91;174664:45;;;;;;;;174679:28;;174664:45;;;174711:38;;;;;;;;174726:21;174711:38;;;174659:4;:91::i;:::-;174647:103;;174775:85;174780:40;;;;;;;;174795:23;174780:40;;;174822:37;;;;;;;;174837:20;174822:37;;;174775:4;:85::i;:::-;174761:99;;174879:28;174884:9;174895:11;174879:4;:28::i;:::-;174871:36;;174934:44;174953:5;174960:17;174934:18;:44::i;:::-;175004:14;;-1:-1:-1;174920:58:0;-1:-1:-1;;;;;;;;173479:1562:0;;;;;;;:::o;144711:34::-;144744:1;144711:34;:::o;162581:972::-;162881:19;;162775:4;;-1:-1:-1;;;162881:19:0;;;;162880:20;162872:48;;;;;-1:-1:-1;;;162872:48:0;;;;;;;;;;;;-1:-1:-1;;;162872:48:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;162997:26:0;;;;;;:7;:26;;;;;:35;;;162996:36;;:74;;-1:-1:-1;;;;;;163037:24:0;;;;;;:7;:24;;;;;:33;;;163036:34;162996:74;162992:143;;;163099:23;163094:29;;162992:143;163203:15;-1:-1:-1;;;;;163195:36:0;;:38;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;163195:38:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;163195:38:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;163195:38:0;163151:40;;;-1:-1:-1;;;163151:40:0;;;;-1:-1:-1;;;;;163151:82:0;;;;:38;;;;;:40;;;;;163195:38;;163151:40;;;;;;;:38;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;163151:40:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;163151:40:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;163151:40:0;-1:-1:-1;;;;;163151:82:0;;163147:154;;163262:26;163257:32;;163147:154;163350:71;163393:17;163412:8;163350:42;:71::i;:::-;163432:73;163475:17;163494:10;163432:42;:73::i;:::-;163530:14;163518:27;162581:972;-1:-1:-1;;;;;;162581:972:0:o;26574:80::-;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;26574:80:0;;;-1:-1:-1;;;26574:80:0;;;;;:::o;154924:2008::-;-1:-1:-1;;;;;155125:29:0;;155019:4;155125:29;;;:20;:29;;;;;;;;155124:30;155116:59;;;;;-1:-1:-1;;;155116:59:0;;;;;;;;;;;;-1:-1:-1;;;155116:59:0;;;;;;;;;;;;;;;-1:-1:-1;;;;;155193:16:0;;;;;;:7;:16;;;;;:25;;;155188:95;;155247:23;155242:29;;155188:95;-1:-1:-1;;;;;155300:16:0;;;;;;;:7;:16;;;;;;;;:44;;;;;:34;;;;:44;;;;;;155295:580;;155448:10;-1:-1:-1;;;;;155448:21:0;;;155440:56;;;;;-1:-1:-1;;;155440:56:0;;;;;;;;;;;;-1:-1:-1;;;155440:56:0;;;;;;;;;;;;;;;155567:9;155579:50;155607:10;155620:8;155579:19;:50::i;:::-;155567:62;-1:-1:-1;155655:14:0;155648:3;:21;;;;;;;;;155644:78;;155702:3;155697:9;;;;;;;;155690:16;;;;;155644:78;-1:-1:-1;;;;;155818:16:0;;;;;;;:7;:16;;;;;;;;:44;;;;;:34;;;;:44;;;;;;155811:52;;;;155295:580;;155891:6;;;:43;;;-1:-1:-1;;;155891:43:0;;-1:-1:-1;;;;;155891:43:0;;;;;;;;;;;;:6;;;;;:25;;:43;;;;;;;;;;;;;;;:6;:43;;;5:2:-1;;;;30:1;27;20:12;5:2;155891:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;155891:43:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;155891:43:0;155887:111;;155968:17;155963:23;;155887:111;-1:-1:-1;;;;;156029:19:0;;156012:14;156029:19;;;:10;:19;;;;;;156126:14;;156122:250;;156157:17;156185:7;-1:-1:-1;;;;;156177:29:0;;:31;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;156177:31:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;156177:31:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;156177:31:0;;-1:-1:-1;156223:21:0;156247:32;156177:31;156266:12;156247:4;:32::i;:::-;156223:56;;156321:9;156302:16;:28;156294:66;;;;;-1:-1:-1;;;156294:66:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;156122:250;;;156385:9;156398:14;156416:84;156456:8;156474:7;156484:1;156487:12;156416:39;:84::i;:::-;156384:116;;-1:-1:-1;156384:116:0;;-1:-1:-1;156522:14:0;;-1:-1:-1;156515:3:0;:21;;;;;;;;;156511:70;;156565:3;156560:9;;;;;;;;156553:16;;;;;;;156511:70;156595:13;;156591:87;;156637:28;156632:34;;156591:87;156727:22;;:::i;:::-;156752:47;;;;;;;;156775:7;-1:-1:-1;;;;;156767:28:0;;:30;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;156767:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;156767:30:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;156767:30:0;156752:47;;156727:72;-1:-1:-1;156810:74:0;156853:7;156862:8;156727:72;156810:42;:74::i;:::-;156909:14;156897:27;154924:2008;-1:-1:-1;;;;;;;;154924:2008:0:o;24051:50::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;24051:50:0;;-1:-1:-1;24051:50:0;;-1:-1:-1;24051:50:0:o;23252:47::-;;;-1:-1:-1;;;;;23252:47:0;;:::o;176944:1644::-;177043:4;177112:5;;-1:-1:-1;;;;;177112:5:0;177098:10;:19;177094:130;;177141:71;177146:18;177166:45;177141:4;:71::i;:::-;177134:78;;;;177094:130;-1:-1:-1;;;;;177296:25:0;;177272:21;177296:25;;;:7;:25;;;;;177337:15;;;;177332:130;;177376:74;177381:23;177406:43;177376:4;:74::i;:::-;177369:81;;;;;177332:130;177474:33;;:::i;:::-;-1:-1:-1;177510:44:0;;;;;;;;;;;;177610:20;;:::i;:::-;-1:-1:-1;177633:44:0;;;;;;;;;144641:6;177633:44;;177692:46;177633:44;177715:22;177692:11;:46::i;:::-;177688:169;;;177762:83;177767:31;177800:44;177762:4;:83::i;:::-;177755:90;;;;;;;177688:169;177931:32;;;;;:75;;-1:-1:-1;177967:6:0;;;:34;;;-1:-1:-1;;;177967:34:0;;-1:-1:-1;;;;;177967:34:0;;;;;;;;;;;;:6;;;;;:25;;:34;;;;;;;;;;;;;;;:6;:34;;;5:2:-1;;;;30:1;27;20:12;5:2;177967:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;177967:34:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;177967:34:0;:39;177931:75;177927:187;;;178030:72;178035:17;178054:47;178030:4;:72::i;177927:187::-;178249:31;;;;;178291:61;;;;178454:86;;;-1:-1:-1;;;;;178454:86:0;;;;;;;;;;;;;;;;;;;;;;;;;;;178565:14;178553:27;176944:1644;-1:-1:-1;;;;;;;176944:1644:0:o;25284:33::-;;;-1:-1:-1;;;25284:33:0;;;;;:::o;23601:31::-;;;;:::o;152476:428::-;152571:4;152588:12;152603:54;152625:7;152634:8;152644:12;152603:21;:54::i;:::-;152588:69;-1:-1:-1;152672:31:0;;152668:78;;152727:7;-1:-1:-1;152720:14:0;;152668:78;152795:61;152838:7;152847:8;152795:42;:61::i;:::-;152881:14;152869:27;152476:428;-1:-1:-1;;;;;152476:428:0:o;144204:51::-;144251:4;144204:51;:::o;148093:2192::-;148155:4;148172:15;148198:14;148172:41;;148305:9;148316:15;148333;148354:7;-1:-1:-1;;;;;148354:26:0;;148381:10;148354:38;;;;;;;;;;;;;-1:-1:-1;;;;;148354:38:0;-1:-1:-1;;;;;148354:38:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;148354:38:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;148354:38:0;;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;148354:38:0;;;;;;;;;;;;;-1:-1:-1;148354:38:0;;-1:-1:-1;148354:38:0;-1:-1:-1;148411:9:0;;148403:59;;;;-1:-1:-1;;;148403:59:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;148560:15;;148556:127;;148599:72;148604:28;148634:36;148599:4;:72::i;:::-;148592:79;;;;;;;;148556:127;148776:12;148791:61;148813:14;148829:10;148841;148791:21;:61::i;:::-;148776:76;-1:-1:-1;148867:12:0;;148863:123;;148903:71;148914:15;148931:33;148966:7;148903:10;:71::i;:::-;148896:78;;;;;;;;;148863:123;-1:-1:-1;;;;;149028:25:0;;148998:27;149028:25;;;:7;:25;;;;;;;;149178:10;149147:42;;:30;;;:42;;;;;;;;;149142:103;;149218:14;149206:27;;;;;;;;;;149142:103;149350:10;149319:42;;;;:30;;;:42;;;;;;;;149312:49;;-1:-1:-1;;149312:49:0;;;149523:13;:25;;;;;;149490:58;;;;;;;;;;;;;;;;;:30;;:58;;;149523:25;149490:58;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;149490:58:0;;;;;;;;;;;;;;;;-1:-1:-1;;149570:20:0;;149490:58;;-1:-1:-1;149570:20:0;;-1:-1:-1;149559:8:0;;-1:-1:-1;;149633:163:0;149654:3;149650:1;:7;149633:163;;;149703:7;-1:-1:-1;;;;;149683:27:0;:13;149697:1;149683:16;;;;;;;;;;;;;;-1:-1:-1;;;;;149683:27:0;;149679:106;;;149744:1;149731:14;;149764:5;;149679:106;149659:3;;149633:163;;;;149925:3;149912:10;:16;149905:24;;;;150076:10;150031:28;150062:25;;;:13;:25;;;;;150134:17;;150062:25;;-1:-1:-1;;150134:21:0;;;150123:33;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;150123:33:0;150098:10;150109;150098:22;;;;;;;;;;;;;;;;;:58;;-1:-1:-1;;;;;;150098:58:0;-1:-1:-1;;;;;150098:58:0;;;;;;;;;;150167:19;;;;-1:-1:-1;;150167:19:0;;;:::i;:::-;-1:-1:-1;150204:33:0;;;-1:-1:-1;;;;;150204:33:0;;;;150226:10;150204:33;;;;;;;;;;;;;;;;;150262:14;150250:27;148093:2192;-1:-1:-1;;;;;;;;;;;;148093:2192:0:o;199605:297::-;199723:1;199709:10;:15;;;;199701:49;;;;;-1:-1:-1;;;199701:49:0;;;;;;;;;;;;-1:-1:-1;;;199701:49:0;;;;;;;;;;;;;;;199770:21;:19;:21::i;:::-;199762:65;;;;;-1:-1:-1;;;199762:65:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;199838:56;199861:10;199873:7;199882:11;199838:22;:56::i;22945:20::-;;;-1:-1:-1;;;;;22945:20:0;;:::o;193171:381::-;193313:16;193308:237;193349:1;193335:10;:15;;;193308:237;;193381:63;193405:10;193417:7;193426:17;193381:23;:63::i;:::-;193459:74;193484:10;193496:7;193505:8;193515:17;193459:24;:74::i;:::-;193352:12;;193308:237;;185827:148;185881:4;185919:5;;-1:-1:-1;;;;;185919:5:0;185905:10;:19;;:62;;-1:-1:-1;185942:25:0;;-1:-1:-1;;;;;185942:25:0;185928:10;:39;185905:62;185898:69;;185827:148;:::o;198035:664::-;198134:4;198155:15;198151:517;;198201:9;;198245:30;;;-1:-1:-1;;;198245:30:0;;198269:4;198245:30;;;;;;-1:-1:-1;;;;;198201:9:0;;;;198187:8;;198201:9;;198245:15;;:30;;;;;;;;;;;;;;;198201:9;198245:30;;;5:2:-1;;;;30:1;27;20:12;5:2;198245:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;198245:30:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;198245:30:0;;-1:-1:-1;198294:10:0;;;;;:35;;;198318:11;198308:6;:21;;198294:35;198290:131;;;198350:5;-1:-1:-1;;;;;198350:14:0;;198365:4;198371:6;198350:28;;;;;;;;;;;;;-1:-1:-1;;;;;198350:28:0;-1:-1:-1;;;;;198350:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;198350:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;198350:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;198404:1:0;;-1:-1:-1;198397:8:0;;-1:-1:-1;;;198397:8:0;198290:131;198151:517;;;;;198442:10;198456:1;198442:15;198438:230;;;198495:21;198535:10;;;;;:37;;;198559:13;198549:6;:23;;198535:37;198531:126;;;198593:21;;-1:-1:-1;;;;;198593:13:0;;;:21;;;;;198607:6;;198593:21;;;;198607:6;198593:13;:21;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;198593:21:0;198640:1;198633:8;;;;;198531:126;198438:230;;-1:-1:-1;198685:6:0;198035:664;-1:-1:-1;;198035:664:0:o;169983:2950::-;170170:5;170177:4;170183;170202:37;;:::i;:::-;-1:-1:-1;;;;;170380:22:0;;170287:9;170380:22;;;:13;:22;;;;;;;;170354:48;;;;;;;;;;;;;;;;;:23;;:48;;170380:22;170354:48;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;170354:48:0;;;;;;;;;;;;;;;;-1:-1:-1;170354:48:0;;-1:-1:-1;170418:6:0;;-1:-1:-1;;;;170413:2169:0;170434:6;:13;170430:1;:17;170413:2169;;;170469:13;170485:6;170492:1;170485:9;;;;;;;;;;;;;;170469:25;;170657:5;-1:-1:-1;;;;;170657:24:0;;170682:7;170657:33;;;;;;;;;;;;;-1:-1:-1;;;;;170657:33:0;-1:-1:-1;;;;;170657:33:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;170657:33:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;170657:33:0;;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;170657:33:0;;;;;;;;;;;;;;;;;170628:25;;170580:110;170608:18;;;170580:110;;;;170587:19;;;170580:110;;;;170657:33;-1:-1:-1;170709:9:0;;170705:166;;-1:-1:-1;170828:20:0;;-1:-1:-1;170850:1:0;;-1:-1:-1;170850:1:0;;-1:-1:-1;170820:35:0;;-1:-1:-1;;;;170820:35:0;170705:166;170909:65;;;;;;;;;-1:-1:-1;;;;;170924:23:0;;;-1:-1:-1;170924:23:0;;;:7;:23;;;;;:48;;;170909:65;;170885:21;;;:89;;;;171009:42;;;;;;;-1:-1:-1;;;171024:25:0;171009:42;;170989:17;;;:62;171149:6;;;:32;;-1:-1:-1;;;171149:32:0;;;;;;;;;;;:6;;;:25;;:32;;;;;170909:65;171149:32;;;;;:6;:32;;;5:2:-1;;;;30:1;27;20:12;5:2;171149:32:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;171149:32:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;171149:32:0;171122:24;;;:59;;;171196:102;;-1:-1:-1;171258:17:0;;-1:-1:-1;171277:1:0;;-1:-1:-1;171277:1:0;;-1:-1:-1;171250:32:0;;-1:-1:-1;;;;171250:32:0;171196:102;171331:41;;;;;;;;;171346:24;;;;171331:41;;171312:16;;;:60;171513:21;;;;171536:17;;;;171503:70;;171508:46;;:4;:46::i;:::-;171556:4;:16;;;171503:4;:70::i;:::-;171482:18;;;:91;;;171721:19;;;;171742:18;;171675:86;;171482:91;171721:19;171675:25;:86::i;:::-;171654:107;;171900:16;;;;171918:18;;;;171938:25;;;;171874:90;;171900:16;171918:18;171874:25;:90::i;:::-;171846:25;;;:118;-1:-1:-1;;;;;172053:22:0;;;;;;;172049:522;;;172231:86;172257:4;:18;;;172277:12;172291:4;:25;;;172231;:86::i;:::-;172203:25;;;:114;;;172497:16;;;;172471:84;;172515:12;;172471:25;:84::i;:::-;172443:25;;;:112;172049:522;-1:-1:-1;170449:3:0;;170413:2169;;;-1:-1:-1;172691:25:0;;;;172670:18;;:46;172666:260;;;-1:-1:-1;;172778:25:0;;;;172757:18;;172741:14;;-1:-1:-1;172757:46:0;;-1:-1:-1;172741:14:0;;-1:-1:-1;172733:74:0;;172666:260;-1:-1:-1;;172895:18:0;;172867:25;;;;;172848:14;;-1:-1:-1;172848:14:0;;-1:-1:-1;172867:46:0;;-1:-1:-1;172840:74:0;;191191:311;191302:16;191297:198;191338:1;191324:10;:15;;;191297:198;;191370:44;191394:10;191406:7;191370:23;:44::i;:::-;191429:54;191454:10;191466:7;191475;191429:24;:54::i;:::-;191341:12;;191297:198;;16630:153;16691:4;16713:33;16726:3;16721:9;;;;;;;;16737:4;16732:10;;;;;;;;16713:33;;;;;;;;;;;;;16744:1;16713:33;;;;;;;;;;;;;16771:3;16766:9;;;;;;;167965:188;168042:5;168049:4;168055;168079:66;168119:7;168136:1;168140;168143;168079:39;:66::i;:::-;168072:73;;;;;;167965:188;;;;;:::o;37722:174::-;37800:4;37817:18;;:::i;:::-;37838:15;37843:1;37846:6;37838:4;:15::i;:::-;37817:36;;37871:17;37880:7;37871:8;:17::i;189673:1281::-;189813:1;189799:10;:15;;;;189791:49;;;;;-1:-1:-1;;;189791:49:0;;;;;;;;;;;;-1:-1:-1;;;189791:49:0;;;;;;;;;;;;;;;189892:29;;;189852:37;189892:29;;;:17;:29;;;;;;;;-1:-1:-1;;;;;189892:38:0;;;;;;;;;;;189960:24;;;:12;:24;;;;;:33;;;;;;;;;;190026:19;:17;:19::i;:::-;190105:21;;190004:41;;-1:-1:-1;190056:20:0;;190079:49;;190004:41;;-1:-1:-1;;;190105:21:0;;;;190079:4;:49::i;:::-;190056:72;;190161:1;190143:15;:19;:38;;;;;190180:1;190166:11;:15;190143:38;190139:808;;;190198:17;190218:56;190231:7;-1:-1:-1;;;;;190223:29:0;;:31;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;190223:31:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;190223:31:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;190223:31:0;190256:17;190218:4;:56::i;:::-;190198:76;;190289:14;190306:34;190311:15;190328:11;190306:4;:34::i;:::-;190289:51;;190355:19;;:::i;:::-;190392:1;190377:12;:16;:76;;190432:21;;;;;;;;190450:1;190432:21;;;190377:76;;;190396:33;190405:9;190416:12;190396:8;:33::i;:::-;190355:98;;190468:19;;:::i;:::-;190495:37;;;;;;;;;190513:17;;-1:-1:-1;;;;;190513:17:0;190495:37;;190490:50;;190534:5;190490:4;:50::i;:::-;190468:72;;190596:200;;;;;;;;190640:53;190648:5;:14;;;190640:53;;;;;;;;;;;;;;;;;:7;:53::i;:::-;-1:-1:-1;;;;;190596:200:0;;;;;190723:57;190730:14;190723:57;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;190723:57:0;;;:6;:57::i;:::-;190596:200;;;;;190555:17;:29;190573:10;190555:29;;;;;;;;;;;;;;;:38;190585:7;-1:-1:-1;;;;;190555:38:0;-1:-1:-1;;;;;190555:38:0;;;;;;;;;;;;:241;;;;;;;;;;;;;-1:-1:-1;;;;;190555:241:0;;;;;-1:-1:-1;;;;;190555:241:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;190139:808;;;;;;;190818:19;;190814:133;;190878:57;190885:14;190878:57;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;190878:57:0;;;:6;:57::i;:::-;190854:81;;;;;;;-1:-1:-1;;;190854:81:0;-1:-1:-1;;;;;190854:81:0;;;;;;189673:1281;;;;;;;:::o;193954:1146::-;194113:1;194099:10;:15;;;;194091:49;;;;;-1:-1:-1;;;194091:49:0;;;;;;;;;;;;-1:-1:-1;;;194091:49:0;;;;;;;;;;;;;;;194192:30;;;194152:37;194192:30;;;:17;:30;;;;;;;;-1:-1:-1;;;;;194192:39:0;;;;;;;;;194242:25;;:::i;:::-;-1:-1:-1;194270:37:0;;;;;;;;;194288:17;;-1:-1:-1;;;;;194288:17:0;194270:37;;194318:27;;:::i;:::-;-1:-1:-1;194348:70:0;;;;;;;;;194366:31;;;-1:-1:-1;194366:31:0;;;:19;:31;;;;;-1:-1:-1;;;;;194366:40:0;;;;;;;;;;;:50;;;;;;;;;;;;;;194348:70;;194482:20;;194429:50;;;;;;;:73;;;;194519:22;;:26;194515:578;;194562:24;;:::i;:::-;194589:32;194594:11;194607:13;194589:4;:32::i;:::-;194562:59;;194636:19;194658:71;194671:7;-1:-1:-1;;;;;194663:36:0;;194700:8;194663:46;;;;;;;;;;;;;-1:-1:-1;;;;;194663:46:0;-1:-1:-1;;;;;194663:46:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;194658:71:0;194636:93;;194744:18;194765:32;194770:14;194786:10;194765:4;:32::i;:::-;194840:25;;;194812:20;194840:25;;;:13;:25;;;;;;;;-1:-1:-1;;;;;194840:35:0;;;;;;;;;;194744:53;;-1:-1:-1;194812:20:0;194835:56;;194744:53;194835:4;:56::i;:::-;194812:79;;194944:15;194906:13;:25;194920:10;194906:25;;;;;;;;;;;;;;;:35;194932:8;-1:-1:-1;;;;;194906:35:0;-1:-1:-1;;;;;194906:35:0;;;;;;;;;;;;:53;;;;195035:8;-1:-1:-1;;;;;194979:102:0;195025:7;-1:-1:-1;;;;;194979:102:0;195005:10;194979:102;;;195045:13;195060:11;:20;;;194979:102;;;;;;;;;;;;;;;;;;;;;;;;194515:578;;;;193954:1146;;;;;;;:::o;188245:1225::-;188355:1;188341:10;:15;;;;188333:49;;;;;-1:-1:-1;;;188333:49:0;;;;;;;;;;;;-1:-1:-1;;;188333:49:0;;;;;;;;;;;;;;;188434:29;;;188394:37;188434:29;;;:17;:29;;;;;;;;-1:-1:-1;;;;;188434:38:0;;;;;;;;;;;188502:24;;;:12;:24;;;;;:33;;;;;;;;;;188568:19;:17;:19::i;:::-;188647:21;;188546:41;;-1:-1:-1;188598:20:0;;188621:49;;188546:41;;-1:-1:-1;;;188647:21:0;;;;188621:4;:49::i;:::-;188598:72;;188703:1;188685:15;:19;:38;;;;;188722:1;188708:11;:15;188685:38;188681:782;;;188740:17;188768:7;-1:-1:-1;;;;;188760:28:0;;:30;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;188760:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;188760:30:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;188760:30:0;;-1:-1:-1;188805:14:0;188822:34;188827:15;188844:11;188822:4;:34::i;:::-;188805:51;;188871:19;;:::i;:::-;188908:1;188893:12;:16;:76;;188948:21;;;;;;;;188966:1;188948:21;;;188893:76;;;188912:33;188921:9;188932:12;188912:8;:33::i;:::-;188871:98;;188984:19;;:::i;:::-;189011:37;;;;;;;;;189029:17;;-1:-1:-1;;;;;189029:17:0;189011:37;;189006:50;;189050:5;189006:4;:50::i;:::-;188984:72;;189112:200;;;;;;;;189156:53;189164:5;:14;;;189156:53;;;;;;;;;;;;;;;;;:7;:53::i;:::-;-1:-1:-1;;;;;189112:200:0;;;;;189239:57;189246:14;189239:57;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;189239:57:0;;;:6;:57::i;:::-;189112:200;;;;;;;189071:29;;;;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;189071:38:0;;;;;;;;;:241;;;;;;;;;;;;-1:-1:-1;;;189071:241:0;-1:-1:-1;;;;;189071:241:0;;;-1:-1:-1;;;;;;189071:241:0;;;;;;;;;;;;;;-1:-1:-1;188681:782:0;;-1:-1:-1;;;188681:782:0;;189334:19;;189330:133;;189394:57;189401:14;189394:57;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;189394:57:0;;;:6;:57::i;:::-;189370:81;;;;;;;-1:-1:-1;;;189370:81:0;-1:-1:-1;;;;;189370:81:0;;;;;;188245:1225;;;;;;:::o;191808:1147::-;191937:1;191923:10;:15;;;;191915:49;;;;;-1:-1:-1;;;191915:49:0;;;;;;;;;;;;-1:-1:-1;;;191915:49:0;;;;;;;;;;;;;;;192016:29;;;191976:37;192016:29;;;:17;:29;;;;;;;;-1:-1:-1;;;;;192016:38:0;;;;;;;;;192065:25;;:::i;:::-;-1:-1:-1;192093:37:0;;;;;;;;;192111:17;;-1:-1:-1;;;;;192111:17:0;192093:37;;192141:27;;:::i;:::-;-1:-1:-1;192171:70:0;;;;;;;;;192189:31;;;-1:-1:-1;192189:31:0;;;:19;:31;;;;;-1:-1:-1;;;;;192189:40:0;;;;;;;;;;;:50;;;;;;;;;;;;;;192171:70;;192305:20;;192252:50;;;;;;;:73;;;;192342:22;;:27;:55;;;;-1:-1:-1;192373:20:0;;:24;;192342:55;192338:133;;;144251:4;192414:45;;192338:133;192483:24;;:::i;:::-;192510:32;192515:11;192528:13;192510:4;:32::i;:::-;192483:59;;192553:19;192583:7;-1:-1:-1;;;;;192575:26:0;;192602:8;192575:36;;;;;;;;;;;;;-1:-1:-1;;;;;192575:36:0;-1:-1:-1;;;;;192575:36:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;192575:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;192575:36:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;192575:36:0;;-1:-1:-1;192622:18:0;192643:32;192575:36;192664:10;192643:4;:32::i;:::-;192714:25;;;192686:20;192714:25;;;:13;:25;;;;;;;;-1:-1:-1;;;;;192714:35:0;;;;;;;;;;192622:53;;-1:-1:-1;192686:20:0;192709:56;;192622:53;192709:4;:56::i;:::-;192776:25;;;;;;;:13;:25;;;;;;;;-1:-1:-1;;;;;192776:35:0;;;;;;;;;;;;;:53;;;192926:20;;192845:102;;;;;;;;;;;192686:79;;-1:-1:-1;192776:35:0;192845:102;;;;192776:25;192845:102;;;;;;;;;;191808:1147;;;;;;;;;;:::o;180704:255::-;180774:6;180769:139;180790:10;:17;180786:21;;180769:139;;;180863:7;-1:-1:-1;;;;;180838:33:0;:10;180849:1;180838:13;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;180838:13:0;:33;;180830:66;;;;;-1:-1:-1;;;180830:66:0;;;;;;;;;;;;-1:-1:-1;;;180830:66:0;;;;;;;;;;;;;;;180809:4;;180769:139;;;-1:-1:-1;180918:10:0;27::-1;;39:1;23:18;;45:23;;-1:-1;180918:33:0;;;;;;;;-1:-1:-1;;;;;;180918:33:0;-1:-1:-1;;;;;180918:33:0;;;;;;;;;;180704:255::o;152912:876::-;-1:-1:-1;;;;;153042:16:0;;153020:4;153042:16;;;:7;:16;;;;;:25;;;153037:95;;153096:23;153091:29;;153037:95;-1:-1:-1;;;;;153243:16:0;;;;;;;:7;:16;;;;;;;;:44;;;;;:34;;;;:44;;;;;;153238:105;;153316:14;153311:20;;153238:105;153448:9;153461:14;153479:84;153519:8;153537:7;153547:12;153561:1;153479:39;:84::i;:::-;153447:116;;-1:-1:-1;153447:116:0;;-1:-1:-1;153585:14:0;;-1:-1:-1;153578:3:0;:21;;;;;;;;;153574:70;;153628:3;153623:9;;;;;;;;153616:16;;;;;;153574:70;153658:13;;153654:87;;153700:28;153695:34;;146676:1023;-1:-1:-1;;;;;146806:25:0;;146758:5;146806:25;;;:7;:25;;;;;146849:21;;;;146844:135;;146944:23;146937:30;;;;;146844:135;-1:-1:-1;;;;;146995:40:0;;;;;;:30;;;:40;;;;;;;;:48;;:40;:48;146991:133;;;147098:14;147091:21;;;;;146991:133;-1:-1:-1;;;;;147512:40:0;;;;;;;:30;;;:40;;;;;;;;:47;;-1:-1:-1;;147512:47:0;147555:4;147512:47;;;;;;147570:13;:23;;;;;27:10:-1;;23:18;;;45:23;;147570:37:0;;;;;;;;;;;;;;-1:-1:-1;;;;;;147570:37:0;;;;;;;147625:32;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;147677:14:0;;146676:1023;-1:-1:-1;;;146676:1023:0:o;40699:159::-;40764:10;;:::i;:::-;40794:56;;;;;;;;37000:4;40809:28;40814:1;:10;;;40826:1;:10;;;40809:4;:28::i;:::-;:39;;;;;;40794:56;;40787:63;40699:159;-1:-1:-1;;;40699:159:0:o;41991:164::-;42056:10;;:::i;:::-;42086:61;;;;;;;;42101:44;42106:26;42111:1;:10;;;37000:4;42106;:26::i;:::-;42134:10;;42101:4;:44::i;:::-;42086:61;;42079:68;41991:164;-1:-1:-1;;;41991:164:0:o;39770:116::-;39823:4;39847:31;39852:1;39855;39847:31;;;;;;;;;;;;;-1:-1:-1;;;39847:31:0;;;:4;:31::i;38333:141::-;38452:14;38436:13;;:30;;38333:141::o;16906:187::-;16991:4;17013:43;17026:3;17021:9;;;;;;;;17037:4;17032:10;;;;;;;;17013:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;17081:3;17076:9;;;;;;;186257:1785;186385:24;;;186359:23;186385:24;;;:12;:24;;;;;;;;-1:-1:-1;;;;;186385:42:0;;;;;;;;;;186442:23;;186438:1406;;186577:22;;:::i;:::-;186602:38;;;;;;;;186617:7;-1:-1:-1;;;;;186617:19:0;;:21;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;186617:21:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;186617:21:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;186617:21:0;186602:38;;186577:63;-1:-1:-1;186655:52:0;186679:10;186698:7;186655:23;:52::i;:::-;186722:65;186746:10;186765:7;186775:11;186722:23;:65::i;:::-;186438:1406;;;;186809:13;;186805:1039;;-1:-1:-1;;;;;186900:25:0;;186876:21;186900:25;;;:7;:25;;;;;186948:15;;;;:23;;:15;:23;186940:62;;;;;-1:-1:-1;;;186940:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;187023:29;;;;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;187023:47:0;;;;;;;;;:53;-1:-1:-1;;;;;187023:53:0;:58;:124;;;;-1:-1:-1;187085:29:0;;;;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;187085:47:0;;;;;;;;;:57;-1:-1:-1;;;187085:57:0;;;;:62;187023:124;187019:399;;;187218:184;;;;;;;;144251:4;-1:-1:-1;;;;;187218:184:0;;;;;187320:62;187327:19;:17;:19::i;:::-;187320:62;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;187320:62:0;;;:6;:62::i;:::-;187218:184;;;;;;;187168:29;;;;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;187168:47:0;;;;;;;;;:234;;;;;;;;;;;;-1:-1:-1;;;187168:234:0;-1:-1:-1;;;;;187168:234:0;;;-1:-1:-1;;;;;;187168:234:0;;;;;;;;;;;;;;187019:399;187438:29;;;;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;187438:47:0;;;;;;;;;:53;-1:-1:-1;;;;;187438:53:0;:58;:124;;;;-1:-1:-1;187500:29:0;;;;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;187500:47:0;;;;;;;;;:57;-1:-1:-1;;;187500:57:0;;;;:62;187438:124;187434:399;;;187633:184;;;;;;;;144251:4;-1:-1:-1;;;;;187633:184:0;;;;;187735:62;187742:19;:17;:19::i;187735:62::-;187633:184;;;;;;;187583:29;;;;;;;:17;:29;;;;;;;;-1:-1:-1;;;;;187583:47:0;;;;;;;;;:234;;;;;;;;;;;;-1:-1:-1;;;187583:234:0;-1:-1:-1;;;;;187583:234:0;;;-1:-1:-1;;;;;;187583:234:0;;;;;;;;;;;;;;187434:399;186805:1039;;187882:8;187860:18;:30;187856:179;;187907:24;;;;;;;:12;:24;;;;;;;;-1:-1:-1;;;;;187907:42:0;;;;;;;;;;;;:53;;;187980:43;;;;;;;;;;;;;187907:42;;187980:43;;;;;;;;;;;186257:1785;;;;:::o;38041:208::-;38139:4;38156:18;;:::i;:::-;38177:15;38182:1;38185:6;38177:4;:15::i;:::-;38156:36;;38210:31;38215:17;38224:7;38215:8;:17::i;:::-;38234:6;38210:4;:31::i;40866:133::-;40925:10;;:::i;:::-;40955:36;;;;;;;;40970:19;40975:1;:10;;;40987:1;40970:4;:19::i;37396:213::-;37578:12;37000:4;37578:23;;;37396:213::o;40405:120::-;40458:4;40482:35;40487:1;40490;40482:35;;;;;;;;;;;;;-1:-1:-1;;;40482:35:0;;;:4;:35::i;42304:126::-;42363:4;42387:35;42392:17;42397:1;37000:4;42392;:17::i;:::-;42411:10;;42387:4;:35::i;41603:122::-;41656:4;41680:37;41685:1;41688;41680:37;;;;;;;;;;;;;;;;;:4;:37::i;43201:147::-;43258:13;;:::i;:::-;43291:49;;;;;;;;43309:29;43314:20;43319:1;37039:4;43314;:20::i;:::-;43336:1;43309:4;:29::i;39602:160::-;39673:13;;:::i;:::-;39706:48;;;;;;;;39724:28;39729:1;:10;;;39741:1;:10;;;39724:4;:28::i;39104:165::-;39180:7;39220:12;-1:-1:-1;;;39208:10:0;;39200:33;;;;-1:-1:-1;;;39200: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;39200:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;39259:1:0;;39104:165;-1:-1:-1;;39104:165:0:o;39277:161::-;39352:6;39390:12;-1:-1:-1;;;39379:9:0;;39371:32;;;;-1:-1:-1;;;39371:32:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;40237:160:0;40308:13;;:::i;:::-;40341:48;;;;;;;;40359:28;40364:1;:10;;;40376:1;:10;;;40359:4;:28::i;41468:127::-;41530:4;37039;41554:19;41559:1;41562;:10;;;41554:4;:19::i;:::-;:33;;;;;;;41468:127;-1:-1:-1;;;41468:127:0:o;42915:113::-;42968:4;42992:28;42997:1;43000;42992:28;;;;;;;;;;;;;-1:-1:-1;;;42992:28:0;;;:4;:28::i;39894:179::-;39975:4;40001:5;;;40033:12;40025:6;;;;40017:29;;;;-1:-1:-1;;;40017:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;40017:29:0;-1:-1:-1;40064:1:0;39894:179;-1:-1:-1;;;;39894:179:0:o;40533:158::-;40614:4;40647:12;40639:6;;;;40631:29;;;;-1:-1:-1;;;40631:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;40631:29:0;-1:-1:-1;;;40678:5:0;;;40533:158::o;41733:250::-;41814:4;41835:6;;;:16;;-1:-1:-1;41845:6:0;;41835:16;41831:57;;;-1:-1:-1;41875:1:0;41868:8;;41831:57;41907:5;;;41911:1;41907;:5;:1;41931:5;;;;;:10;41943:12;41923:33;;;;;-1:-1:-1;;;41923:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;43036:157:0;43117:4;43149:12;43142:5;43134:28;;;;-1:-1:-1;;;43134:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;43134:28:0;;43184:1;43180;:5;;;;;;;43036:157;-1:-1:-1;;;;43036:157:0:o;141450:59170::-;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;
Swarm Source
bzzr://1cfaae6e77026b21602c3de8780a5729642ad7e0af45c6d06a71bf5e74733454
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.