ETH Price: $3,103.14 (+3.95%)
Gas: 10 Gwei

Contract

0x42D03f506c2308ECd06aE81D8fA22352BC7A8F2b
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Burn Synths90853512019-12-10 21:56:141591 days ago1576014974IN
Synthetix: Old Synth SNX 9
0 ETH0.000035841
Issue Synths90480412019-12-04 7:03:341598 days ago1575443014IN
Synthetix: Old Synth SNX 9
0 ETH0.000698585.1
Issue Max Synths89496812019-11-17 9:30:301614 days ago1573983030IN
Synthetix: Old Synth SNX 9
0 ETH0.002322871.5
Mint89326972019-11-14 13:32:551617 days ago1573738375IN
Synthetix: Old Synth SNX 9
0 ETH0.0005116320.11
Mint89326962019-11-14 13:32:381617 days ago1573738358IN
Synthetix: Old Synth SNX 9
0 ETH0.000127235.001
Mint89326962019-11-14 13:32:381617 days ago1573738358IN
Synthetix: Old Synth SNX 9
0 ETH0.0005116320.11
Mint89326962019-11-14 13:32:381617 days ago1573738358IN
Synthetix: Old Synth SNX 9
0 ETH0.0005116320.11
Mint89326952019-11-14 13:31:421617 days ago1573738302IN
Synthetix: Old Synth SNX 9
0 ETH0.0005116320.11
Mint89326952019-11-14 13:31:421617 days ago1573738302IN
Synthetix: Old Synth SNX 9
0 ETH0.0005116320.11
Mint89326932019-11-14 13:31:211617 days ago1573738281IN
Synthetix: Old Synth SNX 9
0 ETH0.0010459241.11
Mint89326932019-11-14 13:31:211617 days ago1573738281IN
Synthetix: Old Synth SNX 9
0 ETH0.0005116320.11
Mint89293222019-11-13 23:58:581618 days ago1573689538IN
Synthetix: Old Synth SNX 9
0 ETH0.000025461.001
Exchange89130922019-11-11 7:15:371621 days ago1573456537IN
Synthetix: Old Synth SNX 9
0 ETH0.000070381.5
Issue Max Synths89116642019-11-11 1:33:211621 days ago1573436001IN
Synthetix: Old Synth SNX 9
0 ETH0.001703471.1
Issue Max Synths89116442019-11-11 1:28:501621 days ago1573435730IN
Synthetix: Old Synth SNX 9
0 ETH0.001703471.1
Issue Max Synths89115302019-11-11 0:59:331621 days ago1573433973IN
Synthetix: Old Synth SNX 9
0 ETH0.001873771.21
Issue Max Synths89049092019-11-09 22:37:311622 days ago1573339051IN
Synthetix: Old Synth SNX 9
0 ETH0.003097042
Set Gas Price Li...88931822019-11-08 0:43:461624 days ago1573173826IN
Synthetix: Old Synth SNX 9
0 ETH0.0004241714.25
Set Gas Price Li...88931692019-11-08 0:40:251624 days ago1573173625IN
Synthetix: Old Synth SNX 9
0 ETH0.0004194114.09
Set Gas Price Li...88931552019-11-08 0:37:161624 days ago1573173436IN
Synthetix: Old Synth SNX 9
0 ETH0.0004194114.09
Set Gas Price Li...88924422019-11-07 21:49:161624 days ago1573163356IN
Synthetix: Old Synth SNX 9
0 ETH0.0003842912.91
Set Gas Price Li...88923862019-11-07 21:37:071624 days ago1573162627IN
Synthetix: Old Synth SNX 9
0 ETH0.0015255551.25
Set Gas Price Li...88920422019-11-07 20:19:581624 days ago1573157998IN
Synthetix: Old Synth SNX 9
0 ETH0.0011162637.5
Set Gas Price Li...88920302019-11-07 20:16:351624 days ago1573157795IN
Synthetix: Old Synth SNX 9
0 ETH0.0014883550
Issue Max Synths88918742019-11-07 19:40:211624 days ago1573155621IN
Synthetix: Old Synth SNX 9
0 ETH0.001825581.05
View all transactions

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Block From To Value
87589242019-10-17 13:59:421645 days ago1571320782
Synthetix: Old Synth SNX 9
0.0015 ETH
87271112019-10-12 13:56:591650 days ago1570888619
Synthetix: Old Synth SNX 9
0.011 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Synthetix

Compiler Version
v0.4.25+commit.59dbf8f1

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2019-10-04
*/

/* ===============================================
* Flattened with Solidifier by Coinage
* 
* https://solidifier.coina.ge
* ===============================================
*/


pragma solidity ^0.4.24;

/**
 * @title SafeMath
 * @dev Math operations with safety checks that revert on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, reverts on 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);

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0); // Solidity only automatically asserts when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold

    return c;
  }

  /**
  * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a);
    uint256 c = a - b;

    return c;
  }

  /**
  * @dev Adds two numbers, reverts on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a);

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0);
    return a % b;
  }
}


/*

-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       SafeDecimalMath.sol
version:    2.0
author:     Kevin Brown
            Gavin Conway
date:       2018-10-18

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A library providing safe mathematical operations for division and
multiplication with the capability to round or truncate the results
to the nearest increment. Operations can return a standard precision
or high precision decimal. High precision decimals are useful for
example when attempting to calculate percentages or fractions
accurately.

-----------------------------------------------------------------
*/


/**
 * @title Safely manipulate unsigned fixed-point decimals at a given precision level.
 * @dev Functions accepting uints in this contract and derived contracts
 * are taken to be such fixed point decimals of a specified precision (either standard
 * or high).
 */
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;
    }

}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       Owned.sol
version:    1.1
author:     Anton Jurisevic
            Dominic Romanowski

date:       2018-2-26

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

An Owned contract, to be inherited by other contracts.
Requires its owner to be explicitly set in the constructor.
Provides an onlyOwner access modifier.

To change owner, the current owner must nominate the next owner,
who then has to accept the nomination. The nomination can be
cancelled before it is accepted by the new owner by having the
previous owner change the nomination (setting it to 0).

-----------------------------------------------------------------
*/


/**
 * @title A contract with an owner.
 * @notice Contract ownership can be transferred by first nominating the new owner,
 * who must then accept the ownership, which prevents accidental incorrect ownership transfers.
 */
contract Owned {
    address public owner;
    address public nominatedOwner;

    /**
     * @dev Owned Constructor
     */
    constructor(address _owner)
        public
    {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    /**
     * @notice Nominate a new owner of this contract.
     * @dev Only the current owner may nominate a new owner.
     */
    function nominateNewOwner(address _owner)
        external
        onlyOwner
    {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    /**
     * @notice Accept the nomination to be 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
    {
        require(msg.sender == owner, "Only the contract owner may perform this action");
        _;
    }

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

/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       SelfDestructible.sol
version:    1.2
author:     Anton Jurisevic

date:       2018-05-29

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

This contract allows an inheriting contract to be destroyed after
its owner indicates an intention and then waits for a period
without changing their mind. All ether contained in the contract
is forwarded to a nominated beneficiary upon destruction.

-----------------------------------------------------------------
*/


/**
 * @title A contract that can be destroyed by its owner after a delay elapses.
 */
contract SelfDestructible is Owned {
    
    uint public initiationTime;
    bool public selfDestructInitiated;
    address public selfDestructBeneficiary;
    uint public constant SELFDESTRUCT_DELAY = 4 weeks;

    /**
     * @dev Constructor
     * @param _owner The account which controls this contract.
     */
    constructor(address _owner)
        Owned(_owner)
        public
    {
        require(_owner != address(0), "Owner must not be zero");
        selfDestructBeneficiary = _owner;
        emit SelfDestructBeneficiaryUpdated(_owner);
    }

    /**
     * @notice Set the beneficiary address of this contract.
     * @dev Only the contract owner may call this. The provided beneficiary must be non-null.
     * @param _beneficiary The address to pay any eth contained in this contract to upon self-destruction.
     */
    function setSelfDestructBeneficiary(address _beneficiary)
        external
        onlyOwner
    {
        require(_beneficiary != address(0), "Beneficiary must not be zero");
        selfDestructBeneficiary = _beneficiary;
        emit SelfDestructBeneficiaryUpdated(_beneficiary);
    }

    /**
     * @notice Begin the self-destruction counter of this contract.
     * Once the delay has elapsed, the contract may be self-destructed.
     * @dev Only the contract owner may call this.
     */
    function initiateSelfDestruct()
        external
        onlyOwner
    {
        initiationTime = now;
        selfDestructInitiated = true;
        emit SelfDestructInitiated(SELFDESTRUCT_DELAY);
    }

    /**
     * @notice Terminate and reset the self-destruction timer.
     * @dev Only the contract owner may call this.
     */
    function terminateSelfDestruct()
        external
        onlyOwner
    {
        initiationTime = 0;
        selfDestructInitiated = false;
        emit SelfDestructTerminated();
    }

    /**
     * @notice If the self-destruction delay has elapsed, destroy this contract and
     * remit any ether it owns to the beneficiary address.
     * @dev Only the contract owner may call this.
     */
    function selfDestruct()
        external
        onlyOwner
    {
        require(selfDestructInitiated, "Self Destruct not yet initiated");
        require(initiationTime + SELFDESTRUCT_DELAY < now, "Self destruct delay not met");
        address beneficiary = selfDestructBeneficiary;
        emit SelfDestructed(beneficiary);
        selfdestruct(beneficiary);
    }

    event SelfDestructTerminated();
    event SelfDestructed(address beneficiary);
    event SelfDestructInitiated(uint selfDestructDelay);
    event SelfDestructBeneficiaryUpdated(address newBeneficiary);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       State.sol
version:    1.1
author:     Dominic Romanowski
            Anton Jurisevic

date:       2018-05-15

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

This contract is used side by side with external state token
contracts, such as Synthetix and Synth.
It provides an easy way to upgrade contract logic while
maintaining all user balances and allowances. This is designed
to make the changeover as easy as possible, since mappings
are not so cheap or straightforward to migrate.

The first deployed contract would create this state contract,
using it as its store of balances.
When a new contract is deployed, it links to the existing
state contract, whose owner would then change its associated
contract to the new one.

-----------------------------------------------------------------
*/


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 _owner, address _associatedContract)
        Owned(_owner)
        public
    {
        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);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       TokenState.sol
version:    1.1
author:     Dominic Romanowski
            Anton Jurisevic

date:       2018-05-15

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A contract that holds the state of an ERC20 compliant token.

This contract is used side by side with external state token
contracts, such as Synthetix and Synth.
It provides an easy way to upgrade contract logic while
maintaining all user balances and allowances. This is designed
to make the changeover as easy as possible, since mappings
are not so cheap or straightforward to migrate.

The first deployed contract would create this state contract,
using it as its store of balances.
When a new contract is deployed, it links to the existing
state contract, whose owner would then change its associated
contract to the new one.

-----------------------------------------------------------------
*/


/**
 * @title ERC20 Token State
 * @notice Stores balance information of an ERC20 token contract.
 */
contract TokenState is State {

    /* ERC20 fields. */
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;

    /**
     * @dev Constructor
     * @param _owner The address which controls this contract.
     * @param _associatedContract The ERC20 contract whose state this composes.
     */
    constructor(address _owner, address _associatedContract)
        State(_owner, _associatedContract)
        public
    {}

    /* ========== 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;
    }
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       Proxy.sol
version:    1.3
author:     Anton Jurisevic

date:       2018-05-29

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A proxy contract that, if it does not recognise the function
being called on it, passes all value and call data to an
underlying target contract.

This proxy has the capacity to toggle between DELEGATECALL
and CALL style proxy functionality.

The former executes in the proxy's context, and so will preserve 
msg.sender and store data at the proxy address. The latter will not.
Therefore, any contract the proxy wraps in the CALL style must
implement the Proxyable interface, in order that it can pass msg.sender
into the underlying contract as the state parameter, messageSender.

-----------------------------------------------------------------
*/


contract Proxy is Owned {

    Proxyable public target;
    bool public useDELEGATECALL;

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

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

    function setUseDELEGATECALL(bool value) 
        external
        onlyOwner
    {
        useDELEGATECALL = value;
    }

    function _emit(bytes 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)
            }
        }
    }

    function()
        external
        payable
    {
        if (useDELEGATECALL) {
            assembly {
                /* Copy call data into free memory region. */
                let free_ptr := mload(0x40)
                calldatacopy(free_ptr, 0, calldatasize)

                /* Forward all gas and call data to the target contract. */
                let result := delegatecall(gas, sload(target_slot), free_ptr, calldatasize, 0, 0)
                returndatacopy(free_ptr, 0, returndatasize)

                /* Revert if the call failed, otherwise return the result. */
                if iszero(result) { revert(free_ptr, returndatasize) }
                return(free_ptr, returndatasize)
            }
        } else {
            /* Here we are as above, but must send the messageSender explicitly 
             * since we are using CALL rather than 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);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       Proxyable.sol
version:    1.1
author:     Anton Jurisevic

date:       2018-05-15

checked:    Mike Spain
approved:   Samuel Brooks

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A proxyable contract that works hand in hand with the Proxy contract
to allow for anyone to interact with the underlying contract both
directly and through the proxy.

-----------------------------------------------------------------
*/


// This contract should be treated like an abstract contract
contract Proxyable is Owned {
    /* The proxy this contract exists behind. */
    Proxy public proxy;
    Proxy public integrationProxy;

    /* 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 messageSender;

    constructor(address _proxy, address _owner)
        Owned(_owner)
        public
    {
        proxy = Proxy(_proxy);
        emit ProxyUpdated(_proxy);
    }

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

    function setIntegrationProxy(address _integrationProxy)
        external
        onlyOwner
    {
        integrationProxy = Proxy(_integrationProxy);
    }

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

    modifier onlyProxy {
        require(Proxy(msg.sender) == proxy || Proxy(msg.sender) == integrationProxy, "Only the proxy can call");
        _;
    }

    modifier optionalProxy
    {
        if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy) {
            messageSender = msg.sender;
        }
        _;
    }

    modifier optionalProxy_onlyOwner
    {
        if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy) {
            messageSender = msg.sender;
        }
        require(messageSender == owner, "Owner only function");
        _;
    }

    event ProxyUpdated(address proxyAddress);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       ExternStateToken.sol
version:    1.0
author:     Kevin Brown
date:       2018-08-06

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

This contract offers a modifer that can prevent reentrancy on
particular actions. It will not work if you put it on multiple
functions that can be called from each other. Specifically guard
external entry points to the contract with the modifier only.

-----------------------------------------------------------------
*/


contract ReentrancyPreventer {
    /* ========== MODIFIERS ========== */
    bool isInFunctionBody = false;

    modifier preventReentrancy {
        require(!isInFunctionBody, "Reverted to prevent reentrancy");
        isInFunctionBody = true;
        _;
        isInFunctionBody = false;
    }
}

/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       TokenFallback.sol
version:    1.0
author:     Kevin Brown
date:       2018-08-10

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

This contract provides the logic that's used to call tokenFallback()
when transfers happen.

It's pulled out into its own module because it's needed in two
places, so instead of copy/pasting this logic and maininting it
both in Fee Token and Extern State Token, it's here and depended
on by both contracts.

-----------------------------------------------------------------
*/


contract TokenFallbackCaller is ReentrancyPreventer {
    function callTokenFallbackIfNeeded(address sender, address recipient, uint amount, bytes data)
        internal
        preventReentrancy
    {
        /*
            If we're transferring to a contract and it implements the tokenFallback function, call it.
            This isn't ERC223 compliant because we don't revert if the contract doesn't implement tokenFallback.
            This is because many DEXes and other contracts that expect to work with the standard
            approve / transferFrom workflow don't implement tokenFallback but can still process our tokens as
            usual, so it feels very harsh and likely to cause trouble if we add this restriction after having
            previously gone live with a vanilla ERC20.
        */

        // Is the to address a contract? We can check the code size on that address and know.
        uint length;

        // solium-disable-next-line security/no-inline-assembly
        assembly {
            // Retrieve the size of the code on the recipient address
            length := extcodesize(recipient)
        }

        // If there's code there, it's a contract
        if (length > 0) {
            // Now we need to optionally call tokenFallback(address from, uint value).
            // We can't call it the normal way because that reverts when the recipient doesn't implement the function.

            // solium-disable-next-line security/no-low-level-calls
            recipient.call(abi.encodeWithSignature("tokenFallback(address,uint256,bytes)", sender, amount, data));

            // And yes, we specifically don't care if this call fails, so we're not checking the return value.
        }
    }
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       ExternStateToken.sol
version:    1.3
author:     Anton Jurisevic
            Dominic Romanowski
            Kevin Brown

date:       2018-05-29

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A partial ERC20 token contract, designed to operate with a proxy.
To produce a complete ERC20 token, transfer and transferFrom
tokens must be implemented, using the provided _byProxy internal
functions.
This contract utilises an external state for upgradeability.

-----------------------------------------------------------------
*/


/**
 * @title ERC20 Token contract, with detached state and designed to operate behind a proxy.
 */
contract ExternStateToken is SelfDestructible, Proxyable, TokenFallbackCaller {

    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;

    /**
     * @dev Constructor.
     * @param _proxy The proxy associated with this contract.
     * @param _name Token's ERC20 name.
     * @param _symbol Token's ERC20 symbol.
     * @param _totalSupply The total supply of the token.
     * @param _tokenState The TokenState contract address.
     * @param _owner The owner of this contract.
     */
    constructor(address _proxy, TokenState _tokenState,
                string _name, string _symbol, uint _totalSupply,
                uint8 _decimals, address _owner)
        SelfDestructible(_owner)
        Proxyable(_proxy, _owner)
        public
    {
        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)
        public
        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(_tokenState);
    }

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

        // 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));

        // If the recipient is a contract, we need to call tokenFallback on it so they can do ERC223
        // actions when receiving our tokens. Unlike the standard, however, we don't revert if the
        // recipient contract doesn't implement tokenFallback.
        callTokenFallbackIfNeeded(from, to, value, data);
        
        // 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 _transfer_byProxy(address from, address to, uint value, bytes data)
        internal
        returns (bool)
    {
        return _internalTransfer(from, to, value, data);
    }

    /**
     * @dev Perform an ERC20 token transferFrom. Designed to be called by transferFrom functions
     * possessing the optionalProxy or optionalProxy modifiers.
     */
    function _transferFrom_byProxy(address sender, address from, address to, uint value, bytes data)
        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, data);
    }

    /**
     * @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 ========== */

    event Transfer(address indexed from, address indexed to, uint value);
    bytes32 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, bytes32(from), bytes32(to), 0);
    }

    event Approval(address indexed owner, address indexed spender, uint value);
    bytes32 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, bytes32(owner), bytes32(spender), 0);
    }

    event TokenStateUpdated(address newTokenState);
    bytes32 constant TOKENSTATEUPDATED_SIG = keccak256("TokenStateUpdated(address)");
    function emitTokenStateUpdated(address newTokenState) internal {
        proxy._emit(abi.encode(newTokenState), 1, TOKENSTATEUPDATED_SIG, 0, 0, 0);
    }
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       SupplySchedule.sol
version:    1.0
author:     Jackson Chan
            Clinton Ennis
date:       2019-03-01

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

Supply Schedule contract. SNX is a transferable ERC20 token.

User's get staking rewards as part of the incentives of
+------+-------------+--------------+----------+
| Year |  Increase   | Total Supply | Increase |
+------+-------------+--------------+----------+
|    1 |           0 |  100,000,000 |          |
|    2 |  75,000,000 |  175,000,000 | 75%      |
|    3 |  37,500,000 |  212,500,000 | 21%      |
|    4 |  18,750,000 |  231,250,000 | 9%       |
|    5 |   9,375,000 |  240,625,000 | 4%       |
|    6 |   4,687,500 |  245,312,500 | 2%       |
+------+-------------+--------------+----------+


-----------------------------------------------------------------
*/


/**
 * @title SupplySchedule contract
 */
contract SupplySchedule is Owned {
    using SafeMath for uint;
    using SafeDecimalMath for uint;

    /* Storage */
    struct ScheduleData {
        // Total supply issuable during period
        uint totalSupply;

        // UTC Time - Start of the schedule
        uint startPeriod;

        // UTC Time - End of the schedule
        uint endPeriod;

        // UTC Time - Total of supply minted
        uint totalSupplyMinted;
    }

    // How long each mint period is
    uint public mintPeriodDuration = 1 weeks;

    // time supply last minted
    uint public lastMintEvent;

    Synthetix public synthetix;

    uint constant SECONDS_IN_YEAR = 60 * 60 * 24 * 365;

    uint public constant START_DATE = 1520294400; // 2018-03-06T00:00:00+00:00
    uint public constant YEAR_ONE = START_DATE + SECONDS_IN_YEAR.mul(1);
    uint public constant YEAR_TWO = START_DATE + SECONDS_IN_YEAR.mul(2);
    uint public constant YEAR_THREE = START_DATE + SECONDS_IN_YEAR.mul(3);
    uint public constant YEAR_FOUR = START_DATE + SECONDS_IN_YEAR.mul(4);
    uint public constant YEAR_FIVE = START_DATE + SECONDS_IN_YEAR.mul(5);
    uint public constant YEAR_SIX = START_DATE + SECONDS_IN_YEAR.mul(6);
    uint public constant YEAR_SEVEN = START_DATE + SECONDS_IN_YEAR.mul(7);

    uint8 constant public INFLATION_SCHEDULES_LENGTH = 7;
    ScheduleData[INFLATION_SCHEDULES_LENGTH] public schedules;

    uint public minterReward = 200 * SafeDecimalMath.unit();

    constructor(address _owner)
        Owned(_owner)
        public
    {
        // ScheduleData(totalSupply, startPeriod, endPeriod, totalSupplyMinted)
        // Year 1 - Total supply 100,000,000
        schedules[0] = ScheduleData(1e8 * SafeDecimalMath.unit(), START_DATE, YEAR_ONE - 1, 1e8 * SafeDecimalMath.unit());
        schedules[1] = ScheduleData(75e6 * SafeDecimalMath.unit(), YEAR_ONE, YEAR_TWO - 1, 0); // Year 2 - Total supply 175,000,000
        schedules[2] = ScheduleData(37.5e6 * SafeDecimalMath.unit(), YEAR_TWO, YEAR_THREE - 1, 0); // Year 3 - Total supply 212,500,000
        schedules[3] = ScheduleData(18.75e6 * SafeDecimalMath.unit(), YEAR_THREE, YEAR_FOUR - 1, 0); // Year 4 - Total supply 231,250,000
        schedules[4] = ScheduleData(9.375e6 * SafeDecimalMath.unit(), YEAR_FOUR, YEAR_FIVE - 1, 0); // Year 5 - Total supply 240,625,000
        schedules[5] = ScheduleData(4.6875e6 * SafeDecimalMath.unit(), YEAR_FIVE, YEAR_SIX - 1, 0); // Year 6 - Total supply 245,312,500
        schedules[6] = ScheduleData(0, YEAR_SIX, YEAR_SEVEN - 1, 0); // Year 7 - Total supply 245,312,500
    }

    // ========== SETTERS ========== */
    function setSynthetix(Synthetix _synthetix)
        external
        onlyOwner
    {
        synthetix = _synthetix;
        // emit event
    }

    // ========== VIEWS ==========
    function mintableSupply()
        public
        view
        returns (uint)
    {
        if (!isMintable()) {
            return 0;
        }

        uint index = getCurrentSchedule();

        // Calculate previous year's mintable supply
        uint amountPreviousPeriod = _remainingSupplyFromPreviousYear(index);

        /* solium-disable */

        // Last mint event within current period will use difference in (now - lastMintEvent)
        // Last mint event not set (0) / outside of current Period will use current Period
        // start time resolved in (now - schedule.startPeriod)
        ScheduleData memory schedule = schedules[index];

        uint weeksInPeriod = (schedule.endPeriod - schedule.startPeriod).div(mintPeriodDuration);

        uint supplyPerWeek = schedule.totalSupply.divideDecimal(weeksInPeriod);

        uint weeksToMint = lastMintEvent >= schedule.startPeriod ? _numWeeksRoundedDown(now.sub(lastMintEvent)) : _numWeeksRoundedDown(now.sub(schedule.startPeriod));
        // /* solium-enable */

        uint amountInPeriod = supplyPerWeek.multiplyDecimal(weeksToMint);
        return amountInPeriod.add(amountPreviousPeriod);
    }

    function _numWeeksRoundedDown(uint _timeDiff)
        public
        view
        returns (uint)
    {
        // Take timeDiff in seconds (Dividend) and mintPeriodDuration as (Divisor)
        // Calculate the numberOfWeeks since last mint rounded down to 1 week
        // Fraction of a week will return 0
        return _timeDiff.div(mintPeriodDuration);
    }

    function isMintable()
        public
        view
        returns (bool)
    {
        bool mintable = false;
        if (now - lastMintEvent > mintPeriodDuration && now <= schedules[6].endPeriod) // Ensure time is not after end of Year 7
        {
            mintable = true;
        }
        return mintable;
    }

    // Return the current schedule based on the timestamp
    // applicable based on startPeriod and endPeriod
    function getCurrentSchedule()
        public
        view
        returns (uint)
    {
        require(now <= schedules[6].endPeriod, "Mintable periods have ended");

        for (uint i = 0; i < INFLATION_SCHEDULES_LENGTH; i++) {
            if (schedules[i].startPeriod <= now && schedules[i].endPeriod >= now) {
                return i;
            }
        }
    }

    function _remainingSupplyFromPreviousYear(uint currentSchedule)
        internal
        view
        returns (uint)
    {
        // All supply has been minted for previous period if last minting event is after
        // the endPeriod for last year
        if (currentSchedule == 0 || lastMintEvent > schedules[currentSchedule - 1].endPeriod) {
            return 0;
        }

        // return the remaining supply to be minted for previous period missed
        uint amountInPeriod = schedules[currentSchedule - 1].totalSupply.sub(schedules[currentSchedule - 1].totalSupplyMinted);

        // Ensure previous period remaining amount is not less than 0
        if (amountInPeriod < 0) {
            return 0;
        }

        return amountInPeriod;
    }

    // ========== MUTATIVE FUNCTIONS ==========
    function updateMintValues()
        external
        onlySynthetix
        returns (bool)
    {
        // Will fail if the time is outside of schedules
        uint currentIndex = getCurrentSchedule();
        uint lastPeriodAmount = _remainingSupplyFromPreviousYear(currentIndex);
        uint currentPeriodAmount = mintableSupply().sub(lastPeriodAmount);

        // Update schedule[n - 1].totalSupplyMinted
        if (lastPeriodAmount > 0) {
            schedules[currentIndex - 1].totalSupplyMinted = schedules[currentIndex - 1].totalSupplyMinted.add(lastPeriodAmount);
        }

        // Update schedule.totalSupplyMinted for currentSchedule
        schedules[currentIndex].totalSupplyMinted = schedules[currentIndex].totalSupplyMinted.add(currentPeriodAmount);
        // Update mint event to now
        lastMintEvent = now;

        emit SupplyMinted(lastPeriodAmount, currentPeriodAmount, currentIndex, now);
        return true;
    }

    function setMinterReward(uint _amount)
        external
        onlyOwner
    {
        minterReward = _amount;
        emit MinterRewardUpdated(_amount);
    }

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

    modifier onlySynthetix() {
        require(msg.sender == address(synthetix), "Only the synthetix contract can perform this action");
        _;
    }

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

    event SupplyMinted(uint previousPeriodAmount, uint currentAmount, uint indexed schedule, uint timestamp);
    event MinterRewardUpdated(uint newRewardAmount);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       ExchangeRates.sol
version:    1.0
author:     Kevin Brown
date:       2018-09-12

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A contract that any other contract in the Synthetix system can query
for the current market value of various assets, including
crypto assets as well as various fiat assets.

This contract assumes that rate updates will completely update
all rates to their current values. If a rate shock happens
on a single asset, the oracle will still push updated rates
for all other assets.

-----------------------------------------------------------------
*/


/**
 * @title The repository for exchange rates
 */

contract ExchangeRates is SelfDestructible {


    using SafeMath for uint;
    using SafeDecimalMath for uint;

    // Exchange rates stored by currency code, e.g. 'SNX', or 'sUSD'
    mapping(bytes32 => uint) public rates;

    // Update times stored by currency code, e.g. 'SNX', or 'sUSD'
    mapping(bytes32 => uint) public lastRateUpdateTimes;

    // The address of the oracle which pushes rate updates to this contract
    address public oracle;

    // Do not allow the oracle to submit times any further forward into the future than this constant.
    uint constant ORACLE_FUTURE_LIMIT = 10 minutes;

    // How long will the contract assume the rate of any asset is correct
    uint public rateStalePeriod = 3 hours;

    // Lock exchanges until price update complete
    bool public priceUpdateLock = false;

    // Each participating currency in the XDR basket is represented as a currency key with
    // equal weighting.
    // There are 5 participating currencies, so we'll declare that clearly.
    bytes32[5] public xdrParticipants;

    // For inverted prices, keep a mapping of their entry, limits and frozen status
    struct InversePricing {
        uint entryPoint;
        uint upperLimit;
        uint lowerLimit;
        bool frozen;
    }
    mapping(bytes32 => InversePricing) public inversePricing;
    bytes32[] public invertedKeys;

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

    /**
     * @dev Constructor
     * @param _owner The owner of this contract.
     * @param _oracle The address which is able to update rate information.
     * @param _currencyKeys The initial currency keys to store (in order).
     * @param _newRates The initial currency amounts for each currency (in order).
     */
    constructor(
        // SelfDestructible (Ownable)
        address _owner,

        // Oracle values - Allows for rate updates
        address _oracle,
        bytes32[] _currencyKeys,
        uint[] _newRates
    )
        /* Owned is initialised in SelfDestructible */
        SelfDestructible(_owner)
        public
    {
        require(_currencyKeys.length == _newRates.length, "Currency key length and rate length must match.");

        oracle = _oracle;

        // The sUSD rate is always 1 and is never stale.
        rates["sUSD"] = SafeDecimalMath.unit();
        lastRateUpdateTimes["sUSD"] = now;

        // These are the currencies that make up the XDR basket.
        // These are hard coded because:
        //  - This way users can depend on the calculation and know it won't change for this deployment of the contract.
        //  - Adding new currencies would likely introduce some kind of weighting factor, which
        //    isn't worth preemptively adding when all of the currencies in the current basket are weighted at 1.
        //  - The expectation is if this logic needs to be updated, we'll simply deploy a new version of this contract
        //    then point the system at the new version.
        xdrParticipants = [
            bytes32("sUSD"),
            bytes32("sAUD"),
            bytes32("sCHF"),
            bytes32("sEUR"),
            bytes32("sGBP")
        ];

        internalUpdateRates(_currencyKeys, _newRates, now);
    }

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

    /**
     * @notice Set the rates stored in this contract
     * @param currencyKeys The currency keys you wish to update the rates for (in order)
     * @param newRates The rates for each currency (in order)
     * @param timeSent The timestamp of when the update was sent, specified in seconds since epoch (e.g. the same as the now keyword in solidity).contract
     *                 This is useful because transactions can take a while to confirm, so this way we know how old the oracle's datapoint was exactly even
     *                 if it takes a long time for the transaction to confirm.
     */
    function updateRates(bytes32[] currencyKeys, uint[] newRates, uint timeSent)
        external
        onlyOracle
        returns(bool)
    {
        return internalUpdateRates(currencyKeys, newRates, timeSent);
    }

    /**
     * @notice Internal function which sets the rates stored in this contract
     * @param currencyKeys The currency keys you wish to update the rates for (in order)
     * @param newRates The rates for each currency (in order)
     * @param timeSent The timestamp of when the update was sent, specified in seconds since epoch (e.g. the same as the now keyword in solidity).contract
     *                 This is useful because transactions can take a while to confirm, so this way we know how old the oracle's datapoint was exactly even
     *                 if it takes a long time for the transaction to confirm.
     */
    function internalUpdateRates(bytes32[] currencyKeys, uint[] newRates, uint timeSent)
        internal
        returns(bool)
    {
        require(currencyKeys.length == newRates.length, "Currency key array length must match rates array length.");
        require(timeSent < (now + ORACLE_FUTURE_LIMIT), "Time is too far into the future");

        // Loop through each key and perform update.
        for (uint i = 0; i < currencyKeys.length; i++) {
            // Should not set any rate to zero ever, as no asset will ever be
            // truely worthless and still valid. In this scenario, we should
            // delete the rate and remove it from the system.
            require(newRates[i] != 0, "Zero is not a valid rate, please call deleteRate instead.");
            require(currencyKeys[i] != "sUSD", "Rate of sUSD cannot be updated, it's always UNIT.");

            // We should only update the rate if it's at least the same age as the last rate we've got.
            if (timeSent < lastRateUpdateTimes[currencyKeys[i]]) {
                continue;
            }

            newRates[i] = rateOrInverted(currencyKeys[i], newRates[i]);

            // Ok, go ahead with the update.
            rates[currencyKeys[i]] = newRates[i];
            lastRateUpdateTimes[currencyKeys[i]] = timeSent;
        }

        emit RatesUpdated(currencyKeys, newRates);

        // Now update our XDR rate.
        updateXDRRate(timeSent);

        // If locked during a priceupdate then reset it
        if (priceUpdateLock) {
            priceUpdateLock = false;
        }

        return true;
    }

    /**
     * @notice Internal function to get the inverted rate, if any, and mark an inverted
     *  key as frozen if either limits are reached.
     * @param currencyKey The price key to lookup
     * @param rate The rate for the given price key
     */
    function rateOrInverted(bytes32 currencyKey, uint rate) internal returns (uint) {
        // if an inverse mapping exists, adjust the price accordingly
        InversePricing storage inverse = inversePricing[currencyKey];
        if (inverse.entryPoint <= 0) {
            return rate;
        }

        // set the rate to the current rate initially (if it's frozen, this is what will be returned)
        uint newInverseRate = rates[currencyKey];

        // get the new inverted rate if not frozen
        if (!inverse.frozen) {
            uint doubleEntryPoint = inverse.entryPoint.mul(2);
            if (doubleEntryPoint <= rate) {
                // avoid negative numbers for unsigned ints, so set this to 0
                // which by the requirement that lowerLimit be > 0 will
                // cause this to freeze the price to the lowerLimit
                newInverseRate = 0;
            } else {
                newInverseRate = doubleEntryPoint.sub(rate);
            }

            // now if new rate hits our limits, set it to the limit and freeze
            if (newInverseRate >= inverse.upperLimit) {
                newInverseRate = inverse.upperLimit;
            } else if (newInverseRate <= inverse.lowerLimit) {
                newInverseRate = inverse.lowerLimit;
            }

            if (newInverseRate == inverse.upperLimit || newInverseRate == inverse.lowerLimit) {
                inverse.frozen = true;
                emit InversePriceFrozen(currencyKey);
            }
        }

        return newInverseRate;
    }

    /**
     * @notice Update the Synthetix Drawing Rights exchange rate based on other rates already updated.
     */
    function updateXDRRate(uint timeSent)
        internal
    {
        uint total = 0;

        for (uint i = 0; i < xdrParticipants.length; i++) {
            total = rates[xdrParticipants[i]].add(total);
        }

        // Set the rate
        rates["XDR"] = total;

        // Record that we updated the XDR rate.
        lastRateUpdateTimes["XDR"] = timeSent;

        // Emit our updated event separate to the others to save
        // moving data around between arrays.
        bytes32[] memory eventCurrencyCode = new bytes32[](1);
        eventCurrencyCode[0] = "XDR";

        uint[] memory eventRate = new uint[](1);
        eventRate[0] = rates["XDR"];

        emit RatesUpdated(eventCurrencyCode, eventRate);
    }

    /**
     * @notice Delete a rate stored in the contract
     * @param currencyKey The currency key you wish to delete the rate for
     */
    function deleteRate(bytes32 currencyKey)
        external
        onlyOracle
    {
        require(rates[currencyKey] > 0, "Rate is zero");

        delete rates[currencyKey];
        delete lastRateUpdateTimes[currencyKey];

        emit RateDeleted(currencyKey);
    }

    /**
     * @notice Set the Oracle that pushes the rate information to this contract
     * @param _oracle The new oracle address
     */
    function setOracle(address _oracle)
        external
        onlyOwner
    {
        oracle = _oracle;
        emit OracleUpdated(oracle);
    }

    /**
     * @notice Set the stale period on the updated rate variables
     * @param _time The new rateStalePeriod
     */
    function setRateStalePeriod(uint _time)
        external
        onlyOwner
    {
        rateStalePeriod = _time;
        emit RateStalePeriodUpdated(rateStalePeriod);
    }

    /**
     * @notice Set the the locked state for a priceUpdate call
     * @param _priceUpdateLock lock boolean flag
     */
    function setPriceUpdateLock(bool _priceUpdateLock)
        external
        onlyOracle
    {
        priceUpdateLock = _priceUpdateLock;
    }

    /**
     * @notice Set an inverse price up for the currency key
     * @param currencyKey The currency to update
     * @param entryPoint The entry price point of the inverted price
     * @param upperLimit The upper limit, at or above which the price will be frozen
     * @param lowerLimit The lower limit, at or below which the price will be frozen
     */
    function setInversePricing(bytes32 currencyKey, uint entryPoint, uint upperLimit, uint lowerLimit)
        external onlyOwner
    {
        require(entryPoint > 0, "entryPoint must be above 0");
        require(lowerLimit > 0, "lowerLimit must be above 0");
        require(upperLimit > entryPoint, "upperLimit must be above the entryPoint");
        require(upperLimit < entryPoint.mul(2), "upperLimit must be less than double entryPoint");
        require(lowerLimit < entryPoint, "lowerLimit must be below the entryPoint");

        if (inversePricing[currencyKey].entryPoint <= 0) {
            // then we are adding a new inverse pricing, so add this
            invertedKeys.push(currencyKey);
        }
        inversePricing[currencyKey].entryPoint = entryPoint;
        inversePricing[currencyKey].upperLimit = upperLimit;
        inversePricing[currencyKey].lowerLimit = lowerLimit;
        inversePricing[currencyKey].frozen = false;

        emit InversePriceConfigured(currencyKey, entryPoint, upperLimit, lowerLimit);
    }

    /**
     * @notice Remove an inverse price for the currency key
     * @param currencyKey The currency to remove inverse pricing for
     */
    function removeInversePricing(bytes32 currencyKey) external onlyOwner {
        inversePricing[currencyKey].entryPoint = 0;
        inversePricing[currencyKey].upperLimit = 0;
        inversePricing[currencyKey].lowerLimit = 0;
        inversePricing[currencyKey].frozen = false;

        // now remove inverted key from array
        for (uint8 i = 0; i < invertedKeys.length; i++) {
            if (invertedKeys[i] == currencyKey) {
                delete invertedKeys[i];

                // Copy the last key into the place of the one we just deleted
                // If there's only one key, this is array[0] = array[0].
                // If we're deleting the last one, it's also a NOOP in the same way.
                invertedKeys[i] = invertedKeys[invertedKeys.length - 1];

                // Decrease the size of the array by one.
                invertedKeys.length--;

                break;
            }
        }

        emit InversePriceConfigured(currencyKey, 0, 0, 0);
    }
    /* ========== VIEWS ========== */

    /**
     * @notice A function that lets you easily convert an amount in a source currency to an amount in the destination currency
     * @param sourceCurrencyKey The currency the amount is specified in
     * @param sourceAmount The source amount, specified in UNIT base
     * @param destinationCurrencyKey The destination currency
     */
    function effectiveValue(bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey)
        public
        view
        rateNotStale(sourceCurrencyKey)
        rateNotStale(destinationCurrencyKey)
        returns (uint)
    {
        // If there's no change in the currency, then just return the amount they gave us
        if (sourceCurrencyKey == destinationCurrencyKey) return sourceAmount;

        // Calculate the effective value by going from source -> USD -> destination
        return sourceAmount.multiplyDecimalRound(rateForCurrency(sourceCurrencyKey))
            .divideDecimalRound(rateForCurrency(destinationCurrencyKey));
    }

    /**
     * @notice Retrieve the rate for a specific currency
     */
    function rateForCurrency(bytes32 currencyKey)
        public
        view
        returns (uint)
    {
        return rates[currencyKey];
    }

    /**
     * @notice Retrieve the rates for a list of currencies
     */
    function ratesForCurrencies(bytes32[] currencyKeys)
        public
        view
        returns (uint[])
    {
        uint[] memory _rates = new uint[](currencyKeys.length);

        for (uint8 i = 0; i < currencyKeys.length; i++) {
            _rates[i] = rates[currencyKeys[i]];
        }

        return _rates;
    }

    /**
     * @notice Retrieve a list of last update times for specific currencies
     */
    function lastRateUpdateTimeForCurrency(bytes32 currencyKey)
        public
        view
        returns (uint)
    {
        return lastRateUpdateTimes[currencyKey];
    }

    /**
     * @notice Retrieve the last update time for a specific currency
     */
    function lastRateUpdateTimesForCurrencies(bytes32[] currencyKeys)
        public
        view
        returns (uint[])
    {
        uint[] memory lastUpdateTimes = new uint[](currencyKeys.length);

        for (uint8 i = 0; i < currencyKeys.length; i++) {
            lastUpdateTimes[i] = lastRateUpdateTimes[currencyKeys[i]];
        }

        return lastUpdateTimes;
    }

    /**
     * @notice Check if a specific currency's rate hasn't been updated for longer than the stale period.
     */
    function rateIsStale(bytes32 currencyKey)
        public
        view
        returns (bool)
    {
        // sUSD is a special case and is never stale.
        if (currencyKey == "sUSD") return false;

        return lastRateUpdateTimes[currencyKey].add(rateStalePeriod) < now;
    }

    /**
     * @notice Check if any rate is frozen (cannot be exchanged into)
     */
    function rateIsFrozen(bytes32 currencyKey)
        external
        view
        returns (bool)
    {
        return inversePricing[currencyKey].frozen;
    }


    /**
     * @notice Check if any of the currency rates passed in haven't been updated for longer than the stale period.
     */
    function anyRateIsStale(bytes32[] currencyKeys)
        external
        view
        returns (bool)
    {
        // Loop through each key and check whether the data point is stale.
        uint256 i = 0;

        while (i < currencyKeys.length) {
            // sUSD is a special case and is never false
            if (currencyKeys[i] != "sUSD" && lastRateUpdateTimes[currencyKeys[i]].add(rateStalePeriod) < now) {
                return true;
            }
            i += 1;
        }

        return false;
    }

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

    modifier rateNotStale(bytes32 currencyKey) {
        require(!rateIsStale(currencyKey), "Rate stale or nonexistant currency");
        _;
    }

    modifier onlyOracle
    {
        require(msg.sender == oracle, "Only the oracle can perform this action");
        _;
    }

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

    event OracleUpdated(address newOracle);
    event RateStalePeriodUpdated(uint rateStalePeriod);
    event RatesUpdated(bytes32[] currencyKeys, uint[] newRates);
    event RateDeleted(bytes32 currencyKey);
    event InversePriceConfigured(bytes32 currencyKey, uint entryPoint, uint upperLimit, uint lowerLimit);
    event InversePriceFrozen(bytes32 currencyKey);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       LimitedSetup.sol
version:    1.1
author:     Anton Jurisevic

date:       2018-05-15

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A contract with a limited setup period. Any function modified
with the setup modifier will cease to work after the
conclusion of the configurable-length post-construction setup period.

-----------------------------------------------------------------
*/


/**
 * @title Any function decorated with the modifier this contract provides
 * deactivates after a specified setup period.
 */
contract LimitedSetup {

    uint setupExpiryTime;

    /**
     * @dev LimitedSetup Constructor.
     * @param setupDuration The time the setup period will last for.
     */
    constructor(uint setupDuration)
        public
    {
        setupExpiryTime = now + setupDuration;
    }

    modifier onlyDuringSetup
    {
        require(now < setupExpiryTime, "Can only perform this action during setup");
        _;
    }
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       SynthetixState.sol
version:    1.0
author:     Kevin Brown
date:       2018-10-19

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A contract that holds issuance state and preferred currency of
users in the Synthetix system.

This contract is used side by side with the Synthetix contract
to make it easier to upgrade the contract logic while maintaining
issuance state.

The Synthetix contract is also quite large and on the edge of
being beyond the contract size limit without moving this information
out to another contract.

The first deployed contract would create this state contract,
using it as its store of issuance data.

When a new contract is deployed, it links to the existing
state contract, whose owner would then change its associated
contract to the new one.

-----------------------------------------------------------------
*/


/**
 * @title Synthetix State
 * @notice Stores issuance information and preferred currency information of the Synthetix contract.
 */
contract SynthetixState is State, LimitedSetup {
    using SafeMath for uint;
    using SafeDecimalMath for uint;

    // A struct for handing values associated with an individual user's debt position
    struct IssuanceData {
        // Percentage of the total debt owned at the time
        // of issuance. This number is modified by the global debt
        // delta array. You can figure out a user's exit price and
        // collateralisation ratio using a combination of their initial
        // debt and the slice of global debt delta which applies to them.
        uint initialDebtOwnership;
        // This lets us know when (in relative terms) the user entered
        // the debt pool so we can calculate their exit price and
        // collateralistion ratio
        uint debtEntryIndex;
    }

    // Issued synth balances for individual fee entitlements and exit price calculations
    mapping(address => IssuanceData) public issuanceData;

    // The total count of people that have outstanding issued synths in any flavour
    uint public totalIssuerCount;

    // Global debt pool tracking
    uint[] public debtLedger;

    // Import state
    uint public importedXDRAmount;

    // A quantity of synths greater than this ratio
    // may not be issued against a given value of SNX.
    uint public issuanceRatio = SafeDecimalMath.unit() / 5;
    // No more synths may be issued than the value of SNX backing them.
    uint constant MAX_ISSUANCE_RATIO = SafeDecimalMath.unit();

    // Users can specify their preferred currency, in which case all synths they receive
    // will automatically exchange to that preferred currency upon receipt in their wallet
    mapping(address => bytes4) public preferredCurrency;

    /**
     * @dev Constructor
     * @param _owner The address which controls this contract.
     * @param _associatedContract The ERC20 contract whose state this composes.
     */
    constructor(address _owner, address _associatedContract)
        State(_owner, _associatedContract)
        LimitedSetup(1 weeks)
        public
    {}

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

    /**
     * @notice Set issuance data for an address
     * @dev Only the associated contract may call this.
     * @param account The address to set the data for.
     * @param initialDebtOwnership The initial debt ownership for this address.
     */
    function setCurrentIssuanceData(address account, uint initialDebtOwnership)
        external
        onlyAssociatedContract
    {
        issuanceData[account].initialDebtOwnership = initialDebtOwnership;
        issuanceData[account].debtEntryIndex = debtLedger.length;
    }

    /**
     * @notice Clear issuance data for an address
     * @dev Only the associated contract may call this.
     * @param account The address to clear the data for.
     */
    function clearIssuanceData(address account)
        external
        onlyAssociatedContract
    {
        delete issuanceData[account];
    }

    /**
     * @notice Increment the total issuer count
     * @dev Only the associated contract may call this.
     */
    function incrementTotalIssuerCount()
        external
        onlyAssociatedContract
    {
        totalIssuerCount = totalIssuerCount.add(1);
    }

    /**
     * @notice Decrement the total issuer count
     * @dev Only the associated contract may call this.
     */
    function decrementTotalIssuerCount()
        external
        onlyAssociatedContract
    {
        totalIssuerCount = totalIssuerCount.sub(1);
    }

    /**
     * @notice Append a value to the debt ledger
     * @dev Only the associated contract may call this.
     * @param value The new value to be added to the debt ledger.
     */
    function appendDebtLedgerValue(uint value)
        external
        onlyAssociatedContract
    {
        debtLedger.push(value);
    }

    /**
     * @notice Set preferred currency for a user
     * @dev Only the associated contract may call this.
     * @param account The account to set the preferred currency for
     * @param currencyKey The new preferred currency
     */
    function setPreferredCurrency(address account, bytes4 currencyKey)
        external
        onlyAssociatedContract
    {
        preferredCurrency[account] = currencyKey;
    }

    /**
     * @notice Set the issuanceRatio for issuance calculations.
     * @dev Only callable by the contract owner.
     */
    function setIssuanceRatio(uint _issuanceRatio)
        external
        onlyOwner
    {
        require(_issuanceRatio <= MAX_ISSUANCE_RATIO, "New issuance ratio cannot exceed MAX_ISSUANCE_RATIO");
        issuanceRatio = _issuanceRatio;
        emit IssuanceRatioUpdated(_issuanceRatio);
    }

    /**
     * @notice Import issuer data from the old Synthetix contract before multicurrency
     * @dev Only callable by the contract owner, and only for 1 week after deployment.
     */
    function importIssuerData(address[] accounts, uint[] sUSDAmounts)
        external
        onlyOwner
        onlyDuringSetup
    {
        require(accounts.length == sUSDAmounts.length, "Length mismatch");

        for (uint8 i = 0; i < accounts.length; i++) {
            _addToDebtRegister(accounts[i], sUSDAmounts[i]);
        }
    }

    /**
     * @notice Import issuer data from the old Synthetix contract before multicurrency
     * @dev Only used from importIssuerData above, meant to be disposable
     */
    function _addToDebtRegister(address account, uint amount)
        internal
    {
        // This code is duplicated from Synthetix so that we can call it directly here
        // during setup only.
        Synthetix synthetix = Synthetix(associatedContract);

        // What is the value of the requested debt in XDRs?
        uint xdrValue = synthetix.effectiveValue("sUSD", amount, "XDR");

        // What is the value that we've previously imported?
        uint totalDebtIssued = importedXDRAmount;

        // What will the new total be including the new value?
        uint newTotalDebtIssued = xdrValue.add(totalDebtIssued);

        // Save that for the next import.
        importedXDRAmount = newTotalDebtIssued;

        // What is their percentage (as a high precision int) of the total debt?
        uint debtPercentage = xdrValue.divideDecimalRoundPrecise(newTotalDebtIssued);

        // And what effect does this percentage have on the global debt holding of other issuers?
        // The delta specifically needs to not take into account any existing debt as it's already
        // accounted for in the delta from when they issued previously.
        // The delta is a high precision integer.
        uint delta = SafeDecimalMath.preciseUnit().sub(debtPercentage);

        uint existingDebt = synthetix.debtBalanceOf(account, "XDR");

        // And what does their debt ownership look like including this previous stake?
        if (existingDebt > 0) {
            debtPercentage = xdrValue.add(existingDebt).divideDecimalRoundPrecise(newTotalDebtIssued);
        }

        // Are they a new issuer? If so, record them.
        if (issuanceData[account].initialDebtOwnership == 0) {
            totalIssuerCount = totalIssuerCount.add(1);
        }

        // Save the debt entry parameters
        issuanceData[account].initialDebtOwnership = debtPercentage;
        issuanceData[account].debtEntryIndex = debtLedger.length;

        // And if we're the first, push 1 as there was no effect to any other holders, otherwise push
        // the change for the rest of the debt holders. The debt ledger holds high precision integers.
        if (debtLedger.length > 0) {
            debtLedger.push(
                debtLedger[debtLedger.length - 1].multiplyDecimalRoundPrecise(delta)
            );
        } else {
            debtLedger.push(SafeDecimalMath.preciseUnit());
        }
    }

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

    /**
     * @notice Retrieve the length of the debt ledger array
     */
    function debtLedgerLength()
        external
        view
        returns (uint)
    {
        return debtLedger.length;
    }

    /**
     * @notice Retrieve the most recent entry from the debt ledger
     */
    function lastDebtLedgerEntry()
        external
        view
        returns (uint)
    {
        return debtLedger[debtLedger.length - 1];
    }

    /**
     * @notice Query whether an account has issued and has an outstanding debt balance
     * @param account The address to query for
     */
    function hasIssued(address account)
        external
        view
        returns (bool)
    {
        return issuanceData[account].initialDebtOwnership > 0;
    }

    event IssuanceRatioUpdated(uint newRatio);
}


/**
 * @title FeePool Interface
 * @notice Abstract contract to hold public getters
 */
contract IFeePool {
    address public FEE_ADDRESS;
    uint public exchangeFeeRate;
    function amountReceivedFromExchange(uint value) external view returns (uint);
    function amountReceivedFromTransfer(uint value) external view returns (uint);
    function feePaid(bytes32 currencyKey, uint amount) external;
    function appendAccountIssuanceRecord(address account, uint lockedAmount, uint debtEntryIndex) external;
    function setRewardsToDistribute(uint amount) external;
}


/**
 * @title SynthetixState interface contract
 * @notice Abstract contract to hold public getters
 */
contract ISynthetixState {
    // A struct for handing values associated with an individual user's debt position
    struct IssuanceData {
        // Percentage of the total debt owned at the time
        // of issuance. This number is modified by the global debt
        // delta array. You can figure out a user's exit price and
        // collateralisation ratio using a combination of their initial
        // debt and the slice of global debt delta which applies to them.
        uint initialDebtOwnership;
        // This lets us know when (in relative terms) the user entered
        // the debt pool so we can calculate their exit price and
        // collateralistion ratio
        uint debtEntryIndex;
    }

    uint[] public debtLedger;
    uint public issuanceRatio;
    mapping(address => IssuanceData) public issuanceData;

    function debtLedgerLength() external view returns (uint);
    function hasIssued(address account) external view returns (bool);
    function incrementTotalIssuerCount() external;
    function decrementTotalIssuerCount() external;
    function setCurrentIssuanceData(address account, uint initialDebtOwnership) external;
    function lastDebtLedgerEntry() external view returns (uint);
    function appendDebtLedgerValue(uint value) external;
    function clearIssuanceData(address account) external;
}


interface ISynth {
  function burn(address account, uint amount) external;
  function issue(address account, uint amount) external;
  function transfer(address to, uint value) public returns (bool);
  function triggerTokenFallbackIfNeeded(address sender, address recipient, uint amount) external;
  function transferFrom(address from, address to, uint value) public returns (bool);
}


/**
 * @title SynthetixEscrow interface
 */
interface ISynthetixEscrow {
    function balanceOf(address account) public view returns (uint);
    function appendVestingEntry(address account, uint quantity) public;
}


/**
 * @title ExchangeRates interface
 */
interface IExchangeRates {
    function effectiveValue(bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey) external view returns (uint);

    function rateForCurrency(bytes32 currencyKey) external view returns (uint);
    function ratesForCurrencies(bytes32[] currencyKeys) external view returns (uint[] memory);

    function rateIsStale(bytes32 currencyKey) external view returns (bool);
    function anyRateIsStale(bytes32[] currencyKeys) external view returns (bool);
}


/**
 * @title Synthetix interface contract
 * @notice Abstract contract to hold public getters
 * @dev pseudo interface, actually declared as contract to hold the public getters 
 */


contract ISynthetix {

    // ========== PUBLIC STATE VARIABLES ==========

    IFeePool public feePool;
    ISynthetixEscrow public escrow;
    ISynthetixEscrow public rewardEscrow;
    ISynthetixState public synthetixState;
    IExchangeRates public exchangeRates;

    mapping(bytes32 => Synth) public synths;

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

    function balanceOf(address account) public view returns (uint);
    function transfer(address to, uint value) public returns (bool);
    function effectiveValue(bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey) public view returns (uint);

    function synthInitiatedExchange(
        address from,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address destinationAddress) external returns (bool);
    function exchange(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address destinationAddress) external returns (bool);
    function collateralisationRatio(address issuer) public view returns (uint);
    function totalIssuedSynths(bytes32 currencyKey)
        public
        view
        returns (uint);
    function getSynth(bytes32 currencyKey) public view returns (ISynth);
    function debtBalanceOf(address issuer, bytes32 currencyKey) public view returns (uint);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       Synth.sol
version:    2.0
author:     Kevin Brown
date:       2018-09-13

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

Synthetix-backed stablecoin contract.

This contract issues synths, which are tokens that mirror various
flavours of fiat currency.

Synths are issuable by Synthetix Network Token (SNX) holders who
have to lock up some value of their SNX to issue S * Cmax synths.
Where Cmax issome value less than 1.

A configurable fee is charged on synth transfers and deposited
into a common pot, which Synthetix holders may withdraw from once
per fee period.

-----------------------------------------------------------------
*/


contract Synth is ExternStateToken {

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

    // Address of the FeePoolProxy
    address public feePoolProxy;
    // Address of the SynthetixProxy
    address public synthetixProxy;

    // Currency key which identifies this Synth to the Synthetix system
    bytes32 public currencyKey;

    uint8 constant DECIMALS = 18;

    /* ========== CONSTRUCTOR ========== */

    constructor(address _proxy, TokenState _tokenState, address _synthetixProxy, address _feePoolProxy,
        string _tokenName, string _tokenSymbol, address _owner, bytes32 _currencyKey, uint _totalSupply
    )
        ExternStateToken(_proxy, _tokenState, _tokenName, _tokenSymbol, _totalSupply, DECIMALS, _owner)
        public
    {
        require(_proxy != address(0), "_proxy cannot be 0");
        require(_synthetixProxy != address(0), "_synthetixProxy cannot be 0");
        require(_feePoolProxy != address(0), "_feePoolProxy cannot be 0");
        require(_owner != 0, "_owner cannot be 0");
        require(ISynthetix(_synthetixProxy).synths(_currencyKey) == Synth(0), "Currency key is already in use");

        feePoolProxy = _feePoolProxy;
        synthetixProxy = _synthetixProxy;
        currencyKey = _currencyKey;
    }

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

    /**
     * @notice Set the SynthetixProxy should it ever change.
     * The Synth requires Synthetix address as it has the authority
     * to mint and burn synths
     * */
    function setSynthetixProxy(ISynthetix _synthetixProxy)
        external
        optionalProxy_onlyOwner
    {
        synthetixProxy = _synthetixProxy;
        emitSynthetixUpdated(_synthetixProxy);
    }

    /**
     * @notice Set the FeePoolProxy should it ever change.
     * The Synth requires FeePool address as it has the authority
     * to mint and burn for FeePool.claimFees()
     * */
    function setFeePoolProxy(address _feePoolProxy)
        external
        optionalProxy_onlyOwner
    {
        feePoolProxy = _feePoolProxy;
        emitFeePoolUpdated(_feePoolProxy);
    }

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

    /**
     * @notice ERC20 transfer function
     * forward call on to _internalTransfer */
    function transfer(address to, uint value)
        public
        optionalProxy
        returns (bool)
    {
        _notFeeAddress(messageSender);
        bytes memory empty;
        return super._internalTransfer(messageSender, to, value, empty);
    }

    /**
     * @notice ERC223 transfer function
     */
    function transfer(address to, uint value, bytes data)
        public
        optionalProxy
        returns (bool)
    {
        _notFeeAddress(messageSender);
        // And send their result off to the destination address
        return super._internalTransfer(messageSender, to, value, data);
    }

    /**
     * @notice ERC20 transferFrom function
     */
    function transferFrom(address from, address to, uint value)
        public
        optionalProxy
        returns (bool)
    {
        _notFeeAddress(from);
        // Reduce the allowance by the amount we're transferring.
        // The safeSub call will handle an insufficient allowance.
        tokenState.setAllowance(from, messageSender, tokenState.allowance(from, messageSender).sub(value));

        bytes memory empty;
        return super._internalTransfer(from, to, value, empty);
    }

    /**
     * @notice ERC223 transferFrom function
     */
    function transferFrom(address from, address to, uint value, bytes data)
        public
        optionalProxy
        returns (bool)
    {
        _notFeeAddress(from);
        // Reduce the allowance by the amount we're transferring.
        // The safeSub call will handle an insufficient allowance.
        tokenState.setAllowance(from, messageSender, tokenState.allowance(from, messageSender).sub(value));

        return super._internalTransfer(from, to, value, data);
    }

    // Allow synthetix to issue a certain number of synths from an account.
    function issue(address account, uint amount)
        external
        onlySynthetixOrFeePool
    {
        tokenState.setBalanceOf(account, tokenState.balanceOf(account).add(amount));
        totalSupply = totalSupply.add(amount);
        emitTransfer(address(0), account, amount);
        emitIssued(account, amount);
    }

    // Allow synthetix or another synth contract to burn a certain number of synths from an account.
    function burn(address account, uint amount)
        external
        onlySynthetixOrFeePool
    {
        tokenState.setBalanceOf(account, tokenState.balanceOf(account).sub(amount));
        totalSupply = totalSupply.sub(amount);
        emitTransfer(account, address(0), amount);
        emitBurned(account, amount);
    }

    // Allow owner to set the total supply on import.
    function setTotalSupply(uint amount)
        external
        optionalProxy_onlyOwner
    {
        totalSupply = amount;
    }

    // Allow synthetix to trigger a token fallback call from our synths so users get notified on
    // exchange as well as transfer
    function triggerTokenFallbackIfNeeded(address sender, address recipient, uint amount)
        external
        onlySynthetixOrFeePool
    {
        bytes memory empty;
        callTokenFallbackIfNeeded(sender, recipient, amount, empty);
    }


    function _notFeeAddress(address account)
        internal
        view
    {
        require(account != IFeePool(feePoolProxy).FEE_ADDRESS(), "The fee address is not allowed");
    }

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

    modifier onlySynthetixOrFeePool() {
        bool isSynthetix = msg.sender == address(Proxy(synthetixProxy).target());
        bool isFeePool = msg.sender == address(Proxy(feePoolProxy).target());

        require(isSynthetix || isFeePool, "Only Synthetix, FeePool allowed");
        _;
    }

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

    event SynthetixUpdated(address newSynthetix);
    bytes32 constant SYNTHETIXUPDATED_SIG = keccak256("SynthetixUpdated(address)");
    function emitSynthetixUpdated(address newSynthetix) internal {
        proxy._emit(abi.encode(newSynthetix), 1, SYNTHETIXUPDATED_SIG, 0, 0, 0);
    }

    event FeePoolUpdated(address newFeePool);
    bytes32 constant FEEPOOLUPDATED_SIG = keccak256("FeePoolUpdated(address)");
    function emitFeePoolUpdated(address newFeePool) internal {
        proxy._emit(abi.encode(newFeePool), 1, FEEPOOLUPDATED_SIG, 0, 0, 0);
    }

    event Issued(address indexed account, uint value);
    bytes32 constant ISSUED_SIG = keccak256("Issued(address,uint256)");
    function emitIssued(address account, uint value) internal {
        proxy._emit(abi.encode(value), 2, ISSUED_SIG, bytes32(account), 0, 0);
    }

    event Burned(address indexed account, uint value);
    bytes32 constant BURNED_SIG = keccak256("Burned(address,uint256)");
    function emitBurned(address account, uint value) internal {
        proxy._emit(abi.encode(value), 2, BURNED_SIG, bytes32(account), 0, 0);
    }
}


/**
 * @title RewardsDistribution interface
 */
interface IRewardsDistribution {
    function distributeRewards(uint amount) external;
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       Synthetix.sol
version:    2.0
author:     Kevin Brown
            Gavin Conway
date:       2018-09-14

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

Synthetix token contract. SNX is a transferable ERC20 token,
and also give its holders the following privileges.
An owner of SNX has the right to issue synths in all synth flavours.

After a fee period terminates, the duration and fees collected for that
period are computed, and the next period begins. Thus an account may only
withdraw the fees owed to them for the previous period, and may only do
so once per period. Any unclaimed fees roll over into the common pot for
the next period.

== Average Balance Calculations ==

The fee entitlement of a synthetix holder is proportional to their average
issued synth balance over the last fee period. This is computed by
measuring the area under the graph of a user's issued synth balance over
time, and then when a new fee period begins, dividing through by the
duration of the fee period.

We need only update values when the balances of an account is modified.
This occurs when issuing or burning for issued synth balances,
and when transferring for synthetix balances. This is for efficiency,
and adds an implicit friction to interacting with SNX.
A synthetix holder pays for his own recomputation whenever he wants to change
his position, which saves the foundation having to maintain a pot dedicated
to resourcing this.

A hypothetical user's balance history over one fee period, pictorially:

      s ____
       |    |
       |    |___ p
       |____|___|___ __ _  _
       f    t   n

Here, the balance was s between times f and t, at which time a transfer
occurred, updating the balance to p, until n, when the present transfer occurs.
When a new transfer occurs at time n, the balance being p,
we must:

  - Add the area p * (n - t) to the total area recorded so far
  - Update the last transfer time to n

So if this graph represents the entire current fee period,
the average SNX held so far is ((t-f)*s + (n-t)*p) / (n-f).
The complementary computations must be performed for both sender and
recipient.

Note that a transfer keeps global supply of SNX invariant.
The sum of all balances is constant, and unmodified by any transfer.
So the sum of all balances multiplied by the duration of a fee period is also
constant, and this is equivalent to the sum of the area of every user's
time/balance graph. Dividing through by that duration yields back the total
synthetix supply. So, at the end of a fee period, we really do yield a user's
average share in the synthetix supply over that period.

A slight wrinkle is introduced if we consider the time r when the fee period
rolls over. Then the previous fee period k-1 is before r, and the current fee
period k is afterwards. If the last transfer took place before r,
but the latest transfer occurred afterwards:

k-1       |        k
      s __|_
       |  | |
       |  | |____ p
       |__|_|____|___ __ _  _
          |
       f  | t    n
          r

In this situation the area (r-f)*s contributes to fee period k-1, while
the area (t-r)*s contributes to fee period k. We will implicitly consider a
zero-value transfer to have occurred at time r. Their fee entitlement for the
previous period will be finalised at the time of their first transfer during the
current fee period, or when they query or withdraw their fee entitlement.

In the implementation, the duration of different fee periods may be slightly irregular,
as the check that they have rolled over occurs only when state-changing synthetix
operations are performed.

== Issuance and Burning ==

In this version of the synthetix contract, synths can only be issued by
those that have been nominated by the synthetix foundation. Synths are assumed
to be valued at $1, as they are a stable unit of account.

All synths issued require a proportional value of SNX to be locked,
where the proportion is governed by the current issuance ratio. This
means for every $1 of SNX locked up, $(issuanceRatio) synths can be issued.
i.e. to issue 100 synths, 100/issuanceRatio dollars of SNX need to be locked up.

To determine the value of some amount of SNX(S), an oracle is used to push
the price of SNX (P_S) in dollars to the contract. The value of S
would then be: S * P_S.

Any SNX that are locked up by this issuance process cannot be transferred.
The amount that is locked floats based on the price of SNX. If the price
of SNX moves up, less SNX are locked, so they can be issued against,
or transferred freely. If the price of SNX moves down, more SNX are locked,
even going above the initial wallet balance.

-----------------------------------------------------------------
*/


/**
 * @title Synthetix ERC20 contract.
 * @notice The Synthetix contracts not only facilitates transfers, exchanges, and tracks balances,
 * but it also computes the quantity of fees each synthetix holder is entitled to.
 */
contract Synthetix is ExternStateToken {

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

    // Available Synths which can be used with the system
    Synth[] public availableSynths;
    mapping(bytes32 => Synth) public synths;

    IFeePool public feePool;
    ISynthetixEscrow public escrow;
    ISynthetixEscrow public rewardEscrow;
    ExchangeRates public exchangeRates;
    SynthetixState public synthetixState;
    SupplySchedule public supplySchedule;
    IRewardsDistribution public rewardsDistribution;

    bool private protectionCircuit = false;

    string constant TOKEN_NAME = "Synthetix Network Token";
    string constant TOKEN_SYMBOL = "SNX";
    uint8 constant DECIMALS = 18;
    bool public exchangeEnabled = true;
    uint public gasPriceLimit;

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

    /**
     * @dev Constructor
     * @param _tokenState A pre-populated contract containing token balances.
     * If the provided address is 0x0, then a fresh one will be constructed with the contract owning all tokens.
     * @param _owner The owner of this contract.
     */
    constructor(address _proxy, TokenState _tokenState, SynthetixState _synthetixState,
        address _owner, ExchangeRates _exchangeRates, IFeePool _feePool, SupplySchedule _supplySchedule,
        ISynthetixEscrow _rewardEscrow, ISynthetixEscrow _escrow, IRewardsDistribution _rewardsDistribution, uint _totalSupply
    )
        ExternStateToken(_proxy, _tokenState, TOKEN_NAME, TOKEN_SYMBOL, _totalSupply, DECIMALS, _owner)
        public
    {
        synthetixState = _synthetixState;
        exchangeRates = _exchangeRates;
        feePool = _feePool;
        supplySchedule = _supplySchedule;
        rewardEscrow = _rewardEscrow;
        escrow = _escrow;
        rewardsDistribution = _rewardsDistribution;
    }
    // ========== SETTERS ========== */

    function setFeePool(IFeePool _feePool)
        external
        optionalProxy_onlyOwner
    {
        feePool = _feePool;
    }

    function setExchangeRates(ExchangeRates _exchangeRates)
        external
        optionalProxy_onlyOwner
    {
        exchangeRates = _exchangeRates;
    }

    function setProtectionCircuit(bool _protectionCircuitIsActivated)
        external
        onlyOracle
    {
        protectionCircuit = _protectionCircuitIsActivated;
    }

    function setExchangeEnabled(bool _exchangeEnabled)
        external
        optionalProxy_onlyOwner
    {
        exchangeEnabled = _exchangeEnabled;
    }

    function setGasPriceLimit(uint _gasPriceLimit)
        external
        onlyOracle
    {
        require(_gasPriceLimit > 0, "Needs to be greater than 0");
        gasPriceLimit = _gasPriceLimit;
    }

    /**
     * @notice Add an associated Synth contract to the Synthetix system
     * @dev Only the contract owner may call this.
     */
    function addSynth(Synth synth)
        external
        optionalProxy_onlyOwner
    {
        bytes32 currencyKey = synth.currencyKey();

        require(synths[currencyKey] == Synth(0), "Synth already exists");

        availableSynths.push(synth);
        synths[currencyKey] = synth;
    }

    /**
     * @notice Remove an associated Synth contract from the Synthetix system
     * @dev Only the contract owner may call this.
     */
    function removeSynth(bytes32 currencyKey)
        external
        optionalProxy_onlyOwner
    {
        require(synths[currencyKey] != address(0), "Synth does not exist");
        require(synths[currencyKey].totalSupply() == 0, "Synth supply exists");
        require(currencyKey != "XDR", "Cannot remove XDR synth");

        // Save the address we're removing for emitting the event at the end.
        address synthToRemove = synths[currencyKey];

        // Remove the synth from the availableSynths array.
        for (uint8 i = 0; i < availableSynths.length; i++) {
            if (availableSynths[i] == synthToRemove) {
                delete availableSynths[i];

                // Copy the last synth into the place of the one we just deleted
                // If there's only one synth, this is synths[0] = synths[0].
                // If we're deleting the last one, it's also a NOOP in the same way.
                availableSynths[i] = availableSynths[availableSynths.length - 1];

                // Decrease the size of the array by one.
                availableSynths.length--;

                break;
            }
        }

        // And remove it from the synths mapping
        delete synths[currencyKey];

        // Note: No event here as our contract exceeds max contract size
        // with these events, and it's unlikely people will need to
        // track these events specifically.
    }

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

    /**
     * @notice A function that lets you easily convert an amount in a source currency to an amount in the destination currency
     * @param sourceCurrencyKey The currency the amount is specified in
     * @param sourceAmount The source amount, specified in UNIT base
     * @param destinationCurrencyKey The destination currency
     */
    function effectiveValue(bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey)
        public
        view
        returns (uint)
    {
        return exchangeRates.effectiveValue(sourceCurrencyKey, sourceAmount, destinationCurrencyKey);
    }

    /**
     * @notice Total amount of synths issued by the system, priced in currencyKey
     * @param currencyKey The currency to value the synths in
     */
    function totalIssuedSynths(bytes32 currencyKey)
        public
        view
        rateNotStale(currencyKey)
        returns (uint)
    {
        uint total = 0;
        uint currencyRate = exchangeRates.rateForCurrency(currencyKey);

        require(!exchangeRates.anyRateIsStale(availableCurrencyKeys()), "Rates are stale");

        for (uint8 i = 0; i < availableSynths.length; i++) {
            // What's the total issued value of that synth in the destination currency?
            // Note: We're not using our effectiveValue function because we don't want to go get the
            //       rate for the destination currency and check if it's stale repeatedly on every
            //       iteration of the loop
            uint synthValue = availableSynths[i].totalSupply()
                .multiplyDecimalRound(exchangeRates.rateForCurrency(availableSynths[i].currencyKey()))
                .divideDecimalRound(currencyRate);
            total = total.add(synthValue);
        }

        return total;
    }

    /**
     * @notice Returns the currencyKeys of availableSynths for rate checking
     */
    function availableCurrencyKeys()
        public
        view
        returns (bytes32[])
    {
        bytes32[] memory availableCurrencyKeys = new bytes32[](availableSynths.length);

        for (uint8 i = 0; i < availableSynths.length; i++) {
            availableCurrencyKeys[i] = availableSynths[i].currencyKey();
        }

        return availableCurrencyKeys;
    }

    /**
     * @notice Returns the count of available synths in the system, which you can use to iterate availableSynths
     */
    function availableSynthCount()
        public
        view
        returns (uint)
    {
        return availableSynths.length;
    }

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

    /**
     * @notice ERC20 transfer function.
     */
    function transfer(address to, uint value)
        public
        returns (bool)
    {
        bytes memory empty;
        return transfer(to, value, empty);
    }

    /**
     * @notice ERC223 transfer function. Does not conform with the ERC223 spec, as:
     *         - Transaction doesn't revert if the recipient doesn't implement tokenFallback()
     *         - Emits a standard ERC20 event without the bytes data parameter so as not to confuse
     *           tooling such as Etherscan.
     */
    function transfer(address to, uint value, bytes data)
        public
        optionalProxy
        returns (bool)
    {
        // Ensure they're not trying to exceed their locked amount
        require(value <= transferableSynthetix(messageSender), "Insufficient balance");

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

        return true;
    }

    /**
     * @notice ERC20 transferFrom function.
     */
    function transferFrom(address from, address to, uint value)
        public
        returns (bool)
    {
        bytes memory empty;
        return transferFrom(from, to, value, empty);
    }

    /**
     * @notice ERC223 transferFrom function. Does not conform with the ERC223 spec, as:
     *         - Transaction doesn't revert if the recipient doesn't implement tokenFallback()
     *         - Emits a standard ERC20 event without the bytes data parameter so as not to confuse
     *           tooling such as Etherscan.
     */
    function transferFrom(address from, address to, uint value, bytes data)
        public
        optionalProxy
        returns (bool)
    {
        // Ensure they're not trying to exceed their locked amount
        require(value <= transferableSynthetix(from), "Insufficient balance");

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

        return true;
    }

    /**
     * @notice Function that allows you to exchange synths you hold in one flavour for another.
     * @param sourceCurrencyKey The source currency you wish to exchange from
     * @param sourceAmount The amount, specified in UNIT of source currency you wish to exchange
     * @param destinationCurrencyKey The destination currency you wish to obtain.
     * @param destinationAddress Deprecated. Will always send to messageSender
     * @return Boolean that indicates whether the transfer succeeded or failed.
     */
    function exchange(bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress)
        external
        optionalProxy
        // Note: We don't need to insist on non-stale rates because effectiveValue will do it for us.
        returns (bool)
    {
        require(sourceCurrencyKey != destinationCurrencyKey, "Must use different synths");
        require(sourceAmount > 0, "Zero amount");

        // verify gas price limit
        validateGasPrice(tx.gasprice);

        //  If protectionCircuit is true then we burn the synths through _internalLiquidation()
        if (protectionCircuit) {
            return _internalLiquidation(
                messageSender,
                sourceCurrencyKey,
                sourceAmount
            );
        } else {
            // Pass it along, defaulting to the sender as the recipient.
            return _internalExchange(
                messageSender,
                sourceCurrencyKey,
                sourceAmount,
                destinationCurrencyKey,
                messageSender,
                true // Charge fee on the exchange
            );
        }
    }

    /*
        @dev validate that the given gas price is less than or equal to the gas price limit
        @param _gasPrice tested gas price
    */
    function validateGasPrice(uint _givenGasPrice)
        public
        view
    {
        require(_givenGasPrice <= gasPriceLimit, "Gas price above limit");
    }

    /**
     * @notice Function that allows synth contract to delegate exchanging of a synth that is not the same sourceCurrency
     * @dev Only the synth contract can call this function
     * @param from The address to exchange / burn synth from
     * @param sourceCurrencyKey The source currency you wish to exchange from
     * @param sourceAmount The amount, specified in UNIT of source currency you wish to exchange
     * @param destinationCurrencyKey The destination currency you wish to obtain.
     * @param destinationAddress Where the result should go.
     * @return Boolean that indicates whether the transfer succeeded or failed.
     */
    function synthInitiatedExchange(
        address from,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address destinationAddress
    )
        external
        returns (bool)
    {
        _onlySynth();
        require(sourceCurrencyKey != destinationCurrencyKey, "Can't be same synth");
        require(sourceAmount > 0, "Zero amount");

        // Pass it along
        return _internalExchange(
            from,
            sourceCurrencyKey,
            sourceAmount,
            destinationCurrencyKey,
            destinationAddress,
            false // Don't charge fee on the exchange, as they've already been charged a transfer fee in the synth contract
        );
    }

    /**
     * @notice Function that allows synth contract to delegate sending fee to the fee Pool.
     * @dev fee pool contract address is not allowed to call function
     * @param from The address to move synth from
     * @param sourceCurrencyKey source currency from.
     * @param sourceAmount The amount, specified in UNIT of source currency.
     * @param destinationCurrencyKey The destination currency to obtain.
     * @param destinationAddress Where the result should go.
     * @param chargeFee Boolean to charge a fee for transaction.
     * @return Boolean that indicates whether the transfer succeeded or failed.
     */
    function _internalExchange(
        address from,
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        address destinationAddress,
        bool chargeFee
    )
        internal
        notFeeAddress(from)
        returns (bool)
    {
        require(exchangeEnabled, "Exchanging is disabled");
        require(!exchangeRates.priceUpdateLock(), "Price update lock");
        require(destinationAddress != address(0), "Zero destination");
        require(destinationAddress != address(this), "Synthetix is invalid destination");
        require(destinationAddress != address(proxy), "Proxy is invalid destination");

        // Note: We don't need to check their balance as the burn() below will do a safe subtraction which requires
        // the subtraction to not overflow, which would happen if their balance is not sufficient.

        // Burn the source amount
        synths[sourceCurrencyKey].burn(from, sourceAmount);

        // How much should they get in the destination currency?
        uint destinationAmount = effectiveValue(sourceCurrencyKey, sourceAmount, destinationCurrencyKey);

        // What's the fee on that currency that we should deduct?
        uint amountReceived = destinationAmount;
        uint fee = 0;

        if (chargeFee) {
            amountReceived = feePool.amountReceivedFromExchange(destinationAmount);
            fee = destinationAmount.sub(amountReceived);
        }

        // Issue their new synths
        synths[destinationCurrencyKey].issue(destinationAddress, amountReceived);

        // Remit the fee in XDRs
        if (fee > 0) {
            uint xdrFeeAmount = effectiveValue(destinationCurrencyKey, fee, "XDR");
            synths["XDR"].issue(feePool.FEE_ADDRESS(), xdrFeeAmount);
            // Tell the fee pool about this.
            feePool.feePaid("XDR", xdrFeeAmount);
        }

        // Nothing changes as far as issuance data goes because the total value in the system hasn't changed.

        // Call the ERC223 transfer callback if needed
        synths[destinationCurrencyKey].triggerTokenFallbackIfNeeded(from, destinationAddress, amountReceived);

        //Let the DApps know there was a Synth exchange
        emitSynthExchange(from, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, amountReceived, destinationAddress);

        return true;
    }

    /**
    * @notice Function that burns the amount sent during an exchange in case the protection circuit is activated
    * @param from The address to move synth from
    * @param sourceCurrencyKey source currency from.
    * @param sourceAmount The amount, specified in UNIT of source currency.
    * @return Boolean that indicates whether the transfer succeeded or failed.
    */
    function _internalLiquidation(
        address from,
        bytes32 sourceCurrencyKey,
        uint sourceAmount
    )
        internal
        returns (bool)
    {
        // Burn the source amount
        synths[sourceCurrencyKey].burn(from, sourceAmount);
        return true;
    }

    /**
     * @notice Function that registers new synth as they are isseud. Calculate delta to append to synthetixState.
     * @dev Only internal calls from synthetix address.
     * @param currencyKey The currency to register synths in, for example sUSD or sAUD
     * @param amount The amount of synths to register with a base of UNIT
     */
    function _addToDebtRegister(bytes32 currencyKey, uint amount)
        internal
        optionalProxy
    {
        // What is the value of the requested debt in XDRs?
        uint xdrValue = effectiveValue(currencyKey, amount, "XDR");

        // What is the value of all issued synths of the system (priced in XDRs)?
        uint totalDebtIssued = totalIssuedSynths("XDR");

        // What will the new total be including the new value?
        uint newTotalDebtIssued = xdrValue.add(totalDebtIssued);

        // What is their percentage (as a high precision int) of the total debt?
        uint debtPercentage = xdrValue.divideDecimalRoundPrecise(newTotalDebtIssued);

        // And what effect does this percentage change have on the global debt holding of other issuers?
        // The delta specifically needs to not take into account any existing debt as it's already
        // accounted for in the delta from when they issued previously.
        // The delta is a high precision integer.
        uint delta = SafeDecimalMath.preciseUnit().sub(debtPercentage);

        // How much existing debt do they have?
        uint existingDebt = debtBalanceOf(messageSender, "XDR");

        // And what does their debt ownership look like including this previous stake?
        if (existingDebt > 0) {
            debtPercentage = xdrValue.add(existingDebt).divideDecimalRoundPrecise(newTotalDebtIssued);
        }

        // Are they a new issuer? If so, record them.
        if (!synthetixState.hasIssued(messageSender)) {
            synthetixState.incrementTotalIssuerCount();
        }

        // Save the debt entry parameters
        synthetixState.setCurrentIssuanceData(messageSender, debtPercentage);

        // And if we're the first, push 1 as there was no effect to any other holders, otherwise push
        // the change for the rest of the debt holders. The debt ledger holds high precision integers.
        if (synthetixState.debtLedgerLength() > 0) {
            synthetixState.appendDebtLedgerValue(
                synthetixState.lastDebtLedgerEntry().multiplyDecimalRoundPrecise(delta)
            );
        } else {
            synthetixState.appendDebtLedgerValue(SafeDecimalMath.preciseUnit());
        }
    }

    /**
     * @notice Issue synths against the sender's SNX.
     * @dev Issuance is only allowed if the synthetix price isn't stale. Amount should be larger than 0.
     * @param currencyKey The currency you wish to issue synths in, for example sUSD or sAUD
     * @param amount The amount of synths you wish to issue with a base of UNIT
     */
    function issueSynths(bytes32 currencyKey, uint amount)
        public
        optionalProxy
        // No need to check if price is stale, as it is checked in issuableSynths.
    {
        require(amount <= remainingIssuableSynths(messageSender, currencyKey), "Amount too large");

        // Keep track of the debt they're about to create
        _addToDebtRegister(currencyKey, amount);

        // Create their synths
        synths[currencyKey].issue(messageSender, amount);

        // Store their locked SNX amount to determine their fee % for the period
        _appendAccountIssuanceRecord();
    }

    /**
     * @notice Issue the maximum amount of Synths possible against the sender's SNX.
     * @dev Issuance is only allowed if the synthetix price isn't stale.
     * @param currencyKey The currency you wish to issue synths in, for example sUSD or sAUD
     */
    function issueMaxSynths(bytes32 currencyKey)
        external
        optionalProxy
    {
        // Figure out the maximum we can issue in that currency
        uint maxIssuable = remainingIssuableSynths(messageSender, currencyKey);

        // And issue them
        issueSynths(currencyKey, maxIssuable);
    }

    /**
     * @notice Burn synths to clear issued synths/free SNX.
     * @param currencyKey The currency you're specifying to burn
     * @param amount The amount (in UNIT base) you wish to burn
     * @dev The amount to burn is debased to XDR's
     */
    function burnSynths(bytes32 currencyKey, uint amount)
        external
        optionalProxy
        // No need to check for stale rates as effectiveValue checks rates
    {
        // How much debt do they have?
        uint debtToRemove = effectiveValue(currencyKey, amount, "XDR");
        uint debt = debtBalanceOf(messageSender, "XDR");
        uint debtInCurrencyKey = debtBalanceOf(messageSender, currencyKey);

        require(debt > 0, "No debt to forgive");

        // If they're trying to burn more debt than they actually owe, rather than fail the transaction, let's just
        // clear their debt and leave them be.
        uint amountToRemove = debt < debtToRemove ? debt : debtToRemove;

        // Remove their debt from the ledger
        _removeFromDebtRegister(amountToRemove);

        uint amountToBurn = debtInCurrencyKey < amount ? debtInCurrencyKey : amount;

        // synth.burn does a safe subtraction on balance (so it will revert if there are not enough synths).
        synths[currencyKey].burn(messageSender, amountToBurn);

        // Store their debtRatio against a feeperiod to determine their fee/rewards % for the period
        _appendAccountIssuanceRecord();
    }

    /**
     * @notice Store in the FeePool the users current debt value in the system in XDRs.
     * @dev debtBalanceOf(messageSender, "XDR") to be used with totalIssuedSynths("XDR") to get
     *  users % of the system within a feePeriod.
     */
    function _appendAccountIssuanceRecord()
        internal
    {
        uint initialDebtOwnership;
        uint debtEntryIndex;
        (initialDebtOwnership, debtEntryIndex) = synthetixState.issuanceData(messageSender);

        feePool.appendAccountIssuanceRecord(
            messageSender,
            initialDebtOwnership,
            debtEntryIndex
        );
    }

    /**
     * @notice Remove a debt position from the register
     * @param amount The amount (in UNIT base) being presented in XDRs
     */
    function _removeFromDebtRegister(uint amount)
        internal
    {
        uint debtToRemove = amount;

        // How much debt do they have?
        uint existingDebt = debtBalanceOf(messageSender, "XDR");

        // What is the value of all issued synths of the system (priced in XDRs)?
        uint totalDebtIssued = totalIssuedSynths("XDR");

        // What will the new total after taking out the withdrawn amount
        uint newTotalDebtIssued = totalDebtIssued.sub(debtToRemove);

        uint delta;

        // What will the debt delta be if there is any debt left?
        // Set delta to 0 if no more debt left in system after user
        if (newTotalDebtIssued > 0) {

            // What is the percentage of the withdrawn debt (as a high precision int) of the total debt after?
            uint debtPercentage = debtToRemove.divideDecimalRoundPrecise(newTotalDebtIssued);

            // And what effect does this percentage change have on the global debt holding of other issuers?
            // The delta specifically needs to not take into account any existing debt as it's already
            // accounted for in the delta from when they issued previously.
            delta = SafeDecimalMath.preciseUnit().add(debtPercentage);
        } else {
            delta = 0;
        }

        // Are they exiting the system, or are they just decreasing their debt position?
        if (debtToRemove == existingDebt) {
            synthetixState.setCurrentIssuanceData(messageSender, 0);
            synthetixState.decrementTotalIssuerCount();
        } else {
            // What percentage of the debt will they be left with?
            uint newDebt = existingDebt.sub(debtToRemove);
            uint newDebtPercentage = newDebt.divideDecimalRoundPrecise(newTotalDebtIssued);

            // Store the debt percentage and debt ledger as high precision integers
            synthetixState.setCurrentIssuanceData(messageSender, newDebtPercentage);
        }

        // Update our cumulative ledger. This is also a high precision integer.
        synthetixState.appendDebtLedgerValue(
            synthetixState.lastDebtLedgerEntry().multiplyDecimalRoundPrecise(delta)
        );
    }

    // ========== Issuance/Burning ==========

    /**
     * @notice The maximum synths an issuer can issue against their total synthetix quantity, priced in XDRs.
     * This ignores any already issued synths, and is purely giving you the maximimum amount the user can issue.
     */
    function maxIssuableSynths(address issuer, bytes32 currencyKey)
        public
        view
        // We don't need to check stale rates here as effectiveValue will do it for us.
        returns (uint)
    {
        // What is the value of their SNX balance in the destination currency?
        uint destinationValue = effectiveValue("SNX", collateral(issuer), currencyKey);

        // They're allowed to issue up to issuanceRatio of that value
        return destinationValue.multiplyDecimal(synthetixState.issuanceRatio());
    }

    /**
     * @notice The current collateralisation ratio for a user. Collateralisation ratio varies over time
     * as the value of the underlying Synthetix asset changes, e.g. if a user issues their maximum available
     * synths when they hold $10 worth of Synthetix, they will have issued $2 worth of synths. If the value
     * of Synthetix changes, the ratio returned by this function will adjust accordlingly. Users are
     * incentivised to maintain a collateralisation ratio as close to the issuance ratio as possible by
     * altering the amount of fees they're able to claim from the system.
     */
    function collateralisationRatio(address issuer)
        public
        view
        returns (uint)
    {
        uint totalOwnedSynthetix = collateral(issuer);
        if (totalOwnedSynthetix == 0) return 0;

        uint debtBalance = debtBalanceOf(issuer, "SNX");
        return debtBalance.divideDecimalRound(totalOwnedSynthetix);
    }

    /**
     * @notice If a user issues synths backed by SNX in their wallet, the SNX become locked. This function
     * will tell you how many synths a user has to give back to the system in order to unlock their original
     * debt position. This is priced in whichever synth is passed in as a currency key, e.g. you can price
     * the debt in sUSD, XDR, or any other synth you wish.
     */
    function debtBalanceOf(address issuer, bytes32 currencyKey)
        public
        view
        // Don't need to check for stale rates here because totalIssuedSynths will do it for us
        returns (uint)
    {
        // What was their initial debt ownership?
        uint initialDebtOwnership;
        uint debtEntryIndex;
        (initialDebtOwnership, debtEntryIndex) = synthetixState.issuanceData(issuer);

        // If it's zero, they haven't issued, and they have no debt.
        if (initialDebtOwnership == 0) return 0;

        // Figure out the global debt percentage delta from when they entered the system.
        // This is a high precision integer.
        uint currentDebtOwnership = synthetixState.lastDebtLedgerEntry()
            .divideDecimalRoundPrecise(synthetixState.debtLedger(debtEntryIndex))
            .multiplyDecimalRoundPrecise(initialDebtOwnership);

        // What's the total value of the system in their requested currency?
        uint totalSystemValue = totalIssuedSynths(currencyKey);

        // Their debt balance is their portion of the total system value.
        uint highPrecisionBalance = totalSystemValue.decimalToPreciseDecimal()
            .multiplyDecimalRoundPrecise(currentDebtOwnership);

        return highPrecisionBalance.preciseDecimalToDecimal();
    }

    /**
     * @notice The remaining synths an issuer can issue against their total synthetix balance.
     * @param issuer The account that intends to issue
     * @param currencyKey The currency to price issuable value in
     */
    function remainingIssuableSynths(address issuer, bytes32 currencyKey)
        public
        view
        // Don't need to check for synth existing or stale rates because maxIssuableSynths will do it for us.
        returns (uint)
    {
        uint alreadyIssued = debtBalanceOf(issuer, currencyKey);
        uint max = maxIssuableSynths(issuer, currencyKey);

        if (alreadyIssued >= max) {
            return 0;
        } else {
            return max.sub(alreadyIssued);
        }
    }

    /**
     * @notice The total SNX owned by this account, both escrowed and unescrowed,
     * against which synths can be issued.
     * This includes those already being used as collateral (locked), and those
     * available for further issuance (unlocked).
     */
    function collateral(address account)
        public
        view
        returns (uint)
    {
        uint balance = tokenState.balanceOf(account);

        if (escrow != address(0)) {
            balance = balance.add(escrow.balanceOf(account));
        }

        if (rewardEscrow != address(0)) {
            balance = balance.add(rewardEscrow.balanceOf(account));
        }

        return balance;
    }

    /**
     * @notice The number of SNX that are free to be transferred by an account.
     * @dev When issuing, escrowed SNX are locked first, then non-escrowed
     * SNX are locked last, but escrowed SNX are not transferable, so they are not included
     * in this calculation.
     */
    function transferableSynthetix(address account)
        public
        view
        rateNotStale("SNX")
        returns (uint)
    {
        // How many SNX do they have, excluding escrow?
        // Note: We're excluding escrow here because we're interested in their transferable amount
        // and escrowed SNX are not transferable.
        uint balance = tokenState.balanceOf(account);

        // How many of those will be locked by the amount they've issued?
        // Assuming issuance ratio is 20%, then issuing 20 SNX of value would require
        // 100 SNX to be locked in their wallet to maintain their collateralisation ratio
        // The locked synthetix value can exceed their balance.
        uint lockedSynthetixValue = debtBalanceOf(account, "SNX").divideDecimalRound(synthetixState.issuanceRatio());

        // If we exceed the balance, no SNX are transferable, otherwise the difference is.
        if (lockedSynthetixValue >= balance) {
            return 0;
        } else {
            return balance.sub(lockedSynthetixValue);
        }
    }

    /**
     * @notice Mints the inflationary SNX supply. The inflation shedule is
     * defined in the SupplySchedule contract.
     * The mint() function is publicly callable by anyone. The caller will
     receive a minter reward as specified in supplySchedule.minterReward().
     */
    function mint()
        external
        returns (bool)
    {
        require(rewardsDistribution != address(0), "RewardsDistribution not set");

        uint supplyToMint = supplySchedule.mintableSupply();
        require(supplyToMint > 0, "No supply is mintable");

        supplySchedule.updateMintValues();

        // Set minted SNX balance to RewardEscrow's balance
        // Minus the minterReward and set balance of minter to add reward
        uint minterReward = supplySchedule.minterReward();
        // Get the remainder
        uint amountToDistribute = supplyToMint.sub(minterReward);

        // Set the token balance to the RewardsDistribution contract
        tokenState.setBalanceOf(rewardsDistribution, tokenState.balanceOf(rewardsDistribution).add(amountToDistribute));
        emitTransfer(this, rewardsDistribution, amountToDistribute);

        // Kick off the distribution of rewards
        rewardsDistribution.distributeRewards(amountToDistribute);

        // Assign the minters reward.
        tokenState.setBalanceOf(msg.sender, tokenState.balanceOf(msg.sender).add(minterReward));
        emitTransfer(this, msg.sender, minterReward);

        totalSupply = totalSupply.add(supplyToMint);

        return true;
    }

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

    modifier rateNotStale(bytes32 currencyKey) {
        require(!exchangeRates.rateIsStale(currencyKey), "Rate stale or not a synth");
        _;
    }

    modifier notFeeAddress(address account) {
        require(account != feePool.FEE_ADDRESS(), "Fee address not allowed");
        _;
    }

    /**
     * @notice Only a synth can call this function, optionally via synthetixProxy or directly
     * @dev This used to be a modifier but instead of duplicating the bytecode into
     * The functions implementing it they now call this internal function to save bytecode space
     */
    function _onlySynth()
        internal
        view
        optionalProxy
    {
        bool isSynth = false;

        // No need to repeatedly call this function either
        for (uint8 i = 0; i < availableSynths.length; i++) {
            if (availableSynths[i] == messageSender) {
                isSynth = true;
                break;
            }
        }

        require(isSynth, "Only synth allowed");
    }

    modifier onlyOracle
    {
        require(msg.sender == exchangeRates.oracle(), "Only oracle allowed");
        _;
    }

    // ========== EVENTS ==========
    /* solium-disable */
    event SynthExchange(address indexed account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey,  uint256 toAmount, address toAddress);
    bytes32 constant SYNTHEXCHANGE_SIG = keccak256("SynthExchange(address,bytes32,uint256,bytes32,uint256,address)");
    function emitSynthExchange(address account, bytes32 fromCurrencyKey, uint256 fromAmount, bytes32 toCurrencyKey, uint256 toAmount, address toAddress) internal {
        proxy._emit(abi.encode(fromCurrencyKey, fromAmount, toCurrencyKey, toAmount, toAddress), 2, SYNTHEXCHANGE_SIG, bytes32(account), 0, 0);
    }
    /* solium-enable */
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_gasPriceLimit","type":"uint256"}],"name":"setGasPriceLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes32"}],"name":"removeSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes32"},{"name":"amount","type":"uint256"}],"name":"issueSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_integrationProxy","type":"address"}],"name":"setIntegrationProxy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initiationTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_feePool","type":"address"}],"name":"setFeePool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"sourceCurrencyKey","type":"bytes32"},{"name":"sourceAmount","type":"uint256"},{"name":"destinationCurrencyKey","type":"bytes32"},{"name":"destinationAddress","type":"address"}],"name":"exchange","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"}],"name":"setSelfDestructBeneficiary","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"synths","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"terminateSelfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardsDistribution","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRates","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_exchangeRates","type":"address"}],"name":"setExchangeRates","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"sourceCurrencyKey","type":"bytes32"},{"name":"sourceAmount","type":"uint256"},{"name":"destinationCurrencyKey","type":"bytes32"}],"name":"effectiveValue","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"transferableSynthetix","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_givenGasPrice","type":"uint256"}],"name":"validateGasPrice","outputs":[],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableCurrencyKeys","outputs":[{"name":"","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"},{"name":"currencyKey","type":"bytes32"}],"name":"remainingIssuableSynths","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"availableSynths","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"currencyKey","type":"bytes32"}],"name":"totalIssuedSynths","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"synth","type":"address"}],"name":"addSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_exchangeEnabled","type":"bool"}],"name":"setExchangeEnabled","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gasPriceLimit","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proxy","type":"address"}],"name":"setProxy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"selfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"integrationProxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenState","type":"address"}],"name":"setTokenState","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"}],"name":"collateralisationRatio","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardEscrow","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SELFDESTRUCT_DELAY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"collateral","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"},{"name":"currencyKey","type":"bytes32"}],"name":"maxIssuableSynths","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"sourceCurrencyKey","type":"bytes32"},{"name":"sourceAmount","type":"uint256"},{"name":"destinationCurrencyKey","type":"bytes32"},{"name":"destinationAddress","type":"address"}],"name":"synthInitiatedExchange","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feePool","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"selfDestructInitiated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"}],"name":"setMessageSender","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"initiateSelfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"supplySchedule","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"selfDestructBeneficiary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_protectionCircuitIsActivated","type":"bool"}],"name":"setProtectionCircuit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"},{"name":"currencyKey","type":"bytes32"}],"name":"debtBalanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"synthetixState","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableSynthCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"escrow","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenState","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes32"},{"name":"amount","type":"uint256"}],"name":"burnSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"proxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes32"}],"name":"issueMaxSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_proxy","type":"address"},{"name":"_tokenState","type":"address"},{"name":"_synthetixState","type":"address"},{"name":"_owner","type":"address"},{"name":"_exchangeRates","type":"address"},{"name":"_feePool","type":"address"},{"name":"_supplySchedule","type":"address"},{"name":"_rewardEscrow","type":"address"},{"name":"_escrow","type":"address"},{"name":"_rewardsDistribution","type":"address"},{"name":"_totalSupply","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"},{"indexed":false,"name":"fromCurrencyKey","type":"bytes32"},{"indexed":false,"name":"fromAmount","type":"uint256"},{"indexed":false,"name":"toCurrencyKey","type":"bytes32"},{"indexed":false,"name":"toAmount","type":"uint256"},{"indexed":false,"name":"toAddress","type":"address"}],"name":"SynthExchange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newTokenState","type":"address"}],"name":"TokenStateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"proxyAddress","type":"address"}],"name":"ProxyUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"SelfDestructTerminated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"beneficiary","type":"address"}],"name":"SelfDestructed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"selfDestructDelay","type":"uint256"}],"name":"SelfDestructInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newBeneficiary","type":"address"}],"name":"SelfDestructBeneficiaryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldOwner","type":"address"},{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"}]

60806040526006805460a060020a60ff02191690556014805460a060020a61ffff02191675010000000000000000000000000000000000000000001790553480156200004a57600080fd5b5060405161016080620062c78339810160408181528251602080850151838601516060870151608088015160a089015160c08a015160e08b01516101008c01516101208d0151610140909d01518b8d018c5260178d527f53796e746865746978204e6574776f726b20546f6b656e0000000000000000008a8e01528b51808d01909c5260038c527f534e580000000000000000000000000000000000000000000000000000000000998c0199909952989b969a9599949893979296919590949192918c918c918460128d86818080600160a060020a03811615156200019057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b60008054600160a060020a031916600160a060020a038316908117825560408051928352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150600160a060020a03811615156200026157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f776e6572206d757374206e6f74206265207a65726f00000000000000000000604482015290519081900360640190fd5b60038054600160a060020a038316610100810261010060a860020a03199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a15060048054600160a060020a038416600160a060020a0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a1505060078054600160a060020a031916600160a060020a03881617905584516200033e906008906020880190620003fb565b50835162000354906009906020870190620003fb565b5050600a91909155600b805460ff191660ff909216919091179055505060128054600160a060020a0319908116600160a060020a039d8e16179091556011805482169a8d169a909a179099555050600e80548816968a16969096179095556013805487169489169490941790935560108054861692881692909217909155600f8054851691871691909117905560148054909316941693909317905550620004a092505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200043e57805160ff19168380011785556200046e565b828001600101855582156200046e579182015b828111156200046e57825182559160200191906001019062000451565b506200047c92915062000480565b5090565b6200049d91905b808211156200047c576000815560010162000487565b90565b615e1780620004b06000396000f3006080604052600436106102e75763ffffffff60e060020a60003504166306fdde0381146102ec5780630923160214610376578063095ea7b3146103905780630b887dae146103c85780630ee54a1d146103e05780631249c58b146103fb578063131b0ae7146104105780631627540c1461043157806317c70de41461045257806318160ddd1461047957806319db22281461048e5780631aa6adf7146104af57806320714f88146104d957806323b872dd146104fa578063313ce56714610524578063326080391461054f5780633278c960146105835780633fc6df6e146105985780634ffcd9df146105ad57806353a47bb7146105c257806356e44954146105d7578063654a60ac146105f85780636ac0bf9c146106165780636b4dff1f1461063757806370a082311461064f57806372cb051f1461067057806379ba5097146106d55780638357ce36146106ea578063835e119c1461070e57806383d625d414610726578063849cf5881461073e5780638da5cb5b1461075f578063945240961461077457806395d89b411461078e578063961a929c146107a357806397107d6d146107b85780639cb8a26a146107d95780639cbdaeb6146107ee5780639f76980714610803578063a311c7c214610824578063a430be6c14610845578063a461fc821461085a578063a5fdc5de1461086f578063a8913cdb14610890578063a9059cbb146108b4578063ab3e337d146108d8578063ab67aa581461090b578063ae2e933b1461097a578063b8225dec1461098f578063bc67f832146109a4578063bd32aa44146109c5578063be45fd62146109da578063c40dd66f14610a43578063c58aaae614610a58578063c9df6df514610a6d578063d37c4d8b14610a87578063dbd4a42214610aab578063dbf6334014610ac0578063dd62ed3e14610ad5578063e2fdcc1714610afc578063e90dd9e214610b11578063ea168b6214610b26578063ec55688914610b41578063ef7fae7c14610b56578063f534375214610b6e575b600080fd5b3480156102f857600080fd5b50610301610b83565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561033b578181015183820152602001610323565b50505050905090810190601f1680156103685780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038257600080fd5b5061038e600435610c11565b005b34801561039c57600080fd5b506103b4600160a060020a0360043516602435610d4c565b604080519115158252519081900360200190f35b3480156103d457600080fd5b5061038e600435610e3b565b3480156103ec57600080fd5b5061038e6004356024356111be565b34801561040757600080fd5b506103b461130d565b34801561041c57600080fd5b5061038e600160a060020a0360043516611806565b34801561043d57600080fd5b5061038e600160a060020a036004351661188c565b34801561045e57600080fd5b50610467611944565b60408051918252519081900360200190f35b34801561048557600080fd5b5061046761194a565b34801561049a57600080fd5b5061038e600160a060020a0360043516611950565b3480156104bb57600080fd5b506103b4600435602435604435600160a060020a0360643516611a06565b3480156104e557600080fd5b5061038e600160a060020a0360043516611b64565b34801561050657600080fd5b506103b4600160a060020a0360043581169060243516604435611c91565b34801561053057600080fd5b50610539611caa565b6040805160ff9092168252519081900360200190f35b34801561055b57600080fd5b50610567600435611cb3565b60408051600160a060020a039092168252519081900360200190f35b34801561058f57600080fd5b5061038e611cce565b3480156105a457600080fd5b50610567611d6c565b3480156105b957600080fd5b50610567611d7b565b3480156105ce57600080fd5b50610567611d8a565b3480156105e357600080fd5b5061038e600160a060020a0360043516611d99565b34801561060457600080fd5b50610467600435602435604435611e4f565b34801561062257600080fd5b50610467600160a060020a0360043516611ef7565b34801561064357600080fd5b5061038e60043561214c565b34801561065b57600080fd5b50610467600160a060020a03600435166121a9565b34801561067c57600080fd5b50610685612230565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106c15781810151838201526020016106a9565b505050509050019250505060405180910390f35b3480156106e157600080fd5b5061038e61233a565b3480156106f657600080fd5b50610467600160a060020a0360043516602435612435565b34801561071a57600080fd5b5061056760043561247d565b34801561073257600080fd5b506104676004356124a5565b34801561074a57600080fd5b5061038e600160a060020a0360043516612942565b34801561076b57600080fd5b50610567612b17565b34801561078057600080fd5b5061038e6004351515612b26565b34801561079a57600080fd5b50610301612bfc565b3480156107af57600080fd5b50610467612c57565b3480156107c457600080fd5b5061038e600160a060020a0360043516612c5d565b3480156107e557600080fd5b5061038e612d15565b3480156107fa57600080fd5b50610567612e8e565b34801561080f57600080fd5b5061038e600160a060020a0360043516612e9d565b34801561083057600080fd5b50610467600160a060020a0360043516612f55565b34801561085157600080fd5b50610567612fa4565b34801561086657600080fd5b50610467612fb3565b34801561087b57600080fd5b50610467600160a060020a0360043516612fba565b34801561089c57600080fd5b50610467600160a060020a0360043516602435613151565b3480156108c057600080fd5b506103b4600160a060020a0360043516602435613201565b3480156108e457600080fd5b506103b4600160a060020a0360043581169060243590604435906064359060843516613210565b34801561091757600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526103b494600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506132e39650505050505050565b34801561098657600080fd5b506105676133a9565b34801561099b57600080fd5b506103b46133b8565b3480156109b057600080fd5b5061038e600160a060020a03600435166133c1565b3480156109d157600080fd5b5061038e61345c565b3480156109e657600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103b4948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506135099650505050505050565b348015610a4f57600080fd5b506105676135d9565b348015610a6457600080fd5b506105676135e8565b348015610a7957600080fd5b5061038e60043515156135fc565b348015610a9357600080fd5b50610467600160a060020a036004351660243561371a565b348015610ab757600080fd5b50610567613946565b348015610acc57600080fd5b50610467613955565b348015610ae157600080fd5b50610467600160a060020a036004358116906024351661395c565b348015610b0857600080fd5b50610567613a02565b348015610b1d57600080fd5b50610567613a11565b348015610b3257600080fd5b5061038e600435602435613a20565b348015610b4d57600080fd5b50610567613bde565b348015610b6257600080fd5b5061038e600435613bed565b348015610b7a57600080fd5b506103b4613c50565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c095780601f10610bde57610100808354040283529160200191610c09565b820191906000526020600020905b815481529060010190602001808311610bec57829003601f168201915b505050505081565b601160009054906101000a9004600160a060020a0316600160a060020a0316637dc0d1d06040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610c6457600080fd5b505af1158015610c78573d6000803e3d6000fd5b505050506040513d6020811015610c8e57600080fd5b5051600160a060020a03163314610cef576040805160e560020a62461bcd02815260206004820152601360248201527f4f6e6c79206f7261636c6520616c6c6f77656400000000000000000000000000604482015290519081900360640190fd5b60008111610d47576040805160e560020a62461bcd02815260206004820152601a60248201527f4e6565647320746f2062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b601555565b6004546000908190600160a060020a03163314801590610d775750600554600160a060020a03163314155b15610d8f5760068054600160a060020a031916331790555b50600654600754604080517fda46098c000000000000000000000000000000000000000000000000000000008152600160a060020a0393841660048201819052878516602483015260448201879052915191939092169163da46098c91606480830192600092919082900301818387803b158015610e0c57600080fd5b505af1158015610e20573d6000803e3d6000fd5b50505050610e2f818585613c72565b600191505b5092915050565b6004546000908190600160a060020a03163314801590610e665750600554600160a060020a03163314155b15610e7e5760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614610ed4576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b6000838152600d6020526040902054600160a060020a03161515610f42576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b6000838152600d602090815260408083205481517f18160ddd0000000000000000000000000000000000000000000000000000000081529151600160a060020a03909116936318160ddd93600480850194919392918390030190829087803b158015610fad57600080fd5b505af1158015610fc1573d6000803e3d6000fd5b505050506040513d6020811015610fd757600080fd5b50511561102e576040805160e560020a62461bcd02815260206004820152601360248201527f53796e746820737570706c792065786973747300000000000000000000000000604482015290519081900360640190fd5b60e960020a622c22290283141561108f576040805160e560020a62461bcd02815260206004820152601760248201527f43616e6e6f742072656d6f7665205844522073796e7468000000000000000000604482015290519081900360640190fd5b50506000818152600d6020526040812054600160a060020a0316905b600c5460ff8216101561119e5781600160a060020a0316600c8260ff168154811015156110d457fe5b600091825260209091200154600160a060020a0316141561119657600c805460ff831690811061110057fe5b60009182526020909120018054600160a060020a0319169055600c8054600019810190811061112b57fe5b600091825260209091200154600c8054600160a060020a039092169160ff841690811061115457fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600c805490611190906000198301615d44565b5061119e565b6001016110ab565b50506000908152600d602052604090208054600160a060020a0319169055565b600454600160a060020a031633148015906111e45750600554600160a060020a03163314155b156111fc5760068054600160a060020a031916331790555b60065461121290600160a060020a031683612435565b811115611269576040805160e560020a62461bcd02815260206004820152601060248201527f416d6f756e7420746f6f206c6172676500000000000000000000000000000000604482015290519081900360640190fd5b6112738282613dda565b6000828152600d60205260408082205460065482517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015260248101869052925191169263867904b4926044808201939182900301818387803b1580156112e957600080fd5b505af11580156112fd573d6000803e3d6000fd5b50505050611309614351565b5050565b601454600090819081908190600160a060020a03161515611378576040805160e560020a62461bcd02815260206004820152601b60248201527f52657761726473446973747269627574696f6e206e6f74207365740000000000604482015290519081900360640190fd5b601360009054906101000a9004600160a060020a0316600160a060020a031663cc5c095c6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156113cb57600080fd5b505af11580156113df573d6000803e3d6000fd5b505050506040513d60208110156113f557600080fd5b5051925060008311611451576040805160e560020a62461bcd02815260206004820152601560248201527f4e6f20737570706c79206973206d696e7461626c650000000000000000000000604482015290519081900360640190fd5b601360009054906101000a9004600160a060020a0316600160a060020a03166349e701596040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156114a457600080fd5b505af11580156114b8573d6000803e3d6000fd5b505050506040513d60208110156114ce57600080fd5b5050601354604080517f9bdd7ac70000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691639bdd7ac7916004808201926020929091908290030181600087803b15801561153057600080fd5b505af1158015611544573d6000803e3d6000fd5b505050506040513d602081101561155a57600080fd5b5051915061156e838363ffffffff61448416565b6007546014546040805160e060020a6370a08231028152600160a060020a03928316600482018190529151949550919092169263b46310f6929161161091869186916370a08231916024808201926020929091908290030181600087803b1580156115d857600080fd5b505af11580156115ec573d6000803e3d6000fd5b505050506040513d602081101561160257600080fd5b50519063ffffffff61449b16565b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b15801561166257600080fd5b505af1158015611676573d6000803e3d6000fd5b50506014546116929250309150600160a060020a0316836144b4565b601454604080517f59974e38000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a03909216916359974e389160248082019260009290919082900301818387803b1580156116f857600080fd5b505af115801561170c573d6000803e3d6000fd5b50506007546040805160e060020a6370a0823102815233600482018190529151600160a060020a03909316945063b46310f69350909161177191879186916370a082319160248083019260209291908290030181600087803b1580156115d857600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156117c357600080fd5b505af11580156117d7573d6000803e3d6000fd5b505050506117e63033846144b4565b600a546117f9908463ffffffff61449b16565b600a556001935050505090565b600054600160a060020a0316331461186a576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031633146118f0576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60018054600160a060020a038316600160a060020a0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60025481565b600a5481565b600454600160a060020a031633148015906119765750600554600160a060020a03163314155b1561198e5760068054600160a060020a031916331790555b600054600654600160a060020a039081169116146119e4576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b600e8054600160a060020a031916600160a060020a0392909216919091179055565b600454600090600160a060020a03163314801590611a2f5750600554600160a060020a03163314155b15611a475760068054600160a060020a031916331790555b84831415611a9f576040805160e560020a62461bcd02815260206004820152601960248201527f4d7573742075736520646966666572656e742073796e74687300000000000000604482015290519081900360640190fd5b60008411611af7576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b611b003a61214c565b60145474010000000000000000000000000000000000000000900460ff1615611b4157600654611b3a90600160a060020a031686866145b6565b9050611b5c565b600654611b3a90600160a060020a0316868686836001614651565b949350505050565b600054600160a060020a03163314611bc8576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b600160a060020a0381161515611c28576040805160e560020a62461bcd02815260206004820152601c60248201527f42656e6566696369617279206d757374206e6f74206265207a65726f00000000604482015290519081900360640190fd5b60038054600160a060020a038316610100810274ffffffffffffffffffffffffffffffffffffffff00199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a150565b60006060611ca1858585846132e3565b95945050505050565b600b5460ff1681565b600d60205260009081526040902054600160a060020a031681565b600054600160a060020a03163314611d32576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b600060028190556003805460ff191690556040517f6adcc7125002935e0aa31697538ebbd65cfddf20431eb6ecdcfc3e238bfd082c9190a1565b601454600160a060020a031681565b601154600160a060020a031681565b600154600160a060020a031681565b600454600160a060020a03163314801590611dbf5750600554600160a060020a03163314155b15611dd75760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614611e2d576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b60118054600160a060020a031916600160a060020a0392909216919091179055565b601154604080517f654a60ac0000000000000000000000000000000000000000000000000000000081526004810186905260248101859052604481018490529051600092600160a060020a03169163654a60ac91606480830192602092919082900301818787803b158015611ec357600080fd5b505af1158015611ed7573d6000803e3d6000fd5b505050506040513d6020811015611eed57600080fd5b5051949350505050565b601154604080517e9919c000000000000000000000000000000000000000000000000000000000815260eb60020a620a69cb02600482018190529151600093849384939092600160a060020a0390921691629919c09160248082019260209290919082900301818887803b158015611f6e57600080fd5b505af1158015611f82573d6000803e3d6000fd5b505050506040513d6020811015611f9857600080fd5b505115611fef576040805160e560020a62461bcd02815260206004820152601960248201527f52617465207374616c65206f72206e6f7420612073796e746800000000000000604482015290519081900360640190fd5b6007546040805160e060020a6370a08231028152600160a060020a038881166004830152915191909216916370a082319160248083019260209291908290030181600087803b15801561204157600080fd5b505af1158015612055573d6000803e3d6000fd5b505050506040513d602081101561206b57600080fd5b5051601254604080517fb410a034000000000000000000000000000000000000000000000000000000008152905192955061211f92600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b1580156120d457600080fd5b505af11580156120e8573d6000803e3d6000fd5b505050506040513d60208110156120fe57600080fd5b50516121138760eb60020a620a69cb0261371a565b9063ffffffff614e6216565b91508282106121315760009350612144565b612141838363ffffffff61448416565b93505b505050919050565b6015548111156121a6576040805160e560020a62461bcd02815260206004820152601560248201527f4761732070726963652061626f7665206c696d69740000000000000000000000604482015290519081900360640190fd5b50565b6007546040805160e060020a6370a08231028152600160a060020a038481166004830152915160009392909216916370a082319160248082019260209290919082900301818787803b1580156121fe57600080fd5b505af1158015612212573d6000803e3d6000fd5b505050506040513d602081101561222857600080fd5b505192915050565b6060806000600c80549050604051908082528060200260200182016040528015612264578160200160208202803883390190505b509150600090505b600c5460ff8216101561233457600c805460ff831690811061228a57fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156122e557600080fd5b505af11580156122f9573d6000803e3d6000fd5b505050506040513d602081101561230f57600080fd5b50518251839060ff841690811061232257fe5b6020908102909101015260010161226c565b50919050565b600154600160a060020a031633146123c2576040805160e560020a62461bcd02815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e6572736869700000000000000000000000606482015290519081900360840190fd5b60005460015460408051600160a060020a03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b6000806000612444858561371a565b91506124508585613151565b90508082106124625760009250612475565b612472818363ffffffff61448416565b92505b505092915050565b600c80548290811061248b57fe5b600091825260209091200154600160a060020a0316905081565b601154604080517e9919c000000000000000000000000000000000000000000000000000000000815260048101849052905160009283928392839283928892600160a060020a0390921691629919c09160248082019260209290919082900301818887803b15801561251657600080fd5b505af115801561252a573d6000803e3d6000fd5b505050506040513d602081101561254057600080fd5b505115612597576040805160e560020a62461bcd02815260206004820152601960248201527f52617465207374616c65206f72206e6f7420612073796e746800000000000000604482015290519081900360640190fd5b601154604080517fac82f608000000000000000000000000000000000000000000000000000000008152600481018a9052905160009750600160a060020a039092169163ac82f6089160248082019260209290919082900301818b87803b15801561260157600080fd5b505af1158015612615573d6000803e3d6000fd5b505050506040513d602081101561262b57600080fd5b5051601154909450600160a060020a0316632d227674612649612230565b6040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019060200280838360005b8381101561269b578181015183820152602001612683565b5050505090500192505050602060405180830381600087803b1580156126c057600080fd5b505af11580156126d4573d6000803e3d6000fd5b505050506040513d60208110156126ea57600080fd5b505115612741576040805160e560020a62461bcd02815260206004820152600f60248201527f526174657320617265207374616c650000000000000000000000000000000000604482015290519081900360640190fd5b600092505b600c5460ff8416101561293757601154600c805461291892879261211392600160a060020a039092169163ac82f608919060ff8a1690811061278457fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156127df57600080fd5b505af11580156127f3573d6000803e3d6000fd5b505050506040513d602081101561280957600080fd5b50516040805160e060020a63ffffffff851602815260048101929092525160248083019260209291908290030181600087803b15801561284857600080fd5b505af115801561285c573d6000803e3d6000fd5b505050506040513d602081101561287257600080fd5b5051600c805460ff891690811061288557fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156128e057600080fd5b505af11580156128f4573d6000803e3d6000fd5b505050506040513d602081101561290a57600080fd5b50519063ffffffff614e7716565b915061292a858363ffffffff61449b16565b9450600190920191612746565b509295945050505050565b600454600090600160a060020a0316331480159061296b5750600554600160a060020a03163314155b156129835760068054600160a060020a031916331790555b600054600654600160a060020a039081169116146129d9576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b81600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612a1757600080fd5b505af1158015612a2b573d6000803e3d6000fd5b505050506040513d6020811015612a4157600080fd5b50516000818152600d6020526040902054909150600160a060020a031615612ab3576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820616c726561647920657869737473000000000000000000000000604482015290519081900360640190fd5b600c8054600181019091557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7018054600160a060020a03909316600160a060020a031993841681179091556000918252600d60205260409091208054909216179055565b600054600160a060020a031681565b600454600160a060020a03163314801590612b4c5750600554600160a060020a03163314155b15612b645760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614612bba576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b6014805491151575010000000000000000000000000000000000000000000275ff00000000000000000000000000000000000000000019909216919091179055565b6009805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c095780601f10610bde57610100808354040283529160200191610c09565b60155481565b600054600160a060020a03163314612cc1576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60048054600160a060020a038316600160a060020a0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a150565b60008054600160a060020a03163314612d7a576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60035460ff161515612dd6576040805160e560020a62461bcd02815260206004820152601f60248201527f53656c66204465737472756374206e6f742079657420696e6974696174656400604482015290519081900360640190fd5b426224ea0060025401101515612e36576040805160e560020a62461bcd02815260206004820152601b60248201527f53656c662064657374727563742064656c6179206e6f74206d65740000000000604482015290519081900360640190fd5b5060035460408051600160a060020a0361010090930492909216808352905190917f8a09e1677ced846cb537dc2b172043bd05a1a81ad7e0033a7ef8ba762df990b7919081900360200190a180600160a060020a0316ff5b600554600160a060020a031681565b600454600160a060020a03163314801590612ec35750600554600160a060020a03163314155b15612edb5760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614612f31576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b60078054600160a060020a031916600160a060020a0383161790556121a681614e8c565b6000806000612f6384612fba565b9150811515612f755760009250612f9d565b612f888460eb60020a620a69cb0261371a565b9050612f9a818363ffffffff614e6216565b92505b5050919050565b601054600160a060020a031681565b6224ea0081565b6007546040805160e060020a6370a08231028152600160a060020a0384811660048301529151600093849316916370a0823191602480830192602092919082900301818787803b15801561300d57600080fd5b505af1158015613021573d6000803e3d6000fd5b505050506040513d602081101561303757600080fd5b5051600f54909150600160a060020a0316156130e057600f546040805160e060020a6370a08231028152600160a060020a03868116600483015291516130dd9392909216916370a08231916024808201926020929091908290030181600087803b1580156130a457600080fd5b505af11580156130b8573d6000803e3d6000fd5b505050506040513d60208110156130ce57600080fd5b5051829063ffffffff61449b16565b90505b601054600160a060020a03161561314b576010546040805160e060020a6370a08231028152600160a060020a03868116600483015291516131489392909216916370a08231916024808201926020929091908290030181600087803b1580156130a457600080fd5b90505b92915050565b60008061317060eb60020a620a69cb0261316a86612fba565b85611e4f565b9050611b5c601260009054906101000a9004600160a060020a0316600160a060020a031663b410a0346040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156131c857600080fd5b505af11580156131dc573d6000803e3d6000fd5b505050506040513d60208110156131f257600080fd5b5051829063ffffffff614fd316565b60006060611b5c848483613509565b600061321a614fff565b84831415613272576040805160e560020a62461bcd02815260206004820152601360248201527f43616e27742062652073616d652073796e746800000000000000000000000000604482015290519081900360640190fd5b600084116132ca576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b6132d986868686866000614651565b9695505050505050565b600454600090600160a060020a0316331480159061330c5750600554600160a060020a03163314155b156133245760068054600160a060020a031916331790555b61332d85611ef7565b831115613384576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b60065461339d90600160a060020a0316868686866150f9565b50600195945050505050565b600e54600160a060020a031681565b60035460ff1681565b600454600160a060020a03163314806133e45750600554600160a060020a031633145b151561343a576040805160e560020a62461bcd02815260206004820152601760248201527f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000604482015290519081900360640190fd5b60068054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031633146134c0576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b426002556003805460ff19166001179055604080516224ea00815290517fcbd94ca75b8dc45c9d80c77e851670e78843c0d75180cb81db3e2158228fa9a69181900360200190a1565b600454600090600160a060020a031633148015906135325750600554600160a060020a03163314155b1561354a5760068054600160a060020a031916331790555b60065461355f90600160a060020a0316611ef7565b8311156135b6576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b6006546135ce90600160a060020a0316858585615209565b506001949350505050565b601354600160a060020a031681565b6003546101009004600160a060020a031681565b601160009054906101000a9004600160a060020a0316600160a060020a0316637dc0d1d06040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561364f57600080fd5b505af1158015613663573d6000803e3d6000fd5b505050506040513d602081101561367957600080fd5b5051600160a060020a031633146136da576040805160e560020a62461bcd02815260206004820152601360248201527f4f6e6c79206f7261636c6520616c6c6f77656400000000000000000000000000604482015290519081900360640190fd5b60148054911515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019909216919091179055565b601254604080517f8b3f8088000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301528251600094859485948594859485949190911692638b3f8088926024808201939182900301818787803b15801561378a57600080fd5b505af115801561379e573d6000803e3d6000fd5b505050506040513d60408110156137b457600080fd5b50805160209091015190955093508415156137d2576000955061393b565b601254604080517f08d95cd500000000000000000000000000000000000000000000000000000000815260048101879052905161391392889261390792600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b15801561384357600080fd5b505af1158015613857573d6000803e3d6000fd5b505050506040513d602081101561386d57600080fd5b5051601254604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916346317712916004808201926020929091908290030181600087803b1580156138cf57600080fd5b505af11580156138e3573d6000803e3d6000fd5b505050506040513d60208110156138f957600080fd5b50519063ffffffff61521716565b9063ffffffff61523016565b925061391e876124a5565b915061392d8361390784615249565b90506139388161525f565b95505b505050505092915050565b601254600160a060020a031681565b600c545b90565b600754604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015284811660248301529151600093929092169163dd62ed3e9160448082019260209290919082900301818787803b1580156139cf57600080fd5b505af11580156139e3573d6000803e3d6000fd5b505050506040513d60208110156139f957600080fd5b50519392505050565b600f54600160a060020a031681565b600754600160a060020a031681565b6004546000908190819081908190600160a060020a03163314801590613a515750600554600160a060020a03163314155b15613a695760068054600160a060020a031916331790555b613a7d878760e960020a622c222902611e4f565b600654909550613a9f90600160a060020a031660e960020a622c22290261371a565b600654909450613ab890600160a060020a03168861371a565b925060008411613b12576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f206465627420746f20666f72676976650000000000000000000000000000604482015290519081900360640190fd5b848410613b1f5784613b21565b835b9150613b2c82615281565b858310613b395785613b3b565b825b6000888152600d60205260408082205460065482517f9dc29fac000000000000000000000000000000000000000000000000000000008152600160a060020a0391821660048201526024810186905292519495501692639dc29fac9260448084019391929182900301818387803b158015613bb557600080fd5b505af1158015613bc9573d6000803e3d6000fd5b50505050613bd5614351565b50505050505050565b600454600160a060020a031681565b600454600090600160a060020a03163314801590613c165750600554600160a060020a03163314155b15613c2e5760068054600160a060020a031916331790555b600654613c4490600160a060020a031683612435565b905061130982826111be565b6014547501000000000000000000000000000000000000000000900460ff1681565b600480546040805160208082018690528251808303820181528284018085527f417070726f76616c28616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a0190808383885b83811015613d75578181015183820152602001613d5d565b50505050905090810190601f168015613da25780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015613dc657600080fd5b505af1158015613bd5573d6000803e3d6000fd5b60045460009081908190819081908190600160a060020a03163314801590613e0d5750600554600160a060020a03163314155b15613e255760068054600160a060020a031916331790555b613e39888860e960020a622c222902611e4f565b9550613e4d60e960020a622c2229026124a5565b9450613e5f868663ffffffff61449b16565b9350613e71868563ffffffff61521716565b9250613ef6837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b158015613ebe57600080fd5b505af4158015613ed2573d6000803e3d6000fd5b505050506040513d6020811015613ee857600080fd5b50519063ffffffff61448416565b600654909250613f1890600160a060020a031660e960020a622c22290261371a565b90506000811115613f4657613f4384613f37888463ffffffff61449b16565b9063ffffffff61521716565b92505b601254600654604080517fb992812e000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201529051919092169163b992812e9160248083019260209291908290030181600087803b158015613fb157600080fd5b505af1158015613fc5573d6000803e3d6000fd5b505050506040513d6020811015613fdb57600080fd5b5051151561404f57601260009054906101000a9004600160a060020a0316600160a060020a0316631bfba5956040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561403657600080fd5b505af115801561404a573d6000803e3d6000fd5b505050505b601254600654604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018790529051919092169163a764eb4591604480830192600092919082900301818387803b1580156140c057600080fd5b505af11580156140d4573d6000803e3d6000fd5b505050506000601260009054906101000a9004600160a060020a0316600160a060020a031663cd92eba96040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561412d57600080fd5b505af1158015614141573d6000803e3d6000fd5b505050506040513d602081101561415757600080fd5b5051111561425b57601254604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161420591869185916346317712916004808201926020929091908290030181600087803b1580156141cd57600080fd5b505af11580156141e1573d6000803e3d6000fd5b505050506040513d60208110156141f757600080fd5b50519063ffffffff61523016565b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561423e57600080fd5b505af1158015614252573d6000803e3d6000fd5b50505050614347565b601260009054906101000a9004600160a060020a0316600160a060020a0316633d31e97b7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b1580156142c657600080fd5b505af41580156142da573d6000803e3d6000fd5b505050506040513d60208110156142f057600080fd5b50516040805160e060020a63ffffffff8516028152600481019290925251602480830192600092919082900301818387803b15801561432e57600080fd5b505af1158015614342573d6000803e3d6000fd5b505050505b5050505050505050565b601254600654604080517f8b3f8088000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152815160009485941692638b3f8088926024808201939182900301818787803b1580156143b957600080fd5b505af11580156143cd573d6000803e3d6000fd5b505050506040513d60408110156143e357600080fd5b508051602090910151600e54600654604080517f86645274000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101869052604481018590529051949650929450169163866452749160648082019260009290919082900301818387803b15801561446857600080fd5b505af115801561447c573d6000803e3d6000fd5b505050505050565b6000808383111561449457600080fd5b5050900390565b6000828201838110156144ad57600080fd5b9392505050565b600480546040805160208082018690528251808303820181528284018085527f5472616e7366657228616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a01908083838883811015613d75578181015183820152602001613d5d565b6000828152600d60205260408082205481517f9dc29fac000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660048301526024820186905292519290911691639dc29fac91604480820192869290919082900301818387803b15801561462f57600080fd5b505af1158015614643573d6000803e3d6000fd5b506001979650505050505050565b60008060008060008a600e60009054906101000a9004600160a060020a0316600160a060020a031663eb1edd616040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156146ad57600080fd5b505af11580156146c1573d6000803e3d6000fd5b505050506040513d60208110156146d757600080fd5b5051600160a060020a038281169116141561473c576040805160e560020a62461bcd02815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b6014547501000000000000000000000000000000000000000000900460ff1615156147b1576040805160e560020a62461bcd02815260206004820152601660248201527f45786368616e67696e672069732064697361626c656400000000000000000000604482015290519081900360640190fd5b601160009054906101000a9004600160a060020a0316600160a060020a03166344d010d46040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561480457600080fd5b505af1158015614818573d6000803e3d6000fd5b505050506040513d602081101561482e57600080fd5b505115614885576040805160e560020a62461bcd02815260206004820152601160248201527f507269636520757064617465206c6f636b000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03881615156148e5576040805160e560020a62461bcd02815260206004820152601060248201527f5a65726f2064657374696e6174696f6e00000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038816301415614946576040805160e560020a62461bcd02815260206004820181905260248201527f53796e74686574697820697320696e76616c69642064657374696e6174696f6e604482015290519081900360640190fd5b600454600160a060020a03898116911614156149ac576040805160e560020a62461bcd02815260206004820152601c60248201527f50726f787920697320696e76616c69642064657374696e6174696f6e00000000604482015290519081900360640190fd5b600d60008c6000191660001916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a0316639dc29fac8d8c6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015614a3d57600080fd5b505af1158015614a51573d6000803e3d6000fd5b50505050614a608b8b8b611e4f565b9450849350600092508615614b1757600e54604080517fe05bac82000000000000000000000000000000000000000000000000000000008152600481018890529051600160a060020a039092169163e05bac82916024808201926020929091908290030181600087803b158015614ad657600080fd5b505af1158015614aea573d6000803e3d6000fd5b505050506040513d6020811015614b0057600080fd5b50519350614b14858563ffffffff61448416565b92505b6000898152600d60205260408082205481517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038c81166004830152602482018990529251929091169263867904b49260448084019382900301818387803b158015614b8b57600080fd5b505af1158015614b9f573d6000803e3d6000fd5b505050506000831115614d7f57614bc0898460e960020a622c222902611e4f565b60e960020a622c2229026000908152600d60209081527f948e51b26ecd0047a7c9e5be598423840fa0193911ba4f830ec851010ee5c01854600e54604080517feb1edd610000000000000000000000000000000000000000000000000000000081529051959750600160a060020a039283169563867904b495939092169363eb1edd619360048084019492938390030190829087803b158015614c6257600080fd5b505af1158015614c76573d6000803e3d6000fd5b505050506040513d6020811015614c8c57600080fd5b50516040805160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820186905251604480830192600092919082900301818387803b158015614cd957600080fd5b505af1158015614ced573d6000803e3d6000fd5b5050600e54604080517fa5fdab8000000000000000000000000000000000000000000000000000000000815260e960020a622c2229026004820152602481018790529051600160a060020a03909216935063a5fdab80925060448082019260009290919082900301818387803b158015614d6657600080fd5b505af1158015614d7a573d6000803e3d6000fd5b505050505b600d60008a6000191660001916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a031663eb6ecc038d8a876040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a031681526020018281526020019350505050600060405180830381600087803b158015614e2a57600080fd5b505af1158015614e3e573d6000803e3d6000fd5b50505050614e508c8c8c8c888d6155d6565b5060019b9a5050505050505050505050565b60006144ad8383670de0b6b3a764000061576a565b60006144ad8383670de0b6b3a76400006157ae565b6004805460408051600160a060020a038581166020808401919091528351808403820181528385018086527f546f6b656e5374617465557064617465642861646472657373290000000000009052935192839003605a01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651949097169763907dff979791959294919384938493839260e4909201918a0190808383885b83811015614f67578181015183820152602001614f4f565b50505050905090810190601f168015614f945780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015614fb857600080fd5b505af1158015614fcc573d6000803e3d6000fd5b5050505050565b6000670de0b6b3a7640000614fee848463ffffffff6157db16565b811515614ff757fe5b049392505050565b6004546000908190600160a060020a0316331480159061502a5750600554600160a060020a03163314155b156150425760068054600160a060020a031916331790555b5060009050805b600c5460ff821610156150a257600654600c8054600160a060020a039092169160ff841690811061507657fe5b600091825260209091200154600160a060020a0316141561509a57600191506150a2565b600101615049565b811515611309576040805160e560020a62461bcd02815260206004820152601260248201527f4f6e6c792073796e746820616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b600754604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015288811660248301529151600093929092169163da46098c9188918a91615192918991879163dd62ed3e9160448082019260209290919082900301818d87803b15801561517e57600080fd5b505af1158015613ed2573d6000803e3d6000fd5b6040805160e060020a63ffffffff8716028152600160a060020a03948516600482015292909316602483015260448201529051606480830192600092919082900301818387803b1580156151e557600080fd5b505af11580156151f9573d6000803e3d6000fd5b505050506132d985858585615809565b6000611ca185858585615809565b60006144ad83836b033b2e3c9fd0803ce800000061576a565b60006144ad83836b033b2e3c9fd0803ce80000006157ae565b600061314b82633b9aca0063ffffffff6157db16565b60006305f5e10082046005600a82061061527757600a015b600a900492915050565b60065481906000908190819081908190819081906152b190600160a060020a031660e960020a622c22290261371a565b96506152c560e960020a622c2229026124a5565b95506152d7868963ffffffff61448416565b9450600085111561535a576152f2888663ffffffff61521716565b9250615353837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561533f57600080fd5b505af41580156115ec573d6000803e3d6000fd5b935061535f565b600093505b8688141561545e57601254600654604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526000602482018190529151929093169263a764eb45926044808301939282900301818387803b1580156153d657600080fd5b505af11580156153ea573d6000803e3d6000fd5b50505050601260009054906101000a9004600160a060020a0316600160a060020a031663ba08f2996040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561544157600080fd5b505af1158015615455573d6000803e3d6000fd5b5050505061550c565b61546e878963ffffffff61448416565b9150615480828663ffffffff61521716565b601254600654604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a764eb459160448082019260009290919082900301818387803b1580156154f357600080fd5b505af1158015615507573d6000803e3d6000fd5b505050505b601254604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161557a91889185916346317712916004808201926020929091908290030181600087803b1580156141cd57600080fd5b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156155b357600080fd5b505af11580156155c7573d6000803e3d6000fd5b50505050505050505050505050565b600480546040805160208082018a90528183018990526060820188905260808201879052600160a060020a0386811660a0808501919091528451808503909101815260c08085018087527f53796e746845786368616e676528616464726573732c627974657333322c756990527f6e743235362c627974657333322c75696e743235362c6164647265737329000060e086015294519384900360fe01842060e060020a63907dff97028552600260248601819052604486018290528e84166064870181905260006084880181905260a48801819052998701978852835160c48801528351949098169863907dff9798939791969295939490938493839260e4909101918a0190808383885b838110156156f95781810151838201526020016156e1565b50505050905090810190601f1680156157265780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561574a57600080fd5b505af115801561575e573d6000803e3d6000fd5b50505050505050505050565b6000806157908461578487600a870263ffffffff6157db16565b9063ffffffff615ae316565b90506005600a825b06106157a257600a015b600a9004949350505050565b600080600a83046157c5868663ffffffff6157db16565b8115156157ce57fe5b0490506005600a82615798565b6000808315156157ee5760009150610e34565b508282028284828115156157fe57fe5b04146144ad57600080fd5b6000600160a060020a038416151561586b576040805160e560020a62461bcd02815260206004820181905260248201527f43616e6e6f74207472616e7366657220746f2074686520302061646472657373604482015290519081900360640190fd5b600160a060020a0384163014156158cc576040805160e560020a62461bcd02815260206004820152601f60248201527f43616e6e6f74207472616e7366657220746f2074686520636f6e747261637400604482015290519081900360640190fd5b600454600160a060020a0385811691161415615932576040805160e560020a62461bcd02815260206004820152601c60248201527f43616e6e6f74207472616e7366657220746f207468652070726f787900000000604482015290519081900360640190fd5b6007546040805160e060020a6370a08231028152600160a060020a0388811660048301529151919092169163b46310f691889161599591889186916370a08231916024808201926020929091908290030181600087803b15801561517e57600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156159e757600080fd5b505af11580156159fb573d6000803e3d6000fd5b50506007546040805160e060020a6370a08231028152600160a060020a038981166004830152915191909216935063b46310f692508791615a6291889186916370a08231916024808201926020929091908290030181600087803b1580156115d857600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015615ab457600080fd5b505af1158015615ac8573d6000803e3d6000fd5b50505050615ad885858585615b06565b6135ce8585856144b4565b600080808311615af257600080fd5b8284811515615afd57fe5b04949350505050565b60065460009074010000000000000000000000000000000000000000900460ff1615615b7c576040805160e560020a62461bcd02815260206004820152601e60248201527f526576657274656420746f2070726576656e74207265656e7472616e63790000604482015290519081900360640190fd5b506006805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055823b6000811115615d1f5783600160a060020a03168584846040516024018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015615c28578181015183820152602001615c10565b50505050905090810190601f168015615c555780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fc0ee0b8a000000000000000000000000000000000000000000000000000000001781529051825192975095508594509250905080838360005b83811015615cdc578181015183820152602001615cc4565b50505050905090810190601f168015615d095780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af15050505b50506006805474ff000000000000000000000000000000000000000019169055505050565b815481835581811115615d6857600083815260209020615d68918101908301615d6d565b505050565b61395991905b80821115615d875760008155600101615d73565b509056004f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e00000000000000000000000000000000004f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000a165627a7a72305820ad09190e224895f4b5afd631162f84553c261f0ba3f4c951f64e8cbc33c08d8b0029000000000000000000000000c011a72400e58ecd99ee497cf89e3775d4bd732f0000000000000000000000005b1b5fea1b99d83ad479df0c222f0492385381dd0000000000000000000000004b9ca5607f1ff8019c1c6a3c2f0cc8de622d5b82000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f617688200000000000000000000000099a46c42689720d9118ff7af7ce80c2a92fc4f97000000000000000000000000c566a81f193626ee88a85fb3dcc82279b96a094e000000000000000000000000a3de830b5208851539de8e4ff158d635e8f36fcb000000000000000000000000b671f2210b1f6621a2607ea63e6b2dc3e2464d1f000000000000000000000000971e78e0c92392a4e39099835cf7e6ab535b2227000000000000000000000000ffa72fd80d8a84032d855bfb67036baf459490090000000000000000000000000000000000000000007682709001125f5f44ec3f

Deployed Bytecode

0x6080604052600436106102e75763ffffffff60e060020a60003504166306fdde0381146102ec5780630923160214610376578063095ea7b3146103905780630b887dae146103c85780630ee54a1d146103e05780631249c58b146103fb578063131b0ae7146104105780631627540c1461043157806317c70de41461045257806318160ddd1461047957806319db22281461048e5780631aa6adf7146104af57806320714f88146104d957806323b872dd146104fa578063313ce56714610524578063326080391461054f5780633278c960146105835780633fc6df6e146105985780634ffcd9df146105ad57806353a47bb7146105c257806356e44954146105d7578063654a60ac146105f85780636ac0bf9c146106165780636b4dff1f1461063757806370a082311461064f57806372cb051f1461067057806379ba5097146106d55780638357ce36146106ea578063835e119c1461070e57806383d625d414610726578063849cf5881461073e5780638da5cb5b1461075f578063945240961461077457806395d89b411461078e578063961a929c146107a357806397107d6d146107b85780639cb8a26a146107d95780639cbdaeb6146107ee5780639f76980714610803578063a311c7c214610824578063a430be6c14610845578063a461fc821461085a578063a5fdc5de1461086f578063a8913cdb14610890578063a9059cbb146108b4578063ab3e337d146108d8578063ab67aa581461090b578063ae2e933b1461097a578063b8225dec1461098f578063bc67f832146109a4578063bd32aa44146109c5578063be45fd62146109da578063c40dd66f14610a43578063c58aaae614610a58578063c9df6df514610a6d578063d37c4d8b14610a87578063dbd4a42214610aab578063dbf6334014610ac0578063dd62ed3e14610ad5578063e2fdcc1714610afc578063e90dd9e214610b11578063ea168b6214610b26578063ec55688914610b41578063ef7fae7c14610b56578063f534375214610b6e575b600080fd5b3480156102f857600080fd5b50610301610b83565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561033b578181015183820152602001610323565b50505050905090810190601f1680156103685780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038257600080fd5b5061038e600435610c11565b005b34801561039c57600080fd5b506103b4600160a060020a0360043516602435610d4c565b604080519115158252519081900360200190f35b3480156103d457600080fd5b5061038e600435610e3b565b3480156103ec57600080fd5b5061038e6004356024356111be565b34801561040757600080fd5b506103b461130d565b34801561041c57600080fd5b5061038e600160a060020a0360043516611806565b34801561043d57600080fd5b5061038e600160a060020a036004351661188c565b34801561045e57600080fd5b50610467611944565b60408051918252519081900360200190f35b34801561048557600080fd5b5061046761194a565b34801561049a57600080fd5b5061038e600160a060020a0360043516611950565b3480156104bb57600080fd5b506103b4600435602435604435600160a060020a0360643516611a06565b3480156104e557600080fd5b5061038e600160a060020a0360043516611b64565b34801561050657600080fd5b506103b4600160a060020a0360043581169060243516604435611c91565b34801561053057600080fd5b50610539611caa565b6040805160ff9092168252519081900360200190f35b34801561055b57600080fd5b50610567600435611cb3565b60408051600160a060020a039092168252519081900360200190f35b34801561058f57600080fd5b5061038e611cce565b3480156105a457600080fd5b50610567611d6c565b3480156105b957600080fd5b50610567611d7b565b3480156105ce57600080fd5b50610567611d8a565b3480156105e357600080fd5b5061038e600160a060020a0360043516611d99565b34801561060457600080fd5b50610467600435602435604435611e4f565b34801561062257600080fd5b50610467600160a060020a0360043516611ef7565b34801561064357600080fd5b5061038e60043561214c565b34801561065b57600080fd5b50610467600160a060020a03600435166121a9565b34801561067c57600080fd5b50610685612230565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106c15781810151838201526020016106a9565b505050509050019250505060405180910390f35b3480156106e157600080fd5b5061038e61233a565b3480156106f657600080fd5b50610467600160a060020a0360043516602435612435565b34801561071a57600080fd5b5061056760043561247d565b34801561073257600080fd5b506104676004356124a5565b34801561074a57600080fd5b5061038e600160a060020a0360043516612942565b34801561076b57600080fd5b50610567612b17565b34801561078057600080fd5b5061038e6004351515612b26565b34801561079a57600080fd5b50610301612bfc565b3480156107af57600080fd5b50610467612c57565b3480156107c457600080fd5b5061038e600160a060020a0360043516612c5d565b3480156107e557600080fd5b5061038e612d15565b3480156107fa57600080fd5b50610567612e8e565b34801561080f57600080fd5b5061038e600160a060020a0360043516612e9d565b34801561083057600080fd5b50610467600160a060020a0360043516612f55565b34801561085157600080fd5b50610567612fa4565b34801561086657600080fd5b50610467612fb3565b34801561087b57600080fd5b50610467600160a060020a0360043516612fba565b34801561089c57600080fd5b50610467600160a060020a0360043516602435613151565b3480156108c057600080fd5b506103b4600160a060020a0360043516602435613201565b3480156108e457600080fd5b506103b4600160a060020a0360043581169060243590604435906064359060843516613210565b34801561091757600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526103b494600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506132e39650505050505050565b34801561098657600080fd5b506105676133a9565b34801561099b57600080fd5b506103b46133b8565b3480156109b057600080fd5b5061038e600160a060020a03600435166133c1565b3480156109d157600080fd5b5061038e61345c565b3480156109e657600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103b4948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506135099650505050505050565b348015610a4f57600080fd5b506105676135d9565b348015610a6457600080fd5b506105676135e8565b348015610a7957600080fd5b5061038e60043515156135fc565b348015610a9357600080fd5b50610467600160a060020a036004351660243561371a565b348015610ab757600080fd5b50610567613946565b348015610acc57600080fd5b50610467613955565b348015610ae157600080fd5b50610467600160a060020a036004358116906024351661395c565b348015610b0857600080fd5b50610567613a02565b348015610b1d57600080fd5b50610567613a11565b348015610b3257600080fd5b5061038e600435602435613a20565b348015610b4d57600080fd5b50610567613bde565b348015610b6257600080fd5b5061038e600435613bed565b348015610b7a57600080fd5b506103b4613c50565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c095780601f10610bde57610100808354040283529160200191610c09565b820191906000526020600020905b815481529060010190602001808311610bec57829003601f168201915b505050505081565b601160009054906101000a9004600160a060020a0316600160a060020a0316637dc0d1d06040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610c6457600080fd5b505af1158015610c78573d6000803e3d6000fd5b505050506040513d6020811015610c8e57600080fd5b5051600160a060020a03163314610cef576040805160e560020a62461bcd02815260206004820152601360248201527f4f6e6c79206f7261636c6520616c6c6f77656400000000000000000000000000604482015290519081900360640190fd5b60008111610d47576040805160e560020a62461bcd02815260206004820152601a60248201527f4e6565647320746f2062652067726561746572207468616e2030000000000000604482015290519081900360640190fd5b601555565b6004546000908190600160a060020a03163314801590610d775750600554600160a060020a03163314155b15610d8f5760068054600160a060020a031916331790555b50600654600754604080517fda46098c000000000000000000000000000000000000000000000000000000008152600160a060020a0393841660048201819052878516602483015260448201879052915191939092169163da46098c91606480830192600092919082900301818387803b158015610e0c57600080fd5b505af1158015610e20573d6000803e3d6000fd5b50505050610e2f818585613c72565b600191505b5092915050565b6004546000908190600160a060020a03163314801590610e665750600554600160a060020a03163314155b15610e7e5760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614610ed4576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b6000838152600d6020526040902054600160a060020a03161515610f42576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b6000838152600d602090815260408083205481517f18160ddd0000000000000000000000000000000000000000000000000000000081529151600160a060020a03909116936318160ddd93600480850194919392918390030190829087803b158015610fad57600080fd5b505af1158015610fc1573d6000803e3d6000fd5b505050506040513d6020811015610fd757600080fd5b50511561102e576040805160e560020a62461bcd02815260206004820152601360248201527f53796e746820737570706c792065786973747300000000000000000000000000604482015290519081900360640190fd5b60e960020a622c22290283141561108f576040805160e560020a62461bcd02815260206004820152601760248201527f43616e6e6f742072656d6f7665205844522073796e7468000000000000000000604482015290519081900360640190fd5b50506000818152600d6020526040812054600160a060020a0316905b600c5460ff8216101561119e5781600160a060020a0316600c8260ff168154811015156110d457fe5b600091825260209091200154600160a060020a0316141561119657600c805460ff831690811061110057fe5b60009182526020909120018054600160a060020a0319169055600c8054600019810190811061112b57fe5b600091825260209091200154600c8054600160a060020a039092169160ff841690811061115457fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600c805490611190906000198301615d44565b5061119e565b6001016110ab565b50506000908152600d602052604090208054600160a060020a0319169055565b600454600160a060020a031633148015906111e45750600554600160a060020a03163314155b156111fc5760068054600160a060020a031916331790555b60065461121290600160a060020a031683612435565b811115611269576040805160e560020a62461bcd02815260206004820152601060248201527f416d6f756e7420746f6f206c6172676500000000000000000000000000000000604482015290519081900360640190fd5b6112738282613dda565b6000828152600d60205260408082205460065482517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015260248101869052925191169263867904b4926044808201939182900301818387803b1580156112e957600080fd5b505af11580156112fd573d6000803e3d6000fd5b50505050611309614351565b5050565b601454600090819081908190600160a060020a03161515611378576040805160e560020a62461bcd02815260206004820152601b60248201527f52657761726473446973747269627574696f6e206e6f74207365740000000000604482015290519081900360640190fd5b601360009054906101000a9004600160a060020a0316600160a060020a031663cc5c095c6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156113cb57600080fd5b505af11580156113df573d6000803e3d6000fd5b505050506040513d60208110156113f557600080fd5b5051925060008311611451576040805160e560020a62461bcd02815260206004820152601560248201527f4e6f20737570706c79206973206d696e7461626c650000000000000000000000604482015290519081900360640190fd5b601360009054906101000a9004600160a060020a0316600160a060020a03166349e701596040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156114a457600080fd5b505af11580156114b8573d6000803e3d6000fd5b505050506040513d60208110156114ce57600080fd5b5050601354604080517f9bdd7ac70000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691639bdd7ac7916004808201926020929091908290030181600087803b15801561153057600080fd5b505af1158015611544573d6000803e3d6000fd5b505050506040513d602081101561155a57600080fd5b5051915061156e838363ffffffff61448416565b6007546014546040805160e060020a6370a08231028152600160a060020a03928316600482018190529151949550919092169263b46310f6929161161091869186916370a08231916024808201926020929091908290030181600087803b1580156115d857600080fd5b505af11580156115ec573d6000803e3d6000fd5b505050506040513d602081101561160257600080fd5b50519063ffffffff61449b16565b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b15801561166257600080fd5b505af1158015611676573d6000803e3d6000fd5b50506014546116929250309150600160a060020a0316836144b4565b601454604080517f59974e38000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a03909216916359974e389160248082019260009290919082900301818387803b1580156116f857600080fd5b505af115801561170c573d6000803e3d6000fd5b50506007546040805160e060020a6370a0823102815233600482018190529151600160a060020a03909316945063b46310f69350909161177191879186916370a082319160248083019260209291908290030181600087803b1580156115d857600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156117c357600080fd5b505af11580156117d7573d6000803e3d6000fd5b505050506117e63033846144b4565b600a546117f9908463ffffffff61449b16565b600a556001935050505090565b600054600160a060020a0316331461186a576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031633146118f0576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60018054600160a060020a038316600160a060020a0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60025481565b600a5481565b600454600160a060020a031633148015906119765750600554600160a060020a03163314155b1561198e5760068054600160a060020a031916331790555b600054600654600160a060020a039081169116146119e4576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b600e8054600160a060020a031916600160a060020a0392909216919091179055565b600454600090600160a060020a03163314801590611a2f5750600554600160a060020a03163314155b15611a475760068054600160a060020a031916331790555b84831415611a9f576040805160e560020a62461bcd02815260206004820152601960248201527f4d7573742075736520646966666572656e742073796e74687300000000000000604482015290519081900360640190fd5b60008411611af7576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b611b003a61214c565b60145474010000000000000000000000000000000000000000900460ff1615611b4157600654611b3a90600160a060020a031686866145b6565b9050611b5c565b600654611b3a90600160a060020a0316868686836001614651565b949350505050565b600054600160a060020a03163314611bc8576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b600160a060020a0381161515611c28576040805160e560020a62461bcd02815260206004820152601c60248201527f42656e6566696369617279206d757374206e6f74206265207a65726f00000000604482015290519081900360640190fd5b60038054600160a060020a038316610100810274ffffffffffffffffffffffffffffffffffffffff00199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a150565b60006060611ca1858585846132e3565b95945050505050565b600b5460ff1681565b600d60205260009081526040902054600160a060020a031681565b600054600160a060020a03163314611d32576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b600060028190556003805460ff191690556040517f6adcc7125002935e0aa31697538ebbd65cfddf20431eb6ecdcfc3e238bfd082c9190a1565b601454600160a060020a031681565b601154600160a060020a031681565b600154600160a060020a031681565b600454600160a060020a03163314801590611dbf5750600554600160a060020a03163314155b15611dd75760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614611e2d576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b60118054600160a060020a031916600160a060020a0392909216919091179055565b601154604080517f654a60ac0000000000000000000000000000000000000000000000000000000081526004810186905260248101859052604481018490529051600092600160a060020a03169163654a60ac91606480830192602092919082900301818787803b158015611ec357600080fd5b505af1158015611ed7573d6000803e3d6000fd5b505050506040513d6020811015611eed57600080fd5b5051949350505050565b601154604080517e9919c000000000000000000000000000000000000000000000000000000000815260eb60020a620a69cb02600482018190529151600093849384939092600160a060020a0390921691629919c09160248082019260209290919082900301818887803b158015611f6e57600080fd5b505af1158015611f82573d6000803e3d6000fd5b505050506040513d6020811015611f9857600080fd5b505115611fef576040805160e560020a62461bcd02815260206004820152601960248201527f52617465207374616c65206f72206e6f7420612073796e746800000000000000604482015290519081900360640190fd5b6007546040805160e060020a6370a08231028152600160a060020a038881166004830152915191909216916370a082319160248083019260209291908290030181600087803b15801561204157600080fd5b505af1158015612055573d6000803e3d6000fd5b505050506040513d602081101561206b57600080fd5b5051601254604080517fb410a034000000000000000000000000000000000000000000000000000000008152905192955061211f92600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b1580156120d457600080fd5b505af11580156120e8573d6000803e3d6000fd5b505050506040513d60208110156120fe57600080fd5b50516121138760eb60020a620a69cb0261371a565b9063ffffffff614e6216565b91508282106121315760009350612144565b612141838363ffffffff61448416565b93505b505050919050565b6015548111156121a6576040805160e560020a62461bcd02815260206004820152601560248201527f4761732070726963652061626f7665206c696d69740000000000000000000000604482015290519081900360640190fd5b50565b6007546040805160e060020a6370a08231028152600160a060020a038481166004830152915160009392909216916370a082319160248082019260209290919082900301818787803b1580156121fe57600080fd5b505af1158015612212573d6000803e3d6000fd5b505050506040513d602081101561222857600080fd5b505192915050565b6060806000600c80549050604051908082528060200260200182016040528015612264578160200160208202803883390190505b509150600090505b600c5460ff8216101561233457600c805460ff831690811061228a57fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156122e557600080fd5b505af11580156122f9573d6000803e3d6000fd5b505050506040513d602081101561230f57600080fd5b50518251839060ff841690811061232257fe5b6020908102909101015260010161226c565b50919050565b600154600160a060020a031633146123c2576040805160e560020a62461bcd02815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e6572736869700000000000000000000000606482015290519081900360840190fd5b60005460015460408051600160a060020a03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b6000806000612444858561371a565b91506124508585613151565b90508082106124625760009250612475565b612472818363ffffffff61448416565b92505b505092915050565b600c80548290811061248b57fe5b600091825260209091200154600160a060020a0316905081565b601154604080517e9919c000000000000000000000000000000000000000000000000000000000815260048101849052905160009283928392839283928892600160a060020a0390921691629919c09160248082019260209290919082900301818887803b15801561251657600080fd5b505af115801561252a573d6000803e3d6000fd5b505050506040513d602081101561254057600080fd5b505115612597576040805160e560020a62461bcd02815260206004820152601960248201527f52617465207374616c65206f72206e6f7420612073796e746800000000000000604482015290519081900360640190fd5b601154604080517fac82f608000000000000000000000000000000000000000000000000000000008152600481018a9052905160009750600160a060020a039092169163ac82f6089160248082019260209290919082900301818b87803b15801561260157600080fd5b505af1158015612615573d6000803e3d6000fd5b505050506040513d602081101561262b57600080fd5b5051601154909450600160a060020a0316632d227674612649612230565b6040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019060200280838360005b8381101561269b578181015183820152602001612683565b5050505090500192505050602060405180830381600087803b1580156126c057600080fd5b505af11580156126d4573d6000803e3d6000fd5b505050506040513d60208110156126ea57600080fd5b505115612741576040805160e560020a62461bcd02815260206004820152600f60248201527f526174657320617265207374616c650000000000000000000000000000000000604482015290519081900360640190fd5b600092505b600c5460ff8416101561293757601154600c805461291892879261211392600160a060020a039092169163ac82f608919060ff8a1690811061278457fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156127df57600080fd5b505af11580156127f3573d6000803e3d6000fd5b505050506040513d602081101561280957600080fd5b50516040805160e060020a63ffffffff851602815260048101929092525160248083019260209291908290030181600087803b15801561284857600080fd5b505af115801561285c573d6000803e3d6000fd5b505050506040513d602081101561287257600080fd5b5051600c805460ff891690811061288557fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156128e057600080fd5b505af11580156128f4573d6000803e3d6000fd5b505050506040513d602081101561290a57600080fd5b50519063ffffffff614e7716565b915061292a858363ffffffff61449b16565b9450600190920191612746565b509295945050505050565b600454600090600160a060020a0316331480159061296b5750600554600160a060020a03163314155b156129835760068054600160a060020a031916331790555b600054600654600160a060020a039081169116146129d9576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b81600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612a1757600080fd5b505af1158015612a2b573d6000803e3d6000fd5b505050506040513d6020811015612a4157600080fd5b50516000818152600d6020526040902054909150600160a060020a031615612ab3576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820616c726561647920657869737473000000000000000000000000604482015290519081900360640190fd5b600c8054600181019091557fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7018054600160a060020a03909316600160a060020a031993841681179091556000918252600d60205260409091208054909216179055565b600054600160a060020a031681565b600454600160a060020a03163314801590612b4c5750600554600160a060020a03163314155b15612b645760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614612bba576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b6014805491151575010000000000000000000000000000000000000000000275ff00000000000000000000000000000000000000000019909216919091179055565b6009805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610c095780601f10610bde57610100808354040283529160200191610c09565b60155481565b600054600160a060020a03163314612cc1576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60048054600160a060020a038316600160a060020a0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a150565b60008054600160a060020a03163314612d7a576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b60035460ff161515612dd6576040805160e560020a62461bcd02815260206004820152601f60248201527f53656c66204465737472756374206e6f742079657420696e6974696174656400604482015290519081900360640190fd5b426224ea0060025401101515612e36576040805160e560020a62461bcd02815260206004820152601b60248201527f53656c662064657374727563742064656c6179206e6f74206d65740000000000604482015290519081900360640190fd5b5060035460408051600160a060020a0361010090930492909216808352905190917f8a09e1677ced846cb537dc2b172043bd05a1a81ad7e0033a7ef8ba762df990b7919081900360200190a180600160a060020a0316ff5b600554600160a060020a031681565b600454600160a060020a03163314801590612ec35750600554600160a060020a03163314155b15612edb5760068054600160a060020a031916331790555b600054600654600160a060020a03908116911614612f31576040805160e560020a62461bcd0281526020600482015260136024820152600080516020615dcc833981519152604482015290519081900360640190fd5b60078054600160a060020a031916600160a060020a0383161790556121a681614e8c565b6000806000612f6384612fba565b9150811515612f755760009250612f9d565b612f888460eb60020a620a69cb0261371a565b9050612f9a818363ffffffff614e6216565b92505b5050919050565b601054600160a060020a031681565b6224ea0081565b6007546040805160e060020a6370a08231028152600160a060020a0384811660048301529151600093849316916370a0823191602480830192602092919082900301818787803b15801561300d57600080fd5b505af1158015613021573d6000803e3d6000fd5b505050506040513d602081101561303757600080fd5b5051600f54909150600160a060020a0316156130e057600f546040805160e060020a6370a08231028152600160a060020a03868116600483015291516130dd9392909216916370a08231916024808201926020929091908290030181600087803b1580156130a457600080fd5b505af11580156130b8573d6000803e3d6000fd5b505050506040513d60208110156130ce57600080fd5b5051829063ffffffff61449b16565b90505b601054600160a060020a03161561314b576010546040805160e060020a6370a08231028152600160a060020a03868116600483015291516131489392909216916370a08231916024808201926020929091908290030181600087803b1580156130a457600080fd5b90505b92915050565b60008061317060eb60020a620a69cb0261316a86612fba565b85611e4f565b9050611b5c601260009054906101000a9004600160a060020a0316600160a060020a031663b410a0346040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156131c857600080fd5b505af11580156131dc573d6000803e3d6000fd5b505050506040513d60208110156131f257600080fd5b5051829063ffffffff614fd316565b60006060611b5c848483613509565b600061321a614fff565b84831415613272576040805160e560020a62461bcd02815260206004820152601360248201527f43616e27742062652073616d652073796e746800000000000000000000000000604482015290519081900360640190fd5b600084116132ca576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b6132d986868686866000614651565b9695505050505050565b600454600090600160a060020a0316331480159061330c5750600554600160a060020a03163314155b156133245760068054600160a060020a031916331790555b61332d85611ef7565b831115613384576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b60065461339d90600160a060020a0316868686866150f9565b50600195945050505050565b600e54600160a060020a031681565b60035460ff1681565b600454600160a060020a03163314806133e45750600554600160a060020a031633145b151561343a576040805160e560020a62461bcd02815260206004820152601760248201527f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000604482015290519081900360640190fd5b60068054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031633146134c0576040805160e560020a62461bcd02815260206004820152602f6024820152600080516020615d8c8339815191526044820152600080516020615dac833981519152606482015290519081900360840190fd5b426002556003805460ff19166001179055604080516224ea00815290517fcbd94ca75b8dc45c9d80c77e851670e78843c0d75180cb81db3e2158228fa9a69181900360200190a1565b600454600090600160a060020a031633148015906135325750600554600160a060020a03163314155b1561354a5760068054600160a060020a031916331790555b60065461355f90600160a060020a0316611ef7565b8311156135b6576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b6006546135ce90600160a060020a0316858585615209565b506001949350505050565b601354600160a060020a031681565b6003546101009004600160a060020a031681565b601160009054906101000a9004600160a060020a0316600160a060020a0316637dc0d1d06040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561364f57600080fd5b505af1158015613663573d6000803e3d6000fd5b505050506040513d602081101561367957600080fd5b5051600160a060020a031633146136da576040805160e560020a62461bcd02815260206004820152601360248201527f4f6e6c79206f7261636c6520616c6c6f77656400000000000000000000000000604482015290519081900360640190fd5b60148054911515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019909216919091179055565b601254604080517f8b3f8088000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301528251600094859485948594859485949190911692638b3f8088926024808201939182900301818787803b15801561378a57600080fd5b505af115801561379e573d6000803e3d6000fd5b505050506040513d60408110156137b457600080fd5b50805160209091015190955093508415156137d2576000955061393b565b601254604080517f08d95cd500000000000000000000000000000000000000000000000000000000815260048101879052905161391392889261390792600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b15801561384357600080fd5b505af1158015613857573d6000803e3d6000fd5b505050506040513d602081101561386d57600080fd5b5051601254604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916346317712916004808201926020929091908290030181600087803b1580156138cf57600080fd5b505af11580156138e3573d6000803e3d6000fd5b505050506040513d60208110156138f957600080fd5b50519063ffffffff61521716565b9063ffffffff61523016565b925061391e876124a5565b915061392d8361390784615249565b90506139388161525f565b95505b505050505092915050565b601254600160a060020a031681565b600c545b90565b600754604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015284811660248301529151600093929092169163dd62ed3e9160448082019260209290919082900301818787803b1580156139cf57600080fd5b505af11580156139e3573d6000803e3d6000fd5b505050506040513d60208110156139f957600080fd5b50519392505050565b600f54600160a060020a031681565b600754600160a060020a031681565b6004546000908190819081908190600160a060020a03163314801590613a515750600554600160a060020a03163314155b15613a695760068054600160a060020a031916331790555b613a7d878760e960020a622c222902611e4f565b600654909550613a9f90600160a060020a031660e960020a622c22290261371a565b600654909450613ab890600160a060020a03168861371a565b925060008411613b12576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f206465627420746f20666f72676976650000000000000000000000000000604482015290519081900360640190fd5b848410613b1f5784613b21565b835b9150613b2c82615281565b858310613b395785613b3b565b825b6000888152600d60205260408082205460065482517f9dc29fac000000000000000000000000000000000000000000000000000000008152600160a060020a0391821660048201526024810186905292519495501692639dc29fac9260448084019391929182900301818387803b158015613bb557600080fd5b505af1158015613bc9573d6000803e3d6000fd5b50505050613bd5614351565b50505050505050565b600454600160a060020a031681565b600454600090600160a060020a03163314801590613c165750600554600160a060020a03163314155b15613c2e5760068054600160a060020a031916331790555b600654613c4490600160a060020a031683612435565b905061130982826111be565b6014547501000000000000000000000000000000000000000000900460ff1681565b600480546040805160208082018690528251808303820181528284018085527f417070726f76616c28616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a0190808383885b83811015613d75578181015183820152602001613d5d565b50505050905090810190601f168015613da25780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015613dc657600080fd5b505af1158015613bd5573d6000803e3d6000fd5b60045460009081908190819081908190600160a060020a03163314801590613e0d5750600554600160a060020a03163314155b15613e255760068054600160a060020a031916331790555b613e39888860e960020a622c222902611e4f565b9550613e4d60e960020a622c2229026124a5565b9450613e5f868663ffffffff61449b16565b9350613e71868563ffffffff61521716565b9250613ef6837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b158015613ebe57600080fd5b505af4158015613ed2573d6000803e3d6000fd5b505050506040513d6020811015613ee857600080fd5b50519063ffffffff61448416565b600654909250613f1890600160a060020a031660e960020a622c22290261371a565b90506000811115613f4657613f4384613f37888463ffffffff61449b16565b9063ffffffff61521716565b92505b601254600654604080517fb992812e000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201529051919092169163b992812e9160248083019260209291908290030181600087803b158015613fb157600080fd5b505af1158015613fc5573d6000803e3d6000fd5b505050506040513d6020811015613fdb57600080fd5b5051151561404f57601260009054906101000a9004600160a060020a0316600160a060020a0316631bfba5956040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561403657600080fd5b505af115801561404a573d6000803e3d6000fd5b505050505b601254600654604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018790529051919092169163a764eb4591604480830192600092919082900301818387803b1580156140c057600080fd5b505af11580156140d4573d6000803e3d6000fd5b505050506000601260009054906101000a9004600160a060020a0316600160a060020a031663cd92eba96040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561412d57600080fd5b505af1158015614141573d6000803e3d6000fd5b505050506040513d602081101561415757600080fd5b5051111561425b57601254604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161420591869185916346317712916004808201926020929091908290030181600087803b1580156141cd57600080fd5b505af11580156141e1573d6000803e3d6000fd5b505050506040513d60208110156141f757600080fd5b50519063ffffffff61523016565b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561423e57600080fd5b505af1158015614252573d6000803e3d6000fd5b50505050614347565b601260009054906101000a9004600160a060020a0316600160a060020a0316633d31e97b7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b1580156142c657600080fd5b505af41580156142da573d6000803e3d6000fd5b505050506040513d60208110156142f057600080fd5b50516040805160e060020a63ffffffff8516028152600481019290925251602480830192600092919082900301818387803b15801561432e57600080fd5b505af1158015614342573d6000803e3d6000fd5b505050505b5050505050505050565b601254600654604080517f8b3f8088000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152815160009485941692638b3f8088926024808201939182900301818787803b1580156143b957600080fd5b505af11580156143cd573d6000803e3d6000fd5b505050506040513d60408110156143e357600080fd5b508051602090910151600e54600654604080517f86645274000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101869052604481018590529051949650929450169163866452749160648082019260009290919082900301818387803b15801561446857600080fd5b505af115801561447c573d6000803e3d6000fd5b505050505050565b6000808383111561449457600080fd5b5050900390565b6000828201838110156144ad57600080fd5b9392505050565b600480546040805160208082018690528251808303820181528284018085527f5472616e7366657228616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a01908083838883811015613d75578181015183820152602001613d5d565b6000828152600d60205260408082205481517f9dc29fac000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660048301526024820186905292519290911691639dc29fac91604480820192869290919082900301818387803b15801561462f57600080fd5b505af1158015614643573d6000803e3d6000fd5b506001979650505050505050565b60008060008060008a600e60009054906101000a9004600160a060020a0316600160a060020a031663eb1edd616040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156146ad57600080fd5b505af11580156146c1573d6000803e3d6000fd5b505050506040513d60208110156146d757600080fd5b5051600160a060020a038281169116141561473c576040805160e560020a62461bcd02815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b6014547501000000000000000000000000000000000000000000900460ff1615156147b1576040805160e560020a62461bcd02815260206004820152601660248201527f45786368616e67696e672069732064697361626c656400000000000000000000604482015290519081900360640190fd5b601160009054906101000a9004600160a060020a0316600160a060020a03166344d010d46040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561480457600080fd5b505af1158015614818573d6000803e3d6000fd5b505050506040513d602081101561482e57600080fd5b505115614885576040805160e560020a62461bcd02815260206004820152601160248201527f507269636520757064617465206c6f636b000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03881615156148e5576040805160e560020a62461bcd02815260206004820152601060248201527f5a65726f2064657374696e6174696f6e00000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038816301415614946576040805160e560020a62461bcd02815260206004820181905260248201527f53796e74686574697820697320696e76616c69642064657374696e6174696f6e604482015290519081900360640190fd5b600454600160a060020a03898116911614156149ac576040805160e560020a62461bcd02815260206004820152601c60248201527f50726f787920697320696e76616c69642064657374696e6174696f6e00000000604482015290519081900360640190fd5b600d60008c6000191660001916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a0316639dc29fac8d8c6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015614a3d57600080fd5b505af1158015614a51573d6000803e3d6000fd5b50505050614a608b8b8b611e4f565b9450849350600092508615614b1757600e54604080517fe05bac82000000000000000000000000000000000000000000000000000000008152600481018890529051600160a060020a039092169163e05bac82916024808201926020929091908290030181600087803b158015614ad657600080fd5b505af1158015614aea573d6000803e3d6000fd5b505050506040513d6020811015614b0057600080fd5b50519350614b14858563ffffffff61448416565b92505b6000898152600d60205260408082205481517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038c81166004830152602482018990529251929091169263867904b49260448084019382900301818387803b158015614b8b57600080fd5b505af1158015614b9f573d6000803e3d6000fd5b505050506000831115614d7f57614bc0898460e960020a622c222902611e4f565b60e960020a622c2229026000908152600d60209081527f948e51b26ecd0047a7c9e5be598423840fa0193911ba4f830ec851010ee5c01854600e54604080517feb1edd610000000000000000000000000000000000000000000000000000000081529051959750600160a060020a039283169563867904b495939092169363eb1edd619360048084019492938390030190829087803b158015614c6257600080fd5b505af1158015614c76573d6000803e3d6000fd5b505050506040513d6020811015614c8c57600080fd5b50516040805160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820186905251604480830192600092919082900301818387803b158015614cd957600080fd5b505af1158015614ced573d6000803e3d6000fd5b5050600e54604080517fa5fdab8000000000000000000000000000000000000000000000000000000000815260e960020a622c2229026004820152602481018790529051600160a060020a03909216935063a5fdab80925060448082019260009290919082900301818387803b158015614d6657600080fd5b505af1158015614d7a573d6000803e3d6000fd5b505050505b600d60008a6000191660001916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a031663eb6ecc038d8a876040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a031681526020018281526020019350505050600060405180830381600087803b158015614e2a57600080fd5b505af1158015614e3e573d6000803e3d6000fd5b50505050614e508c8c8c8c888d6155d6565b5060019b9a5050505050505050505050565b60006144ad8383670de0b6b3a764000061576a565b60006144ad8383670de0b6b3a76400006157ae565b6004805460408051600160a060020a038581166020808401919091528351808403820181528385018086527f546f6b656e5374617465557064617465642861646472657373290000000000009052935192839003605a01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651949097169763907dff979791959294919384938493839260e4909201918a0190808383885b83811015614f67578181015183820152602001614f4f565b50505050905090810190601f168015614f945780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015614fb857600080fd5b505af1158015614fcc573d6000803e3d6000fd5b5050505050565b6000670de0b6b3a7640000614fee848463ffffffff6157db16565b811515614ff757fe5b049392505050565b6004546000908190600160a060020a0316331480159061502a5750600554600160a060020a03163314155b156150425760068054600160a060020a031916331790555b5060009050805b600c5460ff821610156150a257600654600c8054600160a060020a039092169160ff841690811061507657fe5b600091825260209091200154600160a060020a0316141561509a57600191506150a2565b600101615049565b811515611309576040805160e560020a62461bcd02815260206004820152601260248201527f4f6e6c792073796e746820616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b600754604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015288811660248301529151600093929092169163da46098c9188918a91615192918991879163dd62ed3e9160448082019260209290919082900301818d87803b15801561517e57600080fd5b505af1158015613ed2573d6000803e3d6000fd5b6040805160e060020a63ffffffff8716028152600160a060020a03948516600482015292909316602483015260448201529051606480830192600092919082900301818387803b1580156151e557600080fd5b505af11580156151f9573d6000803e3d6000fd5b505050506132d985858585615809565b6000611ca185858585615809565b60006144ad83836b033b2e3c9fd0803ce800000061576a565b60006144ad83836b033b2e3c9fd0803ce80000006157ae565b600061314b82633b9aca0063ffffffff6157db16565b60006305f5e10082046005600a82061061527757600a015b600a900492915050565b60065481906000908190819081908190819081906152b190600160a060020a031660e960020a622c22290261371a565b96506152c560e960020a622c2229026124a5565b95506152d7868963ffffffff61448416565b9450600085111561535a576152f2888663ffffffff61521716565b9250615353837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561533f57600080fd5b505af41580156115ec573d6000803e3d6000fd5b935061535f565b600093505b8688141561545e57601254600654604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526000602482018190529151929093169263a764eb45926044808301939282900301818387803b1580156153d657600080fd5b505af11580156153ea573d6000803e3d6000fd5b50505050601260009054906101000a9004600160a060020a0316600160a060020a031663ba08f2996040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561544157600080fd5b505af1158015615455573d6000803e3d6000fd5b5050505061550c565b61546e878963ffffffff61448416565b9150615480828663ffffffff61521716565b601254600654604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a764eb459160448082019260009290919082900301818387803b1580156154f357600080fd5b505af1158015615507573d6000803e3d6000fd5b505050505b601254604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161557a91889185916346317712916004808201926020929091908290030181600087803b1580156141cd57600080fd5b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156155b357600080fd5b505af11580156155c7573d6000803e3d6000fd5b50505050505050505050505050565b600480546040805160208082018a90528183018990526060820188905260808201879052600160a060020a0386811660a0808501919091528451808503909101815260c08085018087527f53796e746845786368616e676528616464726573732c627974657333322c756990527f6e743235362c627974657333322c75696e743235362c6164647265737329000060e086015294519384900360fe01842060e060020a63907dff97028552600260248601819052604486018290528e84166064870181905260006084880181905260a48801819052998701978852835160c48801528351949098169863907dff9798939791969295939490938493839260e4909101918a0190808383885b838110156156f95781810151838201526020016156e1565b50505050905090810190601f1680156157265780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561574a57600080fd5b505af115801561575e573d6000803e3d6000fd5b50505050505050505050565b6000806157908461578487600a870263ffffffff6157db16565b9063ffffffff615ae316565b90506005600a825b06106157a257600a015b600a9004949350505050565b600080600a83046157c5868663ffffffff6157db16565b8115156157ce57fe5b0490506005600a82615798565b6000808315156157ee5760009150610e34565b508282028284828115156157fe57fe5b04146144ad57600080fd5b6000600160a060020a038416151561586b576040805160e560020a62461bcd02815260206004820181905260248201527f43616e6e6f74207472616e7366657220746f2074686520302061646472657373604482015290519081900360640190fd5b600160a060020a0384163014156158cc576040805160e560020a62461bcd02815260206004820152601f60248201527f43616e6e6f74207472616e7366657220746f2074686520636f6e747261637400604482015290519081900360640190fd5b600454600160a060020a0385811691161415615932576040805160e560020a62461bcd02815260206004820152601c60248201527f43616e6e6f74207472616e7366657220746f207468652070726f787900000000604482015290519081900360640190fd5b6007546040805160e060020a6370a08231028152600160a060020a0388811660048301529151919092169163b46310f691889161599591889186916370a08231916024808201926020929091908290030181600087803b15801561517e57600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156159e757600080fd5b505af11580156159fb573d6000803e3d6000fd5b50506007546040805160e060020a6370a08231028152600160a060020a038981166004830152915191909216935063b46310f692508791615a6291889186916370a08231916024808201926020929091908290030181600087803b1580156115d857600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015615ab457600080fd5b505af1158015615ac8573d6000803e3d6000fd5b50505050615ad885858585615b06565b6135ce8585856144b4565b600080808311615af257600080fd5b8284811515615afd57fe5b04949350505050565b60065460009074010000000000000000000000000000000000000000900460ff1615615b7c576040805160e560020a62461bcd02815260206004820152601e60248201527f526576657274656420746f2070726576656e74207265656e7472616e63790000604482015290519081900360640190fd5b506006805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055823b6000811115615d1f5783600160a060020a03168584846040516024018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015615c28578181015183820152602001615c10565b50505050905090810190601f168015615c555780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fc0ee0b8a000000000000000000000000000000000000000000000000000000001781529051825192975095508594509250905080838360005b83811015615cdc578181015183820152602001615cc4565b50505050905090810190601f168015615d095780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af15050505b50506006805474ff000000000000000000000000000000000000000019169055505050565b815481835581811115615d6857600083815260209020615d68918101908301615d6d565b505050565b61395991905b80821115615d875760008155600101615d73565b509056004f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e00000000000000000000000000000000004f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000a165627a7a72305820ad09190e224895f4b5afd631162f84553c261f0ba3f4c951f64e8cbc33c08d8b0029

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

000000000000000000000000c011a72400e58ecd99ee497cf89e3775d4bd732f0000000000000000000000005b1b5fea1b99d83ad479df0c222f0492385381dd0000000000000000000000004b9ca5607f1ff8019c1c6a3c2f0cc8de622d5b82000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f617688200000000000000000000000099a46c42689720d9118ff7af7ce80c2a92fc4f97000000000000000000000000c566a81f193626ee88a85fb3dcc82279b96a094e000000000000000000000000a3de830b5208851539de8e4ff158d635e8f36fcb000000000000000000000000b671f2210b1f6621a2607ea63e6b2dc3e2464d1f000000000000000000000000971e78e0c92392a4e39099835cf7e6ab535b2227000000000000000000000000ffa72fd80d8a84032d855bfb67036baf459490090000000000000000000000000000000000000000007682709001125f5f44ec3f

-----Decoded View---------------
Arg [0] : _proxy (address): 0xC011A72400E58ecD99Ee497CF89E3775d4bd732F
Arg [1] : _tokenState (address): 0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD
Arg [2] : _synthetixState (address): 0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82
Arg [3] : _owner (address): 0xB64fF7a4a33Acdf48d97dab0D764afD0F6176882
Arg [4] : _exchangeRates (address): 0x99a46c42689720d9118FF7aF7ce80C2a92fC4f97
Arg [5] : _feePool (address): 0xc566a81F193626ee88A85fB3dCC82279B96A094E
Arg [6] : _supplySchedule (address): 0xA3de830b5208851539De8e4FF158D635E8f36FCb
Arg [7] : _rewardEscrow (address): 0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F
Arg [8] : _escrow (address): 0x971e78e0C92392A4E39099835cF7E6aB535b2227
Arg [9] : _rewardsDistribution (address): 0xFfA72Fd80d8A84032d855bfb67036BAF45949009
Arg [10] : _totalSupply (uint256): 143269230769230769230769215

-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 000000000000000000000000c011a72400e58ecd99ee497cf89e3775d4bd732f
Arg [1] : 0000000000000000000000005b1b5fea1b99d83ad479df0c222f0492385381dd
Arg [2] : 0000000000000000000000004b9ca5607f1ff8019c1c6a3c2f0cc8de622d5b82
Arg [3] : 000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882
Arg [4] : 00000000000000000000000099a46c42689720d9118ff7af7ce80c2a92fc4f97
Arg [5] : 000000000000000000000000c566a81f193626ee88a85fb3dcc82279b96a094e
Arg [6] : 000000000000000000000000a3de830b5208851539de8e4ff158d635e8f36fcb
Arg [7] : 000000000000000000000000b671f2210b1f6621a2607ea63e6b2dc3e2464d1f
Arg [8] : 000000000000000000000000971e78e0c92392a4e39099835cf7e6ab535b2227
Arg [9] : 000000000000000000000000ffa72fd80d8a84032d855bfb67036baf45949009
Arg [10] : 0000000000000000000000000000000000000000007682709001125f5f44ec3f


Libraries Used


Swarm Source

bzzr://ad09190e224895f4b5afd631162f84553c261f0ba3f4c951f64e8cbc33c08d8b

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

The legacy contract address for Synthetix: Synth SNX.

Validator Index Block Amount
View All Withdrawals

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

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