Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CErc20Delegate
Compiler Version
v0.5.17+commit.d19bba13
Contract Source Code (Solidity Multiple files format)
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Delegate Contract
* @notice CTokens which wrap an EIP-20 underlying and are delegated to
* @author Compound
*/
contract CErc20Delegate is CDelegateInterface, CErc20 {
/**
* @notice Construct an empty delegate
*/
constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function _becomeImplementation(bytes memory data) public {
// Shh -- currently unused
data;
// Shh -- we don't ever want this hook to be marked pure
if (false) {
implementation = address(0);
}
require(hasAdminRights(), "only the admin may call _becomeImplementation");
}
/**
* @notice Called by the delegator on a delegate to forfeit its responsibility
*/
function _resignImplementation() public {
// Shh -- we don't ever want this hook to be marked pure
if (false) {
implementation = address(0);
}
require(hasAdminRights(), "only the admin may call _resignImplementation");
}
}
pragma solidity ^0.5.16;
/**
* @title Careful Math
* @author Compound
* @notice Derived from OpenZeppelin's SafeMath library
* https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract CarefulMath {
/**
* @dev Possible error codes that we can return
*/
enum MathError {
NO_ERROR,
DIVISION_BY_ZERO,
INTEGER_OVERFLOW,
INTEGER_UNDERFLOW
}
/**
* @dev Multiplies two numbers, returns an error on overflow.
*/
function mulUInt(uint a, uint b) internal pure returns (MathError, uint) {
if (a == 0) {
return (MathError.NO_ERROR, 0);
}
uint c = a * b;
if (c / a != b) {
return (MathError.INTEGER_OVERFLOW, 0);
} else {
return (MathError.NO_ERROR, c);
}
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function divUInt(uint a, uint b) internal pure returns (MathError, uint) {
if (b == 0) {
return (MathError.DIVISION_BY_ZERO, 0);
}
return (MathError.NO_ERROR, a / b);
}
/**
* @dev Subtracts two numbers, returns an error on overflow (i.e. if subtrahend is greater than minuend).
*/
function subUInt(uint a, uint b) internal pure returns (MathError, uint) {
if (b <= a) {
return (MathError.NO_ERROR, a - b);
} else {
return (MathError.INTEGER_UNDERFLOW, 0);
}
}
/**
* @dev Adds two numbers, returns an error on overflow.
*/
function addUInt(uint a, uint b) internal pure returns (MathError, uint) {
uint c = a + b;
if (c >= a) {
return (MathError.NO_ERROR, c);
} else {
return (MathError.INTEGER_OVERFLOW, 0);
}
}
/**
* @dev add a and b and then subtract c
*/
function addThenSubUInt(uint a, uint b, uint c) internal pure returns (MathError, uint) {
(MathError err0, uint sum) = addUInt(a, b);
if (err0 != MathError.NO_ERROR) {
return (err0, 0);
}
return subUInt(sum, c);
}
}pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @dev This contract should not to be deployed on its own; instead, deploy:
* 1) `CErc20Delegator` (proxy contract) and `CErc20Delegate` (logic/implementation contract).
* 2) `CErc20Immutable` to deploy without the proxy storage pattern.
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlying asset
* @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_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
*/
function initialize(address underlying_,
ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 reserveFactorMantissa_,
uint256 adminFeeMantissa_) public {
// CToken initialize does the bulk of the work
super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_, reserveFactorMantissa_, adminFeeMantissa_);
// Set underlying and sanity check it
underlying = underlying_;
EIP20Interface(underlying).totalSupply();
}
/*** User Interface ***/
/**
* @notice Sender supplies assets into the market and receives cTokens in exchange
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param mintAmount The amount of the underlying asset to supply
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function mint(uint mintAmount) external returns (uint) {
(uint err,) = mintInternal(mintAmount);
return err;
}
/**
* @notice Sender redeems cTokens in exchange for the underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemTokens The number of cTokens to redeem into underlying
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeem(uint redeemTokens) external returns (uint) {
return redeemInternal(redeemTokens);
}
/**
* @notice Sender redeems cTokens in exchange for a specified amount of underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemAmount The amount of underlying to redeem
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeemUnderlying(uint redeemAmount) external returns (uint) {
return redeemUnderlyingInternal(redeemAmount);
}
/**
* @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 borrow(uint borrowAmount) external returns (uint) {
return borrowInternal(borrowAmount);
}
/**
* @notice Sender repays their own borrow
* @param repayAmount The amount to repay
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function repayBorrow(uint repayAmount) external returns (uint) {
(uint err,) = repayBorrowInternal(repayAmount);
return err;
}
/**
* @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 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint) {
(uint err,) = repayBorrowBehalfInternal(borrower, repayAmount);
return err;
}
/**
* @notice The sender liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @param borrower The borrower of this cToken to be liquidated
* @param repayAmount The amount of the underlying borrowed asset to repay
* @param cTokenCollateral The market in which to seize collateral from the borrower
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function liquidateBorrow(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) external returns (uint) {
(uint err,) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);
return err;
}
/**
* @notice The sender adds to reserves.
* @param addAmount The amount fo underlying token to add as reserves
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _addReserves(uint addAmount) external returns (uint) {
return _addReservesInternal(addAmount);
}
/*** 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 tokens owned by this contract
*/
function getCashPrior() internal view returns (uint) {
EIP20Interface token = EIP20Interface(underlying);
return token.balanceOf(address(this));
}
/**
* @dev Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case.
* This will revert due to insufficient balance or insufficient allowance.
* This function returns the actual amount received,
* which may be less than `amount` if there is a fee attached to the transfer.
*
* Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.
* See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
*/
function doTransferIn(address from, uint amount) internal returns (uint) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));
token.transferFrom(from, address(this), amount);
bool success;
assembly {
switch returndatasize()
case 0 { // This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 { // This is a compliant ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set `success = returndata` of external call
}
default { // This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_IN_FAILED");
// Calculate the amount that was *actually* transferred
uint balanceAfter = EIP20Interface(underlying).balanceOf(address(this));
require(balanceAfter >= balanceBefore, "TOKEN_TRANSFER_IN_OVERFLOW");
return balanceAfter - balanceBefore; // underflow already checked above, just subtract
}
/**
* @dev Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory
* error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to
* insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and verified
* it is >= amount, this should not revert in normal conditions.
*
* Note: This wrapper safely handles non-standard ERC-20 tokens that do not return a value.
* See here: https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
*/
function doTransferOut(address payable to, uint amount) internal {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
token.transfer(to, amount);
bool success;
assembly {
switch returndatasize()
case 0 { // This is a non-standard ERC-20
success := not(0) // set success to true
}
case 32 { // This is a complaint ERC-20
returndatacopy(0, 0, 32)
success := mload(0) // Set `success = returndata` of external call
}
default { // This is an excessively non-compliant ERC-20, revert.
revert(0, 0)
}
}
require(success, "TOKEN_TRANSFER_OUT_FAILED");
}
}
pragma solidity ^0.5.16;
import "./CTokenInterfaces.sol";
/**
* @title Compound's CErc20Delegator Contract
* @notice CTokens which wrap an EIP-20 underlying and delegate to an implementation
* @author Compound
*/
contract CErc20Delegator is CDelegatorInterface, CTokenAdminStorage {
/**
* @notice Construct a new money market
* @param underlying_ The address of the underlying asset
* @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_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
* @param admin_ Address of the administrator of this token
* @param implementation_ The address of the implementation the contract delegates to
* @param becomeImplementationData The encoded args for becomeImplementation
*/
constructor(address underlying_,
ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_,
address payable admin_,
address implementation_,
bytes memory becomeImplementationData,
uint256 reserveFactorMantissa_,
uint256 adminFeeMantissa_) public {
// Creator of the contract is admin during initialization
admin = msg.sender;
// First delegate gets to initialize the delegator (i.e. storage contract)
delegateTo(implementation_, abi.encodeWithSignature("initialize(address,address,address,uint256,string,string,uint8,uint256,uint256)",
underlying_,
comptroller_,
interestRateModel_,
initialExchangeRateMantissa_,
name_,
symbol_,
decimals_,
reserveFactorMantissa_,
adminFeeMantissa_));
// New implementations always get set via the settor (post-initialize)
_setImplementation(implementation_, false, becomeImplementationData);
// Set the proper admin now that initialization is done
admin = admin_;
}
/**
* @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 {
require(hasAdminRights(), "CErc20Delegator::_setImplementation: Caller must be admin");
if (allowResign) {
delegateToImplementation(abi.encodeWithSignature("_resignImplementation()"));
}
address oldImplementation = implementation;
implementation = implementation_;
delegateToImplementation(abi.encodeWithSignature("_becomeImplementation(bytes)", becomeImplementationData));
emit NewImplementation(oldImplementation, implementation);
}
/**
* @notice Internal method to delegate execution to another contract
* @dev It returns to the external caller whatever the implementation returns or forwards reverts
* @param callee The contract to delegatecall
* @param data The raw data to delegatecall
* @return The returned bytes from the delegatecall
*/
function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returnData) = callee.delegatecall(data);
assembly {
if eq(success, 0) {
revert(add(returnData, 0x20), returndatasize)
}
}
return returnData;
}
/**
* @notice Delegates execution to the implementation contract
* @dev It returns to the external caller whatever the implementation returns or forwards reverts
* @param data The raw data to delegatecall
* @return The returned bytes from the delegatecall
*/
function delegateToImplementation(bytes memory data) public returns (bytes memory) {
return delegateTo(implementation, data);
}
/**
* @notice Delegates execution to an implementation contract
* @dev It returns to the external caller whatever the implementation returns or forwards reverts
*/
function () external payable {
require(msg.value == 0,"CErc20Delegator:fallback: cannot send value to fallback");
// delegate all other functions to current implementation
(bool success, ) = implementation.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) }
}
}
}
pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CEther Contract
* @notice CToken which wraps Ether
* @dev This contract should not to be deployed on its own; instead, deploy:
* 1) `CEtherDelegator` (proxy contract) and `CEtherDelegate` (logic/implementation contract).
* 2) `CEtherImmutable` to deploy without the proxy storage pattern.
* @author Compound
*/
contract CEther is CToken, CEtherInterface {
/**
* @notice Initialize the new 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_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
*/
function initialize(ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 reserveFactorMantissa_,
uint256 adminFeeMantissa_) public {
// CToken initialize does the bulk of the work
super.initialize(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_, reserveFactorMantissa_, adminFeeMantissa_);
}
/*** User Interface ***/
/**
* @notice Sender supplies assets into the market and receives cTokens in exchange
* @dev Reverts upon any failure
*/
function mint() external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/**
* @notice Sender redeems cTokens in exchange for the underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemTokens The number of cTokens to redeem into underlying
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeem(uint redeemTokens) external returns (uint) {
return redeemInternal(redeemTokens);
}
/**
* @notice Sender redeems cTokens in exchange for a specified amount of underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemAmount The amount of underlying to redeem
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeemUnderlying(uint redeemAmount) external returns (uint) {
return redeemUnderlyingInternal(redeemAmount);
}
/**
* @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 borrow(uint borrowAmount) external returns (uint) {
return borrowInternal(borrowAmount);
}
/**
* @notice Sender repays their own borrow
* @dev Reverts upon any failure
*/
function repayBorrow() external payable {
(uint err,) = repayBorrowInternal(msg.value);
requireNoError(err, "repayBorrow failed");
}
/**
* @notice Sender repays a borrow belonging to borrower
* @dev Reverts upon any failure
* @param borrower the account with the debt being payed off
*/
function repayBorrowBehalf(address borrower) external payable {
(uint err,) = repayBorrowBehalfInternal(borrower, msg.value);
requireNoError(err, "repayBorrowBehalf failed");
}
/**
* @notice The sender liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @dev Reverts upon any failure
* @param borrower The borrower of this cToken to be liquidated
* @param cTokenCollateral The market in which to seize collateral from the borrower
*/
function liquidateBorrow(address borrower, CToken cTokenCollateral) external payable {
(uint err,) = liquidateBorrowInternal(borrower, msg.value, cTokenCollateral);
requireNoError(err, "liquidateBorrow failed");
}
/**
* @notice Send Ether to CEther to mint
*/
function () external payable {
(uint err,) = mintInternal(msg.value);
requireNoError(err, "mint failed");
}
/*** Safe Token ***/
/**
* @notice Gets balance of this contract in terms of Ether, before this message
* @dev This excludes the value of the current message, if any
* @return The quantity of Ether owned by this contract
*/
function getCashPrior() internal view returns (uint) {
(MathError err, uint startingBalance) = subUInt(address(this).balance, msg.value);
require(err == MathError.NO_ERROR);
return startingBalance;
}
/**
* @notice Perform the actual transfer in, which is a no-op
* @param from Address sending the Ether
* @param amount Amount of Ether being sent
* @return The actual amount of Ether transferred
*/
function doTransferIn(address from, uint amount) internal returns (uint) {
// Sanity checks
require(msg.sender == from, "sender mismatch");
require(msg.value == amount, "value mismatch");
return amount;
}
function doTransferOut(address payable to, uint amount) internal {
// Send the Ether and revert on failure
(bool success, ) = to.call.value(amount)("");
require(success, "doTransferOut failed");
}
function requireNoError(uint errCode, string memory message) internal pure {
if (errCode == uint(Error.NO_ERROR)) {
return;
}
bytes memory fullMessage = new bytes(bytes(message).length + 5);
uint i;
for (i = 0; i < bytes(message).length; i++) {
fullMessage[i] = bytes(message)[i];
}
fullMessage[i+0] = byte(uint8(32));
fullMessage[i+1] = byte(uint8(40));
fullMessage[i+2] = byte(uint8(48 + ( errCode / 10 )));
fullMessage[i+3] = byte(uint8(48 + ( errCode % 10 )));
fullMessage[i+4] = byte(uint8(41));
require(errCode == uint(Error.NO_ERROR), string(fullMessage));
}
}
pragma solidity ^0.5.16;
import "./CEther.sol";
/**
* @title Compound's CEtherDelegate Contract
* @notice CTokens which wrap Ether and are delegated to
* @author Compound
*/
contract CEtherDelegate is CDelegateInterface, CEther {
/**
* @notice Construct an empty delegate
*/
constructor() public {}
/**
* @notice Called by the delegator on a delegate to initialize it for duty
* @param data The encoded bytes data for any initialization
*/
function _becomeImplementation(bytes memory data) public {
// Shh -- currently unused
data;
// Shh -- we don't ever want this hook to be marked pure
if (false) {
implementation = address(0);
}
require(hasAdminRights(), "only the admin may call _becomeImplementation");
}
/**
* @notice Called by the delegator on a delegate to forfeit its responsibility
*/
function _resignImplementation() public {
// Shh -- we don't ever want this hook to be marked pure
if (false) {
implementation = address(0);
}
require(hasAdminRights(), "only the admin may call _resignImplementation");
}
}
pragma solidity ^0.5.16;
import "./CTokenInterfaces.sol";
/**
* @title Compound's CEtherDelegator Contract
* @notice CTokens which wrap Ether and delegate to an implementation
* @author Compound
*/
contract CEtherDelegator is CDelegatorInterface, CTokenAdminStorage {
/**
* @notice Construct a new CEther 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_ ERC-20 name of this token
* @param symbol_ ERC-20 symbol of this token
* @param decimals_ ERC-20 decimal precision of this token
* @param admin_ Address of the administrator of this token
* @param implementation_ The address of the implementation the contract delegates to
* @param becomeImplementationData The encoded args for becomeImplementation
*/
constructor(ComptrollerInterface comptroller_,
InterestRateModel interestRateModel_,
uint initialExchangeRateMantissa_,
string memory name_,
string memory symbol_,
uint8 decimals_,
address payable admin_,
address implementation_,
bytes memory becomeImplementationData,
uint256 reserveFactorMantissa_,
uint256 adminFeeMantissa_) public {
// Creator of the contract is admin during initialization
admin = msg.sender;
// First delegate gets to initialize the delegator (i.e. storage contract)
delegateTo(implementation_, abi.encodeWithSignature("initialize(address,address,uint256,string,string,uint8,uint256,uint256)",
comptroller_,
interestRateModel_,
initialExchangeRateMantissa_,
name_,
symbol_,
decimals_,
reserveFactorMantissa_,
adminFeeMantissa_));
// New implementations always get set via the settor (post-initialize)
_setImplementation(implementation_, false, becomeImplementationData);
// Set the proper admin now that initialization is done
admin = admin_;
}
/**
* @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 {
require(hasAdminRights(), "CErc20Delegator::_setImplementation: Caller must be admin");
if (allowResign) {
delegateToImplementation(abi.encodeWithSignature("_resignImplementation()"));
}
address oldImplementation = implementation;
implementation = implementation_;
delegateToImplementation(abi.encodeWithSignature("_becomeImplementation(bytes)", becomeImplementationData));
emit NewImplementation(oldImplementation, implementation);
}
/**
* @notice Internal method to delegate execution to another contract
* @dev It returns to the external caller whatever the implementation returns or forwards reverts
* @param callee The contract to delegatecall
* @param data The raw data to delegatecall
* @return The returned bytes from the delegatecall
*/
function delegateTo(address callee, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returnData) = callee.delegatecall(data);
assembly {
if eq(success, 0) {
revert(add(returnData, 0x20), returndatasize)
}
}
return returnData;
}
/**
* @notice Delegates execution to the implementation contract
* @dev It returns to the external caller whatever the implementation returns or forwards reverts
* @param data The raw data to delegatecall
* @return The returned bytes from the delegatecall
*/
function delegateToImplementation(bytes memory data) public returns (bytes memory) {
return delegateTo(implementation, data);
}
/**
* @notice Delegates execution to an implementation contract
* @dev It returns to the external caller whatever the implementation returns or forwards reverts
*/
function () external payable {
// delegate all other functions to current implementation
(bool success, ) = implementation.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) }
}
}
}
pragma solidity ^0.5.16;
import "./CToken.sol";
import "./CErc20.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./PriceOracle.sol";
import "./ComptrollerInterface.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
/**
* @title Compound's Comptroller Contract
* @author Compound
*/
contract Comptroller is ComptrollerV2Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential {
/**
* @notice Emitted when an admin supports a market
*/
event MarketListed(CToken cToken);
/**
* @notice Emitted when an account enters a market
*/
event MarketEntered(CToken cToken, address account);
/**
* @notice Emitted when an account exits a market
*/
event MarketExited(CToken cToken, 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(CToken cToken, uint oldCollateralFactorMantissa, uint newCollateralFactorMantissa);
/**
* @notice Emitted when liquidation incentive is changed by admin
*/
event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
/**
* @notice Emitted when maxAssets is changed by admin
*/
event NewMaxAssets(uint oldMaxAssets, uint newMaxAssets);
/**
* @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(CToken cToken, string action, bool pauseState);
// 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
// liquidationIncentiveMantissa must be no less than this value
uint internal constant liquidationIncentiveMinMantissa = 1.0e18; // 1.0
// liquidationIncentiveMantissa must be no greater than this value
uint internal constant liquidationIncentiveMaxMantissa = 1.5e18; // 1.5
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 (CToken[] memory) {
CToken[] 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 cToken The cToken to check
* @return True if the account is in the asset, otherwise false.
*/
function checkMembership(address account, CToken cToken) external view returns (bool) {
return markets[address(cToken)].accountMembership[account];
}
/**
* @notice Add assets to be included in account liquidity calculation
* @param cTokens The list of addresses of the cToken markets to be enabled
* @return Success indicator for whether each corresponding market was entered
*/
function enterMarkets(address[] memory cTokens) public returns (uint[] memory) {
uint len = cTokens.length;
uint[] memory results = new uint[](len);
for (uint i = 0; i < len; i++) {
CToken cToken = CToken(cTokens[i]);
results[i] = uint(addToMarketInternal(cToken, msg.sender));
}
return results;
}
/**
* @notice Add the market to the borrower's "assets in" for liquidity calculations
* @param cToken The market to enter
* @param borrower The address of the account to modify
* @return Success indicator for whether the market was entered
*/
function addToMarketInternal(CToken cToken, address borrower) internal returns (Error) {
Market storage marketToJoin = markets[address(cToken)];
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;
}
if (accountAssets[borrower].length >= maxAssets) {
// no space, cannot join
return Error.TOO_MANY_ASSETS;
}
// 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(cToken);
// Add to allBorrowers
if (!borrowers[borrower]) {
allBorrowers.push(borrower);
borrowers[borrower] = true;
borrowerIndexes[borrower] = allBorrowers.length - 1;
}
emit MarketEntered(cToken, 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 neccessary collateral for an outstanding borrow.
* @param cTokenAddress The address of the asset to be removed
* @return Whether or not the account successfully exited the market
*/
function exitMarket(address cTokenAddress) external returns (uint) {
CToken cToken = CToken(cTokenAddress);
/* Get sender tokensHeld and amountOwed underlying from the cToken */
(uint oErr, uint tokensHeld, uint amountOwed, ) = cToken.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(cTokenAddress, msg.sender, tokensHeld);
if (allowed != 0) {
return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);
}
Market storage marketToExit = markets[address(cToken)];
/* Return true if the sender is not already ‘in’ the market */
if (!marketToExit.accountMembership[msg.sender]) {
return uint(Error.NO_ERROR);
}
/* Set cToken account membership to false */
delete marketToExit.accountMembership[msg.sender];
/* Delete cToken from the account’s list of assets */
// load into memory for faster iteration
CToken[] memory userAssetList = accountAssets[msg.sender];
uint len = userAssetList.length;
uint assetIndex = len;
for (uint i = 0; i < len; i++) {
if (userAssetList[i] == cToken) {
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
CToken[] storage storedList = accountAssets[msg.sender];
storedList[assetIndex] = storedList[storedList.length - 1];
storedList.length--;
// If the user has exited all markets, remove them from the `allBorrowers` array
if (storedList.length == 0) {
allBorrowers[borrowerIndexes[msg.sender]] = allBorrowers[allBorrowers.length - 1]; // Copy last item in list to location of item to be removed
allBorrowers.length--; // Reduce length by 1
borrowerIndexes[allBorrowers[borrowerIndexes[msg.sender]]] = borrowerIndexes[msg.sender]; // Set borrower index of moved item to correct index
borrowerIndexes[msg.sender] = 0; // Reset sender borrower index to 0 for a gas refund
borrowers[msg.sender] = false; // Tell the contract that the sender is no longer a borrower (so it knows to add the borrower back if they enter a market in the future)
}
emit MarketExited(cToken, 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 cToken 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 cToken, address minter, uint mintAmount) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!mintGuardianPaused[cToken], "mint is paused");
// Shh - currently unused
minter;
mintAmount;
// Make sure market is listed
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
return uint(Error.NO_ERROR);
}
/**
* @notice Validates mint and reverts on rejection. May emit logs.
* @param cToken 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 cToken, address minter, uint actualMintAmount, uint mintTokens) external {
// Shh - currently unused
cToken;
minter;
actualMintAmount;
mintTokens;
// Shh - we don't ever want this hook to be marked pure
if (false) {
maxAssets = maxAssets;
}
// Add minter to suppliers mapping
suppliers[minter] = true;
}
/**
* @notice Checks if the account should be allowed to redeem tokens in the given market
* @param cToken The market to verify the redeem against
* @param redeemer The account which would redeem the tokens
* @param redeemTokens The number of cTokens 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 cToken, address redeemer, uint redeemTokens) external returns (uint) {
return redeemAllowedInternal(cToken, redeemer, redeemTokens);
}
function redeemAllowedInternal(address cToken, address redeemer, uint redeemTokens) internal view returns (uint) {
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
/* If the redeemer is not 'in' the market, then we can bypass the liquidity check */
if (!markets[cToken].accountMembership[redeemer]) {
return uint(Error.NO_ERROR);
}
/* Otherwise, perform a hypothetical liquidity check to guard against shortfall */
(Error err, , uint shortfall) = getHypotheticalAccountLiquidityInternal(redeemer, CToken(cToken), 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 cToken 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 cToken, address redeemer, uint redeemAmount, uint redeemTokens) external {
// Shh - currently unused
cToken;
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 cToken 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 cToken, address borrower, uint borrowAmount) external returns (uint) {
// Pausing is a very serious situation - we revert to sound the alarms
require(!borrowGuardianPaused[cToken], "borrow is paused");
// Make sure market is listed
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
if (!markets[cToken].accountMembership[borrower]) {
// only cTokens may call borrowAllowed if borrower not in market
require(msg.sender == cToken, "sender must be cToken");
// attempt to add borrower to the market
Error err = addToMarketInternal(CToken(msg.sender), borrower);
if (err != Error.NO_ERROR) {
return uint(err);
}
// it should be impossible to break the important invariant
assert(markets[cToken].accountMembership[borrower]);
}
if (oracle.getUnderlyingPrice(CToken(cToken)) == 0) {
return uint(Error.PRICE_ERROR);
}
(Error err, , uint shortfall) = getHypotheticalAccountLiquidityInternal(borrower, CToken(cToken), 0, borrowAmount);
if (err != Error.NO_ERROR) {
return uint(err);
}
if (shortfall > 0) {
return uint(Error.INSUFFICIENT_LIQUIDITY);
}
return uint(Error.NO_ERROR);
}
/**
* @notice Checks if the account should be allowed to borrow the underlying asset of the given market
* @param cToken Asset whose underlying is being borrowed
* @param accountBorrowsNew The user's new borrow balance of the underlying asset
*/
function borrowWithinLimits(address cToken, uint accountBorrowsNew) external returns (uint) {
uint oraclePriceMantissa = oracle.getUnderlyingPrice(CToken(cToken));
if (oraclePriceMantissa == 0) return uint(Error.PRICE_ERROR);
(MathError mathErr, uint borrowBalanceEth) = mulScalarTruncate(Exp({mantissa: oraclePriceMantissa}), accountBorrowsNew);
if (mathErr != MathError.NO_ERROR) return uint(Error.MATH_ERROR);
if (borrowBalanceEth < fuseAdmin.minBorrowEth()) return uint(Error.BORROW_BELOW_MIN);
return uint(Error.NO_ERROR);
}
/**
* @notice Checks if the account should be allowed to borrow the underlying asset of the given market
* @param cToken Asset whose underlying is being borrowed
* @param exchangeRateMantissa Underlying/cToken exchange rate
* @param accountTokens Initial account cToken balance
* @param accountTokens Underlying amount to mint
*/
function mintWithinLimits(address cToken, uint exchangeRateMantissa, uint accountTokens, uint mintAmount) external returns (uint) {
// Check max supply
uint maxSupplyEth = fuseAdmin.maxSupplyEth();
if (maxSupplyEth < uint(-1)) {
(MathError mathErr, uint newUnderlyingBalance) = mulScalarTruncateAddUInt(Exp({mantissa: exchangeRateMantissa}), accountTokens, mintAmount);
if (mathErr != MathError.NO_ERROR) return uint(Error.MATH_ERROR);
uint newEthBalance;
(mathErr, newEthBalance) = mulScalarTruncate(Exp({mantissa: oracle.getUnderlyingPrice(CToken(cToken))}), newUnderlyingBalance);
if (mathErr != MathError.NO_ERROR) return uint(Error.MATH_ERROR);
if (newEthBalance > maxSupplyEth) return uint(Error.SUPPLY_ABOVE_MAX);
}
}
/**
* @notice Validates borrow and reverts on rejection. May emit logs.
* @param cToken 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 cToken, address borrower, uint borrowAmount) external {
// Shh - currently unused
cToken;
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 cToken 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 cToken,
address payer,
address borrower,
uint repayAmount) external returns (uint) {
// Shh - currently unused
payer;
borrower;
repayAmount;
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
return uint(Error.NO_ERROR);
}
/**
* @notice Validates repayBorrow and reverts on rejection. May emit logs.
* @param cToken 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 cToken,
address payer,
address borrower,
uint actualRepayAmount,
uint borrowerIndex) external {
// Shh - currently unused
cToken;
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 cTokenBorrowed Asset which was borrowed by the borrower
* @param cTokenCollateral 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 cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint repayAmount) external returns (uint) {
// Shh - currently unused
liquidator;
if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
/* 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 = CToken(cTokenBorrowed).borrowBalanceStored(borrower);
(MathError mathErr, uint maxClose) = mulScalarTruncate(Exp({mantissa: closeFactorMantissa}), borrowBalance);
if (mathErr != MathError.NO_ERROR) {
return uint(Error.MATH_ERROR);
}
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 cTokenBorrowed Asset which was borrowed by the borrower
* @param cTokenCollateral 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 cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint actualRepayAmount,
uint seizeTokens) external {
// Shh - currently unused
cTokenBorrowed;
cTokenCollateral;
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 cTokenCollateral Asset which was used as collateral and will be seized
* @param cTokenBorrowed 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 cTokenCollateral,
address cTokenBorrowed,
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
liquidator;
borrower;
seizeTokens;
if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
if (CToken(cTokenCollateral).comptroller() != CToken(cTokenBorrowed).comptroller()) {
return uint(Error.COMPTROLLER_MISMATCH);
}
// *may include Policy Hook-type checks
return uint(Error.NO_ERROR);
}
/**
* @notice Validates seize and reverts on rejection. May emit logs.
* @param cTokenCollateral Asset which was used as collateral and will be seized
* @param cTokenBorrowed 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 cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
uint seizeTokens) external {
// Shh - currently unused
cTokenCollateral;
cTokenBorrowed;
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 cToken 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 cTokens to transfer
* @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)
*/
function transferAllowed(address cToken, 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");
// Shh - currently unused
dst;
// *may include Policy Hook-type checks
// Currently the only consideration is whether or not
// the src is allowed to redeem this many tokens
return redeemAllowedInternal(cToken, src, transferTokens);
}
/**
* @notice Validates transfer and reverts on rejection. May emit logs.
* @param cToken Asset being transferred
* @param src The account which sources the tokens
* @param dst The account which receives the tokens
* @param transferTokens The number of cTokens to transfer
*/
function transferVerify(address cToken, address src, address dst, uint transferTokens) external {
// Shh - currently unused
cToken;
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 `cTokenBalance` is the number of cTokens 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 cTokenBalance;
uint borrowBalance;
uint exchangeRateMantissa;
uint oraclePriceMantissa;
Exp collateralFactor;
Exp exchangeRate;
Exp oraclePrice;
Exp tokensToEther;
}
/**
* @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, CToken(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, CToken(0), 0, 0);
}
/**
* @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed
* @param cTokenModify 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 cTokenModify,
uint redeemTokens,
uint borrowAmount) public view returns (uint, uint, uint) {
(Error err, uint liquidity, uint shortfall) = getHypotheticalAccountLiquidityInternal(account, CToken(cTokenModify), redeemTokens, borrowAmount);
return (uint(err), liquidity, shortfall);
}
/**
* @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed
* @param cTokenModify 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 cToken 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,
CToken cTokenModify,
uint redeemTokens,
uint borrowAmount) internal view returns (Error, uint, uint) {
AccountLiquidityLocalVars memory vars; // Holds all our calculation results
uint oErr;
MathError mErr;
// For each asset the account is in
CToken[] memory assets = accountAssets[account];
for (uint i = 0; i < assets.length; i++) {
CToken asset = assets[i];
// Read the balances and exchange rate from the cToken
(oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = asset.getAccountSnapshot(account);
if (oErr != 0) { // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades
return (Error.SNAPSHOT_ERROR, 0, 0);
}
vars.collateralFactor = Exp({mantissa: markets[address(asset)].collateralFactorMantissa});
vars.exchangeRate = Exp({mantissa: vars.exchangeRateMantissa});
// Get the normalized price of the asset
vars.oraclePriceMantissa = oracle.getUnderlyingPrice(asset);
if (vars.oraclePriceMantissa == 0) {
return (Error.PRICE_ERROR, 0, 0);
}
vars.oraclePrice = Exp({mantissa: vars.oraclePriceMantissa});
// Pre-compute a conversion factor from tokens -> ether (normalized price value)
(mErr, vars.tokensToEther) = mulExp3(vars.collateralFactor, vars.exchangeRate, vars.oraclePrice);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// sumCollateral += tokensToEther * cTokenBalance
(mErr, vars.sumCollateral) = mulScalarTruncateAddUInt(vars.tokensToEther, vars.cTokenBalance, vars.sumCollateral);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// sumBorrowPlusEffects += oraclePrice * borrowBalance
(mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// Calculate effects of interacting with cTokenModify
if (asset == cTokenModify) {
// redeem effect
// sumBorrowPlusEffects += tokensToEther * redeemTokens
(mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.tokensToEther, redeemTokens, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// borrow effect
// sumBorrowPlusEffects += oraclePrice * borrowAmount
(mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, borrowAmount, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
}
}
// 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 Determine the maximum redeem amount of a cToken
* @param cTokenModify The market to hypothetically redeem in
* @param account The account to determine liquidity for
* @dev Note that we calculate the exchangeRateStored for each collateral cToken using stored data,
* without calculating accumulated interest.
* @return (possible error code,
maximum redeem amount)
*/
function getMaxRedeem(address account, CToken cTokenModify) external returns (uint, uint) {
(Error err, uint maxRedeem) = getMaxRedeemOrBorrow(account, cTokenModify, false);
return (uint(err), maxRedeem);
}
/**
* @notice Determine the maximum borrow amount of a cToken
* @param cTokenModify The market to hypothetically borrow in
* @param account The account to determine liquidity for
* @dev Note that we calculate the exchangeRateStored for each collateral cToken using stored data,
* without calculating accumulated interest.
* @return (possible error code,
maximum borrow amount)
*/
function getMaxBorrow(address account, CToken cTokenModify) external returns (uint, uint) {
(Error err, uint maxBorrow) = getMaxRedeemOrBorrow(account, cTokenModify, true);
return (uint(err), maxBorrow);
}
/**
* @dev Internal function to determine the maximum borrow/redeem amount of a cToken
* @param cTokenModify The market to hypothetically borrow/redeem in
* @param account The account to determine liquidity for
* @dev Note that we calculate the exchangeRateStored for each collateral cToken using stored data,
* without calculating accumulated interest.
* @return (possible error code,
maximum borrow/redeem amount)
*/
function getMaxRedeemOrBorrow(address account, CToken cTokenModify, bool isBorrow) internal returns (Error, uint) {
// Accrue interest
uint balanceOfUnderlying = cTokenModify.balanceOfUnderlying(account);
// Get account liquidity
(Error err, uint liquidity, uint shortfall) = getHypotheticalAccountLiquidityInternal(account, CToken(0), 0, 0);
if (err != Error.NO_ERROR) return (err, 0);
if (shortfall > 0) return (Error.NO_ERROR, 0); // Shortfall, so no more borrow/redeem
// Get max borrow/redeem
uint maxBorrowOrRedeemAmount;
if (!isBorrow && !markets[address(cTokenModify)].accountMembership[msg.sender]) {
// Max redeem = balance of underlying if not used as collateral
maxBorrowOrRedeemAmount = balanceOfUnderlying;
} else {
// Avoid "stack too deep" error by separating this logic
(err, maxBorrowOrRedeemAmount) = _getMaxRedeemOrBorrow(liquidity, cTokenModify, isBorrow);
if (err != Error.NO_ERROR) return (err, 0);
// Redeem only: max out at underlying balance
if (!isBorrow && balanceOfUnderlying < maxBorrowOrRedeemAmount) maxBorrowOrRedeemAmount = balanceOfUnderlying;
}
// Get max borrow or redeem considering cToken liquidity
uint cTokenLiquidity = cTokenModify.getCash();
// Return the minimum of the two maximums
return (Error.NO_ERROR, maxBorrowOrRedeemAmount <= cTokenLiquidity ? maxBorrowOrRedeemAmount : cTokenLiquidity);
}
/**
* @dev Portion of the logic above separated to avoid "stack too deep" errors.
*/
function _getMaxRedeemOrBorrow(uint liquidity, CToken cTokenModify, bool isBorrow) internal view returns (Error, uint) {
if (liquidity <= 0) return (Error.NO_ERROR, 0); // No available account liquidity, so no more borrow/redeem
// Get the normalized price of the asset
uint oraclePriceMantissa = oracle.getUnderlyingPrice(cTokenModify);
if (oraclePriceMantissa == 0) return (Error.PRICE_ERROR, 0);
Exp memory conversionFactor = Exp({mantissa: oraclePriceMantissa});
// Pre-compute a conversion factor from tokens -> ether (normalized price value)
MathError mErr;
if (!isBorrow) {
Exp memory collateralFactor = Exp({mantissa: markets[address(cTokenModify)].collateralFactorMantissa});
(mErr, conversionFactor) = mulExp(collateralFactor, conversionFactor);
if (mErr != MathError.NO_ERROR) return (Error.MATH_ERROR, 0);
}
// Get max borrow or redeem considering excess account liquidity
uint maxBorrowOrRedeemAmount;
(mErr, maxBorrowOrRedeemAmount) = divScalarByExpTruncate(liquidity, conversionFactor);
if (mErr != MathError.NO_ERROR) return (Error.MATH_ERROR, 0);
return (Error.NO_ERROR, maxBorrowOrRedeemAmount);
}
/**
* @notice Calculate number of tokens of collateral asset to seize given an underlying amount
* @dev Used in liquidation (called in cToken.liquidateBorrowFresh)
* @param cTokenBorrowed The address of the borrowed cToken
* @param cTokenCollateral The address of the collateral cToken
* @param actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens
* @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)
*/
function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollateral, uint actualRepayAmount) external view returns (uint, uint) {
/* Read oracle prices for borrowed and collateral markets */
uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed));
uint priceCollateralMantissa = oracle.getUnderlyingPrice(CToken(cTokenCollateral));
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 = CToken(cTokenCollateral).exchangeRateStored(); // Note: reverts on error
uint seizeTokens;
Exp memory numerator;
Exp memory denominator;
Exp memory ratio;
MathError mathErr;
(mathErr, numerator) = mulExp(liquidationIncentiveMantissa, priceBorrowedMantissa);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
(mathErr, denominator) = mulExp(priceCollateralMantissa, exchangeRateMantissa);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
(mathErr, ratio) = divExp(numerator, denominator);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
(mathErr, seizeTokens) = mulScalarTruncate(ratio, actualRepayAmount);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
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 (!hasAdminRights()) {
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. (See ErrorReporter for details)
*/
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint256) {
// Check caller is admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);
}
Exp memory newCloseFactorExp = Exp({mantissa: newCloseFactorMantissa});
Exp memory lowLimit = Exp({mantissa: closeFactorMinMantissa});
if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {
return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);
}
Exp memory highLimit = Exp({mantissa: closeFactorMaxMantissa});
if (lessThanExp(highLimit, newCloseFactorExp)) {
return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);
}
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 cToken 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(CToken cToken, uint newCollateralFactorMantissa) public returns (uint256) {
// Check caller is admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);
}
// Verify market is listed
Market storage market = markets[address(cToken)];
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(cToken) == 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(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);
return uint(Error.NO_ERROR);
}
/**
* @notice Sets maxAssets which controls how many markets can be entered
* @dev Admin function to set maxAssets
* @param newMaxAssets New max assets
* @return uint 0=success, otherwise a failure. (See ErrorReporter for details)
*/
function _setMaxAssets(uint newMaxAssets) external returns (uint) {
// Check caller is admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_MAX_ASSETS_OWNER_CHECK);
}
uint oldMaxAssets = maxAssets;
maxAssets = newMaxAssets;
emit NewMaxAssets(oldMaxAssets, newMaxAssets);
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 (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);
}
// Check de-scaled min <= newLiquidationIncentive <= max
Exp memory newLiquidationIncentive = Exp({mantissa: newLiquidationIncentiveMantissa});
Exp memory minLiquidationIncentive = Exp({mantissa: liquidationIncentiveMinMantissa});
if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {
return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);
}
Exp memory maxLiquidationIncentive = Exp({mantissa: liquidationIncentiveMaxMantissa});
if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {
return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);
}
// 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 cToken The address of the market (token) to list
* @return uint 0=success, otherwise a failure. (See enum Error for details)
*/
function _supportMarket(CToken cToken) public returns (uint) {
// Check caller is admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);
}
// Is market already listed?
if (markets[address(cToken)].isListed) {
return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);
}
// Sanity check to make sure its really a CToken
cToken.isCToken();
// Check cToken.comptroller == this
require(address(cToken.comptroller()) == address(this), "Cannot support a market with a different Comptroller.");
// Make sure market is not already listed
address underlying = cToken.isCEther() ? address(0) : CErc20(address(cToken)).underlying();
if (address(cTokensByUnderlying[underlying]) != address(0)) {
return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);
}
// List market and emit event
markets[address(cToken)] = Market({isListed: true, collateralFactorMantissa: 0});
allMarkets.push(cToken);
cTokensByUnderlying[underlying] = cToken;
emit MarketListed(cToken);
return uint(Error.NO_ERROR);
}
/**
* @notice Add the market to the markets mapping and set it as listed and set the collateral factor
* @dev Admin function to set isListed and add support for the market and set the collateral factor
* @param cToken The address of the market (token) to list
* @param newCollateralFactorMantissa The new collateral factor, scaled by 1e18
* @return uint 0=success, otherwise a failure. (See enum Error for details)
*/
function _supportMarketAndSetCollateralFactor(CToken cToken, uint newCollateralFactorMantissa) external returns (uint) {
uint256 err = _supportMarket(cToken);
return err == uint(Error.NO_ERROR) ? _setCollateralFactor(cToken, newCollateralFactorMantissa) : err;
}
/**
* @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 (!hasAdminRights()) {
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(CToken cToken, bool state) public returns (bool) {
require(markets[address(cToken)].isListed, "cannot pause a market that is not listed");
require(msg.sender == pauseGuardian || hasAdminRights(), "only pause guardian and admin can pause");
require(hasAdminRights() || state == true, "only admin can unpause");
mintGuardianPaused[address(cToken)] = state;
emit ActionPaused(cToken, "Mint", state);
return state;
}
function _setBorrowPaused(CToken cToken, bool state) public returns (bool) {
require(markets[address(cToken)].isListed, "cannot pause a market that is not listed");
require(msg.sender == pauseGuardian || hasAdminRights(), "only pause guardian and admin can pause");
require(hasAdminRights() || state == true, "only admin can unpause");
borrowGuardianPaused[address(cToken)] = state;
emit ActionPaused(cToken, "Borrow", state);
return state;
}
function _setTransferPaused(bool state) public returns (bool) {
require(msg.sender == pauseGuardian || hasAdminRights(), "only pause guardian and admin can pause");
require(hasAdminRights() || 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 || hasAdminRights(), "only pause guardian and admin can pause");
require(hasAdminRights() || 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");
uint changeStatus = unitroller._acceptImplementation();
require(changeStatus == 0, "change not authorized");
}
/**
* @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 (CToken[] memory) {
return allMarkets;
}
/**
* @notice Return all of the borrowers
* @dev The automatic getter may be used to access an individual borrower.
* @return The list of borrower account addresses
*/
function getAllBorrowers() public view returns (address[] memory) {
return allBorrowers;
}
}
pragma solidity ^0.5.16;
import "./CToken.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./PriceOracle.sol";
import "./ComptrollerInterface.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
/**
* @title Compound's Comptroller Contract
* @author Compound
* @dev This was the first version of the Comptroller brains.
* We keep it so our tests can continue to do the real-life behavior of upgrading from this logic forward.
*/
contract ComptrollerG1 is ComptrollerV1Storage, ComptrollerInterface, ComptrollerErrorReporter, Exponential {
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 Official mapping of cTokens -> Market metadata
* @dev Used e.g. to determine if a market is supported
*/
mapping(address => Market) public markets;
/**
* @notice Emitted when an admin supports a market
*/
event MarketListed(CToken cToken);
/**
* @notice Emitted when an account enters a market
*/
event MarketEntered(CToken cToken, address account);
/**
* @notice Emitted when an account exits a market
*/
event MarketExited(CToken cToken, 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(CToken cToken, uint oldCollateralFactorMantissa, uint newCollateralFactorMantissa);
/**
* @notice Emitted when liquidation incentive is changed by admin
*/
event NewLiquidationIncentive(uint oldLiquidationIncentiveMantissa, uint newLiquidationIncentiveMantissa);
/**
* @notice Emitted when maxAssets is changed by admin
*/
event NewMaxAssets(uint oldMaxAssets, uint newMaxAssets);
/**
* @notice Emitted when price oracle is changed
*/
event NewPriceOracle(PriceOracle oldPriceOracle, PriceOracle newPriceOracle);
// closeFactorMantissa must be strictly greater than this value
uint constant closeFactorMinMantissa = 5e16; // 0.05
// closeFactorMantissa must not exceed this value
uint constant closeFactorMaxMantissa = 9e17; // 0.9
// No collateralFactorMantissa may exceed this value
uint constant collateralFactorMaxMantissa = 9e17; // 0.9
// liquidationIncentiveMantissa must be no less than this value
uint constant liquidationIncentiveMinMantissa = mantissaOne;
// liquidationIncentiveMantissa must be no greater than this value
uint constant liquidationIncentiveMaxMantissa = 15e17; // 1.5
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 (CToken[] memory) {
CToken[] 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 cToken The cToken to check
* @return True if the account is in the asset, otherwise false.
*/
function checkMembership(address account, CToken cToken) external view returns (bool) {
return markets[address(cToken)].accountMembership[account];
}
/**
* @notice Add assets to be included in account liquidity calculation
* @param cTokens The list of addresses of the cToken markets to be enabled
* @return Success indicator for whether each corresponding market was entered
*/
function enterMarkets(address[] memory cTokens) public returns (uint[] memory) {
uint len = cTokens.length;
uint[] memory results = new uint[](len);
for (uint i = 0; i < len; i++) {
CToken cToken = CToken(cTokens[i]);
Market storage marketToJoin = markets[address(cToken)];
if (!marketToJoin.isListed) {
// if market is not listed, cannot join move along
results[i] = uint(Error.MARKET_NOT_LISTED);
continue;
}
if (marketToJoin.accountMembership[msg.sender] == true) {
// if already joined, move along
results[i] = uint(Error.NO_ERROR);
continue;
}
if (accountAssets[msg.sender].length >= maxAssets) {
// if no space, cannot join, move along
results[i] = uint(Error.TOO_MANY_ASSETS);
continue;
}
// 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[msg.sender] = true;
accountAssets[msg.sender].push(cToken);
emit MarketEntered(cToken, msg.sender);
results[i] = uint(Error.NO_ERROR);
}
return results;
}
/**
* @notice Removes asset from sender's account liquidity calculation
* @dev Sender must not have an outstanding borrow balance in the asset,
* or be providing neccessary collateral for an outstanding borrow.
* @param cTokenAddress The address of the asset to be removed
* @return Whether or not the account successfully exited the market
*/
function exitMarket(address cTokenAddress) external returns (uint) {
CToken cToken = CToken(cTokenAddress);
/* Get sender tokensHeld and amountOwed underlying from the cToken */
(uint oErr, uint tokensHeld, uint amountOwed, ) = cToken.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(cTokenAddress, msg.sender, tokensHeld);
if (allowed != 0) {
return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed);
}
Market storage marketToExit = markets[address(cToken)];
/* Return true if the sender is not already ‘in’ the market */
if (!marketToExit.accountMembership[msg.sender]) {
return uint(Error.NO_ERROR);
}
/* Set cToken account membership to false */
delete marketToExit.accountMembership[msg.sender];
/* Delete cToken from the account’s list of assets */
// load into memory for faster iteration
CToken[] memory userAssetList = accountAssets[msg.sender];
uint len = userAssetList.length;
uint assetIndex = len;
for (uint i = 0; i < len; i++) {
if (userAssetList[i] == cToken) {
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
CToken[] storage storedList = accountAssets[msg.sender];
storedList[assetIndex] = storedList[storedList.length - 1];
storedList.length--;
emit MarketExited(cToken, 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 cToken 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 cToken, address minter, uint mintAmount) external returns (uint) {
minter; // currently unused
mintAmount; // currently unused
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
return uint(Error.NO_ERROR);
}
/**
* @notice Validates mint and reverts on rejection. May emit logs.
* @param cToken Asset being minted
* @param minter The address minting the tokens
* @param mintAmount The amount of the underlying asset being minted
* @param mintTokens The number of tokens being minted
*/
function mintVerify(address cToken, address minter, uint mintAmount, uint mintTokens) external {
cToken; // currently unused
minter; // currently unused
mintAmount; // currently unused
mintTokens; // currently unused
if (false) {
maxAssets = maxAssets; // not pure
}
}
/**
* @notice Checks if the account should be allowed to redeem tokens in the given market
* @param cToken The market to verify the redeem against
* @param redeemer The account which would redeem the tokens
* @param redeemTokens The number of cTokens 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 cToken, address redeemer, uint redeemTokens) external returns (uint) {
return redeemAllowedInternal(cToken, redeemer, redeemTokens);
}
function redeemAllowedInternal(address cToken, address redeemer, uint redeemTokens) internal view returns (uint) {
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
/* If the redeemer is not 'in' the market, then we can bypass the liquidity check */
if (!markets[cToken].accountMembership[redeemer]) {
return uint(Error.NO_ERROR);
}
/* Otherwise, perform a hypothetical liquidity check to guard against shortfall */
(Error err, , uint shortfall) = getHypotheticalAccountLiquidityInternal(redeemer, CToken(cToken), 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 cToken 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 cToken, address redeemer, uint redeemAmount, uint redeemTokens) external {
cToken; // currently unused
redeemer; // currently unused
redeemAmount; // currently unused
redeemTokens; // currently unused
// 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 cToken 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 cToken, address borrower, uint borrowAmount) external returns (uint) {
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
if (!markets[cToken].accountMembership[borrower]) {
return uint(Error.MARKET_NOT_ENTERED);
}
if (oracle.getUnderlyingPrice(CToken(cToken)) == 0) {
return uint(Error.PRICE_ERROR);
}
(Error err, , uint shortfall) = getHypotheticalAccountLiquidityInternal(borrower, CToken(cToken), 0, borrowAmount);
if (err != Error.NO_ERROR) {
return uint(err);
}
if (shortfall > 0) {
return uint(Error.INSUFFICIENT_LIQUIDITY);
}
return uint(Error.NO_ERROR);
}
/**
* @notice Validates borrow and reverts on rejection. May emit logs.
* @param cToken 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 cToken, address borrower, uint borrowAmount) external {
cToken; // currently unused
borrower; // currently unused
borrowAmount; // currently unused
if (false) {
maxAssets = maxAssets; // not pure
}
}
/**
* @notice Checks if the account should be allowed to repay a borrow in the given market
* @param cToken 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 cToken,
address payer,
address borrower,
uint repayAmount) external returns (uint) {
payer; // currently unused
borrower; // currently unused
repayAmount; // currently unused
if (!markets[cToken].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
return uint(Error.NO_ERROR);
}
/**
* @notice Validates repayBorrow and reverts on rejection. May emit logs.
* @param cToken Asset being repaid
* @param payer The address repaying the borrow
* @param borrower The address of the borrower
* @param repayAmount The amount of underlying being repaid
*/
function repayBorrowVerify(
address cToken,
address payer,
address borrower,
uint repayAmount,
uint borrowerIndex) external {
cToken; // currently unused
payer; // currently unused
borrower; // currently unused
repayAmount; // currently unused
borrowerIndex; // currently unused
if (false) {
maxAssets = maxAssets; // not pure
}
}
/**
* @notice Checks if the liquidation should be allowed to occur
* @param cTokenBorrowed Asset which was borrowed by the borrower
* @param cTokenCollateral 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 cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint repayAmount) external returns (uint) {
liquidator; // currently unused
borrower; // currently unused
repayAmount; // currently unused
if (!markets[cTokenBorrowed].isListed || !markets[cTokenCollateral].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
// *may include Policy Hook-type checks
/* 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 = CToken(cTokenBorrowed).borrowBalanceStored(borrower);
(MathError mathErr, uint maxClose) = mulScalarTruncate(Exp({mantissa: closeFactorMantissa}), borrowBalance);
if (mathErr != MathError.NO_ERROR) {
return uint(Error.MATH_ERROR);
}
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 cTokenBorrowed Asset which was borrowed by the borrower
* @param cTokenCollateral 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 liquidateBorrowVerify(
address cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint repayAmount,
uint seizeTokens) external {
cTokenBorrowed; // currently unused
cTokenCollateral; // currently unused
liquidator; // currently unused
borrower; // currently unused
repayAmount; // currently unused
seizeTokens; // currently unused
if (false) {
maxAssets = maxAssets; // not pure
}
}
/**
* @notice Checks if the seizing of assets should be allowed to occur
* @param cTokenCollateral Asset which was used as collateral and will be seized
* @param cTokenBorrowed 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 cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
uint seizeTokens) external returns (uint) {
liquidator; // currently unused
borrower; // currently unused
seizeTokens; // currently unused
if (!markets[cTokenCollateral].isListed || !markets[cTokenBorrowed].isListed) {
return uint(Error.MARKET_NOT_LISTED);
}
if (CToken(cTokenCollateral).comptroller() != CToken(cTokenBorrowed).comptroller()) {
return uint(Error.COMPTROLLER_MISMATCH);
}
// *may include Policy Hook-type checks
return uint(Error.NO_ERROR);
}
/**
* @notice Validates seize and reverts on rejection. May emit logs.
* @param cTokenCollateral Asset which was used as collateral and will be seized
* @param cTokenBorrowed 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 cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
uint seizeTokens) external {
cTokenCollateral; // currently unused
cTokenBorrowed; // currently unused
liquidator; // currently unused
borrower; // currently unused
seizeTokens; // currently unused
if (false) {
maxAssets = maxAssets; // not pure
}
}
/**
* @notice Checks if the account should be allowed to transfer tokens in the given market
* @param cToken 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 cTokens to transfer
* @return 0 if the transfer is allowed, otherwise a semi-opaque error code (See ErrorReporter.sol)
*/
function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint) {
cToken; // currently unused
src; // currently unused
dst; // currently unused
transferTokens; // currently unused
// *may include Policy Hook-type checks
// Currently the only consideration is whether or not
// the src is allowed to redeem this many tokens
return redeemAllowedInternal(cToken, src, transferTokens);
}
/**
* @notice Validates transfer and reverts on rejection. May emit logs.
* @param cToken Asset being transferred
* @param src The account which sources the tokens
* @param dst The account which receives the tokens
* @param transferTokens The number of cTokens to transfer
*/
function transferVerify(address cToken, address src, address dst, uint transferTokens) external {
cToken; // currently unused
src; // currently unused
dst; // currently unused
transferTokens; // currently unused
if (false) {
maxAssets = maxAssets; // not pure
}
}
/*** Liquidity/Liquidation Calculations ***/
/**
* @dev Local vars for avoiding stack-depth limits in calculating account liquidity.
* Note that `cTokenBalance` is the number of cTokens 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 cTokenBalance;
uint borrowBalance;
uint exchangeRateMantissa;
uint oraclePriceMantissa;
Exp collateralFactor;
Exp exchangeRate;
Exp oraclePrice;
Exp tokensToEther;
}
/**
* @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, CToken(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, CToken(0), 0, 0);
}
/**
* @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed
* @param cTokenModify 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 cToken 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,
CToken cTokenModify,
uint redeemTokens,
uint borrowAmount) internal view returns (Error, uint, uint) {
AccountLiquidityLocalVars memory vars; // Holds all our calculation results
uint oErr;
MathError mErr;
// For each asset the account is in
CToken[] memory assets = accountAssets[account];
for (uint i = 0; i < assets.length; i++) {
CToken asset = assets[i];
// Read the balances and exchange rate from the cToken
(oErr, vars.cTokenBalance, vars.borrowBalance, vars.exchangeRateMantissa) = asset.getAccountSnapshot(account);
if (oErr != 0) { // semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades
return (Error.SNAPSHOT_ERROR, 0, 0);
}
vars.collateralFactor = Exp({mantissa: markets[address(asset)].collateralFactorMantissa});
vars.exchangeRate = Exp({mantissa: vars.exchangeRateMantissa});
// Get the normalized price of the asset
vars.oraclePriceMantissa = oracle.getUnderlyingPrice(asset);
if (vars.oraclePriceMantissa == 0) {
return (Error.PRICE_ERROR, 0, 0);
}
vars.oraclePrice = Exp({mantissa: vars.oraclePriceMantissa});
// Pre-compute a conversion factor from tokens -> ether (normalized price value)
(mErr, vars.tokensToEther) = mulExp3(vars.collateralFactor, vars.exchangeRate, vars.oraclePrice);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// sumCollateral += tokensToEther * cTokenBalance
(mErr, vars.sumCollateral) = mulScalarTruncateAddUInt(vars.tokensToEther, vars.cTokenBalance, vars.sumCollateral);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// sumBorrowPlusEffects += oraclePrice * borrowBalance
(mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// Calculate effects of interacting with cTokenModify
if (asset == cTokenModify) {
// redeem effect
// sumBorrowPlusEffects += tokensToEther * redeemTokens
(mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.tokensToEther, redeemTokens, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
// borrow effect
// sumBorrowPlusEffects += oraclePrice * borrowAmount
(mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, borrowAmount, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
}
}
// 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 cToken.liquidateBorrowFresh)
* @param cTokenBorrowed The address of the borrowed cToken
* @param cTokenCollateral The address of the collateral cToken
* @param repayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens
* @return (errorCode, number of cTokenCollateral tokens to be seized in a liquidation)
*/
function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollateral, uint repayAmount) external view returns (uint, uint) {
/* Read oracle prices for borrowed and collateral markets */
uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed));
uint priceCollateralMantissa = oracle.getUnderlyingPrice(CToken(cTokenCollateral));
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 = repayAmount * liquidationIncentive * priceBorrowed / priceCollateral
* seizeTokens = seizeAmount / exchangeRate
* = repayAmount * (liquidationIncentive * priceBorrowed) / (priceCollateral * exchangeRate)
*/
uint exchangeRateMantissa = CToken(cTokenCollateral).exchangeRateStored(); // Note: reverts on error
uint seizeTokens;
Exp memory numerator;
Exp memory denominator;
Exp memory ratio;
MathError mathErr;
(mathErr, numerator) = mulExp(liquidationIncentiveMantissa, priceBorrowedMantissa);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
(mathErr, denominator) = mulExp(priceCollateralMantissa, exchangeRateMantissa);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
(mathErr, ratio) = divExp(numerator, denominator);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
(mathErr, seizeTokens) = mulScalarTruncate(ratio, repayAmount);
if (mathErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0);
}
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 OR currently initialzing as new unitroller implementation
if (!adminOrInitializing()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK);
}
// Track the old oracle for the comptroller
PriceOracle oldOracle = oracle;
// Ensure invoke newOracle.isPriceOracle() returns true
// require(newOracle.isPriceOracle(), "oracle method isPriceOracle returned false");
// 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. (See ErrorReporter for details)
*/
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint256) {
// Check caller is admin OR currently initialzing as new unitroller implementation
if (!adminOrInitializing()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_CLOSE_FACTOR_OWNER_CHECK);
}
Exp memory newCloseFactorExp = Exp({mantissa: newCloseFactorMantissa});
Exp memory lowLimit = Exp({mantissa: closeFactorMinMantissa});
if (lessThanOrEqualExp(newCloseFactorExp, lowLimit)) {
return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);
}
Exp memory highLimit = Exp({mantissa: closeFactorMaxMantissa});
if (lessThanExp(highLimit, newCloseFactorExp)) {
return fail(Error.INVALID_CLOSE_FACTOR, FailureInfo.SET_CLOSE_FACTOR_VALIDATION);
}
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 cToken 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(CToken cToken, uint newCollateralFactorMantissa) external returns (uint256) {
// Check caller is admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);
}
// Verify market is listed
Market storage market = markets[address(cToken)];
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(cToken) == 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(cToken, oldCollateralFactorMantissa, newCollateralFactorMantissa);
return uint(Error.NO_ERROR);
}
/**
* @notice Sets maxAssets which controls how many markets can be entered
* @dev Admin function to set maxAssets
* @param newMaxAssets New max assets
* @return uint 0=success, otherwise a failure. (See ErrorReporter for details)
*/
function _setMaxAssets(uint newMaxAssets) external returns (uint) {
// Check caller is admin OR currently initialzing as new unitroller implementation
if (!adminOrInitializing()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_MAX_ASSETS_OWNER_CHECK);
}
uint oldMaxAssets = maxAssets;
maxAssets = newMaxAssets;
emit NewMaxAssets(oldMaxAssets, newMaxAssets);
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 OR currently initialzing as new unitroller implementation
if (!adminOrInitializing()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK);
}
// Check de-scaled 1 <= newLiquidationDiscount <= 1.5
Exp memory newLiquidationIncentive = Exp({mantissa: newLiquidationIncentiveMantissa});
Exp memory minLiquidationIncentive = Exp({mantissa: liquidationIncentiveMinMantissa});
if (lessThanExp(newLiquidationIncentive, minLiquidationIncentive)) {
return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);
}
Exp memory maxLiquidationIncentive = Exp({mantissa: liquidationIncentiveMaxMantissa});
if (lessThanExp(maxLiquidationIncentive, newLiquidationIncentive)) {
return fail(Error.INVALID_LIQUIDATION_INCENTIVE, FailureInfo.SET_LIQUIDATION_INCENTIVE_VALIDATION);
}
// 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 cToken The address of the market (token) to list
* @return uint 0=success, otherwise a failure. (See enum Error for details)
*/
function _supportMarket(CToken cToken) external returns (uint) {
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);
}
if (markets[address(cToken)].isListed) {
return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS);
}
cToken.isCToken(); // Sanity check to make sure its really a CToken
markets[address(cToken)] = Market({isListed: true, collateralFactorMantissa: 0});
emit MarketListed(cToken);
return uint(Error.NO_ERROR);
}
function _become(Unitroller unitroller, PriceOracle _oracle, uint _closeFactorMantissa, uint _maxAssets, bool reinitializing) public {
require(msg.sender == unitroller.admin(), "only unitroller admin can change brains");
uint changeStatus = unitroller._acceptImplementation();
require(changeStatus == 0, "change not authorized");
if (!reinitializing) {
ComptrollerG1 freshBrainedComptroller = ComptrollerG1(address(unitroller));
// Ensure invoke _setPriceOracle() = 0
uint err = freshBrainedComptroller._setPriceOracle(_oracle);
require (err == uint(Error.NO_ERROR), "set price oracle error");
// Ensure invoke _setCloseFactor() = 0
err = freshBrainedComptroller._setCloseFactor(_closeFactorMantissa);
require (err == uint(Error.NO_ERROR), "set close factor error");
// Ensure invoke _setMaxAssets() = 0
err = freshBrainedComptroller._setMaxAssets(_maxAssets);
require (err == uint(Error.NO_ERROR), "set max asssets error");
// Ensure invoke _setLiquidationIncentive(liquidationIncentiveMinMantissa) = 0
err = freshBrainedComptroller._setLiquidationIncentive(liquidationIncentiveMinMantissa);
require (err == uint(Error.NO_ERROR), "set liquidation incentive error");
}
}
/**
* @dev Check that caller is admin or this contract is initializing itself as
* the new implementation.
* There should be no way to satisfy msg.sender == comptrollerImplementaiton
* without tx.origin also being admin, but both are included for extra safety
*/
function adminOrInitializing() internal view returns (bool) {
bool initializing = (
msg.sender == comptrollerImplementation
&&
//solium-disable-next-line security/no-tx-origin
tx.origin == admin
);
bool isAdmin = hasAdminRights();
return isAdmin || initializing;
}
}pragma solidity ^0.5.16;
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 cTokens) external returns (uint[] memory);
function exitMarket(address cToken) external returns (uint);
/*** Policy Hooks ***/
function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint);
function mintWithinLimits(address cToken, uint exchangeRateMantissa, uint accountTokens, uint mintAmount) external returns (uint);
function mintVerify(address cToken, address minter, uint mintAmount, uint mintTokens) external;
function redeemAllowed(address cToken, address redeemer, uint redeemTokens) external returns (uint);
function redeemVerify(address cToken, address redeemer, uint redeemAmount, uint redeemTokens) external;
function borrowAllowed(address cToken, address borrower, uint borrowAmount) external returns (uint);
function borrowWithinLimits(address cToken, uint accountBorrowsNew) external returns (uint);
function borrowVerify(address cToken, address borrower, uint borrowAmount) external;
function repayBorrowAllowed(
address cToken,
address payer,
address borrower,
uint repayAmount) external returns (uint);
function repayBorrowVerify(
address cToken,
address payer,
address borrower,
uint repayAmount,
uint borrowerIndex) external;
function liquidateBorrowAllowed(
address cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint repayAmount) external returns (uint);
function liquidateBorrowVerify(
address cTokenBorrowed,
address cTokenCollateral,
address liquidator,
address borrower,
uint repayAmount,
uint seizeTokens) external;
function seizeAllowed(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
uint seizeTokens) external returns (uint);
function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
uint seizeTokens) external;
function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint);
function transferVerify(address cToken, address src, address dst, uint transferTokens) external;
/*** Liquidity/Liquidation Calculations ***/
function liquidateCalculateSeizeTokens(
address cTokenBorrowed,
address cTokenCollateral,
uint repayAmount) external view returns (uint, uint);
}
pragma solidity ^0.5.16;
import "./IFuseFeeDistributor.sol";
import "./CToken.sol";
import "./PriceOracle.sol";
contract UnitrollerAdminStorage {
/**
* @notice Administrator for Fuse
*/
IFuseFeeDistributor internal constant fuseAdmin = IFuseFeeDistributor(0xa731585ab05fC9f83555cf9Bff8F58ee94e18F85);
/**
* @notice Administrator for this contract
*/
address public admin;
/**
* @notice Pending administrator for this contract
*/
address public pendingAdmin;
/**
* @notice Whether or not the Fuse admin has admin rights
*/
bool public fuseAdminHasRights = true;
/**
* @notice Whether or not the admin has admin rights
*/
bool public adminHasRights = true;
/**
* @notice Returns a boolean indicating if the sender has admin rights
*/
function hasAdminRights() internal view returns (bool) {
return (msg.sender == admin && adminHasRights) || (msg.sender == address(fuseAdmin) && fuseAdminHasRights);
}
/**
* @notice Active brains of Unitroller
*/
address public comptrollerImplementation;
/**
* @notice Pending brains of Unitroller
*/
address public pendingComptrollerImplementation;
}
contract ComptrollerV1Storage 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 => CToken[]) public accountAssets;
}
contract ComptrollerV2Storage is ComptrollerV1Storage {
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 Official mapping of cTokens -> Market metadata
* @dev Used e.g. to determine if a market is supported
*/
mapping(address => Market) public markets;
/// @notice A list of all markets
CToken[] public allMarkets;
/**
* @dev Maps borrowers to booleans indicating if they have entered any markets
*/
mapping(address => bool) internal borrowers;
/// @notice A list of all borrowers who have entered markets
address[] public allBorrowers;
/// @notice Indexes of borrower account addresses in the `allBorrowers` array
mapping(address => uint256) internal borrowerIndexes;
/**
* @dev Maps suppliers to booleans indicating if they have ever supplied to any markets
*/
mapping(address => bool) public suppliers;
/// @notice All cTokens addresses mapped by their underlying token addresses
mapping(address => CToken) public cTokensByUnderlying;
/// @notice Whether or not the supplier whitelist is enforced
bool public enforceWhitelist;
/// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)
mapping(address => bool) public whitelist;
/// @notice An array of all whitelisted accounts
address[] public whitelistArray;
/// @notice Indexes of account addresses in the `whitelistArray` array
mapping(address => uint256) internal whitelistIndexes;
/**
* @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;
}
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstract base for CTokens
* @author Compound
*/
contract CToken is CTokenInterface, 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_,
uint256 reserveFactorMantissa_,
uint256 adminFeeMantissa_) public {
require(hasAdminRights(), "only admin may initialize the market");
require(accrualBlockNumber == 0 && borrowIndex == 0, "market may only be initialized once");
// Set initial exchange rate
initialExchangeRateMantissa = initialExchangeRateMantissa_;
require(initialExchangeRateMantissa > 0, "initial exchange rate must be greater than zero.");
// Set the comptroller
uint err = _setComptroller(comptroller_);
require(err == uint(Error.NO_ERROR), "setting comptroller failed");
// Initialize block number and borrow index (block number mocks depend on comptroller being set)
accrualBlockNumber = getBlockNumber();
borrowIndex = mantissaOne;
// Set the interest rate model (depends on block number / borrow index)
err = _setInterestRateModelFresh(interestRateModel_);
require(err == uint(Error.NO_ERROR), "setting interest rate model failed");
name = name_;
symbol = symbol_;
decimals = decimals_;
// Set reserve factor
err = _setReserveFactorFresh(reserveFactorMantissa_);
require(err == uint(Error.NO_ERROR), "setting reserve factor failed");
// Set admin fee
err = _setAdminFeeFresh(adminFeeMantissa_);
require(err == uint(Error.NO_ERROR), "setting admin fee failed");
// Set Fuse fee
err = _setFuseFeeFresh(getPendingFuseFeeFromAdmin());
require(err == uint(Error.NO_ERROR), "setting Fuse fee failed");
// The counter starts true to prevent changing it from zero to non-zero (i.e. smaller cost/refund)
_notEntered = true;
}
/**
* @dev Returns latest pending Fuse fee (to be set with `_setFuseFeeFresh`)
*/
function getPendingFuseFeeFromAdmin() internal view returns (uint) {
return fuseAdmin.interestFeeRate();
}
/**
* @notice Transfer `tokens` tokens from `src` to `dst` by `spender`
* @dev Called by both `transfer` and `transferFrom` internally
* @param spender The address of the account performing the transfer
* @param src The address of the source account
* @param dst The address of the destination account
* @param tokens The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferTokens(address spender, address src, address dst, uint tokens) internal returns (uint) {
/* Fail if transfer not allowed */
uint allowed = comptroller.transferAllowed(address(this), src, dst, tokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.TRANSFER_COMPTROLLER_REJECTION, allowed);
}
/* Do not allow self-transfers */
if (src == dst) {
return fail(Error.BAD_INPUT, FailureInfo.TRANSFER_NOT_ALLOWED);
}
/* Get the allowance, infinite for the account owner */
uint startingAllowance = 0;
if (spender == src) {
startingAllowance = uint(-1);
} else {
startingAllowance = transferAllowances[src][spender];
}
/* Do the calculations, checking for {under,over}flow */
MathError mathErr;
uint allowanceNew;
uint srcTokensNew;
uint dstTokensNew;
(mathErr, allowanceNew) = subUInt(startingAllowance, tokens);
if (mathErr != MathError.NO_ERROR) {
return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ALLOWED);
}
(mathErr, srcTokensNew) = subUInt(accountTokens[src], tokens);
if (mathErr != MathError.NO_ERROR) {
return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_NOT_ENOUGH);
}
(mathErr, dstTokensNew) = addUInt(accountTokens[dst], tokens);
if (mathErr != MathError.NO_ERROR) {
return fail(Error.MATH_ERROR, FailureInfo.TRANSFER_TOO_MUCH);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
accountTokens[src] = srcTokensNew;
accountTokens[dst] = dstTokensNew;
/* Eat some of the allowance (if necessary) */
if (startingAllowance != uint(-1)) {
transferAllowances[src][spender] = allowanceNew;
}
/* We emit a Transfer event */
emit Transfer(src, dst, tokens);
comptroller.transferVerify(address(this), src, dst, tokens);
return uint(Error.NO_ERROR);
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param amount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint256 amount) external nonReentrant returns (bool) {
return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR);
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param amount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) {
return transferTokens(msg.sender, src, dst, amount) == uint(Error.NO_ERROR);
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param amount The number of tokens that are approved (-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint256 amount) external returns (bool) {
address src = msg.sender;
transferAllowances[src][spender] = amount;
emit Approval(src, spender, amount);
return true;
}
/**
* @notice Get the current allowance from `owner` for `spender`
* @param owner The address of the account which owns the tokens to be spent
* @param spender The address of the account which may transfer tokens
* @return The number of tokens allowed to be spent (-1 means infinite)
*/
function allowance(address owner, address spender) external view returns (uint256) {
return transferAllowances[owner][spender];
}
/**
* @notice Get the token balance of the `owner`
* @param owner The address of the account to query
* @return The number of tokens owned by `owner`
*/
function balanceOf(address owner) external view returns (uint256) {
return accountTokens[owner];
}
/**
* @notice Get the underlying balance of the `owner`
* @dev This also accrues interest in a transaction
* @param owner The address of the account to query
* @return The amount of underlying owned by `owner`
*/
function balanceOfUnderlying(address owner) external returns (uint) {
Exp memory exchangeRate = Exp({mantissa: exchangeRateCurrent()});
(MathError mErr, uint balance) = mulScalarTruncate(exchangeRate, accountTokens[owner]);
require(mErr == MathError.NO_ERROR, "balance could not be calculated");
return balance;
}
/**
* @notice Get a snapshot of the account's balances, and the cached exchange rate
* @dev This is used by comptroller to more efficiently perform liquidity checks.
* @param account Address of the account to snapshot
* @return (possible error, token balance, borrow balance, exchange rate mantissa)
*/
function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) {
uint cTokenBalance = accountTokens[account];
uint borrowBalance;
uint exchangeRateMantissa;
MathError mErr;
(mErr, borrowBalance) = borrowBalanceStoredInternal(account);
if (mErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0, 0, 0);
}
(mErr, exchangeRateMantissa) = exchangeRateStoredInternal();
if (mErr != MathError.NO_ERROR) {
return (uint(Error.MATH_ERROR), 0, 0, 0);
}
return (uint(Error.NO_ERROR), cTokenBalance, borrowBalance, exchangeRateMantissa);
}
/**
* @dev Function to simply retrieve block number
* This exists mainly for inheriting test contracts to stub this result.
*/
function getBlockNumber() internal view returns (uint) {
return block.number;
}
/**
* @notice Returns the current per-block borrow interest rate for this cToken
* @return The borrow interest rate per block, scaled by 1e18
*/
function borrowRatePerBlock() external view returns (uint) {
return interestRateModel.getBorrowRate(getCashPrior(), totalBorrows, totalReserves + totalFuseFees + totalAdminFees);
}
/**
* @notice Returns the current per-block supply interest rate for this cToken
* @return The supply interest rate per block, scaled by 1e18
*/
function supplyRatePerBlock() external view returns (uint) {
return interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves + totalFuseFees + totalAdminFees, reserveFactorMantissa + fuseFeeMantissa + adminFeeMantissa);
}
/**
* @notice Returns the current total borrows plus accrued interest
* @return The total borrows with interest
*/
function totalBorrowsCurrent() external nonReentrant returns (uint) {
require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
return totalBorrows;
}
/**
* @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex
* @param account The address whose balance should be calculated after updating borrowIndex
* @return The calculated balance
*/
function borrowBalanceCurrent(address account) external nonReentrant returns (uint) {
require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
return borrowBalanceStored(account);
}
/**
* @notice Return the borrow balance of account based on stored data
* @param account The address whose balance should be calculated
* @return The calculated balance
*/
function borrowBalanceStored(address account) public view returns (uint) {
(MathError err, uint result) = borrowBalanceStoredInternal(account);
require(err == MathError.NO_ERROR, "borrowBalanceStored: borrowBalanceStoredInternal failed");
return result;
}
/**
* @notice Return the borrow balance of account based on stored data
* @param account The address whose balance should be calculated
* @return (error code, the calculated balance or 0 if error code is non-zero)
*/
function borrowBalanceStoredInternal(address account) internal view returns (MathError, uint) {
/* Note: we do not assert that the market is up to date */
MathError mathErr;
uint principalTimesIndex;
uint result;
/* Get borrowBalance and borrowIndex */
BorrowSnapshot storage borrowSnapshot = accountBorrows[account];
/* If borrowBalance = 0 then borrowIndex is likely also 0.
* Rather than failing the calculation with a division by 0, we immediately return 0 in this case.
*/
if (borrowSnapshot.principal == 0) {
return (MathError.NO_ERROR, 0);
}
/* Calculate new borrow balance using the interest index:
* recentBorrowBalance = borrower.borrowBalance * market.borrowIndex / borrower.borrowIndex
*/
(mathErr, principalTimesIndex) = mulUInt(borrowSnapshot.principal, borrowIndex);
if (mathErr != MathError.NO_ERROR) {
return (mathErr, 0);
}
(mathErr, result) = divUInt(principalTimesIndex, borrowSnapshot.interestIndex);
if (mathErr != MathError.NO_ERROR) {
return (mathErr, 0);
}
return (MathError.NO_ERROR, result);
}
/**
* @notice Accrue interest then return the up-to-date exchange rate
* @return Calculated exchange rate scaled by 1e18
*/
function exchangeRateCurrent() public nonReentrant returns (uint) {
require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
return exchangeRateStored();
}
/**
* @notice Calculates the exchange rate from the underlying to the CToken
* @dev This function does not accrue interest before calculating the exchange rate
* @return Calculated exchange rate scaled by 1e18
*/
function exchangeRateStored() public view returns (uint) {
(MathError err, uint result) = exchangeRateStoredInternal();
require(err == MathError.NO_ERROR, "exchangeRateStored: exchangeRateStoredInternal failed");
return result;
}
/**
* @notice Calculates the exchange rate from the underlying to the CToken
* @dev This function does not accrue interest before calculating the exchange rate
* @return (error code, calculated exchange rate scaled by 1e18)
*/
function exchangeRateStoredInternal() internal view returns (MathError, uint) {
uint _totalSupply = totalSupply;
if (_totalSupply == 0) {
/*
* If there are no tokens minted:
* exchangeRate = initialExchangeRate
*/
return (MathError.NO_ERROR, initialExchangeRateMantissa);
} else {
/*
* Otherwise:
* exchangeRate = (totalCash + totalBorrows - (totalReserves + totalFuseFees + totalAdminFees)) / totalSupply
*/
uint totalCash = getCashPrior();
uint cashPlusBorrowsMinusReserves;
Exp memory exchangeRate;
MathError mathErr;
(mathErr, cashPlusBorrowsMinusReserves) = addThenSubUInt(totalCash, totalBorrows, totalReserves + totalFuseFees + totalAdminFees);
if (mathErr != MathError.NO_ERROR) {
return (mathErr, 0);
}
(mathErr, exchangeRate) = getExp(cashPlusBorrowsMinusReserves, _totalSupply);
if (mathErr != MathError.NO_ERROR) {
return (mathErr, 0);
}
return (MathError.NO_ERROR, exchangeRate.mantissa);
}
}
/**
* @notice Get cash balance of this cToken in the underlying asset
* @return The quantity of underlying asset owned by this contract
*/
function getCash() external view returns (uint) {
return getCashPrior();
}
/**
* @notice Applies accrued interest to total borrows and reserves
* @dev This calculates interest accrued from the last checkpointed block
* up to the current block and writes new checkpoint to storage.
*/
function accrueInterest() public returns (uint) {
/* Remember the initial block number */
uint currentBlockNumber = getBlockNumber();
/* Short-circuit accumulating 0 interest */
if (accrualBlockNumber == currentBlockNumber) {
return uint(Error.NO_ERROR);
}
/* Read the previous values out of storage */
uint cashPrior = getCashPrior();
/* Calculate the current borrow interest rate */
uint borrowRateMantissa = interestRateModel.getBorrowRate(cashPrior, totalBorrows, totalReserves + totalFuseFees + totalAdminFees);
require(borrowRateMantissa <= borrowRateMaxMantissa, "borrow rate is absurdly high");
/* Calculate the number of blocks elapsed since the last accrual */
(MathError mathErr, uint blockDelta) = subUInt(currentBlockNumber, accrualBlockNumber);
require(mathErr == MathError.NO_ERROR, "could not calculate block delta");
return finishInterestAccrual(currentBlockNumber, cashPrior, borrowRateMantissa, blockDelta);
}
function finishInterestAccrual(uint currentBlockNumber, uint cashPrior, uint borrowRateMantissa, uint blockDelta) private returns (uint) {
/*
* 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
* totalFuseFeesNew = interestAccumulated * fuseFee + totalFuseFees
* totalAdminFeesNew = interestAccumulated * adminFee + totalAdminFees
* borrowIndexNew = simpleInterestFactor * borrowIndex + borrowIndex
*/
MathError mathErr;
Exp memory simpleInterestFactor;
uint interestAccumulated;
uint totalBorrowsNew;
uint totalReservesNew;
uint totalFuseFeesNew;
uint totalAdminFeesNew;
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, totalBorrows);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_ACCUMULATED_INTEREST_CALCULATION_FAILED, uint(mathErr));
}
(mathErr, totalBorrowsNew) = addUInt(interestAccumulated, totalBorrows);
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, totalReserves);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_RESERVES_CALCULATION_FAILED, uint(mathErr));
}
(mathErr, totalFuseFeesNew) = mulScalarTruncateAddUInt(Exp({mantissa: fuseFeeMantissa}), interestAccumulated, totalFuseFees);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_FUSE_FEES_CALCULATION_FAILED, uint(mathErr));
}
(mathErr, totalAdminFeesNew) = mulScalarTruncateAddUInt(Exp({mantissa: adminFeeMantissa}), interestAccumulated, totalAdminFees);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_CALCULATION_FAILED, uint(mathErr));
}
(mathErr, borrowIndexNew) = mulScalarTruncateAddUInt(simpleInterestFactor, borrowIndex, borrowIndex);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.ACCRUE_INTEREST_NEW_BORROW_INDEX_CALCULATION_FAILED, uint(mathErr));
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/* We write the previously calculated values into storage */
accrualBlockNumber = currentBlockNumber;
borrowIndex = borrowIndexNew;
totalBorrows = totalBorrowsNew;
totalReserves = totalReservesNew;
totalFuseFees = totalFuseFeesNew;
totalAdminFees = totalAdminFeesNew;
/* We emit an AccrueInterest event */
emit AccrueInterest(cashPrior, interestAccumulated, borrowIndexNew, totalBorrowsNew);
return uint(Error.NO_ERROR);
}
/**
* @notice Sender supplies assets into the market and receives cTokens in exchange
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param mintAmount The amount of the underlying asset to supply
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.
*/
function mintInternal(uint mintAmount) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
return (fail(Error(error), FailureInfo.MINT_ACCRUE_INTEREST_FAILED), 0);
}
// mintFresh emits the actual Mint event if successful and logs on errors, so we don't need to
return mintFresh(msg.sender, mintAmount);
}
struct MintLocalVars {
Error err;
MathError mathErr;
uint exchangeRateMantissa;
uint mintTokens;
uint totalSupplyNew;
uint accountTokensNew;
uint actualMintAmount;
}
/**
* @notice User supplies assets into the market and receives cTokens in exchange
* @dev Assumes interest has already been accrued up to the current block
* @param minter The address of the account which is supplying the assets
* @param mintAmount The amount of the underlying asset to supply
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual mint amount.
*/
function mintFresh(address minter, uint mintAmount) internal returns (uint, uint) {
/* Fail if mint not allowed */
uint allowed = comptroller.mintAllowed(address(this), minter, mintAmount);
if (allowed != 0) {
return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);
}
/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return (fail(Error.MARKET_NOT_FRESH, FailureInfo.MINT_FRESHNESS_CHECK), 0);
}
MintLocalVars memory vars;
(vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
if (vars.mathErr != MathError.NO_ERROR) {
return (failOpaque(Error.MATH_ERROR, FailureInfo.MINT_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr)), 0);
}
// Check max supply
allowed = comptroller.mintWithinLimits(address(this), vars.exchangeRateMantissa, accountTokens[minter], mintAmount);
if (allowed != 0) {
return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.MINT_COMPTROLLER_REJECTION, allowed), 0);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/*
* We call `doTransferIn` for the minter and the mintAmount.
* Note: The cToken must handle variations between ERC-20 and ETH underlying.
* `doTransferIn` reverts if anything goes wrong, since we can't be sure if
* side-effects occurred. The function returns the amount actually transferred,
* in case of a fee. On success, the cToken holds an additional `actualMintAmount`
* of cash.
*/
vars.actualMintAmount = doTransferIn(minter, mintAmount);
/*
* We get the current exchange rate and calculate the number of cTokens to be minted:
* mintTokens = actualMintAmount / exchangeRate
*/
(vars.mathErr, vars.mintTokens) = divScalarByExpTruncate(vars.actualMintAmount, Exp({mantissa: vars.exchangeRateMantissa}));
require(vars.mathErr == MathError.NO_ERROR, "MINT_EXCHANGE_CALCULATION_FAILED");
/*
* We calculate the new total supply of cTokens and minter token balance, checking for overflow:
* totalSupplyNew = totalSupply + mintTokens
* accountTokensNew = accountTokens[minter] + mintTokens
*/
(vars.mathErr, vars.totalSupplyNew) = addUInt(totalSupply, vars.mintTokens);
require(vars.mathErr == MathError.NO_ERROR, "MINT_NEW_TOTAL_SUPPLY_CALCULATION_FAILED");
(vars.mathErr, vars.accountTokensNew) = addUInt(accountTokens[minter], vars.mintTokens);
require(vars.mathErr == MathError.NO_ERROR, "MINT_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED");
/* We write previously calculated values into storage */
totalSupply = vars.totalSupplyNew;
accountTokens[minter] = vars.accountTokensNew;
/* We emit a Mint event, and a Transfer event */
emit Mint(minter, vars.actualMintAmount, vars.mintTokens);
emit Transfer(address(this), minter, vars.mintTokens);
/* We call the defense hook */
comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);
return (uint(Error.NO_ERROR), vars.actualMintAmount);
}
/**
* @notice Sender redeems cTokens in exchange for the underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemTokens The number of cTokens to redeem into underlying
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeemInternal(uint redeemTokens) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
}
// redeemFresh emits redeem-specific logs on errors, so we don't need to
return redeemFresh(msg.sender, redeemTokens, 0);
}
/**
* @notice Sender redeems cTokens in exchange for a specified amount of underlying asset
* @dev Accrues interest whether or not the operation succeeds, unless reverted
* @param redeemAmount The amount of underlying to receive from redeeming cTokens
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeemUnderlyingInternal(uint redeemAmount) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted redeem failed
return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
}
// redeemFresh emits redeem-specific logs on errors, so we don't need to
return redeemFresh(msg.sender, 0, redeemAmount);
}
struct RedeemLocalVars {
Error err;
MathError mathErr;
uint exchangeRateMantissa;
uint redeemTokens;
uint redeemAmount;
uint totalSupplyNew;
uint accountTokensNew;
}
/**
* @notice User redeems cTokens in exchange for the underlying asset
* @dev Assumes interest has already been accrued up to the current block
* @param redeemer The address of the account which is redeeming the tokens
* @param redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero)
* @param redeemAmountIn The number of underlying tokens to receive from redeeming cTokens (only one of redeemTokensIn or redeemAmountIn may be non-zero)
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rate Stored() */
(vars.mathErr, vars.exchangeRateMantissa) = exchangeRateStoredInternal();
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_RATE_READ_FAILED, uint(vars.mathErr));
}
/* If redeemTokensIn > 0: */
if (redeemTokensIn > 0) {
/*
* We calculate the exchange rate and the amount of underlying to be redeemed:
* redeemTokens = redeemTokensIn
* redeemAmount = redeemTokensIn x exchangeRateCurrent
*/
vars.redeemTokens = redeemTokensIn;
(vars.mathErr, vars.redeemAmount) = mulScalarTruncate(Exp({mantissa: vars.exchangeRateMantissa}), redeemTokensIn);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_TOKENS_CALCULATION_FAILED, uint(vars.mathErr));
}
} else {
/*
* We get the current exchange rate and calculate the amount to be redeemed:
* redeemTokens = redeemAmountIn / exchangeRate
* redeemAmount = redeemAmountIn
*/
(vars.mathErr, vars.redeemTokens) = divScalarByExpTruncate(redeemAmountIn, Exp({mantissa: vars.exchangeRateMantissa}));
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_EXCHANGE_AMOUNT_CALCULATION_FAILED, uint(vars.mathErr));
}
vars.redeemAmount = redeemAmountIn;
}
/* Fail if redeem not allowed */
uint allowed = comptroller.redeemAllowed(address(this), redeemer, vars.redeemTokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REDEEM_COMPTROLLER_REJECTION, allowed);
}
/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDEEM_FRESHNESS_CHECK);
}
/*
* We calculate the new total supply and redeemer balance, checking for underflow:
* totalSupplyNew = totalSupply - redeemTokens
* accountTokensNew = accountTokens[redeemer] - redeemTokens
*/
(vars.mathErr, vars.totalSupplyNew) = subUInt(totalSupply, vars.redeemTokens);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_TOTAL_SUPPLY_CALCULATION_FAILED, uint(vars.mathErr));
}
(vars.mathErr, vars.accountTokensNew) = subUInt(accountTokens[redeemer], vars.redeemTokens);
if (vars.mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.REDEEM_NEW_ACCOUNT_BALANCE_CALCULATION_FAILED, uint(vars.mathErr));
}
/* Fail gracefully if protocol has insufficient cash */
if (getCashPrior() < vars.redeemAmount) {
return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDEEM_TRANSFER_OUT_NOT_POSSIBLE);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/*
* We invoke doTransferOut for the redeemer and the redeemAmount.
* Note: The cToken must handle variations between ERC-20 and ETH underlying.
* On success, the cToken has redeemAmount less of cash.
* doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.
*/
doTransferOut(redeemer, vars.redeemAmount);
/* We write previously calculated values into storage */
totalSupply = vars.totalSupplyNew;
accountTokens[redeemer] = vars.accountTokensNew;
/* We emit a Transfer event, and a Redeem event */
emit Transfer(redeemer, address(this), vars.redeemTokens);
emit Redeem(redeemer, vars.redeemAmount, vars.redeemTokens);
/* We call the defense hook */
comptroller.redeemVerify(address(this), redeemer, vars.redeemAmount, vars.redeemTokens);
return uint(Error.NO_ERROR);
}
/**
* @notice Sender borrows assets from the protocol to their own address
* @param borrowAmount The amount of the underlying asset to borrow
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function borrowInternal(uint borrowAmount) internal nonReentrant returns (uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
return fail(Error(error), FailureInfo.BORROW_ACCRUE_INTEREST_FAILED);
}
// borrowFresh emits borrow-specific logs on errors, so we don't need to
return borrowFresh(msg.sender, borrowAmount);
}
struct BorrowLocalVars {
MathError mathErr;
uint accountBorrows;
uint accountBorrowsNew;
uint totalBorrowsNew;
}
/**
* @notice Users borrow assets from the protocol to their own address
* @param borrowAmount The amount of the underlying asset to borrow
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function borrowFresh(address payable borrower, uint borrowAmount) internal returns (uint) {
/* Fail if borrow not allowed */
uint allowed = comptroller.borrowAllowed(address(this), borrower, borrowAmount);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);
}
/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.BORROW_FRESHNESS_CHECK);
}
/* Fail gracefully if protocol has insufficient underlying cash */
uint cashPrior = getCashPrior();
if (cashPrior < 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));
}
// Check min borrow for this user for this asset
allowed = comptroller.borrowWithinLimits(address(this), vars.accountBorrowsNew);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.BORROW_COMPTROLLER_REJECTION, allowed);
}
(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));
}
// Check max utilization rate for this asset
uint maxUtilizationRate = fuseAdmin.maxUtilizationRate();
if (maxUtilizationRate < uint(-1)) {
uint256 utilizationRate = vars.totalBorrowsNew == 0 ? 0 : vars.totalBorrowsNew * 1e18 / (cashPrior + totalBorrows - (totalReserves + totalFuseFees + totalAdminFees));
if (utilizationRate > maxUtilizationRate) return fail(Error.UTILIZATION_ABOVE_MAX, FailureInfo.NEW_UTILIZATION_RATE_ABOVE_MAX);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/*
* We invoke doTransferOut for the borrower and the borrowAmount.
* Note: The cToken must handle variations between ERC-20 and ETH underlying.
* On success, the cToken borrowAmount less of cash.
* doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.
*/
doTransferOut(borrower, borrowAmount);
/* We write the previously calculated values into storage */
accountBorrows[borrower].principal = vars.accountBorrowsNew;
accountBorrows[borrower].interestIndex = borrowIndex;
totalBorrows = vars.totalBorrowsNew;
/* We emit a Borrow event */
emit Borrow(borrower, borrowAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);
/* We call the defense hook */
comptroller.borrowVerify(address(this), borrower, borrowAmount);
return uint(Error.NO_ERROR);
}
/**
* @notice Sender repays their own borrow
* @param repayAmount The amount to repay
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.
*/
function repayBorrowInternal(uint repayAmount) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
return (fail(Error(error), FailureInfo.REPAY_BORROW_ACCRUE_INTEREST_FAILED), 0);
}
// repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to
return repayBorrowFresh(msg.sender, msg.sender, repayAmount);
}
/**
* @notice Sender repays a borrow belonging to borrower
* @param borrower the account with the debt being payed off
* @param repayAmount The amount to repay
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.
*/
function repayBorrowBehalfInternal(address borrower, uint repayAmount) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted borrow failed
return (fail(Error(error), FailureInfo.REPAY_BEHALF_ACCRUE_INTEREST_FAILED), 0);
}
// repayBorrowFresh emits repay-borrow-specific logs on errors, so we don't need to
return repayBorrowFresh(msg.sender, borrower, repayAmount);
}
struct RepayBorrowLocalVars {
Error err;
MathError mathErr;
uint repayAmount;
uint borrowerIndex;
uint accountBorrows;
uint accountBorrowsNew;
uint totalBorrowsNew;
uint actualRepayAmount;
}
/**
* @notice Borrows are repaid by another user (possibly the borrower).
* @param payer the account paying off the borrow
* @param borrower the account with the debt being payed off
* @param repayAmount the amount of undelrying tokens being returned
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.
*/
function repayBorrowFresh(address payer, address borrower, uint repayAmount) internal returns (uint, uint) {
/* Fail if repayBorrow not allowed */
uint allowed = comptroller.repayBorrowAllowed(address(this), payer, borrower, repayAmount);
if (allowed != 0) {
return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.REPAY_BORROW_COMPTROLLER_REJECTION, allowed), 0);
}
/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return (fail(Error.MARKET_NOT_FRESH, FailureInfo.REPAY_BORROW_FRESHNESS_CHECK), 0);
}
RepayBorrowLocalVars memory vars;
/* We remember the original borrowerIndex for verification purposes */
vars.borrowerIndex = accountBorrows[borrower].interestIndex;
/* We fetch the amount the borrower owes, with accumulated interest */
(vars.mathErr, vars.accountBorrows) = borrowBalanceStoredInternal(borrower);
if (vars.mathErr != MathError.NO_ERROR) {
return (failOpaque(Error.MATH_ERROR, FailureInfo.REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED, uint(vars.mathErr)), 0);
}
/* If repayAmount == -1, repayAmount = accountBorrows */
if (repayAmount == uint(-1)) {
vars.repayAmount = vars.accountBorrows;
} else {
vars.repayAmount = repayAmount;
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/*
* We call doTransferIn for the payer and the repayAmount
* Note: The cToken must handle variations between ERC-20 and ETH underlying.
* On success, the cToken holds an additional repayAmount of cash.
* doTransferIn reverts if anything goes wrong, since we can't be sure if side effects occurred.
* it returns the amount actually transferred, in case of a fee.
*/
vars.actualRepayAmount = doTransferIn(payer, vars.repayAmount);
/*
* We calculate the new borrower and total borrow balances, failing on underflow:
* accountBorrowsNew = accountBorrows - actualRepayAmount
* totalBorrowsNew = totalBorrows - actualRepayAmount
*/
(vars.mathErr, vars.accountBorrowsNew) = subUInt(vars.accountBorrows, vars.actualRepayAmount);
require(vars.mathErr == MathError.NO_ERROR, "REPAY_BORROW_NEW_ACCOUNT_BORROW_BALANCE_CALCULATION_FAILED");
(vars.mathErr, vars.totalBorrowsNew) = subUInt(totalBorrows, vars.actualRepayAmount);
require(vars.mathErr == MathError.NO_ERROR, "REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED");
/* We write the previously calculated values into storage */
accountBorrows[borrower].principal = vars.accountBorrowsNew;
accountBorrows[borrower].interestIndex = borrowIndex;
totalBorrows = vars.totalBorrowsNew;
/* We emit a RepayBorrow event */
emit RepayBorrow(payer, borrower, vars.actualRepayAmount, vars.accountBorrowsNew, vars.totalBorrowsNew);
/* We call the defense hook */
comptroller.repayBorrowVerify(address(this), payer, borrower, vars.actualRepayAmount, vars.borrowerIndex);
return (uint(Error.NO_ERROR), vars.actualRepayAmount);
}
/**
* @notice The sender liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @param borrower The borrower of this cToken to be liquidated
* @param cTokenCollateral The market in which to seize collateral from the borrower
* @param repayAmount The amount of the underlying borrowed asset to repay
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.
*/
function liquidateBorrowInternal(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal nonReentrant returns (uint, uint) {
uint error = accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed
return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_BORROW_INTEREST_FAILED), 0);
}
error = cTokenCollateral.accrueInterest();
if (error != uint(Error.NO_ERROR)) {
// accrueInterest emits logs on errors, but we still want to log the fact that an attempted liquidation failed
return (fail(Error(error), FailureInfo.LIQUIDATE_ACCRUE_COLLATERAL_INTEREST_FAILED), 0);
}
// liquidateBorrowFresh emits borrow-specific logs on errors, so we don't need to
return liquidateBorrowFresh(msg.sender, borrower, repayAmount, cTokenCollateral);
}
/**
* @notice The liquidator liquidates the borrowers collateral.
* The collateral seized is transferred to the liquidator.
* @param borrower The borrower of this cToken to be liquidated
* @param liquidator The address repaying the borrow and seizing collateral
* @param cTokenCollateral The market in which to seize collateral from the borrower
* @param repayAmount The amount of the underlying borrowed asset to repay
* @return (uint, uint) An error code (0=success, otherwise a failure, see ErrorReporter.sol), and the actual repayment amount.
*/
function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal returns (uint, uint) {
/* Fail if liquidate not allowed */
uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(cTokenCollateral), liquidator, borrower, repayAmount);
if (allowed != 0) {
return (failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_COMPTROLLER_REJECTION, allowed), 0);
}
/* Verify market's block number equals current block number */
if (accrualBlockNumber != getBlockNumber()) {
return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_FRESHNESS_CHECK), 0);
}
/* Verify cTokenCollateral market's block number equals current block number */
if (cTokenCollateral.accrualBlockNumber() != getBlockNumber()) {
return (fail(Error.MARKET_NOT_FRESH, FailureInfo.LIQUIDATE_COLLATERAL_FRESHNESS_CHECK), 0);
}
/* Fail if borrower = liquidator */
if (borrower == liquidator) {
return (fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_LIQUIDATOR_IS_BORROWER), 0);
}
/* Fail if repayAmount = 0 */
if (repayAmount == 0) {
return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_ZERO), 0);
}
/* Fail if repayAmount = -1 */
if (repayAmount == uint(-1)) {
return (fail(Error.INVALID_CLOSE_AMOUNT_REQUESTED, FailureInfo.LIQUIDATE_CLOSE_AMOUNT_IS_UINT_MAX), 0);
}
/* Fail if repayBorrow fails */
(uint repayBorrowError, uint actualRepayAmount) = repayBorrowFresh(liquidator, borrower, repayAmount);
if (repayBorrowError != uint(Error.NO_ERROR)) {
return (fail(Error(repayBorrowError), FailureInfo.LIQUIDATE_REPAY_BORROW_FRESH_FAILED), 0);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/* We calculate the number of collateral tokens that will be seized */
(uint amountSeizeError, uint seizeTokens) = comptroller.liquidateCalculateSeizeTokens(address(this), address(cTokenCollateral), actualRepayAmount);
require(amountSeizeError == uint(Error.NO_ERROR), "LIQUIDATE_COMPTROLLER_CALCULATE_AMOUNT_SEIZE_FAILED");
/* Revert if borrower collateral token balance < seizeTokens */
require(cTokenCollateral.balanceOf(borrower) >= seizeTokens, "LIQUIDATE_SEIZE_TOO_MUCH");
// If this is also the collateral, run seizeInternal to avoid re-entrancy, otherwise make an external call
uint seizeError;
if (address(cTokenCollateral) == address(this)) {
seizeError = seizeInternal(address(this), liquidator, borrower, seizeTokens);
} else {
seizeError = cTokenCollateral.seize(liquidator, borrower, seizeTokens);
}
/* Revert if seize tokens fails (since we cannot be sure of side effects) */
require(seizeError == uint(Error.NO_ERROR), "token seizure failed");
/* We emit a LiquidateBorrow event */
emit LiquidateBorrow(liquidator, borrower, actualRepayAmount, address(cTokenCollateral), seizeTokens);
/* We call the defense hook */
comptroller.liquidateBorrowVerify(address(this), address(cTokenCollateral), liquidator, borrower, actualRepayAmount, seizeTokens);
return (uint(Error.NO_ERROR), actualRepayAmount);
}
/**
* @notice Transfers collateral tokens (this market) to the liquidator.
* @dev Will fail unless called by another cToken during the process of liquidation.
* Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter.
* @param liquidator The account receiving seized collateral
* @param borrower The account having collateral seized
* @param seizeTokens The number of cTokens to seize
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function seize(address liquidator, address borrower, uint seizeTokens) external nonReentrant returns (uint) {
return seizeInternal(msg.sender, liquidator, borrower, seizeTokens);
}
/**
* @notice Transfers collateral tokens (this market) to the liquidator.
* @dev Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken.
* Its absolutely critical to use msg.sender as the seizer cToken and not a parameter.
* @param seizerToken The contract seizing the collateral (i.e. borrowed cToken)
* @param liquidator The account receiving seized collateral
* @param borrower The account having collateral seized
* @param seizeTokens The number of cTokens to seize
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) {
/* Fail if seize not allowed */
uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_REJECTION, FailureInfo.LIQUIDATE_SEIZE_COMPTROLLER_REJECTION, allowed);
}
/* Fail if borrower = liquidator */
if (borrower == liquidator) {
return fail(Error.INVALID_ACCOUNT_PAIR, FailureInfo.LIQUIDATE_SEIZE_LIQUIDATOR_IS_BORROWER);
}
MathError mathErr;
uint borrowerTokensNew;
uint liquidatorTokensNew;
/*
* We calculate the new borrower and liquidator token balances, failing on underflow/overflow:
* borrowerTokensNew = accountTokens[borrower] - seizeTokens
* liquidatorTokensNew = accountTokens[liquidator] + seizeTokens
*/
(mathErr, borrowerTokensNew) = subUInt(accountTokens[borrower], seizeTokens);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_DECREMENT_FAILED, uint(mathErr));
}
(mathErr, liquidatorTokensNew) = addUInt(accountTokens[liquidator], seizeTokens);
if (mathErr != MathError.NO_ERROR) {
return failOpaque(Error.MATH_ERROR, FailureInfo.LIQUIDATE_SEIZE_BALANCE_INCREMENT_FAILED, uint(mathErr));
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
/* We write the previously calculated values into storage */
accountTokens[borrower] = borrowerTokensNew;
accountTokens[liquidator] = liquidatorTokensNew;
/* Emit a Transfer event */
emit Transfer(borrower, liquidator, seizeTokens);
/* We call the defense hook */
comptroller.seizeVerify(address(this), seizerToken, liquidator, borrower, seizeTokens);
return uint(Error.NO_ERROR);
}
/*** Admin Functions ***/
/**
* @notice Renounce the Fuse admin rights.
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _renounceFuseAdminRights() external returns (uint) {
// Check caller = admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.RENOUNCE_ADMIN_RIGHTS_OWNER_CHECK);
}
// Check that rights have not already been renounced
if (!fuseAdminHasRights) return uint(Error.NO_ERROR);
// Set fuseAdminHasRights to false
fuseAdminHasRights = false;
// Emit FuseAdminRightsRenounced()
emit FuseAdminRightsRenounced();
return uint(Error.NO_ERROR);
}
/**
* @notice Renounce admin rights.
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _renounceAdminRights() external returns (uint) {
// Check caller = admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.RENOUNCE_ADMIN_RIGHTS_OWNER_CHECK);
}
// Check that rights have not already been renounced
if (!adminHasRights) return uint(Error.NO_ERROR);
// Set adminHasRights to false
adminHasRights = false;
// Emit AdminRightsRenounced()
emit AdminRightsRenounced();
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 payable newPendingAdmin) external returns (uint) {
// Check caller = admin
if (!hasAdminRights()) {
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 (!hasAdminRights()) {
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 admin fee for the protocol using _setAdminFeeFresh
* @dev Admin function to accrue interest and set a new admin fee
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _setAdminFee(uint newAdminFeeMantissa) 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 admin fee change failed.
return fail(Error(error), FailureInfo.SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED);
}
// _setAdminFeeFresh emits reserve-factor-specific logs on errors, so we don't need to.
return _setAdminFeeFresh(newAdminFeeMantissa);
}
/**
* @notice Sets a new admin fee for the protocol (*requires fresh interest accrual)
* @dev Admin function to set a new admin fee
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _setAdminFeeFresh(uint newAdminFeeMantissa) internal returns (uint) {
// Check caller is admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_ADMIN_FEE_ADMIN_CHECK);
}
// Verify market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_ADMIN_FEE_FRESH_CHECK);
}
// Check newAdminFee ≤ maxAdminFee
if (reserveFactorMantissa + newAdminFeeMantissa + fuseFeeMantissa > reserveFactorPlusFeesMaxMantissa) {
return fail(Error.BAD_INPUT, FailureInfo.SET_ADMIN_FEE_BOUNDS_CHECK);
}
uint oldAdminFeeMantissa = adminFeeMantissa;
adminFeeMantissa = newAdminFeeMantissa;
emit NewAdminFee(oldAdminFeeMantissa, newAdminFeeMantissa);
return uint(Error.NO_ERROR);
}
/**
* @notice accrues interest and sets a new Fuse fee for the protocol using _setFuseFeeFresh
* @dev Function to accrue interest and set a new Fuse fee
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _setFuseFee() 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 admin fee change failed.
return fail(Error(error), FailureInfo.SET_FUSE_FEE_ACCRUE_INTEREST_FAILED);
}
// _setAdminFeeFresh emits reserve-factor-specific logs on errors, so we don't need to.
return _setFuseFeeFresh(getPendingFuseFeeFromAdmin());
}
/**
* @notice Sets a new Fuse fee for the protocol (*requires fresh interest accrual)
* @dev Function to set a new Fuse fee
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _setFuseFeeFresh(uint newFuseFeeMantissa) internal returns (uint) {
// Check newFuseFeeMantissa != fuseFeeMantissa
if (newFuseFeeMantissa == fuseFeeMantissa) {
return uint(Error.NO_ERROR);
}
// Verify market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_FUSE_FEE_FRESH_CHECK);
}
// Check newAdminFee ≤ maxFuseFee
if (reserveFactorMantissa + adminFeeMantissa + newFuseFeeMantissa > reserveFactorPlusFeesMaxMantissa) {
return fail(Error.BAD_INPUT, FailureInfo.SET_FUSE_FEE_BOUNDS_CHECK);
}
uint oldFuseFeeMantissa = fuseFeeMantissa;
fuseFeeMantissa = newFuseFeeMantissa;
emit NewFuseFee(oldFuseFeeMantissa, newFuseFeeMantissa);
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 (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_RESERVE_FACTOR_ADMIN_CHECK);
}
// Verify market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_RESERVE_FACTOR_FRESH_CHECK);
}
// Check newReserveFactor ≤ maxReserveFactor
if (newReserveFactorMantissa + adminFeeMantissa + fuseFeeMantissa > reserveFactorPlusFeesMaxMantissa) {
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 number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
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 cToken must handle variations between ERC-20 and ETH underlying.
* On success, the cToken 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 (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.REDUCE_RESERVES_ADMIN_CHECK);
}
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.REDUCE_RESERVES_FRESH_CHECK);
}
// Fail gracefully if protocol has insufficient underlying cash
if (getCashPrior() < reduceAmount) {
return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.REDUCE_RESERVES_CASH_NOT_AVAILABLE);
}
// Check reduceAmount ≤ reserves[n] (totalReserves)
if (reduceAmount > totalReserves) {
return fail(Error.BAD_INPUT, FailureInfo.REDUCE_RESERVES_VALIDATION);
}
/////////////////////////
// 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 reduces Fuse fees by transferring to Fuse
* @param withdrawAmount Amount of fees to withdraw
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _withdrawFuseFees(uint withdrawAmount) 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 Fuse fee withdrawal failed.
return fail(Error(error), FailureInfo.WITHDRAW_FUSE_FEES_ACCRUE_INTEREST_FAILED);
}
// _withdrawFuseFeesFresh emits reserve-reduction-specific logs on errors, so we don't need to.
return _withdrawFuseFeesFresh(withdrawAmount);
}
/**
* @notice Reduces Fuse fees by transferring to Fuse
* @dev Requires fresh interest accrual
* @param withdrawAmount Amount of fees to withdraw
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _withdrawFuseFeesFresh(uint withdrawAmount) internal returns (uint) {
// totalFuseFees - reduceAmount
uint totalFuseFeesNew;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_FUSE_FEES_FRESH_CHECK);
}
// Fail gracefully if protocol has insufficient underlying cash
if (getCashPrior() < withdrawAmount) {
return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_FUSE_FEES_CASH_NOT_AVAILABLE);
}
// Check withdrawAmount ≤ fuseFees[n] (totalFuseFees)
if (withdrawAmount > totalFuseFees) {
return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_FUSE_FEES_VALIDATION);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
totalFuseFeesNew = totalFuseFees - withdrawAmount;
// We checked withdrawAmount <= totalFuseFees above, so this should never revert.
require(totalFuseFeesNew <= totalFuseFees, "withdraw Fuse fees unexpected underflow");
// Store fuseFees[n+1] = fuseFees[n] - withdrawAmount
totalFuseFees = totalFuseFeesNew;
// doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.
doTransferOut(address(fuseAdmin), withdrawAmount);
return uint(Error.NO_ERROR);
}
/**
* @notice Accrues interest and reduces admin fees by transferring to admin
* @param withdrawAmount Amount of fees to withdraw
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _withdrawAdminFees(uint withdrawAmount) 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 admin fee withdrawal failed.
return fail(Error(error), FailureInfo.WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED);
}
// _withdrawAdminFeesFresh emits reserve-reduction-specific logs on errors, so we don't need to.
return _withdrawAdminFeesFresh(withdrawAmount);
}
/**
* @notice Reduces admin fees by transferring to admin
* @dev Requires fresh interest accrual
* @param withdrawAmount Amount of fees to withdraw
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _withdrawAdminFeesFresh(uint withdrawAmount) internal returns (uint) {
// totalAdminFees - reduceAmount
uint totalAdminFeesNew;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.WITHDRAW_ADMIN_FEES_FRESH_CHECK);
}
// Fail gracefully if protocol has insufficient underlying cash
if (getCashPrior() < withdrawAmount) {
return fail(Error.TOKEN_INSUFFICIENT_CASH, FailureInfo.WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE);
}
// Check withdrawAmount ≤ adminFees[n] (totalAdminFees)
if (withdrawAmount > totalAdminFees) {
return fail(Error.BAD_INPUT, FailureInfo.WITHDRAW_ADMIN_FEES_VALIDATION);
}
/////////////////////////
// EFFECTS & INTERACTIONS
// (No safe failures beyond this point)
totalAdminFeesNew = totalAdminFees - withdrawAmount;
// We checked withdrawAmount <= totalAdminFees above, so this should never revert.
require(totalAdminFeesNew <= totalAdminFees, "withdraw admin fees unexpected underflow");
// Store adminFees[n+1] = adminFees[n] - withdrawAmount
totalAdminFees = totalAdminFeesNew;
// doTransferOut reverts if anything goes wrong, since we can't be sure if side effects occurred.
doTransferOut(admin, withdrawAmount);
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 (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_INTEREST_RATE_MODEL_OWNER_CHECK);
}
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber()) {
return fail(Error.MARKET_NOT_FRESH, FailureInfo.SET_INTEREST_RATE_MODEL_FRESH_CHECK);
}
// Track the market's current interest rate model
oldInterestRateModel = interestRateModel;
// Ensure invoke newInterestRateModel.isInterestRateModel() returns true
require(newInterestRateModel.isInterestRateModel(), "marker method returned false");
// Set the interest rate model to newInterestRateModel
interestRateModel = newInterestRateModel;
// Emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel)
emit NewMarketInterestRateModel(oldInterestRateModel, newInterestRateModel);
return uint(Error.NO_ERROR);
}
/*** Safe Token ***/
/**
* @notice Gets balance of this contract in terms of the underlying
* @dev This excludes the value of the current message, if any
* @return The quantity of underlying owned by this contract
*/
function getCashPrior() internal view returns (uint);
/**
* @dev Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee.
* This may revert due to insufficient balance or insufficient allowance.
*/
function doTransferIn(address from, uint amount) internal returns (uint);
/**
* @dev Performs a transfer out, ideally returning an explanatory error code upon failure tather than reverting.
* If caller has not called checked protocol's balance, may revert due to insufficient cash held in the contract.
* If caller has checked protocol's balance, and verified it is >= amount, this should not revert in normal conditions.
*/
function doTransferOut(address payable to, uint amount) internal;
/*** 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
}
}
pragma solidity ^0.5.16;
import "./IFuseFeeDistributor.sol";
import "./ComptrollerInterface.sol";
import "./InterestRateModel.sol";
contract CTokenAdminStorage {
/**
* @notice Administrator for Fuse
*/
IFuseFeeDistributor internal constant fuseAdmin = IFuseFeeDistributor(0xa731585ab05fC9f83555cf9Bff8F58ee94e18F85);
/**
* @notice Administrator for this contract
*/
address payable public admin;
/**
* @notice Whether or not the Fuse admin has admin rights
*/
bool public fuseAdminHasRights = true;
/**
* @notice Whether or not the admin has admin rights
*/
bool public adminHasRights = true;
/**
* @notice Returns a boolean indicating if the sender has admin rights
*/
function hasAdminRights() internal view returns (bool) {
return (msg.sender == admin && adminHasRights) || (msg.sender == address(fuseAdmin) && fuseAdminHasRights);
}
}
contract CTokenStorage is CTokenAdminStorage {
/**
* @dev Guard variable for re-entrancy checks
*/
bool internal _notEntered;
/**
* @notice EIP-20 token name for this token
*/
string public name;
/**
* @notice EIP-20 token symbol for this token
*/
string public symbol;
/**
* @notice EIP-20 token decimals for this token
*/
uint8 public decimals;
/**
* @notice 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 + fees
*/
uint internal constant reserveFactorPlusFeesMaxMantissa = 1e18;
/**
* @notice Pending administrator for this contract
*/
address payable public pendingAdmin;
/**
* @notice Contract which oversees inter-cToken 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 CTokens (used when totalSupply = 0)
*/
uint internal initialExchangeRateMantissa;
/**
* @notice Fraction of interest currently set aside for admin fees
*/
uint public adminFeeMantissa;
/**
* @notice Fraction of interest currently set aside for Fuse fees
*/
uint public fuseFeeMantissa;
/**
* @notice Fraction of interest currently set aside for reserves
*/
uint public reserveFactorMantissa;
/**
* @notice Block number that interest was last accrued at
*/
uint public accrualBlockNumber;
/**
* @notice 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 amount of admin fees of the underlying held in this market
*/
uint public totalAdminFees;
/**
* @notice Total amount of Fuse fees of the underlying held in this market
*/
uint public totalFuseFees;
/**
* @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;
}
contract CTokenInterface is CTokenStorage {
/**
* @notice Indicator that this is a CToken contract (for inspection)
*/
bool public constant isCToken = true;
/**
* @notice Indicator that this is or is not a CEther contract (for inspection)
*/
bool public constant isCEther = false;
/*** Market Events ***/
/**
* @notice Event emitted when interest is accrued
*/
event AccrueInterest(uint cashPrior, uint interestAccumulated, uint borrowIndex, uint totalBorrows);
/**
* @notice Event emitted when tokens are minted
*/
event Mint(address minter, uint mintAmount, uint mintTokens);
/**
* @notice Event emitted when tokens are redeemed
*/
event Redeem(address redeemer, uint redeemAmount, uint redeemTokens);
/**
* @notice Event emitted when underlying is borrowed
*/
event Borrow(address borrower, uint borrowAmount, uint accountBorrows, uint totalBorrows);
/**
* @notice Event emitted when a borrow is repaid
*/
event RepayBorrow(address payer, address borrower, uint repayAmount, uint accountBorrows, uint totalBorrows);
/**
* @notice Event emitted when a borrow is liquidated
*/
event LiquidateBorrow(address liquidator, address borrower, uint repayAmount, address cTokenCollateral, uint seizeTokens);
/*** Admin Events ***/
/**
* @notice Event emitted when the Fuse admin renounces their rights
*/
event FuseAdminRightsRenounced();
/**
* @notice Event emitted when the admin renounces their rights
*/
event AdminRightsRenounced();
/**
* @notice Event emitted when pendingAdmin is changed
*/
event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
/**
* @notice Event emitted when pendingAdmin is accepted, which means admin is updated
*/
event NewAdmin(address oldAdmin, address newAdmin);
/**
* @notice Event emitted when comptroller is changed
*/
event NewComptroller(ComptrollerInterface oldComptroller, ComptrollerInterface newComptroller);
/**
* @notice Event emitted when interestRateModel is changed
*/
event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);
/**
* @notice Event emitted when the reserve factor is changed
*/
event NewReserveFactor(uint oldReserveFactorMantissa, uint newReserveFactorMantissa);
/**
* @notice Event emitted when the reserves are 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 Event emitted when the admin fee is changed
*/
event NewAdminFee(uint oldAdminFeeMantissa, uint newAdminFeeMantissa);
/**
* @notice Event emitted when the Fuse fee is changed
*/
event NewFuseFee(uint oldFuseFeeMantissa, uint newFuseFeeMantissa);
/**
* @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 borrowRatePerBlock() external view returns (uint);
function supplyRatePerBlock() 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);
}
contract CErc20Storage {
/**
* @notice Underlying asset for this CToken
*/
address public underlying;
}
contract CErc20Interface is CErc20Storage {
/*** User Interface ***/
function mint(uint mintAmount) external returns (uint);
function redeem(uint redeemTokens) external returns (uint);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function borrow(uint borrowAmount) external returns (uint);
function repayBorrow(uint repayAmount) external returns (uint);
function repayBorrowBehalf(address borrower, uint repayAmount) external returns (uint);
function liquidateBorrow(address borrower, uint repayAmount, CTokenInterface cTokenCollateral) external returns (uint);
/*** Admin Functions ***/
function _addReserves(uint addAmount) external returns (uint);
}
contract CEtherInterface is CErc20Storage {
/**
* @notice Indicator that this is a CEther contract (for inspection)
*/
bool public constant isCEther = true;
}
contract CDelegationStorage {
/**
* @notice Implementation address for this contract
*/
address public implementation;
}
contract CDelegatorInterface is CDelegationStorage {
/**
* @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 CDelegateInterface is CDelegationStorage {
/**
* @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;
}
pragma solidity ^0.5.16;
/**
* @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);
}
pragma solidity ^0.5.16;
/**
* @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);
}
pragma solidity ^0.5.16;
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,
SUPPLIER_NOT_WHITELISTED,
BORROW_BELOW_MIN,
SUPPLY_ABOVE_MAX
}
enum FailureInfo {
ACCEPT_ADMIN_PENDING_ADMIN_CHECK,
ACCEPT_PENDING_IMPLEMENTATION_ADDRESS_CHECK,
EXIT_MARKET_BALANCE_OWED,
EXIT_MARKET_REJECTION,
RENOUNCE_ADMIN_RIGHTS_OWNER_CHECK,
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_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,
SET_WHITELIST_ENFORCEMENT_OWNER_CHECK,
SET_WHITELIST_STATUS_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,
UTILIZATION_ABOVE_MAX
}
/*
* 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_NEW_TOTAL_FUSE_FEES_CALCULATION_FAILED,
ACCRUE_INTEREST_NEW_TOTAL_ADMIN_FEES_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,
NEW_UTILIZATION_RATE_ABOVE_MAX,
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,
WITHDRAW_FUSE_FEES_ACCRUE_INTEREST_FAILED,
WITHDRAW_FUSE_FEES_CASH_NOT_AVAILABLE,
WITHDRAW_FUSE_FEES_FRESH_CHECK,
WITHDRAW_FUSE_FEES_VALIDATION,
WITHDRAW_ADMIN_FEES_ACCRUE_INTEREST_FAILED,
WITHDRAW_ADMIN_FEES_CASH_NOT_AVAILABLE,
WITHDRAW_ADMIN_FEES_FRESH_CHECK,
WITHDRAW_ADMIN_FEES_VALIDATION,
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,
RENOUNCE_ADMIN_RIGHTS_OWNER_CHECK,
SET_PENDING_ADMIN_OWNER_CHECK,
SET_ADMIN_FEE_ACCRUE_INTEREST_FAILED,
SET_ADMIN_FEE_ADMIN_CHECK,
SET_ADMIN_FEE_FRESH_CHECK,
SET_ADMIN_FEE_BOUNDS_CHECK,
SET_FUSE_FEE_ACCRUE_INTEREST_FAILED,
SET_FUSE_FEE_FRESH_CHECK,
SET_FUSE_FEE_BOUNDS_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
}
/**
* @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 err == Error.COMPTROLLER_REJECTION ? 1000 + opaqueError : uint(err);
}
}pragma solidity ^0.5.16;
import "./CarefulMath.sol";
/**
* @title Exponential module for storing fixed-precision decimals
* @author Compound
* @notice Exp is a struct which stores decimals with a fixed precision of 18 decimal places.
* Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:
* `Exp({mantissa: 5100000000000000000})`.
*/
contract Exponential is CarefulMath {
uint constant expScale = 1e18;
uint constant halfExpScale = expScale/2;
uint constant mantissaOne = expScale;
struct Exp {
uint mantissa;
}
/**
* @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);
}
/**
* @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 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;
}
}
pragma solidity ^0.5.16;
interface IFuseFeeDistributor {
function minBorrowEth() external view returns (uint256);
function maxSupplyEth() external view returns (uint256);
function maxUtilizationRate() external view returns (uint256);
function interestFeeRate() external view returns (uint256);
function () external payable;
}
pragma solidity ^0.5.16;
/**
* @title Compound's InterestRateModel Interface
* @author Compound
*/
contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the current borrow interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amnount of reserves the market has
* @return The borrow rate per block (as a percentage, and scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
/**
* @notice Calculates the current supply interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amnount of reserves the market has
* @param reserveFactorMantissa The current reserve factor the market has
* @return The supply rate per block (as a percentage, and scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint);
}
pragma solidity ^0.5.16;
import "./InterestRateModel.sol";
import "./SafeMath.sol";
/**
* @title Compound's JumpRateModel Contract
* @author Compound
*/
contract JumpRateModel is InterestRateModel {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);
/**
* @notice The approximate number of blocks per year that is assumed by the interest rate model
*/
uint public constant blocksPerYear = 2102400;
/**
* @notice The multiplier of utilization rate that gives the slope of the interest rate
*/
uint public multiplierPerBlock;
/**
* @notice The base interest rate which is the y-intercept when utilization rate is 0
*/
uint public baseRatePerBlock;
/**
* @notice The multiplierPerBlock after hitting a specified utilization point
*/
uint public jumpMultiplierPerBlock;
/**
* @notice The utilization point at which the jump multiplier is applied
*/
uint public kink;
/**
* @notice Construct an interest rate model
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
* @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
* @param kink_ The utilization point at which the jump multiplier is applied
*/
constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) public {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
kink = kink_;
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);
}
/**
* @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market (currently unused)
* @return The utilization rate as a mantissa between [0, 1e18]
*/
function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {
// Utilization rate is 0 when there are no borrows
if (borrows == 0) {
return 0;
}
return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));
}
/**
* @notice Calculates the current borrow rate per block, with the error code expected by the market
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint util = utilizationRate(cash, borrows, reserves);
if (util <= kink) {
return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
} else {
uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
uint excessUtil = util.sub(kink);
return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);
}
}
/**
* @notice Calculates the current supply rate per block
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @param reserveFactorMantissa The current reserve factor for the market
* @return The supply rate percentage per block as a mantissa (scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public view returns (uint) {
uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);
uint borrowRate = getBorrowRate(cash, borrows, reserves);
uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
}
}
pragma solidity ^0.5.16;
import "./CToken.sol";
contract PriceOracle {
/// @notice Indicator that this is a PriceOracle contract (for inspection)
bool public constant isPriceOracle = true;
/**
* @notice Get the underlying price of a cToken asset
* @param cToken The cToken to get the underlying price of
* @return The underlying asset price mantissa (scaled by 1e18).
* Zero means the price is unavailable.
*/
function getUnderlyingPrice(CToken cToken) external view returns (uint);
}
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
pragma solidity ^0.5.16;
import "./ErrorReporter.sol";
import "./ComptrollerStorage.sol";
/**
* @title ComptrollerCore
* @dev Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.
* CTokens 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 Event emitted when the Fuse admin renounces their rights
*/
event FuseAdminRightsRenounced();
/**
* @notice Event emitted when the admin renounces their rights
*/
event AdminRightsRenounced();
/**
* @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 (!hasAdminRights()) {
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 Renounce Fuse admin rights.
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _renounceFuseAdminRights() external returns (uint) {
// Check caller = admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.RENOUNCE_ADMIN_RIGHTS_OWNER_CHECK);
}
// Check that rights have not already been renounced
if (!fuseAdminHasRights) return uint(Error.NO_ERROR);
// Set fuseAdminHasRights to false
fuseAdminHasRights = false;
// Emit FuseAdminRightsRenounced()
emit FuseAdminRightsRenounced();
return uint(Error.NO_ERROR);
}
/**
* @notice Renounce admin rights.
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/
function _renounceAdminRights() external returns (uint) {
// Check caller = admin
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.RENOUNCE_ADMIN_RIGHTS_OWNER_CHECK);
}
// Check that rights have not already been renounced
if (!adminHasRights) return uint(Error.NO_ERROR);
// Set adminHasRights to false
adminHasRights = false;
// Emit AdminRightsRenounced()
emit AdminRightsRenounced();
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 (!hasAdminRights()) {
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) }
}
}
}
pragma solidity ^0.5.16;
import "./InterestRateModel.sol";
import "./SafeMath.sol";
/**
* @title Compound's WhitePaperInterestRateModel Contract
* @author Compound
* @notice The parameterized model described in section 2.4 of the original Compound Protocol whitepaper
*/
contract WhitePaperInterestRateModel is InterestRateModel {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock);
/**
* @notice The approximate number of blocks per year that is assumed by the interest rate model
*/
uint public constant blocksPerYear = 2102400;
/**
* @notice The multiplier of utilization rate that gives the slope of the interest rate
*/
uint public multiplierPerBlock;
/**
* @notice The base interest rate which is the y-intercept when utilization rate is 0
*/
uint public baseRatePerBlock;
/**
* @notice Construct an interest rate model
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
*/
constructor(uint baseRatePerYear, uint multiplierPerYear) public {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock);
}
/**
* @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market (currently unused)
* @return The utilization rate as a mantissa between [0, 1e18]
*/
function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {
// Utilization rate is 0 when there are no borrows
if (borrows == 0) {
return 0;
}
return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));
}
/**
* @notice Calculates the current borrow rate per block, with the error code expected by the market
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint ur = utilizationRate(cash, borrows, reserves);
return ur.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
}
/**
* @notice Calculates the current supply rate per block
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @param reserveFactorMantissa The current reserve factor for the market
* @return The supply rate percentage per block as a mantissa (scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public view returns (uint) {
uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);
uint borrowRate = getBorrowRate(cash, borrows, reserves);
uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
}
}
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"cashPrior","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"interestAccumulated","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"AccrueInterest","type":"event"},{"anonymous":false,"inputs":[],"name":"AdminRightsRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"Borrow","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":[],"name":"FuseAdminRightsRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"liquidator","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"cTokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"LiquidateBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldAdminFeeMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAdminFeeMantissa","type":"uint256"}],"name":"NewAdminFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract ComptrollerInterface","name":"oldComptroller","type":"address"},{"indexed":false,"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"NewComptroller","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFuseFeeMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFuseFeeMantissa","type":"uint256"}],"name":"NewFuseFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract InterestRateModel","name":"oldInterestRateModel","type":"address"},{"indexed":false,"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"NewMarketInterestRateModel","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"NewPendingAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldReserveFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"NewReserveFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"repayAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"accountBorrows","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBorrows","type":"uint256"}],"name":"RepayBorrow","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"benefactor","type":"address"},{"indexed":false,"internalType":"uint256","name":"addAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"reduceAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotalReserves","type":"uint256"}],"name":"ReservesReduced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":false,"inputs":[],"name":"_acceptAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"addAmount","type":"uint256"}],"name":"_addReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"_becomeImplementation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"reduceAmount","type":"uint256"}],"name":"_reduceReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"_renounceAdminRights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"_renounceFuseAdminRights","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"_resignImplementation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newAdminFeeMantissa","type":"uint256"}],"name":"_setAdminFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"newComptroller","type":"address"}],"name":"_setComptroller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"_setFuseFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract InterestRateModel","name":"newInterestRateModel","type":"address"}],"name":"_setInterestRateModel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"newPendingAdmin","type":"address"}],"name":"_setPendingAdmin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newReserveFactorMantissa","type":"uint256"}],"name":"_setReserveFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"withdrawAmount","type":"uint256"}],"name":"_withdrawAdminFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"withdrawAmount","type":"uint256"}],"name":"_withdrawFuseFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"accrualBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"accrueInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"adminFeeMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"adminHasRights","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"borrowBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"borrowRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptroller","outputs":[{"internalType":"contract ComptrollerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRateStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fuseAdminHasRights","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fuseFeeMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountSnapshot","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"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":"getCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"uint256","name":"reserveFactorMantissa_","type":"uint256"},{"internalType":"uint256","name":"adminFeeMantissa_","type":"uint256"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"underlying_","type":"address"},{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"uint256","name":"initialExchangeRateMantissa_","type":"uint256"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"uint256","name":"reserveFactorMantissa_","type":"uint256"},{"internalType":"uint256","name":"adminFeeMantissa_","type":"uint256"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestRateModel","outputs":[{"internalType":"contract InterestRateModel","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isCEther","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isCToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"},{"internalType":"contract CTokenInterface","name":"cTokenCollateral","type":"address"}],"name":"liquidateBorrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrow","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrowBehalf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"reserveFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplyRatePerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalAdminFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"totalBorrowsCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalFuseFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]Contract Creation Code
60806040526001805460ff60a81b1960ff60a01b19909116600160a01b1716600160a81b17905534801561003257600080fd5b50615f3980620000436000396000f3fe608060405234801561001057600080fd5b50600436106103d05760003560e01c80638f840ddd116101ff578063c26b1b131161011a578063e9c714f2116100ad578063f851a4401161007c578063f851a44014610ccc578063f8f9da2814610cd4578063fca7820b14610cdc578063fe9c44ae14610cf9576103d0565b8063e9c714f214610c60578063f2b3abbd14610c68578063f3fdb15a14610c8e578063f5e3c46214610c96576103d0565b8063dbfe7c19116100e9578063dbfe7c1914610c1a578063dc028ab114610c22578063dd62ed3e14610c2a578063e16d2c3214610c58576103d0565b8063c26b1b1314610b8c578063c37f68e214610b94578063c5ebeaec14610be0578063db006a7514610bfd576103d0565b8063a9059cbb11610192578063b2a02ff111610161578063b2a02ff114610b20578063b71d1a0c14610b56578063bd6d894d14610b7c578063bf0f1d7b14610b84576103d0565b8063a9059cbb14610adc578063aa5af0fd14610b08578063ac784ddc14610b10578063ae9d70b014610b18576103d0565b8063a03dce8d116101ce578063a03dce8d14610a7d578063a0712d6814610a9a578063a6afed9514610ab7578063a7b820df14610abf576103d0565b80638f840ddd14610a2a57806391dd36c614610a3257806395d89b4114610a4f57806395dd919314610a57576103d0565b80633af9e669116102ef578063601a0bf11161028257806370a082311161025157806370a08231146109d757806373acee98146109fd578063852a12e314610a055780638d02d9a114610a22576103d0565b8063601a0bf1146109a257806361feacff146109bf5780636c540baf146109c75780636f307dc3146109cf576103d0565b806347bd3718116102be57806347bd3718146108e657806356e67728146108ee5780635c60da1b146109925780635fe3b5671461099a576103d0565b80633af9e669146108755780633b1d21a21461089b5780633e941010146108a35780634576b5db146108c0576103d0565b806318160ddd116103675780632608f818116103365780632608f818146107ff578063267822471461082b5780632f1069ba1461084f578063313ce56714610857576103d0565b806318160ddd14610659578063182df0f514610661578063219ef65c1461066957806323b872dd146107c9576103d0565b80630f8855e8116103a35780630f8855e8146104c9578063153ab50514610623578063173b99041461062b57806317bfdfbc14610633576103d0565b806306fdde03146103d5578063095ea7b3146104525780630a755ec2146104925780630e7527021461049a575b600080fd5b6103dd610d01565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104175781810151838201526020016103ff565b50505050905090810190601f1680156104445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61047e6004803603604081101561046857600080fd5b506001600160a01b038135169060200135610d8c565b604080519115158252519081900360200190f35b61047e610df9565b6104b7600480360360208110156104b057600080fd5b5035610e09565b60408051918252519081900360200190f35b61062160048036036101008110156104e057600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561051a57600080fd5b82018360208201111561052c57600080fd5b803590602001918460018302840111600160201b8311171561054d57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561059f57600080fd5b8201836020820111156105b157600080fd5b803590602001918460018302840111600160201b831117156105d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff8335169350505060208101359060400135610e1f565b005b610621611123565b6104b7611168565b6104b76004803603602081101561064957600080fd5b50356001600160a01b031661116e565b6104b7611242565b6104b7611248565b610621600480360361012081101561068057600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b8111156106c257600080fd5b8201836020820111156106d457600080fd5b803590602001918460018302840111600160201b831117156106f557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561074757600080fd5b82018360208201111561075957600080fd5b803590602001918460018302840111600160201b8311171561077a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff83351693505050602081013590604001356112ab565b61047e600480360360608110156107df57600080fd5b506001600160a01b0381358116916020810135909116906040013561134e565b6104b76004803603604081101561081557600080fd5b506001600160a01b0381351690602001356113d4565b6108336113ea565b604080516001600160a01b039092168252519081900360200190f35b61047e6113fe565b61085f61140e565b6040805160ff9092168252519081900360200190f35b6104b76004803603602081101561088b57600080fd5b50356001600160a01b0316611417565b6104b76114cd565b6104b7600480360360208110156108b957600080fd5b50356114dc565b6104b7600480360360208110156108d657600080fd5b50356001600160a01b03166114e7565b6104b7611630565b6106216004803603602081101561090457600080fd5b810190602081018135600160201b81111561091e57600080fd5b82018360208201111561093057600080fd5b803590602001918460018302840111600160201b8311171561095157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611636945050505050565b61083361167c565b61083361168b565b6104b7600480360360208110156109b857600080fd5b503561169a565b6104b7611749565b6104b761174f565b610833611755565b6104b7600480360360208110156109ed57600080fd5b50356001600160a01b0316611764565b6104b761177f565b6104b760048036036020811015610a1b57600080fd5b503561184a565b6104b7611855565b6104b761185b565b6104b760048036036020811015610a4857600080fd5b5035611861565b6103dd6118ed565b6104b760048036036020811015610a6d57600080fd5b50356001600160a01b0316611948565b6104b760048036036020811015610a9357600080fd5b50356119a5565b6104b760048036036020811015610ab057600080fd5b5035611a31565b6104b7611a3d565b6104b760048036036020811015610ad557600080fd5b5035611bea565b61047e60048036036040811015610af257600080fd5b506001600160a01b038135169060200135611c76565b6104b7611cfb565b61047e611d01565b6104b7611d06565b6104b760048036036060811015610b3657600080fd5b506001600160a01b03813581169160208101359091169060400135611db5565b6104b760048036036020811015610b6c57600080fd5b50356001600160a01b0316611e38565b6104b7611ec2565b6104b7611f92565b6104b7612008565b610bba60048036036020811015610baa57600080fd5b50356001600160a01b03166120b7565b604080519485526020850193909352838301919091526060830152519081900360800190f35b6104b760048036036020811015610bf657600080fd5b503561214c565b6104b760048036036020811015610c1357600080fd5b5035612157565b6104b7612162565b6104b7612168565b6104b760048036036040811015610c4057600080fd5b506001600160a01b038135811691602001351661216e565b6104b7612199565b6104b7612208565b6104b760048036036020811015610c7e57600080fd5b50356001600160a01b0316612308565b610833612342565b6104b760048036036060811015610cac57600080fd5b506001600160a01b03813581169160208101359160409091013516612351565b610833612369565b6104b7612378565b6104b760048036036020811015610cf257600080fd5b50356123e4565b61047e612470565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610d845780601f10610d5957610100808354040283529160200191610d84565b820191906000526020600020905b815481529060010190602001808311610d6757829003601f168201915b505050505081565b3360008181526013602090815260408083206001600160a01b03871680855290835281842086905581518681529151939493909284927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a360019150505b92915050565b600154600160a81b900460ff1681565b600080610e1583612475565b509150505b919050565b610e27612532565b610e625760405162461bcd60e51b8152600401808060200182810382526024815260200180615bee6024913960400191505060405180910390fd5b600b54158015610e725750600c54155b610ead5760405162461bcd60e51b8152600401808060200182810382526023815260200180615c126023913960400191505060405180910390fd5b600786905585610eee5760405162461bcd60e51b8152600401808060200182810382526030815260200180615c356030913960400191505060405180910390fd5b6000610ef9896114e7565b90508015610f4e576040805162461bcd60e51b815260206004820152601a60248201527f73657474696e6720636f6d7074726f6c6c6572206661696c6564000000000000604482015290519081900360640190fd5b610f5661258d565b600b55670de0b6b3a7640000600c55610f6e88612591565b90508015610fad5760405162461bcd60e51b8152600401808060200182810382526022815260200180615c656022913960400191505060405180910390fd5b8551610fc0906002906020890190615a95565b508451610fd4906003906020880190615a95565b506004805460ff191660ff8616179055610fed836126f9565b90508015611042576040805162461bcd60e51b815260206004820152601d60248201527f73657474696e67207265736572766520666163746f72206661696c6564000000604482015290519081900360640190fd5b61104b8261279d565b905080156110a0576040805162461bcd60e51b815260206004820152601860248201527f73657474696e672061646d696e20666565206661696c65640000000000000000604482015290519081900360640190fd5b6110b06110ab612841565b612890565b90508015611105576040805162461bcd60e51b815260206004820152601760248201527f73657474696e67204675736520666565206661696c6564000000000000000000604482015290519081900360640190fd5b50506001805460ff60b01b1916600160b01b17905550505050505050565b61112b612532565b6111665760405162461bcd60e51b815260040180806020018281038252602d815260200180615c87602d913960400191505060405180910390fd5b565b600a5481565b600154600090600160b01b900460ff166111bc576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006111d3611a3d565b1461121e576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b61122782611948565b90505b6001805460ff60b01b1916600160b01b179055919050565b60115481565b600080600061125561292d565b9092509050600082600381111561126857fe5b146112a45760405162461bcd60e51b8152600401808060200182810382526035815260200180615dfc6035913960400191505060405180910390fd5b9150505b90565b6112bb8888888888888888610e1f565b601580546001600160a01b0319166001600160a01b038b81169190911791829055604080516318160ddd60e01b8152905192909116916318160ddd91600480820192602092909190829003018186803b15801561131757600080fd5b505afa15801561132b573d6000803e3d6000fd5b505050506040513d602081101561134157600080fd5b5050505050505050505050565b600154600090600160b01b900460ff1661139c576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006113b7338686866129e4565b1490506001805460ff60b01b1916600160b01b1790559392505050565b6000806113e18484612cf2565b50949350505050565b60045461010090046001600160a01b031681565b600154600160a01b900460ff1681565b60045460ff1681565b6000611421615b13565b6040518060200160405280611434611ec2565b90526001600160a01b038416600090815260126020526040812054919250908190611460908490612db1565b9092509050600082600381111561147357fe5b146114c5576040805162461bcd60e51b815260206004820152601f60248201527f62616c616e636520636f756c64206e6f742062652063616c63756c6174656400604482015290519081900360640190fd5b949350505050565b60006114d7612e05565b905090565b6000610df382612e85565b60006114f1612532565b611508576115016001604a612f2d565b9050610e1a565b60055460408051623f1ee960e11b815290516001600160a01b0392831692851691627e3dd2916004808301926020929190829003018186803b15801561154d57600080fd5b505afa158015611561573d6000803e3d6000fd5b505050506040513d602081101561157757600080fd5b50516115ca576040805162461bcd60e51b815260206004820152601c60248201527f6d61726b6572206d6574686f642072657475726e65642066616c736500000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b03858116918217909255604080519284168352602083019190915280517f7ac369dbd14fa5ea3f473ed67cc9d598964a77501540ba6751eb0b3decf5870d9281900390910190a160005b9392505050565b600d5481565b61163e612532565b6116795760405162461bcd60e51b815260040180806020018281038252602d815260200180615ed8602d913960400191505060405180910390fd5b50565b6000546001600160a01b031681565b6005546001600160a01b031681565b600154600090600160b01b900460ff166116e8576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006116ff611a3d565b905080156117255761171d81601181111561171657fe5b603b612f2d565b91505061122a565b61172e83612f93565b9150506001805460ff60b01b1916600160b01b179055919050565b600f5481565b600b5481565b6015546001600160a01b031681565b6001600160a01b031660009081526012602052604090205490565b600154600090600160b01b900460ff166117cd576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006117e4611a3d565b1461182f576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b50600d545b6001805460ff60b01b1916600160b01b17905590565b6000610df3826130af565b60085481565b600e5481565b600154600090600160b01b900460ff166118af576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006118c6611a3d565b905080156118e45761171d8160118111156118dd57fe5b6052612f2d565b61172e8361279d565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d845780601f10610d5957610100808354040283529160200191610d84565b60008060006119568461313e565b9092509050600082600381111561196957fe5b146116295760405162461bcd60e51b8152600401808060200182810382526037815260200180615d076037913960400191505060405180910390fd5b600154600090600160b01b900460ff166119f3576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611a0a611a3d565b90508015611a285761171d816011811115611a2157fe5b6033612f2d565b61172e836131f2565b600080610e15836132b2565b600080611a4861258d565b905080600b541415611a5e5760009150506112a8565b6000611a68612e05565b600654600d54600f54601054600e54604080516315f2405360e01b815260048101889052602481019590955291019091016044830152519293506000926001600160a01b03909216916315f2405391606480820192602092909190829003018186803b158015611ad757600080fd5b505afa158015611aeb573d6000803e3d6000fd5b505050506040513d6020811015611b0157600080fd5b5051905065048c27395000811115611b60576040805162461bcd60e51b815260206004820152601c60248201527f626f72726f772072617465206973206162737572646c79206869676800000000604482015290519081900360640190fd5b600080611b6f85600b54613341565b90925090506000826003811115611b8257fe5b14611bd4576040805162461bcd60e51b815260206004820152601f60248201527f636f756c64206e6f742063616c63756c61746520626c6f636b2064656c746100604482015290519081900360640190fd5b611be085858584613364565b9550505050505090565b600154600090600160b01b900460ff16611c38576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611c4f611a3d565b90508015611c6d5761171d816011811115611c6657fe5b6037612f2d565b61172e836135c7565b600154600090600160b01b900460ff16611cc4576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611cdf333386866129e4565b1490506001805460ff60b01b1916600160b01b17905592915050565b600c5481565b600081565b6006546000906001600160a01b031663b8168816611d22612e05565b600d54600f54601054600e540101600854600954600a5401016040518563ffffffff1660e01b81526004018085815260200184815260200183815260200182815260200194505050505060206040518083038186803b158015611d8457600080fd5b505afa158015611d98573d6000803e3d6000fd5b505050506040513d6020811015611dae57600080fd5b5051905090565b600154600090600160b01b900460ff16611e03576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b19169055611e1c33858585613678565b90506001805460ff60b01b1916600160b01b1790559392505050565b6000611e42612532565b611e525761150160016051612f2d565b600480546001600160a01b03848116610100818102610100600160a81b03198516179094556040805194909304919091168084526020840191909152815190927fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a992908290030190a16000611629565b600154600090600160b01b900460ff16611f10576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611f27611a3d565b14611f72576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b611f7a611248565b90506001805460ff60b01b1916600160b01b17905590565b6000611f9c612532565b611fb357611fac60016050612f2d565b90506112a8565b600154600160a81b900460ff16611fcb576000611fac565b6001805460ff60a81b191690556040517fc8ed31b431dd871a74f7e15bc645f3dbdd94636e59d7633a4407b044524eb45990600090a160006114d7565b600154600090600160b01b900460ff16612056576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b19169055600061206d611a3d565b905080156120935761208b81601181111561208457fe5b6056612f2d565b915050611834565b61209e6110ab612841565b9150506001805460ff60b01b1916600160b01b17905590565b6001600160a01b0381166000908152601260205260408120548190819081908180806120e28961313e565b9350905060008160038111156120f457fe5b146121125760095b9750600096508695508594506121459350505050565b61211a61292d565b92509050600081600381111561212c57fe5b146121385760096120fc565b5060009650919450925090505b9193509193565b6000610df3826138de565b6000610df38261396b565b60095481565b60105481565b6001600160a01b03918216600090815260136020908152604080832093909416825291909152205490565b60006121a3612532565b6121b357611fac60016050612f2d565b600154600160a01b900460ff166121cb576000611fac565b6001805460ff60a01b191690556040517f9f60987413d3c28e8232c3eec2559453cc8c6805ff81501e344a133944113e3590600090a160006114d7565b60045460009061010090046001600160a01b031633141580612228575033155b1561223957611fac60016000612f2d565b60018054600480546001600160a01b03610100820481166001600160a01b03198516811795869055610100600160a81b031990921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600454604080516001600160a01b038481168252610100909304909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a160009250505090565b600080612313611a3d565b905080156123395761233181601181111561232a57fe5b604b612f2d565b915050610e1a565b61162983612591565b6006546001600160a01b031681565b60008061235f8585856139f3565b5095945050505050565b6001546001600160a01b031681565b6006546000906001600160a01b03166315f24053612394612e05565b600d54600f54601054600e5401016040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b158015611d8457600080fd5b600154600090600160b01b900460ff16612432576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000612449611a3d565b905080156124675761171d81601181111561246057fe5b6059612f2d565b61172e836126f9565b600181565b6001546000908190600160b01b900460ff166124c5576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006124dc611a3d565b90508015612507576124fa8160118111156124f357fe5b6041612f2d565b9250600091506125189050565b612512333386613b39565b92509250505b6001805460ff60b01b1916600160b01b1790559092909150565b6001546000906001600160a01b0316331480156125585750600154600160a81b900460ff165b806114d757503373a731585ab05fc9f83555cf9bff8f58ee94e18f851480156114d7575050600154600160a01b900460ff1690565b4390565b60008061259c612532565b6125ac576123316001604d612f2d565b6125b461258d565b600b54146125c857612331600a604c612f2d565b600660009054906101000a90046001600160a01b03169050826001600160a01b0316632191f92a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561261957600080fd5b505afa15801561262d573d6000803e3d6000fd5b505050506040513d602081101561264357600080fd5b5051612696576040805162461bcd60e51b815260206004820152601c60248201527f6d61726b6572206d6574686f642072657475726e65642066616c736500000000604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b03858116918217909255604080519284168352602083019190915280517fedffc32e068c7c95dfd4bdfd5c4d939a084d6b11c4199eac8436ed234d72f9269281900390910190a16000611629565b6000612703612532565b612713576115016001605a612f2d565b61271b61258d565b600b541461272f57611501600a605b612f2d565b670de0b6b3a76400006009546008548401011115612753576115016002605c612f2d565b600a805490839055604080518281526020810185905281517faaa68312e2ea9d50e16af5068410ab56e1a1fd06037b1a35664812c30f821460929181900390910190a16000611629565b60006127a7612532565b6127b75761150160016053612f2d565b6127bf61258d565b600b54146127d357611501600a6054612f2d565b670de0b6b3a764000060095483600a54010111156127f75761150160026055612f2d565b6008805490839055604080518281526020810185905281517fcdd0b588250e1398549f79cfdb8217c186688822905d6715b0834ea1c865594a929181900390910190a16000611629565b600073a731585ab05fc9f83555cf9bff8f58ee94e18f856001600160a01b031663dd86fea16040518163ffffffff1660e01b815260040160206040518083038186803b158015611d8457600080fd5b60006009548214156128a3576000611501565b6128ab61258d565b600b54146128bf57611501600a6057612f2d565b670de0b6b3a764000082600854600a54010111156128e35761150160026058612f2d565b6009805490839055604080518281526020810185905281517f92eef861b6533b7d3417f39c2ad7b460eed4e88a32fa3604f30e718b7602e7dc929181900390910190a16000611629565b601154600090819080612948575050600754600091506129e0565b6000612952612e05565b9050600061295e615b13565b600061297784600d54600f54601054600e540101613f1f565b93509050600081600381111561298957fe5b1461299e579550600094506129e09350505050565b6129a88386613f6b565b9250905060008160038111156129ba57fe5b146129cf579550600094506129e09350505050565b50516000955093506129e092505050565b9091565b600554604080516317b9b84b60e31b81523060048201526001600160a01b03868116602483015285811660448301526064820185905291516000938493169163bdcdc25891608480830192602092919082900301818787803b158015612a4957600080fd5b505af1158015612a5d573d6000803e3d6000fd5b505050506040513d6020811015612a7357600080fd5b505190508015612a9257612a8a6003605d8361401b565b9150506114c5565b836001600160a01b0316856001600160a01b03161415612ab857612a8a6002605e612f2d565b60006001600160a01b038781169087161415612ad75750600019612aff565b506001600160a01b038086166000908152601360209081526040808320938a16835292905220545b600080600080612b0f8589613341565b90945092506000846003811115612b2257fe5b14612b4057612b336009605e612f2d565b96505050505050506114c5565b6001600160a01b038a16600090815260126020526040902054612b639089613341565b90945091506000846003811115612b7657fe5b14612b8757612b336009605f612f2d565b6001600160a01b038916600090815260126020526040902054612baa90896140a4565b90945090506000846003811115612bbd57fe5b14612bce57612b3360096060612f2d565b6001600160a01b03808b16600090815260126020526040808220859055918b168152208190556000198514612c26576001600160a01b03808b166000908152601360209081526040808320938f168352929052208390555b886001600160a01b03168a6001600160a01b0316600080516020615d788339815191528a6040518082815260200191505060405180910390a36005546040805163352b4a3f60e11b81523060048201526001600160a01b038d811660248301528c81166044830152606482018c905291519190921691636a56947e91608480830192600092919082900301818387803b158015612cc257600080fd5b505af1158015612cd6573d6000803e3d6000fd5b5060009250612ce3915050565b9b9a5050505050505050505050565b6001546000908190600160b01b900460ff16612d42576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000612d59611a3d565b90508015612d8457612d77816011811115612d7057fe5b6040612f2d565b925060009150612d959050565b612d8f338686613b39565b92509250505b6001805460ff60b01b1916600160b01b17905590939092509050565b6000806000612dbe615b13565b612dc886866140ca565b90925090506000826003811115612ddb57fe5b14612dec5750915060009050612dfe565b6000612df782614132565b9350935050505b9250929050565b601554604080516370a0823160e01b815230600482015290516000926001600160a01b03169182916370a0823191602480820192602092909190829003018186803b158015612e5357600080fd5b505afa158015612e67573d6000803e3d6000fd5b505050506040513d6020811015612e7d57600080fd5b505191505090565b600154600090600160b01b900460ff16612ed3576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000612eea611a3d565b90508015612f085761171d816011811115612f0157fe5b6061612f2d565b612f1183614141565b509150506001805460ff60b01b1916600160b01b179055919050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0836011811115612f5c57fe5b836063811115612f6857fe5b604080519283526020830191909152600082820152519081900360600190a182601181111561162957fe5b600080612f9e612532565b612fae576123316001603c612f2d565b612fb661258d565b600b5414612fca57612331600a603e612f2d565b82612fd3612e05565b1015612fe557612331600e603d612f2d565b600e54831115612ffb576123316002603f612f2d565b50600e54828103908111156130415760405162461bcd60e51b8152600401808060200182810382526024815260200180615e8d6024913960400191505060405180910390fd5b600e81905560015461305c906001600160a01b031684614229565b600154604080516001600160a01b03909216825260208201859052818101839052517f3bad0c59cf2f06e7314077049f48a93578cd16f5ef92329f1dab1420a99c177e9181900360600190a16000611629565b600154600090600160b01b900460ff166130fd576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613114611a3d565b905080156131325761171d81601181111561312b57fe5b602a612f2d565b61172e33600085614320565b6001600160a01b0381166000908152601460205260408120805482918291829182916131755750600094508493506131ed92505050565b6131858160000154600c546147e7565b9094509250600084600381111561319857fe5b146131ad5750919350600092506131ed915050565b6131bb838260010154614826565b909450915060008460038111156131ce57fe5b146131e35750919350600092506131ed915050565b5060009450925050505b915091565b6000806131fd61258d565b600b541461321157612331600a6035612f2d565b8261321a612e05565b101561322c57612331600e6034612f2d565b6010548311156132425761233160026036612f2d565b50601054828103908111156132885760405162461bcd60e51b8152600401808060200182810382526027815260200180615eb16027913960400191505060405180910390fd5b60108190556132ab73a731585ab05fc9f83555cf9bff8f58ee94e18f8584614229565b6000611629565b6001546000908190600160b01b900460ff16613302576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613319611a3d565b90508015613337576124fa81601181111561333057fe5b6020612f2d565b6125123385614851565b600080838311613358575060009050818303612dfe565b50600390506000612dfe565b60008061336f615b13565b60008060008060008061339060405180602001604052808d8152508b6140ca565b909850965060008860038111156133a357fe5b146133cf576133c0600960088a60038111156133bb57fe5b61401b565b985050505050505050506114c5565b6133db87600d54612db1565b909850955060008860038111156133ee57fe5b14613406576133c0600960018a60038111156133bb57fe5b61341286600d546140a4565b9098509450600088600381111561342557fe5b1461343d576133c0600960048a60038111156133bb57fe5b61345a6040518060200160405280600a5481525087600e54614d68565b9098509350600088600381111561346d57fe5b14613485576133c0600960058a60038111156133bb57fe5b6134a2604051806020016040528060095481525087601054614d68565b909850925060008860038111156134b557fe5b146134cd576133c0600960068a60038111156133bb57fe5b6134ea604051806020016040528060085481525087600f54614d68565b909850915060008860038111156134fd57fe5b14613515576133c0600960078a60038111156133bb57fe5b61352487600c54600c54614d68565b9098509050600088600381111561353757fe5b1461354f576133c0600960038a60038111156133bb57fe5b600b8d9055600c819055600d859055600e8490556010839055600f829055604080518d8152602081018890528082018390526060810187905290517f4dec04e750ca11537cabcd8a9eab06494de08da3735bc8871cd41250e190bc049181900360800190a160009d9c50505050505050505050505050565b6000806135d261258d565b600b54146135e657612331600a6039612f2d565b826135ef612e05565b101561360157612331600e6038612f2d565b600f54831115613617576123316002603a612f2d565b50600f548281039081111561365d5760405162461bcd60e51b8152600401808060200182810382526028815260200180615cdf6028913960400191505060405180910390fd5b600f8190556001546132ab906001600160a01b031684614229565b6005546040805163d02f735160e01b81523060048201526001600160a01b038781166024830152868116604483015285811660648301526084820185905291516000938493169163d02f73519160a480830192602092919082900301818787803b1580156136e557600080fd5b505af11580156136f9573d6000803e3d6000fd5b505050506040513d602081101561370f57600080fd5b50519050801561372657612a8a6003601d8361401b565b846001600160a01b0316846001600160a01b0316141561374c57612a8a6006601e612f2d565b6001600160a01b038416600090815260126020526040812054819081906137739087613341565b9093509150600083600381111561378657fe5b146137a95761379e6009601c8560038111156133bb57fe5b9450505050506114c5565b6001600160a01b0388166000908152601260205260409020546137cc90876140a4565b909350905060008360038111156137df57fe5b146137f75761379e6009601b8560038111156133bb57fe5b6001600160a01b038088166000818152601260209081526040808320879055938c168083529184902085905583518a815293519193600080516020615d78833981519152929081900390910190a360055460408051636d35bf9160e01b81523060048201526001600160a01b038c811660248301528b811660448301528a81166064830152608482018a905291519190921691636d35bf919160a480830192600092919082900301818387803b1580156138b057600080fd5b505af11580156138c4573d6000803e3d6000fd5b50600092506138d1915050565b9998505050505050505050565b600154600090600160b01b900460ff1661392c576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613943611a3d565b905080156139615761171d81601181111561395a57fe5b600a612f2d565b61172e3384614db5565b600154600090600160b01b900460ff166139b9576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006139d0611a3d565b905080156139e75761171d81601181111561312b57fe5b61172e33846000614320565b6001546000908190600160b01b900460ff16613a43576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613a5a611a3d565b90508015613a8557613a78816011811115613a7157fe5b6011612f2d565b925060009150613b1c9050565b836001600160a01b031663a6afed956040518163ffffffff1660e01b8152600401602060405180830381600087803b158015613ac057600080fd5b505af1158015613ad4573d6000803e3d6000fd5b505050506040513d6020811015613aea57600080fd5b505190508015613b0a57613a78816011811115613b0357fe5b6012612f2d565b613b1633878787615257565b92509250505b6001805460ff60b01b1916600160b01b1790559094909350915050565b60055460408051631200453160e11b81523060048201526001600160a01b0386811660248301528581166044830152606482018590529151600093849384939116916324008a629160848082019260209290919082900301818787803b158015613ba257600080fd5b505af1158015613bb6573d6000803e3d6000fd5b505050506040513d6020811015613bcc57600080fd5b505190508015613bf057613be3600360438361401b565b925060009150613f179050565b613bf861258d565b600b5414613c0c57613be3600a6044612f2d565b613c14615b26565b6001600160a01b0386166000908152601460205260409020600101546060820152613c3e8661313e565b6080830181905260208301826003811115613c5557fe5b6003811115613c6057fe5b9052506000905081602001516003811115613c7757fe5b14613ca157613c9360096042836020015160038111156133bb57fe5b935060009250613f17915050565b600019851415613cba5760808101516040820152613cc2565b604081018590525b613cd08782604001516157da565b60e082018190526080820151613ce591613341565b60a0830181905260208301826003811115613cfc57fe5b6003811115613d0757fe5b9052506000905081602001516003811115613d1e57fe5b14613d5a5760405162461bcd60e51b815260040180806020018281038252603a815260200180615d3e603a913960400191505060405180910390fd5b613d6a600d548260e00151613341565b60c0830181905260208301826003811115613d8157fe5b6003811115613d8c57fe5b9052506000905081602001516003811115613da357fe5b14613ddf5760405162461bcd60e51b8152600401808060200182810382526031815260200180615d986031913960400191505060405180910390fd5b60a080820180516001600160a01b03808a16600081815260146020908152604091829020948555600c5460019095019490945560c0870151600d81905560e088015195518251948f16855294840192909252828101949094526060820192909252608081019190915290517f1a2a22cb034d26d1854bdc6666a5b91fe25efbbb5dcad3b0355478d6f5c362a1929181900390910190a160055460e0820151606083015160408051631ededc9160e01b81523060048201526001600160a01b038c811660248301528b8116604483015260648201949094526084810192909252519190921691631ededc919160a480830192600092919082900301818387803b158015613eea57600080fd5b505af1158015613efe573d6000803e3d6000fd5b5060009250613f0b915050565b8160e001519350935050505b935093915050565b600080600080613f2f87876140a4565b90925090506000826003811115613f4257fe5b14613f535750915060009050613f17565b613f5d8186613341565b935093505050935093915050565b6000613f75615b13565b600080613f8a86670de0b6b3a76400006147e7565b90925090506000826003811115613f9d57fe5b14613fbc57506040805160208101909152600081529092509050612dfe565b600080613fc98388614826565b90925090506000826003811115613fdc57fe5b14613ffe57506040805160208101909152600081529094509250612dfe915050565b604080516020810190915290815260009890975095505050505050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa084601181111561404a57fe5b84606381111561405657fe5b604080519283526020830191909152818101859052519081900360600190a1600384601181111561408357fe5b146140995783601181111561409457fe5b6114c5565b506103e80192915050565b6000808383018481106140bc57600092509050612dfe565b506002915060009050612dfe565b60006140d4615b13565b6000806140e58660000151866147e7565b909250905060008260038111156140f857fe5b1461411757506040805160208101909152600081529092509050612dfe565b60408051602081019091529081526000969095509350505050565b51670de0b6b3a7640000900490565b60008060008061414f61258d565b600b541461416e57614163600a6062612f2d565b935091506131ed9050565b61417833866157da565b905080600e54019150600e548210156141d8576040805162461bcd60e51b815260206004820181905260248201527f61646420726573657276657320756e6578706563746564206f766572666c6f77604482015290519081900360640190fd5b600e829055604080513381526020810183905280820184905290517fa91e67c5ea634cd43a12c5a482724b03de01e85ca68702a53d0c2f45cb7c1dc59181900360600190a160009350915050915091565b6015546040805163a9059cbb60e01b81526001600160a01b0385811660048301526024820185905291519190921691829163a9059cbb9160448082019260009290919082900301818387803b15801561428157600080fd5b505af1158015614295573d6000803e3d6000fd5b5050505060003d600081146142b157602081146142bb57600080fd5b60001991506142c7565b60206000803e60005191505b508061431a576040805162461bcd60e51b815260206004820152601960248201527f544f4b454e5f5452414e534645525f4f55545f4641494c454400000000000000604482015290519081900360640190fd5b50505050565b600082158061432d575081155b6143685760405162461bcd60e51b8152600401808060200182810382526034815260200180615e596034913960400191505060405180910390fd5b614370615b6c565b61437861292d565b604083018190526020830182600381111561438f57fe5b600381111561439a57fe5b90525060009050816020015160038111156143b157fe5b146143d5576143cd6009602e836020015160038111156133bb57fe5b915050611629565b83156144565760608101849052604080516020810182529082015181526143fc9085612db1565b608083018190526020830182600381111561441357fe5b600381111561441e57fe5b905250600090508160200151600381111561443557fe5b14614451576143cd6009602c836020015160038111156133bb57fe5b6144cf565b6144728360405180602001604052808460400151815250615a24565b606083018190526020830182600381111561448957fe5b600381111561449457fe5b90525060009050816020015160038111156144ab57fe5b146144c7576143cd6009602d836020015160038111156133bb57fe5b608081018390525b60055460608201516040805163eabe7d9160e01b81523060048201526001600160a01b03898116602483015260448201939093529051600093929092169163eabe7d919160648082019260209290919082900301818787803b15801561453457600080fd5b505af1158015614548573d6000803e3d6000fd5b505050506040513d602081101561455e57600080fd5b50519050801561457e576145756003602b8361401b565b92505050611629565b61458661258d565b600b541461459a57614575600a602f612f2d565b6145aa6011548360600151613341565b60a08401819052602084018260038111156145c157fe5b60038111156145cc57fe5b90525060009050826020015160038111156145e357fe5b146145ff5761457560096031846020015160038111156133bb57fe5b6001600160a01b03861660009081526012602052604090205460608301516146279190613341565b60c084018190526020840182600381111561463e57fe5b600381111561464957fe5b905250600090508260200151600381111561466057fe5b1461467c5761457560096030846020015160038111156133bb57fe5b8160800151614689612e05565b101561469b57614575600e6032612f2d565b6146a9868360800151614229565b60a082015160115560c08201516001600160a01b038716600081815260126020908152604091829020939093556060850151815190815290513093600080516020615d78833981519152928290030190a36080820151606080840151604080516001600160a01b038b168152602081019490945283810191909152517fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9299281900390910190a160055460808301516060840151604080516351dff98960e01b81523060048201526001600160a01b038b81166024830152604482019490945260648101929092525191909216916351dff98991608480830192600092919082900301818387803b1580156147bc57600080fd5b505af11580156147d0573d6000803e3d6000fd5b50600092506147dd915050565b9695505050505050565b600080836147fa57506000905080612dfe565b8383028385828161480757fe5b041461481b57506002915060009050612dfe565b600092509050612dfe565b6000808261483a5750600190506000612dfe565b600083858161484557fe5b04915091509250929050565b60055460408051634ef4c3e160e01b81523060048201526001600160a01b03858116602483015260448201859052915160009384938493911691634ef4c3e19160648082019260209290919082900301818787803b1580156148b257600080fd5b505af11580156148c6573d6000803e3d6000fd5b505050506040513d60208110156148dc57600080fd5b505190508015614900576148f3600360218361401b565b925060009150612dfe9050565b61490861258d565b600b541461491c576148f3600a6024612f2d565b614924615b6c565b61492c61292d565b604083018190526020830182600381111561494357fe5b600381111561494e57fe5b905250600090508160200151600381111561496557fe5b1461498f5761498160096023836020015160038111156133bb57fe5b935060009250612dfe915050565b6005546040808301516001600160a01b0389811660009081526012602090815284822054855163112c8c9560e11b815230600482015260248101959095526044850152606484018b905293519190941693632259192a93608480850194919392918390030190829087803b158015614a0657600080fd5b505af1158015614a1a573d6000803e3d6000fd5b505050506040513d6020811015614a3057600080fd5b505191508115614a4757614981600360218461401b565b614a5186866157da565b60c0820181905260408051602081018252908301518152614a729190615a24565b6060830181905260208301826003811115614a8957fe5b6003811115614a9457fe5b9052506000905081602001516003811115614aab57fe5b14614afd576040805162461bcd60e51b815260206004820181905260248201527f4d494e545f45584348414e47455f43414c43554c4154494f4e5f4641494c4544604482015290519081900360640190fd5b614b0d60115482606001516140a4565b6080830181905260208301826003811115614b2457fe5b6003811115614b2f57fe5b9052506000905081602001516003811115614b4657fe5b14614b825760405162461bcd60e51b8152600401808060200182810382526028815260200180615e316028913960400191505060405180910390fd5b6001600160a01b0386166000908152601260205260409020546060820151614baa91906140a4565b60a0830181905260208301826003811115614bc157fe5b6003811115614bcc57fe5b9052506000905081602001516003811115614be357fe5b14614c1f5760405162461bcd60e51b815260040180806020018281038252602b815260200180615cb4602b913960400191505060405180910390fd5b608081015160115560a08101516001600160a01b0387166000818152601260209081526040918290209390935560c084015160608086015183519485529484019190915282820193909352517f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f929181900390910190a1606081015160408051918252516001600160a01b038816913091600080516020615d788339815191529181900360200190a360055460c08201516060830151604080516341c728b960e01b81523060048201526001600160a01b038b81166024830152604482019490945260648101929092525191909216916341c728b991608480830192600092919082900301818387803b158015614d3557600080fd5b505af1158015614d49573d6000803e3d6000fd5b5060009250614d56915050565b8160c001519350935050509250929050565b6000806000614d75615b13565b614d7f87876140ca565b90925090506000826003811115614d9257fe5b14614da35750915060009050613f17565b613f5d614daf82614132565b866140a4565b6005546040805163368f515360e21b81523060048201526001600160a01b0385811660248301526044820185905291516000938493169163da3d454c91606480830192602092919082900301818787803b158015614e1257600080fd5b505af1158015614e26573d6000803e3d6000fd5b505050506040513d6020811015614e3c57600080fd5b505190508015614e5b57614e53600360108361401b565b915050610df3565b614e6361258d565b600b5414614e7757614e53600a600c612f2d565b6000614e81612e05565b905083811015614ea057614e97600e600b612f2d565b92505050610df3565b614ea8615baa565b614eb18661313e565b6020830181905282826003811115614ec557fe5b6003811115614ed057fe5b9052506000905081516003811115614ee457fe5b14614f0957614eff600980836000015160038111156133bb57fe5b9350505050610df3565b614f178160200151866140a4565b6040830181905282826003811115614f2b57fe5b6003811115614f3657fe5b9052506000905081516003811115614f4a57fe5b14614f6657614eff6009600e836000015160038111156133bb57fe5b6005546040808301518151631de6c8a560e21b8152306004820152602481019190915290516001600160a01b039092169163779b2294916044808201926020929091908290030181600087803b158015614fbf57600080fd5b505af1158015614fd3573d6000803e3d6000fd5b505050506040513d6020811015614fe957600080fd5b50519250821561500057614eff600360108561401b565b61500c600d54866140a4565b606083018190528282600381111561502057fe5b600381111561502b57fe5b905250600090508151600381111561503f57fe5b1461505b57614eff6009600d836000015160038111156133bb57fe5b600073a731585ab05fc9f83555cf9bff8f58ee94e18f856001600160a01b031663dfcb48bd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156150aa57600080fd5b505afa1580156150be573d6000803e3d6000fd5b505050506040513d60208110156150d457600080fd5b50519050600019811015615144576000826060015160001461511d57600f54601054600e540101600d548501038360600151670de0b6b3a7640000028161511757fe5b04615120565b60005b9050818111156151425761513660116029612f2d565b95505050505050610df3565b505b61514e8787614229565b604080830180516001600160a01b038a1660008181526014602090815290859020928355600c54600190930192909255606080870151600d819055935185519283529282018b9052818501929092529081019190915290517f13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab809181900360800190a160055460408051635c77860560e01b81523060048201526001600160a01b038a81166024830152604482018a905291519190921691635c77860591606480830192600092919082900301818387803b15801561522b57600080fd5b505af115801561523f573d6000803e3d6000fd5b506000925061524c915050565b979650505050505050565b60055460408051632fe3f38f60e11b81523060048201526001600160a01b0384811660248301528781166044830152868116606483015260848201869052915160009384938493911691635fc7e71e9160a48082019260209290919082900301818787803b1580156152c857600080fd5b505af11580156152dc573d6000803e3d6000fd5b505050506040513d60208110156152f257600080fd5b50519050801561531657615309600360148361401b565b9250600091506157d19050565b61531e61258d565b600b541461533257615309600a6018612f2d565b61533a61258d565b846001600160a01b0316636c540baf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561537357600080fd5b505afa158015615387573d6000803e3d6000fd5b505050506040513d602081101561539d57600080fd5b5051146153b057615309600a6013612f2d565b866001600160a01b0316866001600160a01b031614156153d65761530960066019612f2d565b846153e75761530960076017612f2d565b6000198514156153fd5761530960076016612f2d565b60008061540b898989613b39565b9092509050811561543b5761542c82601181111561542557fe5b601a612f2d565b9450600093506157d192505050565b6005546040805163c488847b60e01b81523060048201526001600160a01b038981166024830152604482018590528251600094859492169263c488847b926064808301939192829003018186803b15801561549557600080fd5b505afa1580156154a9573d6000803e3d6000fd5b505050506040513d60408110156154bf57600080fd5b5080516020909101519092509050811561550a5760405162461bcd60e51b8152600401808060200182810382526033815260200180615dc96033913960400191505060405180910390fd5b80886001600160a01b03166370a082318c6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561556157600080fd5b505afa158015615575573d6000803e3d6000fd5b505050506040513d602081101561558b57600080fd5b505110156155e0576040805162461bcd60e51b815260206004820152601860248201527f4c49515549444154455f5345495a455f544f4f5f4d5543480000000000000000604482015290519081900360640190fd5b60006001600160a01b038916301415615606576155ff308d8d85613678565b9050615690565b6040805163b2a02ff160e01b81526001600160a01b038e811660048301528d81166024830152604482018590529151918b169163b2a02ff1916064808201926020929091908290030181600087803b15801561566157600080fd5b505af1158015615675573d6000803e3d6000fd5b505050506040513d602081101561568b57600080fd5b505190505b80156156da576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b881cd95a5e9d5c994819985a5b195960621b604482015290519081900360640190fd5b604080516001600160a01b03808f168252808e1660208301528183018790528b1660608201526080810184905290517f298637f684da70674f26509b10f07ec2fbc77a335ab1e7d6215a4b2484d8bb529181900360a00190a1600554604080516347ef3b3b60e01b81523060048201526001600160a01b038c811660248301528f811660448301528e811660648301526084820188905260a48201869052915191909216916347ef3b3b9160c480830192600092919082900301818387803b1580156157a557600080fd5b505af11580156157b9573d6000803e3d6000fd5b50600092506157c6915050565b975092955050505050505b94509492505050565b601554604080516370a0823160e01b815230600482015290516000926001600160a01b031691839183916370a08231916024808301926020929190829003018186803b15801561582957600080fd5b505afa15801561583d573d6000803e3d6000fd5b505050506040513d602081101561585357600080fd5b5051604080516323b872dd60e01b81526001600160a01b038881166004830152306024830152604482018890529151929350908416916323b872dd9160648082019260009290919082900301818387803b1580156158b057600080fd5b505af11580156158c4573d6000803e3d6000fd5b5050505060003d600081146158e057602081146158ea57600080fd5b60001991506158f6565b60206000803e60005191505b5080615949576040805162461bcd60e51b815260206004820152601860248201527f544f4b454e5f5452414e534645525f494e5f4641494c45440000000000000000604482015290519081900360640190fd5b601554604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561599457600080fd5b505afa1580156159a8573d6000803e3d6000fd5b505050506040513d60208110156159be57600080fd5b5051905082811015615a17576040805162461bcd60e51b815260206004820152601a60248201527f544f4b454e5f5452414e534645525f494e5f4f564552464c4f57000000000000604482015290519081900360640190fd5b9190910395945050505050565b6000806000615a31615b13565b612dc886866000615a40615b13565b600080615a55670de0b6b3a7640000876147e7565b90925090506000826003811115615a6857fe5b14615a8757506040805160208101909152600081529092509050612dfe565b612df7818660000151613f6b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615ad657805160ff1916838001178555615b03565b82800160010185558215615b03579182015b82811115615b03578251825591602001919060010190615ae8565b50615b0f929150615bd3565b5090565b6040518060200160405280600081525090565b6040805161010081019091528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b604080516080810190915280600081526020016000815260200160008152602001600081525090565b6112a891905b80821115615b0f5760008155600101615bd956fe6f6e6c792061646d696e206d617920696e697469616c697a6520746865206d61726b65746d61726b6574206d6179206f6e6c7920626520696e697469616c697a6564206f6e6365696e697469616c2065786368616e67652072617465206d7573742062652067726561746572207468616e207a65726f2e73657474696e6720696e7465726573742072617465206d6f64656c206661696c65646f6e6c79207468652061646d696e206d61792063616c6c205f72657369676e496d706c656d656e746174696f6e4d494e545f4e45575f4143434f554e545f42414c414e43455f43414c43554c4154494f4e5f4641494c454477697468647261772061646d696e206665657320756e657870656374656420756e646572666c6f77626f72726f7742616c616e636553746f7265643a20626f72726f7742616c616e636553746f726564496e7465726e616c206661696c656452455041595f424f52524f575f4e45575f4143434f554e545f424f52524f575f42414c414e43455f43414c43554c4154494f4e5f4641494c4544ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef52455041595f424f52524f575f4e45575f544f54414c5f42414c414e43455f43414c43554c4154494f4e5f4641494c45444c49515549444154455f434f4d5054524f4c4c45525f43414c43554c4154455f414d4f554e545f5345495a455f4641494c454465786368616e67655261746553746f7265643a2065786368616e67655261746553746f726564496e7465726e616c206661696c65644d494e545f4e45575f544f54414c5f535550504c595f43414c43554c4154494f4e5f4641494c45446f6e65206f662072656465656d546f6b656e73496e206f722072656465656d416d6f756e74496e206d757374206265207a65726f72656475636520726573657276657320756e657870656374656420756e646572666c6f7777697468647261772046757365206665657320756e657870656374656420756e646572666c6f776f6e6c79207468652061646d696e206d61792063616c6c205f6265636f6d65496d706c656d656e746174696f6ea265627a7a723158207473ae03a63b26da518758f6b72730461f0fcc79be55f453679cbfe4d137d83a64736f6c63430005110032
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103d05760003560e01c80638f840ddd116101ff578063c26b1b131161011a578063e9c714f2116100ad578063f851a4401161007c578063f851a44014610ccc578063f8f9da2814610cd4578063fca7820b14610cdc578063fe9c44ae14610cf9576103d0565b8063e9c714f214610c60578063f2b3abbd14610c68578063f3fdb15a14610c8e578063f5e3c46214610c96576103d0565b8063dbfe7c19116100e9578063dbfe7c1914610c1a578063dc028ab114610c22578063dd62ed3e14610c2a578063e16d2c3214610c58576103d0565b8063c26b1b1314610b8c578063c37f68e214610b94578063c5ebeaec14610be0578063db006a7514610bfd576103d0565b8063a9059cbb11610192578063b2a02ff111610161578063b2a02ff114610b20578063b71d1a0c14610b56578063bd6d894d14610b7c578063bf0f1d7b14610b84576103d0565b8063a9059cbb14610adc578063aa5af0fd14610b08578063ac784ddc14610b10578063ae9d70b014610b18576103d0565b8063a03dce8d116101ce578063a03dce8d14610a7d578063a0712d6814610a9a578063a6afed9514610ab7578063a7b820df14610abf576103d0565b80638f840ddd14610a2a57806391dd36c614610a3257806395d89b4114610a4f57806395dd919314610a57576103d0565b80633af9e669116102ef578063601a0bf11161028257806370a082311161025157806370a08231146109d757806373acee98146109fd578063852a12e314610a055780638d02d9a114610a22576103d0565b8063601a0bf1146109a257806361feacff146109bf5780636c540baf146109c75780636f307dc3146109cf576103d0565b806347bd3718116102be57806347bd3718146108e657806356e67728146108ee5780635c60da1b146109925780635fe3b5671461099a576103d0565b80633af9e669146108755780633b1d21a21461089b5780633e941010146108a35780634576b5db146108c0576103d0565b806318160ddd116103675780632608f818116103365780632608f818146107ff578063267822471461082b5780632f1069ba1461084f578063313ce56714610857576103d0565b806318160ddd14610659578063182df0f514610661578063219ef65c1461066957806323b872dd146107c9576103d0565b80630f8855e8116103a35780630f8855e8146104c9578063153ab50514610623578063173b99041461062b57806317bfdfbc14610633576103d0565b806306fdde03146103d5578063095ea7b3146104525780630a755ec2146104925780630e7527021461049a575b600080fd5b6103dd610d01565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104175781810151838201526020016103ff565b50505050905090810190601f1680156104445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61047e6004803603604081101561046857600080fd5b506001600160a01b038135169060200135610d8c565b604080519115158252519081900360200190f35b61047e610df9565b6104b7600480360360208110156104b057600080fd5b5035610e09565b60408051918252519081900360200190f35b61062160048036036101008110156104e057600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561051a57600080fd5b82018360208201111561052c57600080fd5b803590602001918460018302840111600160201b8311171561054d57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561059f57600080fd5b8201836020820111156105b157600080fd5b803590602001918460018302840111600160201b831117156105d257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff8335169350505060208101359060400135610e1f565b005b610621611123565b6104b7611168565b6104b76004803603602081101561064957600080fd5b50356001600160a01b031661116e565b6104b7611242565b6104b7611248565b610621600480360361012081101561068057600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b8111156106c257600080fd5b8201836020820111156106d457600080fd5b803590602001918460018302840111600160201b831117156106f557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561074757600080fd5b82018360208201111561075957600080fd5b803590602001918460018302840111600160201b8311171561077a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505060ff83351693505050602081013590604001356112ab565b61047e600480360360608110156107df57600080fd5b506001600160a01b0381358116916020810135909116906040013561134e565b6104b76004803603604081101561081557600080fd5b506001600160a01b0381351690602001356113d4565b6108336113ea565b604080516001600160a01b039092168252519081900360200190f35b61047e6113fe565b61085f61140e565b6040805160ff9092168252519081900360200190f35b6104b76004803603602081101561088b57600080fd5b50356001600160a01b0316611417565b6104b76114cd565b6104b7600480360360208110156108b957600080fd5b50356114dc565b6104b7600480360360208110156108d657600080fd5b50356001600160a01b03166114e7565b6104b7611630565b6106216004803603602081101561090457600080fd5b810190602081018135600160201b81111561091e57600080fd5b82018360208201111561093057600080fd5b803590602001918460018302840111600160201b8311171561095157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611636945050505050565b61083361167c565b61083361168b565b6104b7600480360360208110156109b857600080fd5b503561169a565b6104b7611749565b6104b761174f565b610833611755565b6104b7600480360360208110156109ed57600080fd5b50356001600160a01b0316611764565b6104b761177f565b6104b760048036036020811015610a1b57600080fd5b503561184a565b6104b7611855565b6104b761185b565b6104b760048036036020811015610a4857600080fd5b5035611861565b6103dd6118ed565b6104b760048036036020811015610a6d57600080fd5b50356001600160a01b0316611948565b6104b760048036036020811015610a9357600080fd5b50356119a5565b6104b760048036036020811015610ab057600080fd5b5035611a31565b6104b7611a3d565b6104b760048036036020811015610ad557600080fd5b5035611bea565b61047e60048036036040811015610af257600080fd5b506001600160a01b038135169060200135611c76565b6104b7611cfb565b61047e611d01565b6104b7611d06565b6104b760048036036060811015610b3657600080fd5b506001600160a01b03813581169160208101359091169060400135611db5565b6104b760048036036020811015610b6c57600080fd5b50356001600160a01b0316611e38565b6104b7611ec2565b6104b7611f92565b6104b7612008565b610bba60048036036020811015610baa57600080fd5b50356001600160a01b03166120b7565b604080519485526020850193909352838301919091526060830152519081900360800190f35b6104b760048036036020811015610bf657600080fd5b503561214c565b6104b760048036036020811015610c1357600080fd5b5035612157565b6104b7612162565b6104b7612168565b6104b760048036036040811015610c4057600080fd5b506001600160a01b038135811691602001351661216e565b6104b7612199565b6104b7612208565b6104b760048036036020811015610c7e57600080fd5b50356001600160a01b0316612308565b610833612342565b6104b760048036036060811015610cac57600080fd5b506001600160a01b03813581169160208101359160409091013516612351565b610833612369565b6104b7612378565b6104b760048036036020811015610cf257600080fd5b50356123e4565b61047e612470565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610d845780601f10610d5957610100808354040283529160200191610d84565b820191906000526020600020905b815481529060010190602001808311610d6757829003601f168201915b505050505081565b3360008181526013602090815260408083206001600160a01b03871680855290835281842086905581518681529151939493909284927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a360019150505b92915050565b600154600160a81b900460ff1681565b600080610e1583612475565b509150505b919050565b610e27612532565b610e625760405162461bcd60e51b8152600401808060200182810382526024815260200180615bee6024913960400191505060405180910390fd5b600b54158015610e725750600c54155b610ead5760405162461bcd60e51b8152600401808060200182810382526023815260200180615c126023913960400191505060405180910390fd5b600786905585610eee5760405162461bcd60e51b8152600401808060200182810382526030815260200180615c356030913960400191505060405180910390fd5b6000610ef9896114e7565b90508015610f4e576040805162461bcd60e51b815260206004820152601a60248201527f73657474696e6720636f6d7074726f6c6c6572206661696c6564000000000000604482015290519081900360640190fd5b610f5661258d565b600b55670de0b6b3a7640000600c55610f6e88612591565b90508015610fad5760405162461bcd60e51b8152600401808060200182810382526022815260200180615c656022913960400191505060405180910390fd5b8551610fc0906002906020890190615a95565b508451610fd4906003906020880190615a95565b506004805460ff191660ff8616179055610fed836126f9565b90508015611042576040805162461bcd60e51b815260206004820152601d60248201527f73657474696e67207265736572766520666163746f72206661696c6564000000604482015290519081900360640190fd5b61104b8261279d565b905080156110a0576040805162461bcd60e51b815260206004820152601860248201527f73657474696e672061646d696e20666565206661696c65640000000000000000604482015290519081900360640190fd5b6110b06110ab612841565b612890565b90508015611105576040805162461bcd60e51b815260206004820152601760248201527f73657474696e67204675736520666565206661696c6564000000000000000000604482015290519081900360640190fd5b50506001805460ff60b01b1916600160b01b17905550505050505050565b61112b612532565b6111665760405162461bcd60e51b815260040180806020018281038252602d815260200180615c87602d913960400191505060405180910390fd5b565b600a5481565b600154600090600160b01b900460ff166111bc576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006111d3611a3d565b1461121e576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b61122782611948565b90505b6001805460ff60b01b1916600160b01b179055919050565b60115481565b600080600061125561292d565b9092509050600082600381111561126857fe5b146112a45760405162461bcd60e51b8152600401808060200182810382526035815260200180615dfc6035913960400191505060405180910390fd5b9150505b90565b6112bb8888888888888888610e1f565b601580546001600160a01b0319166001600160a01b038b81169190911791829055604080516318160ddd60e01b8152905192909116916318160ddd91600480820192602092909190829003018186803b15801561131757600080fd5b505afa15801561132b573d6000803e3d6000fd5b505050506040513d602081101561134157600080fd5b5050505050505050505050565b600154600090600160b01b900460ff1661139c576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006113b7338686866129e4565b1490506001805460ff60b01b1916600160b01b1790559392505050565b6000806113e18484612cf2565b50949350505050565b60045461010090046001600160a01b031681565b600154600160a01b900460ff1681565b60045460ff1681565b6000611421615b13565b6040518060200160405280611434611ec2565b90526001600160a01b038416600090815260126020526040812054919250908190611460908490612db1565b9092509050600082600381111561147357fe5b146114c5576040805162461bcd60e51b815260206004820152601f60248201527f62616c616e636520636f756c64206e6f742062652063616c63756c6174656400604482015290519081900360640190fd5b949350505050565b60006114d7612e05565b905090565b6000610df382612e85565b60006114f1612532565b611508576115016001604a612f2d565b9050610e1a565b60055460408051623f1ee960e11b815290516001600160a01b0392831692851691627e3dd2916004808301926020929190829003018186803b15801561154d57600080fd5b505afa158015611561573d6000803e3d6000fd5b505050506040513d602081101561157757600080fd5b50516115ca576040805162461bcd60e51b815260206004820152601c60248201527f6d61726b6572206d6574686f642072657475726e65642066616c736500000000604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b03858116918217909255604080519284168352602083019190915280517f7ac369dbd14fa5ea3f473ed67cc9d598964a77501540ba6751eb0b3decf5870d9281900390910190a160005b9392505050565b600d5481565b61163e612532565b6116795760405162461bcd60e51b815260040180806020018281038252602d815260200180615ed8602d913960400191505060405180910390fd5b50565b6000546001600160a01b031681565b6005546001600160a01b031681565b600154600090600160b01b900460ff166116e8576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006116ff611a3d565b905080156117255761171d81601181111561171657fe5b603b612f2d565b91505061122a565b61172e83612f93565b9150506001805460ff60b01b1916600160b01b179055919050565b600f5481565b600b5481565b6015546001600160a01b031681565b6001600160a01b031660009081526012602052604090205490565b600154600090600160b01b900460ff166117cd576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006117e4611a3d565b1461182f576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b50600d545b6001805460ff60b01b1916600160b01b17905590565b6000610df3826130af565b60085481565b600e5481565b600154600090600160b01b900460ff166118af576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006118c6611a3d565b905080156118e45761171d8160118111156118dd57fe5b6052612f2d565b61172e8361279d565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d845780601f10610d5957610100808354040283529160200191610d84565b60008060006119568461313e565b9092509050600082600381111561196957fe5b146116295760405162461bcd60e51b8152600401808060200182810382526037815260200180615d076037913960400191505060405180910390fd5b600154600090600160b01b900460ff166119f3576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611a0a611a3d565b90508015611a285761171d816011811115611a2157fe5b6033612f2d565b61172e836131f2565b600080610e15836132b2565b600080611a4861258d565b905080600b541415611a5e5760009150506112a8565b6000611a68612e05565b600654600d54600f54601054600e54604080516315f2405360e01b815260048101889052602481019590955291019091016044830152519293506000926001600160a01b03909216916315f2405391606480820192602092909190829003018186803b158015611ad757600080fd5b505afa158015611aeb573d6000803e3d6000fd5b505050506040513d6020811015611b0157600080fd5b5051905065048c27395000811115611b60576040805162461bcd60e51b815260206004820152601c60248201527f626f72726f772072617465206973206162737572646c79206869676800000000604482015290519081900360640190fd5b600080611b6f85600b54613341565b90925090506000826003811115611b8257fe5b14611bd4576040805162461bcd60e51b815260206004820152601f60248201527f636f756c64206e6f742063616c63756c61746520626c6f636b2064656c746100604482015290519081900360640190fd5b611be085858584613364565b9550505050505090565b600154600090600160b01b900460ff16611c38576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611c4f611a3d565b90508015611c6d5761171d816011811115611c6657fe5b6037612f2d565b61172e836135c7565b600154600090600160b01b900460ff16611cc4576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611cdf333386866129e4565b1490506001805460ff60b01b1916600160b01b17905592915050565b600c5481565b600081565b6006546000906001600160a01b031663b8168816611d22612e05565b600d54600f54601054600e540101600854600954600a5401016040518563ffffffff1660e01b81526004018085815260200184815260200183815260200182815260200194505050505060206040518083038186803b158015611d8457600080fd5b505afa158015611d98573d6000803e3d6000fd5b505050506040513d6020811015611dae57600080fd5b5051905090565b600154600090600160b01b900460ff16611e03576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b19169055611e1c33858585613678565b90506001805460ff60b01b1916600160b01b1790559392505050565b6000611e42612532565b611e525761150160016051612f2d565b600480546001600160a01b03848116610100818102610100600160a81b03198516179094556040805194909304919091168084526020840191909152815190927fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a992908290030190a16000611629565b600154600090600160b01b900460ff16611f10576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000611f27611a3d565b14611f72576040805162461bcd60e51b81526020600482015260166024820152751858d8dc9d59481a5b9d195c995cdd0819985a5b195960521b604482015290519081900360640190fd5b611f7a611248565b90506001805460ff60b01b1916600160b01b17905590565b6000611f9c612532565b611fb357611fac60016050612f2d565b90506112a8565b600154600160a81b900460ff16611fcb576000611fac565b6001805460ff60a81b191690556040517fc8ed31b431dd871a74f7e15bc645f3dbdd94636e59d7633a4407b044524eb45990600090a160006114d7565b600154600090600160b01b900460ff16612056576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b19169055600061206d611a3d565b905080156120935761208b81601181111561208457fe5b6056612f2d565b915050611834565b61209e6110ab612841565b9150506001805460ff60b01b1916600160b01b17905590565b6001600160a01b0381166000908152601260205260408120548190819081908180806120e28961313e565b9350905060008160038111156120f457fe5b146121125760095b9750600096508695508594506121459350505050565b61211a61292d565b92509050600081600381111561212c57fe5b146121385760096120fc565b5060009650919450925090505b9193509193565b6000610df3826138de565b6000610df38261396b565b60095481565b60105481565b6001600160a01b03918216600090815260136020908152604080832093909416825291909152205490565b60006121a3612532565b6121b357611fac60016050612f2d565b600154600160a01b900460ff166121cb576000611fac565b6001805460ff60a01b191690556040517f9f60987413d3c28e8232c3eec2559453cc8c6805ff81501e344a133944113e3590600090a160006114d7565b60045460009061010090046001600160a01b031633141580612228575033155b1561223957611fac60016000612f2d565b60018054600480546001600160a01b03610100820481166001600160a01b03198516811795869055610100600160a81b031990921690925560408051938316808552949092166020840152815190927ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc92908290030190a1600454604080516001600160a01b038481168252610100909304909216602083015280517fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99281900390910190a160009250505090565b600080612313611a3d565b905080156123395761233181601181111561232a57fe5b604b612f2d565b915050610e1a565b61162983612591565b6006546001600160a01b031681565b60008061235f8585856139f3565b5095945050505050565b6001546001600160a01b031681565b6006546000906001600160a01b03166315f24053612394612e05565b600d54600f54601054600e5401016040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b158015611d8457600080fd5b600154600090600160b01b900460ff16612432576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000612449611a3d565b905080156124675761171d81601181111561246057fe5b6059612f2d565b61172e836126f9565b600181565b6001546000908190600160b01b900460ff166124c5576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006124dc611a3d565b90508015612507576124fa8160118111156124f357fe5b6041612f2d565b9250600091506125189050565b612512333386613b39565b92509250505b6001805460ff60b01b1916600160b01b1790559092909150565b6001546000906001600160a01b0316331480156125585750600154600160a81b900460ff165b806114d757503373a731585ab05fc9f83555cf9bff8f58ee94e18f851480156114d7575050600154600160a01b900460ff1690565b4390565b60008061259c612532565b6125ac576123316001604d612f2d565b6125b461258d565b600b54146125c857612331600a604c612f2d565b600660009054906101000a90046001600160a01b03169050826001600160a01b0316632191f92a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561261957600080fd5b505afa15801561262d573d6000803e3d6000fd5b505050506040513d602081101561264357600080fd5b5051612696576040805162461bcd60e51b815260206004820152601c60248201527f6d61726b6572206d6574686f642072657475726e65642066616c736500000000604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b03858116918217909255604080519284168352602083019190915280517fedffc32e068c7c95dfd4bdfd5c4d939a084d6b11c4199eac8436ed234d72f9269281900390910190a16000611629565b6000612703612532565b612713576115016001605a612f2d565b61271b61258d565b600b541461272f57611501600a605b612f2d565b670de0b6b3a76400006009546008548401011115612753576115016002605c612f2d565b600a805490839055604080518281526020810185905281517faaa68312e2ea9d50e16af5068410ab56e1a1fd06037b1a35664812c30f821460929181900390910190a16000611629565b60006127a7612532565b6127b75761150160016053612f2d565b6127bf61258d565b600b54146127d357611501600a6054612f2d565b670de0b6b3a764000060095483600a54010111156127f75761150160026055612f2d565b6008805490839055604080518281526020810185905281517fcdd0b588250e1398549f79cfdb8217c186688822905d6715b0834ea1c865594a929181900390910190a16000611629565b600073a731585ab05fc9f83555cf9bff8f58ee94e18f856001600160a01b031663dd86fea16040518163ffffffff1660e01b815260040160206040518083038186803b158015611d8457600080fd5b60006009548214156128a3576000611501565b6128ab61258d565b600b54146128bf57611501600a6057612f2d565b670de0b6b3a764000082600854600a54010111156128e35761150160026058612f2d565b6009805490839055604080518281526020810185905281517f92eef861b6533b7d3417f39c2ad7b460eed4e88a32fa3604f30e718b7602e7dc929181900390910190a16000611629565b601154600090819080612948575050600754600091506129e0565b6000612952612e05565b9050600061295e615b13565b600061297784600d54600f54601054600e540101613f1f565b93509050600081600381111561298957fe5b1461299e579550600094506129e09350505050565b6129a88386613f6b565b9250905060008160038111156129ba57fe5b146129cf579550600094506129e09350505050565b50516000955093506129e092505050565b9091565b600554604080516317b9b84b60e31b81523060048201526001600160a01b03868116602483015285811660448301526064820185905291516000938493169163bdcdc25891608480830192602092919082900301818787803b158015612a4957600080fd5b505af1158015612a5d573d6000803e3d6000fd5b505050506040513d6020811015612a7357600080fd5b505190508015612a9257612a8a6003605d8361401b565b9150506114c5565b836001600160a01b0316856001600160a01b03161415612ab857612a8a6002605e612f2d565b60006001600160a01b038781169087161415612ad75750600019612aff565b506001600160a01b038086166000908152601360209081526040808320938a16835292905220545b600080600080612b0f8589613341565b90945092506000846003811115612b2257fe5b14612b4057612b336009605e612f2d565b96505050505050506114c5565b6001600160a01b038a16600090815260126020526040902054612b639089613341565b90945091506000846003811115612b7657fe5b14612b8757612b336009605f612f2d565b6001600160a01b038916600090815260126020526040902054612baa90896140a4565b90945090506000846003811115612bbd57fe5b14612bce57612b3360096060612f2d565b6001600160a01b03808b16600090815260126020526040808220859055918b168152208190556000198514612c26576001600160a01b03808b166000908152601360209081526040808320938f168352929052208390555b886001600160a01b03168a6001600160a01b0316600080516020615d788339815191528a6040518082815260200191505060405180910390a36005546040805163352b4a3f60e11b81523060048201526001600160a01b038d811660248301528c81166044830152606482018c905291519190921691636a56947e91608480830192600092919082900301818387803b158015612cc257600080fd5b505af1158015612cd6573d6000803e3d6000fd5b5060009250612ce3915050565b9b9a5050505050505050505050565b6001546000908190600160b01b900460ff16612d42576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000612d59611a3d565b90508015612d8457612d77816011811115612d7057fe5b6040612f2d565b925060009150612d959050565b612d8f338686613b39565b92509250505b6001805460ff60b01b1916600160b01b17905590939092509050565b6000806000612dbe615b13565b612dc886866140ca565b90925090506000826003811115612ddb57fe5b14612dec5750915060009050612dfe565b6000612df782614132565b9350935050505b9250929050565b601554604080516370a0823160e01b815230600482015290516000926001600160a01b03169182916370a0823191602480820192602092909190829003018186803b158015612e5357600080fd5b505afa158015612e67573d6000803e3d6000fd5b505050506040513d6020811015612e7d57600080fd5b505191505090565b600154600090600160b01b900460ff16612ed3576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000612eea611a3d565b90508015612f085761171d816011811115612f0157fe5b6061612f2d565b612f1183614141565b509150506001805460ff60b01b1916600160b01b179055919050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa0836011811115612f5c57fe5b836063811115612f6857fe5b604080519283526020830191909152600082820152519081900360600190a182601181111561162957fe5b600080612f9e612532565b612fae576123316001603c612f2d565b612fb661258d565b600b5414612fca57612331600a603e612f2d565b82612fd3612e05565b1015612fe557612331600e603d612f2d565b600e54831115612ffb576123316002603f612f2d565b50600e54828103908111156130415760405162461bcd60e51b8152600401808060200182810382526024815260200180615e8d6024913960400191505060405180910390fd5b600e81905560015461305c906001600160a01b031684614229565b600154604080516001600160a01b03909216825260208201859052818101839052517f3bad0c59cf2f06e7314077049f48a93578cd16f5ef92329f1dab1420a99c177e9181900360600190a16000611629565b600154600090600160b01b900460ff166130fd576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613114611a3d565b905080156131325761171d81601181111561312b57fe5b602a612f2d565b61172e33600085614320565b6001600160a01b0381166000908152601460205260408120805482918291829182916131755750600094508493506131ed92505050565b6131858160000154600c546147e7565b9094509250600084600381111561319857fe5b146131ad5750919350600092506131ed915050565b6131bb838260010154614826565b909450915060008460038111156131ce57fe5b146131e35750919350600092506131ed915050565b5060009450925050505b915091565b6000806131fd61258d565b600b541461321157612331600a6035612f2d565b8261321a612e05565b101561322c57612331600e6034612f2d565b6010548311156132425761233160026036612f2d565b50601054828103908111156132885760405162461bcd60e51b8152600401808060200182810382526027815260200180615eb16027913960400191505060405180910390fd5b60108190556132ab73a731585ab05fc9f83555cf9bff8f58ee94e18f8584614229565b6000611629565b6001546000908190600160b01b900460ff16613302576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613319611a3d565b90508015613337576124fa81601181111561333057fe5b6020612f2d565b6125123385614851565b600080838311613358575060009050818303612dfe565b50600390506000612dfe565b60008061336f615b13565b60008060008060008061339060405180602001604052808d8152508b6140ca565b909850965060008860038111156133a357fe5b146133cf576133c0600960088a60038111156133bb57fe5b61401b565b985050505050505050506114c5565b6133db87600d54612db1565b909850955060008860038111156133ee57fe5b14613406576133c0600960018a60038111156133bb57fe5b61341286600d546140a4565b9098509450600088600381111561342557fe5b1461343d576133c0600960048a60038111156133bb57fe5b61345a6040518060200160405280600a5481525087600e54614d68565b9098509350600088600381111561346d57fe5b14613485576133c0600960058a60038111156133bb57fe5b6134a2604051806020016040528060095481525087601054614d68565b909850925060008860038111156134b557fe5b146134cd576133c0600960068a60038111156133bb57fe5b6134ea604051806020016040528060085481525087600f54614d68565b909850915060008860038111156134fd57fe5b14613515576133c0600960078a60038111156133bb57fe5b61352487600c54600c54614d68565b9098509050600088600381111561353757fe5b1461354f576133c0600960038a60038111156133bb57fe5b600b8d9055600c819055600d859055600e8490556010839055600f829055604080518d8152602081018890528082018390526060810187905290517f4dec04e750ca11537cabcd8a9eab06494de08da3735bc8871cd41250e190bc049181900360800190a160009d9c50505050505050505050505050565b6000806135d261258d565b600b54146135e657612331600a6039612f2d565b826135ef612e05565b101561360157612331600e6038612f2d565b600f54831115613617576123316002603a612f2d565b50600f548281039081111561365d5760405162461bcd60e51b8152600401808060200182810382526028815260200180615cdf6028913960400191505060405180910390fd5b600f8190556001546132ab906001600160a01b031684614229565b6005546040805163d02f735160e01b81523060048201526001600160a01b038781166024830152868116604483015285811660648301526084820185905291516000938493169163d02f73519160a480830192602092919082900301818787803b1580156136e557600080fd5b505af11580156136f9573d6000803e3d6000fd5b505050506040513d602081101561370f57600080fd5b50519050801561372657612a8a6003601d8361401b565b846001600160a01b0316846001600160a01b0316141561374c57612a8a6006601e612f2d565b6001600160a01b038416600090815260126020526040812054819081906137739087613341565b9093509150600083600381111561378657fe5b146137a95761379e6009601c8560038111156133bb57fe5b9450505050506114c5565b6001600160a01b0388166000908152601260205260409020546137cc90876140a4565b909350905060008360038111156137df57fe5b146137f75761379e6009601b8560038111156133bb57fe5b6001600160a01b038088166000818152601260209081526040808320879055938c168083529184902085905583518a815293519193600080516020615d78833981519152929081900390910190a360055460408051636d35bf9160e01b81523060048201526001600160a01b038c811660248301528b811660448301528a81166064830152608482018a905291519190921691636d35bf919160a480830192600092919082900301818387803b1580156138b057600080fd5b505af11580156138c4573d6000803e3d6000fd5b50600092506138d1915050565b9998505050505050505050565b600154600090600160b01b900460ff1661392c576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613943611a3d565b905080156139615761171d81601181111561395a57fe5b600a612f2d565b61172e3384614db5565b600154600090600160b01b900460ff166139b9576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b1916905560006139d0611a3d565b905080156139e75761171d81601181111561312b57fe5b61172e33846000614320565b6001546000908190600160b01b900460ff16613a43576040805162461bcd60e51b815260206004820152600a6024820152691c994b595b9d195c995960b21b604482015290519081900360640190fd5b6001805460ff60b01b191690556000613a5a611a3d565b90508015613a8557613a78816011811115613a7157fe5b6011612f2d565b925060009150613b1c9050565b836001600160a01b031663a6afed956040518163ffffffff1660e01b8152600401602060405180830381600087803b158015613ac057600080fd5b505af1158015613ad4573d6000803e3d6000fd5b505050506040513d6020811015613aea57600080fd5b505190508015613b0a57613a78816011811115613b0357fe5b6012612f2d565b613b1633878787615257565b92509250505b6001805460ff60b01b1916600160b01b1790559094909350915050565b60055460408051631200453160e11b81523060048201526001600160a01b0386811660248301528581166044830152606482018590529151600093849384939116916324008a629160848082019260209290919082900301818787803b158015613ba257600080fd5b505af1158015613bb6573d6000803e3d6000fd5b505050506040513d6020811015613bcc57600080fd5b505190508015613bf057613be3600360438361401b565b925060009150613f179050565b613bf861258d565b600b5414613c0c57613be3600a6044612f2d565b613c14615b26565b6001600160a01b0386166000908152601460205260409020600101546060820152613c3e8661313e565b6080830181905260208301826003811115613c5557fe5b6003811115613c6057fe5b9052506000905081602001516003811115613c7757fe5b14613ca157613c9360096042836020015160038111156133bb57fe5b935060009250613f17915050565b600019851415613cba5760808101516040820152613cc2565b604081018590525b613cd08782604001516157da565b60e082018190526080820151613ce591613341565b60a0830181905260208301826003811115613cfc57fe5b6003811115613d0757fe5b9052506000905081602001516003811115613d1e57fe5b14613d5a5760405162461bcd60e51b815260040180806020018281038252603a815260200180615d3e603a913960400191505060405180910390fd5b613d6a600d548260e00151613341565b60c0830181905260208301826003811115613d8157fe5b6003811115613d8c57fe5b9052506000905081602001516003811115613da357fe5b14613ddf5760405162461bcd60e51b8152600401808060200182810382526031815260200180615d986031913960400191505060405180910390fd5b60a080820180516001600160a01b03808a16600081815260146020908152604091829020948555600c5460019095019490945560c0870151600d81905560e088015195518251948f16855294840192909252828101949094526060820192909252608081019190915290517f1a2a22cb034d26d1854bdc6666a5b91fe25efbbb5dcad3b0355478d6f5c362a1929181900390910190a160055460e0820151606083015160408051631ededc9160e01b81523060048201526001600160a01b038c811660248301528b8116604483015260648201949094526084810192909252519190921691631ededc919160a480830192600092919082900301818387803b158015613eea57600080fd5b505af1158015613efe573d6000803e3d6000fd5b5060009250613f0b915050565b8160e001519350935050505b935093915050565b600080600080613f2f87876140a4565b90925090506000826003811115613f4257fe5b14613f535750915060009050613f17565b613f5d8186613341565b935093505050935093915050565b6000613f75615b13565b600080613f8a86670de0b6b3a76400006147e7565b90925090506000826003811115613f9d57fe5b14613fbc57506040805160208101909152600081529092509050612dfe565b600080613fc98388614826565b90925090506000826003811115613fdc57fe5b14613ffe57506040805160208101909152600081529094509250612dfe915050565b604080516020810190915290815260009890975095505050505050565b60007f45b96fe442630264581b197e84bbada861235052c5a1aadfff9ea4e40a969aa084601181111561404a57fe5b84606381111561405657fe5b604080519283526020830191909152818101859052519081900360600190a1600384601181111561408357fe5b146140995783601181111561409457fe5b6114c5565b506103e80192915050565b6000808383018481106140bc57600092509050612dfe565b506002915060009050612dfe565b60006140d4615b13565b6000806140e58660000151866147e7565b909250905060008260038111156140f857fe5b1461411757506040805160208101909152600081529092509050612dfe565b60408051602081019091529081526000969095509350505050565b51670de0b6b3a7640000900490565b60008060008061414f61258d565b600b541461416e57614163600a6062612f2d565b935091506131ed9050565b61417833866157da565b905080600e54019150600e548210156141d8576040805162461bcd60e51b815260206004820181905260248201527f61646420726573657276657320756e6578706563746564206f766572666c6f77604482015290519081900360640190fd5b600e829055604080513381526020810183905280820184905290517fa91e67c5ea634cd43a12c5a482724b03de01e85ca68702a53d0c2f45cb7c1dc59181900360600190a160009350915050915091565b6015546040805163a9059cbb60e01b81526001600160a01b0385811660048301526024820185905291519190921691829163a9059cbb9160448082019260009290919082900301818387803b15801561428157600080fd5b505af1158015614295573d6000803e3d6000fd5b5050505060003d600081146142b157602081146142bb57600080fd5b60001991506142c7565b60206000803e60005191505b508061431a576040805162461bcd60e51b815260206004820152601960248201527f544f4b454e5f5452414e534645525f4f55545f4641494c454400000000000000604482015290519081900360640190fd5b50505050565b600082158061432d575081155b6143685760405162461bcd60e51b8152600401808060200182810382526034815260200180615e596034913960400191505060405180910390fd5b614370615b6c565b61437861292d565b604083018190526020830182600381111561438f57fe5b600381111561439a57fe5b90525060009050816020015160038111156143b157fe5b146143d5576143cd6009602e836020015160038111156133bb57fe5b915050611629565b83156144565760608101849052604080516020810182529082015181526143fc9085612db1565b608083018190526020830182600381111561441357fe5b600381111561441e57fe5b905250600090508160200151600381111561443557fe5b14614451576143cd6009602c836020015160038111156133bb57fe5b6144cf565b6144728360405180602001604052808460400151815250615a24565b606083018190526020830182600381111561448957fe5b600381111561449457fe5b90525060009050816020015160038111156144ab57fe5b146144c7576143cd6009602d836020015160038111156133bb57fe5b608081018390525b60055460608201516040805163eabe7d9160e01b81523060048201526001600160a01b03898116602483015260448201939093529051600093929092169163eabe7d919160648082019260209290919082900301818787803b15801561453457600080fd5b505af1158015614548573d6000803e3d6000fd5b505050506040513d602081101561455e57600080fd5b50519050801561457e576145756003602b8361401b565b92505050611629565b61458661258d565b600b541461459a57614575600a602f612f2d565b6145aa6011548360600151613341565b60a08401819052602084018260038111156145c157fe5b60038111156145cc57fe5b90525060009050826020015160038111156145e357fe5b146145ff5761457560096031846020015160038111156133bb57fe5b6001600160a01b03861660009081526012602052604090205460608301516146279190613341565b60c084018190526020840182600381111561463e57fe5b600381111561464957fe5b905250600090508260200151600381111561466057fe5b1461467c5761457560096030846020015160038111156133bb57fe5b8160800151614689612e05565b101561469b57614575600e6032612f2d565b6146a9868360800151614229565b60a082015160115560c08201516001600160a01b038716600081815260126020908152604091829020939093556060850151815190815290513093600080516020615d78833981519152928290030190a36080820151606080840151604080516001600160a01b038b168152602081019490945283810191909152517fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9299281900390910190a160055460808301516060840151604080516351dff98960e01b81523060048201526001600160a01b038b81166024830152604482019490945260648101929092525191909216916351dff98991608480830192600092919082900301818387803b1580156147bc57600080fd5b505af11580156147d0573d6000803e3d6000fd5b50600092506147dd915050565b9695505050505050565b600080836147fa57506000905080612dfe565b8383028385828161480757fe5b041461481b57506002915060009050612dfe565b600092509050612dfe565b6000808261483a5750600190506000612dfe565b600083858161484557fe5b04915091509250929050565b60055460408051634ef4c3e160e01b81523060048201526001600160a01b03858116602483015260448201859052915160009384938493911691634ef4c3e19160648082019260209290919082900301818787803b1580156148b257600080fd5b505af11580156148c6573d6000803e3d6000fd5b505050506040513d60208110156148dc57600080fd5b505190508015614900576148f3600360218361401b565b925060009150612dfe9050565b61490861258d565b600b541461491c576148f3600a6024612f2d565b614924615b6c565b61492c61292d565b604083018190526020830182600381111561494357fe5b600381111561494e57fe5b905250600090508160200151600381111561496557fe5b1461498f5761498160096023836020015160038111156133bb57fe5b935060009250612dfe915050565b6005546040808301516001600160a01b0389811660009081526012602090815284822054855163112c8c9560e11b815230600482015260248101959095526044850152606484018b905293519190941693632259192a93608480850194919392918390030190829087803b158015614a0657600080fd5b505af1158015614a1a573d6000803e3d6000fd5b505050506040513d6020811015614a3057600080fd5b505191508115614a4757614981600360218461401b565b614a5186866157da565b60c0820181905260408051602081018252908301518152614a729190615a24565b6060830181905260208301826003811115614a8957fe5b6003811115614a9457fe5b9052506000905081602001516003811115614aab57fe5b14614afd576040805162461bcd60e51b815260206004820181905260248201527f4d494e545f45584348414e47455f43414c43554c4154494f4e5f4641494c4544604482015290519081900360640190fd5b614b0d60115482606001516140a4565b6080830181905260208301826003811115614b2457fe5b6003811115614b2f57fe5b9052506000905081602001516003811115614b4657fe5b14614b825760405162461bcd60e51b8152600401808060200182810382526028815260200180615e316028913960400191505060405180910390fd5b6001600160a01b0386166000908152601260205260409020546060820151614baa91906140a4565b60a0830181905260208301826003811115614bc157fe5b6003811115614bcc57fe5b9052506000905081602001516003811115614be357fe5b14614c1f5760405162461bcd60e51b815260040180806020018281038252602b815260200180615cb4602b913960400191505060405180910390fd5b608081015160115560a08101516001600160a01b0387166000818152601260209081526040918290209390935560c084015160608086015183519485529484019190915282820193909352517f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f929181900390910190a1606081015160408051918252516001600160a01b038816913091600080516020615d788339815191529181900360200190a360055460c08201516060830151604080516341c728b960e01b81523060048201526001600160a01b038b81166024830152604482019490945260648101929092525191909216916341c728b991608480830192600092919082900301818387803b158015614d3557600080fd5b505af1158015614d49573d6000803e3d6000fd5b5060009250614d56915050565b8160c001519350935050509250929050565b6000806000614d75615b13565b614d7f87876140ca565b90925090506000826003811115614d9257fe5b14614da35750915060009050613f17565b613f5d614daf82614132565b866140a4565b6005546040805163368f515360e21b81523060048201526001600160a01b0385811660248301526044820185905291516000938493169163da3d454c91606480830192602092919082900301818787803b158015614e1257600080fd5b505af1158015614e26573d6000803e3d6000fd5b505050506040513d6020811015614e3c57600080fd5b505190508015614e5b57614e53600360108361401b565b915050610df3565b614e6361258d565b600b5414614e7757614e53600a600c612f2d565b6000614e81612e05565b905083811015614ea057614e97600e600b612f2d565b92505050610df3565b614ea8615baa565b614eb18661313e565b6020830181905282826003811115614ec557fe5b6003811115614ed057fe5b9052506000905081516003811115614ee457fe5b14614f0957614eff600980836000015160038111156133bb57fe5b9350505050610df3565b614f178160200151866140a4565b6040830181905282826003811115614f2b57fe5b6003811115614f3657fe5b9052506000905081516003811115614f4a57fe5b14614f6657614eff6009600e836000015160038111156133bb57fe5b6005546040808301518151631de6c8a560e21b8152306004820152602481019190915290516001600160a01b039092169163779b2294916044808201926020929091908290030181600087803b158015614fbf57600080fd5b505af1158015614fd3573d6000803e3d6000fd5b505050506040513d6020811015614fe957600080fd5b50519250821561500057614eff600360108561401b565b61500c600d54866140a4565b606083018190528282600381111561502057fe5b600381111561502b57fe5b905250600090508151600381111561503f57fe5b1461505b57614eff6009600d836000015160038111156133bb57fe5b600073a731585ab05fc9f83555cf9bff8f58ee94e18f856001600160a01b031663dfcb48bd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156150aa57600080fd5b505afa1580156150be573d6000803e3d6000fd5b505050506040513d60208110156150d457600080fd5b50519050600019811015615144576000826060015160001461511d57600f54601054600e540101600d548501038360600151670de0b6b3a7640000028161511757fe5b04615120565b60005b9050818111156151425761513660116029612f2d565b95505050505050610df3565b505b61514e8787614229565b604080830180516001600160a01b038a1660008181526014602090815290859020928355600c54600190930192909255606080870151600d819055935185519283529282018b9052818501929092529081019190915290517f13ed6866d4e1ee6da46f845c46d7e54120883d75c5ea9a2dacc1c4ca8984ab809181900360800190a160055460408051635c77860560e01b81523060048201526001600160a01b038a81166024830152604482018a905291519190921691635c77860591606480830192600092919082900301818387803b15801561522b57600080fd5b505af115801561523f573d6000803e3d6000fd5b506000925061524c915050565b979650505050505050565b60055460408051632fe3f38f60e11b81523060048201526001600160a01b0384811660248301528781166044830152868116606483015260848201869052915160009384938493911691635fc7e71e9160a48082019260209290919082900301818787803b1580156152c857600080fd5b505af11580156152dc573d6000803e3d6000fd5b505050506040513d60208110156152f257600080fd5b50519050801561531657615309600360148361401b565b9250600091506157d19050565b61531e61258d565b600b541461533257615309600a6018612f2d565b61533a61258d565b846001600160a01b0316636c540baf6040518163ffffffff1660e01b815260040160206040518083038186803b15801561537357600080fd5b505afa158015615387573d6000803e3d6000fd5b505050506040513d602081101561539d57600080fd5b5051146153b057615309600a6013612f2d565b866001600160a01b0316866001600160a01b031614156153d65761530960066019612f2d565b846153e75761530960076017612f2d565b6000198514156153fd5761530960076016612f2d565b60008061540b898989613b39565b9092509050811561543b5761542c82601181111561542557fe5b601a612f2d565b9450600093506157d192505050565b6005546040805163c488847b60e01b81523060048201526001600160a01b038981166024830152604482018590528251600094859492169263c488847b926064808301939192829003018186803b15801561549557600080fd5b505afa1580156154a9573d6000803e3d6000fd5b505050506040513d60408110156154bf57600080fd5b5080516020909101519092509050811561550a5760405162461bcd60e51b8152600401808060200182810382526033815260200180615dc96033913960400191505060405180910390fd5b80886001600160a01b03166370a082318c6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561556157600080fd5b505afa158015615575573d6000803e3d6000fd5b505050506040513d602081101561558b57600080fd5b505110156155e0576040805162461bcd60e51b815260206004820152601860248201527f4c49515549444154455f5345495a455f544f4f5f4d5543480000000000000000604482015290519081900360640190fd5b60006001600160a01b038916301415615606576155ff308d8d85613678565b9050615690565b6040805163b2a02ff160e01b81526001600160a01b038e811660048301528d81166024830152604482018590529151918b169163b2a02ff1916064808201926020929091908290030181600087803b15801561566157600080fd5b505af1158015615675573d6000803e3d6000fd5b505050506040513d602081101561568b57600080fd5b505190505b80156156da576040805162461bcd60e51b81526020600482015260146024820152731d1bdad95b881cd95a5e9d5c994819985a5b195960621b604482015290519081900360640190fd5b604080516001600160a01b03808f168252808e1660208301528183018790528b1660608201526080810184905290517f298637f684da70674f26509b10f07ec2fbc77a335ab1e7d6215a4b2484d8bb529181900360a00190a1600554604080516347ef3b3b60e01b81523060048201526001600160a01b038c811660248301528f811660448301528e811660648301526084820188905260a48201869052915191909216916347ef3b3b9160c480830192600092919082900301818387803b1580156157a557600080fd5b505af11580156157b9573d6000803e3d6000fd5b50600092506157c6915050565b975092955050505050505b94509492505050565b601554604080516370a0823160e01b815230600482015290516000926001600160a01b031691839183916370a08231916024808301926020929190829003018186803b15801561582957600080fd5b505afa15801561583d573d6000803e3d6000fd5b505050506040513d602081101561585357600080fd5b5051604080516323b872dd60e01b81526001600160a01b038881166004830152306024830152604482018890529151929350908416916323b872dd9160648082019260009290919082900301818387803b1580156158b057600080fd5b505af11580156158c4573d6000803e3d6000fd5b5050505060003d600081146158e057602081146158ea57600080fd5b60001991506158f6565b60206000803e60005191505b5080615949576040805162461bcd60e51b815260206004820152601860248201527f544f4b454e5f5452414e534645525f494e5f4641494c45440000000000000000604482015290519081900360640190fd5b601554604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561599457600080fd5b505afa1580156159a8573d6000803e3d6000fd5b505050506040513d60208110156159be57600080fd5b5051905082811015615a17576040805162461bcd60e51b815260206004820152601a60248201527f544f4b454e5f5452414e534645525f494e5f4f564552464c4f57000000000000604482015290519081900360640190fd5b9190910395945050505050565b6000806000615a31615b13565b612dc886866000615a40615b13565b600080615a55670de0b6b3a7640000876147e7565b90925090506000826003811115615a6857fe5b14615a8757506040805160208101909152600081529092509050612dfe565b612df7818660000151613f6b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10615ad657805160ff1916838001178555615b03565b82800160010185558215615b03579182015b82811115615b03578251825591602001919060010190615ae8565b50615b0f929150615bd3565b5090565b6040518060200160405280600081525090565b6040805161010081019091528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040805160e0810190915280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b604080516080810190915280600081526020016000815260200160008152602001600081525090565b6112a891905b80821115615b0f5760008155600101615bd956fe6f6e6c792061646d696e206d617920696e697469616c697a6520746865206d61726b65746d61726b6574206d6179206f6e6c7920626520696e697469616c697a6564206f6e6365696e697469616c2065786368616e67652072617465206d7573742062652067726561746572207468616e207a65726f2e73657474696e6720696e7465726573742072617465206d6f64656c206661696c65646f6e6c79207468652061646d696e206d61792063616c6c205f72657369676e496d706c656d656e746174696f6e4d494e545f4e45575f4143434f554e545f42414c414e43455f43414c43554c4154494f4e5f4641494c454477697468647261772061646d696e206665657320756e657870656374656420756e646572666c6f77626f72726f7742616c616e636553746f7265643a20626f72726f7742616c616e636553746f726564496e7465726e616c206661696c656452455041595f424f52524f575f4e45575f4143434f554e545f424f52524f575f42414c414e43455f43414c43554c4154494f4e5f4641494c4544ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef52455041595f424f52524f575f4e45575f544f54414c5f42414c414e43455f43414c43554c4154494f4e5f4641494c45444c49515549444154455f434f4d5054524f4c4c45525f43414c43554c4154455f414d4f554e545f5345495a455f4641494c454465786368616e67655261746553746f7265643a2065786368616e67655261746553746f726564496e7465726e616c206661696c65644d494e545f4e45575f544f54414c5f535550504c595f43414c43554c4154494f4e5f4641494c45446f6e65206f662072656465656d546f6b656e73496e206f722072656465656d416d6f756e74496e206d757374206265207a65726f72656475636520726573657276657320756e657870656374656420756e646572666c6f7777697468647261772046757365206665657320756e657870656374656420756e646572666c6f776f6e6c79207468652061646d696e206d61792063616c6c205f6265636f6d65496d706c656d656e746174696f6ea265627a7a723158207473ae03a63b26da518758f6b72730461f0fcc79be55f453679cbfe4d137d83a64736f6c63430005110032
Deployed Bytecode Sourcemap
204:1053:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;204:1053:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1205:18:7;;;:::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;1205:18:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7355:237:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;7355:237:6;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;660:33:7;;;:::i;3879:149:0:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3879:149:0;;:::i;:::-;;;;;;;;;;;;;;;;896:2131:6;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;896:2131:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;896:2131:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;896:2131:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;-1:-1;;;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;896:2131:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;896:2131:6;;;;;;;;-1:-1:-1;896:2131:6;;-1:-1:-1;;;;;5:28;;2:2;;;46:1;43;36:12;2:2;896:2131:6;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;896:2131:6;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;-1:-1;;;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;896:2131:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;896:2131:6;;-1:-1:-1;;896:2131:6;;;;;-1:-1:-1;;;896:2131:6;;;;;;;;;:::i;:::-;;978:276:1;;;:::i;2670:33:7:-;;;:::i;11707:224:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;11707:224:6;-1:-1:-1;;;;;11707:224:6;;:::i;3581:23:7:-;;;:::i;14552:261:6:-;;;:::i;978:836:0:-;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;978:836:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;978:836:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;978:836:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;-1:-1;;;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;978:836:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;978:836:0;;;;;;;;-1:-1:-1;978:836:0;;-1:-1:-1;;;;;5:28;;2:2;;;46:1;43;36:12;2:2;978:836:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;978:836:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;-1:-1;;;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;978:836:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;978:836:0;;-1:-1:-1;;978:836:0;;;;;-1:-1:-1;;;978:836:0;;;;;;;;;:::i;6690:195:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;6690:195:6;;;;;;;;;;;;;;;;;:::i;4316:189:0:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;4316:189:0;;;;;;;;:::i;1842:35:7:-;;;:::i;:::-;;;;-1:-1:-1;;;;;1842:35:7;;;;;;;;;;;;;;538:37;;;:::i;1401:21::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;8623:354:6;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8623:354:6;-1:-1:-1;;;;;8623:354:6;;:::i;16501:88::-;;;:::i;5458:119:0:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5458:119:0;;:::i;58223:733:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;58223:733:6;-1:-1:-1;;;;;58223:733:6;;:::i;3079:24:7:-;;;:::i;522:346:1:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;522:346:1;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;522:346:1;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;522:346:1;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;-1:-1;;;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;522:346:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;522:346:1;;-1:-1:-1;522:346:1;;-1:-1:-1;;;;;522:346:1:i;11036:29:7:-;;;:::i;1968:39::-;;;:::i;68300:571:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;68300:571:6;;:::i;3342:26:7:-;;;:::i;2793:30::-;;;:::i;9966:25::-;;;:::i;8255:112:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;8255:112:6;-1:-1:-1;;;;;8255:112:6;;:::i;11224:192::-;;;:::i;3157:133:0:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3157:133:0;;:::i;2420:28:7:-;;;:::i;3209:25::-;;;:::i;59244:572:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;59244:572:6;;:::i;1301:20:7:-;;;:::i;12140:287:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;12140:287:6;-1:-1:-1;;;;;12140:287:6;;:::i;71143:588::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;71143:588:6;;:::i;2204:133:0:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2204:133:0;;:::i;16837:1082:6:-;;;:::i;73805:593::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;73805:593:6;;:::i;6198:185::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;6198:185:6;;;;;;;;:::i;2944:23:7:-;;;:::i;4754:37::-;;;:::i;10824:254:6:-;;;:::i;51425:194::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;51425:194:6;;;;;;;;;;;;;;;;;:::i;56333:645::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;56333:645:6;-1:-1:-1;;;;;56333:645:6;;:::i;14104:198::-;;;:::i;55366:553::-;;;:::i;61299:554::-;;;:::i;9323:703::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;9323:703:6;-1:-1:-1;;;;;9323:703:6;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3558:113:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3558:113:0;;:::i;2688:::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2688:113:0;;:::i;2546:27:7:-;;;:::i;3475:25::-;;;:::i;7922:143:6:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;7922:143:6;;;;;;;;;;:::i;54633:577::-;;;:::i;57256:742::-;;;:::i;76597:633::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;76597:633:6;-1:-1:-1;;;;;76597:633:6;;:::i;2109:42:7:-;;;:::i;4987:237:0:-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;4987:237:0;;;;;;;;;;;;;;;;;:::i;420:28:7:-;;;:::i;10454:194:6:-;;;:::i;63339:607::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;63339:607:6;;:::i;4607:36:7:-;;;:::i;1205:18::-;;;;;;;;;;;;;;-1:-1:-1;;1205:18:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;7355:237:6:-;7454:10;7423:4;7475:23;;;:18;:23;;;;;;;;-1:-1:-1;;;;;7475:32:6;;;;;;;;;;;:41;;;7532:30;;;;;;;7423:4;;7454:10;7475:32;;7454:10;;7532:30;;;;;;;;;;;7580:4;7573:11;;;7355:237;;;;;:::o;660:33:7:-;;;-1:-1:-1;;;660:33:7;;;;;:::o;3879:149:0:-;3936:4;3954:8;3967:32;3987:11;3967:19;:32::i;:::-;-1:-1:-1;3953:46:0;-1:-1:-1;;3879:149:0;;;;:::o;896:2131:6:-;1345:16;:14;:16::i;:::-;1337:65;;;;-1:-1:-1;;;1337:65:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1421:18;;:23;:43;;;;-1:-1:-1;1448:11:6;;:16;1421:43;1413:91;;;;-1:-1:-1;;;1413:91:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1555:27;:58;;;1632:31;1624:92;;;;-1:-1:-1;;;1624:92:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1761:8;1772:29;1788:12;1772:15;:29::i;:::-;1761:40;-1:-1:-1;1820:27:6;;1812:66;;;;;-1:-1:-1;;;1812:66:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;2018:16;:14;:16::i;:::-;1997:18;:37;459:4:16;2045:11:6;:25;2170:46;2197:18;2170:26;:46::i;:::-;2164:52;-1:-1:-1;2235:27:6;;2227:74;;;;-1:-1:-1;;;2227:74:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2314:12;;;;:4;;:12;;;;;:::i;:::-;-1:-1:-1;2337:16:6;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;2364:8:6;:20;;-1:-1:-1;;2364:20:6;;;;;;;2434:46;2457:22;2434;:46::i;:::-;2428:52;-1:-1:-1;2499:27:6;;2491:69;;;;;-1:-1:-1;;;2491:69:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;2605:36;2623:17;2605;:36::i;:::-;2599:42;-1:-1:-1;2660:27:6;;2652:64;;;;;-1:-1:-1;;;2652:64:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;2760:46;2777:28;:26;:28::i;:::-;2760:16;:46::i;:::-;2754:52;-1:-1:-1;2825:27:6;;2817:63;;;;;-1:-1:-1;;;2817:63:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;3015:4:6;3001:18;;-1:-1:-1;;;;3001:18:6;-1:-1:-1;;;3001:18:6;;;-1:-1:-1;;;;;;;896:2131:6:o;978:276:1:-;1180:16;:14;:16::i;:::-;1172:74;;;;-1:-1:-1;;;1172:74:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;978:276::o;2670:33:7:-;;;;:::o;11707:224:6:-;80124:11;;11785:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;11810:16;:14;:16::i;:::-;:40;11802:75;;;;;-1:-1:-1;;;11802:75:6;;;;;;;;;;;;-1:-1:-1;;;11802:75:6;;;;;;;;;;;;;;;11895:28;11915:7;11895:19;:28::i;:::-;11888:35;;80191:1;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;11707:224;;-1:-1:-1;11707:224:6:o;3581:23:7:-;;;;:::o;14552:261:6:-;14603:4;14621:13;14636:11;14651:28;:26;:28::i;:::-;14620:59;;-1:-1:-1;14620:59:6;-1:-1:-1;14705:18:6;14698:3;:25;;;;;;;;;14690:91;;;;-1:-1:-1;;;14690:91:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14799:6;-1:-1:-1;;14552:261:6;;:::o;978:836:0:-;1521:150;1538:12;1552:18;1572:28;1602:5;1609:7;1618:9;1629:22;1653:17;1521:16;:150::i;:::-;1731:10;:24;;-1:-1:-1;;;;;;1731:24:0;-1:-1:-1;;;;;1731:24:0;;;;;;;;;;;1766:40;;;-1:-1:-1;;;1766:40:0;;;;1781:10;;;;;1766:38;;:40;;;;;;;;;;;;;;;1781:10;1766:40;;;5:2:-1;;;;30:1;27;20:12;5:2;1766:40:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1766:40:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;;;;;;978:836:0:o;6690:195:6:-;80124:11;;6785:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;6809:44;6824:10;6836:3;6841;6846:6;6809:14;:44::i;:::-;:68;6802:75;;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;6690:195;;-1:-1:-1;;;6690:195:6:o;4316:189:0:-;4397:4;4415:8;4428:48;4454:8;4464:11;4428:25;:48::i;:::-;-1:-1:-1;4414:62:0;4316:189;-1:-1:-1;;;;4316:189:0:o;1842:35:7:-;;;;;;-1:-1:-1;;;;;1842:35:7;;:::o;538:37::-;;;-1:-1:-1;;;538:37:7;;;;;:::o;1401:21::-;;;;;;:::o;8623:354:6:-;8685:4;8702:23;;:::i;:::-;8728:38;;;;;;;;8743:21;:19;:21::i;:::-;8728:38;;-1:-1:-1;;;;;8842:20:6;;8778:14;8842:20;;;:13;:20;;;;;;8702:64;;-1:-1:-1;8778:14:6;;;8810:53;;8702:64;;8810:17;:53::i;:::-;8777:86;;-1:-1:-1;8777:86:6;-1:-1:-1;8890:18:6;8882:4;:26;;;;;;;;;8874:70;;;;;-1:-1:-1;;;8874:70:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;8962:7;8623:354;-1:-1:-1;;;;8623:354:6:o;16501:88::-;16543:4;16567:14;:12;:14::i;:::-;16560:21;;16501:88;:::o;5458:119:0:-;5514:4;5538:31;5559:9;5538:20;:31::i;58223:733:6:-;58301:4;58357:16;:14;:16::i;:::-;58352:122;;58397:65;58402:18;58422:39;58397:4;:65::i;:::-;58390:72;;;;58352:122;58524:11;;58621:30;;;-1:-1:-1;;;58621:30:6;;;;-1:-1:-1;;;;;58524:11:6;;;;58621:28;;;;;:30;;;;;;;;;;;;;;:28;:30;;;5:2:-1;;;;30:1;27;20:12;5:2;58621:30:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;58621:30:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;58621:30:6;58613:71;;;;;-1:-1:-1;;;58613:71:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;58752:11;:28;;-1:-1:-1;;;;;;58752:28:6;-1:-1:-1;;;;;58752:28:6;;;;;;;;;58862:46;;;;;;;;;;;;;;;;;;;;;;;;;;;58933:14;58928:20;58921:27;58223:733;-1:-1:-1;;;58223:733:6:o;3079:24:7:-;;;;:::o;522:346:1:-;794:16;:14;:16::i;:::-;786:74;;;;-1:-1:-1;;;786:74:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;522:346;:::o;11036:29:7:-;;;-1:-1:-1;;;;;11036:29:7;;:::o;1968:39::-;;;-1:-1:-1;;;;;1968:39:7;;:::o;68300:571:6:-;80124:11;;68375:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;68405:16;:14;:16::i;:::-;68392:29;-1:-1:-1;68436:29:6;;68432:277;;68627:70;68638:5;68632:12;;;;;;;;68646:50;68627:4;:70::i;:::-;68620:77;;;;;68432:277;68829:34;68850:12;68829:20;:34::i;:::-;68822:41;;;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;68300:571;;-1:-1:-1;68300:571:6:o;3342:26:7:-;;;;:::o;2793:30::-;;;;:::o;9966:25::-;;;-1:-1:-1;;;;;9966:25:7;;:::o;8255:112:6:-;-1:-1:-1;;;;;8339:20:6;8312:7;8339:20;;;:13;:20;;;;;;;8255:112::o;11224:192::-;80124:11;;11286:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;11311:16;:14;:16::i;:::-;:40;11303:75;;;;;-1:-1:-1;;;11303:75:6;;;;;;;;;;;;-1:-1:-1;;;11303:75:6;;;;;;;;;;;;;;;-1:-1:-1;11396:12:6;;80191:1;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;11224:192;:::o;3157:133:0:-;3220:4;3244:38;3269:12;3244:24;:38::i;2420:28:7:-;;;;:::o;3209:25::-;;;;:::o;59244:572:6:-;80124:11;;59323:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;59353:16;:14;:16::i;:::-;59340:29;-1:-1:-1;59384:29:6;;59380:276;;59576:68;59587:5;59581:12;;;;;;;;59595:48;59576:4;:68::i;59380:276::-;59770:38;59788:19;59770:17;:38::i;1301:20:7:-;;;;;;;;;;;;;;;-1:-1:-1;;1301:20:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12140:287:6;12207:4;12225:13;12240:11;12255:36;12283:7;12255:27;:36::i;:::-;12224:67;;-1:-1:-1;12224:67:6;-1:-1:-1;12317:18:6;12310:3;:25;;;;;;;;;12302:93;;;;-1:-1:-1;;;12302:93:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;71143:588;80124:11;;71222:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;71252:16;:14;:16::i;:::-;71239:29;-1:-1:-1;71283:29:6;;71279:284;;71478:73;71489:5;71483:12;;;;;;;;71497:53;71478:4;:73::i;71279:284::-;71685:38;71708:14;71685:22;:38::i;2204:133:0:-;2253:4;2271:8;2284:24;2297:10;2284:12;:24::i;16837:1082:6:-;16879:4;16945:23;16971:16;:14;:16::i;:::-;16945:42;;17079:18;17057;;:40;17053:100;;;17126:14;17114:27;;;;;17053:100;17220:14;17237;:12;:14::i;:::-;17348:17;;17391:12;;17437:14;;17421:13;;17405;;17348:104;;;-1:-1:-1;;;17348:104:6;;;;;;;;;;;;;;;17405:29;;:46;;;17348:104;;;;;17220:31;;-1:-1:-1;17322:23:6;;-1:-1:-1;;;;;17348:17:6;;;;:31;;:104;;;;;;;;;;;;;;;:17;:104;;;5:2:-1;;;;30:1;27;20:12;5:2;17348:104:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;17348:104:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;17348:104:6;;-1:-1:-1;1574:9:7;17471:43:6;;;17463:84;;;;;-1:-1:-1;;;17463:84:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;17638:17;17657:15;17676:47;17684:18;17704;;17676:7;:47::i;:::-;17637:86;;-1:-1:-1;17637:86:6;-1:-1:-1;17753:18:6;17742:7;:29;;;;;;;;;17734:73;;;;;-1:-1:-1;;;17734:73:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;17827:84;17849:18;17869:9;17880:18;17900:10;17827:21;:84::i;:::-;17820:91;;;;;;;16837:1082;:::o;73805:593::-;80124:11;;73885:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;73915:16;:14;:16::i;:::-;73902:29;-1:-1:-1;73946:29:6;;73942:286;;74142:74;74153:5;74147:12;;;;;;;;74161:54;74142:4;:74::i;73942:286::-;74351:39;74375:14;74351:23;:39::i;6198:185::-;80124:11;;6276:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;6300:51;6315:10;6327;6339:3;6344:6;6300:14;:51::i;:::-;:75;6293:82;;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;6198:185;;-1:-1:-1;;6198:185:6:o;2944:23:7:-;;;;:::o;4754:37::-;4786:5;4754:37;:::o;10824:254:6:-;10901:17;;10877:4;;-1:-1:-1;;;;;10901:17:6;:31;10933:14;:12;:14::i;:::-;10949:12;;10995:14;;10979:13;;10963;;:29;:46;11053:16;;11035:15;;11011:21;;:39;:58;10901:169;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10901:169:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;10901:169:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;10901:169:6;;-1:-1:-1;10824:254:6;:::o;51425:194::-;80124:11;;51527:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;51551:60;51565:10;51577;51589:8;51599:11;51551:13;:60::i;:::-;51544:67;;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;51425:194;;-1:-1:-1;;;51425:194:6:o;56333:645::-;56410:4;56465:16;:14;:16::i;:::-;56460:124;;56505:67;56510:18;56530:41;56505:4;:67::i;56460:124::-;56683:12;;;-1:-1:-1;;;;;56766:30:6;;;56683:12;56766:30;;;-1:-1:-1;;;;;;56766:30:6;;;;;;56881:49;;;56683:12;;;;;;;;56881:49;;;;;;;;;;;;56683:12;;56881:49;;;;;;;;;56955:14;56950:20;;14104:198;80124:11;;14164:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;14189:16;:14;:16::i;:::-;:40;14181:75;;;;;-1:-1:-1;;;14181:75:6;;;;;;;;;;;;-1:-1:-1;;;14181:75:6;;;;;;;;;;;;;;;14274:20;:18;:20::i;:::-;14267:27;;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;14104:198;:::o;55366:553::-;55416:4;55471:16;:14;:16::i;:::-;55466:128;;55511:71;55516:18;55536:45;55511:4;:71::i;:::-;55504:78;;;;55466:128;55673:14;;-1:-1:-1;;;55673:14:6;;;;55668:48;;55701:14;55696:20;;55668:48;55769:14;:22;;-1:-1:-1;;;;55769:22:6;;;55849;;;;55786:5;;55849:22;55896:14;55891:20;;61299:554;80124:11;;61353:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;61383:16;:14;:16::i;:::-;61370:29;-1:-1:-1;61414:29:6;;61410:275;;61606:67;61617:5;61611:12;;;;;;;;61625:47;61606:4;:67::i;:::-;61599:74;;;;;61410:275;61799:46;61816:28;:26;:28::i;61799:46::-;61792:53;;;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;61299:554;:::o;9323:703::-;-1:-1:-1;;;;;9447:22:6;;9391:4;9447:22;;;:13;:22;;;;;;9391:4;;;;;;;;;9598:36;9461:7;9598:27;:36::i;:::-;9574:60;-1:-1:-1;9574:60:6;-1:-1:-1;9657:18:6;9649:4;:26;;;;;;;;;9645:99;;9705:16;9700:22;9692:40;-1:-1:-1;9724:1:6;;-1:-1:-1;9724:1:6;;-1:-1:-1;9724:1:6;;-1:-1:-1;9692:40:6;;-1:-1:-1;;;;9692:40:6;9645:99;9787:28;:26;:28::i;:::-;9756:59;-1:-1:-1;9756:59:6;-1:-1:-1;9838:18:6;9830:4;:26;;;;;;;;;9826:99;;9886:16;9881:22;;9826:99;-1:-1:-1;9950:14:6;;-1:-1:-1;9967:13:6;;-1:-1:-1;9982:13:6;-1:-1:-1;9982:13:6;-1:-1:-1;9323:703:6;;;;;;:::o;3558:113:0:-;3611:4;3635:28;3650:12;3635:14;:28::i;2688:113::-;2741:4;2765:28;2780:12;2765:14;:28::i;2546:27:7:-;;;;:::o;3475:25::-;;;;:::o;7922:143:6:-;-1:-1:-1;;;;;8023:25:6;;;7996:7;8023:25;;;:18;:25;;;;;;;;:34;;;;;;;;;;;;;7922:143::o;54633:577::-;54687:4;54742:16;:14;:16::i;:::-;54737:128;;54782:71;54787:18;54807:45;54782:4;:71::i;54737:128::-;54944:18;;-1:-1:-1;;;54944:18:6;;;;54939:52;;54976:14;54971:20;;54939:52;55048:18;:26;;-1:-1:-1;;;;55048:26:6;;;55136;;;;55069:5;;55136:26;55187:14;55182:20;;57256:742;57406:12;;57298:4;;57406:12;;;-1:-1:-1;;;;;57406:12:6;57392:10;:26;;;:54;;-1:-1:-1;57422:10:6;:24;57392:54;57388:164;;;57470:70;57475:18;57495:44;57470:4;:70::i;57388:164::-;57636:5;;;57678:12;;;-1:-1:-1;;;;;57636:5:6;57678:12;;;;-1:-1:-1;;;;;;57751:20:6;;;;;;;;-1:-1:-1;;;;;;57820:25:6;;;;;;57863;;;57636:5;;;57863:25;;;57882:5;;;;57863:25;;;;;;57678:12;;57863:25;;;;;;;;;57937:12;;57904:46;;;-1:-1:-1;;;;;57904:46:6;;;;;57937:12;;;;;;;57904:46;;;;;;;;;;;;;;;;57975:14;57963:27;;;;57256:742;:::o;76597:633::-;76684:4;76701:10;76714:16;:14;:16::i;:::-;76701:29;-1:-1:-1;76745:29:6;;76741:298;;76949:78;76960:5;76954:12;;;;;;;;76968:58;76949:4;:78::i;:::-;76942:85;;;;;76741:298;77174:48;77201:20;77174:26;:48::i;2109:42:7:-;;;-1:-1:-1;;;;;2109:42:7;;:::o;4987:237:0:-;5100:4;5118:8;5131:64;5155:8;5165:11;5178:16;5131:23;:64::i;:::-;-1:-1:-1;5117:78:0;4987:237;-1:-1:-1;;;;;4987:237:0:o;420:28:7:-;;;-1:-1:-1;;;;;420:28:7;;:::o;10454:194:6:-;10531:17;;10507:4;;-1:-1:-1;;;;;10531:17:6;:31;10563:14;:12;:14::i;:::-;10579:12;;10625:14;;10609:13;;10593;;:29;:46;10531:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;63339:607:6;80124:11;;63428:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;63458:16;:14;:16::i;:::-;63445:29;-1:-1:-1;63489:29:6;;63485:286;;63686:73;63697:5;63691:12;;;;;;;;63705:53;63686:4;:73::i;63485:286::-;63890:48;63913:24;63890:22;:48::i;4607:36:7:-;4639:4;4607:36;:::o;39536:572:6:-;80124:11;;39614:4;;;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;39650:16;:14;:16::i;:::-;39637:29;-1:-1:-1;39681:29:6;;39677:260;;39854:67;39865:5;39859:12;;;;;;;;39873:47;39854:4;:67::i;:::-;39846:79;-1:-1:-1;39923:1:6;;-1:-1:-1;39846:79:6;;-1:-1:-1;39846:79:6;39677:260;40047:53;40064:10;40076;40088:11;40047:16;:53::i;:::-;40040:60;;;;;80191:1;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;39536:572;;;;-1:-1:-1;39536:572:6:o;796:180:7:-;884:5;;845:4;;-1:-1:-1;;;;;884:5:7;870:10;:19;:37;;;;-1:-1:-1;893:14:7;;-1:-1:-1;;;893:14:7;;;;870:37;869:99;;;-1:-1:-1;913:10:7;302:42;913:32;:54;;;;-1:-1:-1;;949:18:7;;-1:-1:-1;;;949:18:7;;;;;796:180::o;10185:93:6:-;10258:12;10185:93;:::o;77560:1297::-;77654:4;77757:38;77847:16;:14;:16::i;:::-;77842:130;;77887:73;77892:18;77912:47;77887:4;:73::i;77842:130::-;78098:16;:14;:16::i;:::-;78076:18;;:38;78072:155;;78138:77;78143:22;78167:47;78138:4;:77::i;78072:155::-;78321:17;;;;;;;;;-1:-1:-1;;;;;78321:17:6;78298:40;;78441:20;-1:-1:-1;;;;;78441:40:6;;:42;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;78441:42:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;78441:42:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;78441:42:6;78433:83;;;;;-1:-1:-1;;;78433:83:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;78593:17;:40;;-1:-1:-1;;;;;;78593:40:6;-1:-1:-1;;;;;78593:40:6;;;;;;;;;78739:70;;;;;;;;;;;;;;;;;;;;;;;;;;;78834:14;78829:20;;64214:1016;64295:4;64351:16;:14;:16::i;:::-;64346:125;;64391:68;64396:18;64416:42;64391:4;:68::i;64346:125::-;64578:16;:14;:16::i;:::-;64556:18;;:38;64552:150;;64618:72;64623:22;64647:42;64618:4;:72::i;64552:150::-;1755:4:7;64820:15:6;;64801:16;;64774:24;:43;:61;:96;64770:202;;;64894:66;64899:15;64916:43;64894:4;:66::i;64770:202::-;65016:21;;;65048:48;;;;65114:68;;;;;;;;;;;;;;;;;;;;;;;;;65207:14;65202:20;;60074:946;60145:4;60201:16;:14;:16::i;:::-;60196:120;;60241:63;60246:18;60266:37;60241:4;:63::i;60196:120::-;60423:16;:14;:16::i;:::-;60401:18;;:38;60397:145;;60463:67;60468:22;60492:37;60463:4;:67::i;60397:145::-;1755:4:7;60650:15:6;;60628:19;60604:21;;:43;:61;:96;60600:197;;;60724:61;60729:15;60746:38;60724:4;:61::i;60600:197::-;60836:16;;;60863:38;;;;60919:53;;;;;;;;;;;;;;;;;;;;;;;;;60997:14;60992:20;;3138:120;3199:4;302:42:7;-1:-1:-1;;;;;3223:25:6;;:27;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;62103:933:6;62172:4;62271:15;;62249:18;:37;62245:97;;;62315:14;62310:20;;62245:97;62449:16;:14;:16::i;:::-;62427:18;;:38;62423:144;;62489:66;62494:22;62518:36;62489:4;:66::i;62423:144::-;1755:4:7;62671:18:6;62652:16;;62628:21;;:40;:61;:96;62624:196;;;62748:60;62753:15;62770:37;62748:4;:60::i;62624:196::-;62858:15;;;62884:36;;;;62938:50;;;;;;;;;;;;;;;;;;;;;;;;;63013:14;63008:20;;15077:1254;15186:11;;15138:9;;;;15212:17;15208:1116;;-1:-1:-1;;15406:27:6;;15386:18;;-1:-1:-1;15378:56:6;;15208:1116;15651:14;15668;:12;:14::i;:::-;15651:31;;15697:33;15745:23;;:::i;:::-;15783:17;15859:87;15874:9;15885:12;;15931:14;;15915:13;;15899;;:29;:46;15859:14;:87::i;:::-;15817:129;-1:-1:-1;15817:129:6;-1:-1:-1;15976:18:6;15965:7;:29;;;;;;;;;15961:89;;16023:7;-1:-1:-1;16032:1:6;;-1:-1:-1;16015:19:6;;-1:-1:-1;;;;16015:19:6;15961:89;16092:50;16099:28;16129:12;16092:6;:50::i;:::-;16066:76;-1:-1:-1;16066:76:6;-1:-1:-1;16172:18:6;16161:7;:29;;;;;;;;;16157:89;;16219:7;-1:-1:-1;16228:1:6;;-1:-1:-1;16211:19:6;;-1:-1:-1;;;;16211:19:6;16157:89;-1:-1:-1;16290:21:6;16270:18;;-1:-1:-1;16290:21:6;-1:-1:-1;16262:50:6;;-1:-1:-1;;;16262:50:6;15077:1254;;;:::o;3721:2216::-;3895:11;;:60;;;-1:-1:-1;;;3895:60:6;;3931:4;3895:60;;;;-1:-1:-1;;;;;3895:60:6;;;;;;;;;;;;;;;;;;;;;;3819:4;;;;3895:11;;:27;;:60;;;;;;;;;;;;;;3819:4;3895:11;:60;;;5:2:-1;;;;30:1;27;20:12;5:2;3895:60:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3895:60:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3895:60:6;;-1:-1:-1;3970:12:6;;3966:144;;4006:92;4017:27;4046:42;4090:7;4006:10;:92::i;:::-;3999:99;;;;;3966:144;4176:3;-1:-1:-1;;;;;4169:10:6;:3;-1:-1:-1;;;;;4169:10:6;;4165:105;;;4203:55;4208:15;4225:32;4203:4;:55::i;4165:105::-;4347:22;-1:-1:-1;;;;;4388:14:6;;;;;;;4384:160;;;-1:-1:-1;;;4384:160:6;;;-1:-1:-1;;;;;;4500:23:6;;;;;;;:18;:23;;;;;;;;:32;;;;;;;;;;4384:160;4622:17;4650;4678;4706;4762:34;4770:17;4789:6;4762:7;:34::i;:::-;4736:60;;-1:-1:-1;4736:60:6;-1:-1:-1;4822:18:6;4811:7;:29;;;;;;;;;4807:125;;4864:56;4869:16;4887:32;4864:4;:56::i;:::-;4857:63;;;;;;;;;;4807:125;-1:-1:-1;;;;;4978:18:6;;;;;;:13;:18;;;;;;4970:35;;4998:6;4970:7;:35::i;:::-;4944:61;;-1:-1:-1;4944:61:6;-1:-1:-1;5031:18:6;5020:7;:29;;;;;;;;;5016:124;;5073:55;5078:16;5096:31;5073:4;:55::i;5016:124::-;-1:-1:-1;;;;;5186:18:6;;;;;;:13;:18;;;;;;5178:35;;5206:6;5178:7;:35::i;:::-;5152:61;;-1:-1:-1;5152:61:6;-1:-1:-1;5239:18:6;5228:7;:29;;;;;;;;;5224:122;;5281:53;5286:16;5304:29;5281:4;:53::i;5224:122::-;-1:-1:-1;;;;;5479:18:6;;;;;;;:13;:18;;;;;;:33;;;5523:18;;;;;;:33;;;-1:-1:-1;;5629:29:6;;5625:109;;-1:-1:-1;;;;;5675:23:6;;;;;;;:18;:23;;;;;;;;:32;;;;;;;;;:47;;;5625:109;5805:3;-1:-1:-1;;;;;5791:26:6;5800:3;-1:-1:-1;;;;;5791:26:6;-1:-1:-1;;;;;;;;;;;5810:6:6;5791:26;;;;;;;;;;;;;;;;;;5830:11;;:59;;;-1:-1:-1;;;5830:59:6;;5865:4;5830:59;;;;-1:-1:-1;;;;;5830:59:6;;;;;;;;;;;;;;;;;;;;;;:11;;;;;:26;;:59;;;;;:11;;:59;;;;;;;:11;;:59;;;5:2:-1;;;;30:1;27;20:12;5:2;5830:59:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;5914:14:6;;-1:-1:-1;5909:20:6;;-1:-1:-1;;5909:20:6;;5902:27;3721:2216;-1:-1:-1;;;;;;;;;;;3721:2216:6:o;40441:594::-;80124:11;;40543:4;;;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;40579:16;:14;:16::i;:::-;40566:29;-1:-1:-1;40610:29:6;;40606:260;;40783:67;40794:5;40788:12;;;;;;;;40802:47;40783:4;:67::i;:::-;40775:79;-1:-1:-1;40852:1:6;;-1:-1:-1;40775:79:6;;-1:-1:-1;40775:79:6;40606:260;40976:51;40993:10;41005:8;41015:11;40976:16;:51::i;:::-;40969:58;;;;;80191:1;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;40441:594;;;;-1:-1:-1;40441:594:6;-1:-1:-1;40441:594:6:o;2520:313:16:-;2597:9;2608:4;2626:13;2641:18;;:::i;:::-;2663:20;2673:1;2676:6;2663:9;:20::i;:::-;2625:58;;-1:-1:-1;2625:58:16;-1:-1:-1;2705:18:16;2698:3;:25;;;;;;;;;2694:73;;-1:-1:-1;2748:3:16;-1:-1:-1;2753:1:16;;-1:-1:-1;2740:15:16;;2694:73;2787:18;2807:17;2816:7;2807:8;:17::i;:::-;2779:46;;;;;;2520:313;;;;;;:::o;5845:169:0:-;5947:10;;5976:30;;;-1:-1:-1;;;5976:30:0;;6000:4;5976:30;;;;;;5892:4;;-1:-1:-1;;;;;5947:10:0;;;;5976:15;;:30;;;;;;;;;;;;;;;5947:10;5976:30;;;5:2:-1;;;;30:1;27;20:12;5:2;5976:30:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5976:30:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;5976:30:0;;-1:-1:-1;;5845:169:0;:::o;65486:590:6:-;80124:11;;65563:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;65593:16;:14;:16::i;:::-;65580:29;-1:-1:-1;65624:29:6;;65620:274;;65815:67;65826:5;65820:12;;;;;;;;65834:47;65815:4;:67::i;65620:274::-;66017:28;66035:9;66017:17;:28::i;:::-;-1:-1:-1;66005:40:6;-1:-1:-1;;80217:4:6;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;65486:590;;-1:-1:-1;65486:590:6:o;8495:153:15:-;8556:4;8578:33;8591:3;8586:9;;;;;;;;8602:4;8597:10;;;;;;;;8578:33;;;;;;;;;;;;;8609:1;8578:33;;;;;;;;;;;;;8636:3;8631:9;;;;;;;69148:1745:6;69215:4;69273:21;69346:16;:14;:16::i;:::-;69341:122;;69386:65;69391:18;69411:39;69386:4;:65::i;69341:122::-;69589:16;:14;:16::i;:::-;69567:18;;:38;69563:147;;69629:69;69634:22;69658:39;69629:4;:69::i;69563:147::-;69816:12;69799:14;:12;:14::i;:::-;:29;69795:152;;;69852:83;69857:29;69888:46;69852:4;:83::i;69795:152::-;70041:13;;70026:12;:28;70022:129;;;70078:61;70083:15;70100:38;70078:4;:61::i;70022:129::-;-1:-1:-1;70303:13:6;;:28;;;;70439:33;;;70431:82;;;;-1:-1:-1;;;70431:82:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;70587:13;:32;;;70753:5;;70739:34;;-1:-1:-1;;;;;70753:5:6;70760:12;70739:13;:34::i;:::-;70807:5;;70791:54;;;-1:-1:-1;;;;;70807:5:6;;;70791:54;;;;;;;;;;;;;;;;;;;;;;;;70870:14;70865:20;;28162:537;80124:11;;28246:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;28276:16;:14;:16::i;:::-;28263:29;-1:-1:-1;28307:29:6;;28303:249;;28479:61;28490:5;28484:12;;;;;;;;28498:41;28479:4;:61::i;28303:249::-;28651:40;28663:10;28675:1;28678:12;28651:11;:40::i;12681:1268::-;-1:-1:-1;;;;;13030:23:6;;12758:9;13030:23;;;:14;:23;;;;;13259:24;;12758:9;;;;;;;;13255:92;;-1:-1:-1;13313:18:6;;-1:-1:-1;13313:18:6;;-1:-1:-1;13305:30:6;;-1:-1:-1;;;13305:30:6;13255:92;13574:46;13582:14;:24;;;13608:11;;13574:7;:46::i;:::-;13541:79;;-1:-1:-1;13541:79:6;-1:-1:-1;13646:18:6;13635:7;:29;;;;;;;;;13631:81;;-1:-1:-1;13689:7:6;;-1:-1:-1;13698:1:6;;-1:-1:-1;13681:19:6;;-1:-1:-1;;13681:19:6;13631:81;13744:58;13752:19;13773:14;:28;;;13744:7;:58::i;:::-;13724:78;;-1:-1:-1;13724:78:6;-1:-1:-1;13828:18:6;13817:7;:29;;;;;;;;;13813:81;;-1:-1:-1;13871:7:6;;-1:-1:-1;13880:1:6;;-1:-1:-1;13863:19:6;;-1:-1:-1;;13863:19:6;13813:81;-1:-1:-1;13914:18:6;;-1:-1:-1;13934:6:6;-1:-1:-1;;;12681:1268:6;;;;:::o;72005:1548::-;72076:4;72134:21;72282:16;:14;:16::i;:::-;72260:18;;:38;72256:150;;72322:72;72327:22;72351:42;72322:4;:72::i;72256:150::-;72512:14;72495;:12;:14::i;:::-;:31;72491:157;;;72550:86;72555:29;72586:49;72550:4;:86::i;72491:157::-;72746:13;;72729:14;:30;72725:134;;;72783:64;72788:15;72805:41;72783:4;:64::i;72725:134::-;-1:-1:-1;73011:13:6;;:30;;;;73151:33;;;73143:85;;;;-1:-1:-1;;;73143:85:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;73304:13;:32;;;73456:49;302:42:7;73490:14:6;73456:13;:49::i;:::-;73530:14;73525:20;;22159:547;80124:11;;22229:4;;;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;22265:16;:14;:16::i;:::-;22252:29;-1:-1:-1;22296:29:6;;22292:252;;22469:59;22480:5;22474:12;;;;;;;;22488:39;22469:4;:59::i;22292:252::-;22665:33;22675:10;22687;22665:9;:33::i;1303:230:8:-;1359:9;1370:4;1395:1;1390;:6;1386:141;;-1:-1:-1;1420:18:8;;-1:-1:-1;1440:5:8;;;1412:34;;1386:141;-1:-1:-1;1485:27:8;;-1:-1:-1;1514:1:8;1477:39;;17927:3834:6;18058:4;18713:17;18741:31;;:::i;:::-;18783:24;18818:20;18849:21;18881;18913:22;18946:19;19012:58;19022:35;;;;;;;;19037:18;19022:35;;;19059:10;19012:9;:58::i;:::-;18978:92;;-1:-1:-1;18978:92:6;-1:-1:-1;19096:18:6;19085:7;:29;;;;;;;;;19081:183;;19138:114;19149:16;19167:69;19243:7;19238:13;;;;;;;;19138:10;:114::i;:::-;19131:121;;;;;;;;;;;;19081:183;19309:53;19327:20;19349:12;;19309:17;:53::i;:::-;19276:86;;-1:-1:-1;19276:86:6;-1:-1:-1;19388:18:6;19377:7;:29;;;;;;;;;19373:181;;19430:112;19441:16;19459:67;19533:7;19528:13;;;;;;;19373:181;19595:42;19603:19;19624:12;;19595:7;:42::i;:::-;19566:71;;-1:-1:-1;19566:71:6;-1:-1:-1;19663:18:6;19652:7;:29;;;;;;;;;19648:178;;19705:109;19716:16;19734:64;19805:7;19800:13;;;;;;;19648:178;19868:100;19893:38;;;;;;;;19908:21;;19893:38;;;19933:19;19954:13;;19868:24;:100::i;:::-;19838:130;;-1:-1:-1;19838:130:6;-1:-1:-1;19994:18:6;19983:7;:29;;;;;;;;;19979:179;;20036:110;20047:16;20065:65;20137:7;20132:13;;;;;;;19979:179;20200:94;20225:32;;;;;;;;20240:15;;20225:32;;;20259:19;20280:13;;20200:24;:94::i;:::-;20170:124;;-1:-1:-1;20170:124:6;-1:-1:-1;20320:18:6;20309:7;:29;;;;;;;;;20305:180;;20362:111;20373:16;20391:66;20464:7;20459:13;;;;;;;20305:180;20528:96;20553:33;;;;;;;;20568:16;;20553:33;;;20588:19;20609:14;;20528:24;:96::i;:::-;20497:127;;-1:-1:-1;20497:127:6;-1:-1:-1;20650:18:6;20639:7;:29;;;;;;;;;20635:181;;20692:112;20703:16;20721:67;20795:7;20790:13;;;;;;;20635:181;20856:72;20881:20;20903:11;;20916;;20856:24;:72::i;:::-;20828:100;;-1:-1:-1;20828:100:6;-1:-1:-1;20954:18:6;20943:7;:29;;;;;;;;;20939:177;;20996:108;21007:16;21025:63;21095:7;21090:13;;;;;;;20939:177;21319:18;:39;;;21369:11;:28;;;21408:12;:30;;;21449:13;:32;;;21492:13;:32;;;21535:14;:34;;;21634:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21738:14;21726:27;17927:3834;-1:-1:-1;;;;;;;;;;;;;17927:3834:6:o;74674:1554::-;74746:4;74805:22;74954:16;:14;:16::i;:::-;74932:18;;:38;74928:151;;74994:73;74999:22;75023:43;74994:4;:73::i;74928:151::-;75185:14;75168;:12;:14::i;:::-;:31;75164:158;;;75223:87;75228:29;75259:50;75223:4;:87::i;75164:158::-;75422:14;;75405;:31;75401:136;;;75460:65;75465:15;75482:42;75460:4;:65::i;75401:136::-;-1:-1:-1;75690:14:6;;:31;;;;75832:35;;;75824:88;;;;-1:-1:-1;;;75824:88:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;75990:14;:34;;;76158:5;;76144:36;;-1:-1:-1;;;;;76158:5:6;76165:14;76144:13;:36::i;52294:2139::-;52485:11;;:87;;;-1:-1:-1;;;52485:87:6;;52518:4;52485:87;;;;-1:-1:-1;;;;;52485:87:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;52412:4;;;;52485:11;;:24;;:87;;;;;;;;;;;;;;52412:4;52485:11;:87;;;5:2:-1;;;;30:1;27;20:12;5:2;52485:87:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;52485:87:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;52485:87:6;;-1:-1:-1;52587:12:6;;52583:151;;52623:99;52634:27;52663:49;52714:7;52623:10;:99::i;52583:151::-;52807:10;-1:-1:-1;;;;;52795:22:6;:8;-1:-1:-1;;;;;52795:22:6;;52791:146;;;52841:84;52846:26;52874:50;52841:4;:84::i;52791:146::-;-1:-1:-1;;;;;53361:23:6;;52949:17;53361:23;;;:13;:23;;;;;;52949:17;;;;53353:45;;53386:11;53353:7;:45::i;:::-;53322:76;;-1:-1:-1;53322:76:6;-1:-1:-1;53424:18:6;53413:7;:29;;;;;;;;;53409:166;;53466:97;53477:16;53495:52;53554:7;53549:13;;;;;;;53466:97;53459:104;;;;;;;;53409:166;-1:-1:-1;;;;;53628:25:6;;;;;;:13;:25;;;;;;53620:47;;53655:11;53620:7;:47::i;:::-;53587:80;;-1:-1:-1;53587:80:6;-1:-1:-1;53693:18:6;53682:7;:29;;;;;;;;;53678:166;;53735:97;53746:16;53764:52;53823:7;53818:13;;;;;;;53678:166;-1:-1:-1;;;;;54047:23:6;;;;;;;:13;:23;;;;;;;;:43;;;54101:25;;;;;;;;;;:47;;;54203:43;;;;;;;54101:25;;-1:-1:-1;;;;;;;;;;;54203:43:6;;;;;;;;;;54299:11;;:86;;;-1:-1:-1;;;54299:86:6;;54331:4;54299:86;;;;-1:-1:-1;;;;;54299:86:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:11;;;;;:23;;:86;;;;;:11;;:86;;;;;;;:11;;:86;;;5:2:-1;;;;30:1;27;20:12;5:2;54299:86:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;54410:14:6;;-1:-1:-1;54405:20:6;;-1:-1:-1;;54405:20:6;;54398:27;52294:2139;-1:-1:-1;;;;;;;;;52294:2139:6:o;34454:524::-;80124:11;;34528:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;34558:16;:14;:16::i;:::-;34545:29;-1:-1:-1;34589:29:6;;34585:249;;34761:61;34772:5;34766:12;;;;;;;;34780:41;34761:4;:61::i;34585:249::-;34933:37;34945:10;34957:12;34933:11;:37::i;27255:527::-;80124:11;;27329:4;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;27359:16;:14;:16::i;:::-;27346:29;-1:-1:-1;27390:29:6;;27386:249;;27562:61;27573:5;27567:12;;;;;;;27386:249;27734:40;27746:10;27758:12;27772:1;27734:11;:40::i;45676:994::-;80124:11;;45810:4;;;;-1:-1:-1;;;80124:11:6;;;;80116:34;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;-1:-1:-1;;;80116:34:6;;;;;;;;;;;;;;;80161:11;:19;;-1:-1:-1;;;;80161:19:6;;;80175:5;45846:16;:14;:16::i;:::-;45833:29;-1:-1:-1;45877:29:6;;45873:269;;46055:71;46066:5;46060:12;;;;;;;;46074:51;46055:4;:71::i;:::-;46047:83;-1:-1:-1;46128:1:6;;-1:-1:-1;46047:83:6;;-1:-1:-1;46047:83:6;45873:269;46162:16;-1:-1:-1;;;;;46162:31:6;;:33;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;46162:33:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;46162:33:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;46162:33:6;;-1:-1:-1;46210:29:6;;46206:273;;46388:75;46399:5;46393:12;;;;;;;;46407:55;46388:4;:75::i;46206:273::-;46589:73;46610:10;46622:8;46632:11;46645:16;46589:20;:73::i;:::-;46582:80;;;;;80191:1;80217:4;80203:18;;-1:-1:-1;;;;80203:18:6;-1:-1:-1;;;80203:18:6;;;45676:994;;;;-1:-1:-1;45676:994:6;-1:-1:-1;;45676:994:6:o;41740:3409::-;41920:11;;:75;;;-1:-1:-1;;;41920:75:6;;41959:4;41920:75;;;;-1:-1:-1;;;;;41920:75:6;;;;;;;;;;;;;;;;;;;;;;41835:4;;;;;;41920:11;;;:30;;:75;;;;;;;;;;;;;;;41835:4;41920:11;:75;;;5:2:-1;;;;30:1;27;20:12;5:2;41920:75:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;41920:75:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;41920:75:6;;-1:-1:-1;42010:12:6;;42006:153;;42047:96;42058:27;42087:46;42135:7;42047:10;:96::i;:::-;42039:108;-1:-1:-1;42145:1:6;;-1:-1:-1;42039:108:6;;-1:-1:-1;42039:108:6;42006:153;42269:16;:14;:16::i;:::-;42247:18;;:38;42243:153;;42310:70;42315:22;42339:40;42310:4;:70::i;42243:153::-;42408:32;;:::i;:::-;-1:-1:-1;;;;;42554:24:6;;;;;;:14;:24;;;;;:38;;;42533:18;;;:59;42723:37;42569:8;42723:27;:37::i;:::-;42700:19;;;42685:75;;;42686:12;;;42685:75;;;;;;;;;;;;;;;;;;;-1:-1:-1;42791:18:6;;-1:-1:-1;42775:4:6;:12;;;:34;;;;;;;;;42771:192;;42834:113;42845:16;42863:63;42933:4;:12;;;42928:18;;;;;;;42834:113;42826:125;-1:-1:-1;42949:1:6;;-1:-1:-1;42826:125:6;;-1:-1:-1;;42826:125:6;42771:192;-1:-1:-1;;43045:11:6;:23;43041:157;;;43104:19;;;;43085:16;;;:38;43041:157;;;43156:16;;;:30;;;43041:157;43796:37;43809:5;43816:4;:16;;;43796:12;:37::i;:::-;43771:22;;;:62;;;44143:19;;;;44135:52;;:7;:52::i;:::-;44109:22;;;44094:93;;;44095:12;;;44094:93;;;;;;;;;;;;;;;;;;;-1:-1:-1;44222:18:6;;-1:-1:-1;44206:4:6;:12;;;:34;;;;;;;;;44198:105;;;;-1:-1:-1;;;44198:105:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;44355:45;44363:12;;44377:4;:22;;;44355:7;:45::i;:::-;44331:20;;;44316:84;;;44317:12;;;44316:84;;;;;;;;;;;;;;;;;;;-1:-1:-1;44435:18:6;;-1:-1:-1;44419:4:6;:12;;;:34;;;;;;;;;44411:96;;;;-1:-1:-1;;;44411:96:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;44627:22;;;;;;-1:-1:-1;;;;;44590:24:6;;;;;;;:14;:24;;;;;;;;;:59;;;44701:11;;44660:38;;;;:52;;;;44738:20;;;;44723:12;:35;;;44848:22;;;;44872;;44819:98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;44970:11;;45032:22;;;;45056:18;;;;44970:105;;;-1:-1:-1;;;44970:105:6;;45008:4;44970:105;;;;-1:-1:-1;;;;;44970:105:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:11;;;;;:29;;:105;;;;;:11;;:105;;;;;;;:11;;:105;;;5:2:-1;;;;30:1;27;20:12;5:2;44970:105:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;45101:14:6;;-1:-1:-1;45096:20:6;;-1:-1:-1;;45096:20:6;;45118:4;:22;;;45088:53;;;;;;41740:3409;;;;;;;:::o;1927:263:8:-;1998:9;2009:4;2026:14;2042:8;2054:13;2062:1;2065;2054:7;:13::i;:::-;2025:42;;-1:-1:-1;2025:42:8;-1:-1:-1;2090:18:8;2082:4;:26;;;;;;;;;2078:73;;-1:-1:-1;2132:4:8;-1:-1:-1;2138:1:8;;-1:-1:-1;2124:16:8;;2078:73;2168:15;2176:3;2181:1;2168:7;:15::i;:::-;2161:22;;;;;;1927:263;;;;;;:::o;813:515:16:-;874:9;885:10;;:::i;:::-;909:14;925:20;949:22;957:3;459:4;949:7;:22::i;:::-;908:63;;-1:-1:-1;908:63:16;-1:-1:-1;994:18:16;986:4;:26;;;;;;;;;982:92;;-1:-1:-1;1043:18:16;;;;;;;;;-1:-1:-1;1043:18:16;;1037:4;;-1:-1:-1;1043:18:16;-1:-1:-1;1029:33:16;;982:92;1087:14;1103:13;1120:31;1128:15;1145:5;1120:7;:31::i;:::-;1086:65;;-1:-1:-1;1086:65:16;-1:-1:-1;1174:18:16;1166:4;:26;;;;;;;;;1162:92;;-1:-1:-1;1223:18:16;;;;;;;;;-1:-1:-1;1223:18:16;;1217:4;;-1:-1:-1;1223:18:16;-1:-1:-1;1209:33:16;;-1:-1:-1;;1209:33:16;1162:92;1294:25;;;;;;;;;;;;-1:-1:-1;;1294:25:16;;-1:-1:-1;813:515:16;-1:-1:-1;;;;;;813:515:16:o;8771:245:15:-;8856:4;8878:43;8891:3;8886:9;;;;;;;;8902:4;8897:10;;;;;;;;8878:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;8948:27;8941:3;:34;;;;;;;;;:67;;9004:3;8999:9;;;;;;;;8941:67;;;-1:-1:-1;8978:4:15;:18;;8934:74;-1:-1:-1;;8771:245:15:o;1613:250:8:-;1669:9;;1705:5;;;1725:6;;;1721:136;;1755:18;;-1:-1:-1;1775:1:8;-1:-1:-1;1747:30:8;;1721:136;-1:-1:-1;1816:26:8;;-1:-1:-1;1844:1:8;;-1:-1:-1;1808:38:8;;2054:353:16;2123:9;2134:10;;:::i;:::-;2158:14;2174:19;2197:27;2205:1;:10;;;2217:6;2197:7;:27::i;:::-;2157:67;;-1:-1:-1;2157:67:16;-1:-1:-1;2247:18:16;2239:4;:26;;;;;;;;;2235:92;;-1:-1:-1;2296:18:16;;;;;;;;;-1:-1:-1;2296:18:16;;2290:4;;-1:-1:-1;2296:18:16;-1:-1:-1;2282:33:16;;2235:92;2367:31;;;;;;;;;;;;-1:-1:-1;;2367:31:16;;-1:-1:-1;2054:353:16;-1:-1:-1;;;;2054:353:16:o;7333:213::-;7515:12;459:4;7515:23;;;7333:213::o;66416:1631:6:-;66477:4;66483;66544:21;66576:20;66723:16;:14;:16::i;:::-;66701:18;;:38;66697:163;;66764:66;66769:22;66793:36;66764:4;:66::i;:::-;66756:92;-1:-1:-1;66832:15:6;-1:-1:-1;66756:92:6;;-1:-1:-1;66756:92:6;66697:163;67449:35;67462:10;67474:9;67449:12;:35::i;:::-;67431:53;;67532:15;67516:13;;:31;67497:50;;67622:13;;67602:16;:33;;67594:78;;;;;-1:-1:-1;;;67594:78:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;67749:13;:32;;;67870:60;;;67884:10;67870:60;;;;;;;;;;;;;;;;;;;;;;;;;68006:14;67993:46;-1:-1:-1;68023:15:6;-1:-1:-1;;66416:1631:6;;;:::o;8679:904:0:-;8815:10;;8837:26;;;-1:-1:-1;;;8837:26:0;;-1:-1:-1;;;;;8837:26:0;;;;;;;;;;;;;;;8815:10;;;;;;;8837:14;;:26;;;;;8755:31;;8837:26;;;;;;;;8755:31;8815:10;8837:26;;;5:2:-1;;;;30:1;27;20:12;5:2;8837:26:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;8837:26:0;;;;8876:12;8930:16;8969:1;8964:152;;;;9139:2;9134:219;;;;9488:1;9485;9478:12;8964:152;-1:-1:-1;;9059:6:0;-1:-1:-1;8964:152:0;;9134:219;9236:2;9233:1;9230;9215:24;9278:1;9272:8;9261:19;;8923:586;;9538:7;9530:45;;;;;-1:-1:-1;;;9530:45:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;8679:904;;;;:::o;29588:4598:6:-;29695:4;29720:19;;;:42;;-1:-1:-1;29743:19:6;;29720:42;29712:107;;;;-1:-1:-1;;;29712:107:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;29832:27;;:::i;:::-;29976:28;:26;:28::i;:::-;29947:25;;;29932:72;;;29933:12;;;29932:72;;;;;;;;;;;;;;;;;;;-1:-1:-1;30035:18:6;;-1:-1:-1;30019:4:6;:12;;;:34;;;;;;;;;30015:168;;30077:94;30088:16;30106:44;30157:4;:12;;;30152:18;;;;;;;30077:94;30070:101;;;;;30015:168;30237:18;;30233:1290;;30513:17;;;:34;;;30618:42;;;;;;;;30633:25;;;;30618:42;;30600:77;;30533:14;30600:17;:77::i;:::-;30579:17;;;30564:113;;;30565:12;;;30564:113;;;;;;;;;;;;;;;;;;;-1:-1:-1;30712:18:6;;-1:-1:-1;30696:4:6;:12;;;:34;;;;;;;;;30692:185;;30758:103;30769:16;30787:53;30847:4;:12;;;30842:18;;;;;;;30692:185;30233:1290;;;31179:82;31202:14;31218:42;;;;;;;;31233:4;:25;;;31218:42;;;31179:22;:82::i;:::-;31158:17;;;31143:118;;;31144:12;;;31143:118;;;;;;;;;;;;;;;;;;;-1:-1:-1;31296:18:6;;-1:-1:-1;31280:4:6;:12;;;:34;;;;;;;;;31276:185;;31342:103;31353:16;31371:53;31431:4;:12;;;31426:18;;;;;;;31276:185;31477:17;;;:34;;;30233:1290;31592:11;;31643:17;;;;31592:69;;;-1:-1:-1;;;31592:69:6;;31626:4;31592:69;;;;-1:-1:-1;;;;;31592:69:6;;;;;;;;;;;;;;;;31577:12;;31592:11;;;;;:25;;:69;;;;;;;;;;;;;;;31577:12;31592:11;:69;;;5:2:-1;;;;30:1;27;20:12;5:2;31592:69:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;31592:69:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;31592:69:6;;-1:-1:-1;31676:12:6;;31672:142;;31712:90;31723:27;31752:40;31794:7;31712:10;:90::i;:::-;31705:97;;;;;;31672:142;31924:16;:14;:16::i;:::-;31902:18;;:38;31898:142;;31964:64;31969:22;31993:34;31964:4;:64::i;31898:142::-;32335:39;32343:11;;32356:4;:17;;;32335:7;:39::i;:::-;32312:19;;;32297:77;;;32298:12;;;32297:77;;;;;;;;;;;;;;;;;;;-1:-1:-1;32405:18:6;;-1:-1:-1;32389:4:6;:12;;;:34;;;;;;;;;32385:178;;32447:104;32458:16;32476:54;32537:4;:12;;;32532:18;;;;;;;32385:178;-1:-1:-1;;;;;32623:23:6;;;;;;:13;:23;;;;;;32648:17;;;;32615:51;;32623:23;32615:7;:51::i;:::-;32590:21;;;32575:91;;;32576:12;;;32575:91;;;;;;;;;;;;;;;;;;;-1:-1:-1;32697:18:6;;-1:-1:-1;32681:4:6;:12;;;:34;;;;;;;;;32677:181;;32739:107;32750:16;32768:57;32832:4;:12;;;32827:18;;;;;;;32677:181;32956:4;:17;;;32939:14;:12;:14::i;:::-;:34;32935:155;;;32997:81;33002:29;33033:44;32997:4;:81::i;32935:155::-;33586:42;33600:8;33610:4;:17;;;33586:13;:42::i;:::-;33721:19;;;;33707:11;:33;33777:21;;;;-1:-1:-1;;;;;33751:23:6;;;;;;:13;:23;;;;;;;;;:47;;;;33910:17;;;;33876:52;;;;;;;33903:4;;-1:-1:-1;;;;;;;;;;;33876:52:6;;;;;;;33961:17;;;;33980;;;;;33944:54;;;-1:-1:-1;;;;;33944:54:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;34051:11;;34101:17;;;;34120;;;;34051:87;;;-1:-1:-1;;;34051:87:6;;34084:4;34051:87;;;;-1:-1:-1;;;;;34051:87:6;;;;;;;;;;;;;;;;;;;;;;:11;;;;;:24;;:87;;;;;:11;;:87;;;;;;;:11;;:87;;;5:2:-1;;;;30:1;27;20:12;5:2;34051:87:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;34163:14:6;;-1:-1:-1;34158:20:6;;-1:-1:-1;;34158:20:6;;34151:27;29588:4598;-1:-1:-1;;;;;;29588:4598:6:o;543:331:8:-;599:9;;630:6;626:67;;-1:-1:-1;660:18:8;;-1:-1:-1;660:18:8;652:30;;626:67;712:5;;;716:1;712;:5;:1;732:5;;;;;:10;728:140;;-1:-1:-1;766:26:8;;-1:-1:-1;794:1:8;;-1:-1:-1;758:38:8;;728:140;835:18;;-1:-1:-1;855:1:8;-1:-1:-1;827:30:8;;964:209;1020:9;;1051:6;1047:75;;-1:-1:-1;1081:26:8;;-1:-1:-1;1109:1:8;1073:38;;1047:75;1140:18;1164:1;1160;:5;;;;;;1132:34;;;;964:209;;;;;:::o;23416:3488:6:-;23564:11;;:58;;;-1:-1:-1;;;23564:58:6;;23596:4;23564:58;;;;-1:-1:-1;;;;;23564:58:6;;;;;;;;;;;;;;;23486:4;;;;;;23564:11;;;:23;;:58;;;;;;;;;;;;;;;23486:4;23564:11;:58;;;5:2:-1;;;;30:1;27;20:12;5:2;23564:58:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;23564:58:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;23564:58:6;;-1:-1:-1;23637:12:6;;23633:145;;23674:88;23685:27;23714:38;23754:7;23674:10;:88::i;:::-;23666:100;-1:-1:-1;23764:1:6;;-1:-1:-1;23666:100:6;;-1:-1:-1;23666:100:6;23633:145;23888:16;:14;:16::i;:::-;23866:18;;:38;23862:145;;23929:62;23934:22;23958:32;23929:4;:62::i;23862:145::-;24019:25;;:::i;:::-;24101:28;:26;:28::i;:::-;24072:25;;;24057:72;;;24058:12;;;24057:72;;;;;;;;;;;;;;;;;;;-1:-1:-1;24160:18:6;;-1:-1:-1;24144:4:6;:12;;;:34;;;;;;;;;24140:171;;24203:92;24214:16;24232:42;24281:4;:12;;;24276:18;;;;;;;24203:92;24195:104;-1:-1:-1;24297:1:6;;-1:-1:-1;24195:104:6;;-1:-1:-1;;24195:104:6;24140:171;24362:11;;24406:25;;;;;-1:-1:-1;;;;;24433:21:6;;;24362:11;24433:21;;;:13;:21;;;;;;;;24362:105;;-1:-1:-1;;;24362:105:6;;24399:4;24362:105;;;;;;;;;;;;;;;;;;;;;;;:11;;;;;:28;;:105;;;;;24433:21;;24362:105;;;;;;;;;:11;:105;;;5:2:-1;;;;30:1;27;20:12;5:2;24362:105:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;24362:105:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;24362:105:6;;-1:-1:-1;24482:12:6;;24478:145;;24519:88;24530:27;24559:38;24599:7;24519:10;:88::i;24478:145::-;25255:32;25268:6;25276:10;25255:12;:32::i;:::-;25231:21;;;:56;;;25560:42;;;;;;;;25575:25;;;;25560:42;;25514:89;;25231:56;25514:22;:89::i;:::-;25495:15;;;25480:123;;;25481:12;;;25480:123;;;;;;;;;;;;;;;;;;;-1:-1:-1;25638:18:6;;-1:-1:-1;25622:4:6;:12;;;:34;;;;;;;;;25614:79;;;;;-1:-1:-1;;;25614:79:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;25997:37;26005:11;;26018:4;:15;;;25997:7;:37::i;:::-;25974:19;;;25959:75;;;25960:12;;;25959:75;;;;;;;;;;;;;;;;;;;-1:-1:-1;26069:18:6;;-1:-1:-1;26053:4:6;:12;;;:34;;;;;;;;;26045:87;;;;-1:-1:-1;;;26045:87:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;26193:21:6;;;;;;:13;:21;;;;;;26216:15;;;;26185:47;;26193:21;26185:7;:47::i;:::-;26160:21;;;26145:87;;;26146:12;;;26145:87;;;;;;;;;;;;;;;;;;;-1:-1:-1;26267:18:6;;-1:-1:-1;26251:4:6;:12;;;:34;;;;;;;;;26243:90;;;;-1:-1:-1;;;26243:90:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26426:19;;;;26412:11;:33;26480:21;;;;-1:-1:-1;;;;;26456:21:6;;;;;;:13;:21;;;;;;;;;:45;;;;26590:21;;;;26613:15;;;;;26577:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26677:15;;;;26645:48;;;;;;;-1:-1:-1;;;;;26645:48:6;;;26662:4;;-1:-1:-1;;;;;;;;;;;26645:48:6;;;;;;;;26746:11;;26792:21;;;;26815:15;;;;26746:85;;;-1:-1:-1;;;26746:85:6;;26777:4;26746:85;;;;-1:-1:-1;;;;;26746:85:6;;;;;;;;;;;;;;;;;;;;;;:11;;;;;:22;;:85;;;;;:11;;:85;;;;;;;:11;;:85;;;5:2:-1;;;;30:1;27;20:12;5:2;26746:85:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;26857:14:6;;-1:-1:-1;26852:20:6;;-1:-1:-1;;26852:20:6;;26874:4;:21;;;26844:52;;;;;;23416:3488;;;;;:::o;2978:328:16:-;3075:9;3086:4;3104:13;3119:18;;:::i;:::-;3141:20;3151:1;3154:6;3141:9;:20::i;:::-;3103:58;;-1:-1:-1;3103:58:16;-1:-1:-1;3183:18:16;3176:3;:25;;;;;;;;;3172:73;;-1:-1:-1;3226:3:16;-1:-1:-1;3231:1:16;;-1:-1:-1;3218:15:16;;3172:73;3264:34;3272:17;3281:7;3272:8;:17::i;:::-;3291:6;3264:7;:34::i;35405:3878:6:-;35563:11;;:64;;;-1:-1:-1;;;35563:64:6;;35597:4;35563:64;;;;-1:-1:-1;;;;;35563:64:6;;;;;;;;;;;;;;;35489:4;;;;35563:11;;:25;;:64;;;;;;;;;;;;;;35489:4;35563:11;:64;;;5:2:-1;;;;30:1;27;20:12;5:2;35563:64:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;35563:64:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;35563:64:6;;-1:-1:-1;35642:12:6;;35638:142;;35678:90;35689:27;35718:40;35760:7;35678:10;:90::i;:::-;35671:97;;;;;35638:142;35890:16;:14;:16::i;:::-;35868:18;;:38;35864:142;;35930:64;35935:22;35959:34;35930:4;:64::i;35864:142::-;36094:14;36111;:12;:14::i;:::-;36094:31;;36154:12;36142:9;:24;36138:138;;;36190:74;36195:29;36226:37;36190:4;:74::i;:::-;36183:81;;;;;;36138:138;36288:27;;:::i;:::-;36603:37;36631:8;36603:27;:37::i;:::-;36580:19;;;36565:75;;;36566:4;36565:75;;;;;;;;;;;;;;;;;;;-1:-1:-1;36671:18:6;;-1:-1:-1;36655:12:6;;:34;;;;;;;;;36651:181;;36713:107;36724:16;36742:57;36806:4;:12;;;36801:18;;;;;;;36713:107;36706:114;;;;;;;36651:181;36885:42;36893:4;:19;;;36914:12;36885:7;:42::i;:::-;36859:22;;;36844:83;;;36845:4;36844:83;;;;;;;;;;;;;;;;;;;-1:-1:-1;36958:18:6;;-1:-1:-1;36942:12:6;;:34;;;;;;;;;36938:188;;37000:114;37011:16;37029:64;37100:4;:12;;;37095:18;;;;;;;36938:188;37206:11;;37252:22;;;;;37206:69;;-1:-1:-1;;;37206:69:6;;37245:4;37206:69;;;;;;;;;;;;;-1:-1:-1;;;;;37206:11:6;;;;:30;;:69;;;;;;;;;;;;;;;:11;;:69;;;5:2:-1;;;;30:1;27;20:12;5:2;37206:69:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;37206:69:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;37206:69:6;;-1:-1:-1;37290:12:6;;37286:142;;37326:90;37337:27;37366:40;37408:7;37326:10;:90::i;37286:142::-;37479:35;37487:12;;37501;37479:7;:35::i;:::-;37455:20;;;37440:74;;;37441:4;37440:74;;;;;;;;;;;;;;;;;;;-1:-1:-1;37545:18:6;;-1:-1:-1;37529:12:6;;:34;;;;;;;;;37525:179;;37587:105;37598:16;37616:55;37678:4;:12;;;37673:18;;;;;;;37525:179;37770:23;302:42:7;-1:-1:-1;;;;;37796:28:6;;:30;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;37796:30:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;37796:30:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;37796:30:6;;-1:-1:-1;;;37843:29:6;;37839:368;;;37889:23;37915:4;:20;;;37939:1;37915:25;:139;;38038:14;;38022:13;;38006;;:29;:46;37990:12;;37978:9;:24;:75;37947:4;:20;;;37970:4;37947:27;:107;;;;;;37915:139;;;37943:1;37915:139;37889:165;;38091:18;38073:15;:36;38069:126;;;38118:77;38123:27;38152:42;38118:4;:77::i;:::-;38111:84;;;;;;;;;38069:126;37839:368;;38699:37;38713:8;38723:12;38699:13;:37::i;:::-;38856:22;;;;;;-1:-1:-1;;;;;38819:24:6;;;;;;:14;:24;;;;;;;;:59;;;38930:11;;38889:38;;;;:52;;;;38967:20;;;;;38952:12;:35;;;39074:22;;39043:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;39172:11;;:63;;;-1:-1:-1;;;39172:63:6;;39205:4;39172:63;;;;-1:-1:-1;;;;;39172:63:6;;;;;;;;;;;;;;;:11;;;;;:24;;:63;;;;;:11;;:63;;;;;;;:11;;:63;;;5:2:-1;;;;30:1;27;20:12;5:2;39172:63:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;39260:14:6;;-1:-1:-1;39255:20:6;;-1:-1:-1;;39255:20:6;;39248:27;35405:3878;-1:-1:-1;;;;;;;35405:3878:6:o;47282:3582::-;47503:11;;:111;;;-1:-1:-1;;;47503:111:6;;47546:4;47503:111;;;;-1:-1:-1;;;;;47503:111:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47420:4;;;;;;47503:11;;;:34;;:111;;;;;;;;;;;;;;;47420:4;47503:11;:111;;;5:2:-1;;;;30:1;27;20:12;5:2;47503:111:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;47503:111:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;47503:111:6;;-1:-1:-1;47629:12:6;;47625:150;;47666:93;47677:27;47706:43;47751:7;47666:10;:93::i;:::-;47658:105;-1:-1:-1;47761:1:6;;-1:-1:-1;47658:105:6;;-1:-1:-1;47658:105:6;47625:150;47885:16;:14;:16::i;:::-;47863:18;;:38;47859:150;;47926:67;47931:22;47955:37;47926:4;:67::i;47859:150::-;48155:16;:14;:16::i;:::-;48114;-1:-1:-1;;;;;48114:35:6;;:37;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;48114:37:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;48114:37:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;48114:37:6;:57;48110:180;;48196:78;48201:22;48225:48;48196:4;:78::i;48110:180::-;48363:10;-1:-1:-1;;;;;48351:22:6;:8;-1:-1:-1;;;;;48351:22:6;;48347:145;;;48398:78;48403:26;48431:44;48398:4;:78::i;48347:145::-;48547:16;48543:147;;48588:86;48593:36;48631:42;48588:4;:86::i;48543:147::-;-1:-1:-1;;48746:11:6;:23;48742:158;;;48794:90;48799:36;48837:46;48794:4;:90::i;48742:158::-;48956:21;48979:22;49005:51;49022:10;49034:8;49044:11;49005:16;:51::i;:::-;48955:101;;-1:-1:-1;48955:101:6;-1:-1:-1;49071:40:6;;49067:163;;49136:78;49147:16;49141:23;;;;;;;;49166:47;49136:4;:78::i;:::-;49128:90;-1:-1:-1;49216:1:6;;-1:-1:-1;49128:90:6;;-1:-1:-1;;;49128:90:6;49067:163;49487:11;;:102;;;-1:-1:-1;;;49487:102:6;;49537:4;49487:102;;;;-1:-1:-1;;;;;49487:102:6;;;;;;;;;;;;;;;49444:21;;;;49487:11;;;:41;;:102;;;;;;;;;;;;:11;:102;;;5:2:-1;;;;30:1;27;20:12;5:2;49487:102:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;49487:102:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;49487:102:6;;;;;;;;;-1:-1:-1;49487:102:6;-1:-1:-1;49608:40:6;;49600:104;;;;-1:-1:-1;;;49600:104:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49838:11;49798:16;-1:-1:-1;;;;;49798:26:6;;49825:8;49798:36;;;;;;;;;;;;;-1:-1:-1;;;;;49798:36:6;-1:-1:-1;;;;;49798:36:6;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;49798:36:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;49798:36:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;49798:36:6;:51;;49790:88;;;;;-1:-1:-1;;;49790:88:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;50007:15;-1:-1:-1;;;;;50037:42:6;;50074:4;50037:42;50033:254;;;50109:63;50131:4;50138:10;50150:8;50160:11;50109:13;:63::i;:::-;50096:76;;50033:254;;;50218:57;;;-1:-1:-1;;;50218:57:6;;-1:-1:-1;;;;;50218:57:6;;;;;;;;;;;;;;;;;;;;;;:22;;;;;;:57;;;;;;;;;;;;;;;-1:-1:-1;50218:22:6;:57;;;5:2:-1;;;;30:1;27;20:12;5:2;50218:57:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;50218:57:6;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;50218:57:6;;-1:-1:-1;50033:254:6;50393:34;;50385:67;;;;;-1:-1:-1;;;50385:67:6;;;;;;;;;;;;-1:-1:-1;;;50385:67:6;;;;;;;;;;;;;;;50517:96;;;-1:-1:-1;;;;;50517:96:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50666:11;;:129;;;-1:-1:-1;;;50666:129:6;;50708:4;50666:129;;;;-1:-1:-1;;;;;50666:129:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:11;;;;;:33;;:129;;;;;:11;;:129;;;;;;;:11;;:129;;;5:2:-1;;;;30:1;27;20:12;5:2;50666:129:6;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;50821:14:6;;-1:-1:-1;50816:20:6;;-1:-1:-1;;50816:20:6;;50808:48;-1:-1:-1;50838:17:6;;-1:-1:-1;;;;;;47282:3582:6;;;;;;;;:::o;6631:1344:0:-;6775:10;;6818:51;;;-1:-1:-1;;;6818:51:0;;6863:4;6818:51;;;;;;6698:4;;-1:-1:-1;;;;;6775:10:0;;6698:4;;6775:10;;6818:36;;:51;;;;;;;;;;;;;;6775:10;6818:51;;;5:2:-1;;;;30:1;27;20:12;5:2;6818:51:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6818:51:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;6818:51:0;6880:47;;;-1:-1:-1;;;6880:47:0;;-1:-1:-1;;;;;6880:47:0;;;;;;;6913:4;6880:47;;;;;;;;;;;;6818:51;;-1:-1:-1;6880:18:0;;;;;;:47;;;;;-1:-1:-1;;6880:47:0;;;;;;;;-1:-1:-1;6880:18:0;:47;;;5:2:-1;;;;30:1;27;20:12;5:2;6880:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6880:47:0;;;;6940:12;6994:16;7033:1;7028:153;;;;7204:2;7199:220;;;;7555:1;7552;7545:12;7028:153;-1:-1:-1;;7124:6:0;-1:-1:-1;7028:153:0;;7199:220;7302:2;7299:1;7296;7281:24;7344:1;7338:8;7327:19;;6987:589;;7605:7;7597:44;;;;;-1:-1:-1;;;7597:44:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;7754:10;;7739:51;;;-1:-1:-1;;;7739:51:0;;7784:4;7739:51;;;;;;7719:17;;-1:-1:-1;;;;;7754:10:0;;7739:36;;:51;;;;;;;;;;;;;;7754:10;7739:51;;;5:2:-1;;;;30:1;27;20:12;5:2;7739:51:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7739:51:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7739:51:0;;-1:-1:-1;7809:29:0;;;;7801:68;;;;;-1:-1:-1;;;7801:68:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;7887:28;;;;;6631:1344;-1:-1:-1;;;;;6631:1344:0:o;4568:337:16:-;4656:9;4667:4;4685:13;4700:19;;:::i;:::-;4723:31;4738:6;4746:7;3917:9;3928:10;;:::i;:::-;4235:14;4251;4269:25;459:4;4287:6;4269:7;:25::i;:::-;4234:60;;-1:-1:-1;4234:60:16;-1:-1:-1;4317:18:16;4309:4;:26;;;;;;;;;4305:92;;-1:-1:-1;4366:18:16;;;;;;;;;-1:-1:-1;4366:18:16;;4360:4;;-1:-1:-1;4366:18:16;-1:-1:-1;4352:33:16;;4305:92;4414:35;4421:9;4432:7;:16;;;4414:6;:35::i;204:1053:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;204:1053:1;;;-1:-1:-1;204:1053:1;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;-1:-1:-1;204:1053:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;-1:-1:-1;204:1053:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;-1:-1:-1;204:1053:1;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;
Swarm Source
bzzr://7473ae03a63b26da518758f6b72730461f0fcc79be55f453679cbfe4d137d83a
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.