OP Sepolia Testnet

Contract

0xC6F85E8Cc2F13521f909810d03Ca66397a813eDb

Overview

ETH Balance

0 ETH

Sponsored

Transaction Hash
Method
Block
From
To
Value
Issue Max Synths131001742024-06-10 7:01:2814 days ago1718002888IN
0xC6F85E8C...97a813eDb
0 ETH0.00000050.00098
Mint130998902024-06-10 6:52:0014 days ago1718002320IN
0xC6F85E8C...97a813eDb
0 ETH0.000000020.00097999
Exchange126737952024-05-31 10:08:5024 days ago1717150130IN
0xC6F85E8C...97a813eDb
0 ETH0.000000750.00110029
Exchange126733742024-05-31 9:54:4824 days ago1717149288IN
0xC6F85E8C...97a813eDb
0 ETH0.000000520.00110029
Exchange119478142024-05-14 14:49:2841 days ago1715698168IN
0xC6F85E8C...97a813eDb
0 ETH0.001003521.50000786
Exchange119456052024-05-14 13:35:5041 days ago1715693750IN
0xC6F85E8C...97a813eDb
0 ETH0.001029111.50000031
Exchange116913042024-05-08 16:19:0847 days ago1715185148IN
0xC6F85E8C...97a813eDb
0 ETH0.000999161.50000099
Exchange116912412024-05-08 16:17:0247 days ago1715185022IN
0xC6F85E8C...97a813eDb
0 ETH0.001029291.50000093
Exchange111692692024-04-26 14:17:5859 days ago1714141078IN
0xC6F85E8C...97a813eDb
0 ETH0.001006081.50000291
Exchange110819592024-04-24 13:47:3861 days ago1713966458IN
0xC6F85E8C...97a813eDb
0 ETH0.001036371.50000025
Exchange103938662024-04-08 15:31:1277 days ago1712590272IN
0xC6F85E8C...97a813eDb
0 ETH0.001058751.50000025
Exchange103938532024-04-08 15:30:4677 days ago1712590246IN
0xC6F85E8C...97a813eDb
0 ETH0.00104151.50000025
Exchange103937992024-04-08 15:28:5877 days ago1712590138IN
0xC6F85E8C...97a813eDb
0 ETH0.001092811.50000025
Exchange103936822024-04-08 15:25:0477 days ago1712589904IN
0xC6F85E8C...97a813eDb
0 ETH0.001046041.50000025
Exchange93053732024-03-14 10:48:06102 days ago1710413286IN
0xC6F85E8C...97a813eDb
0 ETH0.00100511.50000025
Exchange92555182024-03-13 7:06:16103 days ago1710313576IN
0xC6F85E8C...97a813eDb
0 ETH0.000979451.50000025
Exchange92509062024-03-13 4:32:32103 days ago1710304352IN
0xC6F85E8C...97a813eDb
0 ETH0.001005081.50000025
Exchange92272872024-03-12 15:25:14104 days ago1710257114IN
0xC6F85E8C...97a813eDb
0 ETH0.000979421.50000025
Exchange92213352024-03-12 12:06:50104 days ago1710245210IN
0xC6F85E8C...97a813eDb
0 ETH0.001012531.50000025
Exchange89307132024-03-05 18:39:26110 days ago1709663966IN
0xC6F85E8C...97a813eDb
0 ETH0.000982311.50000025
Exchange89305922024-03-05 18:35:24110 days ago1709663724IN
0xC6F85E8C...97a813eDb
0 ETH0.001005361.50000025
Exchange89302652024-03-05 18:24:30110 days ago1709663070IN
0xC6F85E8C...97a813eDb
0 ETH0.001005271.50000025
Exchange87598202024-03-01 19:43:00114 days ago1709322180IN
0xC6F85E8C...97a813eDb
0 ETH0.000968361.50000025
Exchange87597482024-03-01 19:40:36114 days ago1709322036IN
0xC6F85E8C...97a813eDb
0 ETH0.00101231.50000025
Exchange87573712024-03-01 18:21:22114 days ago1709317282IN
0xC6F85E8C...97a813eDb
0 ETH0.00065491.00000025
View all transactions

Advanced mode:
Parent Transaction Hash Block From To Value
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MintableSynthetix

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at sepolia-optimm.etherscan.io on 2023-12-11
*/

/*

⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠

This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS!

This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Synthetix release!
The proxy for this contract can be found here:

https://contracts.synthetix.io/sepolia//ovmProxySynthetix

*//*
   ____            __   __        __   _
  / __/__ __ ___  / /_ / /  ___  / /_ (_)__ __
 _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
     /___/

* Synthetix: MintableSynthetix.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/MintableSynthetix.sol
* Docs: https://docs.synthetix.io/contracts/MintableSynthetix
*
* Contract Dependencies: 
*	- BaseSynthetix
*	- ExternStateToken
*	- IAddressResolver
*	- IERC20
*	- ISynthetix
*	- MixinResolver
*	- Owned
*	- Proxyable
*	- State
* Libraries: 
*	- SafeDecimalMath
*	- SafeMath
*	- VestingEntries
*
* MIT License
* ===========
*
* Copyright (c) 2023 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/



pragma solidity >=0.4.24;

// https://docs.synthetix.io/contracts/source/interfaces/ierc20
interface IERC20 {
    // ERC20 Optional Views
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    // Views
    function totalSupply() external view returns (uint);

    function balanceOf(address owner) external view returns (uint);

    function allowance(address owner, address spender) external view returns (uint);

    // Mutative functions
    function transfer(address to, uint value) external returns (bool);

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

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

    // Events
    event Transfer(address indexed from, address indexed to, uint value);

    event Approval(address indexed owner, address indexed spender, uint value);
}


// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
    address public owner;
    address public nominatedOwner;

    constructor(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}


// Inheritance


// Internal references


// https://docs.synthetix.io/contracts/source/contracts/proxy
contract Proxy is Owned {
    Proxyable public target;

    constructor(address _owner) public Owned(_owner) {}

    function setTarget(Proxyable _target) external onlyOwner {
        target = _target;
        emit TargetUpdated(_target);
    }

    function _emit(
        bytes calldata callData,
        uint numTopics,
        bytes32 topic1,
        bytes32 topic2,
        bytes32 topic3,
        bytes32 topic4
    ) external onlyTarget {
        uint size = callData.length;
        bytes memory _callData = callData;

        assembly {
            /* The first 32 bytes of callData contain its length (as specified by the abi).
             * Length is assumed to be a uint256 and therefore maximum of 32 bytes
             * in length. It is also leftpadded to be a multiple of 32 bytes.
             * This means moving call_data across 32 bytes guarantees we correctly access
             * the data itself. */
            switch numTopics
                case 0 {
                    log0(add(_callData, 32), size)
                }
                case 1 {
                    log1(add(_callData, 32), size, topic1)
                }
                case 2 {
                    log2(add(_callData, 32), size, topic1, topic2)
                }
                case 3 {
                    log3(add(_callData, 32), size, topic1, topic2, topic3)
                }
                case 4 {
                    log4(add(_callData, 32), size, topic1, topic2, topic3, topic4)
                }
        }
    }

    // solhint-disable no-complex-fallback
    function() external payable {
        // Mutable call setting Proxyable.messageSender as this is using call not delegatecall
        target.setMessageSender(msg.sender);

        assembly {
            let free_ptr := mload(0x40)
            calldatacopy(free_ptr, 0, calldatasize)

            /* We must explicitly forward ether to the underlying contract as well. */
            let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0)
            returndatacopy(free_ptr, 0, returndatasize)

            if iszero(result) {
                revert(free_ptr, returndatasize)
            }
            return(free_ptr, returndatasize)
        }
    }

    modifier onlyTarget {
        require(Proxyable(msg.sender) == target, "Must be proxy target");
        _;
    }

    event TargetUpdated(Proxyable newTarget);
}


// Inheritance


// Internal references


// https://docs.synthetix.io/contracts/source/contracts/proxyable
contract Proxyable is Owned {
    // This contract should be treated like an abstract contract

    /* The proxy this contract exists behind. */
    Proxy public proxy;

    /* The caller of the proxy, passed through to this contract.
     * Note that every function using this member must apply the onlyProxy or
     * optionalProxy modifiers, otherwise their invocations can use stale values. */
    address public messageSender;

    constructor(address payable _proxy) internal {
        // This contract is abstract, and thus cannot be instantiated directly
        require(owner != address(0), "Owner must be set");

        proxy = Proxy(_proxy);
        emit ProxyUpdated(_proxy);
    }

    function setProxy(address payable _proxy) external onlyOwner {
        proxy = Proxy(_proxy);
        emit ProxyUpdated(_proxy);
    }

    function setMessageSender(address sender) external onlyProxy {
        messageSender = sender;
    }

    modifier onlyProxy {
        _onlyProxy();
        _;
    }

    function _onlyProxy() private view {
        require(Proxy(msg.sender) == proxy, "Only the proxy can call");
    }

    modifier optionalProxy {
        _optionalProxy();
        _;
    }

    function _optionalProxy() private {
        if (Proxy(msg.sender) != proxy && messageSender != msg.sender) {
            messageSender = msg.sender;
        }
    }

    modifier optionalProxy_onlyOwner {
        _optionalProxy_onlyOwner();
        _;
    }

    // solhint-disable-next-line func-name-mixedcase
    function _optionalProxy_onlyOwner() private {
        if (Proxy(msg.sender) != proxy && messageSender != msg.sender) {
            messageSender = msg.sender;
        }
        require(messageSender == owner, "Owner only function");
    }

    event ProxyUpdated(address proxyAddress);
}


/**
 * @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) {
        require(b <= a, "SafeMath: subtraction overflow");
        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-solidity/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) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, "SafeMath: division by zero");
        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) {
        require(b != 0, "SafeMath: modulo by zero");
        return a % b;
    }
}


// Libraries


// https://docs.synthetix.io/contracts/source/libraries/safedecimalmath
library SafeDecimalMath {
    using SafeMath for uint;

    /* Number of decimal places in the representations. */
    uint8 public constant decimals = 18;
    uint8 public constant highPrecisionDecimals = 27;

    /* The number representing 1.0. */
    uint public constant UNIT = 10**uint(decimals);

    /* The number representing 1.0 for higher fidelity numbers. */
    uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);
    uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);

    /**
     * @return Provides an interface to UNIT.
     */
    function unit() external pure returns (uint) {
        return UNIT;
    }

    /**
     * @return Provides an interface to PRECISE_UNIT.
     */
    function preciseUnit() external pure returns (uint) {
        return PRECISE_UNIT;
    }

    /**
     * @return The result of multiplying x and y, interpreting the operands as fixed-point
     * decimals.
     *
     * @dev A unit factor is divided out after the product of x and y is evaluated,
     * so that product must be less than 2**256. As this is an integer division,
     * the internal division always rounds down. This helps save on gas. Rounding
     * is more expensive on gas.
     */
    function multiplyDecimal(uint x, uint y) internal pure returns (uint) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        return x.mul(y) / UNIT;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of the specified precision unit.
     *
     * @dev The operands should be in the form of a the specified unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function _multiplyDecimalRound(
        uint x,
        uint y,
        uint precisionUnit
    ) private pure returns (uint) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        uint quotientTimesTen = x.mul(y) / (precisionUnit / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a precise unit.
     *
     * @dev The operands should be in the precise unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
        return _multiplyDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a standard unit.
     *
     * @dev The operands should be in the standard unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) {
        return _multiplyDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is a high
     * precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and UNIT must be less than 2**256. As
     * this is an integer division, the result is always rounded down.
     * This helps save on gas. Rounding is more expensive on gas.
     */
    function divideDecimal(uint x, uint y) internal pure returns (uint) {
        /* Reintroduce the UNIT factor that will be divided out by y. */
        return x.mul(UNIT).div(y);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * decimal in the precision unit specified in the parameter.
     *
     * @dev y is divided after the product of x and the specified precision unit
     * is evaluated, so the product of x and the specified precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function _divideDecimalRound(
        uint x,
        uint y,
        uint precisionUnit
    ) private pure returns (uint) {
        uint resultTimesTen = x.mul(precisionUnit * 10).div(y);

        if (resultTimesTen % 10 >= 5) {
            resultTimesTen += 10;
        }

        return resultTimesTen / 10;
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * standard precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and the standard precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRound(uint x, uint y) internal pure returns (uint) {
        return _divideDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * high precision decimal.
     *
     * @dev y is divided after the product of x and the high precision unit
     * is evaluated, so the product of x and the high precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
        return _divideDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @dev Convert a standard decimal representation to a high precision one.
     */
    function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
        return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
    }

    /**
     * @dev Convert a high precision decimal to a standard decimal representation.
     */
    function preciseDecimalToDecimal(uint i) internal pure returns (uint) {
        uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }

    // Computes `a - b`, setting the value to 0 if b > a.
    function floorsub(uint a, uint b) internal pure returns (uint) {
        return b >= a ? 0 : a - b;
    }

    /* ---------- Utilities ---------- */
    /*
     * Absolute value of the input, returned as a signed number.
     */
    function signedAbs(int x) internal pure returns (int) {
        return x < 0 ? -x : x;
    }

    /*
     * Absolute value of the input, returned as an unsigned number.
     */
    function abs(int x) internal pure returns (uint) {
        return uint(signedAbs(x));
    }
}


// Inheritance


// https://docs.synthetix.io/contracts/source/contracts/state
contract State is Owned {
    // the address of the contract that can modify variables
    // this can only be changed by the owner of this contract
    address public associatedContract;

    constructor(address _associatedContract) internal {
        // This contract is abstract, and thus cannot be instantiated directly
        require(owner != address(0), "Owner must be set");

        associatedContract = _associatedContract;
        emit AssociatedContractUpdated(_associatedContract);
    }

    /* ========== SETTERS ========== */

    // Change the associated contract to a new address
    function setAssociatedContract(address _associatedContract) external onlyOwner {
        associatedContract = _associatedContract;
        emit AssociatedContractUpdated(_associatedContract);
    }

    /* ========== MODIFIERS ========== */

    modifier onlyAssociatedContract {
        require(msg.sender == associatedContract, "Only the associated contract can perform this action");
        _;
    }

    /* ========== EVENTS ========== */

    event AssociatedContractUpdated(address associatedContract);
}


// Inheritance


// https://docs.synthetix.io/contracts/source/contracts/tokenstate
contract TokenState is Owned, State {
    /* ERC20 fields. */
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;

    constructor(address _owner, address _associatedContract) public Owned(_owner) State(_associatedContract) {}

    /* ========== SETTERS ========== */

    /**
     * @notice Set ERC20 allowance.
     * @dev Only the associated contract may call this.
     * @param tokenOwner The authorising party.
     * @param spender The authorised party.
     * @param value The total value the authorised party may spend on the
     * authorising party's behalf.
     */
    function setAllowance(
        address tokenOwner,
        address spender,
        uint value
    ) external onlyAssociatedContract {
        allowance[tokenOwner][spender] = value;
    }

    /**
     * @notice Set the balance in a given account
     * @dev Only the associated contract may call this.
     * @param account The account whose value to set.
     * @param value The new balance of the given account.
     */
    function setBalanceOf(address account, uint value) external onlyAssociatedContract {
        balanceOf[account] = value;
    }
}


// Inheritance


// Libraries


// Internal references


// https://docs.synthetix.io/contracts/source/contracts/externstatetoken
contract ExternStateToken is Owned, Proxyable {
    using SafeMath for uint;
    using SafeDecimalMath for uint;

    /* ========== STATE VARIABLES ========== */

    /* Stores balances and allowances. */
    TokenState public tokenState;

    /* Other ERC20 fields. */
    string public name;
    string public symbol;
    uint public totalSupply;
    uint8 public decimals;

    constructor(
        address payable _proxy,
        TokenState _tokenState,
        string memory _name,
        string memory _symbol,
        uint _totalSupply,
        uint8 _decimals,
        address _owner
    ) public Owned(_owner) Proxyable(_proxy) {
        tokenState = _tokenState;

        name = _name;
        symbol = _symbol;
        totalSupply = _totalSupply;
        decimals = _decimals;
    }

    /* ========== VIEWS ========== */

    /**
     * @notice Returns the ERC20 allowance of one party to spend on behalf of another.
     * @param owner The party authorising spending of their funds.
     * @param spender The party spending tokenOwner's funds.
     */
    function allowance(address owner, address spender) public view returns (uint) {
        return tokenState.allowance(owner, spender);
    }

    /**
     * @notice Returns the ERC20 token balance of a given account.
     */
    function balanceOf(address account) external view returns (uint) {
        return tokenState.balanceOf(account);
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    /**
     * @notice Set the address of the TokenState contract.
     * @dev This can be used to "pause" transfer functionality, by pointing the tokenState at 0x000..
     * as balances would be unreachable.
     */
    function setTokenState(TokenState _tokenState) external optionalProxy_onlyOwner {
        tokenState = _tokenState;
        emitTokenStateUpdated(address(_tokenState));
    }

    function _internalTransfer(
        address from,
        address to,
        uint value
    ) internal returns (bool) {
        /* Disallow transfers to irretrievable-addresses. */
        require(to != address(0) && to != address(this) && to != address(proxy), "Cannot transfer to this address");

        // Insufficient balance will be handled by the safe subtraction.
        tokenState.setBalanceOf(from, tokenState.balanceOf(from).sub(value));
        tokenState.setBalanceOf(to, tokenState.balanceOf(to).add(value));

        // Emit a standard ERC20 transfer event
        emitTransfer(from, to, value);

        return true;
    }

    /**
     * @dev Perform an ERC20 token transfer. Designed to be called by transfer functions possessing
     * the onlyProxy or optionalProxy modifiers.
     */
    function _transferByProxy(
        address from,
        address to,
        uint value
    ) internal returns (bool) {
        return _internalTransfer(from, to, value);
    }

    /*
     * @dev Perform an ERC20 token transferFrom. Designed to be called by transferFrom functions
     * possessing the optionalProxy or optionalProxy modifiers.
     */
    function _transferFromByProxy(
        address sender,
        address from,
        address to,
        uint value
    ) internal returns (bool) {
        /* Insufficient allowance will be handled by the safe subtraction. */
        tokenState.setAllowance(from, sender, tokenState.allowance(from, sender).sub(value));
        return _internalTransfer(from, to, value);
    }

    /**
     * @notice Approves spender to transfer on the message sender's behalf.
     */
    function approve(address spender, uint value) public optionalProxy returns (bool) {
        address sender = messageSender;

        tokenState.setAllowance(sender, spender, value);
        emitApproval(sender, spender, value);
        return true;
    }

    /* ========== EVENTS ========== */
    function addressToBytes32(address input) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(input)));
    }

    event Transfer(address indexed from, address indexed to, uint value);
    bytes32 internal constant TRANSFER_SIG = keccak256("Transfer(address,address,uint256)");

    function emitTransfer(
        address from,
        address to,
        uint value
    ) internal {
        proxy._emit(abi.encode(value), 3, TRANSFER_SIG, addressToBytes32(from), addressToBytes32(to), 0);
    }

    event Approval(address indexed owner, address indexed spender, uint value);
    bytes32 internal constant APPROVAL_SIG = keccak256("Approval(address,address,uint256)");

    function emitApproval(
        address owner,
        address spender,
        uint value
    ) internal {
        proxy._emit(abi.encode(value), 3, APPROVAL_SIG, addressToBytes32(owner), addressToBytes32(spender), 0);
    }

    event TokenStateUpdated(address newTokenState);
    bytes32 internal constant TOKENSTATEUPDATED_SIG = keccak256("TokenStateUpdated(address)");

    function emitTokenStateUpdated(address newTokenState) internal {
        proxy._emit(abi.encode(newTokenState), 1, TOKENSTATEUPDATED_SIG, 0, 0, 0);
    }
}


// https://docs.synthetix.io/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
    function getAddress(bytes32 name) external view returns (address);

    function getSynth(bytes32 key) external view returns (address);

    function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}


// https://docs.synthetix.io/contracts/source/interfaces/isynth
interface ISynth {
    // Views
    function currencyKey() external view returns (bytes32);

    function transferableSynths(address account) external view returns (uint);

    // Mutative functions
    function transferAndSettle(address to, uint value) external returns (bool);

    function transferFromAndSettle(
        address from,
        address to,
        uint value
    ) external returns (bool);

    // Restricted: used internally to Synthetix
    function burn(address account, uint amount) external;

    function issue(address account, uint amount) external;
}


// https://docs.synthetix.io/contracts/source/interfaces/iissuer
interface IIssuer {
    // Views

    function allNetworksDebtInfo()
        external
        view
        returns (
            uint256 debt,
            uint256 sharesSupply,
            bool isStale
        );

    function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);

    function availableCurrencyKeys() external view returns (bytes32[] memory);

    function availableSynthCount() external view returns (uint);

    function availableSynths(uint index) external view returns (ISynth);

    function canBurnSynths(address account) external view returns (bool);

    function collateral(address account) external view returns (uint);

    function collateralisationRatio(address issuer) external view returns (uint);

    function collateralisationRatioAndAnyRatesInvalid(address _issuer)
        external
        view
        returns (uint cratio, bool anyRateIsInvalid);

    function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance);

    function issuanceRatio() external view returns (uint);

    function lastIssueEvent(address account) external view returns (uint);

    function maxIssuableSynths(address issuer) external view returns (uint maxIssuable);

    function minimumStakeTime() external view returns (uint);

    function remainingIssuableSynths(address issuer)
        external
        view
        returns (
            uint maxIssuable,
            uint alreadyIssued,
            uint totalSystemDebt
        );

    function synths(bytes32 currencyKey) external view returns (ISynth);

    function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory);

    function synthsByAddress(address synthAddress) external view returns (bytes32);

    function totalIssuedSynths(bytes32 currencyKey, bool excludeOtherCollateral) external view returns (uint);

    function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance)
        external
        view
        returns (uint transferable, bool anyRateIsInvalid);

    function liquidationAmounts(address account, bool isSelfLiquidation)
        external
        view
        returns (
            uint totalRedeemed,
            uint debtToRemove,
            uint escrowToLiquidate,
            uint initialDebtBalance
        );

    // Restricted: used internally to Synthetix
    function addSynths(ISynth[] calldata synthsToAdd) external;

    function issueSynths(address from, uint amount) external;

    function issueSynthsOnBehalf(
        address issueFor,
        address from,
        uint amount
    ) external;

    function issueMaxSynths(address from) external;

    function issueMaxSynthsOnBehalf(address issueFor, address from) external;

    function burnSynths(address from, uint amount) external;

    function burnSynthsOnBehalf(
        address burnForAddress,
        address from,
        uint amount
    ) external;

    function burnSynthsToTarget(address from) external;

    function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external;

    function burnForRedemption(
        address deprecatedSynthProxy,
        address account,
        uint balance
    ) external;

    function setCurrentPeriodId(uint128 periodId) external;

    function liquidateAccount(address account, bool isSelfLiquidation)
        external
        returns (
            uint totalRedeemed,
            uint debtRemoved,
            uint escrowToLiquidate
        );

    function issueSynthsWithoutDebt(
        bytes32 currencyKey,
        address to,
        uint amount
    ) external returns (bool rateInvalid);

    function burnSynthsWithoutDebt(
        bytes32 currencyKey,
        address to,
        uint amount
    ) external returns (bool rateInvalid);

    function modifyDebtSharesForMigration(address account, uint amount) external;
}


// Inheritance


// Internal references


// https://docs.synthetix.io/contracts/source/contracts/addressresolver
contract AddressResolver is Owned, IAddressResolver {
    mapping(bytes32 => address) public repository;

    constructor(address _owner) public Owned(_owner) {}

    /* ========== RESTRICTED FUNCTIONS ========== */

    function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner {
        require(names.length == destinations.length, "Input lengths must match");

        for (uint i = 0; i < names.length; i++) {
            bytes32 name = names[i];
            address destination = destinations[i];
            repository[name] = destination;
            emit AddressImported(name, destination);
        }
    }

    /* ========= PUBLIC FUNCTIONS ========== */

    function rebuildCaches(MixinResolver[] calldata destinations) external {
        for (uint i = 0; i < destinations.length; i++) {
            destinations[i].rebuildCache();
        }
    }

    /* ========== VIEWS ========== */

    function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) {
        for (uint i = 0; i < names.length; i++) {
            if (repository[names[i]] != destinations[i]) {
                return false;
            }
        }
        return true;
    }

    function getAddress(bytes32 name) external view returns (address) {
        return repository[name];
    }

    function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) {
        address _foundAddress = repository[name];
        require(_foundAddress != address(0), reason);
        return _foundAddress;
    }

    function getSynth(bytes32 key) external view returns (address) {
        IIssuer issuer = IIssuer(repository["Issuer"]);
        require(address(issuer) != address(0), "Cannot find Issuer address");
        return address(issuer.synths(key));
    }

    /* ========== EVENTS ========== */

    event AddressImported(bytes32 name, address destination);
}


// Internal references


// https://docs.synthetix.io/contracts/source/contracts/mixinresolver
contract MixinResolver {
    AddressResolver public resolver;

    mapping(bytes32 => address) private addressCache;

    constructor(address _resolver) internal {
        resolver = AddressResolver(_resolver);
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function combineArrays(bytes32[] memory first, bytes32[] memory second)
        internal
        pure
        returns (bytes32[] memory combination)
    {
        combination = new bytes32[](first.length + second.length);

        for (uint i = 0; i < first.length; i++) {
            combination[i] = first[i];
        }

        for (uint j = 0; j < second.length; j++) {
            combination[first.length + j] = second[j];
        }
    }

    /* ========== PUBLIC FUNCTIONS ========== */

    // Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
    function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {}

    function rebuildCache() public {
        bytes32[] memory requiredAddresses = resolverAddressesRequired();
        // The resolver must call this function whenver it updates its state
        for (uint i = 0; i < requiredAddresses.length; i++) {
            bytes32 name = requiredAddresses[i];
            // Note: can only be invoked once the resolver has all the targets needed added
            address destination =
                resolver.requireAndGetAddress(name, string(abi.encodePacked("Resolver missing target: ", name)));
            addressCache[name] = destination;
            emit CacheUpdated(name, destination);
        }
    }

    /* ========== VIEWS ========== */

    function isResolverCached() external view returns (bool) {
        bytes32[] memory requiredAddresses = resolverAddressesRequired();
        for (uint i = 0; i < requiredAddresses.length; i++) {
            bytes32 name = requiredAddresses[i];
            // false if our cache is invalid or if the resolver doesn't have the required address
            if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) {
                return false;
            }
        }

        return true;
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function requireAndGetAddress(bytes32 name) internal view returns (address) {
        address _foundAddress = addressCache[name];
        require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name)));
        return _foundAddress;
    }

    /* ========== EVENTS ========== */

    event CacheUpdated(bytes32 name, address destination);
}


interface IVirtualSynth {
    // Views
    function balanceOfUnderlying(address account) external view returns (uint);

    function rate() external view returns (uint);

    function readyToSettle() external view returns (bool);

    function secsLeftInWaitingPeriod() external view returns (uint);

    function settled() external view returns (bool);

    function synth() external view returns (ISynth);

    // Mutative functions
    function settle(address account) external;
}


// https://docs.synthetix.io/contracts/source/interfaces/isynthetix
interface ISynthetix {
    // Views
    function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);

    function availableCurrencyKeys() external view returns (bytes32[] memory);

    function availableSynthCount() external view returns (uint);

    function availableSynths(uint index) external view returns (ISynth);

    function collateral(address account) external view returns (uint);

    function collateralisationRatio(address issuer) external view returns (uint);

    function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint);

    function isWaitingPeriod(bytes32 currencyKey) external view returns (bool);

    function maxIssuableSynths(address issuer) external view returns (uint maxIssuable);

    function remainingIssuableSynths(address issuer)
        external
        view
        returns (
            uint maxIssuable,
            uint alreadyIssued,
            uint totalSystemDebt
        );

    function synths(bytes32 currencyKey) external view returns (ISynth);

    function synthsByAddress(address synthAddress) external view returns (bytes32);

    function totalIssuedSynths(bytes32 currencyKey) external view returns (uint);

    function totalIssuedSynthsExcludeOtherCollateral(bytes32 currencyKey) external view returns (uint);

    function transferableSynthetix(address account) external view returns (uint transferable);

    function getFirstNonZeroEscrowIndex(address account) external view returns (uint);

    // Mutative Functions
    function burnSynths(uint amount) external;

    function burnSynthsOnBehalf(address burnForAddress, uint amount) external;

    function burnSynthsToTarget() external;

    function burnSynthsToTargetOnBehalf(address burnForAddress) external;

    function exchange(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey
    ) external returns (uint amountReceived);

    function exchangeOnBehalf(
        address exchangeForAddress,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey
    ) external returns (uint amountReceived);

    function exchangeWithTracking(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address rewardAddress,
        bytes32 trackingCode
    ) external returns (uint amountReceived);

    function exchangeWithTrackingForInitiator(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address rewardAddress,
        bytes32 trackingCode
    ) external returns (uint amountReceived);

    function exchangeOnBehalfWithTracking(
        address exchangeForAddress,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address rewardAddress,
        bytes32 trackingCode
    ) external returns (uint amountReceived);

    function exchangeWithVirtual(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        bytes32 trackingCode
    ) external returns (uint amountReceived, IVirtualSynth vSynth);

    function exchangeAtomically(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        bytes32 trackingCode,
        uint minAmount
    ) external returns (uint amountReceived);

    function issueMaxSynths() external;

    function issueMaxSynthsOnBehalf(address issueForAddress) external;

    function issueSynths(uint amount) external;

    function issueSynthsOnBehalf(address issueForAddress, uint amount) external;

    function mint() external returns (bool);

    function settle(bytes32 currencyKey)
        external
        returns (
            uint reclaimed,
            uint refunded,
            uint numEntries
        );

    // Liquidations
    function liquidateDelinquentAccount(address account) external returns (bool);

    function liquidateDelinquentAccountEscrowIndex(address account, uint escrowStartIndex) external returns (bool);

    function liquidateSelf() external returns (bool);

    // Restricted Functions

    function mintSecondary(address account, uint amount) external;

    function mintSecondaryRewards(uint amount) external;

    function burnSecondary(address account, uint amount) external;

    function revokeAllEscrow(address account) external;

    function migrateAccountBalances(address account) external returns (uint totalEscrowRevoked, uint totalLiquidBalance);
}


// https://docs.synthetix.io/contracts/source/interfaces/isystemstatus
interface ISystemStatus {
    struct Status {
        bool canSuspend;
        bool canResume;
    }

    struct Suspension {
        bool suspended;
        // reason is an integer code,
        // 0 => no reason, 1 => upgrading, 2+ => defined by system usage
        uint248 reason;
    }

    // Views
    function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume);

    function requireSystemActive() external view;

    function systemSuspended() external view returns (bool);

    function requireIssuanceActive() external view;

    function requireExchangeActive() external view;

    function requireFuturesActive() external view;

    function requireFuturesMarketActive(bytes32 marketKey) external view;

    function requireExchangeBetweenSynthsAllowed(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view;

    function requireSynthActive(bytes32 currencyKey) external view;

    function synthSuspended(bytes32 currencyKey) external view returns (bool);

    function requireSynthsActive(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view;

    function systemSuspension() external view returns (bool suspended, uint248 reason);

    function issuanceSuspension() external view returns (bool suspended, uint248 reason);

    function exchangeSuspension() external view returns (bool suspended, uint248 reason);

    function futuresSuspension() external view returns (bool suspended, uint248 reason);

    function synthExchangeSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);

    function synthSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);

    function futuresMarketSuspension(bytes32 marketKey) external view returns (bool suspended, uint248 reason);

    function getSynthExchangeSuspensions(bytes32[] calldata synths)
        external
        view
        returns (bool[] memory exchangeSuspensions, uint256[] memory reasons);

    function getSynthSuspensions(bytes32[] calldata synths)
        external
        view
        returns (bool[] memory suspensions, uint256[] memory reasons);

    function getFuturesMarketSuspensions(bytes32[] calldata marketKeys)
        external
        view
        returns (bool[] memory suspensions, uint256[] memory reasons);

    // Restricted functions
    function suspendIssuance(uint256 reason) external;

    function suspendSynth(bytes32 currencyKey, uint256 reason) external;

    function suspendFuturesMarket(bytes32 marketKey, uint256 reason) external;

    function updateAccessControl(
        bytes32 section,
        address account,
        bool canSuspend,
        bool canResume
    ) external;
}


pragma experimental ABIEncoderV2;


// https://docs.synthetix.io/contracts/source/interfaces/iexchanger
interface IExchanger {
    struct ExchangeEntrySettlement {
        bytes32 src;
        uint amount;
        bytes32 dest;
        uint reclaim;
        uint rebate;
        uint srcRoundIdAtPeriodEnd;
        uint destRoundIdAtPeriodEnd;
        uint timestamp;
    }

    struct ExchangeEntry {
        uint sourceRate;
        uint destinationRate;
        uint destinationAmount;
        uint exchangeFeeRate;
        uint exchangeDynamicFeeRate;
        uint roundIdForSrc;
        uint roundIdForDest;
        uint sourceAmountAfterSettlement;
    }

    // Views
    function calculateAmountAfterSettlement(
        address from,
        bytes32 currencyKey,
        uint amount,
        uint refunded
    ) external view returns (uint amountAfterSettlement);

    function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool);

    function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) external view returns (uint);

    function settlementOwing(address account, bytes32 currencyKey)
        external
        view
        returns (
            uint reclaimAmount,
            uint rebateAmount,
            uint numEntries
        );

    function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool);

    function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view returns (uint);

    function dynamicFeeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
        external
        view
        returns (uint feeRate, bool tooVolatile);

    function getAmountsForExchange(
        uint sourceAmount,
        bytes32 sourceCurrencyKey,
        bytes32 destinationCurrencyKey
    )
        external
        view
        returns (
            uint amountReceived,
            uint fee,
            uint exchangeFeeRate
        );

    function priceDeviationThresholdFactor() external view returns (uint);

    function waitingPeriodSecs() external view returns (uint);

    function lastExchangeRate(bytes32 currencyKey) external view returns (uint);

    // Mutative functions
    function exchange(
        address exchangeForAddress,
        address from,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address destinationAddress,
        bool virtualSynth,
        address rewardAddress,
        bytes32 trackingCode
    ) external returns (uint amountReceived, IVirtualSynth vSynth);

    function exchangeAtomically(
        address from,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address destinationAddress,
        bytes32 trackingCode,
        uint minAmount
    ) external returns (uint amountReceived);

    function settle(address from, bytes32 currencyKey)
        external
        returns (
            uint reclaimed,
            uint refunded,
            uint numEntries
        );
}

// Used to have strongly-typed access to internal mutative functions in Synthetix
interface ISynthetixInternal {
    function emitExchangeTracking(
        bytes32 trackingCode,
        bytes32 toCurrencyKey,
        uint256 toAmount,
        uint256 fee
    ) external;

    function emitSynthExchange(
        address account,
        bytes32 fromCurrencyKey,
        uint fromAmount,
        bytes32 toCurrencyKey,
        uint toAmount,
        address toAddress
    ) external;

    function emitAtomicSynthExchange(
        address account,
        bytes32 fromCurrencyKey,
        uint fromAmount,
        bytes32 toCurrencyKey,
        uint toAmount,
        address toAddress
    ) external;

    function emitExchangeReclaim(
        address account,
        bytes32 currencyKey,
        uint amount
    ) external;

    function emitExchangeRebate(
        address account,
        bytes32 currencyKey,
        uint amount
    ) external;
}

interface IExchangerInternalDebtCache {
    function updateCachedSynthDebtsWithRates(bytes32[] calldata currencyKeys, uint[] calldata currencyRates) external;

    function updateCachedSynthDebts(bytes32[] calldata currencyKeys) external;
}


// https://docs.synthetix.io/contracts/source/interfaces/irewardsdistribution
interface IRewardsDistribution {
    // Structs
    struct DistributionData {
        address destination;
        uint amount;
    }

    // Views
    function authority() external view returns (address);

    function distributions(uint index) external view returns (address destination, uint amount); // DistributionData

    function distributionsLength() external view returns (uint);

    // Mutative Functions
    function distributeRewards(uint amount) external returns (bool);
}


interface ILiquidator {
    // Views
    function issuanceRatio() external view returns (uint);

    function liquidationDelay() external view returns (uint);

    function liquidationRatio() external view returns (uint);

    function liquidationEscrowDuration() external view returns (uint);

    function liquidationPenalty() external view returns (uint);

    function selfLiquidationPenalty() external view returns (uint);

    function liquidateReward() external view returns (uint);

    function flagReward() external view returns (uint);

    function liquidationCollateralRatio() external view returns (uint);

    function getLiquidationDeadlineForAccount(address account) external view returns (uint);

    function getLiquidationCallerForAccount(address account) external view returns (address);

    function isLiquidationOpen(address account, bool isSelfLiquidation) external view returns (bool);

    function isLiquidationDeadlinePassed(address account) external view returns (bool);

    function calculateAmountToFixCollateral(
        uint debtBalance,
        uint collateral,
        uint penalty
    ) external view returns (uint);

    function liquidationAmounts(address account, bool isSelfLiquidation)
        external
        view
        returns (
            uint totalRedeemed,
            uint debtToRemove,
            uint escrowToLiquidate,
            uint initialDebtBalance
        );

    // Mutative Functions
    function flagAccountForLiquidation(address account) external;

    // Restricted: used internally to Synthetix contracts
    function removeAccountInLiquidation(address account) external;

    function checkAndRemoveAccountInLiquidation(address account) external;
}


interface ILiquidatorRewards {
    // Views

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

    // Mutative

    function getReward(address account) external;

    function notifyRewardAmount(uint256 reward) external;

    function updateEntry(address account) external;
}


library VestingEntries {
    struct VestingEntry {
        uint64 endTime;
        uint256 escrowAmount;
    }
    struct VestingEntryWithID {
        uint64 endTime;
        uint256 escrowAmount;
        uint256 entryID;
    }
}

/// SIP-252: this is the interface for immutable V2 escrow (renamed with suffix Frozen).
/// These sources need to exist here and match on-chain frozen contracts for tests and reference.
/// the reason for the naming mess is that the immutable LiquidatorRewards expects a working
/// RewardEscrowV2 resolver entry for its getReward method, so the "new" (would be V3)
/// needs to be found at that entry for liq-rewards to function.
interface IRewardEscrowV2Frozen {
    // Views
    function balanceOf(address account) external view returns (uint);

    function numVestingEntries(address account) external view returns (uint);

    function totalEscrowedBalance() external view returns (uint);

    function totalEscrowedAccountBalance(address account) external view returns (uint);

    function totalVestedAccountBalance(address account) external view returns (uint);

    function getVestingQuantity(address account, uint256[] calldata entryIDs) external view returns (uint);

    function getVestingSchedules(
        address account,
        uint256 index,
        uint256 pageSize
    ) external view returns (VestingEntries.VestingEntryWithID[] memory);

    function getAccountVestingEntryIDs(
        address account,
        uint256 index,
        uint256 pageSize
    ) external view returns (uint256[] memory);

    function getVestingEntryClaimable(address account, uint256 entryID) external view returns (uint);

    function getVestingEntry(address account, uint256 entryID) external view returns (uint64, uint256);

    // Mutative functions
    function vest(uint256[] calldata entryIDs) external;

    function createEscrowEntry(
        address beneficiary,
        uint256 deposit,
        uint256 duration
    ) external;

    function appendVestingEntry(
        address account,
        uint256 quantity,
        uint256 duration
    ) external;

    function migrateVestingSchedule(address _addressToMigrate) external;

    function migrateAccountEscrowBalances(
        address[] calldata accounts,
        uint256[] calldata escrowBalances,
        uint256[] calldata vestedBalances
    ) external;

    // Account Merging
    function startMergingWindow() external;

    function mergeAccount(address accountToMerge, uint256[] calldata entryIDs) external;

    function nominateAccountToMerge(address account) external;

    function accountMergingIsOpen() external view returns (bool);

    // L2 Migration
    function importVestingEntries(
        address account,
        uint256 escrowedAmount,
        VestingEntries.VestingEntry[] calldata vestingEntries
    ) external;

    // Return amount of SNX transfered to SynthetixBridgeToOptimism deposit contract
    function burnForMigration(address account, uint256[] calldata entryIDs)
        external
        returns (uint256 escrowedAccountBalance, VestingEntries.VestingEntry[] memory vestingEntries);

    function nextEntryId() external view returns (uint);

    function vestingSchedules(address account, uint256 entryId) external view returns (VestingEntries.VestingEntry memory);

    function accountVestingEntryIDs(address account, uint256 index) external view returns (uint);

    //function totalEscrowedAccountBalance(address account) external view returns (uint);
    //function totalVestedAccountBalance(address account) external view returns (uint);
}


interface IRewardEscrowV2Storage {
    /// Views
    function numVestingEntries(address account) external view returns (uint);

    function totalEscrowedAccountBalance(address account) external view returns (uint);

    function totalVestedAccountBalance(address account) external view returns (uint);

    function totalEscrowedBalance() external view returns (uint);

    function nextEntryId() external view returns (uint);

    function vestingSchedules(address account, uint256 entryId) external view returns (VestingEntries.VestingEntry memory);

    function accountVestingEntryIDs(address account, uint256 index) external view returns (uint);

    /// Mutative
    function setZeroAmount(address account, uint entryId) external;

    function setZeroAmountUntilTarget(
        address account,
        uint startIndex,
        uint targetAmount
    )
        external
        returns (
            uint total,
            uint endIndex,
            uint lastEntryTime
        );

    function updateEscrowAccountBalance(address account, int delta) external;

    function updateVestedAccountBalance(address account, int delta) external;

    function updateTotalEscrowedBalance(int delta) external;

    function addVestingEntry(address account, VestingEntries.VestingEntry calldata entry) external returns (uint);

    // setFallbackRewardEscrow is used for configuration but not used by contracts
}

/// this should remain backwards compatible to IRewardEscrowV2Frozen
/// ideally this would be done by inheriting from that interface
/// but solidity v0.5 doesn't support interface inheritance
interface IRewardEscrowV2 {
    // Views
    function balanceOf(address account) external view returns (uint);

    function numVestingEntries(address account) external view returns (uint);

    function totalEscrowedBalance() external view returns (uint);

    function totalEscrowedAccountBalance(address account) external view returns (uint);

    function totalVestedAccountBalance(address account) external view returns (uint);

    function getVestingQuantity(address account, uint256[] calldata entryIDs) external view returns (uint);

    function getVestingSchedules(
        address account,
        uint256 index,
        uint256 pageSize
    ) external view returns (VestingEntries.VestingEntryWithID[] memory);

    function getAccountVestingEntryIDs(
        address account,
        uint256 index,
        uint256 pageSize
    ) external view returns (uint256[] memory);

    function getVestingEntryClaimable(address account, uint256 entryID) external view returns (uint);

    function getVestingEntry(address account, uint256 entryID) external view returns (uint64, uint256);

    // Mutative functions
    function vest(uint256[] calldata entryIDs) external;

    function createEscrowEntry(
        address beneficiary,
        uint256 deposit,
        uint256 duration
    ) external;

    function appendVestingEntry(
        address account,
        uint256 quantity,
        uint256 duration
    ) external;

    function migrateVestingSchedule(address _addressToMigrate) external;

    function migrateAccountEscrowBalances(
        address[] calldata accounts,
        uint256[] calldata escrowBalances,
        uint256[] calldata vestedBalances
    ) external;

    // Account Merging
    function startMergingWindow() external;

    function mergeAccount(address accountToMerge, uint256[] calldata entryIDs) external;

    function nominateAccountToMerge(address account) external;

    function accountMergingIsOpen() external view returns (bool);

    // L2 Migration
    function importVestingEntries(
        address account,
        uint256 escrowedAmount,
        VestingEntries.VestingEntry[] calldata vestingEntries
    ) external;

    // Return amount of SNX transfered to SynthetixBridgeToOptimism deposit contract
    function burnForMigration(address account, uint256[] calldata entryIDs)
        external
        returns (uint256 escrowedAccountBalance, VestingEntries.VestingEntry[] memory vestingEntries);

    function nextEntryId() external view returns (uint);

    function vestingSchedules(address account, uint256 entryId) external view returns (VestingEntries.VestingEntry memory);

    function accountVestingEntryIDs(address account, uint256 index) external view returns (uint);

    /// below are methods not available in IRewardEscrowV2Frozen

    // revoke entries for liquidations (access controlled to Synthetix)
    function revokeFrom(
        address account,
        address recipient,
        uint targetAmount,
        uint startIndex
    ) external;
}


// Inheritance


// Internal references


contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix {
    // ========== STATE VARIABLES ==========

    // Available Synths which can be used with the system
    string public constant TOKEN_NAME = "Synthetix Network Token";
    string public constant TOKEN_SYMBOL = "SNX";
    uint8 public constant DECIMALS = 18;
    bytes32 public constant sUSD = "sUSD";

    // ========== ADDRESS RESOLVER CONFIGURATION ==========
    bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus";
    bytes32 private constant CONTRACT_EXCHANGER = "Exchanger";
    bytes32 private constant CONTRACT_ISSUER = "Issuer";
    bytes32 private constant CONTRACT_REWARDSDISTRIBUTION = "RewardsDistribution";
    bytes32 private constant CONTRACT_LIQUIDATORREWARDS = "LiquidatorRewards";
    bytes32 private constant CONTRACT_LIQUIDATOR = "Liquidator";
    bytes32 private constant CONTRACT_REWARDESCROW_V2 = "RewardEscrowV2";
    bytes32 private constant CONTRACT_V3_LEGACYMARKET = "LegacyMarket";
    bytes32 private constant CONTRACT_DEBT_MIGRATOR_ON_ETHEREUM = "DebtMigratorOnEthereum";

    // ========== CONSTRUCTOR ==========

    constructor(
        address payable _proxy,
        TokenState _tokenState,
        address _owner,
        uint _totalSupply,
        address _resolver
    )
        public
        ExternStateToken(_proxy, _tokenState, TOKEN_NAME, TOKEN_SYMBOL, _totalSupply, DECIMALS, _owner)
        MixinResolver(_resolver)
    {}

    // ========== VIEWS ==========

    // Note: use public visibility so that it can be invoked in a subclass
    function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
        addresses = new bytes32[](7);
        addresses[0] = CONTRACT_SYSTEMSTATUS;
        addresses[1] = CONTRACT_EXCHANGER;
        addresses[2] = CONTRACT_ISSUER;
        addresses[3] = CONTRACT_REWARDSDISTRIBUTION;
        addresses[4] = CONTRACT_LIQUIDATORREWARDS;
        addresses[5] = CONTRACT_LIQUIDATOR;
        addresses[6] = CONTRACT_REWARDESCROW_V2;
    }

    function systemStatus() internal view returns (ISystemStatus) {
        return ISystemStatus(requireAndGetAddress(CONTRACT_SYSTEMSTATUS));
    }

    function exchanger() internal view returns (IExchanger) {
        return IExchanger(requireAndGetAddress(CONTRACT_EXCHANGER));
    }

    function issuer() internal view returns (IIssuer) {
        return IIssuer(requireAndGetAddress(CONTRACT_ISSUER));
    }

    function rewardsDistribution() internal view returns (IRewardsDistribution) {
        return IRewardsDistribution(requireAndGetAddress(CONTRACT_REWARDSDISTRIBUTION));
    }

    function liquidatorRewards() internal view returns (ILiquidatorRewards) {
        return ILiquidatorRewards(requireAndGetAddress(CONTRACT_LIQUIDATORREWARDS));
    }

    function rewardEscrowV2() internal view returns (IRewardEscrowV2) {
        return IRewardEscrowV2(requireAndGetAddress(CONTRACT_REWARDESCROW_V2));
    }

    function liquidator() internal view returns (ILiquidator) {
        return ILiquidator(requireAndGetAddress(CONTRACT_LIQUIDATOR));
    }

    function debtBalanceOf(address account, bytes32 currencyKey) external view returns (uint) {
        return issuer().debtBalanceOf(account, currencyKey);
    }

    function totalIssuedSynths(bytes32 currencyKey) external view returns (uint) {
        return issuer().totalIssuedSynths(currencyKey, false);
    }

    function totalIssuedSynthsExcludeOtherCollateral(bytes32 currencyKey) external view returns (uint) {
        return issuer().totalIssuedSynths(currencyKey, true);
    }

    function availableCurrencyKeys() external view returns (bytes32[] memory) {
        return issuer().availableCurrencyKeys();
    }

    function availableSynthCount() external view returns (uint) {
        return issuer().availableSynthCount();
    }

    function availableSynths(uint index) external view returns (ISynth) {
        return issuer().availableSynths(index);
    }

    function synths(bytes32 currencyKey) external view returns (ISynth) {
        return issuer().synths(currencyKey);
    }

    function synthsByAddress(address synthAddress) external view returns (bytes32) {
        return issuer().synthsByAddress(synthAddress);
    }

    function isWaitingPeriod(bytes32 currencyKey) external view returns (bool) {
        return exchanger().maxSecsLeftInWaitingPeriod(messageSender, currencyKey) > 0;
    }

    function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid) {
        return issuer().anySynthOrSNXRateIsInvalid();
    }

    function maxIssuableSynths(address account) external view returns (uint maxIssuable) {
        return issuer().maxIssuableSynths(account);
    }

    function remainingIssuableSynths(address account)
        external
        view
        returns (
            uint maxIssuable,
            uint alreadyIssued,
            uint totalSystemDebt
        )
    {
        return issuer().remainingIssuableSynths(account);
    }

    function collateralisationRatio(address _issuer) external view returns (uint) {
        return issuer().collateralisationRatio(_issuer);
    }

    function collateral(address account) external view returns (uint) {
        return issuer().collateral(account);
    }

    function transferableSynthetix(address account) external view returns (uint transferable) {
        (transferable, ) = issuer().transferableSynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account));
    }

    /// the index of the first non zero RewardEscrowV2 entry for an account in order of iteration over accountVestingEntryIDs.
    /// This is intended as a convenience off-chain view for liquidators to calculate the startIndex to pass
    /// into liquidateDelinquentAccountEscrowIndex to save gas.
    function getFirstNonZeroEscrowIndex(address account) external view returns (uint) {
        uint numIds = rewardEscrowV2().numVestingEntries(account);
        uint entryID;
        VestingEntries.VestingEntry memory entry;
        for (uint i = 0; i < numIds; i++) {
            entryID = rewardEscrowV2().accountVestingEntryIDs(account, i);
            entry = rewardEscrowV2().vestingSchedules(account, entryID);
            if (entry.escrowAmount > 0) {
                return i;
            }
        }
        revert("all entries are zero");
    }

    function _canTransfer(address account, uint value) internal view returns (bool) {
        // Always allow legacy market to transfer
        // note if legacy market is not yet available this will just return 0 address and it  will never be true
        address legacyMarketAddress = resolver.getAddress(CONTRACT_V3_LEGACYMARKET);
        if ((messageSender != address(0) && messageSender == legacyMarketAddress) || account == legacyMarketAddress) {
            return true;
        }

        if (issuer().debtBalanceOf(account, sUSD) > 0) {
            (uint transferable, bool anyRateIsInvalid) =
                issuer().transferableSynthetixAndAnyRateIsInvalid(account, tokenState.balanceOf(account));
            require(value <= transferable, "Cannot transfer staked or escrowed SNX");
            require(!anyRateIsInvalid, "A synth or SNX rate is invalid");
        }

        return true;
    }

    // ========== MUTATIVE FUNCTIONS ==========

    function exchange(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey
    ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) {
        (amountReceived, ) = exchanger().exchange(
            messageSender,
            messageSender,
            sourceCurrencyKey,
            sourceAmount,
            destinationCurrencyKey,
            messageSender,
            false,
            messageSender,
            bytes32(0)
        );
    }

    function exchangeOnBehalf(
        address exchangeForAddress,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey
    ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) {
        (amountReceived, ) = exchanger().exchange(
            exchangeForAddress,
            messageSender,
            sourceCurrencyKey,
            sourceAmount,
            destinationCurrencyKey,
            exchangeForAddress,
            false,
            exchangeForAddress,
            bytes32(0)
        );
    }

    function settle(bytes32 currencyKey)
        external
        optionalProxy
        returns (
            uint reclaimed,
            uint refunded,
            uint numEntriesSettled
        )
    {
        return exchanger().settle(messageSender, currencyKey);
    }

    function exchangeWithTracking(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address rewardAddress,
        bytes32 trackingCode
    ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) {
        (amountReceived, ) = exchanger().exchange(
            messageSender,
            messageSender,
            sourceCurrencyKey,
            sourceAmount,
            destinationCurrencyKey,
            messageSender,
            false,
            rewardAddress,
            trackingCode
        );
    }

    function exchangeOnBehalfWithTracking(
        address exchangeForAddress,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address rewardAddress,
        bytes32 trackingCode
    ) external exchangeActive(sourceCurrencyKey, destinationCurrencyKey) optionalProxy returns (uint amountReceived) {
        (amountReceived, ) = exchanger().exchange(
            exchangeForAddress,
            messageSender,
            sourceCurrencyKey,
            sourceAmount,
            destinationCurrencyKey,
            exchangeForAddress,
            false,
            rewardAddress,
            trackingCode
        );
    }

    function transfer(address to, uint value) external onlyProxyOrInternal systemActive returns (bool) {
        // Ensure they're not trying to exceed their locked amount -- only if they have debt.
        _canTransfer(messageSender, value);

        // Perform the transfer: if there is a problem an exception will be thrown in this call.
        _transferByProxy(messageSender, to, value);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint value
    ) external onlyProxyOrInternal systemActive returns (bool) {
        // Ensure they're not trying to exceed their locked amount -- only if they have debt.
        _canTransfer(from, value);

        // Perform the transfer: if there is a problem,
        // an exception will be thrown in this call.
        return _transferFromByProxy(messageSender, from, to, value);
    }

    // SIP-252: migration of SNX token balance from old to new escrow rewards contract
    function migrateEscrowContractBalance() external onlyOwner {
        address from = resolver.requireAndGetAddress("RewardEscrowV2Frozen", "Old escrow address unset");
        // technically the below could use `rewardEscrowV2()`, but in the case of a migration it's better to avoid
        // using the cached value and read the most updated one directly from the resolver
        address to = resolver.requireAndGetAddress("RewardEscrowV2", "New escrow address unset");
        require(to != from, "cannot migrate to same address");

        uint currentBalance = tokenState.balanceOf(from);
        // allow no-op for idempotent migration steps in case action was performed already
        if (currentBalance > 0) {
            _internalTransfer(from, to, currentBalance);
        }
    }

    function issueSynths(uint amount) external issuanceActive optionalProxy {
        return issuer().issueSynths(messageSender, amount);
    }

    function issueSynthsOnBehalf(address issueForAddress, uint amount) external issuanceActive optionalProxy {
        return issuer().issueSynthsOnBehalf(issueForAddress, messageSender, amount);
    }

    function issueMaxSynths() external issuanceActive optionalProxy {
        return issuer().issueMaxSynths(messageSender);
    }

    function issueMaxSynthsOnBehalf(address issueForAddress) external issuanceActive optionalProxy {
        return issuer().issueMaxSynthsOnBehalf(issueForAddress, messageSender);
    }

    function burnSynths(uint amount) external issuanceActive optionalProxy {
        return issuer().burnSynths(messageSender, amount);
    }

    function burnSynthsOnBehalf(address burnForAddress, uint amount) external issuanceActive optionalProxy {
        return issuer().burnSynthsOnBehalf(burnForAddress, messageSender, amount);
    }

    function burnSynthsToTarget() external issuanceActive optionalProxy {
        return issuer().burnSynthsToTarget(messageSender);
    }

    function burnSynthsToTargetOnBehalf(address burnForAddress) external issuanceActive optionalProxy {
        return issuer().burnSynthsToTargetOnBehalf(burnForAddress, messageSender);
    }

    /// @notice Force liquidate a delinquent account and distribute the redeemed SNX rewards amongst the appropriate recipients.
    /// @dev The SNX transfers will revert if the amount to send is more than balanceOf account (i.e. due to escrowed balance).
    function liquidateDelinquentAccount(address account) external systemActive optionalProxy returns (bool) {
        return _liquidateDelinquentAccount(account, 0, messageSender);
    }

    /// @param escrowStartIndex: index into the account's vesting entries list to start iterating from
    /// when liquidating from escrow in order to save gas (the default method uses 0 as default)
    function liquidateDelinquentAccountEscrowIndex(address account, uint escrowStartIndex)
        external
        systemActive
        optionalProxy
        returns (bool)
    {
        return _liquidateDelinquentAccount(account, escrowStartIndex, messageSender);
    }

    /// @notice Force liquidate a delinquent account and distribute the redeemed SNX rewards amongst the appropriate recipients.
    /// @dev The SNX transfers will revert if the amount to send is more than balanceOf account (i.e. due to escrowed balance).
    function _liquidateDelinquentAccount(
        address account,
        uint escrowStartIndex,
        address liquidatorAccount
    ) internal returns (bool) {
        // ensure the user has no liquidation rewards (also counted towards collateral) outstanding
        liquidatorRewards().getReward(account);

        (uint totalRedeemed, uint debtToRemove, uint escrowToLiquidate) = issuer().liquidateAccount(account, false);

        // This transfers the to-be-liquidated part of escrow to the account (!) as liquid SNX.
        // It is transferred to the account instead of to the rewards because of the liquidator / flagger
        // rewards that may need to be paid (so need to be transferrable, to avoid edge cases)
        if (escrowToLiquidate > 0) {
            rewardEscrowV2().revokeFrom(account, account, escrowToLiquidate, escrowStartIndex);
        }

        emitAccountLiquidated(account, totalRedeemed, debtToRemove, liquidatorAccount);

        // First, pay out the flag and liquidate rewards.
        uint flagReward = liquidator().flagReward();
        uint liquidateReward = liquidator().liquidateReward();

        // Transfer the flagReward to the account who flagged this account for liquidation.
        address flagger = liquidator().getLiquidationCallerForAccount(account);
        bool flagRewardTransferSucceeded = _transferByProxy(account, flagger, flagReward);
        require(flagRewardTransferSucceeded, "Flag reward transfer did not succeed");

        // Transfer the liquidateReward to liquidator (the account who invoked this liquidation).
        bool liquidateRewardTransferSucceeded = _transferByProxy(account, liquidatorAccount, liquidateReward);
        require(liquidateRewardTransferSucceeded, "Liquidate reward transfer did not succeed");

        if (totalRedeemed > 0) {
            // Send the remaining SNX to the LiquidatorRewards contract.
            bool liquidatorRewardTransferSucceeded = _transferByProxy(account, address(liquidatorRewards()), totalRedeemed);
            require(liquidatorRewardTransferSucceeded, "Transfer to LiquidatorRewards failed");

            // Inform the LiquidatorRewards contract about the incoming SNX rewards.
            liquidatorRewards().notifyRewardAmount(totalRedeemed);
        }

        return true;
    }

    /// @notice Allows an account to self-liquidate anytime its c-ratio is below the target issuance ratio.
    function liquidateSelf() external systemActive optionalProxy returns (bool) {
        // must store liquidated account address because below functions may attempt to transfer SNX which changes messageSender
        address liquidatedAccount = messageSender;

        // ensure the user has no liquidation rewards (also counted towards collateral) outstanding
        liquidatorRewards().getReward(liquidatedAccount);

        // Self liquidate the account (`isSelfLiquidation` flag must be set to `true`).
        // escrowToLiquidate is unused because it cannot be used for self-liquidations
        (uint totalRedeemed, uint debtRemoved, ) = issuer().liquidateAccount(liquidatedAccount, true);
        require(debtRemoved > 0, "cannot self liquidate");

        emitAccountLiquidated(liquidatedAccount, totalRedeemed, debtRemoved, liquidatedAccount);

        // Transfer the redeemed SNX to the LiquidatorRewards contract.
        // Reverts if amount to redeem is more than balanceOf account (i.e. due to escrowed balance).
        bool success = _transferByProxy(liquidatedAccount, address(liquidatorRewards()), totalRedeemed);
        require(success, "Transfer to LiquidatorRewards failed");

        // Inform the LiquidatorRewards contract about the incoming SNX rewards.
        liquidatorRewards().notifyRewardAmount(totalRedeemed);

        return success;
    }

    /**
     * @notice allows for migration from v2x to v3 when an account has pending escrow entries
     */
    function revokeAllEscrow(address account) external systemActive {
        address legacyMarketAddress = resolver.getAddress(CONTRACT_V3_LEGACYMARKET);
        require(msg.sender == legacyMarketAddress, "Only LegacyMarket can revoke escrow");
        rewardEscrowV2().revokeFrom(account, legacyMarketAddress, rewardEscrowV2().totalEscrowedAccountBalance(account), 0);
    }

    function migrateAccountBalances(address account)
        external
        systemActive
        returns (uint totalEscrowRevoked, uint totalLiquidBalance)
    {
        address debtMigratorOnEthereum = resolver.getAddress(CONTRACT_DEBT_MIGRATOR_ON_ETHEREUM);
        require(msg.sender == debtMigratorOnEthereum, "Only L1 DebtMigrator");

        // get their liquid SNX balance and transfer it to the migrator contract
        totalLiquidBalance = tokenState.balanceOf(account);
        if (totalLiquidBalance > 0) {
            bool succeeded = _transferByProxy(account, debtMigratorOnEthereum, totalLiquidBalance);
            require(succeeded, "snx transfer failed");
        }

        // get their escrowed SNX balance and revoke it all
        totalEscrowRevoked = rewardEscrowV2().totalEscrowedAccountBalance(account);
        if (totalEscrowRevoked > 0) {
            rewardEscrowV2().revokeFrom(account, debtMigratorOnEthereum, totalEscrowRevoked, 0);
        }
    }

    function exchangeWithTrackingForInitiator(
        bytes32,
        uint,
        bytes32,
        address,
        bytes32
    ) external returns (uint) {
        _notImplemented();
    }

    function exchangeWithVirtual(
        bytes32,
        uint,
        bytes32,
        bytes32
    ) external returns (uint, IVirtualSynth) {
        _notImplemented();
    }

    function exchangeAtomically(
        bytes32,
        uint,
        bytes32,
        bytes32,
        uint
    ) external returns (uint) {
        _notImplemented();
    }

    function mint() external returns (bool) {
        _notImplemented();
    }

    function mintSecondary(address, uint) external {
        _notImplemented();
    }

    function mintSecondaryRewards(uint) external {
        _notImplemented();
    }

    function burnSecondary(address, uint) external {
        _notImplemented();
    }

    function _notImplemented() internal pure {
        revert("Cannot be run on this layer");
    }

    // ========== MODIFIERS ==========

    modifier systemActive() {
        _systemActive();
        _;
    }

    function _systemActive() private view {
        systemStatus().requireSystemActive();
    }

    modifier issuanceActive() {
        _issuanceActive();
        _;
    }

    function _issuanceActive() private view {
        systemStatus().requireIssuanceActive();
    }

    modifier exchangeActive(bytes32 src, bytes32 dest) {
        _exchangeActive(src, dest);
        _;
    }

    function _exchangeActive(bytes32 src, bytes32 dest) private view {
        systemStatus().requireExchangeBetweenSynthsAllowed(src, dest);
    }

    modifier onlyExchanger() {
        _onlyExchanger();
        _;
    }

    function _onlyExchanger() private view {
        require(msg.sender == address(exchanger()), "Only Exchanger can invoke this");
    }

    modifier onlyProxyOrInternal {
        _onlyProxyOrInternal();
        _;
    }

    function _onlyProxyOrInternal() internal {
        if (msg.sender == address(proxy)) {
            // allow proxy through, messageSender should be already set correctly
            return;
        } else if (_isInternalTransferCaller(msg.sender)) {
            // optionalProxy behaviour only for the internal legacy contracts
            messageSender = msg.sender;
        } else {
            revert("Only the proxy can call");
        }
    }

    /// some legacy internal contracts use transfer methods directly on implementation
    /// which isn't supported due to SIP-238 for other callers
    function _isInternalTransferCaller(address caller) internal view returns (bool) {
        // These entries are not required or cached in order to allow them to not exist (==address(0))
        // e.g. due to not being available on L2 or at some future point in time.
        return
            // ordered to reduce gas for more frequent calls, bridge first, vesting and migrating after, legacy last
            caller == resolver.getAddress("SynthetixBridgeToOptimism") ||
            caller == resolver.getAddress("RewardEscrowV2") ||
            caller == resolver.getAddress("DebtMigratorOnOptimism") ||
            // legacy contracts
            caller == resolver.getAddress("RewardEscrow") ||
            caller == resolver.getAddress("SynthetixEscrow") ||
            caller == resolver.getAddress("Depot");
    }

    // ========== EVENTS ==========
    event AccountLiquidated(address indexed account, uint snxRedeemed, uint amountLiquidated, address liquidator);
    bytes32 internal constant ACCOUNTLIQUIDATED_SIG = keccak256("AccountLiquidated(address,uint256,uint256,address)");

    function emitAccountLiquidated(
        address account,
        uint256 snxRedeemed,
        uint256 amountLiquidated,
        address liquidator
    ) internal {
        proxy._emit(
            abi.encode(snxRedeemed, amountLiquidated, liquidator),
            2,
            ACCOUNTLIQUIDATED_SIG,
            addressToBytes32(account),
            0,
            0
        );
    }

    event SynthExchange(
        address indexed account,
        bytes32 fromCurrencyKey,
        uint256 fromAmount,
        bytes32 toCurrencyKey,
        uint256 toAmount,
        address toAddress
    );
    bytes32 internal constant SYNTH_EXCHANGE_SIG =
        keccak256("SynthExchange(address,bytes32,uint256,bytes32,uint256,address)");

    function emitSynthExchange(
        address account,
        bytes32 fromCurrencyKey,
        uint256 fromAmount,
        bytes32 toCurrencyKey,
        uint256 toAmount,
        address toAddress
    ) external onlyExchanger {
        proxy._emit(
            abi.encode(fromCurrencyKey, fromAmount, toCurrencyKey, toAmount, toAddress),
            2,
            SYNTH_EXCHANGE_SIG,
            addressToBytes32(account),
            0,
            0
        );
    }

    event ExchangeTracking(bytes32 indexed trackingCode, bytes32 toCurrencyKey, uint256 toAmount, uint256 fee);
    bytes32 internal constant EXCHANGE_TRACKING_SIG = keccak256("ExchangeTracking(bytes32,bytes32,uint256,uint256)");

    function emitExchangeTracking(
        bytes32 trackingCode,
        bytes32 toCurrencyKey,
        uint256 toAmount,
        uint256 fee
    ) external onlyExchanger {
        proxy._emit(abi.encode(toCurrencyKey, toAmount, fee), 2, EXCHANGE_TRACKING_SIG, trackingCode, 0, 0);
    }

    event ExchangeReclaim(address indexed account, bytes32 currencyKey, uint amount);
    bytes32 internal constant EXCHANGERECLAIM_SIG = keccak256("ExchangeReclaim(address,bytes32,uint256)");

    function emitExchangeReclaim(
        address account,
        bytes32 currencyKey,
        uint256 amount
    ) external onlyExchanger {
        proxy._emit(abi.encode(currencyKey, amount), 2, EXCHANGERECLAIM_SIG, addressToBytes32(account), 0, 0);
    }

    event ExchangeRebate(address indexed account, bytes32 currencyKey, uint amount);
    bytes32 internal constant EXCHANGEREBATE_SIG = keccak256("ExchangeRebate(address,bytes32,uint256)");

    function emitExchangeRebate(
        address account,
        bytes32 currencyKey,
        uint256 amount
    ) external onlyExchanger {
        proxy._emit(abi.encode(currencyKey, amount), 2, EXCHANGEREBATE_SIG, addressToBytes32(account), 0, 0);
    }
}


// Inheritance


// https://docs.synthetix.io/contracts/source/contracts/mintablesynthetix
contract MintableSynthetix is BaseSynthetix {
    bytes32 private constant CONTRACT_SYNTHETIX_BRIDGE = "SynthetixBridgeToBase";

    constructor(
        address payable _proxy,
        TokenState _tokenState,
        address _owner,
        uint _totalSupply,
        address _resolver
    ) public BaseSynthetix(_proxy, _tokenState, _owner, _totalSupply, _resolver) {}

    /* ========== INTERNALS =================== */
    function _mintSecondary(address account, uint amount) internal {
        tokenState.setBalanceOf(account, tokenState.balanceOf(account).add(amount));
        emitTransfer(address(this), account, amount);
        totalSupply = totalSupply.add(amount);
    }

    function onlyAllowFromBridge() internal view {
        require(msg.sender == synthetixBridge(), "Can only be invoked by bridge");
    }

    /* ========== MODIFIERS =================== */

    modifier onlyBridge() {
        onlyAllowFromBridge();
        _;
    }

    /* ========== VIEWS ======================= */
    function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
        bytes32[] memory existingAddresses = BaseSynthetix.resolverAddressesRequired();
        bytes32[] memory newAddresses = new bytes32[](1);
        newAddresses[0] = CONTRACT_SYNTHETIX_BRIDGE;
        addresses = combineArrays(existingAddresses, newAddresses);
    }

    function synthetixBridge() internal view returns (address) {
        return requireAndGetAddress(CONTRACT_SYNTHETIX_BRIDGE);
    }

    /* ========== RESTRICTED FUNCTIONS ========== */

    function mintSecondary(address account, uint amount) external onlyBridge {
        _mintSecondary(account, amount);
    }

    function mintSecondaryRewards(uint amount) external onlyBridge {
        IRewardsDistribution _rewardsDistribution = rewardsDistribution();
        _mintSecondary(address(_rewardsDistribution), amount);
        _rewardsDistribution.distributeRewards(amount);
    }

    function burnSecondary(address account, uint amount) external onlyBridge systemActive {
        tokenState.setBalanceOf(account, tokenState.balanceOf(account).sub(amount));
        emitTransfer(account, address(0), amount);
        totalSupply = totalSupply.sub(amount);
    }
}

Contract ABI

[{"inputs":[{"internalType":"address payable","name":"_proxy","type":"address"},{"internalType":"contract TokenState","name":"_tokenState","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"address","name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"snxRedeemed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountLiquidated","type":"uint256"},{"indexed":false,"internalType":"address","name":"liquidator","type":"address"}],"name":"AccountLiquidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"CacheUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ExchangeRebate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ExchangeReclaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"trackingCode","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"toCurrencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"ExchangeTracking","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"proxyAddress","type":"address"}],"name":"ProxyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"fromCurrencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"fromAmount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"toCurrencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"toAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"toAddress","type":"address"}],"name":"SynthExchange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newTokenState","type":"address"}],"name":"TokenStateUpdated","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":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DECIMALS","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TOKEN_SYMBOL","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","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":true,"inputs":[],"name":"anySynthOrSNXRateIsInvalid","outputs":[{"internalType":"bool","name":"anyRateInvalid","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"availableCurrencyKeys","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableSynthCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"availableSynths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSecondary","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"burnForAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"burnSynthsToTarget","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"burnForAddress","type":"address"}],"name":"burnSynthsToTargetOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"collateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"collateralisationRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"debtBalanceOf","outputs":[{"internalType":"uint256","name":"","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":"account","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitExchangeRebate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emitExchangeReclaim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"trackingCode","type":"bytes32"},{"internalType":"bytes32","name":"toCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"toAmount","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"emitExchangeTracking","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"fromCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"bytes32","name":"toCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"toAmount","type":"uint256"},{"internalType":"address","name":"toAddress","type":"address"}],"name":"emitSynthExchange","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"}],"name":"exchange","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"exchangeAtomically","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeForAddress","type":"address"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"}],"name":"exchangeOnBehalf","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeForAddress","type":"address"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"},{"internalType":"address","name":"rewardAddress","type":"address"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"exchangeOnBehalfWithTracking","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"},{"internalType":"address","name":"rewardAddress","type":"address"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"exchangeWithTracking","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"exchangeWithTrackingForInitiator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"exchangeWithVirtual","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"contract IVirtualSynth","name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getFirstNonZeroEscrowIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isResolverCached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"isWaitingPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"issueMaxSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"issueForAddress","type":"address"}],"name":"issueMaxSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issueSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"issueForAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issueSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"liquidateDelinquentAccount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"escrowStartIndex","type":"uint256"}],"name":"liquidateDelinquentAccountEscrowIndex","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"liquidateSelf","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"maxIssuableSynths","outputs":[{"internalType":"uint256","name":"maxIssuable","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"messageSender","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"migrateAccountBalances","outputs":[{"internalType":"uint256","name":"totalEscrowRevoked","type":"uint256"},{"internalType":"uint256","name":"totalLiquidBalance","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"migrateEscrowContractBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintSecondary","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintSecondaryRewards","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proxy","outputs":[{"internalType":"contract Proxy","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebuildCache","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"remainingIssuableSynths","outputs":[{"internalType":"uint256","name":"maxIssuable","type":"uint256"},{"internalType":"uint256","name":"alreadyIssued","type":"uint256"},{"internalType":"uint256","name":"totalSystemDebt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolver","outputs":[{"internalType":"contract AddressResolver","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolverAddressesRequired","outputs":[{"internalType":"bytes32[]","name":"addresses","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"revokeAllEscrow","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"sUSD","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"setMessageSender","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"_proxy","type":"address"}],"name":"setProxy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract TokenState","name":"_tokenState","type":"address"}],"name":"setTokenState","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"settle","outputs":[{"internalType":"uint256","name":"reclaimed","type":"uint256"},{"internalType":"uint256","name":"refunded","type":"uint256"},{"internalType":"uint256","name":"numEntriesSettled","type":"uint256"}],"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":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"synths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"synthAddress","type":"address"}],"name":"synthsByAddress","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenState","outputs":[{"internalType":"contract TokenState","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"totalIssuedSynths","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"totalIssuedSynthsExcludeOtherCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"transferableSynthetix","outputs":[{"internalType":"uint256","name":"transferable","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b5060405162005eb938038062005eb9833981016040819052620000349162000315565b84848484848085856040518060400160405280601781526020017f53796e746865746978204e6574776f726b20546f6b656e000000000000000000815250604051806040016040528060038152602001620a69cb60eb1b81525086601289868160006001600160a01b0316816001600160a01b03161415620000d35760405162461bcd60e51b8152600401620000ca9062000463565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0383161781556040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91620001209184906200042b565b60405180910390a1506000546001600160a01b0316620001545760405162461bcd60e51b8152600401620000ca9062000451565b600280546001600160a01b0319166001600160a01b0383161790556040517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e90620001a19083906200041b565b60405180910390a150600480546001600160a01b0319166001600160a01b0388161790558451620001da90600590602088019062000243565b508351620001f090600690602087019062000243565b50506007919091556008805460ff191660ff90921691909117610100600160a81b0319166101006001600160a01b0397909716969096029590951790945550620004e19c50505050505050505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200028657805160ff1916838001178555620002b6565b82800160010185558215620002b6579182015b82811115620002b657825182559160200191906001019062000299565b50620002c4929150620002c8565b5090565b620002e591905b80821115620002c45760008155600101620002cf565b90565b8051620002f581620004b1565b92915050565b8051620002f581620004cb565b8051620002f581620004d6565b600080600080600060a086880312156200032e57600080fd5b60006200033c8888620002e8565b95505060206200034f88828901620002fb565b94505060406200036288828901620002e8565b9350506060620003758882890162000308565b92505060806200038888828901620002e8565b9150509295509295909350565b620003a081620004a4565b82525050565b620003a0816200047e565b6000620003c060118362000475565b7013dddb995c881b5d5cdd081899481cd95d607a1b815260200192915050565b6000620003ef60198362000475565b7f4f776e657220616464726573732063616e6e6f74206265203000000000000000815260200192915050565b60208101620002f5828462000395565b604081016200043b828562000395565b6200044a6020830184620003a6565b9392505050565b60208082528101620002f581620003b1565b60208082528101620002f581620003e0565b90815260200190565b6000620002f58262000498565b6000620002f5826200047e565b6001600160a01b031690565b6000620002f5826200048b565b620004bc816200047e565b8114620004c857600080fd5b50565b620004bc816200048b565b620004bc81620002e5565b6159c880620004f16000396000f3fe608060405234801561001057600080fd5b50600436106104335760003560e01c80636f01a986116102365780639f7698071161013b578063d37c4d8b116100c3578063e8e09b8b11610087578063e8e09b8b146108c8578063e90dd9e2146108db578063ec556889146108e3578063edef719a146108eb578063ee52a2f3146108fe57610433565b8063d37c4d8b1461087f578063d67bdd2514610892578063d8a1f76f1461089a578063dbf63340146108ad578063dd62ed3e146108b557610433565b8063ace88afd1161010a578063ace88afd1461082b578063af086c7e1461083e578063bc67f83214610846578063c2bf388014610859578063c836fa0a1461086c57610433565b80639f769807146107df578063a311c7c2146107f2578063a5fdc5de14610805578063a9059cbb1461081857610433565b8063899ffef4116101be5780639324cac71161018d5780639324cac7146107a157806395d89b41146107a957806397107d6d146107b15780639741fb22146107c4578063987757dd146107cc57610433565b8063899ffef41461076b5780638a290014146107735780638da5cb5b1461078657806391e56b681461078e57610433565b80637418536011610205578063741853601461071457806379ba50971461071c578063835e119c1461072457806383d625d414610737578063843588431461074a57610433565b80636f01a986146106c6578063704e7b85146106d957806370a08231146106ec57806372cb051f146106ff57610433565b80632c955fa71161033c5780634e99bda9116102c45780635e22846a116102935780635e22846a14610667578063666ed4f11461067a5780636a4277951461068d5780636ac0bf9c146106a05780636c00f310146106b357610433565b80634e99bda914610634578063528c7efb1461063c57806353a47bb7146106445780635af090ef1461065957610433565b8063313ce5671161030b578063313ce567146105e0578063320223db146105e857806332608039146105fb5780633e89b9e51461060e57806344b3e9231461062157610433565b80632c955fa7146105925780632d3169eb146105a55780632e0f2625146105b857806330ead760146105cd57610433565b806316b2213f116103bf57806323b872dd1161038e57806323b872dd146105495780632621716f1461055c578063295da87d1461056f5780632a905318146105825780632af64bd31461058a57610433565b806316b2213f1461051357806318160ddd14610526578063188214001461052e5780631fce304d1461053657610433565b8063095ea7b311610406578063095ea7b3146104955780630e30963c146104b55780631137aedf146104d65780631249c58b146104f85780631627540c1461050057610433565b806303fbc5471461043857806304f3bcec1461044257806305b3c1c91461046057806306fdde0314610480575b600080fd5b610440610911565b005b61044a610afe565b6040516104579190615620565b60405180910390f35b61047361046e36600461435b565b610b12565b6040516104579190615481565b610488610b9f565b604051610457919061562e565b6104a86104a336600461441e565b610c2d565b6040516104579190615473565b6104c86104c3366004614671565b610cba565b604051610457929190615819565b6104e96104e436600461435b565b610cce565b60405161045793929190615525565b6104a8610d63565b61044061050e36600461435b565b610d70565b61047361052136600461435b565b610dce565b610473610e03565b610488610e09565b6104a8610544366004614635565b610e42565b6104a86105573660046143d1565b610ed7565b61047361056a36600461435b565b610f16565b61044061057d366004614635565b6110f7565b610488611178565b6104a8611197565b6104406105a036600461435b565b6112b3565b6104406105b3366004614671565b6112ff565b6105c06113b5565b604051610457919061585c565b6104736105db3660046146b4565b6113ba565b6105c0611478565b6104406105f636600461435b565b611481565b61044a610609366004614635565b6114cd565b61047361061c366004614635565b611552565b61047361062f366004614729565b61158a565b6104a861159d565b6104a861161c565b61064c6117fc565b60405161045791906152dd565b61047361062f3660046146b4565b6104a861067536600461435b565b61180b565b61044061068836600461441e565b611837565b61044061069b36600461435b565b61184d565b6104736106ae36600461435b565b611a06565b6104406106c1366004614568565b611b0e565b6104406106d436600461444e565b611bd0565b6104a86106e736600461441e565b611c89565b6104736106fa36600461435b565b611cb4565b610707611ce6565b6040516104579190615462565b610440611d64565b610440611eb6565b61044a610732366004614635565b611f52565b610473610745366004614635565b611f87565b61075d61075836600461435b565b611fbf565b6040516104579291906154ab565b610707612246565b610440610781366004614635565b6122ba565b61064c612304565b61047361079c3660046144e1565b612313565b6104736123d3565b6104886123de565b6104406107bf36600461435b565b612439565b61044061248c565b6104e96107da366004614635565b612505565b6104406107ed36600461479e565b61257b565b61047361080036600461435b565b6125a7565b61047361081336600461435b565b6125dc565b6104a861082636600461441e565b612611565b61044061083936600461444e565b61265b565b6104406126a8565b61044061085436600461435b565b6126f1565b61044061086736600461441e565b61271b565b61047361087a366004614480565b612769565b61047361088d36600461441e565b612827565b61064c6128ae565b6104406108a8366004614635565b6128bd565b610473612959565b6104736108c3366004614397565b6129d3565b6104406108d636600461441e565b612a07565b61044a612a55565b61044a612a64565b6104406108f936600461441e565b612a73565b61047361090c366004614693565b612b93565b610919612c4f565b60085460405163dacb2d0160e01b815260009161010090046001600160a01b03169063dacb2d019061094d906004016157fb565b60206040518083038186803b15801561096557600080fd5b505afa158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061099d9190810190614379565b60085460405163dacb2d0160e01b81529192506000916101009091046001600160a01b03169063dacb2d01906109d590600401615773565b60206040518083038186803b1580156109ed57600080fd5b505afa158015610a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a259190810190614379565b9050816001600160a01b0316816001600160a01b03161415610a625760405162461bcd60e51b8152600401610a59906157eb565b60405180910390fd5b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a0823191610a94918791016152dd565b60206040518083038186803b158015610aac57600080fd5b505afa158015610ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ae49190810190614653565b90508015610af957610af7838383612c79565b505b505050565b60085461010090046001600160a01b031681565b6000610b1c612e55565b6001600160a01b03166305b3c1c9836040518263ffffffff1660e01b8152600401610b4791906152dd565b60206040518083038186803b158015610b5f57600080fd5b505afa158015610b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b979190810190614653565b90505b919050565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c255780601f10610bfa57610100808354040283529160200191610c25565b820191906000526020600020905b815481529060010190602001808311610c0857829003601f168201915b505050505081565b6000610c37612e69565b60035460048054604051633691826360e21b81526001600160a01b03938416939091169163da46098c91610c71918591899189910161539a565b600060405180830381600087803b158015610c8b57600080fd5b505af1158015610c9f573d6000803e3d6000fd5b50505050610cae818585612ea8565b60019150505b92915050565b600080610cc5612f28565b94509492505050565b6000806000610cdb612e55565b6001600160a01b0316631137aedf856040518263ffffffff1660e01b8152600401610d0691906152dd565b60606040518083038186803b158015610d1e57600080fd5b505afa158015610d32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d56919081019061483a565b9250925092509193909250565b6000610d6d612f28565b90565b610d78612c4f565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290610dc39083906152dd565b60405180910390a150565b6000610dd8612e55565b6001600160a01b03166316b2213f836040518263ffffffff1660e01b8152600401610b4791906152dd565b60075481565b6040518060400160405280601781526020017f53796e746865746978204e6574776f726b20546f6b656e00000000000000000081525081565b600080610e4d612f40565b6003546040516301670a7b60e21b81526001600160a01b039283169263059c29ec92610e80929116908790600401615447565b60206040518083038186803b158015610e9857600080fd5b505afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ed09190810190614653565b1192915050565b6000610ee1612f57565b610ee9612fac565b610ef38483613000565b50600354610f0c906001600160a01b03168585856132d1565b90505b9392505050565b600080610f2161337d565b6001600160a01b031663204b676a846040518263ffffffff1660e01b8152600401610f4c91906152dd565b60206040518083038186803b158015610f6457600080fd5b505afa158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f9c9190810190614653565b90506000610fa8614226565b60005b838110156110de57610fbb61337d565b6001600160a01b031663ae58254987836040518363ffffffff1660e01b8152600401610fe8929190615447565b60206040518083038186803b15801561100057600080fd5b505afa158015611014573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110389190810190614653565b925061104261337d565b6001600160a01b03166345626bd687856040518363ffffffff1660e01b815260040161106f929190615447565b604080518083038186803b15801561108657600080fd5b505afa15801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110be91908101906147bc565b6020810151909250156110d6579350610b9a92505050565b600101610fab565b5060405162461bcd60e51b8152600401610a59906156a9565b6110ff613399565b611107612e69565b61110f612e55565b60035460405163b06e8c6560e01b81526001600160a01b039283169263b06e8c6592611142929116908590600401615447565b600060405180830381600087803b15801561115c57600080fd5b505af1158015611170573d6000803e3d6000fd5b505050505b50565b604051806040016040528060038152602001620a69cb60eb1b81525081565b600060606111a3612246565b905060005b81518110156112aa5760008282815181106111bf57fe5b602090810291909101810151600081815260099092526040918290205460085492516321f8a72160e01b81529193506001600160a01b0390811692610100900416906321f8a72190611215908590600401615481565b60206040518083038186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112659190810190614379565b6001600160a01b031614158061129057506000818152600960205260409020546001600160a01b0316155b156112a15760009350505050610d6d565b506001016111a8565b50600191505090565b6112bb613399565b6112c3612e69565b6112cb612e55565b60035460405163159fa0d560e11b81526001600160a01b0392831692632b3f41aa92611142928692909116906004016152f9565b6113076133d9565b6002546040516001600160a01b039091169063907dff979061133190869086908690602001615525565b604051602081830303815290604052600260405161134e90615265565b6040519081900381206001600160e01b031960e086901b16825261137d9392918a90600090819060040161559f565b600060405180830381600087803b15801561139757600080fd5b505af11580156113ab573d6000803e3d6000fd5b5050505050505050565b601281565b600085846113c88282613411565b6113d0612e69565b6113d8612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d29261141a9291169081908d908d908d9084906000908f908f90600401615314565b6040805180830381600087803b15801561143357600080fd5b505af1158015611447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061146b919081019061480a565b5098975050505050505050565b60085460ff1681565b611489613399565b611491612e69565b611499612e55565b60035460405163fd864ccf60e01b81526001600160a01b039283169263fd864ccf92611142928692909116906004016152f9565b60006114d7612e55565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004016115029190615481565b60206040518083038186803b15801561151a57600080fd5b505afa15801561152e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b979190810190614780565b600061155c612e55565b6001600160a01b0316637b1001b78360016040518363ffffffff1660e01b8152600401610b4792919061549d565b6000611594612f28565b95945050505050565b60006115a7612e55565b6001600160a01b0316634e99bda96040518163ffffffff1660e01b815260040160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116179190810190614617565b905090565b6000611626612fac565b61162e612e69565b6003546001600160a01b0316611642613472565b6001600160a01b031663c00007b0826040518263ffffffff1660e01b815260040161166d91906152dd565b600060405180830381600087803b15801561168757600080fd5b505af115801561169b573d6000803e3d6000fd5b505050506000806116aa612e55565b6001600160a01b03166372c658168460016040518363ffffffff1660e01b81526004016116d892919061542c565b606060405180830381600087803b1580156116f257600080fd5b505af1158015611706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061172a919081019061483a565b50915091506000811161174f5760405162461bcd60e51b8152600401610a59906157a1565b61175b83838386613491565b600061176f84611769613472565b8561350d565b90508061178e5760405162461bcd60e51b8152600401610a5990615746565b611796613472565b6001600160a01b0316633c6b16ab846040518263ffffffff1660e01b81526004016117c19190615481565b600060405180830381600087803b1580156117db57600080fd5b505af11580156117ef573d6000803e3d6000fd5b5092965050505050505090565b6001546001600160a01b031681565b6000611815612fac565b61181d612e69565b600354610b979083906000906001600160a01b031661351a565b61183f61391c565b6118498282613954565b5050565b611855612fac565b6008546040516321f8a72160e01b815260009161010090046001600160a01b0316906321f8a7219061189a906b131959d858de53585c9ad95d60a21b90600401615481565b60206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118ea9190810190614379565b9050336001600160a01b038216146119145760405162461bcd60e51b8152600401610a5990615756565b61191c61337d565b6001600160a01b031663de065f67838361193461337d565b6001600160a01b031663326a3cfb876040518263ffffffff1660e01b815260040161195f91906152dd565b60206040518083038186803b15801561197757600080fd5b505afa15801561198b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506119af9190810190614653565b60006040518563ffffffff1660e01b81526004016119d094939291906153c2565b600060405180830381600087803b1580156119ea57600080fd5b505af11580156119fe573d6000803e3d6000fd5b505050505050565b6000611a10612e55565b600480546040516370a0823160e01b81526001600160a01b0393841693636bed0415938793909116916370a0823191611a4b918591016152dd565b60206040518083038186803b158015611a6357600080fd5b505afa158015611a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611a9b9190810190614653565b6040518363ffffffff1660e01b8152600401611ab8929190615447565b604080518083038186803b158015611acf57600080fd5b505afa158015611ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b0791908101906147da565b5092915050565b611b166133d9565b6002546040516001600160a01b039091169063907dff9790611b4490889088908890889088906020016154d9565b6040516020818303038152906040526002604051611b6190615290565b6040518091039020611b728b613a00565b6000806040518763ffffffff1660e01b8152600401611b969695949392919061559f565b600060405180830381600087803b158015611bb057600080fd5b505af1158015611bc4573d6000803e3d6000fd5b50505050505050505050565b611bd86133d9565b6002546040516001600160a01b039091169063907dff9790611c0090859085906020016154ab565b6040516020818303038152906040526002604051611c1d906152a6565b6040518091039020611c2e88613a00565b6000806040518763ffffffff1660e01b8152600401611c529695949392919061559f565b600060405180830381600087803b158015611c6c57600080fd5b505af1158015611c80573d6000803e3d6000fd5b50505050505050565b6000611c93612fac565b611c9b612e69565b600354610f0f90849084906001600160a01b031661351a565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a0823191610b47918691016152dd565b6060611cf0612e55565b6001600160a01b03166372cb051f6040518163ffffffff1660e01b815260040160006040518083038186803b158015611d2857600080fd5b505afa158015611d3c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261161791908101906145e2565b6060611d6e612246565b905060005b8151811015611849576000828281518110611d8a57fe5b602002602001015190506000600860019054906101000a90046001600160a01b03166001600160a01b031663dacb2d018384604051602001611dcc91906152c7565b6040516020818303038152906040526040518363ffffffff1660e01b8152600401611df89291906154b9565b60206040518083038186803b158015611e1057600080fd5b505afa158015611e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e489190810190614379565b6000838152600960205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa6890611ea4908490849061548f565b60405180910390a15050600101611d73565b6001546001600160a01b03163314611ee05760405162461bcd60e51b8152600401610a599061566c565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92611f23926001600160a01b03918216929116906152f9565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000611f5c612e55565b6001600160a01b031663835e119c836040518263ffffffff1660e01b81526004016115029190615481565b6000611f91612e55565b6001600160a01b0316637b1001b78360006040518363ffffffff1660e01b8152600401610b4792919061549d565b600080611fca612fac565b6008546040516321f8a72160e01b815260009161010090046001600160a01b0316906321f8a721906120199075446562744d69677261746f724f6e457468657265756d60501b90600401615481565b60206040518083038186803b15801561203157600080fd5b505afa158015612045573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120699190810190614379565b9050336001600160a01b038216146120935760405162461bcd60e51b8152600401610a599061563f565b600480546040516370a0823160e01b81526001600160a01b03909116916370a08231916120c2918891016152dd565b60206040518083038186803b1580156120da57600080fd5b505afa1580156120ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121129190810190614653565b9150811561214857600061212785838561350d565b9050806121465760405162461bcd60e51b8152600401610a59906156f6565b505b61215061337d565b6001600160a01b031663326a3cfb856040518263ffffffff1660e01b815260040161217b91906152dd565b60206040518083038186803b15801561219357600080fd5b505afa1580156121a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121cb9190810190614653565b92508215612240576121db61337d565b6001600160a01b031663de065f6785838660006040518563ffffffff1660e01b815260040161220d94939291906153c2565b600060405180830381600087803b15801561222757600080fd5b505af115801561223b573d6000803e3d6000fd5b505050505b50915091565b606080612251613a0c565b60408051600180825281830190925291925060609190602080830190803883390190505090507453796e746865746978427269646765546f4261736560581b8160008151811061229d57fe5b6020026020010181815250506122b38282613b55565b9250505090565b6122c2613399565b6122ca612e69565b6122d2612e55565b6003546040516285c0d160e31b81526001600160a01b039283169263042e068892611142929116908590600401615447565b6000546001600160a01b031681565b600085846123218282613411565b612329612e69565b612331612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d292612374928e92909116908d908d908d9085906000908f908f90600401615314565b6040805180830381600087803b15801561238d57600080fd5b505af11580156123a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506123c5919081019061480a565b509998505050505050505050565b631cd554d160e21b81565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c255780601f10610bfa57610100808354040283529160200191610c25565b612441612c4f565b600280546001600160a01b0319166001600160a01b0383161790556040517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e90610dc39083906152eb565b612494613399565b61249c612e69565b6124a4612e55565b6003546040516324beb82560e11b81526001600160a01b039283169263497d704a926124d5929116906004016152dd565b600060405180830381600087803b1580156124ef57600080fd5b505af1158015610af7573d6000803e3d6000fd5b565b6000806000612512612e69565b61251a612f40565b6003546040516306c5a00b60e21b81526001600160a01b0392831692631b16802c9261254d929116908890600401615447565b606060405180830381600087803b15801561256757600080fd5b505af1158015610d32573d6000803e3d6000fd5b612583613c0a565b600480546001600160a01b0319166001600160a01b03831617905561117581613c78565b60006125b1612e55565b6001600160a01b031663a311c7c2836040518263ffffffff1660e01b8152600401610b4791906152dd565b60006125e6612e55565b6001600160a01b031663a5fdc5de836040518263ffffffff1660e01b8152600401610b4791906152dd565b600061261b612f57565b612623612fac565b600354612639906001600160a01b031683613000565b50600354612651906001600160a01b0316848461350d565b5060019392505050565b6126636133d9565b6002546040516001600160a01b039091169063907dff979061268b90859085906020016154ab565b6040516020818303038152906040526002604051611c1d9061525a565b6126b0613399565b6126b8612e69565b6126c0612e55565b60035460405163644bb89960e11b81526001600160a01b039283169263c8977132926124d5929116906004016152dd565b6126f9613cea565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b612723613399565b61272b612e69565b612733612e55565b600354604051632694552d60e21b81526001600160a01b0392831692639a5154b4926119d092879290911690869060040161539a565b600083826127778282613411565b61277f612e69565b612787612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d2926127ca928c92909116908b908b908b90859060009082908290600401615314565b6040805180830381600087803b1580156127e357600080fd5b505af11580156127f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061281b919081019061480a565b50979650505050505050565b6000612831612e55565b6001600160a01b031663d37c4d8b84846040518363ffffffff1660e01b815260040161285e929190615447565b60206040518083038186803b15801561287657600080fd5b505afa15801561288a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f0f9190810190614653565b6003546001600160a01b031681565b6128c561391c565b60006128cf613d14565b90506128db8183613954565b604051630b32e9c760e31b81526001600160a01b038216906359974e3890612907908590600401615481565b602060405180830381600087803b15801561292157600080fd5b505af1158015612935573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610af99190810190614617565b6000612963612e55565b6001600160a01b031663dbf633406040518163ffffffff1660e01b815260040160206040518083038186803b15801561299b57600080fd5b505afa1580156129af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116179190810190614653565b60048054604051636eb1769f60e11b81526000926001600160a01b039092169163dd62ed3e9161285e9187918791016152f9565b612a0f613399565b612a17612e69565b612a1f612e55565b60035460405163227635b160e11b81526001600160a01b03928316926344ec6b62926119d092879290911690869060040161539a565b6004546001600160a01b031681565b6002546001600160a01b031681565b612a7b61391c565b612a83612fac565b600480546040516370a0823160e01b81526001600160a01b039091169163b46310f6918591612b1e91869186916370a0823191612ac2918791016152dd565b60206040518083038186803b158015612ada57600080fd5b505afa158015612aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612b129190810190614653565b9063ffffffff613d3516565b6040518363ffffffff1660e01b8152600401612b3b929190615447565b600060405180830381600087803b158015612b5557600080fd5b505af1158015612b69573d6000803e3d6000fd5b50505050612b7982600083613d5d565b600754612b8c908263ffffffff613d3516565b6007555050565b60008382612ba18282613411565b612ba9612e69565b612bb1612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d292612bf39291169081908b908b908b90849060009082908290600401615314565b6040805180830381600087803b158015612c0c57600080fd5b505af1158015612c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612c44919081019061480a565b509695505050505050565b6000546001600160a01b031633146125035760405162461bcd60e51b8152600401610a5990615736565b60006001600160a01b03831615801590612c9c57506001600160a01b0383163014155b8015612cb657506002546001600160a01b03848116911614155b612cd25760405162461bcd60e51b8152600401610a599061564f565b600480546040516370a0823160e01b81526001600160a01b039091169163b46310f6918791612d1191879186916370a0823191612ac2918791016152dd565b6040518363ffffffff1660e01b8152600401612d2e929190615447565b600060405180830381600087803b158015612d4857600080fd5b505af1158015612d5c573d6000803e3d6000fd5b5050600480546040516370a0823160e01b81526001600160a01b03909116935063b46310f692508691612dfb91879186916370a0823191612d9f918791016152dd565b60206040518083038186803b158015612db757600080fd5b505afa158015612dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612def9190810190614653565b9063ffffffff613da016565b6040518363ffffffff1660e01b8152600401612e18929190615447565b600060405180830381600087803b158015612e3257600080fd5b505af1158015612e46573d6000803e3d6000fd5b50505050612651848484613d5d565b60006116176524b9b9bab2b960d11b613dc5565b6002546001600160a01b03163314801590612e8f57506003546001600160a01b03163314155b1561250357600380546001600160a01b03191633179055565b6002546040516001600160a01b039091169063907dff9790612ece908490602001615481565b6040516020818303038152906040526003604051612eeb9061529b565b6040518091039020612efc88613a00565b612f0588613a00565b60006040518763ffffffff1660e01b8152600401611c52969594939291906155d9565b60405162461bcd60e51b8152600401610a5990615706565b60006116176822bc31b430b733b2b960b91b613dc5565b6002546001600160a01b0316331415612f6f57612503565b612f7833613e22565b15612f9457600380546001600160a01b03191633179055612503565b60405162461bcd60e51b8152600401610a59906157ce565b612fb46141d1565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b158015612fec57600080fd5b505afa158015610af7573d6000803e3d6000fd5b6008546040516321f8a72160e01b815260009182916101009091046001600160a01b0316906321f8a72190613048906b131959d858de53585c9ad95d60a21b90600401615481565b60206040518083038186803b15801561306057600080fd5b505afa158015613074573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506130989190810190614379565b6003549091506001600160a01b0316158015906130c257506003546001600160a01b038281169116145b806130de5750806001600160a01b0316846001600160a01b0316145b156130ed576001915050610cb4565b60006130f7612e55565b6001600160a01b031663d37c4d8b86631cd554d160e21b6040518363ffffffff1660e01b815260040161312b929190615447565b60206040518083038186803b15801561314357600080fd5b505afa158015613157573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061317b9190810190614653565b1115610cae5760008061318c612e55565b600480546040516370a0823160e01b81526001600160a01b0393841693636bed0415938b93909116916370a08231916131c7918591016152dd565b60206040518083038186803b1580156131df57600080fd5b505afa1580156131f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506132179190810190614653565b6040518363ffffffff1660e01b8152600401613234929190615447565b604080518083038186803b15801561324b57600080fd5b505afa15801561325f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061328391908101906147da565b91509150818511156132a75760405162461bcd60e51b8152600401610a5990615716565b80156132c55760405162461bcd60e51b8152600401610a5990615726565b50600195945050505050565b60048054604051636eb1769f60e11b81526000926001600160a01b039092169163da46098c9187918991613317918891879163dd62ed3e91612ac29188918891016152f9565b6040518463ffffffff1660e01b81526004016133359392919061539a565b600060405180830381600087803b15801561334f57600080fd5b505af1158015613363573d6000803e3d6000fd5b50505050613372848484612c79565b90505b949350505050565b60006116176d2932bbb0b93222b9b1b937bbab1960911b613dc5565b6133a16141d1565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b158015612fec57600080fd5b6133e1612f40565b6001600160a01b0316336001600160a01b0316146125035760405162461bcd60e51b8152600401610a5990615699565b6134196141d1565b6001600160a01b0316631ce00ba283836040518363ffffffff1660e01b81526004016134469291906154ab565b60006040518083038186803b15801561345e57600080fd5b505afa1580156119fe573d6000803e3d6000fd5b6000611617704c697175696461746f725265776172647360781b613dc5565b6002546040516001600160a01b039091169063907dff97906134bb90869086908690602001615834565b60405160208183030381529060405260026040516134d8906152bc565b60405180910390206134e989613a00565b6000806040518763ffffffff1660e01b815260040161137d9695949392919061559f565b6000610f0c848484612c79565b6000613524613472565b6001600160a01b031663c00007b0856040518263ffffffff1660e01b815260040161354f91906152dd565b600060405180830381600087803b15801561356957600080fd5b505af115801561357d573d6000803e3d6000fd5b50505050600080600061358e612e55565b6001600160a01b03166372c658168860006040518363ffffffff1660e01b81526004016135bc92919061542c565b606060405180830381600087803b1580156135d657600080fd5b505af11580156135ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061360e919081019061483a565b9194509250905080156136875761362361337d565b6001600160a01b031663de065f678889848a6040518563ffffffff1660e01b815260040161365494939291906153f7565b600060405180830381600087803b15801561366e57600080fd5b505af1158015613682573d6000803e3d6000fd5b505050505b61369387848488613491565b600061369d6141eb565b6001600160a01b0316638074b3726040518163ffffffff1660e01b815260040160206040518083038186803b1580156136d557600080fd5b505afa1580156136e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061370d9190810190614653565b905060006137196141eb565b6001600160a01b03166331e4e0306040518163ffffffff1660e01b815260040160206040518083038186803b15801561375157600080fd5b505afa158015613765573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506137899190810190614653565b905060006137956141eb565b6001600160a01b0316635616c9578b6040518263ffffffff1660e01b81526004016137c091906152dd565b60206040518083038186803b1580156137d857600080fd5b505afa1580156137ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506138109190810190614379565b9050600061381f8b838661350d565b90508061383e5760405162461bcd60e51b8152600401610a59906156c9565b600061384b8c8b8661350d565b90508061386a5760405162461bcd60e51b8152600401610a5990615791565b871561390a5760006138848d61387e613472565b8b61350d565b9050806138a35760405162461bcd60e51b8152600401610a5990615746565b6138ab613472565b6001600160a01b0316633c6b16ab8a6040518263ffffffff1660e01b81526004016138d69190615481565b600060405180830381600087803b1580156138f057600080fd5b505af1158015613904573d6000803e3d6000fd5b50505050505b5060019b9a5050505050505050505050565b613924614203565b6001600160a01b0316336001600160a01b0316146125035760405162461bcd60e51b8152600401610a59906157be565b600480546040516370a0823160e01b81526001600160a01b039091169163b46310f691859161399391869186916370a0823191612d9f918791016152dd565b6040518363ffffffff1660e01b81526004016139b0929190615447565b600060405180830381600087803b1580156139ca57600080fd5b505af11580156139de573d6000803e3d6000fd5b505050506139ed308383613d5d565b600754612b8c908263ffffffff613da016565b6001600160a01b031690565b60408051600780825261010082019092526060916020820160e0803883390190505090506b53797374656d53746174757360a01b81600081518110613a4d57fe5b6020026020010181815250506822bc31b430b733b2b960b91b81600181518110613a7357fe5b6020026020010181815250506524b9b9bab2b960d11b81600281518110613a9657fe5b602002602001018181525050722932bbb0b93239a234b9ba3934b13aba34b7b760691b81600381518110613ac657fe5b602002602001018181525050704c697175696461746f725265776172647360781b81600481518110613af457fe5b602002602001018181525050692634b8bab4b230ba37b960b11b81600581518110613b1b57fe5b6020026020010181815250506d2932bbb0b93222b9b1b937bbab1960911b81600681518110613b4657fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015613b85578160200160208202803883390190505b50905060005b8351811015613bc757838181518110613ba057fe5b6020026020010151828281518110613bb457fe5b6020908102919091010152600101613b8b565b5060005b8251811015611b0757828181518110613be057fe5b6020026020010151828286510181518110613bf757fe5b6020908102919091010152600101613bcb565b6002546001600160a01b03163314801590613c3057506003546001600160a01b03163314155b15613c4857600380546001600160a01b031916331790555b6000546003546001600160a01b039081169116146125035760405162461bcd60e51b8152600401610a5990615689565b6002546040516001600160a01b039091169063907dff9790613c9e9084906020016152dd565b6040516020818303038152906040526001604051613cbb906152b1565b6040519081900381206001600160e01b031960e086901b16825261114293929160009081908190600401615540565b6002546001600160a01b031633146125035760405162461bcd60e51b8152600401610a59906157ce565b6000611617722932bbb0b93239a234b9ba3934b13aba34b7b760691b613dc5565b600082821115613d575760405162461bcd60e51b8152600401610a59906156e6565b50900390565b6002546040516001600160a01b039091169063907dff9790613d83908490602001615481565b6040516020818303038152906040526003604051612eeb906152d2565b600082820183811015610f0f5760405162461bcd60e51b8152600401610a59906156b9565b60008181526009602090815260408083205490516001600160a01b039091169182151591613df591869101615270565b60405160208183030381529060405290611b075760405162461bcd60e51b8152600401610a59919061562e565b6008546040516321f8a72160e01b815260009161010090046001600160a01b0316906321f8a72190613e56906004016157de565b60206040518083038186803b158015613e6e57600080fd5b505afa158015613e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613ea69190810190614379565b6001600160a01b0316826001600160a01b03161480613f5757506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a72190613ef290600401615766565b60206040518083038186803b158015613f0a57600080fd5b505afa158015613f1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613f429190810190614379565b6001600160a01b0316826001600160a01b0316145b80613ff457506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a72190613f8f9060040161565f565b60206040518083038186803b158015613fa757600080fd5b505afa158015613fbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613fdf9190810190614379565b6001600160a01b0316826001600160a01b0316145b8061409157506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a7219061402c906004016156d9565b60206040518083038186803b15801561404457600080fd5b505afa158015614058573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061407c9190810190614379565b6001600160a01b0316826001600160a01b0316145b8061412e57506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a721906140c99060040161567c565b60206040518083038186803b1580156140e157600080fd5b505afa1580156140f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506141199190810190614379565b6001600160a01b0316826001600160a01b0316145b80610b9757506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a72190614166906004016157b1565b60206040518083038186803b15801561417e57600080fd5b505afa158015614192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506141b69190810190614379565b6001600160a01b0316826001600160a01b0316149050919050565b60006116176b53797374656d53746174757360a01b613dc5565b6000611617692634b8bab4b230ba37b960b11b613dc5565b60006116177453796e746865746978427269646765546f4261736560581b613dc5565b604080518082019091526000808252602082015290565b8035610cb48161594d565b8051610cb48161594d565b600082601f83011261426457600080fd5b815161427761427282615891565b61586a565b9150818183526020840193506020810190508385602084028201111561429c57600080fd5b60005b838110156142c857816142b288826142e8565b845250602092830192919091019060010161429f565b5050505092915050565b8051610cb481615961565b8035610cb48161596a565b8051610cb48161596a565b8051610cb481615973565b8035610cb481615973565b60006040828403121561431b57600080fd5b614325604061586a565b905060006143338484614350565b8252506020614344848483016142e8565b60208301525092915050565b8051610cb48161597c565b60006020828403121561436d57600080fd5b6000613375848461423d565b60006020828403121561438b57600080fd5b60006133758484614248565b600080604083850312156143aa57600080fd5b60006143b6858561423d565b92505060206143c78582860161423d565b9150509250929050565b6000806000606084860312156143e657600080fd5b60006143f2868661423d565b93505060206144038682870161423d565b9250506040614414868287016142dd565b9150509250925092565b6000806040838503121561443157600080fd5b600061443d858561423d565b92505060206143c7858286016142dd565b60008060006060848603121561446357600080fd5b600061446f868661423d565b9350506020614403868287016142dd565b6000806000806080858703121561449657600080fd5b60006144a2878761423d565b94505060206144b3878288016142dd565b93505060406144c4878288016142dd565b92505060606144d5878288016142dd565b91505092959194509250565b60008060008060008060c087890312156144fa57600080fd5b6000614506898961423d565b965050602061451789828a016142dd565b955050604061452889828a016142dd565b945050606061453989828a016142dd565b935050608061454a89828a0161423d565b92505060a061455b89828a016142dd565b9150509295509295509295565b60008060008060008060c0878903121561458157600080fd5b600061458d898961423d565b965050602061459e89828a016142dd565b95505060406145af89828a016142dd565b94505060606145c089828a016142dd565b93505060806145d189828a016142dd565b92505060a061455b89828a0161423d565b6000602082840312156145f457600080fd5b815167ffffffffffffffff81111561460b57600080fd5b61337584828501614253565b60006020828403121561462957600080fd5b600061337584846142d2565b60006020828403121561464757600080fd5b600061337584846142dd565b60006020828403121561466557600080fd5b600061337584846142e8565b6000806000806080858703121561468757600080fd5b60006144a287876142dd565b6000806000606084860312156146a857600080fd5b600061446f86866142dd565b600080600080600060a086880312156146cc57600080fd5b60006146d888886142dd565b95505060206146e9888289016142dd565b94505060406146fa888289016142dd565b935050606061470b8882890161423d565b925050608061471c888289016142dd565b9150509295509295909350565b600080600080600060a0868803121561474157600080fd5b600061474d88886142dd565b955050602061475e888289016142dd565b945050604061476f888289016142dd565b935050606061470b888289016142dd565b60006020828403121561479257600080fd5b600061337584846142f3565b6000602082840312156147b057600080fd5b600061337584846142fe565b6000604082840312156147ce57600080fd5b60006133758484614309565b600080604083850312156147ed57600080fd5b60006147f985856142e8565b92505060206143c7858286016142d2565b6000806040838503121561481d57600080fd5b600061482985856142e8565b92505060206143c7858286016142f3565b60008060006060848603121561484f57600080fd5b600061485b86866142e8565b935050602061486c868287016142e8565b9250506040614414868287016142e8565b6000614889838361490b565b505060200190565b61489a816158f3565b82525050565b61489a816158c5565b60006148b4826158b8565b6148be81856158bc565b93506148c9836158b2565b8060005b838110156148f75781516148e1888261487d565b97506148ec836158b2565b9250506001016148cd565b509495945050505050565b61489a816158d0565b61489a81610d6d565b61489a61492082610d6d565b610d6d565b6000614930826158b8565b61493a81856158bc565b935061494a818560208601615917565b61495381615943565b9093019392505050565b61489a816158d5565b61489a816158fe565b61489a8161590c565b60006149856014836158bc565b7327b7363c902618902232b13a26b4b3b930ba37b960611b815260200192915050565b60006149b5601f836158bc565b7f43616e6e6f74207472616e7366657220746f2074686973206164647265737300815260200192915050565b75446562744d69677261746f724f6e4f7074696d69736d60501b9052565b6000614a0c6035836158bc565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b6e53796e746865746978457363726f7760881b9052565b6000614a7a6013836158bc565b7227bbb732b91037b7363c90333ab731ba34b7b760691b815260200192915050565b6000614aa9601e836158bc565b7f4f6e6c792045786368616e6765722063616e20696e766f6b6520746869730000815260200192915050565b6000614ae26014836158bc565b73616c6c20656e747269657320617265207a65726f60601b815260200192915050565b6000614b12601b836158bc565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000614b4b6024836158bc565b7f466c616720726577617264207472616e7366657220646964206e6f742073756381526318d9595960e21b602082015260400192915050565b6b526577617264457363726f7760a01b9052565b6000614ba56018836158bc565b7f4e657720657363726f77206164647265737320756e7365740000000000000000815260200192915050565b6000614bde602883610b9a565b7f45786368616e67655265636c61696d28616464726573732c627974657333322c81526775696e743235362960c01b602082015260280192915050565b6000614c28601e836158bc565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000614c616013836158bc565b721cdb9e081d1c985b9cd9995c8819985a5b1959606a1b815260200192915050565b6000614c90601b836158bc565b7f43616e6e6f742062652072756e206f6e2074686973206c617965720000000000815260200192915050565b6000614cc9603183610b9a565b7f45786368616e6765547261636b696e6728627974657333322c627974657333328152702c75696e743235362c75696e743235362960781b602082015260310192915050565b6000614d1c601183610b9a565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b6000614d49603e83610b9a565b7f53796e746845786368616e676528616464726573732c627974657333322c756981527f6e743235362c627974657333322c75696e743235362c616464726573732900006020820152603e0192915050565b6000614da86026836158bc565b7f43616e6e6f74207472616e73666572207374616b6564206f7220657363726f778152650cac840a69cb60d31b602082015260400192915050565b6000614df0601e836158bc565b7f412073796e7468206f7220534e58207261746520697320696e76616c69640000815260200192915050565b6000614e29602f836158bc565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b6000614e7a6024836158bc565b7f5472616e7366657220746f204c697175696461746f72526577617264732066618152631a5b195960e21b602082015260400192915050565b6000614ec0602183610b9a565b7f417070726f76616c28616464726573732c616464726573732c75696e743235368152602960f81b602082015260210192915050565b6000614f03602783610b9a565b7f45786368616e676552656261746528616464726573732c627974657333322c75815266696e743235362960c81b602082015260270192915050565b6000614f4c601a83610b9a565b7f546f6b656e5374617465557064617465642861646472657373290000000000008152601a0192915050565b6000614f856023836158bc565b7f4f6e6c79204c65676163794d61726b65742063616e207265766f6b6520657363815262726f7760e81b602082015260400192915050565b6000614fca603283610b9a565b7f4163636f756e744c69717569646174656428616464726573732c75696e743235815271362c75696e743235362c616464726573732960701b602082015260320192915050565b6d2932bbb0b93222b9b1b937bbab1960911b9052565b6000615034601983610b9a565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b600061506d6029836158bc565b7f4c697175696461746520726577617264207472616e7366657220646964206e6f8152681d081cdd58d8d9595960ba1b602082015260400192915050565b60006150b86015836158bc565b7463616e6e6f742073656c66206c697175696461746560581b815260200192915050565b6411195c1bdd60da1b9052565b60006150f6601d836158bc565b7f43616e206f6e6c7920626520696e766f6b656420627920627269646765000000815260200192915050565b600061512f6018836158bc565b7f4f6c6420657363726f77206164647265737320756e7365740000000000000000815260200192915050565b6000615168602183610b9a565b7f5472616e7366657228616464726573732c616464726573732c75696e743235368152602960f81b602082015260210192915050565b60006151ab6017836158bc565b7f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000815260200192915050565b7f53796e746865746978427269646765546f4f7074696d69736d000000000000009052565b6000615209601e836158bc565b7f63616e6e6f74206d69677261746520746f2073616d6520616464726573730000815260200192915050565b732932bbb0b93222b9b1b937bbab19233937bd32b760611b9052565b61489a816158ed565b6000610cb482614bd1565b6000610cb482614cbc565b600061527b82614d0f565b91506152878284614914565b50602001919050565b6000610cb482614d3c565b6000610cb482614eb3565b6000610cb482614ef6565b6000610cb482614f3f565b6000610cb482614fbd565b600061527b82615027565b6000610cb48261515b565b60208101610cb482846148a0565b60208101610cb48284614891565b6040810161530782856148a0565b610f0f60208301846148a0565b6101208101615323828c6148a0565b615330602083018b6148a0565b61533d604083018a61490b565b61534a606083018961490b565b615357608083018861490b565b61536460a08301876148a0565b61537160c0830186614902565b61537e60e08301856148a0565b61538c61010083018461490b565b9a9950505050505050505050565b606081016153a882866148a0565b6153b560208301856148a0565b613375604083018461490b565b608081016153d082876148a0565b6153dd60208301866148a0565b6153ea604083018561490b565b611594606083018461496f565b6080810161540582876148a0565b61541260208301866148a0565b61541f604083018561490b565b611594606083018461490b565b6040810161543a82856148a0565b610f0f6020830184614902565b6040810161545582856148a0565b610f0f602083018461490b565b60208082528101610f0f81846148a9565b60208101610cb48284614902565b60208101610cb4828461490b565b60408101615307828561490b565b6040810161543a828561490b565b60408101615455828561490b565b604081016154c7828561490b565b8181036020830152610f0c8184614925565b60a081016154e7828861490b565b6154f4602083018761490b565b615501604083018661490b565b61550e606083018561490b565b61551b60808301846148a0565b9695505050505050565b60608101615533828661490b565b6153b5602083018561490b565b60c080825281016155518189614925565b9050615560602083018861496f565b61556d604083018761490b565b61557a6060830186614966565b6155876080830185614966565b61559460a0830184614966565b979650505050505050565b60c080825281016155b08189614925565b90506155bf602083018861496f565b6155cc604083018761490b565b61557a606083018661490b565b60c080825281016155ea8189614925565b90506155f9602083018861496f565b615606604083018761490b565b615613606083018661490b565b615587608083018561490b565b60208101610cb4828461495d565b60208082528101610f0f8184614925565b60208082528101610b9781614978565b60208082528101610b97816149a8565b60208101610b9a826149e1565b60208082528101610b97816149ff565b60208101610b9a82614a56565b60208082528101610b9781614a6d565b60208082528101610b9781614a9c565b60208082528101610b9781614ad5565b60208082528101610b9781614b05565b60208082528101610b9781614b3e565b60208101610b9a82614b84565b60208082528101610b9781614c1b565b60208082528101610b9781614c54565b60208082528101610b9781614c83565b60208082528101610b9781614d9b565b60208082528101610b9781614de3565b60208082528101610b9781614e1c565b60208082528101610b9781614e6d565b60208082528101610b9781614f78565b60208101610b9a82615011565b6040810161578082615011565b8181036020830152610b9781614b98565b60208082528101610b9781615060565b60208082528101610b97816150ab565b60208101610b9a826150dc565b60208082528101610b97816150e9565b60208082528101610b978161519e565b60208101610b9a826151d7565b60208082528101610b97816151fc565b6040810161580882615235565b8181036020830152610b9781615122565b60408101615827828561490b565b610f0f602083018461495d565b60608101615842828661490b565b61584f602083018561490b565b61337560408301846148a0565b60208101610cb48284615251565b60405181810167ffffffffffffffff8111828210171561588957600080fd5b604052919050565b600067ffffffffffffffff8211156158a857600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b6000610b9782613a00565b151590565b6000610b97826158c5565b67ffffffffffffffff1690565b60ff1690565b6000610b97826158d5565b6000610b9761492083610d6d565b6000610b9782610d6d565b60005b8381101561593257818101518382015260200161591a565b83811115610af75750506000910152565b601f01601f191690565b615956816158c5565b811461117557600080fd5b615956816158d0565b61595681610d6d565b615956816158d5565b615956816158e056fea365627a7a723158204837232e73f4cbd89de7e6e9b4d87a751a02c8049bde05904471a8b86ee6a8fd6c6578706572696d656e74616cf564736f6c63430005100040000000000000000000000000b409b21634f356cb3372f077920ecdd4017abfc6000000000000000000000000e851b0a420074f4db3bfcac03722a7ccab81867600000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000529c553ef2d0370279dc8abf19702b98b166d252

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106104335760003560e01c80636f01a986116102365780639f7698071161013b578063d37c4d8b116100c3578063e8e09b8b11610087578063e8e09b8b146108c8578063e90dd9e2146108db578063ec556889146108e3578063edef719a146108eb578063ee52a2f3146108fe57610433565b8063d37c4d8b1461087f578063d67bdd2514610892578063d8a1f76f1461089a578063dbf63340146108ad578063dd62ed3e146108b557610433565b8063ace88afd1161010a578063ace88afd1461082b578063af086c7e1461083e578063bc67f83214610846578063c2bf388014610859578063c836fa0a1461086c57610433565b80639f769807146107df578063a311c7c2146107f2578063a5fdc5de14610805578063a9059cbb1461081857610433565b8063899ffef4116101be5780639324cac71161018d5780639324cac7146107a157806395d89b41146107a957806397107d6d146107b15780639741fb22146107c4578063987757dd146107cc57610433565b8063899ffef41461076b5780638a290014146107735780638da5cb5b1461078657806391e56b681461078e57610433565b80637418536011610205578063741853601461071457806379ba50971461071c578063835e119c1461072457806383d625d414610737578063843588431461074a57610433565b80636f01a986146106c6578063704e7b85146106d957806370a08231146106ec57806372cb051f146106ff57610433565b80632c955fa71161033c5780634e99bda9116102c45780635e22846a116102935780635e22846a14610667578063666ed4f11461067a5780636a4277951461068d5780636ac0bf9c146106a05780636c00f310146106b357610433565b80634e99bda914610634578063528c7efb1461063c57806353a47bb7146106445780635af090ef1461065957610433565b8063313ce5671161030b578063313ce567146105e0578063320223db146105e857806332608039146105fb5780633e89b9e51461060e57806344b3e9231461062157610433565b80632c955fa7146105925780632d3169eb146105a55780632e0f2625146105b857806330ead760146105cd57610433565b806316b2213f116103bf57806323b872dd1161038e57806323b872dd146105495780632621716f1461055c578063295da87d1461056f5780632a905318146105825780632af64bd31461058a57610433565b806316b2213f1461051357806318160ddd14610526578063188214001461052e5780631fce304d1461053657610433565b8063095ea7b311610406578063095ea7b3146104955780630e30963c146104b55780631137aedf146104d65780631249c58b146104f85780631627540c1461050057610433565b806303fbc5471461043857806304f3bcec1461044257806305b3c1c91461046057806306fdde0314610480575b600080fd5b610440610911565b005b61044a610afe565b6040516104579190615620565b60405180910390f35b61047361046e36600461435b565b610b12565b6040516104579190615481565b610488610b9f565b604051610457919061562e565b6104a86104a336600461441e565b610c2d565b6040516104579190615473565b6104c86104c3366004614671565b610cba565b604051610457929190615819565b6104e96104e436600461435b565b610cce565b60405161045793929190615525565b6104a8610d63565b61044061050e36600461435b565b610d70565b61047361052136600461435b565b610dce565b610473610e03565b610488610e09565b6104a8610544366004614635565b610e42565b6104a86105573660046143d1565b610ed7565b61047361056a36600461435b565b610f16565b61044061057d366004614635565b6110f7565b610488611178565b6104a8611197565b6104406105a036600461435b565b6112b3565b6104406105b3366004614671565b6112ff565b6105c06113b5565b604051610457919061585c565b6104736105db3660046146b4565b6113ba565b6105c0611478565b6104406105f636600461435b565b611481565b61044a610609366004614635565b6114cd565b61047361061c366004614635565b611552565b61047361062f366004614729565b61158a565b6104a861159d565b6104a861161c565b61064c6117fc565b60405161045791906152dd565b61047361062f3660046146b4565b6104a861067536600461435b565b61180b565b61044061068836600461441e565b611837565b61044061069b36600461435b565b61184d565b6104736106ae36600461435b565b611a06565b6104406106c1366004614568565b611b0e565b6104406106d436600461444e565b611bd0565b6104a86106e736600461441e565b611c89565b6104736106fa36600461435b565b611cb4565b610707611ce6565b6040516104579190615462565b610440611d64565b610440611eb6565b61044a610732366004614635565b611f52565b610473610745366004614635565b611f87565b61075d61075836600461435b565b611fbf565b6040516104579291906154ab565b610707612246565b610440610781366004614635565b6122ba565b61064c612304565b61047361079c3660046144e1565b612313565b6104736123d3565b6104886123de565b6104406107bf36600461435b565b612439565b61044061248c565b6104e96107da366004614635565b612505565b6104406107ed36600461479e565b61257b565b61047361080036600461435b565b6125a7565b61047361081336600461435b565b6125dc565b6104a861082636600461441e565b612611565b61044061083936600461444e565b61265b565b6104406126a8565b61044061085436600461435b565b6126f1565b61044061086736600461441e565b61271b565b61047361087a366004614480565b612769565b61047361088d36600461441e565b612827565b61064c6128ae565b6104406108a8366004614635565b6128bd565b610473612959565b6104736108c3366004614397565b6129d3565b6104406108d636600461441e565b612a07565b61044a612a55565b61044a612a64565b6104406108f936600461441e565b612a73565b61047361090c366004614693565b612b93565b610919612c4f565b60085460405163dacb2d0160e01b815260009161010090046001600160a01b03169063dacb2d019061094d906004016157fb565b60206040518083038186803b15801561096557600080fd5b505afa158015610979573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061099d9190810190614379565b60085460405163dacb2d0160e01b81529192506000916101009091046001600160a01b03169063dacb2d01906109d590600401615773565b60206040518083038186803b1580156109ed57600080fd5b505afa158015610a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610a259190810190614379565b9050816001600160a01b0316816001600160a01b03161415610a625760405162461bcd60e51b8152600401610a59906157eb565b60405180910390fd5b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a0823191610a94918791016152dd565b60206040518083038186803b158015610aac57600080fd5b505afa158015610ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ae49190810190614653565b90508015610af957610af7838383612c79565b505b505050565b60085461010090046001600160a01b031681565b6000610b1c612e55565b6001600160a01b03166305b3c1c9836040518263ffffffff1660e01b8152600401610b4791906152dd565b60206040518083038186803b158015610b5f57600080fd5b505afa158015610b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b979190810190614653565b90505b919050565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c255780601f10610bfa57610100808354040283529160200191610c25565b820191906000526020600020905b815481529060010190602001808311610c0857829003601f168201915b505050505081565b6000610c37612e69565b60035460048054604051633691826360e21b81526001600160a01b03938416939091169163da46098c91610c71918591899189910161539a565b600060405180830381600087803b158015610c8b57600080fd5b505af1158015610c9f573d6000803e3d6000fd5b50505050610cae818585612ea8565b60019150505b92915050565b600080610cc5612f28565b94509492505050565b6000806000610cdb612e55565b6001600160a01b0316631137aedf856040518263ffffffff1660e01b8152600401610d0691906152dd565b60606040518083038186803b158015610d1e57600080fd5b505afa158015610d32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d56919081019061483a565b9250925092509193909250565b6000610d6d612f28565b90565b610d78612c4f565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290610dc39083906152dd565b60405180910390a150565b6000610dd8612e55565b6001600160a01b03166316b2213f836040518263ffffffff1660e01b8152600401610b4791906152dd565b60075481565b6040518060400160405280601781526020017f53796e746865746978204e6574776f726b20546f6b656e00000000000000000081525081565b600080610e4d612f40565b6003546040516301670a7b60e21b81526001600160a01b039283169263059c29ec92610e80929116908790600401615447565b60206040518083038186803b158015610e9857600080fd5b505afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ed09190810190614653565b1192915050565b6000610ee1612f57565b610ee9612fac565b610ef38483613000565b50600354610f0c906001600160a01b03168585856132d1565b90505b9392505050565b600080610f2161337d565b6001600160a01b031663204b676a846040518263ffffffff1660e01b8152600401610f4c91906152dd565b60206040518083038186803b158015610f6457600080fd5b505afa158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f9c9190810190614653565b90506000610fa8614226565b60005b838110156110de57610fbb61337d565b6001600160a01b031663ae58254987836040518363ffffffff1660e01b8152600401610fe8929190615447565b60206040518083038186803b15801561100057600080fd5b505afa158015611014573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110389190810190614653565b925061104261337d565b6001600160a01b03166345626bd687856040518363ffffffff1660e01b815260040161106f929190615447565b604080518083038186803b15801561108657600080fd5b505afa15801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110be91908101906147bc565b6020810151909250156110d6579350610b9a92505050565b600101610fab565b5060405162461bcd60e51b8152600401610a59906156a9565b6110ff613399565b611107612e69565b61110f612e55565b60035460405163b06e8c6560e01b81526001600160a01b039283169263b06e8c6592611142929116908590600401615447565b600060405180830381600087803b15801561115c57600080fd5b505af1158015611170573d6000803e3d6000fd5b505050505b50565b604051806040016040528060038152602001620a69cb60eb1b81525081565b600060606111a3612246565b905060005b81518110156112aa5760008282815181106111bf57fe5b602090810291909101810151600081815260099092526040918290205460085492516321f8a72160e01b81529193506001600160a01b0390811692610100900416906321f8a72190611215908590600401615481565b60206040518083038186803b15801561122d57600080fd5b505afa158015611241573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112659190810190614379565b6001600160a01b031614158061129057506000818152600960205260409020546001600160a01b0316155b156112a15760009350505050610d6d565b506001016111a8565b50600191505090565b6112bb613399565b6112c3612e69565b6112cb612e55565b60035460405163159fa0d560e11b81526001600160a01b0392831692632b3f41aa92611142928692909116906004016152f9565b6113076133d9565b6002546040516001600160a01b039091169063907dff979061133190869086908690602001615525565b604051602081830303815290604052600260405161134e90615265565b6040519081900381206001600160e01b031960e086901b16825261137d9392918a90600090819060040161559f565b600060405180830381600087803b15801561139757600080fd5b505af11580156113ab573d6000803e3d6000fd5b5050505050505050565b601281565b600085846113c88282613411565b6113d0612e69565b6113d8612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d29261141a9291169081908d908d908d9084906000908f908f90600401615314565b6040805180830381600087803b15801561143357600080fd5b505af1158015611447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061146b919081019061480a565b5098975050505050505050565b60085460ff1681565b611489613399565b611491612e69565b611499612e55565b60035460405163fd864ccf60e01b81526001600160a01b039283169263fd864ccf92611142928692909116906004016152f9565b60006114d7612e55565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004016115029190615481565b60206040518083038186803b15801561151a57600080fd5b505afa15801561152e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610b979190810190614780565b600061155c612e55565b6001600160a01b0316637b1001b78360016040518363ffffffff1660e01b8152600401610b4792919061549d565b6000611594612f28565b95945050505050565b60006115a7612e55565b6001600160a01b0316634e99bda96040518163ffffffff1660e01b815260040160206040518083038186803b1580156115df57600080fd5b505afa1580156115f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116179190810190614617565b905090565b6000611626612fac565b61162e612e69565b6003546001600160a01b0316611642613472565b6001600160a01b031663c00007b0826040518263ffffffff1660e01b815260040161166d91906152dd565b600060405180830381600087803b15801561168757600080fd5b505af115801561169b573d6000803e3d6000fd5b505050506000806116aa612e55565b6001600160a01b03166372c658168460016040518363ffffffff1660e01b81526004016116d892919061542c565b606060405180830381600087803b1580156116f257600080fd5b505af1158015611706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061172a919081019061483a565b50915091506000811161174f5760405162461bcd60e51b8152600401610a59906157a1565b61175b83838386613491565b600061176f84611769613472565b8561350d565b90508061178e5760405162461bcd60e51b8152600401610a5990615746565b611796613472565b6001600160a01b0316633c6b16ab846040518263ffffffff1660e01b81526004016117c19190615481565b600060405180830381600087803b1580156117db57600080fd5b505af11580156117ef573d6000803e3d6000fd5b5092965050505050505090565b6001546001600160a01b031681565b6000611815612fac565b61181d612e69565b600354610b979083906000906001600160a01b031661351a565b61183f61391c565b6118498282613954565b5050565b611855612fac565b6008546040516321f8a72160e01b815260009161010090046001600160a01b0316906321f8a7219061189a906b131959d858de53585c9ad95d60a21b90600401615481565b60206040518083038186803b1580156118b257600080fd5b505afa1580156118c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118ea9190810190614379565b9050336001600160a01b038216146119145760405162461bcd60e51b8152600401610a5990615756565b61191c61337d565b6001600160a01b031663de065f67838361193461337d565b6001600160a01b031663326a3cfb876040518263ffffffff1660e01b815260040161195f91906152dd565b60206040518083038186803b15801561197757600080fd5b505afa15801561198b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506119af9190810190614653565b60006040518563ffffffff1660e01b81526004016119d094939291906153c2565b600060405180830381600087803b1580156119ea57600080fd5b505af11580156119fe573d6000803e3d6000fd5b505050505050565b6000611a10612e55565b600480546040516370a0823160e01b81526001600160a01b0393841693636bed0415938793909116916370a0823191611a4b918591016152dd565b60206040518083038186803b158015611a6357600080fd5b505afa158015611a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611a9b9190810190614653565b6040518363ffffffff1660e01b8152600401611ab8929190615447565b604080518083038186803b158015611acf57600080fd5b505afa158015611ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b0791908101906147da565b5092915050565b611b166133d9565b6002546040516001600160a01b039091169063907dff9790611b4490889088908890889088906020016154d9565b6040516020818303038152906040526002604051611b6190615290565b6040518091039020611b728b613a00565b6000806040518763ffffffff1660e01b8152600401611b969695949392919061559f565b600060405180830381600087803b158015611bb057600080fd5b505af1158015611bc4573d6000803e3d6000fd5b50505050505050505050565b611bd86133d9565b6002546040516001600160a01b039091169063907dff9790611c0090859085906020016154ab565b6040516020818303038152906040526002604051611c1d906152a6565b6040518091039020611c2e88613a00565b6000806040518763ffffffff1660e01b8152600401611c529695949392919061559f565b600060405180830381600087803b158015611c6c57600080fd5b505af1158015611c80573d6000803e3d6000fd5b50505050505050565b6000611c93612fac565b611c9b612e69565b600354610f0f90849084906001600160a01b031661351a565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a0823191610b47918691016152dd565b6060611cf0612e55565b6001600160a01b03166372cb051f6040518163ffffffff1660e01b815260040160006040518083038186803b158015611d2857600080fd5b505afa158015611d3c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261161791908101906145e2565b6060611d6e612246565b905060005b8151811015611849576000828281518110611d8a57fe5b602002602001015190506000600860019054906101000a90046001600160a01b03166001600160a01b031663dacb2d018384604051602001611dcc91906152c7565b6040516020818303038152906040526040518363ffffffff1660e01b8152600401611df89291906154b9565b60206040518083038186803b158015611e1057600080fd5b505afa158015611e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e489190810190614379565b6000838152600960205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa6890611ea4908490849061548f565b60405180910390a15050600101611d73565b6001546001600160a01b03163314611ee05760405162461bcd60e51b8152600401610a599061566c565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92611f23926001600160a01b03918216929116906152f9565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000611f5c612e55565b6001600160a01b031663835e119c836040518263ffffffff1660e01b81526004016115029190615481565b6000611f91612e55565b6001600160a01b0316637b1001b78360006040518363ffffffff1660e01b8152600401610b4792919061549d565b600080611fca612fac565b6008546040516321f8a72160e01b815260009161010090046001600160a01b0316906321f8a721906120199075446562744d69677261746f724f6e457468657265756d60501b90600401615481565b60206040518083038186803b15801561203157600080fd5b505afa158015612045573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506120699190810190614379565b9050336001600160a01b038216146120935760405162461bcd60e51b8152600401610a599061563f565b600480546040516370a0823160e01b81526001600160a01b03909116916370a08231916120c2918891016152dd565b60206040518083038186803b1580156120da57600080fd5b505afa1580156120ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121129190810190614653565b9150811561214857600061212785838561350d565b9050806121465760405162461bcd60e51b8152600401610a59906156f6565b505b61215061337d565b6001600160a01b031663326a3cfb856040518263ffffffff1660e01b815260040161217b91906152dd565b60206040518083038186803b15801561219357600080fd5b505afa1580156121a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121cb9190810190614653565b92508215612240576121db61337d565b6001600160a01b031663de065f6785838660006040518563ffffffff1660e01b815260040161220d94939291906153c2565b600060405180830381600087803b15801561222757600080fd5b505af115801561223b573d6000803e3d6000fd5b505050505b50915091565b606080612251613a0c565b60408051600180825281830190925291925060609190602080830190803883390190505090507453796e746865746978427269646765546f4261736560581b8160008151811061229d57fe5b6020026020010181815250506122b38282613b55565b9250505090565b6122c2613399565b6122ca612e69565b6122d2612e55565b6003546040516285c0d160e31b81526001600160a01b039283169263042e068892611142929116908590600401615447565b6000546001600160a01b031681565b600085846123218282613411565b612329612e69565b612331612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d292612374928e92909116908d908d908d9085906000908f908f90600401615314565b6040805180830381600087803b15801561238d57600080fd5b505af11580156123a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506123c5919081019061480a565b509998505050505050505050565b631cd554d160e21b81565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c255780601f10610bfa57610100808354040283529160200191610c25565b612441612c4f565b600280546001600160a01b0319166001600160a01b0383161790556040517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e90610dc39083906152eb565b612494613399565b61249c612e69565b6124a4612e55565b6003546040516324beb82560e11b81526001600160a01b039283169263497d704a926124d5929116906004016152dd565b600060405180830381600087803b1580156124ef57600080fd5b505af1158015610af7573d6000803e3d6000fd5b565b6000806000612512612e69565b61251a612f40565b6003546040516306c5a00b60e21b81526001600160a01b0392831692631b16802c9261254d929116908890600401615447565b606060405180830381600087803b15801561256757600080fd5b505af1158015610d32573d6000803e3d6000fd5b612583613c0a565b600480546001600160a01b0319166001600160a01b03831617905561117581613c78565b60006125b1612e55565b6001600160a01b031663a311c7c2836040518263ffffffff1660e01b8152600401610b4791906152dd565b60006125e6612e55565b6001600160a01b031663a5fdc5de836040518263ffffffff1660e01b8152600401610b4791906152dd565b600061261b612f57565b612623612fac565b600354612639906001600160a01b031683613000565b50600354612651906001600160a01b0316848461350d565b5060019392505050565b6126636133d9565b6002546040516001600160a01b039091169063907dff979061268b90859085906020016154ab565b6040516020818303038152906040526002604051611c1d9061525a565b6126b0613399565b6126b8612e69565b6126c0612e55565b60035460405163644bb89960e11b81526001600160a01b039283169263c8977132926124d5929116906004016152dd565b6126f9613cea565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b612723613399565b61272b612e69565b612733612e55565b600354604051632694552d60e21b81526001600160a01b0392831692639a5154b4926119d092879290911690869060040161539a565b600083826127778282613411565b61277f612e69565b612787612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d2926127ca928c92909116908b908b908b90859060009082908290600401615314565b6040805180830381600087803b1580156127e357600080fd5b505af11580156127f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061281b919081019061480a565b50979650505050505050565b6000612831612e55565b6001600160a01b031663d37c4d8b84846040518363ffffffff1660e01b815260040161285e929190615447565b60206040518083038186803b15801561287657600080fd5b505afa15801561288a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f0f9190810190614653565b6003546001600160a01b031681565b6128c561391c565b60006128cf613d14565b90506128db8183613954565b604051630b32e9c760e31b81526001600160a01b038216906359974e3890612907908590600401615481565b602060405180830381600087803b15801561292157600080fd5b505af1158015612935573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610af99190810190614617565b6000612963612e55565b6001600160a01b031663dbf633406040518163ffffffff1660e01b815260040160206040518083038186803b15801561299b57600080fd5b505afa1580156129af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506116179190810190614653565b60048054604051636eb1769f60e11b81526000926001600160a01b039092169163dd62ed3e9161285e9187918791016152f9565b612a0f613399565b612a17612e69565b612a1f612e55565b60035460405163227635b160e11b81526001600160a01b03928316926344ec6b62926119d092879290911690869060040161539a565b6004546001600160a01b031681565b6002546001600160a01b031681565b612a7b61391c565b612a83612fac565b600480546040516370a0823160e01b81526001600160a01b039091169163b46310f6918591612b1e91869186916370a0823191612ac2918791016152dd565b60206040518083038186803b158015612ada57600080fd5b505afa158015612aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612b129190810190614653565b9063ffffffff613d3516565b6040518363ffffffff1660e01b8152600401612b3b929190615447565b600060405180830381600087803b158015612b5557600080fd5b505af1158015612b69573d6000803e3d6000fd5b50505050612b7982600083613d5d565b600754612b8c908263ffffffff613d3516565b6007555050565b60008382612ba18282613411565b612ba9612e69565b612bb1612f40565b6003546040516327c319e960e11b81526001600160a01b0392831692634f8633d292612bf39291169081908b908b908b90849060009082908290600401615314565b6040805180830381600087803b158015612c0c57600080fd5b505af1158015612c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612c44919081019061480a565b509695505050505050565b6000546001600160a01b031633146125035760405162461bcd60e51b8152600401610a5990615736565b60006001600160a01b03831615801590612c9c57506001600160a01b0383163014155b8015612cb657506002546001600160a01b03848116911614155b612cd25760405162461bcd60e51b8152600401610a599061564f565b600480546040516370a0823160e01b81526001600160a01b039091169163b46310f6918791612d1191879186916370a0823191612ac2918791016152dd565b6040518363ffffffff1660e01b8152600401612d2e929190615447565b600060405180830381600087803b158015612d4857600080fd5b505af1158015612d5c573d6000803e3d6000fd5b5050600480546040516370a0823160e01b81526001600160a01b03909116935063b46310f692508691612dfb91879186916370a0823191612d9f918791016152dd565b60206040518083038186803b158015612db757600080fd5b505afa158015612dcb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612def9190810190614653565b9063ffffffff613da016565b6040518363ffffffff1660e01b8152600401612e18929190615447565b600060405180830381600087803b158015612e3257600080fd5b505af1158015612e46573d6000803e3d6000fd5b50505050612651848484613d5d565b60006116176524b9b9bab2b960d11b613dc5565b6002546001600160a01b03163314801590612e8f57506003546001600160a01b03163314155b1561250357600380546001600160a01b03191633179055565b6002546040516001600160a01b039091169063907dff9790612ece908490602001615481565b6040516020818303038152906040526003604051612eeb9061529b565b6040518091039020612efc88613a00565b612f0588613a00565b60006040518763ffffffff1660e01b8152600401611c52969594939291906155d9565b60405162461bcd60e51b8152600401610a5990615706565b60006116176822bc31b430b733b2b960b91b613dc5565b6002546001600160a01b0316331415612f6f57612503565b612f7833613e22565b15612f9457600380546001600160a01b03191633179055612503565b60405162461bcd60e51b8152600401610a59906157ce565b612fb46141d1565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b158015612fec57600080fd5b505afa158015610af7573d6000803e3d6000fd5b6008546040516321f8a72160e01b815260009182916101009091046001600160a01b0316906321f8a72190613048906b131959d858de53585c9ad95d60a21b90600401615481565b60206040518083038186803b15801561306057600080fd5b505afa158015613074573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506130989190810190614379565b6003549091506001600160a01b0316158015906130c257506003546001600160a01b038281169116145b806130de5750806001600160a01b0316846001600160a01b0316145b156130ed576001915050610cb4565b60006130f7612e55565b6001600160a01b031663d37c4d8b86631cd554d160e21b6040518363ffffffff1660e01b815260040161312b929190615447565b60206040518083038186803b15801561314357600080fd5b505afa158015613157573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061317b9190810190614653565b1115610cae5760008061318c612e55565b600480546040516370a0823160e01b81526001600160a01b0393841693636bed0415938b93909116916370a08231916131c7918591016152dd565b60206040518083038186803b1580156131df57600080fd5b505afa1580156131f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506132179190810190614653565b6040518363ffffffff1660e01b8152600401613234929190615447565b604080518083038186803b15801561324b57600080fd5b505afa15801561325f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061328391908101906147da565b91509150818511156132a75760405162461bcd60e51b8152600401610a5990615716565b80156132c55760405162461bcd60e51b8152600401610a5990615726565b50600195945050505050565b60048054604051636eb1769f60e11b81526000926001600160a01b039092169163da46098c9187918991613317918891879163dd62ed3e91612ac29188918891016152f9565b6040518463ffffffff1660e01b81526004016133359392919061539a565b600060405180830381600087803b15801561334f57600080fd5b505af1158015613363573d6000803e3d6000fd5b50505050613372848484612c79565b90505b949350505050565b60006116176d2932bbb0b93222b9b1b937bbab1960911b613dc5565b6133a16141d1565b6001600160a01b0316637c3125416040518163ffffffff1660e01b815260040160006040518083038186803b158015612fec57600080fd5b6133e1612f40565b6001600160a01b0316336001600160a01b0316146125035760405162461bcd60e51b8152600401610a5990615699565b6134196141d1565b6001600160a01b0316631ce00ba283836040518363ffffffff1660e01b81526004016134469291906154ab565b60006040518083038186803b15801561345e57600080fd5b505afa1580156119fe573d6000803e3d6000fd5b6000611617704c697175696461746f725265776172647360781b613dc5565b6002546040516001600160a01b039091169063907dff97906134bb90869086908690602001615834565b60405160208183030381529060405260026040516134d8906152bc565b60405180910390206134e989613a00565b6000806040518763ffffffff1660e01b815260040161137d9695949392919061559f565b6000610f0c848484612c79565b6000613524613472565b6001600160a01b031663c00007b0856040518263ffffffff1660e01b815260040161354f91906152dd565b600060405180830381600087803b15801561356957600080fd5b505af115801561357d573d6000803e3d6000fd5b50505050600080600061358e612e55565b6001600160a01b03166372c658168860006040518363ffffffff1660e01b81526004016135bc92919061542c565b606060405180830381600087803b1580156135d657600080fd5b505af11580156135ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061360e919081019061483a565b9194509250905080156136875761362361337d565b6001600160a01b031663de065f678889848a6040518563ffffffff1660e01b815260040161365494939291906153f7565b600060405180830381600087803b15801561366e57600080fd5b505af1158015613682573d6000803e3d6000fd5b505050505b61369387848488613491565b600061369d6141eb565b6001600160a01b0316638074b3726040518163ffffffff1660e01b815260040160206040518083038186803b1580156136d557600080fd5b505afa1580156136e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061370d9190810190614653565b905060006137196141eb565b6001600160a01b03166331e4e0306040518163ffffffff1660e01b815260040160206040518083038186803b15801561375157600080fd5b505afa158015613765573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506137899190810190614653565b905060006137956141eb565b6001600160a01b0316635616c9578b6040518263ffffffff1660e01b81526004016137c091906152dd565b60206040518083038186803b1580156137d857600080fd5b505afa1580156137ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506138109190810190614379565b9050600061381f8b838661350d565b90508061383e5760405162461bcd60e51b8152600401610a59906156c9565b600061384b8c8b8661350d565b90508061386a5760405162461bcd60e51b8152600401610a5990615791565b871561390a5760006138848d61387e613472565b8b61350d565b9050806138a35760405162461bcd60e51b8152600401610a5990615746565b6138ab613472565b6001600160a01b0316633c6b16ab8a6040518263ffffffff1660e01b81526004016138d69190615481565b600060405180830381600087803b1580156138f057600080fd5b505af1158015613904573d6000803e3d6000fd5b50505050505b5060019b9a5050505050505050505050565b613924614203565b6001600160a01b0316336001600160a01b0316146125035760405162461bcd60e51b8152600401610a59906157be565b600480546040516370a0823160e01b81526001600160a01b039091169163b46310f691859161399391869186916370a0823191612d9f918791016152dd565b6040518363ffffffff1660e01b81526004016139b0929190615447565b600060405180830381600087803b1580156139ca57600080fd5b505af11580156139de573d6000803e3d6000fd5b505050506139ed308383613d5d565b600754612b8c908263ffffffff613da016565b6001600160a01b031690565b60408051600780825261010082019092526060916020820160e0803883390190505090506b53797374656d53746174757360a01b81600081518110613a4d57fe5b6020026020010181815250506822bc31b430b733b2b960b91b81600181518110613a7357fe5b6020026020010181815250506524b9b9bab2b960d11b81600281518110613a9657fe5b602002602001018181525050722932bbb0b93239a234b9ba3934b13aba34b7b760691b81600381518110613ac657fe5b602002602001018181525050704c697175696461746f725265776172647360781b81600481518110613af457fe5b602002602001018181525050692634b8bab4b230ba37b960b11b81600581518110613b1b57fe5b6020026020010181815250506d2932bbb0b93222b9b1b937bbab1960911b81600681518110613b4657fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015613b85578160200160208202803883390190505b50905060005b8351811015613bc757838181518110613ba057fe5b6020026020010151828281518110613bb457fe5b6020908102919091010152600101613b8b565b5060005b8251811015611b0757828181518110613be057fe5b6020026020010151828286510181518110613bf757fe5b6020908102919091010152600101613bcb565b6002546001600160a01b03163314801590613c3057506003546001600160a01b03163314155b15613c4857600380546001600160a01b031916331790555b6000546003546001600160a01b039081169116146125035760405162461bcd60e51b8152600401610a5990615689565b6002546040516001600160a01b039091169063907dff9790613c9e9084906020016152dd565b6040516020818303038152906040526001604051613cbb906152b1565b6040519081900381206001600160e01b031960e086901b16825261114293929160009081908190600401615540565b6002546001600160a01b031633146125035760405162461bcd60e51b8152600401610a59906157ce565b6000611617722932bbb0b93239a234b9ba3934b13aba34b7b760691b613dc5565b600082821115613d575760405162461bcd60e51b8152600401610a59906156e6565b50900390565b6002546040516001600160a01b039091169063907dff9790613d83908490602001615481565b6040516020818303038152906040526003604051612eeb906152d2565b600082820183811015610f0f5760405162461bcd60e51b8152600401610a59906156b9565b60008181526009602090815260408083205490516001600160a01b039091169182151591613df591869101615270565b60405160208183030381529060405290611b075760405162461bcd60e51b8152600401610a59919061562e565b6008546040516321f8a72160e01b815260009161010090046001600160a01b0316906321f8a72190613e56906004016157de565b60206040518083038186803b158015613e6e57600080fd5b505afa158015613e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613ea69190810190614379565b6001600160a01b0316826001600160a01b03161480613f5757506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a72190613ef290600401615766565b60206040518083038186803b158015613f0a57600080fd5b505afa158015613f1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613f429190810190614379565b6001600160a01b0316826001600160a01b0316145b80613ff457506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a72190613f8f9060040161565f565b60206040518083038186803b158015613fa757600080fd5b505afa158015613fbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613fdf9190810190614379565b6001600160a01b0316826001600160a01b0316145b8061409157506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a7219061402c906004016156d9565b60206040518083038186803b15801561404457600080fd5b505afa158015614058573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061407c9190810190614379565b6001600160a01b0316826001600160a01b0316145b8061412e57506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a721906140c99060040161567c565b60206040518083038186803b1580156140e157600080fd5b505afa1580156140f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506141199190810190614379565b6001600160a01b0316826001600160a01b0316145b80610b9757506008546040516321f8a72160e01b81526101009091046001600160a01b0316906321f8a72190614166906004016157b1565b60206040518083038186803b15801561417e57600080fd5b505afa158015614192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506141b69190810190614379565b6001600160a01b0316826001600160a01b0316149050919050565b60006116176b53797374656d53746174757360a01b613dc5565b6000611617692634b8bab4b230ba37b960b11b613dc5565b60006116177453796e746865746978427269646765546f4261736560581b613dc5565b604080518082019091526000808252602082015290565b8035610cb48161594d565b8051610cb48161594d565b600082601f83011261426457600080fd5b815161427761427282615891565b61586a565b9150818183526020840193506020810190508385602084028201111561429c57600080fd5b60005b838110156142c857816142b288826142e8565b845250602092830192919091019060010161429f565b5050505092915050565b8051610cb481615961565b8035610cb48161596a565b8051610cb48161596a565b8051610cb481615973565b8035610cb481615973565b60006040828403121561431b57600080fd5b614325604061586a565b905060006143338484614350565b8252506020614344848483016142e8565b60208301525092915050565b8051610cb48161597c565b60006020828403121561436d57600080fd5b6000613375848461423d565b60006020828403121561438b57600080fd5b60006133758484614248565b600080604083850312156143aa57600080fd5b60006143b6858561423d565b92505060206143c78582860161423d565b9150509250929050565b6000806000606084860312156143e657600080fd5b60006143f2868661423d565b93505060206144038682870161423d565b9250506040614414868287016142dd565b9150509250925092565b6000806040838503121561443157600080fd5b600061443d858561423d565b92505060206143c7858286016142dd565b60008060006060848603121561446357600080fd5b600061446f868661423d565b9350506020614403868287016142dd565b6000806000806080858703121561449657600080fd5b60006144a2878761423d565b94505060206144b3878288016142dd565b93505060406144c4878288016142dd565b92505060606144d5878288016142dd565b91505092959194509250565b60008060008060008060c087890312156144fa57600080fd5b6000614506898961423d565b965050602061451789828a016142dd565b955050604061452889828a016142dd565b945050606061453989828a016142dd565b935050608061454a89828a0161423d565b92505060a061455b89828a016142dd565b9150509295509295509295565b60008060008060008060c0878903121561458157600080fd5b600061458d898961423d565b965050602061459e89828a016142dd565b95505060406145af89828a016142dd565b94505060606145c089828a016142dd565b93505060806145d189828a016142dd565b92505060a061455b89828a0161423d565b6000602082840312156145f457600080fd5b815167ffffffffffffffff81111561460b57600080fd5b61337584828501614253565b60006020828403121561462957600080fd5b600061337584846142d2565b60006020828403121561464757600080fd5b600061337584846142dd565b60006020828403121561466557600080fd5b600061337584846142e8565b6000806000806080858703121561468757600080fd5b60006144a287876142dd565b6000806000606084860312156146a857600080fd5b600061446f86866142dd565b600080600080600060a086880312156146cc57600080fd5b60006146d888886142dd565b95505060206146e9888289016142dd565b94505060406146fa888289016142dd565b935050606061470b8882890161423d565b925050608061471c888289016142dd565b9150509295509295909350565b600080600080600060a0868803121561474157600080fd5b600061474d88886142dd565b955050602061475e888289016142dd565b945050604061476f888289016142dd565b935050606061470b888289016142dd565b60006020828403121561479257600080fd5b600061337584846142f3565b6000602082840312156147b057600080fd5b600061337584846142fe565b6000604082840312156147ce57600080fd5b60006133758484614309565b600080604083850312156147ed57600080fd5b60006147f985856142e8565b92505060206143c7858286016142d2565b6000806040838503121561481d57600080fd5b600061482985856142e8565b92505060206143c7858286016142f3565b60008060006060848603121561484f57600080fd5b600061485b86866142e8565b935050602061486c868287016142e8565b9250506040614414868287016142e8565b6000614889838361490b565b505060200190565b61489a816158f3565b82525050565b61489a816158c5565b60006148b4826158b8565b6148be81856158bc565b93506148c9836158b2565b8060005b838110156148f75781516148e1888261487d565b97506148ec836158b2565b9250506001016148cd565b509495945050505050565b61489a816158d0565b61489a81610d6d565b61489a61492082610d6d565b610d6d565b6000614930826158b8565b61493a81856158bc565b935061494a818560208601615917565b61495381615943565b9093019392505050565b61489a816158d5565b61489a816158fe565b61489a8161590c565b60006149856014836158bc565b7327b7363c902618902232b13a26b4b3b930ba37b960611b815260200192915050565b60006149b5601f836158bc565b7f43616e6e6f74207472616e7366657220746f2074686973206164647265737300815260200192915050565b75446562744d69677261746f724f6e4f7074696d69736d60501b9052565b6000614a0c6035836158bc565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b6e53796e746865746978457363726f7760881b9052565b6000614a7a6013836158bc565b7227bbb732b91037b7363c90333ab731ba34b7b760691b815260200192915050565b6000614aa9601e836158bc565b7f4f6e6c792045786368616e6765722063616e20696e766f6b6520746869730000815260200192915050565b6000614ae26014836158bc565b73616c6c20656e747269657320617265207a65726f60601b815260200192915050565b6000614b12601b836158bc565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000614b4b6024836158bc565b7f466c616720726577617264207472616e7366657220646964206e6f742073756381526318d9595960e21b602082015260400192915050565b6b526577617264457363726f7760a01b9052565b6000614ba56018836158bc565b7f4e657720657363726f77206164647265737320756e7365740000000000000000815260200192915050565b6000614bde602883610b9a565b7f45786368616e67655265636c61696d28616464726573732c627974657333322c81526775696e743235362960c01b602082015260280192915050565b6000614c28601e836158bc565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000614c616013836158bc565b721cdb9e081d1c985b9cd9995c8819985a5b1959606a1b815260200192915050565b6000614c90601b836158bc565b7f43616e6e6f742062652072756e206f6e2074686973206c617965720000000000815260200192915050565b6000614cc9603183610b9a565b7f45786368616e6765547261636b696e6728627974657333322c627974657333328152702c75696e743235362c75696e743235362960781b602082015260310192915050565b6000614d1c601183610b9a565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b6000614d49603e83610b9a565b7f53796e746845786368616e676528616464726573732c627974657333322c756981527f6e743235362c627974657333322c75696e743235362c616464726573732900006020820152603e0192915050565b6000614da86026836158bc565b7f43616e6e6f74207472616e73666572207374616b6564206f7220657363726f778152650cac840a69cb60d31b602082015260400192915050565b6000614df0601e836158bc565b7f412073796e7468206f7220534e58207261746520697320696e76616c69640000815260200192915050565b6000614e29602f836158bc565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b6000614e7a6024836158bc565b7f5472616e7366657220746f204c697175696461746f72526577617264732066618152631a5b195960e21b602082015260400192915050565b6000614ec0602183610b9a565b7f417070726f76616c28616464726573732c616464726573732c75696e743235368152602960f81b602082015260210192915050565b6000614f03602783610b9a565b7f45786368616e676552656261746528616464726573732c627974657333322c75815266696e743235362960c81b602082015260270192915050565b6000614f4c601a83610b9a565b7f546f6b656e5374617465557064617465642861646472657373290000000000008152601a0192915050565b6000614f856023836158bc565b7f4f6e6c79204c65676163794d61726b65742063616e207265766f6b6520657363815262726f7760e81b602082015260400192915050565b6000614fca603283610b9a565b7f4163636f756e744c69717569646174656428616464726573732c75696e743235815271362c75696e743235362c616464726573732960701b602082015260320192915050565b6d2932bbb0b93222b9b1b937bbab1960911b9052565b6000615034601983610b9a565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b600061506d6029836158bc565b7f4c697175696461746520726577617264207472616e7366657220646964206e6f8152681d081cdd58d8d9595960ba1b602082015260400192915050565b60006150b86015836158bc565b7463616e6e6f742073656c66206c697175696461746560581b815260200192915050565b6411195c1bdd60da1b9052565b60006150f6601d836158bc565b7f43616e206f6e6c7920626520696e766f6b656420627920627269646765000000815260200192915050565b600061512f6018836158bc565b7f4f6c6420657363726f77206164647265737320756e7365740000000000000000815260200192915050565b6000615168602183610b9a565b7f5472616e7366657228616464726573732c616464726573732c75696e743235368152602960f81b602082015260210192915050565b60006151ab6017836158bc565b7f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000815260200192915050565b7f53796e746865746978427269646765546f4f7074696d69736d000000000000009052565b6000615209601e836158bc565b7f63616e6e6f74206d69677261746520746f2073616d6520616464726573730000815260200192915050565b732932bbb0b93222b9b1b937bbab19233937bd32b760611b9052565b61489a816158ed565b6000610cb482614bd1565b6000610cb482614cbc565b600061527b82614d0f565b91506152878284614914565b50602001919050565b6000610cb482614d3c565b6000610cb482614eb3565b6000610cb482614ef6565b6000610cb482614f3f565b6000610cb482614fbd565b600061527b82615027565b6000610cb48261515b565b60208101610cb482846148a0565b60208101610cb48284614891565b6040810161530782856148a0565b610f0f60208301846148a0565b6101208101615323828c6148a0565b615330602083018b6148a0565b61533d604083018a61490b565b61534a606083018961490b565b615357608083018861490b565b61536460a08301876148a0565b61537160c0830186614902565b61537e60e08301856148a0565b61538c61010083018461490b565b9a9950505050505050505050565b606081016153a882866148a0565b6153b560208301856148a0565b613375604083018461490b565b608081016153d082876148a0565b6153dd60208301866148a0565b6153ea604083018561490b565b611594606083018461496f565b6080810161540582876148a0565b61541260208301866148a0565b61541f604083018561490b565b611594606083018461490b565b6040810161543a82856148a0565b610f0f6020830184614902565b6040810161545582856148a0565b610f0f602083018461490b565b60208082528101610f0f81846148a9565b60208101610cb48284614902565b60208101610cb4828461490b565b60408101615307828561490b565b6040810161543a828561490b565b60408101615455828561490b565b604081016154c7828561490b565b8181036020830152610f0c8184614925565b60a081016154e7828861490b565b6154f4602083018761490b565b615501604083018661490b565b61550e606083018561490b565b61551b60808301846148a0565b9695505050505050565b60608101615533828661490b565b6153b5602083018561490b565b60c080825281016155518189614925565b9050615560602083018861496f565b61556d604083018761490b565b61557a6060830186614966565b6155876080830185614966565b61559460a0830184614966565b979650505050505050565b60c080825281016155b08189614925565b90506155bf602083018861496f565b6155cc604083018761490b565b61557a606083018661490b565b60c080825281016155ea8189614925565b90506155f9602083018861496f565b615606604083018761490b565b615613606083018661490b565b615587608083018561490b565b60208101610cb4828461495d565b60208082528101610f0f8184614925565b60208082528101610b9781614978565b60208082528101610b97816149a8565b60208101610b9a826149e1565b60208082528101610b97816149ff565b60208101610b9a82614a56565b60208082528101610b9781614a6d565b60208082528101610b9781614a9c565b60208082528101610b9781614ad5565b60208082528101610b9781614b05565b60208082528101610b9781614b3e565b60208101610b9a82614b84565b60208082528101610b9781614c1b565b60208082528101610b9781614c54565b60208082528101610b9781614c83565b60208082528101610b9781614d9b565b60208082528101610b9781614de3565b60208082528101610b9781614e1c565b60208082528101610b9781614e6d565b60208082528101610b9781614f78565b60208101610b9a82615011565b6040810161578082615011565b8181036020830152610b9781614b98565b60208082528101610b9781615060565b60208082528101610b97816150ab565b60208101610b9a826150dc565b60208082528101610b97816150e9565b60208082528101610b978161519e565b60208101610b9a826151d7565b60208082528101610b97816151fc565b6040810161580882615235565b8181036020830152610b9781615122565b60408101615827828561490b565b610f0f602083018461495d565b60608101615842828661490b565b61584f602083018561490b565b61337560408301846148a0565b60208101610cb48284615251565b60405181810167ffffffffffffffff8111828210171561588957600080fd5b604052919050565b600067ffffffffffffffff8211156158a857600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b6000610b9782613a00565b151590565b6000610b97826158c5565b67ffffffffffffffff1690565b60ff1690565b6000610b97826158d5565b6000610b9761492083610d6d565b6000610b9782610d6d565b60005b8381101561593257818101518382015260200161591a565b83811115610af75750506000910152565b601f01601f191690565b615956816158c5565b811461117557600080fd5b615956816158d0565b61595681610d6d565b615956816158d5565b615956816158e056fea365627a7a723158204837232e73f4cbd89de7e6e9b4d87a751a02c8049bde05904471a8b86ee6a8fd6c6578706572696d656e74616cf564736f6c63430005100040

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000b409b21634f356cb3372f077920ecdd4017abfc6000000000000000000000000e851b0a420074f4db3bfcac03722a7ccab81867600000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000529c553ef2d0370279dc8abf19702b98b166d252

-----Decoded View---------------
Arg [0] : _proxy (address): 0xB409b21634F356cb3372F077920ECDd4017AbFc6
Arg [1] : _tokenState (address): 0xE851b0A420074f4Db3BfcAC03722A7CCAB818676
Arg [2] : _owner (address): 0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9
Arg [3] : _totalSupply (uint256): 0
Arg [4] : _resolver (address): 0x529C553eF2d0370279DC8AbF19702B98b166D252

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000b409b21634f356cb3372f077920ecdd4017abfc6
Arg [1] : 000000000000000000000000e851b0a420074f4db3bfcac03722a7ccab818676
Arg [2] : 00000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee9
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 000000000000000000000000529c553ef2d0370279dc8abf19702b98b166d252


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.