ETH Price: $2,321.53 (+0.86%)

Token

YUAN (YUAN)
 

Overview

Max Total Supply

1,020,016,464,699.400650009983380109 YUAN

Holders

390 (0.00%)

Market

Price

$0.00 @ 0.000000 ETH

Onchain Market Cap

$258,472.17

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
31,440,936.027499024737278945 YUAN

Value
$7.97 ( ~0.00343308092431766 Eth) [0.0031%]
0x8b9629d87e65367132926d6bce6192670039486c
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Yuan is an elastic token tracking the exchange rate of Chinese Yuan against USD. Yuan Project is 100% community-driven and all governances are fully on-chain.

# Exchange Pair Price  24H Volume % Volume

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x30bb8D13...ab85bAc28
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
YUANDelegator

Compiler Version
v0.5.15+commit.6a57276f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU LGPLv3 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-11-03
*/

// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity 0.5.15;

/* Copyright 2020 Compound Labs, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

contract YUANGovernanceStorage {
    /// @notice A record of each accounts delegate
    mapping(address => address) internal _delegates;

    /// @notice A checkpoint for marking number of votes from a given block
    struct Checkpoint {
        uint32 fromBlock;
        uint256 votes;
    }

    /// @notice A record of votes checkpoints for each account, by index
    mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;

    /// @notice The number of checkpoints for each account
    mapping(address => uint32) public numCheckpoints;

    /// @notice The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH = keccak256(
        "EIP712Domain(string name,uint256 chainId,address verifyingContract)"
    );

    /// @notice The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH = keccak256(
        "Delegation(address delegatee,uint256 nonce,uint256 expiry)"
    );

    /// @notice A record of states for signing / validating signatures
    mapping(address => uint256) public nonces;
}

// Storage for a YUAN token
contract YUANTokenStorage {
    using SafeMath for uint256;

    /**
     * @dev Guard variable for re-entrancy checks. Not currently used
     */
    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 Governor for this contract
     */
    address public gov;

    /**
     * @notice Pending governance for this contract
     */
    address public pendingGov;

    /**
     * @notice Approved rebaser for this contract
     */
    address public rebaser;

    /**
     * @notice Approved migrator for this contract
     */
    address public migrator;

    /**
     * @notice Incentivizer address of YUAN protocol
     */
    address public incentivizer;

    /**
     * @notice Total supply of YUANs
     */
    uint256 public totalSupply;

    /**
     * @notice Internal decimals used to handle scaling factor
     */
    uint256 public constant internalDecimals = 10**24;

    /**
     * @notice Used for percentage maths
     */
    uint256 public constant BASE = 10**18;

    /**
     * @notice Scaling factor that adjusts everyone's balances
     */
    uint256 public yuansScalingFactor;

    mapping(address => uint256) internal _yuanBalances;

    mapping(address => mapping(address => uint256)) internal _allowedFragments;

    uint256 public initSupply;

    // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32
        public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
    bytes32 public DOMAIN_SEPARATOR;
}

contract YUANTokenInterface is YUANTokenStorage, YUANGovernanceStorage {
    /// @notice An event thats emitted when an account changes its delegate
    event DelegateChanged(
        address indexed delegator,
        address indexed fromDelegate,
        address indexed toDelegate
    );

    /// @notice An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(
        address indexed delegate,
        uint256 previousBalance,
        uint256 newBalance
    );

    /**
     * @notice Event emitted when tokens are rebased
     */
    event Rebase(
        uint256 epoch,
        uint256 prevYuansScalingFactor,
        uint256 newYuansScalingFactor
    );

    /*** Gov Events ***/

    /**
     * @notice Event emitted when pendingGov is changed
     */
    event NewPendingGov(address oldPendingGov, address newPendingGov);

    /**
     * @notice Event emitted when gov is changed
     */
    event NewGov(address oldGov, address newGov);

    /**
     * @notice Sets the rebaser contract
     */
    event NewRebaser(address oldRebaser, address newRebaser);

    /**
     * @notice Sets the migrator contract
     */
    event NewMigrator(address oldMigrator, address newMigrator);

    /**
     * @notice Sets the incentivizer contract
     */
    event NewIncentivizer(address oldIncentivizer, address newIncentivizer);

    /* - ERC20 Events - */

    /**
     * @notice EIP20 Transfer event
     */
    event Transfer(address indexed from, address indexed to, uint256 amount);

    /**
     * @notice EIP20 Approval event
     */
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 amount
    );

    /* - Extra Events - */
    /**
     * @notice Tokens minted event
     */
    event Mint(address to, uint256 amount);

    // Public functions
    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function balanceOf(address who) external view returns (uint256);

    function balanceOfUnderlying(address who) external view returns (uint256);

    function allowance(address owner_, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function increaseAllowance(address spender, uint256 addedValue)
        external
        returns (bool);

    function decreaseAllowance(address spender, uint256 subtractedValue)
        external
        returns (bool);

    function maxScalingFactor() external view returns (uint256);

    function yuanToFragment(uint256 yuan) external view returns (uint256);

    function fragmentToYuan(uint256 value) external view returns (uint256);

    /* - Governance Functions - */
    function getPriorVotes(address account, uint256 blockNumber)
        external
        view
        returns (uint256);

    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    function delegate(address delegatee) external;

    function delegates(address delegator) external view returns (address);

    function getCurrentVotes(address account) external view returns (uint256);

    /* - Permissioned/Governance functions - */
    function mint(address to, uint256 amount) external returns (bool);

    function rebase(
        uint256 epoch,
        uint256 indexDelta,
        bool positive
    ) external returns (uint256);

    function _setRebaser(address rebaser_) external;

    function _setIncentivizer(address incentivizer_) external;

    function _setPendingGov(address pendingGov_) external;

    function _acceptGov() external;
}

contract YUANGovernanceToken is YUANTokenInterface {
    /// @notice An event thats emitted when an account changes its delegate
    event DelegateChanged(
        address indexed delegator,
        address indexed fromDelegate,
        address indexed toDelegate
    );

    /// @notice An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(
        address indexed delegate,
        uint256 previousBalance,
        uint256 newBalance
    );

    /**
     * @notice Get delegatee for an address delegating
     * @param delegator The address to get delegatee for
     */
    function delegates(address delegator) external view returns (address) {
        return _delegates[delegator];
    }

    /**
     * @notice Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) external {
        return _delegate(msg.sender, delegatee);
    }

    /**
     * @notice Delegates votes from signatory to `delegatee`
     * @param delegatee The address to delegate votes to
     * @param nonce The contract state required to match the signature
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        bytes32 structHash = keccak256(
            abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)
        );

        bytes32 digest = keccak256(
            abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, structHash)
        );

        address signatory = ecrecover(digest, v, r, s);
        require(
            signatory != address(0),
            "YUAN::delegateBySig: invalid signature"
        );
        require(
            nonce == nonces[signatory]++,
            "YUAN::delegateBySig: invalid nonce"
        );
        require(now <= expiry, "YUAN::delegateBySig: signature expired");
        return _delegate(signatory, delegatee);
    }

    /**
     * @notice Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getCurrentVotes(address account) external view returns (uint256) {
        uint32 nCheckpoints = numCheckpoints[account];
        return
            nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

    /**
     * @notice Determine the prior number of votes for an account as of a block number
     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
     * @param account The address of the account to check
     * @param blockNumber The block number to get the vote balance at
     * @return The number of votes the account had as of the given block
     */
    function getPriorVotes(address account, uint256 blockNumber)
        external
        view
        returns (uint256)
    {
        require(
            blockNumber < block.number,
            "YUAN::getPriorVotes: not yet determined"
        );

        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
            return checkpoints[account][nCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) {
            return 0;
        }

        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }

    function _delegate(address delegator, address delegatee) internal {
        address currentDelegate = _delegates[delegator];
        uint256 delegatorBalance = _yuanBalances[delegator]; // balance of underlying YUANs (not scaled);
        _delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveDelegates(
        address srcRep,
        address dstRep,
        uint256 amount
    ) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                // decrease old representative
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint256 srcRepOld = srcRepNum > 0
                    ? checkpoints[srcRep][srcRepNum - 1].votes
                    : 0;
                uint256 srcRepNew = srcRepOld.sub(amount);
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                // increase new representative
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint256 dstRepOld = dstRepNum > 0
                    ? checkpoints[dstRep][dstRepNum - 1].votes
                    : 0;
                uint256 dstRepNew = dstRepOld.add(amount);
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

    function _writeCheckpoint(
        address delegatee,
        uint32 nCheckpoints,
        uint256 oldVotes,
        uint256 newVotes
    ) internal {
        uint32 blockNumber = safe32(
            block.number,
            "YUAN::_writeCheckpoint: block number exceeds 32 bits"
        );

        if (
            nCheckpoints > 0 &&
            checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber
        ) {
            checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
        } else {
            checkpoints[delegatee][nCheckpoints] = Checkpoint(
                blockNumber,
                newVotes
            );
            numCheckpoints[delegatee] = nCheckpoints + 1;
        }

        emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

    function safe32(uint256 n, string memory errorMessage)
        internal
        pure
        returns (uint32)
    {
        require(n < 2**32, errorMessage);
        return uint32(n);
    }

    function getChainId() internal pure returns (uint256) {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        return chainId;
    }
}

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
}

/**
 * @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 subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    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 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) {
        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;
    }
}

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(
            address(this).balance >= amount,
            "Address: insufficient balance"
        );

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call.value(amount)("");
        require(
            success,
            "Address: unable to send value, recipient may have reverted"
        );
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data)
        internal
        returns (bytes memory)
    {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return
            functionCallWithValue(
                target,
                data,
                value,
                "Address: low-level call with value failed"
            );
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(
            address(this).balance >= value,
            "Address: insufficient balance for call"
        );
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(
        address target,
        bytes memory data,
        uint256 weiValue,
        string memory errorMessage
    ) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call.value(weiValue)(
            data
        );
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transfer.selector, to, value)
        );
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
        );
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, value)
        );
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(
            value
        );
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(
            value,
            "SafeERC20: decreased allowance below zero"
        );
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(
            data,
            "SafeERC20: low-level call failed"
        );
        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: ERC20 operation did not succeed"
            );
        }
    }
}

contract YUANToken is YUANGovernanceToken {
    // Modifiers
    modifier onlyGov() {
        require(msg.sender == gov);
        _;
    }

    modifier onlyRebaser() {
        require(msg.sender == rebaser);
        _;
    }

    modifier onlyMinter() {
        require(
            msg.sender == rebaser ||
                msg.sender == gov ||
                msg.sender == incentivizer ||
                msg.sender == migrator,
            "not minter"
        );
        _;
    }

    modifier validRecipient(address to) {
        require(to != address(0x0));
        require(to != address(this));
        _;
    }

    function initialize(
        string memory name_,
        string memory symbol_,
        uint8 decimals_
    ) public {
        require(yuansScalingFactor == 0, "already initialized");
        name = name_;
        symbol = symbol_;
        decimals = decimals_;
    }

    /**
     * @notice Computes the current max scaling factor
     */
    function maxScalingFactor() external view returns (uint256) {
        return _maxScalingFactor();
    }

    function _maxScalingFactor() internal view returns (uint256) {
        // scaling factor can only go up to 2**256-1 = initSupply * yuansScalingFactor
        // this is used to check if yuansScalingFactor will be too high to compute balances when rebasing.
        return uint256(-1) / initSupply;
    }

    /**
     * @notice Mints new tokens, increasing totalSupply, initSupply, and a users balance.
     * @dev Limited to onlyMinter modifier
     */
    function mint(address to, uint256 amount)
        external
        onlyMinter
        returns (bool)
    {
        _mint(to, amount);
        return true;
    }

    function _mint(address to, uint256 amount) internal {
        if (msg.sender == migrator) {
            // migrator directly uses v2 balance for the amount

            // increase initSupply
            initSupply = initSupply.add(amount);

            // get external value
            uint256 scaledAmount = _yuanToFragment(amount);

            // increase totalSupply
            totalSupply = totalSupply.add(scaledAmount);

            // make sure the mint didnt push maxScalingFactor too low
            require(
                yuansScalingFactor <= _maxScalingFactor(),
                "max scaling factor too low"
            );

            // add balance
            _yuanBalances[to] = _yuanBalances[to].add(amount);

            // add delegates to the minter
            _moveDelegates(address(0), _delegates[to], amount);
            emit Mint(to, scaledAmount);
            emit Transfer(address(0), to, scaledAmount);
        } else {
            // increase totalSupply
            totalSupply = totalSupply.add(amount);

            // get underlying value
            uint256 yuanValue = _fragmentToYuan(amount);

            // increase initSupply
            initSupply = initSupply.add(yuanValue);

            // make sure the mint didnt push maxScalingFactor too low
            require(
                yuansScalingFactor <= _maxScalingFactor(),
                "max scaling factor too low"
            );

            // add balance
            _yuanBalances[to] = _yuanBalances[to].add(yuanValue);

            // add delegates to the minter
            _moveDelegates(address(0), _delegates[to], yuanValue);
            emit Mint(to, amount);
            emit Transfer(address(0), to, amount);
        }
    }

    /* - ERC20 functionality - */

    /**
     * @dev Transfer tokens to a specified address.
     * @param to The address to transfer to.
     * @param value The amount to be transferred.
     * @return True on success, false otherwise.
     */
    function transfer(address to, uint256 value)
        external
        validRecipient(to)
        returns (bool)
    {
        // underlying balance is stored in yuans, so divide by current scaling factor

        // note, this means as scaling factor grows, dust will be untransferrable.
        // minimum transfer value == yuansScalingFactor / 1e24;

        // get amount in underlying
        uint256 yuanValue = _fragmentToYuan(value);

        // sub from balance of sender
        _yuanBalances[msg.sender] = _yuanBalances[msg.sender].sub(yuanValue);

        // add to balance of receiver
        _yuanBalances[to] = _yuanBalances[to].add(yuanValue);
        emit Transfer(msg.sender, to, value);

        _moveDelegates(_delegates[msg.sender], _delegates[to], yuanValue);
        return true;
    }

    /**
     * @dev Transfer tokens from one address to another.
     * @param from The address you want to send tokens from.
     * @param to The address you want to transfer to.
     * @param value The amount of tokens to be transferred.
     */
    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external validRecipient(to) returns (bool) {
        // decrease allowance
        _allowedFragments[from][msg.sender] = _allowedFragments[from][msg
            .sender]
            .sub(value);

        // get value in yuans
        uint256 yuanValue = _fragmentToYuan(value);

        // sub from from
        _yuanBalances[from] = _yuanBalances[from].sub(yuanValue);
        _yuanBalances[to] = _yuanBalances[to].add(yuanValue);
        emit Transfer(from, to, value);

        _moveDelegates(_delegates[from], _delegates[to], yuanValue);
        return true;
    }

    /**
     * @param who The address to query.
     * @return The balance of the specified address.
     */
    function balanceOf(address who) external view returns (uint256) {
        return _yuanToFragment(_yuanBalances[who]);
    }

    /** @notice Currently returns the internal storage amount
     * @param who The address to query.
     * @return The underlying balance of the specified address.
     */
    function balanceOfUnderlying(address who) external view returns (uint256) {
        return _yuanBalances[who];
    }

    /**
     * @dev Function to check the amount of tokens that an owner has allowed to a spender.
     * @param owner_ The address which owns the funds.
     * @param spender The address which will spend the funds.
     * @return The number of tokens still available for the spender.
     */
    function allowance(address owner_, address spender)
        external
        view
        returns (uint256)
    {
        return _allowedFragments[owner_][spender];
    }

    /**
     * @dev Approve the passed address to spend the specified amount of tokens on behalf of
     * msg.sender. This method is included for ERC20 compatibility.
     * increaseAllowance and decreaseAllowance should be used instead.
     * Changing an allowance with this method brings the risk that someone may transfer both
     * the old and the new allowance - if they are both greater than zero - if a transfer
     * transaction is mined before the later approve() call is mined.
     *
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     */
    function approve(address spender, uint256 value) external returns (bool) {
        _allowedFragments[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    /**
     * @dev Increase the amount of tokens that an owner has allowed to a spender.
     * This method should be used instead of approve() to avoid the double approval vulnerability
     * described above.
     * @param spender The address which will spend the funds.
     * @param addedValue The amount of tokens to increase the allowance by.
     */
    function increaseAllowance(address spender, uint256 addedValue)
        external
        returns (bool)
    {
        _allowedFragments[msg.sender][spender] = _allowedFragments[msg
            .sender][spender]
            .add(addedValue);
        emit Approval(
            msg.sender,
            spender,
            _allowedFragments[msg.sender][spender]
        );
        return true;
    }

    /**
     * @dev Decrease the amount of tokens that an owner has allowed to a spender.
     *
     * @param spender The address which will spend the funds.
     * @param subtractedValue The amount of tokens to decrease the allowance by.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue)
        external
        returns (bool)
    {
        uint256 oldValue = _allowedFragments[msg.sender][spender];
        if (subtractedValue >= oldValue) {
            _allowedFragments[msg.sender][spender] = 0;
        } else {
            _allowedFragments[msg.sender][spender] = oldValue.sub(
                subtractedValue
            );
        }
        emit Approval(
            msg.sender,
            spender,
            _allowedFragments[msg.sender][spender]
        );
        return true;
    }

    // --- Approve by signature ---
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        require(now <= deadline, "YUAN/permit-expired");

        bytes32 digest = keccak256(
            abi.encodePacked(
                "\x19\x01",
                DOMAIN_SEPARATOR,
                keccak256(
                    abi.encode(
                        PERMIT_TYPEHASH,
                        owner,
                        spender,
                        value,
                        nonces[owner]++,
                        deadline
                    )
                )
            )
        );

        require(owner != address(0), "YUAN/invalid-address-0");
        require(owner == ecrecover(digest, v, r, s), "YUAN/invalid-permit");
        _allowedFragments[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    /* - Governance Functions - */

    /** @notice sets the rebaser
     * @param rebaser_ The address of the rebaser contract to use for authentication.
     */
    function _setRebaser(address rebaser_) external onlyGov {
        address oldRebaser = rebaser;
        rebaser = rebaser_;
        emit NewRebaser(oldRebaser, rebaser_);
    }

    /** @notice sets the migrator
     * @param migrator_ The address of the migrator contract to use for authentication.
     */
    function _setMigrator(address migrator_) external onlyGov {
        address oldMigrator = migrator_;
        migrator = migrator_;
        emit NewMigrator(oldMigrator, migrator_);
    }

    /** @notice sets the incentivizer
     * @param incentivizer_ The address of the rebaser contract to use for authentication.
     */
    function _setIncentivizer(address incentivizer_) external onlyGov {
        address oldIncentivizer = incentivizer;
        incentivizer = incentivizer_;
        emit NewIncentivizer(oldIncentivizer, incentivizer_);
    }

    /** @notice sets the pendingGov
     * @param pendingGov_ The address of the rebaser contract to use for authentication.
     */
    function _setPendingGov(address pendingGov_) external onlyGov {
        address oldPendingGov = pendingGov;
        pendingGov = pendingGov_;
        emit NewPendingGov(oldPendingGov, pendingGov_);
    }

    /** @notice lets msg.sender accept governance
     *
     */
    function _acceptGov() external {
        require(msg.sender == pendingGov, "!pending");
        address oldGov = gov;
        gov = pendingGov;
        pendingGov = address(0);
        emit NewGov(oldGov, gov);
    }

    /* - Extras - */

    /**
     * @notice Initiates a new rebase operation, provided the minimum time period has elapsed.
     *
     * @dev The supply adjustment equals (totalSupply * DeviationFromTargetRate) / rebaseLag
     *      Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate
     *      and targetRate is CpiOracleRate / baseCpi
     */
    function rebase(
        uint256 epoch,
        uint256 indexDelta,
        bool positive
    ) external onlyRebaser returns (uint256) {
        // no change
        if (indexDelta == 0) {
            emit Rebase(epoch, yuansScalingFactor, yuansScalingFactor);
            return totalSupply;
        }

        // for events
        uint256 prevYuansScalingFactor = yuansScalingFactor;

        if (!positive) {
            // negative rebase, decrease scaling factor
            yuansScalingFactor = yuansScalingFactor
                .mul(BASE.sub(indexDelta))
                .div(BASE);
        } else {
            // positive reabse, increase scaling factor
            uint256 newScalingFactor = yuansScalingFactor
                .mul(BASE.add(indexDelta))
                .div(BASE);
            if (newScalingFactor < _maxScalingFactor()) {
                yuansScalingFactor = newScalingFactor;
            } else {
                yuansScalingFactor = _maxScalingFactor();
            }
        }

        // update total supply, correctly
        totalSupply = _yuanToFragment(initSupply);

        emit Rebase(epoch, prevYuansScalingFactor, yuansScalingFactor);
        return totalSupply;
    }

    function yuanToFragment(uint256 yuan) external view returns (uint256) {
        return _yuanToFragment(yuan);
    }

    function fragmentToYuan(uint256 value) external view returns (uint256) {
        return _fragmentToYuan(value);
    }

    function _yuanToFragment(uint256 yuan) internal view returns (uint256) {
        return yuan.mul(yuansScalingFactor).div(internalDecimals);
    }

    function _fragmentToYuan(uint256 value) internal view returns (uint256) {
        return value.mul(internalDecimals).div(yuansScalingFactor);
    }

    // Rescue tokens
    function rescueTokens(
        address token,
        address to,
        uint256 amount
    ) external onlyGov returns (bool) {
        // transfer to
        SafeERC20.safeTransfer(IERC20(token), to, amount);
        return true;
    }
}

contract YUAN is YUANToken {
    /**
     * @notice Initialize the new money market
     * @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(
        string memory name_,
        string memory symbol_,
        uint8 decimals_,
        address initial_owner,
        uint256 initTotalSupply_
    ) public {
        super.initialize(name_, symbol_, decimals_);

        yuansScalingFactor = BASE;
        initSupply = _fragmentToYuan(initTotalSupply_);
        totalSupply = initTotalSupply_;
        _yuanBalances[initial_owner] = initSupply;

        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                DOMAIN_TYPEHASH,
                keccak256(bytes(name)),
                getChainId(),
                address(this)
            )
        );
    }
}

contract YUANDelegationStorage {
    /**
     * @notice Implementation address for this contract
     */
    address public implementation;
}

contract YUANDelegatorInterface is YUANDelegationStorage {
    /**
     * @notice Emitted when implementation is changed
     */
    event NewImplementation(
        address oldImplementation,
        address newImplementation
    );

    /**
     * @notice Called by the gov 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 YUANDelegateInterface is YUANDelegationStorage {
    /**
     * @notice Called by the delegator on a delegate to initialize it for duty
     * @dev Should revert if any issues arise which make it unfit for delegation
     * @param data The encoded bytes data for any initialization
     */
    function _becomeImplementation(bytes memory data) public;

    /**
     * @notice Called by the delegator on a delegate to forfeit its responsibility
     */
    function _resignImplementation() public;
}

contract YUANDelegate is YUAN, YUANDelegateInterface {
    /**
     * @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(
            msg.sender == gov,
            "only the gov 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(
            msg.sender == gov,
            "only the gov may call _resignImplementation"
        );
    }
}

contract YUANDelegator is YUANTokenInterface, YUANDelegatorInterface {
    /**
     * @notice Construct a new YUAN
     * @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 initTotalSupply_ Initial token amount
     * @param implementation_ The address of the implementation the contract delegates to
     * @param becomeImplementationData The encoded args for becomeImplementation
     */
    constructor(
        string memory name_,
        string memory symbol_,
        uint8 decimals_,
        uint256 initTotalSupply_,
        address implementation_,
        bytes memory becomeImplementationData
    ) public {
        // Creator of the contract is gov during initialization
        gov = msg.sender;

        // First delegate gets to initialize the delegator (i.e. storage contract)
        delegateTo(
            implementation_,
            abi.encodeWithSignature(
                "initialize(string,string,uint8,address,uint256)",
                name_,
                symbol_,
                decimals_,
                msg.sender,
                initTotalSupply_
            )
        );

        // New implementations always get set via the settor (post-initialize)
        _setImplementation(implementation_, false, becomeImplementationData);
    }

    /**
     * @notice Called by the gov 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(
            msg.sender == gov,
            "YUANDelegator::_setImplementation: Caller must be gov"
        );

        if (allowResign) {
            delegateToImplementation(
                abi.encodeWithSignature("_resignImplementation()")
            );
        }

        address oldImplementation = implementation;
        implementation = implementation_;

        delegateToImplementation(
            abi.encodeWithSignature(
                "_becomeImplementation(bytes)",
                becomeImplementationData
            )
        );

        emit NewImplementation(oldImplementation, implementation);
    }

    /**
     * @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(address to, uint256 mintAmount) external returns (bool) {
        to;
        mintAmount; // Shh
        delegateAndReturn();
    }

    /**
     * @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) {
        dst;
        amount; // Shh
        delegateAndReturn();
    }

    /**
     * @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) {
        src;
        dst;
        amount; // Shh
        delegateAndReturn();
    }

    /**
     * @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) {
        spender;
        amount; // Shh
        delegateAndReturn();
    }

    /**
     * @dev Increase the amount of tokens that an owner has allowed to a spender.
     * This method should be used instead of approve() to avoid the double approval vulnerability
     * described above.
     * @param spender The address which will spend the funds.
     * @param addedValue The amount of tokens to increase the allowance by.
     */
    function increaseAllowance(address spender, uint256 addedValue)
        external
        returns (bool)
    {
        spender;
        addedValue; // Shh
        delegateAndReturn();
    }

    function maxScalingFactor() external view returns (uint256) {
        delegateToViewAndReturn();
    }

    function rebase(
        uint256 epoch,
        uint256 indexDelta,
        bool positive
    ) external returns (uint256) {
        epoch;
        indexDelta;
        positive;
        delegateAndReturn();
    }

    /**
     * @dev Decrease the amount of tokens that an owner has allowed to a spender.
     *
     * @param spender The address which will spend the funds.
     * @param subtractedValue The amount of tokens to decrease the allowance by.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue)
        external
        returns (bool)
    {
        spender;
        subtractedValue; // Shh
        delegateAndReturn();
    }

    // --- Approve by signature ---
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        owner;
        spender;
        value;
        deadline;
        v;
        r;
        s; // Shh
        delegateAndReturn();
    }

    /**
     * @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)
    {
        owner;
        spender; // Shh
        delegateToViewAndReturn();
    }

    /**
     * @notice Rescues tokens and sends them to the `to` address
     * @param token The address of the token
     * @param to The address for which the tokens should be send
     * @return Success
     */
    function rescueTokens(
        address token,
        address to,
        uint256 amount
    ) external returns (bool) {
        token;
        to;
        amount; // Shh
        delegateAndReturn();
    }

    /**
     * @notice Get the current allowance from `owner` for `spender`
     * @param delegator The address of the account which has designated a delegate
     * @return Address of delegatee
     */
    function delegates(address delegator) external view returns (address) {
        delegator; // Shh
        delegateToViewAndReturn();
    }

    /**
     * @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) {
        owner; // Shh
        delegateToViewAndReturn();
    }

    /**
     * @notice Currently unused. For future compatability
     * @param owner The address of the account to query
     * @return The number of underlying tokens owned by `owner`
     */
    function balanceOfUnderlying(address owner)
        external
        view
        returns (uint256)
    {
        owner; // Shh
        delegateToViewAndReturn();
    }

    /*** Gov Functions ***/

    /**
     * @notice Begins transfer of gov rights. The newPendingGov must call `_acceptGov` to finalize the transfer.
     * @dev Gov function to begin change of gov. The newPendingGov must call `_acceptGov` to finalize the transfer.
     * @param newPendingGov New pending gov.
     */
    function _setPendingGov(address newPendingGov) external {
        newPendingGov; // Shh
        delegateAndReturn();
    }

    function _setRebaser(address rebaser_) external {
        rebaser_; // Shh
        delegateAndReturn();
    }

    function _setIncentivizer(address incentivizer_) external {
        incentivizer_; // Shh
        delegateAndReturn();
    }

    function _setMigrator(address migrator_) external {
        migrator_; // Shh
        delegateAndReturn();
    }

    /**
     * @notice Accepts transfer of gov rights. msg.sender must be pendingGov
     * @dev Gov function for pending gov to accept role and update gov
     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
     */
    function _acceptGov() external {
        delegateAndReturn();
    }

    function getPriorVotes(address account, uint256 blockNumber)
        external
        view
        returns (uint256)
    {
        account;
        blockNumber;
        delegateToViewAndReturn();
    }

    function delegateBySig(
        address delegatee,
        uint256 nonce,
        uint256 expiry,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        delegatee;
        nonce;
        expiry;
        v;
        r;
        s;
        delegateAndReturn();
    }

    function delegate(address delegatee) external {
        delegatee;
        delegateAndReturn();
    }

    function getCurrentVotes(address account) external view returns (uint256) {
        account;
        delegateToViewAndReturn();
    }

    function yuanToFragment(uint256 yuan) external view returns (uint256) {
        yuan;
        delegateToViewAndReturn();
    }

    function fragmentToYuan(uint256 value) external view returns (uint256) {
        value;
        delegateToViewAndReturn();
    }

    /**
     * @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
     *  There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.
     * @param data The raw data to delegatecall
     * @return The returned bytes from the delegatecall
     */
    function delegateToViewImplementation(bytes memory data)
        public
        view
        returns (bytes memory)
    {
        (bool success, bytes memory returnData) = address(this).staticcall(
            abi.encodeWithSignature("delegateToImplementation(bytes)", data)
        );
        assembly {
            if eq(success, 0) {
                revert(add(returnData, 0x20), returndatasize)
            }
        }
        return abi.decode(returnData, (bytes));
    }

    function delegateToViewAndReturn() private view returns (bytes memory) {
        (bool success, ) = address(this).staticcall(
            abi.encodeWithSignature("delegateToImplementation(bytes)", 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(add(free_mem_ptr, 0x40), sub(returndatasize, 0x40))
                }
        }
    }

    function delegateAndReturn() private returns (bytes memory) {
        (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)
                }
        }
    }

    /**
     * @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,
            "YUANDelegator:fallback: cannot send value to fallback"
        );

        // delegate all other functions to current implementation
        delegateAndReturn();
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"uint256","name":"initTotalSupply_","type":"uint256"},{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"bytes","name":"becomeImplementationData","type":"bytes"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"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":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":true,"internalType":"address","name":"fromDelegate","type":"address"},{"indexed":true,"internalType":"address","name":"toDelegate","type":"address"}],"name":"DelegateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldGov","type":"address"},{"indexed":false,"internalType":"address","name":"newGov","type":"address"}],"name":"NewGov","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldImplementation","type":"address"},{"indexed":false,"internalType":"address","name":"newImplementation","type":"address"}],"name":"NewImplementation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldIncentivizer","type":"address"},{"indexed":false,"internalType":"address","name":"newIncentivizer","type":"address"}],"name":"NewIncentivizer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldMigrator","type":"address"},{"indexed":false,"internalType":"address","name":"newMigrator","type":"address"}],"name":"NewMigrator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPendingGov","type":"address"},{"indexed":false,"internalType":"address","name":"newPendingGov","type":"address"}],"name":"NewPendingGov","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRebaser","type":"address"},{"indexed":false,"internalType":"address","name":"newRebaser","type":"address"}],"name":"NewRebaser","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"prevYuansScalingFactor","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newYuansScalingFactor","type":"uint256"}],"name":"Rebase","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"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DELEGATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"_acceptGov","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"bool","name":"allowResign","type":"bool"},{"internalType":"bytes","name":"becomeImplementationData","type":"bytes"}],"name":"_setImplementation","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"incentivizer_","type":"address"}],"name":"_setIncentivizer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"migrator_","type":"address"}],"name":"_setMigrator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newPendingGov","type":"address"}],"name":"_setPendingGov","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"rebaser_","type":"address"}],"name":"_setRebaser","outputs":[],"payable":false,"stateMutability":"nonpayable","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":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOfUnderlying","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpoints","outputs":[{"internalType":"uint32","name":"fromBlock","type":"uint32"},{"internalType":"uint256","name":"votes","type":"uint256"}],"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":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"delegatee","type":"address"}],"name":"delegate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"delegateBySig","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"delegateToImplementation","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"delegateToViewImplementation","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"fragmentToYuan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCurrentVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPriorVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"incentivizer","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"internalDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxScalingFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"migrator","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingGov","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"indexDelta","type":"uint256"},{"internalType":"bool","name":"positive","type":"bool"}],"name":"rebase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rebaser","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"uint256","name":"yuan","type":"uint256"}],"name":"yuanToFragment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"yuansScalingFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b5060405162001c0238038062001c02833981810160405260c08110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200010a57600080fd5b9083019060208201858111156200012057600080fd5b82516401000000008111828201881017156200013b57600080fd5b82525081516020918201929091019080838360005b838110156200016a57818101518382015260200162000150565b50505050905090810190601f168015620001985780820380516001836020036101000a031916815260200191505b50604081815260208301519083015160608401516080909401805192969195919284640100000000821115620001cd57600080fd5b908301906020820185811115620001e357600080fd5b8251640100000000811182820188101715620001fe57600080fd5b82525081516020918201929091019080838360005b838110156200022d57818101518382015260200162000213565b50505050905090810190601f1680156200025b5780820380516001836020036101000a031916815260200191505b5060405250505033600360016101000a8154816001600160a01b0302191690836001600160a01b03160217905550620003d48287878733886040516024018080602001806020018660ff1660ff168152602001856001600160a01b03166001600160a01b03168152602001848152602001838103835288818151815260200191508051906020019080838360005b8381101562000303578181015183820152602001620002e9565b50505050905090810190601f168015620003315780820380516001836020036101000a031916815260200191505b50838103825287518152875160209182019189019080838360005b83811015620003665781810151838201526020016200034c565b50505050905090810190601f168015620003945780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03908116636c94522160e01b17909152909850620003f8169650505050505050565b50620003ec826000836001600160e01b03620004bf16565b505050505050620006a0565b606060006060846001600160a01b0316846040518082805190602001908083835b602083106200043a5780518252601f19909201916020918201910162000419565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146200049c576040519150601f19603f3d011682016040523d82523d6000602084013e620004a1565b606091505b50915091506000821415620004b7573d60208201fd5b949350505050565b60035461010090046001600160a01b031633146200050f5760405162461bcd60e51b815260040180806020018281038252603581526020018062001bcd6035913960400191505060405180910390fd5b811562000551576040805160048152602481019091526020810180516001600160e01b0390811663153ab50560e01b179091526200054f91906200067616565b505b601280546001600160a01b038581166001600160a01b0319831617909255604051602060248201818152855160448401528551949093169362000627938693909283926064909201919085019080838360005b83811015620005be578181015183820152602001620005a4565b50505050905090810190601f168015620005ec5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03908116630adccee560e31b179091529093506200067616915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b6012546060906200069a906001600160a01b0316836001600160e01b03620003f816565b92915050565b61151d80620006b06000396000f3fe6080604052600436106102ae5760003560e01c80636fc6407c11610175578063a9059cbb116100dc578063dd62ed3e11610095578063e9299f401161006f578063e9299f4014610a75578063ec342ad014610a8a578063f1127ed814610a9f578063fa8f3455146106a6576102ae565b8063dd62ed3e14610a25578063e18120cc14610949578063e7a324dc14610a60576102ae565b8063a9059cbb14610431578063b4b5ea57146105c2578063bb4490a714610949578063c3cda52014610973578063cea9d26f14610515578063d505accf146109c7576102ae565b80637cd07e471161012e5780637cd07e47146108d75780637ecebe00146108ec57806395d89b411461091f57806397d63f931461093457806398dca210146106a6578063a457c2d714610431576102ae565b80636fc6407c146108055780636fcfff451461081a57806370a08231146105c257806373f03dff146106a6578063782d6fe1146108665780637af548c11461089f576102ae565b80633644e515116102195780634bda2e20116101d25780634bda2e20146106db578063555bcc40146106f0578063587cde1e146107b85780635c19a95c146106a65780635c60da1b146107db57806364dd48f5146107f0576102ae565b80633644e515146105ad57806339509351146104315780633af9e669146105c257806340c10f19146104315780634487152f146105f557806347dfe70d146106a6576102ae565b806318160ddd1161026b57806318160ddd146104eb57806320606b701461050057806323b872dd14610515578063252408101461055857806330adf81f1461056d578063313ce56714610582576102ae565b806306fdde03146102f65780630933c1ed14610380578063095ea7b31461043157806311d3e6c41461047e57806311fd8a83146104a557806312d43a51146104d6575b34156102eb5760405162461bcd60e51b815260040180806020018281038252603581526020018061147a6035913960400191505060405180910390fd5b6102f3610afe565b50005b34801561030257600080fd5b5061030b610b86565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561034557818101518382015260200161032d565b50505050905090810190601f1680156103725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038c57600080fd5b5061030b600480360360208110156103a357600080fd5b810190602081018135600160201b8111156103bd57600080fd5b8201836020820111156103cf57600080fd5b803590602001918460018302840111600160201b831117156103f057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610c13945050505050565b34801561043d57600080fd5b5061046a6004803603604081101561045457600080fd5b506001600160a01b038135169060200135610c32565b604080519115158252519081900360200190f35b34801561048a57600080fd5b50610493610c43565b60408051918252519081900360200190f35b3480156104b157600080fd5b506104ba610c51565b604080516001600160a01b039092168252519081900360200190f35b3480156104e257600080fd5b506104ba610c60565b3480156104f757600080fd5b50610493610c74565b34801561050c57600080fd5b50610493610c7a565b34801561052157600080fd5b5061046a6004803603606081101561053857600080fd5b506001600160a01b03813581169160208101359091169060400135610c95565b34801561056457600080fd5b506104ba610ca7565b34801561057957600080fd5b50610493610cb6565b34801561058e57600080fd5b50610597610cda565b6040805160ff9092168252519081900360200190f35b3480156105b957600080fd5b50610493610ce3565b3480156105ce57600080fd5b50610493600480360360208110156105e557600080fd5b50356001600160a01b0316610ce9565b34801561060157600080fd5b5061030b6004803603602081101561061857600080fd5b810190602081018135600160201b81111561063257600080fd5b82018360208201111561064457600080fd5b803590602001918460018302840111600160201b8311171561066557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610cf9945050505050565b3480156106b257600080fd5b506106d9600480360360208110156106c957600080fd5b50356001600160a01b0316610f18565b005b3480156106e757600080fd5b506106d9610f24565b3480156106fc57600080fd5b506106d96004803603606081101561071357600080fd5b6001600160a01b03823516916020810135151591810190606081016040820135600160201b81111561074457600080fd5b82018360208201111561075657600080fd5b803590602001918460018302840111600160201b8311171561077757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610f2f945050505050565b3480156107c457600080fd5b506104ba600480360360208110156105e557600080fd5b3480156107e757600080fd5b506104ba6110d2565b3480156107fc57600080fd5b506104936110e1565b34801561081157600080fd5b506104ba6110ef565b34801561082657600080fd5b5061084d6004803603602081101561083d57600080fd5b50356001600160a01b03166110fe565b6040805163ffffffff9092168252519081900360200190f35b34801561087257600080fd5b506104936004803603604081101561088957600080fd5b506001600160a01b038135169060200135611116565b3480156108ab57600080fd5b50610493600480360360608110156108c257600080fd5b50803590602081013590604001351515610c95565b3480156108e357600080fd5b506104ba611120565b3480156108f857600080fd5b506104936004803603602081101561090f57600080fd5b50356001600160a01b031661112f565b34801561092b57600080fd5b5061030b611141565b34801561094057600080fd5b50610493611199565b34801561095557600080fd5b506104936004803603602081101561096c57600080fd5b5035610ce9565b34801561097f57600080fd5b506106d9600480360360c081101561099657600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a0013561119f565b3480156109d357600080fd5b506106d9600480360360e08110156109ea57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356111b0565b348015610a3157600080fd5b5061049360048036036040811015610a4857600080fd5b506001600160a01b0381358116916020013516611116565b348015610a6c57600080fd5b506104936111c2565b348015610a8157600080fd5b506104936111dd565b348015610a9657600080fd5b506104936111e3565b348015610aab57600080fd5b50610ade60048036036040811015610ac257600080fd5b5080356001600160a01b0316906020013563ffffffff166111ef565b6040805163ffffffff909316835260208301919091528051918290030190f35b6012546040516060916000916001600160a01b0390911690829036908083838082843760405192019450600093509091505080830381855af49150503d8060008114610b66576040519150601f19603f3d011682016040523d82523d6000602084013e610b6b565b606091505b505090506040513d6000823e818015610b82573d82f35b3d82fd5b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c0b5780601f10610be057610100808354040283529160200191610c0b565b820191906000526020600020905b815481529060010190602001808311610bee57829003601f168201915b505050505081565b601254606090610c2c906001600160a01b03168361121c565b92915050565b6000610c3c610afe565b5092915050565b6000610c4d6112de565b5090565b6005546001600160a01b031681565b60035461010090046001600160a01b031681565b60085481565b60405180604361140282396043019050604051809103902081565b6000610c9f610afe565b509392505050565b6004546001600160a01b031681565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60035460ff1681565b600d5481565b6000610cf36112de565b50919050565b606060006060306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b83811015610d4a578181015183820152602001610d32565b50505050905090810190601f168015610d775780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b60208310610dd25780518252601f199092019160209182019101610db3565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610e32576040519150601f19603f3d011682016040523d82523d6000602084013e610e37565b606091505b50915091506000821415610e4c573d60208201fd5b808060200190516020811015610e6157600080fd5b8101908080516040519392919084600160201b821115610e8057600080fd5b908301906020820185811115610e9557600080fd5b8251600160201b811182820188101715610eae57600080fd5b82525081516020918201929091019080838360005b83811015610edb578181015183820152602001610ec3565b50505050905090810190601f168015610f085780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b610f20610afe565b5050565b610f2c610afe565b50565b60035461010090046001600160a01b03163314610f7d5760405162461bcd60e51b81526004018080602001828103825260358152602001806114456035913960400191505060405180910390fd5b8115610fb7576040805160048152602481019091526020810180516001600160e01b031663153ab50560e01b179052610fb590610c13565b505b601280546001600160a01b038581166001600160a01b03198316179092556040516020602482018181528551604484015285519490931693611083938693909283926064909201919085019080838360005b83811015611021578181015183820152602001611009565b50505050905090810190601f16801561104e5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316630adccee560e31b1790529250610c13915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b6012546001600160a01b031681565b69d3c21bcecceda100000081565b6007546001600160a01b031681565b60106020526000908152604090205463ffffffff1681565b6000610c3c6112de565b6006546001600160a01b031681565b60116020526000908152604090205481565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610c0b5780601f10610be057610100808354040283529160200191610c0b565b600c5481565b6111a7610afe565b50505050505050565b6111b8610afe565b5050505050505050565b60405180603a6114af8239603a019050604051809103902081565b60095481565b670de0b6b3a764000081565b600f6020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b606060006060846001600160a01b0316846040518082805190602001908083835b6020831061125c5780518252601f19909201916020918201910161123d565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146112bc576040519150601f19603f3d011682016040523d82523d6000602084013e6112c1565b606091505b509150915060008214156112d6573d60208201fd5b949350505050565b60606000306001600160a01b03166000366040516024018080602001828103825284848281815260200192508082843760008382015260408051601f909201601f1990811690940182810390940182529283526020810180516001600160e01b0316630933c1ed60e01b17815292518151919750955085945091925081905083835b6020831061137f5780518252601f199092019160209182019101611360565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113df576040519150601f19603f3d011682016040523d82523d6000602084013e6113e4565b606091505b505090506040513d6000823e818015610b825760403d0360408301f3fe454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374295955414e44656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d75737420626520676f765955414e44656c656761746f723a66616c6c6261636b3a2063616e6e6f742073656e642076616c756520746f2066616c6c6261636b44656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e743235362065787069727929a265627a7a723158208a18d9af84bc7c87eba1c3a09b2b99ab00d2b479f53f578c0dba9e9b5cf926b864736f6c634300050f00325955414e44656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d75737420626520676f7600000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000001da56a4b0835bf800000000000000000000000000000080c1f0479b052bfa95109b5ef38bc343cf7fce31000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000045955414e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045955414e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106102ae5760003560e01c80636fc6407c11610175578063a9059cbb116100dc578063dd62ed3e11610095578063e9299f401161006f578063e9299f4014610a75578063ec342ad014610a8a578063f1127ed814610a9f578063fa8f3455146106a6576102ae565b8063dd62ed3e14610a25578063e18120cc14610949578063e7a324dc14610a60576102ae565b8063a9059cbb14610431578063b4b5ea57146105c2578063bb4490a714610949578063c3cda52014610973578063cea9d26f14610515578063d505accf146109c7576102ae565b80637cd07e471161012e5780637cd07e47146108d75780637ecebe00146108ec57806395d89b411461091f57806397d63f931461093457806398dca210146106a6578063a457c2d714610431576102ae565b80636fc6407c146108055780636fcfff451461081a57806370a08231146105c257806373f03dff146106a6578063782d6fe1146108665780637af548c11461089f576102ae565b80633644e515116102195780634bda2e20116101d25780634bda2e20146106db578063555bcc40146106f0578063587cde1e146107b85780635c19a95c146106a65780635c60da1b146107db57806364dd48f5146107f0576102ae565b80633644e515146105ad57806339509351146104315780633af9e669146105c257806340c10f19146104315780634487152f146105f557806347dfe70d146106a6576102ae565b806318160ddd1161026b57806318160ddd146104eb57806320606b701461050057806323b872dd14610515578063252408101461055857806330adf81f1461056d578063313ce56714610582576102ae565b806306fdde03146102f65780630933c1ed14610380578063095ea7b31461043157806311d3e6c41461047e57806311fd8a83146104a557806312d43a51146104d6575b34156102eb5760405162461bcd60e51b815260040180806020018281038252603581526020018061147a6035913960400191505060405180910390fd5b6102f3610afe565b50005b34801561030257600080fd5b5061030b610b86565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561034557818101518382015260200161032d565b50505050905090810190601f1680156103725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038c57600080fd5b5061030b600480360360208110156103a357600080fd5b810190602081018135600160201b8111156103bd57600080fd5b8201836020820111156103cf57600080fd5b803590602001918460018302840111600160201b831117156103f057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610c13945050505050565b34801561043d57600080fd5b5061046a6004803603604081101561045457600080fd5b506001600160a01b038135169060200135610c32565b604080519115158252519081900360200190f35b34801561048a57600080fd5b50610493610c43565b60408051918252519081900360200190f35b3480156104b157600080fd5b506104ba610c51565b604080516001600160a01b039092168252519081900360200190f35b3480156104e257600080fd5b506104ba610c60565b3480156104f757600080fd5b50610493610c74565b34801561050c57600080fd5b50610493610c7a565b34801561052157600080fd5b5061046a6004803603606081101561053857600080fd5b506001600160a01b03813581169160208101359091169060400135610c95565b34801561056457600080fd5b506104ba610ca7565b34801561057957600080fd5b50610493610cb6565b34801561058e57600080fd5b50610597610cda565b6040805160ff9092168252519081900360200190f35b3480156105b957600080fd5b50610493610ce3565b3480156105ce57600080fd5b50610493600480360360208110156105e557600080fd5b50356001600160a01b0316610ce9565b34801561060157600080fd5b5061030b6004803603602081101561061857600080fd5b810190602081018135600160201b81111561063257600080fd5b82018360208201111561064457600080fd5b803590602001918460018302840111600160201b8311171561066557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610cf9945050505050565b3480156106b257600080fd5b506106d9600480360360208110156106c957600080fd5b50356001600160a01b0316610f18565b005b3480156106e757600080fd5b506106d9610f24565b3480156106fc57600080fd5b506106d96004803603606081101561071357600080fd5b6001600160a01b03823516916020810135151591810190606081016040820135600160201b81111561074457600080fd5b82018360208201111561075657600080fd5b803590602001918460018302840111600160201b8311171561077757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610f2f945050505050565b3480156107c457600080fd5b506104ba600480360360208110156105e557600080fd5b3480156107e757600080fd5b506104ba6110d2565b3480156107fc57600080fd5b506104936110e1565b34801561081157600080fd5b506104ba6110ef565b34801561082657600080fd5b5061084d6004803603602081101561083d57600080fd5b50356001600160a01b03166110fe565b6040805163ffffffff9092168252519081900360200190f35b34801561087257600080fd5b506104936004803603604081101561088957600080fd5b506001600160a01b038135169060200135611116565b3480156108ab57600080fd5b50610493600480360360608110156108c257600080fd5b50803590602081013590604001351515610c95565b3480156108e357600080fd5b506104ba611120565b3480156108f857600080fd5b506104936004803603602081101561090f57600080fd5b50356001600160a01b031661112f565b34801561092b57600080fd5b5061030b611141565b34801561094057600080fd5b50610493611199565b34801561095557600080fd5b506104936004803603602081101561096c57600080fd5b5035610ce9565b34801561097f57600080fd5b506106d9600480360360c081101561099657600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a0013561119f565b3480156109d357600080fd5b506106d9600480360360e08110156109ea57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356111b0565b348015610a3157600080fd5b5061049360048036036040811015610a4857600080fd5b506001600160a01b0381358116916020013516611116565b348015610a6c57600080fd5b506104936111c2565b348015610a8157600080fd5b506104936111dd565b348015610a9657600080fd5b506104936111e3565b348015610aab57600080fd5b50610ade60048036036040811015610ac257600080fd5b5080356001600160a01b0316906020013563ffffffff166111ef565b6040805163ffffffff909316835260208301919091528051918290030190f35b6012546040516060916000916001600160a01b0390911690829036908083838082843760405192019450600093509091505080830381855af49150503d8060008114610b66576040519150601f19603f3d011682016040523d82523d6000602084013e610b6b565b606091505b505090506040513d6000823e818015610b82573d82f35b3d82fd5b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c0b5780601f10610be057610100808354040283529160200191610c0b565b820191906000526020600020905b815481529060010190602001808311610bee57829003601f168201915b505050505081565b601254606090610c2c906001600160a01b03168361121c565b92915050565b6000610c3c610afe565b5092915050565b6000610c4d6112de565b5090565b6005546001600160a01b031681565b60035461010090046001600160a01b031681565b60085481565b60405180604361140282396043019050604051809103902081565b6000610c9f610afe565b509392505050565b6004546001600160a01b031681565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60035460ff1681565b600d5481565b6000610cf36112de565b50919050565b606060006060306001600160a01b0316846040516024018080602001828103825283818151815260200191508051906020019080838360005b83811015610d4a578181015183820152602001610d32565b50505050905090810190601f168015610d775780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b0316630933c1ed60e01b178152905182519295509350839250908083835b60208310610dd25780518252601f199092019160209182019101610db3565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114610e32576040519150601f19603f3d011682016040523d82523d6000602084013e610e37565b606091505b50915091506000821415610e4c573d60208201fd5b808060200190516020811015610e6157600080fd5b8101908080516040519392919084600160201b821115610e8057600080fd5b908301906020820185811115610e9557600080fd5b8251600160201b811182820188101715610eae57600080fd5b82525081516020918201929091019080838360005b83811015610edb578181015183820152602001610ec3565b50505050905090810190601f168015610f085780820380516001836020036101000a031916815260200191505b5060405250505092505050919050565b610f20610afe565b5050565b610f2c610afe565b50565b60035461010090046001600160a01b03163314610f7d5760405162461bcd60e51b81526004018080602001828103825260358152602001806114456035913960400191505060405180910390fd5b8115610fb7576040805160048152602481019091526020810180516001600160e01b031663153ab50560e01b179052610fb590610c13565b505b601280546001600160a01b038581166001600160a01b03198316179092556040516020602482018181528551604484015285519490931693611083938693909283926064909201919085019080838360005b83811015611021578181015183820152602001611009565b50505050905090810190601f16801561104e5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316630adccee560e31b1790529250610c13915050565b50601254604080516001600160a01b038085168252909216602083015280517fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a9281900390910190a150505050565b6012546001600160a01b031681565b69d3c21bcecceda100000081565b6007546001600160a01b031681565b60106020526000908152604090205463ffffffff1681565b6000610c3c6112de565b6006546001600160a01b031681565b60116020526000908152604090205481565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610c0b5780601f10610be057610100808354040283529160200191610c0b565b600c5481565b6111a7610afe565b50505050505050565b6111b8610afe565b5050505050505050565b60405180603a6114af8239603a019050604051809103902081565b60095481565b670de0b6b3a764000081565b600f6020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b606060006060846001600160a01b0316846040518082805190602001908083835b6020831061125c5780518252601f19909201916020918201910161123d565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146112bc576040519150601f19603f3d011682016040523d82523d6000602084013e6112c1565b606091505b509150915060008214156112d6573d60208201fd5b949350505050565b60606000306001600160a01b03166000366040516024018080602001828103825284848281815260200192508082843760008382015260408051601f909201601f1990811690940182810390940182529283526020810180516001600160e01b0316630933c1ed60e01b17815292518151919750955085945091925081905083835b6020831061137f5780518252601f199092019160209182019101611360565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146113df576040519150601f19603f3d011682016040523d82523d6000602084013e6113e4565b606091505b505090506040513d6000823e818015610b825760403d0360408301f3fe454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374295955414e44656c656761746f723a3a5f736574496d706c656d656e746174696f6e3a2043616c6c6572206d75737420626520676f765955414e44656c656761746f723a66616c6c6261636b3a2063616e6e6f742073656e642076616c756520746f2066616c6c6261636b44656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e743235362065787069727929a265627a7a723158208a18d9af84bc7c87eba1c3a09b2b99ab00d2b479f53f578c0dba9e9b5cf926b864736f6c634300050f0032

Deployed Bytecode Sourcemap

52590:14435:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;66820:9;:14;66798:117;;;;-1:-1:-1;;;66798:117:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;66995:19;:17;:19::i;:::-;;52590:14435;2980:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2980:18:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;2980:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;64336:164;;8:9:-1;5:2;;;30:1;27;20:12;5:2;64336:164:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;64336:164:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;64336:164:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;64336:164: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;64336:164:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;64336:164:0;;-1:-1:-1;64336:164:0;;-1:-1:-1;;;;;64336:164:0:i;57130:154::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;57130:154:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;57130:154:0;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;57860:104;;8:9:-1;5:2;;;30:1;27;20:12;5:2;57860:104:0;;;:::i;:::-;;;;;;;;;;;;;;;;3468:22;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3468:22:0;;;:::i;:::-;;;;-1:-1:-1;;;;;3468:22:0;;;;;;;;;;;;;;3267:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3267:18:0;;;:::i;3765:26::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3765:26:0;;;:::i;2198:138::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2198:138:0;;;:::i;56448:212::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;56448:212:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;56448:212:0;;;;;;;;;;;;;;;;;:::i;3365:25::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3365:25:0;;;:::i;4451:117::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4451:117:0;;;:::i;3176:21::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3176:21:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;4575:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4575:31:0;;;:::i;60905:175::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;60905:175:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;60905:175:0;-1:-1:-1;;;;;60905:175:0;;:::i;64922:490::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;64922:490:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;64922:490:0;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;64922:490:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;64922:490: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;64922:490:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;64922:490:0;;-1:-1:-1;64922:490:0;;-1:-1:-1;;;;;64922:490:0:i;61802:115::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;61802:115:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;61802:115:0;-1:-1:-1;;;;;61802:115:0;;:::i;:::-;;62181:69;;8:9:-1;5:2;;;30:1;27;20:12;5:2;62181:69:0;;;:::i;54411:815::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;54411:815:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;54411:815:0;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;54411:815:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;54411:815: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;54411:815:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;54411:815:0;;-1:-1:-1;54411:815:0;;-1:-1:-1;;;;;54411:815:0:i;60234:141::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;60234:141:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;50105:29:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;50105:29:0;;;:::i;3882:49::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3882:49:0;;;:::i;3673:27::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3673:27:0;;;:::i;2077:48::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2077:48:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2077:48:0;-1:-1:-1;;;;;2077:48:0;;:::i;:::-;;;;;;;;;;;;;;;;;;;62258:209;;8:9:-1;5:2;;;30:1;27;20:12;5:2;62258:209:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;62258:209:0;;;;;;;;:::i;57972:221::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;57972:221:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;57972:221:0;;;;;;;;;;;;;;:::i;3569:23::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3569:23:0;;;:::i;2644:41::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2644:41:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2644:41:0;-1:-1:-1;;;;;2644:41:0;;:::i;3076:20::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3076:20:0;;;:::i;4312:25::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4312:25:0;;;:::i;63040:129::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;63040:129:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;63040:129:0;;:::i;62475:301::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;62475:301:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;62475:301:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;58705:341::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;58705:341:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;58705:341:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;59376:200::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;59376:200:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;59376:200:0;;;;;;;;;;:::i;2430:133::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2430:133:0;;;:::i;4128:33::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4128:33:0;;;:::i;4000:37::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4000:37:0;;;:::i;1940:68::-;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1940:68:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1940:68:0;;-1:-1:-1;;;;;1940:68:0;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;66053:511;66143:14;;:37;;66099:12;;66125;;-1:-1:-1;;;;;66143:14:0;;;;66125:12;;66171:8;;66143:37;66125:12;66171:8;;66125:12;66143:37;1:33:-1;66143:37:0;;45:16:-1;;;-1:-1;66143:37:0;;-1:-1:-1;66143:37:0;;-1:-1:-1;;66143:37:0;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;66124:56:0;;;66243:4;66237:11;66294:14;66291:1;66277:12;66262:47;66332:7;66357:85;;;;66512:14;66498:12;66491:36;66357:85;66408:14;66394:12;66387:36;2980:18;;;;;;;;;;;;;;;-1:-1:-1;;2980:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;64336:164::-;64471:14;;64423:12;;64460:32;;-1:-1:-1;;;;;64471:14:0;64487:4;64460:10;:32::i;:::-;64453:39;64336:164;-1:-1:-1;;64336:164:0:o;57130:154::-;57198:4;57257:19;:17;:19::i;:::-;;57130:154;;;;:::o;57860:104::-;57911:7;57931:25;:23;:25::i;:::-;;57860:104;:::o;3468:22::-;;;-1:-1:-1;;;;;3468:22:0;;:::o;3267:18::-;;;;;;-1:-1:-1;;;;;3267:18:0;;:::o;3765:26::-;;;;:::o;2198:138::-;2240:96;;;;;;;;;;;;;;;;;;2198:138;:::o;56448:212::-;56564:4;56633:19;:17;:19::i;:::-;;56448:212;;;;;:::o;3365:25::-;;;-1:-1:-1;;;;;3365:25:0;;:::o;4451:117::-;4502:66;4451:117;:::o;3176:21::-;;;;;;:::o;4575:31::-;;;;:::o;60905:175::-;60999:7;61047:25;:23;:25::i;:::-;;60905:175;;;:::o;64922:490::-;65027:12;65058;65072:23;65107:4;-1:-1:-1;;;;;65099:24:0;65197:4;65138:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;65138:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;65138:64:0;;;-1:-1:-1;;26:21;;;22:32;6:49;;65138:64:0;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;65099:114:0;;;;65138:64;;-1:-1:-1;65099:114:0;-1:-1:-1;65099:114:0;;-1:-1:-1;25:18;65099:114:0;;25:18:-1;36:153;66:2;61:3;58:11;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;65099:114:0;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;65057:156:0;;;;65263:1;65254:7;65251:14;65248:2;;;65315:14;65308:4;65296:10;65292:21;65285:45;65248:2;65384:10;65373:31;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;65373:31:0;;;;;;;;;;;;;-1:-1:-1;;;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;213:10;;-1:-1;;;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;372:25;;-1:-1;65373:31:0;;420:4:-1;411:14;;;;65373:31:0;;;;;411:14:-1;65373:31:0;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;65373:31:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;65366:38;;;;64922:490;;;:::o;61802:115::-;61890:19;:17;:19::i;:::-;;61802:115;:::o;62181:69::-;62223:19;:17;:19::i;:::-;;62181:69::o;54411:815::-;54609:3;;;;;-1:-1:-1;;;;;54609:3:0;54595:10;:17;54573:120;;;;-1:-1:-1;;;54573:120:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;54710:11;54706:152;;;54781:50;;;22:32:-1;6:49;;54781:50:0;;;;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;54738:108:0;;:24;:108::i;:::-;;54706:152;54898:14;;;-1:-1:-1;;;;;54923:32:0;;;-1:-1:-1;;;;;;54923:32:0;;;;;;55007:130;;;;;;;;;;;;;;;;;54898:14;;;;;54968:180;;55098:24;;55007:130;;;;;;;;;;;;;;;;54870:25;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;55007:130:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;55007:130:0;;;-1:-1:-1;;26:21;;;22:32;6:49;;55007:130:0;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;55007:130:0;-1:-1:-1;54968:24:0;;-1:-1:-1;;54968:180:0:i;:::-;-1:-1:-1;55203:14:0;;55166:52;;;-1:-1:-1;;;;;55166:52:0;;;;;55203:14;;;55166:52;;;;;;;;;;;;;;;;54411:815;;;;:::o;50105:29::-;;;-1:-1:-1;;;;;50105:29:0;;:::o;3882:49::-;3925:6;3882:49;:::o;3673:27::-;;;-1:-1:-1;;;;;3673:27:0;;:::o;2077:48::-;;;;;;;;;;;;;;;:::o;62258:209::-;62369:7;62434:25;:23;:25::i;3569:23::-;;;-1:-1:-1;;;;;3569:23:0;;:::o;2644:41::-;;;;;;;;;;;;;:::o;3076:20::-;;;;;;;;;;;;;;-1:-1:-1;;3076:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4312:25;;;;:::o;62475:301::-;62749:19;:17;:19::i;:::-;;62475:301;;;;;;:::o;58705:341::-;59019:19;:17;:19::i;:::-;;58705:341;;;;;;;:::o;2430:133::-;2476:87;;;;;;;;;;;;;;;;;;2430:133;:::o;4128:33::-;;;;:::o;4000:37::-;4031:6;4000:37;:::o;1940:68::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;63668:366::-;63759:12;63790;63804:23;63831:6;-1:-1:-1;;;;;63831:19:0;63851:4;63831:25;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;63831:25:0;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;63789:67:0;;;;63906:1;63897:7;63894:14;63891:2;;;63958:14;63951:4;63939:10;63935:21;63928:45;63891:2;64016:10;63668:366;-1:-1:-1;;;;63668:366:0:o;65420:625::-;65477:12;65503;65529:4;-1:-1:-1;;;;;65521:24:0;65619:8;;65560:68;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;;74:27;65560:68:0;;;137:4:-1;117:14;;;-1:-1;;113:30;;;157:16;;;26:21;;;22:32;;;6:49;;65560:68:0;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;65521:118:0;;;;65560:68;;-1:-1:-1;65521:118:0;-1:-1:-1;65521:118:0;;-1:-1:-1;25:18;;-1:-1;65521:118:0;;-1:-1:-1;65521:118:0;25:18:-1;36:153;66:2;61:3;58:11;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;65521:118:0;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;65502:137:0;;;65702:4;65696:11;65753:14;65750:1;65736:12;65721:47;65791:7;65816:85;;;;66002:4;65986:14;65982:25;65975:4;65961:12;65957:23;65950:58

Swarm Source

bzzr://8a18d9af84bc7c87eba1c3a09b2b99ab00d2b479f53f578c0dba9e9b5cf926b8
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.