ETH Price: $2,812.36 (+0.98%)

Contract

0xA70B3c3DcD4d3CDC55992DC5BEBED33dA92a259A
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim Fees86681972019-10-03 8:30:061970 days ago1570091406IN
Synthetix: Old Fee Pool 6
0 ETH0.0006014611
Claim Fees86202982019-09-25 20:38:041977 days ago1569443884IN
Synthetix: Old Fee Pool 6
0 ETH0.0214742520.1
Close Current Fe...86171732019-09-25 8:48:341978 days ago1569401314IN
Synthetix: Old Fee Pool 6
0 ETH0.0025988424
Set Exchange Fee...86086532019-09-24 0:27:511979 days ago1569284871IN
Synthetix: Old Fee Pool 6
0 ETH0.0006750220
Append Vesting E...85915742019-09-21 8:42:071982 days ago1569055327IN
Synthetix: Old Fee Pool 6
0 ETH0.0034087317
Claim Fees85740052019-09-18 14:43:591985 days ago1568817839IN
Synthetix: Old Fee Pool 6
0 ETH0.0331405131
Close Current Fe...85724862019-09-18 8:56:031985 days ago1568796963IN
Synthetix: Old Fee Pool 6
0 ETH0.0006812430
Close Current Fe...85724862019-09-18 8:56:031985 days ago1568796963IN
Synthetix: Old Fee Pool 6
0 ETH0.0006812430
Close Current Fe...85724492019-09-18 8:46:531985 days ago1568796413IN
Synthetix: Old Fee Pool 6
0 ETH0.0032485530
Claim Fees85640922019-09-17 1:44:241986 days ago1568684664IN
Synthetix: Old Fee Pool 6
0 ETH0.0118779911.1
Claim Fees85638072019-09-17 0:39:161986 days ago1568680756IN
Synthetix: Old Fee Pool 6
0 ETH0.0119145611.11
Claim Fees85636362019-09-17 0:04:351986 days ago1568678675IN
Synthetix: Old Fee Pool 6
0 ETH0.011903711.1
Append Vesting E...85457172019-09-14 5:06:511989 days ago1568437611IN
Synthetix: Old Fee Pool 6
0 ETH0.0034523620
Append Vesting E...85456212019-09-14 4:46:271989 days ago1568436387IN
Synthetix: Old Fee Pool 6
0 ETH0.0018987911
Append Vesting E...85455882019-09-14 4:40:061989 days ago1568436006IN
Synthetix: Old Fee Pool 6
0 ETH0.002405412
Append Vesting E...85455602019-09-14 4:33:591989 days ago1568435639IN
Synthetix: Old Fee Pool 6
0 ETH0.0020691112
Close Current Fe...85275052019-09-11 8:44:101992 days ago1568191450IN
Synthetix: Old Fee Pool 6
0 ETH0.002165720
Close Current Fe...84826532019-09-04 8:49:161999 days ago1567586956IN
Synthetix: Old Fee Pool 6
0 ETH0.000181668
Close Current Fe...84825892019-09-04 8:35:221999 days ago1567586122IN
Synthetix: Old Fee Pool 6
0 ETH0.000962438.888
Accept Ownership84429072019-08-29 4:27:572005 days ago1567052877IN
Synthetix: Old Fee Pool 6
0 ETH0.0002762314
Import Fee Perio...84423372019-08-29 2:16:132005 days ago1567044973IN
Synthetix: Old Fee Pool 6
0 ETH0.0026000815
Import Fee Perio...84423342019-08-29 2:15:252005 days ago1567044925IN
Synthetix: Old Fee Pool 6
0 ETH0.0021308815
Import Fee Perio...84423322019-08-29 2:14:362005 days ago1567044876IN
Synthetix: Old Fee Pool 6
0 ETH0.0014453215
Nominate New Own...84423062019-08-29 2:08:342005 days ago1567044514IN
Synthetix: Old Fee Pool 6
0 ETH0.0008946820
Set Synthetix84422442019-08-29 1:54:472005 days ago1567043687IN
Synthetix: Old Fee Pool 6
0 ETH0.0012774725
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FeePool

Compiler Version
v0.4.25+commit.59dbf8f1

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2019-08-29
*/

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

file:       FeePool.sol
version:    2.8.0
authors:    Kevin Brown
            Jackson Chan
            Clinton Ennis
date:       2018-10-15

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

The FeePool is a place for users to interact with the fees that
have been generated from the Synthetix system if they've helped
to create the economy.

Users stake Synthetix to create Synths. As Synth users transact,
a small fee is deducted from exchange transactions, which collects
in the fee pool. Fees are immediately converted to XDRs, a type
of reserve currency similar to SDRs used by the IMF:
https://www.imf.org/en/About/Factsheets/Sheets/2016/08/01/14/51/Special-Drawing-Right-SDR

Users are entitled to withdraw fees from periods that they participated
in fully, e.g. they have to stake before the period starts. They
can withdraw fees for the last 2 periods as a single lump sum.
Currently fee periods are 7 days long, meaning it's assumed
users will withdraw their fees approximately once a fortnight. Fees
which are not withdrawn are redistributed to the whole pool,
enabling these non-claimed fees to go back to the rest of the commmunity.

Fees can be withdrawn in any synth currency.

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


/*
-----------------------------------------------------------------
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).

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

pragma solidity 0.4.25;

/**
 * @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:       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:       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);
}


/**
 * @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:       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:       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(bytes4 => uint) public rates;

    // Update times stored by currency code, e.g. 'SNX', or 'sUSD'
    mapping(bytes4 => 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.
    bytes4[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(bytes4 => InversePricing) public inversePricing;
    bytes4[] 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,
        bytes4[] _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 = [
            bytes4("sUSD"),
            bytes4("sAUD"),
            bytes4("sCHF"),
            bytes4("sEUR"),
            bytes4("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(bytes4[] 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(bytes4[] 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(bytes4 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.
        bytes4[] memory eventCurrencyCode = new bytes4[](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(bytes4 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(bytes4 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(bytes4 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(bytes4 sourceCurrencyKey, uint sourceAmount, bytes4 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(bytes4 currencyKey)
        public
        view
        returns (uint)
    {
        return rates[currencyKey];
    }

    /**
     * @notice Retrieve the rates for a list of currencies
     */
    function ratesForCurrencies(bytes4[] 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(bytes4 currencyKey)
        public
        view
        returns (uint)
    {
        return lastRateUpdateTimes[currencyKey];
    }

    /**
     * @notice Retrieve the last update time for a specific currency
     */
    function lastRateUpdateTimesForCurrencies(bytes4[] 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(bytes4 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(bytes4 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(bytes4[] 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(bytes4 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(bytes4[] currencyKeys, uint[] newRates);
    event RateDeleted(bytes4 currencyKey);
    event InversePriceConfigured(bytes4 currencyKey, uint entryPoint, uint upperLimit, uint lowerLimit);
    event InversePriceFrozen(bytes4 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);
}


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(bytes4 currencyKey, uint amount) external;
    function appendAccountIssuanceRecord(address account, uint lockedAmount, uint debtEntryIndex) external;
    function setRewardsToDistribute(uint amount) external;
    function transferFeeIncurred(uint value) 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 ========== */

    IFeePool public feePool;
    Synthetix public synthetix;

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

    uint8 constant DECIMALS = 18;

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

    constructor(address _proxy, TokenState _tokenState, Synthetix _synthetix, IFeePool _feePool,
        string _tokenName, string _tokenSymbol, address _owner, bytes4 _currencyKey
    )
        ExternStateToken(_proxy, _tokenState, _tokenName, _tokenSymbol, 0, DECIMALS, _owner)
        public
    {
        require(_proxy != 0, "_proxy cannot be 0");
        require(address(_synthetix) != 0, "_synthetix cannot be 0");
        require(address(_feePool) != 0, "_feePool cannot be 0");
        require(_owner != 0, "_owner cannot be 0");
        require(_synthetix.synths(_currencyKey) == Synth(0), "Currency key is already in use");

        feePool = _feePool;
        synthetix = _synthetix;
        currencyKey = _currencyKey;
    }

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

    function setSynthetix(Synthetix _synthetix)
        external
        optionalProxy_onlyOwner
    {
        synthetix = _synthetix;
        emitSynthetixUpdated(_synthetix);
    }

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

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

    /**
     * @notice Override ERC20 transfer function in order to
     * subtract the transaction fee and send it to the fee pool
     * for SNX holders to claim. */
    function transfer(address to, uint value)
        public
        optionalProxy
        notFeeAddress(messageSender)
        returns (bool)
    {
        uint amountReceived = feePool.amountReceivedFromTransfer(value);
        uint fee = value.sub(amountReceived);

        // Send the fee off to the fee pool.
        synthetix.synthInitiatedFeePayment(messageSender, currencyKey, fee);

        // And send their result off to the destination address
        bytes memory empty;
        return _internalTransfer(messageSender, to, amountReceived, empty);
    }

    /**
     * @notice Override ERC223 transfer function in order to
     * subtract the transaction fee and send it to the fee pool
     * for SNX holders to claim. */
    function transfer(address to, uint value, bytes data)
        public
        optionalProxy
        notFeeAddress(messageSender)
        returns (bool)
    {
        uint amountReceived = feePool.amountReceivedFromTransfer(value);
        uint fee = value.sub(amountReceived);

        // Send the fee off to the fee pool, which we don't want to charge an additional fee on
        synthetix.synthInitiatedFeePayment(messageSender, currencyKey, fee);

        // And send their result off to the destination address
        return _internalTransfer(messageSender, to, amountReceived, data);
    }

    /**
     * @notice Override ERC20 transferFrom function in order to
     * subtract the transaction fee and send it to the fee pool
     * for SNX holders to claim. */
    function transferFrom(address from, address to, uint value)
        public
        optionalProxy
        notFeeAddress(from)
        returns (bool)
    {
        // The fee is deducted from the amount sent.
        uint amountReceived = feePool.amountReceivedFromTransfer(value);
        uint fee = value.sub(amountReceived);

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

        // Send the fee off to the fee pool.
        synthetix.synthInitiatedFeePayment(from, currencyKey, fee);

        bytes memory empty;
        return _internalTransfer(from, to, amountReceived, empty);
    }

    /**
     * @notice Override ERC223 transferFrom function in order to
     * subtract the transaction fee and send it to the fee pool
     * for SNX holders to claim. */
    function transferFrom(address from, address to, uint value, bytes data)
        public
        optionalProxy
        notFeeAddress(from)
        returns (bool)
    {
        // The fee is deducted from the amount sent.
        uint amountReceived = feePool.amountReceivedFromTransfer(value);
        uint fee = value.sub(amountReceived);

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

        // Send the fee off to the fee pool, which we don't want to charge an additional fee on
        synthetix.synthInitiatedFeePayment(from, currencyKey, fee);

        return _internalTransfer(from, to, amountReceived, data);
    }

    /* Subtract the transfer fee from the senders account so the
     * receiver gets the exact amount specified to send. */
    function transferSenderPaysFee(address to, uint value)
        public
        optionalProxy
        notFeeAddress(messageSender)
        returns (bool)
    {
        uint fee = feePool.transferFeeIncurred(value);

        // Send the fee off to the fee pool, which we don't want to charge an additional fee on
        synthetix.synthInitiatedFeePayment(messageSender, currencyKey, fee);

        // And send their transfer amount off to the destination address
        bytes memory empty;
        return _internalTransfer(messageSender, to, value, empty);
    }

    /* Subtract the transfer fee from the senders account so the
     * receiver gets the exact amount specified to send. */
    function transferSenderPaysFee(address to, uint value, bytes data)
        public
        optionalProxy
        notFeeAddress(messageSender)
        returns (bool)
    {
        uint fee = feePool.transferFeeIncurred(value);

        // Send the fee off to the fee pool, which we don't want to charge an additional fee on
        synthetix.synthInitiatedFeePayment(messageSender, currencyKey, fee);

        // And send their transfer amount off to the destination address
        return _internalTransfer(messageSender, to, value, data);
    }

    /* Subtract the transfer fee from the senders account so the
     * to address receives the exact amount specified to send. */
    function transferFromSenderPaysFee(address from, address to, uint value)
        public
        optionalProxy
        notFeeAddress(from)
        returns (bool)
    {
        uint fee = feePool.transferFeeIncurred(value);

        // 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.add(fee)));

        // Send the fee off to the fee pool, which we don't want to charge an additional fee on
        synthetix.synthInitiatedFeePayment(from, currencyKey, fee);

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

    /* Subtract the transfer fee from the senders account so the
     * to address receives the exact amount specified to send. */
    function transferFromSenderPaysFee(address from, address to, uint value, bytes data)
        public
        optionalProxy
        notFeeAddress(from)
        returns (bool)
    {
        uint fee = feePool.transferFeeIncurred(value);

        // 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.add(fee)));

        // Send the fee off to the fee pool, which we don't want to charge an additional fee on
        synthetix.synthInitiatedFeePayment(from, currencyKey, fee);

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

    // Override our internal transfer to inject preferred currency support
    function _internalTransfer(address from, address to, uint value, bytes data)
        internal
        returns (bool)
    {
        bytes4 preferredCurrencyKey = synthetix.synthetixState().preferredCurrency(to);

        // Do they have a preferred currency that's not us? If so we need to exchange
        if (preferredCurrencyKey != 0 && preferredCurrencyKey != currencyKey) {
            return synthetix.synthInitiatedExchange(from, currencyKey, value, preferredCurrencyKey, to);
        } else {
            // Otherwise we just transfer
            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);
    }

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

    modifier onlySynthetixOrFeePool() {
        bool isSynthetix = msg.sender == address(synthetix);
        bool isFeePool = msg.sender == address(feePool);

        require(isSynthetix || isFeePool, "Only the Synthetix or FeePool contracts can perform this action");
        _;
    }

    modifier notFeeAddress(address account) {
        require(account != feePool.FEE_ADDRESS(), "Cannot perform this action with the fee address");
        _;
    }

    /* ========== 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 SynthetixEscrow interface
 */
interface ISynthetixEscrow {
    function balanceOf(address account) public view returns (uint);
    function appendVestingEntry(address account, uint quantity) public;
}


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

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

    /**
     * @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
    {
        bytes4 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(bytes4 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(bytes4 sourceCurrencyKey, uint sourceAmount, bytes4 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(bytes4 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 (bytes4[])
    {
        bytes4[] memory availableCurrencyKeys = new bytes4[](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(bytes4 sourceCurrencyKey, uint sourceAmount, bytes4 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");

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

    /**
     * @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,
        bytes4 sourceCurrencyKey,
        uint sourceAmount,
        bytes4 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 Only the synth contract can call this function.
     * @param from The address fee is coming from.
     * @param sourceCurrencyKey source currency fee from.
     * @param sourceAmount The amount, specified in UNIT of source currency.
     * @return Boolean that indicates whether the transfer succeeded or failed.
     */
    function synthInitiatedFeePayment(
        address from,
        bytes4 sourceCurrencyKey,
        uint sourceAmount
    )
        external
        returns (bool)
    {
        _onlySynth();

        // Allow fee to be 0 and skip minting XDRs to feePool
        if (sourceAmount == 0) {
            return true;
        }

        require(sourceAmount > 0, "Source can't be 0");

        // Pass it along, defaulting to the sender as the recipient.
        bool result = _internalExchange(
            from,
            sourceCurrencyKey,
            sourceAmount,
            "XDR",
            feePool.FEE_ADDRESS(),
            false // Don't charge a fee on the exchange because this is already a fee
        );

        // Tell the fee pool about this.
        feePool.feePaid(sourceCurrencyKey, sourceAmount);

        return result;
    }

    /**
     * @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,
        bytes4 sourceCurrencyKey,
        uint sourceAmount,
        bytes4 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,
        bytes4 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(bytes4 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(bytes4 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(bytes4 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(bytes4 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, bytes4 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, bytes4 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, bytes4 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(bytes4 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
     * @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 {
        bool isSynth = false;

        // No need to repeatedly call this function either
        for (uint8 i = 0; i < availableSynths.length; i++) {
            if (availableSynths[i] == msg.sender) {
                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, bytes4 fromCurrencyKey, uint256 fromAmount, bytes4 toCurrencyKey,  uint256 toAmount, address toAddress);
    bytes32 constant SYNTHEXCHANGE_SIG = keccak256("SynthExchange(address,bytes4,uint256,bytes4,uint256,address)");
    function emitSynthExchange(address account, bytes4 fromCurrencyKey, uint256 fromAmount, bytes4 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 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;
}


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

file:       FeePoolState.sol
version:    1.0
author:     Clinton Ennis
            Jackson Chan
date:       2019-04-05

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

The FeePoolState simply stores the accounts issuance ratio for
each fee period in the FeePool.

This is use to caclulate the correct allocation of fees/rewards
owed to minters of the stablecoin total supply

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


contract FeePoolState is SelfDestructible, LimitedSetup {
    using SafeMath for uint;
    using SafeDecimalMath for uint;

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

    uint8 constant public FEE_PERIOD_LENGTH = 6;

    address public feePool;

    // The IssuanceData activity that's happened in a fee period.
    struct IssuanceData {
        uint debtPercentage;
        uint debtEntryIndex;
    }

    // The IssuanceData activity that's happened in a fee period.
    mapping(address => IssuanceData[FEE_PERIOD_LENGTH]) public accountIssuanceLedger;

    /**
     * @dev Constructor.
     * @param _owner The owner of this contract.
     */
    constructor(address _owner, IFeePool _feePool)
        SelfDestructible(_owner)
        LimitedSetup(6 weeks)
        public
    {
        feePool = _feePool;
    }

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

    /**
     * @notice set the FeePool contract as it is the only authority to be able to call
     * appendAccountIssuanceRecord with the onlyFeePool modifer
     * @dev Must be set by owner when FeePool logic is upgraded
     */
    function setFeePool(IFeePool _feePool)
        external
        onlyOwner
    {
        feePool = _feePool;
    }

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

    /**
     * @notice Get an accounts issuanceData for
     * @param account users account
     * @param index Index in the array to retrieve. Upto FEE_PERIOD_LENGTH
     */
    function getAccountsDebtEntry(address account, uint index)
        public
        view
        returns (uint debtPercentage, uint debtEntryIndex)
    {
        require(index < FEE_PERIOD_LENGTH, "index exceeds the FEE_PERIOD_LENGTH");

        debtPercentage = accountIssuanceLedger[account][index].debtPercentage;
        debtEntryIndex = accountIssuanceLedger[account][index].debtEntryIndex;
    }

    /**
     * @notice Find the oldest debtEntryIndex for the corresponding closingDebtIndex
     * @param account users account
     * @param closingDebtIndex the last periods debt index on close
     */
    function applicableIssuanceData(address account, uint closingDebtIndex)
        external
        view
        returns (uint, uint)
    {
        IssuanceData[FEE_PERIOD_LENGTH] memory issuanceData = accountIssuanceLedger[account];
        
        // We want to use the user's debtEntryIndex at when the period closed
        // Find the oldest debtEntryIndex for the corresponding closingDebtIndex
        for (uint i = 0; i < FEE_PERIOD_LENGTH; i++) {
            if (closingDebtIndex >= issuanceData[i].debtEntryIndex) {
                return (issuanceData[i].debtPercentage, issuanceData[i].debtEntryIndex);
            }
        }
    }

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

    /**
     * @notice Logs an accounts issuance data in the current fee period which is then stored historically
     * @param account Message.Senders account address
     * @param debtRatio Debt percentage this account has locked after minting or burning their synth
     * @param debtEntryIndex The index in the global debt ledger. synthetix.synthetixState().issuanceData(account)
     * @param currentPeriodStartDebtIndex The startingDebtIndex of the current fee period
     * @dev onlyFeePool to call me on synthetix.issue() & synthetix.burn() calls to store the locked SNX
     * per fee period so we know to allocate the correct proportions of fees and rewards per period
      accountIssuanceLedger[account][0] has the latest locked amount for the current period. This can be update as many time
      accountIssuanceLedger[account][1-3] has the last locked amount for a previous period they minted or burned
     */
    function appendAccountIssuanceRecord(address account, uint debtRatio, uint debtEntryIndex, uint currentPeriodStartDebtIndex)
        external
        onlyFeePool
    {
        // Is the current debtEntryIndex within this fee period
        if (accountIssuanceLedger[account][0].debtEntryIndex < currentPeriodStartDebtIndex) {
             // If its older then shift the previous IssuanceData entries periods down to make room for the new one.
            issuanceDataIndexOrder(account);
        }
        
        // Always store the latest IssuanceData entry at [0]
        accountIssuanceLedger[account][0].debtPercentage = debtRatio;
        accountIssuanceLedger[account][0].debtEntryIndex = debtEntryIndex;
    }

    /**
     * @notice Pushes down the entire array of debt ratios per fee period
     */
    function issuanceDataIndexOrder(address account)
        private
    {
        for (uint i = FEE_PERIOD_LENGTH - 2; i < FEE_PERIOD_LENGTH; i--) {
            uint next = i + 1;
            accountIssuanceLedger[account][next].debtPercentage = accountIssuanceLedger[account][i].debtPercentage;
            accountIssuanceLedger[account][next].debtEntryIndex = accountIssuanceLedger[account][i].debtEntryIndex;
        }
    }

    /**
     * @notice Import issuer data from synthetixState.issuerData on FeePeriodClose() block #
     * @dev Only callable by the contract owner, and only for 6 weeks after deployment.
     * @param accounts Array of issuing addresses
     * @param ratios Array of debt ratios
     * @param periodToInsert The Fee Period to insert the historical records into
     * @param feePeriodCloseIndex An accounts debtEntryIndex is valid when within the fee peroid,
     * since the input ratio will be an average of the pervious periods it just needs to be
     * > recentFeePeriods[periodToInsert].startingDebtIndex
     * < recentFeePeriods[periodToInsert - 1].startingDebtIndex
     */
    function importIssuerData(address[] accounts, uint[] ratios, uint periodToInsert, uint feePeriodCloseIndex)
        external
        onlyOwner
        onlyDuringSetup
    {
        require(accounts.length == ratios.length, "Length mismatch");

        for (uint8 i = 0; i < accounts.length; i++) {
            accountIssuanceLedger[accounts[i]][periodToInsert].debtPercentage = ratios[i];
            accountIssuanceLedger[accounts[i]][periodToInsert].debtEntryIndex = feePeriodCloseIndex;
            emit IssuanceDebtRatioEntry(accounts[i], ratios[i], feePeriodCloseIndex);
        }
    }

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

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

    /* ========== Events ========== */
    event IssuanceDebtRatioEntry(address indexed account, uint debtRatio, uint feePeriodCloseIndex);
}


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

file:       EternalStorage.sol
version:    1.0
author:     Clinton Ennise
            Jackson Chan

date:       2019-02-01

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

This contract is used with external state storage contracts for
decoupled data storage.

Implements support for storing a keccak256 key and value pairs. It is
the more flexible and extensible option. This ensures data schema
changes can be implemented without requiring upgrades to the
storage contract

The first deployed storage contract would create this eternal storage.
Favour use of keccak256 key over sha3 as future version of solidity
> 0.5.0 will be deprecated.

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


/**
 * @notice  This contract is based on the code available from this blog
 * https://blog.colony.io/writing-upgradeable-contracts-in-solidity-6743f0eecc88/
 * Implements support for storing a keccak256 key and value pairs. It is the more flexible
 * and extensible option. This ensures data schema changes can be implemented without
 * requiring upgrades to the storage contract.
 */
contract EternalStorage is State {

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

    /* ========== DATA TYPES ========== */
    mapping(bytes32 => uint) UIntStorage;
    mapping(bytes32 => string) StringStorage;
    mapping(bytes32 => address) AddressStorage;
    mapping(bytes32 => bytes) BytesStorage;
    mapping(bytes32 => bytes32) Bytes32Storage;
    mapping(bytes32 => bool) BooleanStorage;
    mapping(bytes32 => int) IntStorage;

    // UIntStorage;
    function getUIntValue(bytes32 record) external view returns (uint){
        return UIntStorage[record];
    }

    function setUIntValue(bytes32 record, uint value) external
        onlyAssociatedContract
    {
        UIntStorage[record] = value;
    }

    function deleteUIntValue(bytes32 record) external
        onlyAssociatedContract
    {
        delete UIntStorage[record];
    }

    // StringStorage
    function getStringValue(bytes32 record) external view returns (string memory){
        return StringStorage[record];
    }

    function setStringValue(bytes32 record, string value) external
        onlyAssociatedContract
    {
        StringStorage[record] = value;
    }

    function deleteStringValue(bytes32 record) external
        onlyAssociatedContract
    {
        delete StringStorage[record];
    }

    // AddressStorage
    function getAddressValue(bytes32 record) external view returns (address){
        return AddressStorage[record];
    }

    function setAddressValue(bytes32 record, address value) external
        onlyAssociatedContract
    {
        AddressStorage[record] = value;
    }

    function deleteAddressValue(bytes32 record) external
        onlyAssociatedContract
    {
        delete AddressStorage[record];
    }


    // BytesStorage
    function getBytesValue(bytes32 record) external view returns
    (bytes memory){
        return BytesStorage[record];
    }

    function setBytesValue(bytes32 record, bytes value) external
        onlyAssociatedContract
    {
        BytesStorage[record] = value;
    }

    function deleteBytesValue(bytes32 record) external
        onlyAssociatedContract
    {
        delete BytesStorage[record];
    }

    // Bytes32Storage
    function getBytes32Value(bytes32 record) external view returns (bytes32)
    {
        return Bytes32Storage[record];
    }

    function setBytes32Value(bytes32 record, bytes32 value) external
        onlyAssociatedContract
    {
        Bytes32Storage[record] = value;
    }

    function deleteBytes32Value(bytes32 record) external
        onlyAssociatedContract
    {
        delete Bytes32Storage[record];
    }

    // BooleanStorage
    function getBooleanValue(bytes32 record) external view returns (bool)
    {
        return BooleanStorage[record];
    }

    function setBooleanValue(bytes32 record, bool value) external
        onlyAssociatedContract
    {
        BooleanStorage[record] = value;
    }

    function deleteBooleanValue(bytes32 record) external
        onlyAssociatedContract
    {
        delete BooleanStorage[record];
    }

    // IntStorage
    function getIntValue(bytes32 record) external view returns (int){
        return IntStorage[record];
    }

    function setIntValue(bytes32 record, int value) external
        onlyAssociatedContract
    {
        IntStorage[record] = value;
    }

    function deleteIntValue(bytes32 record) external
        onlyAssociatedContract
    {
        delete IntStorage[record];
    }
}

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

file:       FeePoolEternalStorage.sol
version:    1.0
author:     Clinton Ennis
            Jackson Chan
date:       2019-04-05

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

The FeePoolEternalStorage is for any state the FeePool contract
needs to persist between upgrades to the FeePool logic.

Please see EternalStorage.sol

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


contract FeePoolEternalStorage is EternalStorage, LimitedSetup {

    bytes32 constant LAST_FEE_WITHDRAWAL = "last_fee_withdrawal";

    /**
     * @dev Constructor.
     * @param _owner The owner of this contract.
     */
    constructor(address _owner, address _feePool)
        EternalStorage(_owner, _feePool)
        LimitedSetup(6 weeks)
        public
    {
    }

    /**
     * @notice Import data from FeePool.lastFeeWithdrawal
     * @dev Only callable by the contract owner, and only for 6 weeks after deployment.
     * @param accounts Array of addresses that have claimed
     * @param feePeriodIDs Array feePeriodIDs with the accounts last claim
     */
    function importFeeWithdrawalData(address[] accounts, uint[] feePeriodIDs)
        external
        onlyOwner
        onlyDuringSetup
    {
        require(accounts.length == feePeriodIDs.length, "Length mismatch");

        for (uint8 i = 0; i < accounts.length; i++) {
            this.setUIntValue(keccak256(abi.encodePacked(LAST_FEE_WITHDRAWAL, accounts[i])), feePeriodIDs[i]);
        }
    }
}


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

file:       DelegateApprovals.sol
version:    1.0
author:     Jackson Chan
checked:    Clinton Ennis
date:       2019-05-01

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

The approval state contract is designed to allow a wallet to
authorise another address to perform actions, on a contract,
on their behalf. This could be an automated service
that would help a wallet claim fees / rewards on their behalf.

The concept is similar to the ERC20 interface where a wallet can
approve an authorised party to spend on the authorising party's
behalf in the allowance interface.

Withdrawing approval sets the delegate as false instead of
removing from the approvals list for auditability.

This contract inherits state for upgradeability / associated
contract.

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


contract DelegateApprovals is State {

    // Approvals - [authoriser][delegate]
    // Each authoriser can have multiple delegates
    mapping(address => mapping(address => bool)) public approval;

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

    function setApproval(address authoriser, address delegate)
        external
        onlyAssociatedContract
    {
        approval[authoriser][delegate] = true;
        emit Approval(authoriser, delegate);
    }

    function withdrawApproval(address authoriser, address delegate)
        external
        onlyAssociatedContract
    {
        delete approval[authoriser][delegate];
        emit WithdrawApproval(authoriser, delegate);
    }

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

    event Approval(address indexed authoriser, address delegate);
    event WithdrawApproval(address indexed authoriser, address delegate);
}


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

file:       FeePool.sol
version:    2.8.0
authors:    Kevin Brown
            Jackson Chan
            Clinton Ennis
date:       2018-10-15

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

The FeePool is a place for users to interact with the fees that
have been generated from the Synthetix system if they've helped
to create the economy.

Users stake Synthetix to create Synths. As Synth users transact,
a small fee is deducted from exchange transactions, which collects
in the fee pool. Fees are immediately converted to XDRs, a type
of reserve currency similar to SDRs used by the IMF:
https://www.imf.org/en/About/Factsheets/Sheets/2016/08/01/14/51/Special-Drawing-Right-SDR

Users are entitled to withdraw fees from periods that they participated
in fully, e.g. they have to stake before the period starts. They
can withdraw fees for the last 2 periods as a single lump sum.
Currently fee periods are 7 days long, meaning it's assumed
users will withdraw their fees approximately once a fortnight. Fees
which are not withdrawn are redistributed to the whole pool,
enabling these non-claimed fees to go back to the rest of the commmunity.

Fees can be withdrawn in any synth currency.

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


contract FeePool is Proxyable, SelfDestructible, LimitedSetup {

    using SafeMath for uint;
    using SafeDecimalMath for uint;

    Synthetix public synthetix;
    ISynthetixState public synthetixState;
    ISynthetixEscrow public rewardEscrow;
    FeePoolEternalStorage public feePoolEternalStorage;

    // A percentage fee charged on each transfer.
    uint public transferFeeRate;

    // Transfer fee may not exceed 10%.
    uint constant public MAX_TRANSFER_FEE_RATE = SafeDecimalMath.unit() / 10;

    // A percentage fee charged on each exchange between currencies.
    uint public exchangeFeeRate;

    // Exchange fee may not exceed 10%.
    uint constant public MAX_EXCHANGE_FEE_RATE = SafeDecimalMath.unit() / 10;

    // The address with the authority to distribute rewards.
    address public rewardsAuthority;

    // The address to the FeePoolState Contract.
    FeePoolState public feePoolState;

    // The address to the DelegateApproval contract.
    DelegateApprovals public delegates;

    // Where fees are pooled in XDRs.
    address public constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF;

    // This struct represents the issuance activity that's happened in a fee period.
    struct FeePeriod {
        uint feePeriodId;
        uint startingDebtIndex;
        uint startTime;
        uint feesToDistribute;
        uint feesClaimed;
        uint rewardsToDistribute;
        uint rewardsClaimed;
    }

    // The last 2 fee periods are all that you can claim from.
    // These are stored and managed from [0], such that [0] is always
    // the current avtive fee period which is not claimable until the
    // public function closeCurrentFeePeriod() is called closing the
    // current weeks collected fees. [1] is last weeks feeperiod and
    // [2] is the oldest fee period that users can claim for.
    uint8 constant public FEE_PERIOD_LENGTH = 3;

    FeePeriod[FEE_PERIOD_LENGTH] public recentFeePeriods;

    // How long a fee period lasts at a minimum. It is required for the
    // fee authority to roll over the periods, so they are not guaranteed
    // to roll over at exactly this duration, but the contract enforces
    // that they cannot roll over any quicker than this duration.
    uint public feePeriodDuration = 1 weeks;
    // The fee period must be between 1 day and 60 days.
    uint public constant MIN_FEE_PERIOD_DURATION = 1 days;
    uint public constant MAX_FEE_PERIOD_DURATION = 60 days;

    // Users are unable to claim fees if their collateralisation ratio drifts out of target treshold
    uint public TARGET_THRESHOLD = (10 * SafeDecimalMath.unit()) / 100;

    /* ========== ETERNAL STORAGE CONSTANTS ========== */

    bytes32 constant LAST_FEE_WITHDRAWAL = "last_fee_withdrawal";

    constructor(
        address _proxy,
        address _owner,
        Synthetix _synthetix,
        FeePoolState _feePoolState,
        FeePoolEternalStorage _feePoolEternalStorage,
        ISynthetixState _synthetixState,
        ISynthetixEscrow _rewardEscrow,
        address _rewardsAuthority,
        uint _transferFeeRate,
        uint _exchangeFeeRate)
        SelfDestructible(_owner)
        Proxyable(_proxy, _owner)
        LimitedSetup(3 weeks)
        public
    {
        // Constructed fee rates should respect the maximum fee rates.
        require(_transferFeeRate <= MAX_TRANSFER_FEE_RATE, "Transfer fee rate max exceeded");
        require(_exchangeFeeRate <= MAX_EXCHANGE_FEE_RATE, "Exchange fee rate max exceeded");

        synthetix = _synthetix;
        feePoolState = _feePoolState;
        feePoolEternalStorage = _feePoolEternalStorage;
        rewardEscrow = _rewardEscrow;
        synthetixState = _synthetixState;
        rewardsAuthority = _rewardsAuthority;
        transferFeeRate = _transferFeeRate;
        exchangeFeeRate = _exchangeFeeRate;

        // Set our initial fee period
        recentFeePeriods[0].feePeriodId = 1;
        recentFeePeriods[0].startTime = now;
    }

    /**
     * @notice Logs an accounts issuance data per fee period
     * @param account Message.Senders account address
     * @param debtRatio Debt percentage this account has locked after minting or burning their synth
     * @param debtEntryIndex The index in the global debt ledger. synthetix.synthetixState().issuanceData(account)
     * @dev onlySynthetix to call me on synthetix.issue() & synthetix.burn() calls to store the locked SNX
     * per fee period so we know to allocate the correct proportions of fees and rewards per period
     */
    function appendAccountIssuanceRecord(address account, uint debtRatio, uint debtEntryIndex)
        external
        onlySynthetix
    {
        feePoolState.appendAccountIssuanceRecord(account, debtRatio, debtEntryIndex, recentFeePeriods[0].startingDebtIndex);

        emitIssuanceDebtRatioEntry(account, debtRatio, debtEntryIndex, recentFeePeriods[0].startingDebtIndex);
    }

    /**
     * @notice Set the exchange fee, anywhere within the range 0-10%.
     * @dev The fee rate is in decimal format, with UNIT being the value of 100%.
     */
    function setExchangeFeeRate(uint _exchangeFeeRate)
        external
        optionalProxy_onlyOwner
    {
        exchangeFeeRate = _exchangeFeeRate;
    }

    /**
     * @notice Set the transfer fee, anywhere within the range 0-10%.
     * @dev The fee rate is in decimal format, with UNIT being the value of 100%.
     */
    function setTransferFeeRate(uint _transferFeeRate)
        external
        optionalProxy_onlyOwner
    {
        require(_transferFeeRate <= MAX_TRANSFER_FEE_RATE, "Transfer fee rate max exceeded");

        transferFeeRate = _transferFeeRate;
    }

    /**
     * @notice Set the address of the contract responsible for distributing rewards
     */
    function setRewardsAuthority(address _rewardsAuthority)
        external
        optionalProxy_onlyOwner
    {
        rewardsAuthority = _rewardsAuthority;
    }

    /**
     * @notice Set the address of the contract for feePool state
     */
    function setFeePoolState(FeePoolState _feePoolState)
        external
        optionalProxy_onlyOwner
    {
        feePoolState = _feePoolState;
    }

    /**
     * @notice Set the address of the contract for delegate approvals
     */
    function setDelegateApprovals(DelegateApprovals _delegates)
        external
        optionalProxy_onlyOwner
    {
        delegates = _delegates;
    }

    /**
     * @notice Set the fee period duration
     */
    function setFeePeriodDuration(uint _feePeriodDuration)
        external
        optionalProxy_onlyOwner
    {
        require(_feePeriodDuration >= MIN_FEE_PERIOD_DURATION, "value < MIN_FEE_PERIOD_DURATION");
        require(_feePeriodDuration <= MAX_FEE_PERIOD_DURATION, "value > MAX_FEE_PERIOD_DURATION");

        feePeriodDuration = _feePeriodDuration;

        emitFeePeriodDurationUpdated(_feePeriodDuration);
    }

    /**
     * @notice Set the synthetix contract
     */
    function setSynthetix(Synthetix _synthetix)
        external
        optionalProxy_onlyOwner
    {
        require(address(_synthetix) != address(0), "New Synthetix must be non-zero");

        synthetix = _synthetix;
    }

    function setTargetThreshold(uint _percent)
        external
        optionalProxy_onlyOwner
    {
        require(_percent >= 0, "Threshold should be positive");
        TARGET_THRESHOLD = (_percent * SafeDecimalMath.unit()) / 100;
    }

    /**
     * @notice The Synthetix contract informs us when fees are paid.
     */
    function feePaid(bytes4 currencyKey, uint amount)
        external
        onlySynthetix
    {
        uint xdrAmount;

        if (currencyKey != "XDR") {
            xdrAmount = synthetix.effectiveValue(currencyKey, amount, "XDR");
        } else {
            xdrAmount = amount;
        }

        // Keep track of in XDRs in our fee pool.
        recentFeePeriods[0].feesToDistribute = recentFeePeriods[0].feesToDistribute.add(xdrAmount);
    }

    /**
     * @notice The RewardsDistribution contract informs us how many SNX rewards are sent to RewardEscrow to be claimed.
     */
    function setRewardsToDistribute(uint amount)
        external
    {
        require(messageSender == rewardsAuthority || msg.sender == rewardsAuthority, "Caller is not rewardsAuthority");
        // Add the amount of SNX rewards to distribute on top of any rolling unclaimed amount
        recentFeePeriods[0].rewardsToDistribute = recentFeePeriods[0].rewardsToDistribute.add(amount);
    }

    /**
     * @notice Close the current fee period and start a new one. Only callable by the fee authority.
     */
    function closeCurrentFeePeriod()
        external
    {
        require(recentFeePeriods[0].startTime <= (now - feePeriodDuration), "Too early to close fee period");

        FeePeriod memory secondLastFeePeriod = recentFeePeriods[FEE_PERIOD_LENGTH - 2];
        FeePeriod memory lastFeePeriod = recentFeePeriods[FEE_PERIOD_LENGTH - 1];

        // Any unclaimed fees from the last period in the array roll back one period.
        // Because of the subtraction here, they're effectively proportionally redistributed to those who
        // have already claimed from the old period, available in the new period.
        // The subtraction is important so we don't create a ticking time bomb of an ever growing
        // number of fees that can never decrease and will eventually overflow at the end of the fee pool.
        recentFeePeriods[FEE_PERIOD_LENGTH - 2].feesToDistribute = lastFeePeriod.feesToDistribute
            .sub(lastFeePeriod.feesClaimed)
            .add(secondLastFeePeriod.feesToDistribute);
        recentFeePeriods[FEE_PERIOD_LENGTH - 2].rewardsToDistribute = lastFeePeriod.rewardsToDistribute
            .sub(lastFeePeriod.rewardsClaimed)
            .add(secondLastFeePeriod.rewardsToDistribute);

        // Shift the previous fee periods across to make room for the new one.
        // Condition checks for overflow when uint subtracts one from zero
        // Could be written with int instead of uint, but then we have to convert everywhere
        // so it felt better from a gas perspective to just change the condition to check
        // for overflow after subtracting one from zero.
        for (uint i = FEE_PERIOD_LENGTH - 2; i < FEE_PERIOD_LENGTH; i--) {
            uint next = i + 1;
            recentFeePeriods[next].feePeriodId = recentFeePeriods[i].feePeriodId;
            recentFeePeriods[next].startingDebtIndex = recentFeePeriods[i].startingDebtIndex;
            recentFeePeriods[next].startTime = recentFeePeriods[i].startTime;
            recentFeePeriods[next].feesToDistribute = recentFeePeriods[i].feesToDistribute;
            recentFeePeriods[next].feesClaimed = recentFeePeriods[i].feesClaimed;
            recentFeePeriods[next].rewardsToDistribute = recentFeePeriods[i].rewardsToDistribute;
            recentFeePeriods[next].rewardsClaimed = recentFeePeriods[i].rewardsClaimed;
        }

        // Clear the first element of the array to make sure we don't have any stale values.
        delete recentFeePeriods[0];

        // Open up the new fee period. Take a snapshot of the total value of the system.
        // Increment periodId from the recent closed period feePeriodId
        recentFeePeriods[0].feePeriodId = recentFeePeriods[1].feePeriodId.add(1);
        recentFeePeriods[0].startingDebtIndex = synthetixState.debtLedgerLength();
        recentFeePeriods[0].startTime = now;

        emitFeePeriodClosed(recentFeePeriods[1].feePeriodId);
    }

    /**
    * @notice Claim fees for last period when available or not already withdrawn.
    * @param currencyKey Synth currency you wish to receive the fees in.
    */
    function claimFees(bytes4 currencyKey)
        external
        optionalProxy
        returns (bool)
    {
        return _claimFees(messageSender, currencyKey);
    }

    function claimOnBehalf(address claimingForAddress, bytes4 currencyKey)
        external
        optionalProxy
        returns (bool)
    {
        require(delegates.approval(claimingForAddress, messageSender), "Not approved to claim on behalf");

        return _claimFees(claimingForAddress, currencyKey);
    }

    function _claimFees(address claimingAddress, bytes4 currencyKey)
        internal
        returns (bool)
    {
        uint rewardsPaid;
        uint feesPaid;
        uint availableFees;
        uint availableRewards;

        // Address wont be able to claim fees if it is to far below the target c-ratio.
        // It will need to burn synths then try claiming again.
        require(feesClaimable(claimingAddress), "C-Ratio below penalty threshold");

        // Get the claimingAddress available fees and rewards
        (availableFees, availableRewards) = feesAvailable(claimingAddress, "XDR");

        require(availableFees > 0 || availableRewards > 0, "No fees or rewards available for period, or fees already claimed");

        // Record the address has claimed for this period
        _setLastFeeWithdrawal(claimingAddress, recentFeePeriods[1].feePeriodId);

        if (availableFees > 0) {
            // Record the fee payment in our recentFeePeriods
            feesPaid = _recordFeePayment(availableFees);

            // Send them their fees
            _payFees(claimingAddress, feesPaid, currencyKey);
        }

        if (availableRewards > 0) {
            // Record the reward payment in our recentFeePeriods
            rewardsPaid = _recordRewardPayment(availableRewards);

            // Send them their rewards
            _payRewards(claimingAddress, rewardsPaid);
        }

        emitFeesClaimed(claimingAddress, feesPaid, rewardsPaid);

        return true;
    }

    function importFeePeriod(
        uint feePeriodIndex, uint feePeriodId, uint startingDebtIndex, uint startTime,
        uint feesToDistribute, uint feesClaimed, uint rewardsToDistribute, uint rewardsClaimed)
        public
        optionalProxy_onlyOwner
        onlyDuringSetup
    {
        recentFeePeriods[feePeriodIndex].feePeriodId = feePeriodId;
        recentFeePeriods[feePeriodIndex].startingDebtIndex = startingDebtIndex;
        recentFeePeriods[feePeriodIndex].startTime = startTime;
        recentFeePeriods[feePeriodIndex].feesToDistribute = feesToDistribute;
        recentFeePeriods[feePeriodIndex].feesClaimed = feesClaimed;
        recentFeePeriods[feePeriodIndex].rewardsToDistribute = rewardsToDistribute;
        recentFeePeriods[feePeriodIndex].rewardsClaimed = rewardsClaimed;
    }

    /**
    * @notice Owner can escrow SNX. Owner to send the tokens to the RewardEscrow
    * @param account Address to escrow tokens for
    * @param quantity Amount of tokens to escrow
    */
    function appendVestingEntry(address account, uint quantity)
        public
        optionalProxy_onlyOwner
    {
        // Transfer SNX from messageSender to the Reward Escrow
        synthetix.transferFrom(messageSender, rewardEscrow, quantity);

        // Create Vesting Entry
        rewardEscrow.appendVestingEntry(account, quantity);
    }

    function approveClaimOnBehalf(address account)
        public
        optionalProxy
    {
        require(delegates != address(0), "Delegates Contract missing");
        require(account != address(0), "Can't delegate to address(0)");
        delegates.setApproval(messageSender, account);
    }

    function removeClaimOnBehalf(address account)
        public
        optionalProxy
    {
        require(delegates != address(0), "Delegates Contract missing");
        delegates.withdrawApproval(messageSender, account);
    }

    /**
     * @notice Record the fee payment in our recentFeePeriods.
     * @param xdrAmount The amount of fees priced in XDRs.
     */
    function _recordFeePayment(uint xdrAmount)
        internal
        returns (uint)
    {
        // Don't assign to the parameter
        uint remainingToAllocate = xdrAmount;

        uint feesPaid;
        // Start at the oldest period and record the amount, moving to newer periods
        // until we've exhausted the amount.
        // The condition checks for overflow because we're going to 0 with an unsigned int.
        for (uint i = FEE_PERIOD_LENGTH - 1; i < FEE_PERIOD_LENGTH; i--) {
            uint delta = recentFeePeriods[i].feesToDistribute.sub(recentFeePeriods[i].feesClaimed);

            if (delta > 0) {
                // Take the smaller of the amount left to claim in the period and the amount we need to allocate
                uint amountInPeriod = delta < remainingToAllocate ? delta : remainingToAllocate;

                recentFeePeriods[i].feesClaimed = recentFeePeriods[i].feesClaimed.add(amountInPeriod);
                remainingToAllocate = remainingToAllocate.sub(amountInPeriod);
                feesPaid = feesPaid.add(amountInPeriod);

                // No need to continue iterating if we've recorded the whole amount;
                if (remainingToAllocate == 0) return feesPaid;

                // We've exhausted feePeriods to distribute and no fees remain in last period
                // User last to claim would in this scenario have their remainder slashed
                if (i == 0 && remainingToAllocate > 0) {
                    remainingToAllocate = 0;
                }
            }
        }

        return feesPaid;
    }

    /**
     * @notice Record the reward payment in our recentFeePeriods.
     * @param snxAmount The amount of SNX tokens.
     */
    function _recordRewardPayment(uint snxAmount)
        internal
        returns (uint)
    {
        // Don't assign to the parameter
        uint remainingToAllocate = snxAmount;

        uint rewardPaid;

        // Start at the oldest period and record the amount, moving to newer periods
        // until we've exhausted the amount.
        // The condition checks for overflow because we're going to 0 with an unsigned int.
        for (uint i = FEE_PERIOD_LENGTH - 1; i < FEE_PERIOD_LENGTH; i--) {
            uint toDistribute = recentFeePeriods[i].rewardsToDistribute.sub(recentFeePeriods[i].rewardsClaimed);

            if (toDistribute > 0) {
                // Take the smaller of the amount left to claim in the period and the amount we need to allocate
                uint amountInPeriod = toDistribute < remainingToAllocate ? toDistribute : remainingToAllocate;

                recentFeePeriods[i].rewardsClaimed = recentFeePeriods[i].rewardsClaimed.add(amountInPeriod);
                remainingToAllocate = remainingToAllocate.sub(amountInPeriod);
                rewardPaid = rewardPaid.add(amountInPeriod);

                // No need to continue iterating if we've recorded the whole amount;
                if (remainingToAllocate == 0) return rewardPaid;

                // We've exhausted feePeriods to distribute and no rewards remain in last period
                // User last to claim would in this scenario have their remainder slashed
                // due to rounding up of PreciseDecimal
                if (i == 0 && remainingToAllocate > 0) {
                    remainingToAllocate = 0;
                }
            }
        }
        return rewardPaid;
    }

    /**
    * @notice Send the fees to claiming address.
    * @param account The address to send the fees to.
    * @param xdrAmount The amount of fees priced in XDRs.
    * @param destinationCurrencyKey The synth currency the user wishes to receive their fees in (convert to this currency).
    */
    function _payFees(address account, uint xdrAmount, bytes4 destinationCurrencyKey)
        internal
        notFeeAddress(account)
    {
        require(account != address(0), "Account can't be 0");
        require(account != address(this), "Can't send fees to fee pool");
        require(account != address(proxy), "Can't send fees to proxy");
        require(account != address(synthetix), "Can't send fees to synthetix");

        Synth xdrSynth = synthetix.synths("XDR");
        Synth destinationSynth = synthetix.synths(destinationCurrencyKey);

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

        // Burn the source amount
        xdrSynth.burn(FEE_ADDRESS, xdrAmount);

        // How much should they get in the destination currency?
        uint destinationAmount = synthetix.effectiveValue("XDR", xdrAmount, destinationCurrencyKey);

        // There's no fee on withdrawing fees, as that'd be way too meta.

        // Mint their new synths
        destinationSynth.issue(account, destinationAmount);

        // 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
        destinationSynth.triggerTokenFallbackIfNeeded(FEE_ADDRESS, account, destinationAmount);
    }

    /**
    * @notice Send the rewards to claiming address - will be locked in rewardEscrow.
    * @param account The address to send the fees to.
    * @param snxAmount The amount of SNX.
    */
    function _payRewards(address account, uint snxAmount)
        internal
        notFeeAddress(account)
    {
        require(account != address(0), "Account can't be 0");
        require(account != address(this), "Can't send rewards to fee pool");
        require(account != address(proxy), "Can't send rewards to proxy");
        require(account != address(synthetix), "Can't send rewards to synthetix");

        // Record vesting entry for claiming address and amount
        // SNX already minted to rewardEscrow balance
        rewardEscrow.appendVestingEntry(account, snxAmount);
    }

    /**
     * @notice Calculate the Fee charged on top of a value being sent
     * @return Return the fee charged
     */
    function transferFeeIncurred(uint value)
        public
        view
        returns (uint)
    {
        return value.multiplyDecimal(transferFeeRate);

        // Transfers less than the reciprocal of transferFeeRate should be completely eaten up by fees.
        // This is on the basis that transfers less than this value will result in a nil fee.
        // Probably too insignificant to worry about, but the following code will achieve it.
        //      if (fee == 0 && transferFeeRate != 0) {
        //          return _value;
        //      }
        //      return fee;
    }

    /**
     * @notice The value that you would need to send so that the recipient receives
     * a specified value.
     * @param value The value you want the recipient to receive
     */
    function transferredAmountToReceive(uint value)
        external
        view
        returns (uint)
    {
        return value.add(transferFeeIncurred(value));
    }

    /**
     * @notice The amount the recipient will receive if you send a certain number of tokens.
     * @param value The amount of tokens you intend to send.
     */
    function amountReceivedFromTransfer(uint value)
        external
        view
        returns (uint)
    {
        return value.divideDecimal(transferFeeRate.add(SafeDecimalMath.unit()));
    }

    /**
     * @notice Calculate the fee charged on top of a value being sent via an exchange
     * @return Return the fee charged
     */
    function exchangeFeeIncurred(uint value)
        public
        view
        returns (uint)
    {
        return value.multiplyDecimal(exchangeFeeRate);

        // Exchanges less than the reciprocal of exchangeFeeRate should be completely eaten up by fees.
        // This is on the basis that exchanges less than this value will result in a nil fee.
        // Probably too insignificant to worry about, but the following code will achieve it.
        //      if (fee == 0 && exchangeFeeRate != 0) {
        //          return _value;
        //      }
        //      return fee;
    }

    /**
     * @notice The value that you would need to get after currency exchange so that the recipient receives
     * a specified value.
     * @param value The value you want the recipient to receive
     */
    function exchangedAmountToReceive(uint value)
        external
        view
        returns (uint)
    {
        return value.add(exchangeFeeIncurred(value));
    }

    /**
     * @notice The amount the recipient will receive if you are performing an exchange and the
     * destination currency will be worth a certain number of tokens.
     * @param value The amount of destination currency tokens they received after the exchange.
     */
    function amountReceivedFromExchange(uint value)
        external
        view
        returns (uint)
    {
        return value.multiplyDecimal(SafeDecimalMath.unit().sub(exchangeFeeRate));
    }

    /**
     * @notice The total fees available in the system to be withdrawn, priced in currencyKey currency
     * @param currencyKey The currency you want to price the fees in
     */
    function totalFeesAvailable(bytes4 currencyKey)
        external
        view
        returns (uint)
    {
        uint totalFees = 0;

        // Fees in fee period [0] are not yet available for withdrawal
        for (uint i = 1; i < FEE_PERIOD_LENGTH; i++) {
            totalFees = totalFees.add(recentFeePeriods[i].feesToDistribute);
            totalFees = totalFees.sub(recentFeePeriods[i].feesClaimed);
        }

        return synthetix.effectiveValue("XDR", totalFees, currencyKey);
    }

    /**
     * @notice The total SNX rewards available in the system to be withdrawn
     */
    function totalRewardsAvailable()
        external
        view
        returns (uint)
    {
        uint totalRewards = 0;

        // Rewards in fee period [0] are not yet available for withdrawal
        for (uint i = 1; i < FEE_PERIOD_LENGTH; i++) {
            totalRewards = totalRewards.add(recentFeePeriods[i].rewardsToDistribute);
            totalRewards = totalRewards.sub(recentFeePeriods[i].rewardsClaimed);
        }

        return totalRewards;
    }

    /**
     * @notice The fees available to be withdrawn by a specific account, priced in currencyKey currency
     * @dev Returns two amounts, one for fees and one for SNX rewards
     * @param currencyKey The currency you want to price the fees in
     */
    function feesAvailable(address account, bytes4 currencyKey)
        public
        view
        returns (uint, uint)
    {
        // Add up the fees
        uint[2][FEE_PERIOD_LENGTH] memory userFees = feesByPeriod(account);

        uint totalFees = 0;
        uint totalRewards = 0;

        // Fees & Rewards in fee period [0] are not yet available for withdrawal
        for (uint i = 1; i < FEE_PERIOD_LENGTH; i++) {
            totalFees = totalFees.add(userFees[i][0]);
            totalRewards = totalRewards.add(userFees[i][1]);
        }

        // And convert totalFees to their desired currency
        // Return totalRewards as is in SNX amount
        return (
            synthetix.effectiveValue("XDR", totalFees, currencyKey),
            totalRewards
        );
    }

    /**
     * @notice Check if a particular address is able to claim fees right now
     * @param account The address you want to query for
     */
    function feesClaimable(address account)
        public
        view
        returns (bool)
    {
        // Threshold is calculated from ratio % above the target ratio (issuanceRatio).
        //  0  <  10%:   Claimable
        // 10% > above:  Unable to claim
        uint ratio = synthetix.collateralisationRatio(account);
        uint targetRatio = synthetix.synthetixState().issuanceRatio();

        // Claimable if collateral ratio below target ratio
        if (ratio < targetRatio) {
            return true;
        }

        // Calculate the threshold for collateral ratio before fees can't be claimed.
        uint ratio_threshold = targetRatio.multiplyDecimal(SafeDecimalMath.unit().add(TARGET_THRESHOLD));

        // Not claimable if collateral ratio above threshold
        if (ratio > ratio_threshold) {
            return false;
        }

        return true;
    }

    /**
     * @notice Calculates fees by period for an account, priced in XDRs
     * @param account The address you want to query the fees for
     */
    function feesByPeriod(address account)
        public
        view
        returns (uint[2][FEE_PERIOD_LENGTH] memory results)
    {
        // What's the user's debt entry index and the debt they owe to the system at current feePeriod
        uint userOwnershipPercentage;
        uint debtEntryIndex;
        (userOwnershipPercentage, debtEntryIndex) = feePoolState.getAccountsDebtEntry(account, 0);

        // If they don't have any debt ownership and they haven't minted, they don't have any fees
        if (debtEntryIndex == 0 && userOwnershipPercentage == 0) return;

        // If there are no XDR synths, then they don't have any fees
        if (synthetix.totalIssuedSynths("XDR") == 0) return;

        // The [0] fee period is not yet ready to claim, but it is a fee period that they can have
        // fees owing for, so we need to report on it anyway.
        uint feesFromPeriod;
        uint rewardsFromPeriod;
        (feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(0, userOwnershipPercentage, debtEntryIndex);

        results[0][0] = feesFromPeriod;
        results[0][1] = rewardsFromPeriod;

        // Go through our fee periods from the oldest feePeriod[FEE_PERIOD_LENGTH - 1] and figure out what we owe them.
        // Condition checks for periods > 0
        for (uint i = FEE_PERIOD_LENGTH - 1; i > 0; i--) {
            uint next = i - 1;
            FeePeriod memory nextPeriod = recentFeePeriods[next];

            // We can skip period if no debt minted during period
            if (nextPeriod.startingDebtIndex > 0 &&
            getLastFeeWithdrawal(account) < recentFeePeriods[i].feePeriodId) {

                // We calculate a feePeriod's closingDebtIndex by looking at the next feePeriod's startingDebtIndex
                // we can use the most recent issuanceData[0] for the current feePeriod
                // else find the applicableIssuanceData for the feePeriod based on the StartingDebtIndex of the period
                uint closingDebtIndex = nextPeriod.startingDebtIndex.sub(1);

                // Gas optimisation - to reuse debtEntryIndex if found new applicable one
                // if applicable is 0,0 (none found) we keep most recent one from issuanceData[0]
                // return if userOwnershipPercentage = 0)
                (userOwnershipPercentage, debtEntryIndex) = feePoolState.applicableIssuanceData(account, closingDebtIndex);

                (feesFromPeriod, rewardsFromPeriod) = _feesAndRewardsFromPeriod(i, userOwnershipPercentage, debtEntryIndex);

                results[i][0] = feesFromPeriod;
                results[i][1] = rewardsFromPeriod;
            }
        }
    }

    /**
     * @notice ownershipPercentage is a high precision decimals uint based on
     * wallet's debtPercentage. Gives a precise amount of the feesToDistribute
     * for fees in the period. Precision factor is removed before results are
     * returned.
     */
    function _feesAndRewardsFromPeriod(uint period, uint ownershipPercentage, uint debtEntryIndex)
        internal
        returns (uint, uint)
    {
        // If it's zero, they haven't issued, and they have no fees OR rewards.
        if (ownershipPercentage == 0) return (0, 0);

        uint debtOwnershipForPeriod = ownershipPercentage;

        // If period has closed we want to calculate debtPercentage for the period
        if (period > 0) {
            uint closingDebtIndex = recentFeePeriods[period - 1].startingDebtIndex.sub(1);
            debtOwnershipForPeriod = _effectiveDebtRatioForPeriod(closingDebtIndex, ownershipPercentage, debtEntryIndex);
        }

        // Calculate their percentage of the fees / rewards in this period
        // This is a high precision integer.
        uint feesFromPeriod = recentFeePeriods[period].feesToDistribute
            .multiplyDecimal(debtOwnershipForPeriod);

        uint rewardsFromPeriod = recentFeePeriods[period].rewardsToDistribute
            .multiplyDecimal(debtOwnershipForPeriod);

        return (
            feesFromPeriod.preciseDecimalToDecimal(),
            rewardsFromPeriod.preciseDecimalToDecimal()
        );
    }

    function _effectiveDebtRatioForPeriod(uint closingDebtIndex, uint ownershipPercentage, uint debtEntryIndex)
        internal
        view
        returns (uint)
    {
        // Condition to check if debtLedger[] has value otherwise return 0
        if (closingDebtIndex > synthetixState.debtLedgerLength()) return 0;

        // Figure out their global debt percentage delta at end of fee Period.
        // This is a high precision integer.
        uint feePeriodDebtOwnership = synthetixState.debtLedger(closingDebtIndex)
            .divideDecimalRoundPrecise(synthetixState.debtLedger(debtEntryIndex))
            .multiplyDecimalRoundPrecise(ownershipPercentage);

        return feePeriodDebtOwnership;
    }

    function effectiveDebtRatioForPeriod(address account, uint period)
        external
        view
        returns (uint)
    {
        require(period != 0, "Current period is not closed yet");
        require(period < FEE_PERIOD_LENGTH, "Exceeds the FEE_PERIOD_LENGTH");

        // No debt minted during period as next period starts at 0
        if (recentFeePeriods[period - 1].startingDebtIndex == 0) return;

        uint closingDebtIndex = recentFeePeriods[period - 1].startingDebtIndex.sub(1);

        uint ownershipPercentage;
        uint debtEntryIndex;
        (ownershipPercentage, debtEntryIndex) = feePoolState.applicableIssuanceData(account, closingDebtIndex);

        // internal function will check closingDebtIndex has corresponding debtLedger entry
        return _effectiveDebtRatioForPeriod(closingDebtIndex, ownershipPercentage, debtEntryIndex);
    }

    /**
     * @notice Get the feePeriodID of the last claim this account made
     * @param _claimingAddress account to check the last fee period ID claim for
     * @return uint of the feePeriodID this account last claimed
     */
    function getLastFeeWithdrawal(address _claimingAddress)
        public
        view
        returns (uint)
    {
        return feePoolEternalStorage.getUIntValue(keccak256(abi.encodePacked(LAST_FEE_WITHDRAWAL, _claimingAddress)));
    }

    /**
    * @notice Calculate the collateral ratio before user is blocked from claiming.
    */
    function getPenaltyThresholdRatio()
        public
        view
        returns (uint)
    {
        uint targetRatio = synthetix.synthetixState().issuanceRatio();

        return targetRatio.multiplyDecimal(SafeDecimalMath.unit().add(TARGET_THRESHOLD));
    }

    /* ========== Modifiers ========== */

    /**
     * @notice Set the feePeriodID of the last claim this account made
     * @param _claimingAddress account to set the last feePeriodID claim for
     * @param _feePeriodID the feePeriodID this account claimed fees for
     */
    function _setLastFeeWithdrawal(address _claimingAddress, uint _feePeriodID)
        internal
    {
        feePoolEternalStorage.setUIntValue(keccak256(abi.encodePacked(LAST_FEE_WITHDRAWAL, _claimingAddress)), _feePeriodID);
    }

    modifier onlySynthetix
    {
        require(msg.sender == address(synthetix), "Only Synthetix Authorised");
        _;
    }

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

    /* ========== Proxy Events ========== */

    event IssuanceDebtRatioEntry(address indexed account, uint debtRatio, uint debtEntryIndex, uint feePeriodStartingDebtIndex);
    bytes32 constant ISSUANCEDEBTRATIOENTRY_SIG = keccak256("IssuanceDebtRatioEntry(address,uint256,uint256,uint256)");
    function emitIssuanceDebtRatioEntry(address account, uint debtRatio, uint debtEntryIndex, uint feePeriodStartingDebtIndex) internal {
        proxy._emit(abi.encode(debtRatio, debtEntryIndex, feePeriodStartingDebtIndex), 2, ISSUANCEDEBTRATIOENTRY_SIG, bytes32(account), 0, 0);
    }

    event TransferFeeUpdated(uint newFeeRate);
    bytes32 constant TRANSFERFEEUPDATED_SIG = keccak256("TransferFeeUpdated(uint256)");
    function emitTransferFeeUpdated(uint newFeeRate) internal {
        proxy._emit(abi.encode(newFeeRate), 1, TRANSFERFEEUPDATED_SIG, 0, 0, 0);
    }

    event ExchangeFeeUpdated(uint newFeeRate);
    bytes32 constant EXCHANGEFEEUPDATED_SIG = keccak256("ExchangeFeeUpdated(uint256)");
    function emitExchangeFeeUpdated(uint newFeeRate) internal {
        proxy._emit(abi.encode(newFeeRate), 1, EXCHANGEFEEUPDATED_SIG, 0, 0, 0);
    }

    event FeePeriodDurationUpdated(uint newFeePeriodDuration);
    bytes32 constant FEEPERIODDURATIONUPDATED_SIG = keccak256("FeePeriodDurationUpdated(uint256)");
    function emitFeePeriodDurationUpdated(uint newFeePeriodDuration) internal {
        proxy._emit(abi.encode(newFeePeriodDuration), 1, FEEPERIODDURATIONUPDATED_SIG, 0, 0, 0);
    }

    event FeePeriodClosed(uint feePeriodId);
    bytes32 constant FEEPERIODCLOSED_SIG = keccak256("FeePeriodClosed(uint256)");
    function emitFeePeriodClosed(uint feePeriodId) internal {
        proxy._emit(abi.encode(feePeriodId), 1, FEEPERIODCLOSED_SIG, 0, 0, 0);
    }

    event FeesClaimed(address account, uint xdrAmount, uint snxRewards);
    bytes32 constant FEESCLAIMED_SIG = keccak256("FeesClaimed(address,uint256,uint256)");
    function emitFeesClaimed(address account, uint xdrAmount, uint snxRewards) internal {
        proxy._emit(abi.encode(account, xdrAmount, snxRewards), 1, FEESCLAIMED_SIG, 0, 0, 0);
    }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"_feePeriodDuration","type":"uint256"}],"name":"setFeePeriodDuration","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_feePoolState","type":"address"}],"name":"setFeePoolState","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_claimingAddress","type":"address"}],"name":"getLastFeeWithdrawal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"},{"name":"period","type":"uint256"}],"name":"effectiveDebtRatioForPeriod","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"claimingForAddress","type":"address"},{"name":"currencyKey","type":"bytes4"}],"name":"claimOnBehalf","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeFeeRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"},{"name":"currencyKey","type":"bytes4"}],"name":"feesAvailable","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","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":false,"inputs":[{"name":"_rewardsAuthority","type":"address"}],"name":"setRewardsAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"}],"name":"setSelfDestructBeneficiary","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feePeriodDuration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_percent","type":"uint256"}],"name":"setTargetThreshold","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"terminateSelfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"feesByPeriod","outputs":[{"name":"results","type":"uint256[2][3]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"transferFeeRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"closeCurrentFeePeriod","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"recentFeePeriods","outputs":[{"name":"feePeriodId","type":"uint256"},{"name":"startingDebtIndex","type":"uint256"},{"name":"startTime","type":"uint256"},{"name":"feesToDistribute","type":"uint256"},{"name":"feesClaimed","type":"uint256"},{"name":"rewardsToDistribute","type":"uint256"},{"name":"rewardsClaimed","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"approveClaimOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feePoolEternalStorage","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":"_exchangeFeeRate","type":"uint256"}],"name":"setExchangeFeeRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"feesClaimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_delegates","type":"address"}],"name":"setDelegateApprovals","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"delegates","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"currencyKey","type":"bytes4"}],"name":"totalFeesAvailable","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"removeClaimOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalRewardsAvailable","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"synthetix","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAX_TRANSFER_FEE_RATE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"debtRatio","type":"uint256"},{"name":"debtEntryIndex","type":"uint256"}],"name":"appendAccountIssuanceRecord","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":"_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":"currencyKey","type":"bytes4"},{"name":"amount","type":"uint256"}],"name":"feePaid","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"TARGET_THRESHOLD","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPenaltyThresholdRatio","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"feePeriodIndex","type":"uint256"},{"name":"feePeriodId","type":"uint256"},{"name":"startingDebtIndex","type":"uint256"},{"name":"startTime","type":"uint256"},{"name":"feesToDistribute","type":"uint256"},{"name":"feesClaimed","type":"uint256"},{"name":"rewardsToDistribute","type":"uint256"},{"name":"rewardsClaimed","type":"uint256"}],"name":"importFeePeriod","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"quantity","type":"uint256"}],"name":"appendVestingEntry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"value","type":"uint256"}],"name":"exchangedAmountToReceive","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"value","type":"uint256"}],"name":"amountReceivedFromTransfer","outputs":[{"name":"","type":"uint256"}],"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":true,"inputs":[],"name":"selfDestructBeneficiary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_transferFeeRate","type":"uint256"}],"name":"setTransferFeeRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"value","type":"uint256"}],"name":"exchangeFeeIncurred","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes4"}],"name":"claimFees","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"FEE_PERIOD_LENGTH","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardsAuthority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MIN_FEE_PERIOD_DURATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"value","type":"uint256"}],"name":"transferFeeIncurred","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":"value","type":"uint256"}],"name":"amountReceivedFromExchange","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feePoolState","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"value","type":"uint256"}],"name":"transferredAmountToReceive","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"FEE_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAX_FEE_PERIOD_DURATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAX_EXCHANGE_FEE_RATE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"setRewardsToDistribute","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_synthetix","type":"address"}],"name":"setSynthetix","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_proxy","type":"address"},{"name":"_owner","type":"address"},{"name":"_synthetix","type":"address"},{"name":"_feePoolState","type":"address"},{"name":"_feePoolEternalStorage","type":"address"},{"name":"_synthetixState","type":"address"},{"name":"_rewardEscrow","type":"address"},{"name":"_rewardsAuthority","type":"address"},{"name":"_transferFeeRate","type":"uint256"},{"name":"_exchangeFeeRate","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"},{"indexed":false,"name":"debtRatio","type":"uint256"},{"indexed":false,"name":"debtEntryIndex","type":"uint256"},{"indexed":false,"name":"feePeriodStartingDebtIndex","type":"uint256"}],"name":"IssuanceDebtRatioEntry","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newFeeRate","type":"uint256"}],"name":"TransferFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newFeeRate","type":"uint256"}],"name":"ExchangeFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newFeePeriodDuration","type":"uint256"}],"name":"FeePeriodDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"feePeriodId","type":"uint256"}],"name":"FeePeriodClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"},{"indexed":false,"name":"xdrAmount","type":"uint256"},{"indexed":false,"name":"snxRewards","type":"uint256"}],"name":"FeesClaimed","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":"proxyAddress","type":"address"}],"name":"ProxyUpdated","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"}]

6080604081905262093a806026557f907af6c00000000000000000000000000000000000000000000000000000000081526064907384d626b2bb4d0f064067e4bf80fce7055d8f3e7b9063907af6c09060849060209060048186803b1580156200006857600080fd5b505af41580156200007d573d6000803e3d6000fd5b505050506040513d60208110156200009457600080fd5b5051600a02811515620000a357fe5b04602755348015620000b457600080fd5b506040516101408062005cd983398101604090815281516020830151918301516060840151608085015160a086015160c087015160e088015161010089015161012090990151969895969495939492939192909190621baf80898b8180600160a060020a03811615156200018957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b60008054600160a060020a031916600160a060020a038316908117825560408051928352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a15060028054600160a060020a038416600160a060020a0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a15050600160a060020a0381161515620002ad57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f776e6572206d757374206e6f74206265207a65726f00000000000000000000604482015290519081900360640190fd5b60068054600160a060020a038316610100810261010060a860020a03199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a15080420160078190555050600a7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156200037457600080fd5b505af415801562000389573d6000803e3d6000fd5b505050506040513d6020811015620003a057600080fd5b5051811515620003ac57fe5b048211156200041c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5472616e73666572206665652072617465206d61782065786365656465640000604482015290519081900360640190fd5b600a7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156200047f57600080fd5b505af415801562000494573d6000803e3d6000fd5b505050506040513d6020811015620004ab57600080fd5b5051811515620004b757fe5b048111156200052757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f45786368616e6765206665652072617465206d61782065786365656465640000604482015290519081900360640190fd5b60088054600160a060020a0319908116600160a060020a039a8b1617909155600f80548216988a1698909817909755600b8054881696891696909617909555600a805487169388169390931790925560098054861693871693909317909255600e80549094169190941617909155600c91909155600d55505060016011554260135561572080620005b96000396000f3006080604052600436106103165763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304c49f2c811461031b578063075d2c411461033557806307ea50cd146103565780630813071c146103895780630f5024a7146103ad5780630f9b49551461040457806310adda0e14610419578063131b0ae7146104755780631627540c1461049657806317c70de4146104b75780631c6346ec146104cc57806320714f88146104ed57806322425fa41461050e5780632cce0e54146105235780633278c9601461053b5780633314001614610550578063351bf518146105cb5780633ebc457a146105e05780633fcd2240146105f55780634180e5b51461064557806352b9f8a21461066657806353a47bb714610697578063578a791d146106ac57806358aab84a146106c45780635b292e94146106e55780636138b19e14610706578063639cd59c1461071b5780636c8bc9fe146107525780636de813f114610773578063759b52251461078857806376d752a11461079d57806379ba5097146107b257806386645274146107c75780638da5cb5b146107ee57806397107d6d146108035780639cb8a26a146108245780639cbdaeb614610839578063a3fd6d0e1461084e578063a430be6c14610888578063a461fc821461089d578063a6d5bb14146108b2578063ac834193146108c7578063b10090b8146108dc578063b5ddb9c714610909578063b6dc8e251461092d578063b7fcfa6914610945578063b8225dec1461095d578063bc67f83214610972578063bd32aa4414610993578063c58aaae6146109a8578063c894e1e5146109bd578063cc9b31c9146109d5578063cd503c0b146109ed578063cff2ddad14610a24578063d028a3f714610a4f578063d62ae39914610a64578063da46e6c414610a79578063dbd4a42214610a91578063e05bac8214610aa6578063e3082f6a14610abe578063e9d36c5614610ad3578063eb1edd6114610aeb578063ec55688914610b00578063f344da6714610b15578063fb1b4c7e1461079d578063fd1f498d14610b2a578063fec9f9da14610b42575b600080fd5b34801561032757600080fd5b50610333600435610b63565b005b34801561034157600080fd5b50610333600160a060020a0360043516610cec565b34801561036257600080fd5b50610377600160a060020a0360043516610dd3565b60408051918252519081900360200190f35b34801561039557600080fd5b50610377600160a060020a0360043516602435610f1c565b3480156103b957600080fd5b506103f0600160a060020a03600435167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19602435166110e9565b604080519115158252519081900360200190f35b34801561041057600080fd5b50610377611244565b34801561042557600080fd5b5061045c600160a060020a03600435167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff196024351661124a565b6040805192835260208301919091528051918290030190f35b34801561048157600080fd5b50610333600160a060020a03600435166113b7565b3480156104a257600080fd5b50610333600160a060020a0360043516611473565b3480156104c357600080fd5b50610377611561565b3480156104d857600080fd5b50610333600160a060020a0360043516611567565b3480156104f957600080fd5b50610333600160a060020a036004351661164e565b34801561051a57600080fd5b506103776117b3565b34801561052f57600080fd5b506103336004356117b9565b34801561054757600080fd5b5061033361196f565b34801561055c57600080fd5b50610571600160a060020a0360043516611a36565b6040516000826003835b818410156105bb5760208402830151604080838360005b838110156105aa578181015183820152602001610592565b50505050905001926001019261057b565b9250505091505060405180910390f35b3480156105d757600080fd5b50610377611da3565b3480156105ec57600080fd5b50610333611da9565b34801561060157600080fd5b5061060d60043561214d565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b34801561065157600080fd5b50610333600160a060020a036004351661218d565b34801561067257600080fd5b5061067b612332565b60408051600160a060020a039092168252519081900360200190f35b3480156106a357600080fd5b5061067b612341565b3480156106b857600080fd5b50610333600435612350565b3480156106d057600080fd5b506103f0600160a060020a036004351661240d565b3480156106f157600080fd5b50610333600160a060020a03600435166126a2565b34801561071257600080fd5b5061067b612789565b34801561072757600080fd5b506103777bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1960043516612798565b34801561075e57600080fd5b50610333600160a060020a03600435166128e7565b34801561077f57600080fd5b50610377612a0c565b34801561079457600080fd5b5061067b612a7b565b3480156107a957600080fd5b50610377612a8a565b3480156107be57600080fd5b50610333612b25565b3480156107d357600080fd5b50610333600160a060020a0360043516602435604435612c32565b3480156107fa57600080fd5b5061067b612d48565b34801561080f57600080fd5b50610333600160a060020a0360043516612d57565b34801561083057600080fd5b50610333612e45565b34801561084557600080fd5b5061067b612ff1565b34801561085a57600080fd5b506103337bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1960043516602435613000565b34801561089457600080fd5b5061067b6131b3565b3480156108a957600080fd5b506103776131c2565b3480156108be57600080fd5b506103776131c9565b3480156108d357600080fd5b506103776131cf565b3480156108e857600080fd5b5061033360043560243560443560643560843560a43560c43560e43561337a565b34801561091557600080fd5b50610333600160a060020a0360043516602435613573565b34801561093957600080fd5b5061037760043561375f565b34801561095157600080fd5b50610377600435613780565b34801561096957600080fd5b506103f0613830565b34801561097e57600080fd5b50610333600160a060020a0360043516613839565b34801561099f57600080fd5b506103336138e6565b3480156109b457600080fd5b5061067b6139bc565b3480156109c957600080fd5b506103336004356139d0565b3480156109e157600080fd5b50610377600435613b81565b3480156109f957600080fd5b506103f07bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1960043516613b98565b348015610a3057600080fd5b50610a39613bfc565b6040805160ff9092168252519081900360200190f35b348015610a5b57600080fd5b5061067b613c01565b348015610a7057600080fd5b50610377613c10565b348015610a8557600080fd5b50610377600435613c17565b348015610a9d57600080fd5b5061067b613c2e565b348015610ab257600080fd5b50610377600435613c3d565b348015610aca57600080fd5b5061067b613ce0565b348015610adf57600080fd5b50610377600435613cef565b348015610af757600080fd5b5061067b613cfd565b348015610b0c57600080fd5b5061067b613d15565b348015610b2157600080fd5b50610377613d24565b348015610b3657600080fd5b50610333600435613d2b565b348015610b4e57600080fd5b50610333600160a060020a0360043516613dc8565b600254600160a060020a03163314801590610b895750600354600160a060020a03163314155b15610bae576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614610c1b57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b62015180811015610c7b57604080516000805160206156d5833981519152815260206004820152601f60248201527f76616c7565203c204d494e5f4645455f504552494f445f4455524154494f4e00604482015290519081900360640190fd5b624f1a00811115610cdb57604080516000805160206156d5833981519152815260206004820152601f60248201527f76616c7565203e204d41585f4645455f504552494f445f4455524154494f4e00604482015290519081900360640190fd5b6026819055610ce981613f14565b50565b600254600160a060020a03163314801590610d125750600354600160a060020a03163314155b15610d37576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614610da457604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600f805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600b54604080517f6c6173745f6665655f7769746864726177616c00000000000000000000000000602080830191909152600160a060020a038581166c010000000000000000000000000283850152835180840360340181526054909301938490528251600095919091169363bdc963d89392909182918401908083835b60208310610e705780518252601f199092019160209182019101610e51565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff88167c01000000000000000000000000000000000000000000000000000000000283526004830152925160248083019650939450929083900301905081600087803b158015610eea57600080fd5b505af1158015610efe573d6000803e3d6000fd5b505050506040513d6020811015610f1457600080fd5b505192915050565b6000808080841515610f7d57604080516000805160206156d5833981519152815260206004820181905260248201527f43757272656e7420706572696f64206973206e6f7420636c6f73656420796574604482015290519081900360640190fd5b60038510610fda57604080516000805160206156d5833981519152815260206004820152601d60248201527f4578636565647320746865204645455f504552494f445f4c454e475448000000604482015290519081900360640190fd5b6011600019860160038110610feb57fe5b600702016001015460001415611000576110e0565b61102c6001601160001988016003811061101657fe5b600702016001015461407590919063ffffffff16565b600f54604080517fd29c000a000000000000000000000000000000000000000000000000000000008152600160a060020a038a811660048301526024820185905282519497509092169263d29c000a9260448082019392918290030181600087803b15801561109a57600080fd5b505af11580156110ae573d6000803e3d6000fd5b505050506040513d60408110156110c457600080fd5b50805160209091015190925090506110dd838383614093565b93505b50505092915050565b600254600090600160a060020a031633148015906111125750600354600160a060020a03163314155b15611137576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b60105460048054604080517fe1270b6e000000000000000000000000000000000000000000000000000000008152600160a060020a0388811694820194909452918316602483015251919092169163e1270b6e9160448083019260209291908290030181600087803b1580156111ac57600080fd5b505af11580156111c0573d6000803e3d6000fd5b505050506040513d60208110156111d657600080fd5b5051151561123357604080516000805160206156d5833981519152815260206004820152601f60248201527f4e6f7420617070726f76656420746f20636c61696d206f6e20626568616c6600604482015290519081900360640190fd5b61123d8383614294565b9392505050565b600d5481565b60008061125561564d565b600080600061126388611a36565b93506000925060009150600190505b60038110156112cb5761129784826003811061128a57fe5b6020020151518490614422565b92506112c18482600381106112a857fe5b602002015160016020020151839063ffffffff61442216565b9150600101611272565b600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527f58445200000000000000000000000000000000000000000000000000000000006004820152602481018690527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff198a1660448201529051600160a060020a03909216916339d66fc0916064808201926020929091908290030181600087803b15801561137d57600080fd5b505af1158015611391573d6000803e3d6000fd5b505050506040513d60208110156113a757600080fd5b5051989197509095505050505050565b600054600160a060020a0316331461144457604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461150057604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b60018054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60055481565b600254600160a060020a0316331480159061158d5750600354600160a060020a03163314155b156115b2576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461161f57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600e805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146116db57604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038116151561174057604080516000805160206156d5833981519152815260206004820152601c60248201527f42656e6566696369617279206d757374206e6f74206265207a65726f00000000604482015290519081900360640190fd5b60068054600160a060020a03831661010081027fffffffffffffffffffffff0000000000000000000000000000000000000000ff9092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a150565b60265481565b600254600160a060020a031633148015906117df5750600354600160a060020a03163314155b15611804576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461187157604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b60008110156118cf57604080516000805160206156d5833981519152815260206004820152601c60248201527f5468726573686f6c642073686f756c6420626520706f73697469766500000000604482015290519081900360640190fd5b60647384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561193157600080fd5b505af4158015611945573d6000803e3d6000fd5b505050506040513d602081101561195b57600080fd5b5051820281151561196857fe5b0460275550565b600054600160a060020a031633146119fc57604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b600060058190556006805460ff191690556040517f6adcc7125002935e0aa31697538ebbd65cfddf20431eb6ecdcfc3e238bfd082c9190a1565b611a3e61564d565b600080600080600080611a4f61567b565b600f54604080517fb326f84e000000000000000000000000000000000000000000000000000000008152600160a060020a038c8116600483015260006024830181905283519094919091169263b326f84e926044808201939182900301818787803b158015611abd57600080fd5b505af1158015611ad1573d6000803e3d6000fd5b505050506040513d6040811015611ae757600080fd5b508051602090910151909850965086158015611b01575087155b15611b0b57611d96565b600854604080517f403dca550000000000000000000000000000000000000000000000000000000081527f584452000000000000000000000000000000000000000000000000000000000060048201529051600160a060020a039092169163403dca55916024808201926020929091908290030181600087803b158015611b9157600080fd5b505af1158015611ba5573d6000803e3d6000fd5b505050506040513d6020811015611bbb57600080fd5b50511515611bc857611d96565b611bd460008989614434565b8a518290528a516020018190529096509450600293505b6000841115611d96576000198401925060118360038110611c0857fe5b6007020160e06040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050915060008260200151118015611c8c575060118460038110611c7c57fe5b6007020154611c8a8b610dd3565b105b15611d8a576020820151611ca790600163ffffffff61407516565b600f54604080517fd29c000a000000000000000000000000000000000000000000000000000000008152600160a060020a038e811660048301526024820185905282519495509092169263d29c000a9260448082019392918290030181600087803b158015611d1557600080fd5b505af1158015611d29573d6000803e3d6000fd5b505050506040513d6040811015611d3f57600080fd5b5080516020909101519098509650611d58848989614434565b909650945085898560038110611d6a57fe5b60200201515284898560038110611d7d57fe5b6020020151600160200201525b60001990930192611beb565b5050505050505050919050565b600c5481565b611db161567b565b611db961567b565b602654601354600091829142919091031015611e2457604080516000805160206156d5833981519152815260206004820152601d60248201527f546f6f206561726c7920746f20636c6f73652066656520706572696f64000000604482015290519081900360640190fd5b6040805160e080820183526018548252601954602080840191909152601a5483850152601b546060808501918252601c54608080870191909152601d5460a080880191909152601e5460c08089019190915288519687018952601f54875285549587019590955260215497860197909752602254918501829052602354908501819052602454968501969096526025549284019290925251929750909550611ee292611ed6919063ffffffff61407516565b9063ffffffff61442216565b601b5560a08085015160c085015191850151611f0892611ed6919063ffffffff61407516565b601d55600191505b600382101561207457506001810160118260038110611f2b57fe5b600702015460118260038110611f3d57fe5b600702015560118260038110611f4f57fe5b6007020160010154601182600381101515611f6657fe5b6007020160010181905550601182600381101515611f8057fe5b6007020160020154601182600381101515611f9757fe5b6007020160020181905550601182600381101515611fb157fe5b6007020160030154601182600381101515611fc857fe5b6007020160030181905550601182600381101515611fe257fe5b6007020160040154601182600381101515611ff957fe5b600702016004018190555060118260038110151561201357fe5b600702016005015460118260038110151561202a57fe5b600702016005018190555060118260038110151561204457fe5b600702016006015460118260038110151561205b57fe5b6007020160060181905550818060019003925050611f10565b60006011819055601281905560138190556014819055601581905560168190556017556018546120a5906001614422565b601155600954604080517fcd92eba90000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163cd92eba9916004808201926020929091908290030181600087803b15801561210857600080fd5b505af115801561211c573d6000803e3d6000fd5b505050506040513d602081101561213257600080fd5b505160125542601355601854612147906144f5565b50505050565b6011816003811061215a57fe5b60070201805460018201546002830154600384015460048501546005860154600690960154949650929491939092919087565b600254600160a060020a031633148015906121b35750600354600160a060020a03163314155b156121d8576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b601054600160a060020a0316151561223f57604080516000805160206156d5833981519152815260206004820152601a60248201527f44656c65676174657320436f6e7472616374206d697373696e67000000000000604482015290519081900360640190fd5b600160a060020a03811615156122a457604080516000805160206156d5833981519152815260206004820152601c60248201527f43616e27742064656c656761746520746f206164647265737328302900000000604482015290519081900360640190fd5b60105460048054604080517fb3c12354000000000000000000000000000000000000000000000000000000008152600160a060020a039283169381019390935284821660248401525192169163b3c123549160448082019260009290919082900301818387803b15801561231757600080fd5b505af115801561232b573d6000803e3d6000fd5b5050505050565b600b54600160a060020a031681565b600154600160a060020a031681565b600254600160a060020a031633148015906123765750600354600160a060020a03163314155b1561239b576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461240857604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600d55565b600854604080517fa311c7c2000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301529151600093849384938493919092169163a311c7c291602480830192602092919082900301818787803b15801561247d57600080fd5b505af1158015612491573d6000803e3d6000fd5b505050506040513d60208110156124a757600080fd5b5051600854604080517fdbd4a4220000000000000000000000000000000000000000000000000000000081529051929550600160a060020a039091169163dbd4a422916004808201926020929091908290030181600087803b15801561250c57600080fd5b505af1158015612520573d6000803e3d6000fd5b505050506040513d602081101561253657600080fd5b5051604080517fb410a0340000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b15801561259557600080fd5b505af11580156125a9573d6000803e3d6000fd5b505050506040513d60208110156125bf57600080fd5b50519150818310156125d4576001935061269a565b6126826126756027547384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561263d57600080fd5b505af4158015612651573d6000803e3d6000fd5b505050506040513d602081101561266757600080fd5b50519063ffffffff61442216565b839063ffffffff6145de16565b905080831115612695576000935061269a565b600193505b505050919050565b600254600160a060020a031633148015906126c85750600354600160a060020a03163314155b156126ed576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461275a57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b6010805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b601054600160a060020a031681565b60008060015b6003811015612801576127ce601182600381106127b757fe5b60070201600301548361442290919063ffffffff16565b91506127f7601182600381106127e057fe5b60070201600401548361407590919063ffffffff16565b915060010161279e565b600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527f58445200000000000000000000000000000000000000000000000000000000006004820152602481018590527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19871660448201529051600160a060020a03909216916339d66fc0916064808201926020929091908290030181600087803b1580156128b357600080fd5b505af11580156128c7573d6000803e3d6000fd5b505050506040513d60208110156128dd57600080fd5b5051949350505050565b600254600160a060020a0316331480159061290d5750600354600160a060020a03163314155b15612932576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b601054600160a060020a0316151561299957604080516000805160206156d5833981519152815260206004820152601a60248201527f44656c65676174657320436f6e7472616374206d697373696e67000000000000604482015290519081900360640190fd5b60105460048054604080517f5f0736a1000000000000000000000000000000000000000000000000000000008152600160a060020a0392831693810193909352848216602484015251921691635f0736a19160448082019260009290919082900301818387803b15801561231757600080fd5b60008060015b6003811015612a7557612a4260118260038110612a2b57fe5b60070201600501548361442290919063ffffffff16565b9150612a6b60118260038110612a5457fe5b60070201600601548361407590919063ffffffff16565b9150600101612a12565b50919050565b600854600160a060020a031681565b600a7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015612aec57600080fd5b505af4158015612b00573d6000803e3d6000fd5b505050506040513d6020811015612b1657600080fd5b5051811515612b2157fe5b0481565b600154600160a060020a03163314612bb257604080516000805160206156d5833981519152815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e6572736869700000000000000000000000606482015290519081900360840190fd5b60005460015460408051600160a060020a03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a1600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600854600160a060020a03163314612c9957604080516000805160206156d5833981519152815260206004820152601960248201527f4f6e6c792053796e74686574697820417574686f726973656400000000000000604482015290519081900360640190fd5b600f54601254604080517f94e1a448000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015260248201879052604482018690526064820193909352905191909216916394e1a44891608480830192600092919082900301818387803b158015612d1957600080fd5b505af1158015612d2d573d6000803e3d6000fd5b5050601254612d4392508591508490849061460a565b505050565b600054600160a060020a031681565b600054600160a060020a03163314612de457604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b60028054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a150565b60008054600160a060020a03163314612ed357604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b60065460ff161515612f3457604080516000805160206156d5833981519152815260206004820152601f60248201527f53656c66204465737472756374206e6f742079657420696e6974696174656400604482015290519081900360640190fd5b426224ea0060055401101515612f9957604080516000805160206156d5833981519152815260206004820152601b60248201527f53656c662064657374727563742064656c6179206e6f74206d65740000000000604482015290519081900360640190fd5b5060065460408051600160a060020a0361010090930492909216808352905190917f8a09e1677ced846cb537dc2b172043bd05a1a81ad7e0033a7ef8ba762df990b7919081900360200190a180600160a060020a0316ff5b600354600160a060020a031681565b600854600090600160a060020a0316331461306a57604080516000805160206156d5833981519152815260206004820152601960248201527f4f6e6c792053796e74686574697820417574686f726973656400000000000000604482015290519081900360640190fd5b7f58445200000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1984161461319557600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1986166004820152602481018590527f584452000000000000000000000000000000000000000000000000000000000060448201529051600160a060020a03909216916339d66fc0916064808201926020929091908290030181600087803b15801561316257600080fd5b505af1158015613176573d6000803e3d6000fd5b505050506040513d602081101561318c57600080fd5b50519050613198565b50805b6014546131ab908263ffffffff61442216565b601455505050565b600a54600160a060020a031681565b6224ea0081565b60275481565b600080600860009054906101000a9004600160a060020a0316600160a060020a031663dbd4a4226040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561323e57600080fd5b505af1158015613252573d6000803e3d6000fd5b505050506040513d602081101561326857600080fd5b5051604080517fb410a0340000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b1580156132c757600080fd5b505af11580156132db573d6000803e3d6000fd5b505050506040513d60208110156132f157600080fd5b5051602754604080517f907af6c000000000000000000000000000000000000000000000000000000000815290519293506133749261336792917384d626b2bb4d0f064067e4bf80fce7055d8f3e7b9163907af6c091600480820192602092909190829003018186803b15801561263d57600080fd5b829063ffffffff6145de16565b91505090565b600254600160a060020a031633148015906133a05750600354600160a060020a03163314155b156133c5576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461343257604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b60075442106134b657604080516000805160206156d5833981519152815260206004820152602960248201527f43616e206f6e6c7920706572666f726d207468697320616374696f6e2064757260448201527f696e672073657475700000000000000000000000000000000000000000000000606482015290519081900360840190fd5b86601189600381106134c457fe5b600702015585601189600381106134d757fe5b6007020160010181905550846011896003811015156134f257fe5b60070201600201819055508360118960038110151561350d57fe5b60070201600301819055508260118960038110151561352857fe5b60070201600401819055508160118960038110151561354357fe5b60070201600501819055508060118960038110151561355e57fe5b60070201600601819055505050505050505050565b600254600160a060020a031633148015906135995750600354600160a060020a03163314155b156135be576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461362b57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b60085460048054600a54604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0393841694810194909452908216602484015260448301859052519216916323b872dd916064808201926020929091908290030181600087803b1580156136a957600080fd5b505af11580156136bd573d6000803e3d6000fd5b505050506040513d60208110156136d357600080fd5b5050600a54604080517fb5ddb9c7000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163b5ddb9c791604480830192600092919082900301818387803b15801561374357600080fd5b505af1158015613757573d6000803e3d6000fd5b505050505050565b600061377a61376d83613b81565b839063ffffffff61442216565b92915050565b600061377a6138237384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156137e857600080fd5b505af41580156137fc573d6000803e3d6000fd5b505050506040513d602081101561381257600080fd5b5051600c549063ffffffff61442216565b839063ffffffff6147a116565b60065460ff1681565b600254600160a060020a031633148061385c5750600354600160a060020a031633145b15156138b757604080516000805160206156d5833981519152815260206004820152601760248201527f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000604482015290519081900360640190fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461397357604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b426005556006805460ff19166001179055604080516224ea00815290517fcbd94ca75b8dc45c9d80c77e851670e78843c0d75180cb81db3e2158228fa9a69181900360200190a1565b6006546101009004600160a060020a031681565b600254600160a060020a031633148015906139f65750600354600160a060020a03163314155b15613a1b576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614613a8857604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600a7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015613aea57600080fd5b505af4158015613afe573d6000803e3d6000fd5b505050506040513d6020811015613b1457600080fd5b5051811515613b1f57fe5b04811115613b7c57604080516000805160206156d5833981519152815260206004820152601e60248201527f5472616e73666572206665652072617465206d61782065786365656465640000604482015290519081900360640190fd5b600c55565b600061377a600d54836145de90919063ffffffff16565b600254600090600160a060020a03163314801590613bc15750600354600160a060020a03163314155b15613be6576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b60045461377a90600160a060020a031683614294565b600381565b600e54600160a060020a031681565b6201518081565b600061377a600c54836145de90919063ffffffff16565b600954600160a060020a031681565b600061377a612675600d547384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015613ca857600080fd5b505af4158015613cbc573d6000803e3d6000fd5b505050506040513d6020811015613cd257600080fd5b50519063ffffffff61407516565b600f54600160a060020a031681565b600061377a61376d83613c17565b73feefeefeefeefeefeefeefeefeefeefeefeefeef81565b600254600160a060020a031681565b624f1a0081565b600e54600454600160a060020a0390811691161480613d545750600e54600160a060020a031633145b1515613daf57604080516000805160206156d5833981519152815260206004820152601e60248201527f43616c6c6572206973206e6f742072657761726473417574686f726974790000604482015290519081900360640190fd5b601654613dc2908263ffffffff61442216565b60165550565b600254600160a060020a03163314801590613dee5750600354600160a060020a03163314155b15613e13576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614613e8057604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600160a060020a0381161515613ee557604080516000805160206156d5833981519152815260206004820152601e60248201527f4e65772053796e746865746978206d757374206265206e6f6e2d7a65726f0000604482015290519081900360640190fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6002546040805160208082018590528251808303820181528284018085527f466565506572696f644475726174696f6e557064617465642875696e7432353690527f2900000000000000000000000000000000000000000000000000000000000000606084015292519182900360610182207f907dff97000000000000000000000000000000000000000000000000000000008352600160248401819052604484018290526000606485018190526084850181905260a4850181905260c060048601908152865160c48701528651600160a060020a039098169763907dff979796939592938493849392839260e401918a0190808383885b8381101561402457818101518382015260200161400c565b50505050905090810190601f1680156140515780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561231757600080fd5b6000808383111561408557600080fd5b5050808203805b5092915050565b600080600960009054906101000a9004600160a060020a0316600160a060020a031663cd92eba96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561410257600080fd5b505af1158015614116573d6000803e3d6000fd5b505050506040513d602081101561412c57600080fd5b505185111561413e576000915061428c565b600954604080517f08d95cd500000000000000000000000000000000000000000000000000000000815260048101869052905161428692879261427a92600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b1580156141af57600080fd5b505af11580156141c3573d6000803e3d6000fd5b505050506040513d60208110156141d957600080fd5b5051600954604080517f08d95cd5000000000000000000000000000000000000000000000000000000008152600481018c90529051600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b15801561424257600080fd5b505af1158015614256573d6000803e3d6000fd5b505050506040513d602081101561426c57600080fd5b50519063ffffffff6147cb16565b9063ffffffff6147e416565b90508091505b509392505050565b60008060008060006142a58761240d565b151561430057604080516000805160206156d5833981519152815260206004820152601f60248201527f432d526174696f2062656c6f772070656e616c7479207468726573686f6c6400604482015290519081900360640190fd5b61432a877f584452000000000000000000000000000000000000000000000000000000000061124a565b9092509050600082118061433e5750600081115b15156143bf57604080516000805160206156d5833981519152815260206004820152602481018290527f4e6f2066656573206f72207265776172647320617661696c61626c6520666f7260448201527f20706572696f642c206f72206665657320616c726561647920636c61696d6564606482015290519081900360840190fd5b6018546143cd9088906147fd565b60008211156143ec576143df82614919565b92506143ec878488614a2b565b600081111561440a576143fe81615052565b935061440a8785615156565b6144158784866153fd565b5060019695505050505050565b60008282018381101561123d57600080fd5b6000808080808087151561444e57600095508594506144e9565b879350600089111561448057614470600160116000198c016003811061101657fe5b925061447d838989614093565b93505b6144a78460118b6003811061449157fe5b60070201600301546145de90919063ffffffff16565b91506144d08460118b600381106144ba57fe5b60070201600501546145de90919063ffffffff16565b90506144db82615575565b6144e482615575565b955095505b50505050935093915050565b6002546040805160208082018590528251808303820181528284018085527f466565506572696f64436c6f7365642875696e74323536290000000000000000905292519182900360580182207f907dff97000000000000000000000000000000000000000000000000000000008352600160248401819052604484018290526000606485018190526084850181905260a4850181905260c060048601908152865160c48701528651600160a060020a039098169763907dff979796939592938493849392839260e401918a0190808383888381101561402457818101518382015260200161400c565b6000670de0b6b3a76400006145f9848463ffffffff61559716565b81151561460257fe5b049392505050565b60028054604080516020808201889052818301879052606080830187905283518084039091018152608083018085527f49737375616e636544656274526174696f456e74727928616464726573732c7590527f696e743235362c75696e743235362c75696e743235362900000000000000000060a084015292519182900360b70182207f907dff970000000000000000000000000000000000000000000000000000000083526024830186905260448301819052600160a060020a038a81166064850181905260006084860181905260a4860181905260c060048701908152875160c48801528751939098169863907dff9798909694959294919384939192839260e490910191908a0190808383885b8381101561473257818101518382015260200161471a565b50505050905090810190601f16801561475f5780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561478357600080fd5b505af1158015614797573d6000803e3d6000fd5b5050505050505050565b600061123d826147bf85670de0b6b3a764000063ffffffff61559716565b9063ffffffff6155c516565b600061123d83836b033b2e3c9fd0803ce80000006155e8565b600061123d83836b033b2e3c9fd0803ce8000000615620565b600b54604080517f6c6173745f6665655f7769746864726177616c00000000000000000000000000602080830191909152600160a060020a038681166c010000000000000000000000000283850152835180840360340181526054909301938490528251941693633562fd2093918291908401908083835b602083106148945780518252601f199092019160209182019101614875565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff87167c0100000000000000000000000000000000000000000000000000000000028252600482015260248101889052915160448084019550600094509092839003019050818387803b15801561374357600080fd5b60008181600281805b6003831015614a1d576149686011846003811061493b57fe5b600702016004015460118560038110151561495257fe5b600702016003015461407590919063ffffffff16565b91506000821115614a11578482106149805784614982565b815b90506149ab816011856003811061499557fe5b600702016004015461442290919063ffffffff16565b601184600381106149b857fe5b60070201600401819055506149d6818661407590919063ffffffff16565b94506149e8848263ffffffff61442216565b93508415156149f957839550614a21565b82158015614a075750600085115b15614a1157600094505b60001990920191614922565b8395505b5050505050919050565b6000808085600160a060020a03811673feefeefeefeefeefeefeefeefeefeefeefeefeef1415614aaa57604080516000805160206156d5833981519152815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b600160a060020a0387161515614b0f57604080516000805160206156d5833981519152815260206004820152601260248201527f4163636f756e742063616e277420626520300000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038716301415614b7557604080516000805160206156d5833981519152815260206004820152601b60248201527f43616e27742073656e64206665657320746f2066656520706f6f6c0000000000604482015290519081900360640190fd5b600254600160a060020a0388811691161415614be057604080516000805160206156d5833981519152815260206004820152601860248201527f43616e27742073656e64206665657320746f2070726f78790000000000000000604482015290519081900360640190fd5b600854600160a060020a0388811691161415614c4b57604080516000805160206156d5833981519152815260206004820152601c60248201527f43616e27742073656e64206665657320746f2073796e74686574697800000000604482015290519081900360640190fd5b600854604080517f502b8bda0000000000000000000000000000000000000000000000000000000081527f584452000000000000000000000000000000000000000000000000000000000060048201529051600160a060020a039092169163502b8bda916024808201926020929091908290030181600087803b158015614cd157600080fd5b505af1158015614ce5573d6000803e3d6000fd5b505050506040513d6020811015614cfb57600080fd5b5051600854604080517f502b8bda0000000000000000000000000000000000000000000000000000000081527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19891660048201529051929650600160a060020a039091169163502b8bda916024808201926020929091908290030181600087803b158015614d8557600080fd5b505af1158015614d99573d6000803e3d6000fd5b505050506040513d6020811015614daf57600080fd5b5051604080517f9dc29fac00000000000000000000000000000000000000000000000000000000815273feefeefeefeefeefeefeefeefeefeefeefeefeef6004820152602481018990529051919450600160a060020a03861691639dc29fac9160448082019260009290919082900301818387803b158015614e3057600080fd5b505af1158015614e44573d6000803e3d6000fd5b5050600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527f58445200000000000000000000000000000000000000000000000000000000006004820152602481018b90527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff198a1660448201529051600160a060020a0390921693506339d66fc092506064808201926020929091908290030181600087803b158015614efa57600080fd5b505af1158015614f0e573d6000803e3d6000fd5b505050506040513d6020811015614f2457600080fd5b5051604080517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038a811660048301526024820184905291519294509085169163867904b49160448082019260009290919082900301818387803b158015614f9457600080fd5b505af1158015614fa8573d6000803e3d6000fd5b5050604080517feb6ecc0300000000000000000000000000000000000000000000000000000000815273feefeefeefeefeefeefeefeefeefeefeefeefeef6004820152600160a060020a038b81166024830152604482018790529151918716935063eb6ecc03925060648082019260009290919082900301818387803b15801561503157600080fd5b505af1158015615045573d6000803e3d6000fd5b5050505050505050505050565b60008181600281805b6003831015614a1d576150a16011846003811061507457fe5b600702016006015460118560038110151561508b57fe5b600702016005015461407590919063ffffffff16565b9150600082111561514a578482106150b957846150bb565b815b90506150e481601185600381106150ce57fe5b600702016006015461442290919063ffffffff16565b601184600381106150f157fe5b600702016006018190555061510f818661407590919063ffffffff16565b9450615121848263ffffffff61442216565b935084151561513257839550614a21565b821580156151405750600085115b1561514a57600094505b6000199092019161505b565b81600160a060020a03811673feefeefeefeefeefeefeefeefeefeefeefeefeef14156151d157604080516000805160206156d5833981519152815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b600160a060020a038316151561523657604080516000805160206156d5833981519152815260206004820152601260248201527f4163636f756e742063616e277420626520300000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831630141561529c57604080516000805160206156d5833981519152815260206004820152601e60248201527f43616e27742073656e64207265776172647320746f2066656520706f6f6c0000604482015290519081900360640190fd5b600254600160a060020a038481169116141561530757604080516000805160206156d5833981519152815260206004820152601b60248201527f43616e27742073656e64207265776172647320746f2070726f78790000000000604482015290519081900360640190fd5b600854600160a060020a038481169116141561537257604080516000805160206156d5833981519152815260206004820152601f60248201527f43616e27742073656e64207265776172647320746f2073796e74686574697800604482015290519081900360640190fd5b600a54604080517fb5ddb9c7000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018690529151919092169163b5ddb9c791604480830192600092919082900301818387803b1580156153e057600080fd5b505af11580156153f4573d6000803e3d6000fd5b50505050505050565b60025460408051600160a060020a03868116602080840191909152828401879052606080840187905284518085039091018152608084018086527f46656573436c61696d656428616464726573732c75696e743235362c75696e7490527f323536290000000000000000000000000000000000000000000000000000000060a0850152935160a493819003840181207f907dff97000000000000000000000000000000000000000000000000000000008252600160248301819052604483018290526000606484018190526084840181905295830186905260c060048401908152875160c48501528751959098169763907dff97979691959294919384938493839260e40191908a0190808383885b8381101561552457818101518382015260200161550c565b50505050905090810190601f1680156155515780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b1580156153e057600080fd5b60006305f5e10082046005600a82061061558d57600a015b600a900492915050565b6000808315156155aa576000915061408c565b508282028284828115156155ba57fe5b041461123d57600080fd5b6000808083116155d457600080fd5b82848115156155df57fe5b04949350505050565b600080615602846147bf87600a870263ffffffff61559716565b90506005600a825b061061561457600a015b600a9004949350505050565b600080600a8304615637868663ffffffff61559716565b81151561564057fe5b0490506005600a8261560a565b60c0604051908101604052806003905b6156656156b9565b81526020019060019003908161565d5790505090565b60e060405190810160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60408051808201825290600290829080388339509192915050560008c379a000000000000000000000000000000000000000000000000000000000a165627a7a723058209f722499b8c471c72044deefbb62f60a0f851d8b6b6a3fe0a1db889e06bb9bf10029000000000000000000000000b440dd674e1243644791a4adfe3a2abb0a92d309000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f617688200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9dfff5fa5605fd94f8b7927b892f2b57391e8bb0000000000000000000000004b9ca5607f1ff8019c1c6a3c2f0cc8de622d5b82000000000000000000000000b671f2210b1f6621a2607ea63e6b2dc3e2464d1f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa87bee538000

Deployed Bytecode

0x6080604052600436106103165763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304c49f2c811461031b578063075d2c411461033557806307ea50cd146103565780630813071c146103895780630f5024a7146103ad5780630f9b49551461040457806310adda0e14610419578063131b0ae7146104755780631627540c1461049657806317c70de4146104b75780631c6346ec146104cc57806320714f88146104ed57806322425fa41461050e5780632cce0e54146105235780633278c9601461053b5780633314001614610550578063351bf518146105cb5780633ebc457a146105e05780633fcd2240146105f55780634180e5b51461064557806352b9f8a21461066657806353a47bb714610697578063578a791d146106ac57806358aab84a146106c45780635b292e94146106e55780636138b19e14610706578063639cd59c1461071b5780636c8bc9fe146107525780636de813f114610773578063759b52251461078857806376d752a11461079d57806379ba5097146107b257806386645274146107c75780638da5cb5b146107ee57806397107d6d146108035780639cb8a26a146108245780639cbdaeb614610839578063a3fd6d0e1461084e578063a430be6c14610888578063a461fc821461089d578063a6d5bb14146108b2578063ac834193146108c7578063b10090b8146108dc578063b5ddb9c714610909578063b6dc8e251461092d578063b7fcfa6914610945578063b8225dec1461095d578063bc67f83214610972578063bd32aa4414610993578063c58aaae6146109a8578063c894e1e5146109bd578063cc9b31c9146109d5578063cd503c0b146109ed578063cff2ddad14610a24578063d028a3f714610a4f578063d62ae39914610a64578063da46e6c414610a79578063dbd4a42214610a91578063e05bac8214610aa6578063e3082f6a14610abe578063e9d36c5614610ad3578063eb1edd6114610aeb578063ec55688914610b00578063f344da6714610b15578063fb1b4c7e1461079d578063fd1f498d14610b2a578063fec9f9da14610b42575b600080fd5b34801561032757600080fd5b50610333600435610b63565b005b34801561034157600080fd5b50610333600160a060020a0360043516610cec565b34801561036257600080fd5b50610377600160a060020a0360043516610dd3565b60408051918252519081900360200190f35b34801561039557600080fd5b50610377600160a060020a0360043516602435610f1c565b3480156103b957600080fd5b506103f0600160a060020a03600435167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19602435166110e9565b604080519115158252519081900360200190f35b34801561041057600080fd5b50610377611244565b34801561042557600080fd5b5061045c600160a060020a03600435167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff196024351661124a565b6040805192835260208301919091528051918290030190f35b34801561048157600080fd5b50610333600160a060020a03600435166113b7565b3480156104a257600080fd5b50610333600160a060020a0360043516611473565b3480156104c357600080fd5b50610377611561565b3480156104d857600080fd5b50610333600160a060020a0360043516611567565b3480156104f957600080fd5b50610333600160a060020a036004351661164e565b34801561051a57600080fd5b506103776117b3565b34801561052f57600080fd5b506103336004356117b9565b34801561054757600080fd5b5061033361196f565b34801561055c57600080fd5b50610571600160a060020a0360043516611a36565b6040516000826003835b818410156105bb5760208402830151604080838360005b838110156105aa578181015183820152602001610592565b50505050905001926001019261057b565b9250505091505060405180910390f35b3480156105d757600080fd5b50610377611da3565b3480156105ec57600080fd5b50610333611da9565b34801561060157600080fd5b5061060d60043561214d565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b34801561065157600080fd5b50610333600160a060020a036004351661218d565b34801561067257600080fd5b5061067b612332565b60408051600160a060020a039092168252519081900360200190f35b3480156106a357600080fd5b5061067b612341565b3480156106b857600080fd5b50610333600435612350565b3480156106d057600080fd5b506103f0600160a060020a036004351661240d565b3480156106f157600080fd5b50610333600160a060020a03600435166126a2565b34801561071257600080fd5b5061067b612789565b34801561072757600080fd5b506103777bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1960043516612798565b34801561075e57600080fd5b50610333600160a060020a03600435166128e7565b34801561077f57600080fd5b50610377612a0c565b34801561079457600080fd5b5061067b612a7b565b3480156107a957600080fd5b50610377612a8a565b3480156107be57600080fd5b50610333612b25565b3480156107d357600080fd5b50610333600160a060020a0360043516602435604435612c32565b3480156107fa57600080fd5b5061067b612d48565b34801561080f57600080fd5b50610333600160a060020a0360043516612d57565b34801561083057600080fd5b50610333612e45565b34801561084557600080fd5b5061067b612ff1565b34801561085a57600080fd5b506103337bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1960043516602435613000565b34801561089457600080fd5b5061067b6131b3565b3480156108a957600080fd5b506103776131c2565b3480156108be57600080fd5b506103776131c9565b3480156108d357600080fd5b506103776131cf565b3480156108e857600080fd5b5061033360043560243560443560643560843560a43560c43560e43561337a565b34801561091557600080fd5b50610333600160a060020a0360043516602435613573565b34801561093957600080fd5b5061037760043561375f565b34801561095157600080fd5b50610377600435613780565b34801561096957600080fd5b506103f0613830565b34801561097e57600080fd5b50610333600160a060020a0360043516613839565b34801561099f57600080fd5b506103336138e6565b3480156109b457600080fd5b5061067b6139bc565b3480156109c957600080fd5b506103336004356139d0565b3480156109e157600080fd5b50610377600435613b81565b3480156109f957600080fd5b506103f07bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1960043516613b98565b348015610a3057600080fd5b50610a39613bfc565b6040805160ff9092168252519081900360200190f35b348015610a5b57600080fd5b5061067b613c01565b348015610a7057600080fd5b50610377613c10565b348015610a8557600080fd5b50610377600435613c17565b348015610a9d57600080fd5b5061067b613c2e565b348015610ab257600080fd5b50610377600435613c3d565b348015610aca57600080fd5b5061067b613ce0565b348015610adf57600080fd5b50610377600435613cef565b348015610af757600080fd5b5061067b613cfd565b348015610b0c57600080fd5b5061067b613d15565b348015610b2157600080fd5b50610377613d24565b348015610b3657600080fd5b50610333600435613d2b565b348015610b4e57600080fd5b50610333600160a060020a0360043516613dc8565b600254600160a060020a03163314801590610b895750600354600160a060020a03163314155b15610bae576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614610c1b57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b62015180811015610c7b57604080516000805160206156d5833981519152815260206004820152601f60248201527f76616c7565203c204d494e5f4645455f504552494f445f4455524154494f4e00604482015290519081900360640190fd5b624f1a00811115610cdb57604080516000805160206156d5833981519152815260206004820152601f60248201527f76616c7565203e204d41585f4645455f504552494f445f4455524154494f4e00604482015290519081900360640190fd5b6026819055610ce981613f14565b50565b600254600160a060020a03163314801590610d125750600354600160a060020a03163314155b15610d37576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614610da457604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600f805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600b54604080517f6c6173745f6665655f7769746864726177616c00000000000000000000000000602080830191909152600160a060020a038581166c010000000000000000000000000283850152835180840360340181526054909301938490528251600095919091169363bdc963d89392909182918401908083835b60208310610e705780518252601f199092019160209182019101610e51565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff88167c01000000000000000000000000000000000000000000000000000000000283526004830152925160248083019650939450929083900301905081600087803b158015610eea57600080fd5b505af1158015610efe573d6000803e3d6000fd5b505050506040513d6020811015610f1457600080fd5b505192915050565b6000808080841515610f7d57604080516000805160206156d5833981519152815260206004820181905260248201527f43757272656e7420706572696f64206973206e6f7420636c6f73656420796574604482015290519081900360640190fd5b60038510610fda57604080516000805160206156d5833981519152815260206004820152601d60248201527f4578636565647320746865204645455f504552494f445f4c454e475448000000604482015290519081900360640190fd5b6011600019860160038110610feb57fe5b600702016001015460001415611000576110e0565b61102c6001601160001988016003811061101657fe5b600702016001015461407590919063ffffffff16565b600f54604080517fd29c000a000000000000000000000000000000000000000000000000000000008152600160a060020a038a811660048301526024820185905282519497509092169263d29c000a9260448082019392918290030181600087803b15801561109a57600080fd5b505af11580156110ae573d6000803e3d6000fd5b505050506040513d60408110156110c457600080fd5b50805160209091015190925090506110dd838383614093565b93505b50505092915050565b600254600090600160a060020a031633148015906111125750600354600160a060020a03163314155b15611137576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b60105460048054604080517fe1270b6e000000000000000000000000000000000000000000000000000000008152600160a060020a0388811694820194909452918316602483015251919092169163e1270b6e9160448083019260209291908290030181600087803b1580156111ac57600080fd5b505af11580156111c0573d6000803e3d6000fd5b505050506040513d60208110156111d657600080fd5b5051151561123357604080516000805160206156d5833981519152815260206004820152601f60248201527f4e6f7420617070726f76656420746f20636c61696d206f6e20626568616c6600604482015290519081900360640190fd5b61123d8383614294565b9392505050565b600d5481565b60008061125561564d565b600080600061126388611a36565b93506000925060009150600190505b60038110156112cb5761129784826003811061128a57fe5b6020020151518490614422565b92506112c18482600381106112a857fe5b602002015160016020020151839063ffffffff61442216565b9150600101611272565b600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527f58445200000000000000000000000000000000000000000000000000000000006004820152602481018690527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff198a1660448201529051600160a060020a03909216916339d66fc0916064808201926020929091908290030181600087803b15801561137d57600080fd5b505af1158015611391573d6000803e3d6000fd5b505050506040513d60208110156113a757600080fd5b5051989197509095505050505050565b600054600160a060020a0316331461144457604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461150057604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b60018054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60055481565b600254600160a060020a0316331480159061158d5750600354600160a060020a03163314155b156115b2576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461161f57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600e805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146116db57604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a038116151561174057604080516000805160206156d5833981519152815260206004820152601c60248201527f42656e6566696369617279206d757374206e6f74206265207a65726f00000000604482015290519081900360640190fd5b60068054600160a060020a03831661010081027fffffffffffffffffffffff0000000000000000000000000000000000000000ff9092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a150565b60265481565b600254600160a060020a031633148015906117df5750600354600160a060020a03163314155b15611804576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461187157604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b60008110156118cf57604080516000805160206156d5833981519152815260206004820152601c60248201527f5468726573686f6c642073686f756c6420626520706f73697469766500000000604482015290519081900360640190fd5b60647384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561193157600080fd5b505af4158015611945573d6000803e3d6000fd5b505050506040513d602081101561195b57600080fd5b5051820281151561196857fe5b0460275550565b600054600160a060020a031633146119fc57604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b600060058190556006805460ff191690556040517f6adcc7125002935e0aa31697538ebbd65cfddf20431eb6ecdcfc3e238bfd082c9190a1565b611a3e61564d565b600080600080600080611a4f61567b565b600f54604080517fb326f84e000000000000000000000000000000000000000000000000000000008152600160a060020a038c8116600483015260006024830181905283519094919091169263b326f84e926044808201939182900301818787803b158015611abd57600080fd5b505af1158015611ad1573d6000803e3d6000fd5b505050506040513d6040811015611ae757600080fd5b508051602090910151909850965086158015611b01575087155b15611b0b57611d96565b600854604080517f403dca550000000000000000000000000000000000000000000000000000000081527f584452000000000000000000000000000000000000000000000000000000000060048201529051600160a060020a039092169163403dca55916024808201926020929091908290030181600087803b158015611b9157600080fd5b505af1158015611ba5573d6000803e3d6000fd5b505050506040513d6020811015611bbb57600080fd5b50511515611bc857611d96565b611bd460008989614434565b8a518290528a516020018190529096509450600293505b6000841115611d96576000198401925060118360038110611c0857fe5b6007020160e06040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481525050915060008260200151118015611c8c575060118460038110611c7c57fe5b6007020154611c8a8b610dd3565b105b15611d8a576020820151611ca790600163ffffffff61407516565b600f54604080517fd29c000a000000000000000000000000000000000000000000000000000000008152600160a060020a038e811660048301526024820185905282519495509092169263d29c000a9260448082019392918290030181600087803b158015611d1557600080fd5b505af1158015611d29573d6000803e3d6000fd5b505050506040513d6040811015611d3f57600080fd5b5080516020909101519098509650611d58848989614434565b909650945085898560038110611d6a57fe5b60200201515284898560038110611d7d57fe5b6020020151600160200201525b60001990930192611beb565b5050505050505050919050565b600c5481565b611db161567b565b611db961567b565b602654601354600091829142919091031015611e2457604080516000805160206156d5833981519152815260206004820152601d60248201527f546f6f206561726c7920746f20636c6f73652066656520706572696f64000000604482015290519081900360640190fd5b6040805160e080820183526018548252601954602080840191909152601a5483850152601b546060808501918252601c54608080870191909152601d5460a080880191909152601e5460c08089019190915288519687018952601f54875285549587019590955260215497860197909752602254918501829052602354908501819052602454968501969096526025549284019290925251929750909550611ee292611ed6919063ffffffff61407516565b9063ffffffff61442216565b601b5560a08085015160c085015191850151611f0892611ed6919063ffffffff61407516565b601d55600191505b600382101561207457506001810160118260038110611f2b57fe5b600702015460118260038110611f3d57fe5b600702015560118260038110611f4f57fe5b6007020160010154601182600381101515611f6657fe5b6007020160010181905550601182600381101515611f8057fe5b6007020160020154601182600381101515611f9757fe5b6007020160020181905550601182600381101515611fb157fe5b6007020160030154601182600381101515611fc857fe5b6007020160030181905550601182600381101515611fe257fe5b6007020160040154601182600381101515611ff957fe5b600702016004018190555060118260038110151561201357fe5b600702016005015460118260038110151561202a57fe5b600702016005018190555060118260038110151561204457fe5b600702016006015460118260038110151561205b57fe5b6007020160060181905550818060019003925050611f10565b60006011819055601281905560138190556014819055601581905560168190556017556018546120a5906001614422565b601155600954604080517fcd92eba90000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163cd92eba9916004808201926020929091908290030181600087803b15801561210857600080fd5b505af115801561211c573d6000803e3d6000fd5b505050506040513d602081101561213257600080fd5b505160125542601355601854612147906144f5565b50505050565b6011816003811061215a57fe5b60070201805460018201546002830154600384015460048501546005860154600690960154949650929491939092919087565b600254600160a060020a031633148015906121b35750600354600160a060020a03163314155b156121d8576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b601054600160a060020a0316151561223f57604080516000805160206156d5833981519152815260206004820152601a60248201527f44656c65676174657320436f6e7472616374206d697373696e67000000000000604482015290519081900360640190fd5b600160a060020a03811615156122a457604080516000805160206156d5833981519152815260206004820152601c60248201527f43616e27742064656c656761746520746f206164647265737328302900000000604482015290519081900360640190fd5b60105460048054604080517fb3c12354000000000000000000000000000000000000000000000000000000008152600160a060020a039283169381019390935284821660248401525192169163b3c123549160448082019260009290919082900301818387803b15801561231757600080fd5b505af115801561232b573d6000803e3d6000fd5b5050505050565b600b54600160a060020a031681565b600154600160a060020a031681565b600254600160a060020a031633148015906123765750600354600160a060020a03163314155b1561239b576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461240857604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600d55565b600854604080517fa311c7c2000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301529151600093849384938493919092169163a311c7c291602480830192602092919082900301818787803b15801561247d57600080fd5b505af1158015612491573d6000803e3d6000fd5b505050506040513d60208110156124a757600080fd5b5051600854604080517fdbd4a4220000000000000000000000000000000000000000000000000000000081529051929550600160a060020a039091169163dbd4a422916004808201926020929091908290030181600087803b15801561250c57600080fd5b505af1158015612520573d6000803e3d6000fd5b505050506040513d602081101561253657600080fd5b5051604080517fb410a0340000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b15801561259557600080fd5b505af11580156125a9573d6000803e3d6000fd5b505050506040513d60208110156125bf57600080fd5b50519150818310156125d4576001935061269a565b6126826126756027547384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561263d57600080fd5b505af4158015612651573d6000803e3d6000fd5b505050506040513d602081101561266757600080fd5b50519063ffffffff61442216565b839063ffffffff6145de16565b905080831115612695576000935061269a565b600193505b505050919050565b600254600160a060020a031633148015906126c85750600354600160a060020a03163314155b156126ed576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461275a57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b6010805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b601054600160a060020a031681565b60008060015b6003811015612801576127ce601182600381106127b757fe5b60070201600301548361442290919063ffffffff16565b91506127f7601182600381106127e057fe5b60070201600401548361407590919063ffffffff16565b915060010161279e565b600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527f58445200000000000000000000000000000000000000000000000000000000006004820152602481018590527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19871660448201529051600160a060020a03909216916339d66fc0916064808201926020929091908290030181600087803b1580156128b357600080fd5b505af11580156128c7573d6000803e3d6000fd5b505050506040513d60208110156128dd57600080fd5b5051949350505050565b600254600160a060020a0316331480159061290d5750600354600160a060020a03163314155b15612932576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b601054600160a060020a0316151561299957604080516000805160206156d5833981519152815260206004820152601a60248201527f44656c65676174657320436f6e7472616374206d697373696e67000000000000604482015290519081900360640190fd5b60105460048054604080517f5f0736a1000000000000000000000000000000000000000000000000000000008152600160a060020a0392831693810193909352848216602484015251921691635f0736a19160448082019260009290919082900301818387803b15801561231757600080fd5b60008060015b6003811015612a7557612a4260118260038110612a2b57fe5b60070201600501548361442290919063ffffffff16565b9150612a6b60118260038110612a5457fe5b60070201600601548361407590919063ffffffff16565b9150600101612a12565b50919050565b600854600160a060020a031681565b600a7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015612aec57600080fd5b505af4158015612b00573d6000803e3d6000fd5b505050506040513d6020811015612b1657600080fd5b5051811515612b2157fe5b0481565b600154600160a060020a03163314612bb257604080516000805160206156d5833981519152815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e6572736869700000000000000000000000606482015290519081900360840190fd5b60005460015460408051600160a060020a03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a1600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600854600160a060020a03163314612c9957604080516000805160206156d5833981519152815260206004820152601960248201527f4f6e6c792053796e74686574697820417574686f726973656400000000000000604482015290519081900360640190fd5b600f54601254604080517f94e1a448000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015260248201879052604482018690526064820193909352905191909216916394e1a44891608480830192600092919082900301818387803b158015612d1957600080fd5b505af1158015612d2d573d6000803e3d6000fd5b5050601254612d4392508591508490849061460a565b505050565b600054600160a060020a031681565b600054600160a060020a03163314612de457604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b60028054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a150565b60008054600160a060020a03163314612ed357604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b60065460ff161515612f3457604080516000805160206156d5833981519152815260206004820152601f60248201527f53656c66204465737472756374206e6f742079657420696e6974696174656400604482015290519081900360640190fd5b426224ea0060055401101515612f9957604080516000805160206156d5833981519152815260206004820152601b60248201527f53656c662064657374727563742064656c6179206e6f74206d65740000000000604482015290519081900360640190fd5b5060065460408051600160a060020a0361010090930492909216808352905190917f8a09e1677ced846cb537dc2b172043bd05a1a81ad7e0033a7ef8ba762df990b7919081900360200190a180600160a060020a0316ff5b600354600160a060020a031681565b600854600090600160a060020a0316331461306a57604080516000805160206156d5833981519152815260206004820152601960248201527f4f6e6c792053796e74686574697820417574686f726973656400000000000000604482015290519081900360640190fd5b7f58445200000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1984161461319557600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1986166004820152602481018590527f584452000000000000000000000000000000000000000000000000000000000060448201529051600160a060020a03909216916339d66fc0916064808201926020929091908290030181600087803b15801561316257600080fd5b505af1158015613176573d6000803e3d6000fd5b505050506040513d602081101561318c57600080fd5b50519050613198565b50805b6014546131ab908263ffffffff61442216565b601455505050565b600a54600160a060020a031681565b6224ea0081565b60275481565b600080600860009054906101000a9004600160a060020a0316600160a060020a031663dbd4a4226040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561323e57600080fd5b505af1158015613252573d6000803e3d6000fd5b505050506040513d602081101561326857600080fd5b5051604080517fb410a0340000000000000000000000000000000000000000000000000000000081529051600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b1580156132c757600080fd5b505af11580156132db573d6000803e3d6000fd5b505050506040513d60208110156132f157600080fd5b5051602754604080517f907af6c000000000000000000000000000000000000000000000000000000000815290519293506133749261336792917384d626b2bb4d0f064067e4bf80fce7055d8f3e7b9163907af6c091600480820192602092909190829003018186803b15801561263d57600080fd5b829063ffffffff6145de16565b91505090565b600254600160a060020a031633148015906133a05750600354600160a060020a03163314155b156133c5576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461343257604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b60075442106134b657604080516000805160206156d5833981519152815260206004820152602960248201527f43616e206f6e6c7920706572666f726d207468697320616374696f6e2064757260448201527f696e672073657475700000000000000000000000000000000000000000000000606482015290519081900360840190fd5b86601189600381106134c457fe5b600702015585601189600381106134d757fe5b6007020160010181905550846011896003811015156134f257fe5b60070201600201819055508360118960038110151561350d57fe5b60070201600301819055508260118960038110151561352857fe5b60070201600401819055508160118960038110151561354357fe5b60070201600501819055508060118960038110151561355e57fe5b60070201600601819055505050505050505050565b600254600160a060020a031633148015906135995750600354600160a060020a03163314155b156135be576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a0390811691161461362b57604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b60085460048054600a54604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0393841694810194909452908216602484015260448301859052519216916323b872dd916064808201926020929091908290030181600087803b1580156136a957600080fd5b505af11580156136bd573d6000803e3d6000fd5b505050506040513d60208110156136d357600080fd5b5050600a54604080517fb5ddb9c7000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163b5ddb9c791604480830192600092919082900301818387803b15801561374357600080fd5b505af1158015613757573d6000803e3d6000fd5b505050505050565b600061377a61376d83613b81565b839063ffffffff61442216565b92915050565b600061377a6138237384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156137e857600080fd5b505af41580156137fc573d6000803e3d6000fd5b505050506040513d602081101561381257600080fd5b5051600c549063ffffffff61442216565b839063ffffffff6147a116565b60065460ff1681565b600254600160a060020a031633148061385c5750600354600160a060020a031633145b15156138b757604080516000805160206156d5833981519152815260206004820152601760248201527f4f6e6c79207468652070726f78792063616e2063616c6c000000000000000000604482015290519081900360640190fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461397357604080516000805160206156d5833981519152815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e0000000000000000000000000000000000606482015290519081900360840190fd5b426005556006805460ff19166001179055604080516224ea00815290517fcbd94ca75b8dc45c9d80c77e851670e78843c0d75180cb81db3e2158228fa9a69181900360200190a1565b6006546101009004600160a060020a031681565b600254600160a060020a031633148015906139f65750600354600160a060020a03163314155b15613a1b576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614613a8857604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600a7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015613aea57600080fd5b505af4158015613afe573d6000803e3d6000fd5b505050506040513d6020811015613b1457600080fd5b5051811515613b1f57fe5b04811115613b7c57604080516000805160206156d5833981519152815260206004820152601e60248201527f5472616e73666572206665652072617465206d61782065786365656465640000604482015290519081900360640190fd5b600c55565b600061377a600d54836145de90919063ffffffff16565b600254600090600160a060020a03163314801590613bc15750600354600160a060020a03163314155b15613be6576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b60045461377a90600160a060020a031683614294565b600381565b600e54600160a060020a031681565b6201518081565b600061377a600c54836145de90919063ffffffff16565b600954600160a060020a031681565b600061377a612675600d547384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015613ca857600080fd5b505af4158015613cbc573d6000803e3d6000fd5b505050506040513d6020811015613cd257600080fd5b50519063ffffffff61407516565b600f54600160a060020a031681565b600061377a61376d83613c17565b73feefeefeefeefeefeefeefeefeefeefeefeefeef81565b600254600160a060020a031681565b624f1a0081565b600e54600454600160a060020a0390811691161480613d545750600e54600160a060020a031633145b1515613daf57604080516000805160206156d5833981519152815260206004820152601e60248201527f43616c6c6572206973206e6f742072657761726473417574686f726974790000604482015290519081900360640190fd5b601654613dc2908263ffffffff61442216565b60165550565b600254600160a060020a03163314801590613dee5750600354600160a060020a03163314155b15613e13576004805473ffffffffffffffffffffffffffffffffffffffff1916331790555b600054600454600160a060020a03908116911614613e8057604080516000805160206156d5833981519152815260206004820152601360248201527f4f776e6572206f6e6c792066756e6374696f6e00000000000000000000000000604482015290519081900360640190fd5b600160a060020a0381161515613ee557604080516000805160206156d5833981519152815260206004820152601e60248201527f4e65772053796e746865746978206d757374206265206e6f6e2d7a65726f0000604482015290519081900360640190fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6002546040805160208082018590528251808303820181528284018085527f466565506572696f644475726174696f6e557064617465642875696e7432353690527f2900000000000000000000000000000000000000000000000000000000000000606084015292519182900360610182207f907dff97000000000000000000000000000000000000000000000000000000008352600160248401819052604484018290526000606485018190526084850181905260a4850181905260c060048601908152865160c48701528651600160a060020a039098169763907dff979796939592938493849392839260e401918a0190808383885b8381101561402457818101518382015260200161400c565b50505050905090810190601f1680156140515780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561231757600080fd5b6000808383111561408557600080fd5b5050808203805b5092915050565b600080600960009054906101000a9004600160a060020a0316600160a060020a031663cd92eba96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561410257600080fd5b505af1158015614116573d6000803e3d6000fd5b505050506040513d602081101561412c57600080fd5b505185111561413e576000915061428c565b600954604080517f08d95cd500000000000000000000000000000000000000000000000000000000815260048101869052905161428692879261427a92600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b1580156141af57600080fd5b505af11580156141c3573d6000803e3d6000fd5b505050506040513d60208110156141d957600080fd5b5051600954604080517f08d95cd5000000000000000000000000000000000000000000000000000000008152600481018c90529051600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b15801561424257600080fd5b505af1158015614256573d6000803e3d6000fd5b505050506040513d602081101561426c57600080fd5b50519063ffffffff6147cb16565b9063ffffffff6147e416565b90508091505b509392505050565b60008060008060006142a58761240d565b151561430057604080516000805160206156d5833981519152815260206004820152601f60248201527f432d526174696f2062656c6f772070656e616c7479207468726573686f6c6400604482015290519081900360640190fd5b61432a877f584452000000000000000000000000000000000000000000000000000000000061124a565b9092509050600082118061433e5750600081115b15156143bf57604080516000805160206156d5833981519152815260206004820152602481018290527f4e6f2066656573206f72207265776172647320617661696c61626c6520666f7260448201527f20706572696f642c206f72206665657320616c726561647920636c61696d6564606482015290519081900360840190fd5b6018546143cd9088906147fd565b60008211156143ec576143df82614919565b92506143ec878488614a2b565b600081111561440a576143fe81615052565b935061440a8785615156565b6144158784866153fd565b5060019695505050505050565b60008282018381101561123d57600080fd5b6000808080808087151561444e57600095508594506144e9565b879350600089111561448057614470600160116000198c016003811061101657fe5b925061447d838989614093565b93505b6144a78460118b6003811061449157fe5b60070201600301546145de90919063ffffffff16565b91506144d08460118b600381106144ba57fe5b60070201600501546145de90919063ffffffff16565b90506144db82615575565b6144e482615575565b955095505b50505050935093915050565b6002546040805160208082018590528251808303820181528284018085527f466565506572696f64436c6f7365642875696e74323536290000000000000000905292519182900360580182207f907dff97000000000000000000000000000000000000000000000000000000008352600160248401819052604484018290526000606485018190526084850181905260a4850181905260c060048601908152865160c48701528651600160a060020a039098169763907dff979796939592938493849392839260e401918a0190808383888381101561402457818101518382015260200161400c565b6000670de0b6b3a76400006145f9848463ffffffff61559716565b81151561460257fe5b049392505050565b60028054604080516020808201889052818301879052606080830187905283518084039091018152608083018085527f49737375616e636544656274526174696f456e74727928616464726573732c7590527f696e743235362c75696e743235362c75696e743235362900000000000000000060a084015292519182900360b70182207f907dff970000000000000000000000000000000000000000000000000000000083526024830186905260448301819052600160a060020a038a81166064850181905260006084860181905260a4860181905260c060048701908152875160c48801528751939098169863907dff9798909694959294919384939192839260e490910191908a0190808383885b8381101561473257818101518382015260200161471a565b50505050905090810190601f16801561475f5780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561478357600080fd5b505af1158015614797573d6000803e3d6000fd5b5050505050505050565b600061123d826147bf85670de0b6b3a764000063ffffffff61559716565b9063ffffffff6155c516565b600061123d83836b033b2e3c9fd0803ce80000006155e8565b600061123d83836b033b2e3c9fd0803ce8000000615620565b600b54604080517f6c6173745f6665655f7769746864726177616c00000000000000000000000000602080830191909152600160a060020a038681166c010000000000000000000000000283850152835180840360340181526054909301938490528251941693633562fd2093918291908401908083835b602083106148945780518252601f199092019160209182019101614875565b5181516020939093036101000a60001901801990911692169190911790526040805191909301819003812063ffffffff87167c0100000000000000000000000000000000000000000000000000000000028252600482015260248101889052915160448084019550600094509092839003019050818387803b15801561374357600080fd5b60008181600281805b6003831015614a1d576149686011846003811061493b57fe5b600702016004015460118560038110151561495257fe5b600702016003015461407590919063ffffffff16565b91506000821115614a11578482106149805784614982565b815b90506149ab816011856003811061499557fe5b600702016004015461442290919063ffffffff16565b601184600381106149b857fe5b60070201600401819055506149d6818661407590919063ffffffff16565b94506149e8848263ffffffff61442216565b93508415156149f957839550614a21565b82158015614a075750600085115b15614a1157600094505b60001990920191614922565b8395505b5050505050919050565b6000808085600160a060020a03811673feefeefeefeefeefeefeefeefeefeefeefeefeef1415614aaa57604080516000805160206156d5833981519152815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b600160a060020a0387161515614b0f57604080516000805160206156d5833981519152815260206004820152601260248201527f4163636f756e742063616e277420626520300000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038716301415614b7557604080516000805160206156d5833981519152815260206004820152601b60248201527f43616e27742073656e64206665657320746f2066656520706f6f6c0000000000604482015290519081900360640190fd5b600254600160a060020a0388811691161415614be057604080516000805160206156d5833981519152815260206004820152601860248201527f43616e27742073656e64206665657320746f2070726f78790000000000000000604482015290519081900360640190fd5b600854600160a060020a0388811691161415614c4b57604080516000805160206156d5833981519152815260206004820152601c60248201527f43616e27742073656e64206665657320746f2073796e74686574697800000000604482015290519081900360640190fd5b600854604080517f502b8bda0000000000000000000000000000000000000000000000000000000081527f584452000000000000000000000000000000000000000000000000000000000060048201529051600160a060020a039092169163502b8bda916024808201926020929091908290030181600087803b158015614cd157600080fd5b505af1158015614ce5573d6000803e3d6000fd5b505050506040513d6020811015614cfb57600080fd5b5051600854604080517f502b8bda0000000000000000000000000000000000000000000000000000000081527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19891660048201529051929650600160a060020a039091169163502b8bda916024808201926020929091908290030181600087803b158015614d8557600080fd5b505af1158015614d99573d6000803e3d6000fd5b505050506040513d6020811015614daf57600080fd5b5051604080517f9dc29fac00000000000000000000000000000000000000000000000000000000815273feefeefeefeefeefeefeefeefeefeefeefeefeef6004820152602481018990529051919450600160a060020a03861691639dc29fac9160448082019260009290919082900301818387803b158015614e3057600080fd5b505af1158015614e44573d6000803e3d6000fd5b5050600854604080517f39d66fc00000000000000000000000000000000000000000000000000000000081527f58445200000000000000000000000000000000000000000000000000000000006004820152602481018b90527bffffffffffffffffffffffffffffffffffffffffffffffffffffffff198a1660448201529051600160a060020a0390921693506339d66fc092506064808201926020929091908290030181600087803b158015614efa57600080fd5b505af1158015614f0e573d6000803e3d6000fd5b505050506040513d6020811015614f2457600080fd5b5051604080517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038a811660048301526024820184905291519294509085169163867904b49160448082019260009290919082900301818387803b158015614f9457600080fd5b505af1158015614fa8573d6000803e3d6000fd5b5050604080517feb6ecc0300000000000000000000000000000000000000000000000000000000815273feefeefeefeefeefeefeefeefeefeefeefeefeef6004820152600160a060020a038b81166024830152604482018790529151918716935063eb6ecc03925060648082019260009290919082900301818387803b15801561503157600080fd5b505af1158015615045573d6000803e3d6000fd5b5050505050505050505050565b60008181600281805b6003831015614a1d576150a16011846003811061507457fe5b600702016006015460118560038110151561508b57fe5b600702016005015461407590919063ffffffff16565b9150600082111561514a578482106150b957846150bb565b815b90506150e481601185600381106150ce57fe5b600702016006015461442290919063ffffffff16565b601184600381106150f157fe5b600702016006018190555061510f818661407590919063ffffffff16565b9450615121848263ffffffff61442216565b935084151561513257839550614a21565b821580156151405750600085115b1561514a57600094505b6000199092019161505b565b81600160a060020a03811673feefeefeefeefeefeefeefeefeefeefeefeefeef14156151d157604080516000805160206156d5833981519152815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b600160a060020a038316151561523657604080516000805160206156d5833981519152815260206004820152601260248201527f4163636f756e742063616e277420626520300000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03831630141561529c57604080516000805160206156d5833981519152815260206004820152601e60248201527f43616e27742073656e64207265776172647320746f2066656520706f6f6c0000604482015290519081900360640190fd5b600254600160a060020a038481169116141561530757604080516000805160206156d5833981519152815260206004820152601b60248201527f43616e27742073656e64207265776172647320746f2070726f78790000000000604482015290519081900360640190fd5b600854600160a060020a038481169116141561537257604080516000805160206156d5833981519152815260206004820152601f60248201527f43616e27742073656e64207265776172647320746f2073796e74686574697800604482015290519081900360640190fd5b600a54604080517fb5ddb9c7000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018690529151919092169163b5ddb9c791604480830192600092919082900301818387803b1580156153e057600080fd5b505af11580156153f4573d6000803e3d6000fd5b50505050505050565b60025460408051600160a060020a03868116602080840191909152828401879052606080840187905284518085039091018152608084018086527f46656573436c61696d656428616464726573732c75696e743235362c75696e7490527f323536290000000000000000000000000000000000000000000000000000000060a0850152935160a493819003840181207f907dff97000000000000000000000000000000000000000000000000000000008252600160248301819052604483018290526000606484018190526084840181905295830186905260c060048401908152875160c48501528751959098169763907dff97979691959294919384938493839260e40191908a0190808383885b8381101561552457818101518382015260200161550c565b50505050905090810190601f1680156155515780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b1580156153e057600080fd5b60006305f5e10082046005600a82061061558d57600a015b600a900492915050565b6000808315156155aa576000915061408c565b508282028284828115156155ba57fe5b041461123d57600080fd5b6000808083116155d457600080fd5b82848115156155df57fe5b04949350505050565b600080615602846147bf87600a870263ffffffff61559716565b90506005600a825b061061561457600a015b600a9004949350505050565b600080600a8304615637868663ffffffff61559716565b81151561564057fe5b0490506005600a8261560a565b60c0604051908101604052806003905b6156656156b9565b81526020019060019003908161565d5790505090565b60e060405190810160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b60408051808201825290600290829080388339509192915050560008c379a000000000000000000000000000000000000000000000000000000000a165627a7a723058209f722499b8c471c72044deefbb62f60a0f851d8b6b6a3fe0a1db889e06bb9bf10029

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

000000000000000000000000b440dd674e1243644791a4adfe3a2abb0a92d309000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f617688200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c9dfff5fa5605fd94f8b7927b892f2b57391e8bb0000000000000000000000004b9ca5607f1ff8019c1c6a3c2f0cc8de622d5b82000000000000000000000000b671f2210b1f6621a2607ea63e6b2dc3e2464d1f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa87bee538000

-----Decoded View---------------
Arg [0] : _proxy (address): 0xb440DD674e1243644791a4AdfE3A2AbB0A92d309
Arg [1] : _owner (address): 0xB64fF7a4a33Acdf48d97dab0D764afD0F6176882
Arg [2] : _synthetix (address): 0x0000000000000000000000000000000000000000
Arg [3] : _feePoolState (address): 0x0000000000000000000000000000000000000000
Arg [4] : _feePoolEternalStorage (address): 0xC9DFff5fA5605fd94F8B7927b892F2B57391e8bB
Arg [5] : _synthetixState (address): 0x4b9Ca5607f1fF8019c1C6A3c2f0CC8de622D5B82
Arg [6] : _rewardEscrow (address): 0xb671F2210B1F6621A2607EA63E6B2DC3e2464d1F
Arg [7] : _rewardsAuthority (address): 0x0000000000000000000000000000000000000000
Arg [8] : _transferFeeRate (uint256): 0
Arg [9] : _exchangeFeeRate (uint256): 3000000000000000

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000b440dd674e1243644791a4adfe3a2abb0a92d309
Arg [1] : 000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 000000000000000000000000c9dfff5fa5605fd94f8b7927b892f2b57391e8bb
Arg [5] : 0000000000000000000000004b9ca5607f1ff8019c1c6a3c2f0cc8de622d5b82
Arg [6] : 000000000000000000000000b671f2210b1f6621a2607ea63e6b2dc3e2464d1f
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 000000000000000000000000000000000000000000000000000aa87bee538000


Libraries Used


Deployed Bytecode Sourcemap

154413:38739:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;161084:431;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;161084:431:0;;;;;;;160604:156;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;160604:156:0;-1:-1:-1;;;;;160604:156:0;;;;;189555:243;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;189555:243:0;-1:-1:-1;;;;;189555:243:0;;;;;;;;;;;;;;;;;;;;;188417:892;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;188417:892:0;-1:-1:-1;;;;;188417:892:0;;;;;;;166624:320;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;166624:320:0;-1:-1:-1;;;;;166624:320:0;;;-1:-1:-1;;166624:320:0;;;;;;;;;;;;;;;;;;;;;;;155011:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155011:27:0;;;;181393:810;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;181393:810:0;-1:-1:-1;;;;;181393:810:0;;;-1:-1:-1;;181393:810:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;9952:160;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;9952:160:0;-1:-1:-1;;;;;9952:160:0;;;;;3218:164;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3218:164:0;-1:-1:-1;;;;;3218:164:0;;;;;11814:26;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11814:26:0;;;;160345:167;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;160345:167:0;-1:-1:-1;;;;;160345:167:0;;;;;12631:295;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;12631:295:0;-1:-1:-1;;;;;12631:295:0;;;;;156725:39;;8:9:-1;5:2;;;30:1;27;20:12;5:2;156725:39:0;;;;161822:243;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;161822:243:0;;;;;13497:192;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13497:192:0;;;;183438:2727;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;183438:2727:0;-1:-1:-1;;;;;183438:2727:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;183438:2727:0;;;;;;;;;;;;;;;;;;;;;;;;;;;154783:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154783:27:0;;;;163295:2966;;8:9:-1;5:2;;;30:1;27;20:12;5:2;163295:2966:0;;;;156376:52;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;156376:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;169891:301;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;169891:301:0;-1:-1:-1;;;;;169891:301:0;;;;;154673:50;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154673:50:0;;;;;;;;-1:-1:-1;;;;;154673:50:0;;;;;;;;;;;;;;2789:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2789:29:0;;;;159637:160;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;159637:160:0;;;;;182364:909;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;182364:909:0;-1:-1:-1;;;;;182364:909:0;;;;;160857:157;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;160857:157:0;-1:-1:-1;;;;;160857:157:0;;;;;155416:34;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155416:34:0;;;;180025:513;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;180025:513:0;-1:-1:-1;;180025:513:0;;;;;170200:232;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;170200:232:0;-1:-1:-1;;;;;170200:232:0;;;;;180642:479;;8:9:-1;5:2;;;30:1;27;20:12;5:2;180642:479:0;;;;154553:26;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154553:26:0;;;;154860:72;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154860:72:0;;;;3459:285;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3459:285:0;;;;159072:385;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;159072:385:0;-1:-1:-1;;;;;159072:385:0;;;;;;;;;2762:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2762:20:0;;;;9792:152;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;9792:152:0;-1:-1:-1;;;;;9792:152:0;;;;;13912:377;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13912:377:0;;;;9321:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9321:29:0;;;;162161:463;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;162161:463:0;-1:-1:-1;;162161:463:0;;;;;;;154630:36;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154630:36:0;;;;11932:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11932:49:0;;;;157054:66;;8:9:-1;5:2;;;30:1;27;20:12;5:2;157054:66:0;;;;189907:268;;8:9:-1;5:2;;;30:1;27;20:12;5:2;189907:268:0;;;;168499:821;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;168499:821:0;;;;;;;;;;;;;;;;;;;169528:355;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;169528:355:0;-1:-1:-1;;;;;169528:355:0;;;;;;;179165:170;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;179165:170:0;;;;;177986:199;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;177986:199:0;;;;;11847:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11847:33:0;;;;10120:125;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10120:125:0;-1:-1:-1;;;;;10120:125:0;;;;;13146:209;;8:9:-1;5:2;;;30:1;27;20:12;5:2;13146:209:0;;;;11887:38;;8:9:-1;5:2;;;30:1;27;20:12;5:2;11887:38:0;;;;159977:257;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;159977:257:0;;;;;178337:602;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;178337:602:0;;;;;166443:173;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;166443:173:0;-1:-1:-1;;166443:173:0;;;;;156324:43;;8:9:-1;5:2;;;30:1;27;20:12;5:2;156324:43:0;;;;;;;;;;;;;;;;;;;;;;;155231:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155231:31:0;;;;156829:53;;8:9:-1;5:2;;;30:1;27;20:12;5:2;156829:53:0;;;;176827:602;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;176827:602:0;;;;;154586:37;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154586:37:0;;;;179625:201;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;179625:201:0;;;;;155321:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155321:32:0;;;;177632:172;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;177632:172:0;;;;;155498:80;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155498:80:0;;;;9296:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9296:18:0;;;;156889:54;;8:9:-1;5:2;;;30:1;27;20:12;5:2;156889:54:0;;;;162771:396;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;162771:396:0;;;;;161584:230;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;161584:230:0;-1:-1:-1;;;;;161584:230:0;;;;;161084:431;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;156876:6;161214:45;;;161206:89;;;;;-1:-1:-1;;;;;;;;;;;161206:89:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;156936:7;161314:45;;;161306:89;;;;;-1:-1:-1;;;;;;;;;;;161306:89:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;161408:17;:38;;;161459:48;161428:18;161459:28;:48::i;:::-;161084:431;:::o;160604:156::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;160724:12;:28;;-1:-1:-1;;160724:28:0;-1:-1:-1;;;;;160724:28:0;;;;;;;;;;160604:156::o;189555:243::-;189688:21;;189733:55;;;189750:19;189733:55;;;;;;;;-1:-1:-1;;;;;189733:55:0;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;189733:55:0;;;;;;;;189723:66;;-1:-1:-1;;189688:21:0;;;;;:34;;189733:55;;;;;189723:66;;;;189733:55;189723:66;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;189723:66:0;;;;;;;;;;;;189688:102;;;;;;;;;;;;;;;;;;-1:-1:-1;263:2;;-1:-1;189688:102:0;;;;;;;-1:-1:-1;189688:102:0;-1:-1:-1;189688:102:0;;;;5:2:-1;;;;30:1;27;20:12;5:2;189688:102:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;189688:102:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;189688:102:0;;189555:243;-1:-1:-1;;189555:243:0:o;188417:892::-;188534:4;;;;188564:11;;;188556:56;;;;;-1:-1:-1;;;;;;;;;;;188556:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;156366:1;188631:26;;188623:68;;;;;-1:-1:-1;;;;;;;;;;;188623:68:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;188776:16;-1:-1:-1;;188793:10:0;;188776:28;;;;;;;;;;:46;;;188826:1;188776:51;188772:64;;;188829:7;;188772:64;188872:53;188923:1;188872:16;-1:-1:-1;;188889:10:0;;188872:28;;;;;;;;;;:46;;;:50;;:53;;;;:::i;:::-;189043:12;;:62;;;;;;-1:-1:-1;;;;;189043:62:0;;;;;;;;;;;;;;;188848:77;;-1:-1:-1;189043:12:0;;;;:35;;:62;;;;;;;;;;;;:12;;:62;;;5:2:-1;;;;30:1;27;20:12;5:2;189043:62:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;189043:62:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;189043:62:0;;;;;;;;;-1:-1:-1;189043:62:0;-1:-1:-1;189218:83:0;189247:16;189043:62;;189218:28;:83::i;:::-;189211:90;;188417:892;;;;;;;;:::o;166624:320::-;10478:5;;166754:4;;-1:-1:-1;;;;;10478:5:0;10463:10;10457:26;;;;:67;;-1:-1:-1;10508:16:0;;-1:-1:-1;;;;;10508:16:0;10493:10;10487:37;;10457:67;10453:126;;;10541:13;:26;;-1:-1:-1;;10541:26:0;10557:10;10541:26;;;10453:126;166784:9;;166823:13;;;166784:53;;;;;;-1:-1:-1;;;;;166784:53:0;;;;;;;;;;166823:13;;;166784:53;;;;;:9;;;;;:18;;:53;;;;;;;;;;;;;;:9;;:53;;;5:2:-1;;;;30:1;27;20:12;5:2;166784:53:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;166784:53:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;166784:53:0;166776:97;;;;;;;-1:-1:-1;;;;;;;;;;;166776:97:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;166893:43;166904:18;166924:11;166893:10;:43::i;:::-;166886:50;166624:320;-1:-1:-1;;;166624:320:0:o;155011:27::-;;;;:::o;181393:810::-;181501:4;181507;181557:42;;:::i;:::-;181636:14;181665:17;181786:6;181602:21;181615:7;181602:12;:21::i;:::-;181557:66;;181653:1;181636:18;;181685:1;181665:21;;181795:1;181786:10;;181781:175;156366:1;181798:21;;181781:175;;;181853:29;181867:8;181876:1;181867:11;;;;;;;;;;;:14;181853:9;;:13;:29::i;:::-;181841:41;-1:-1:-1;181912:32:0;181929:8;181938:1;181929:11;;;;;;;;;;;181941:1;181929:14;;;;181912:12;;:32;:16;:32;:::i;:::-;181897:47;-1:-1:-1;181821:3:0;;181781:175;;;182102:9;;:55;;;;;;;;;;;;;;;;;-1:-1:-1;;182102:55:0;;;;;;;;-1:-1:-1;;;;;182102:9:0;;;;:24;;:55;;;;;;;;;;;;;;;:9;;:55;;;5:2:-1;;;;30:1;27;20:12;5:2;182102:55:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;182102:55:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;182102:55:0;;182172:12;;-1:-1:-1;181393:810:0;;-1:-1:-1;;;;;;181393:810:0:o;9952:160::-;3809:5;;-1:-1:-1;;;;;3809:5:0;3795:10;:19;3787:79;;;;;-1:-1:-1;;;;;;;;;;;3787:79:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10061:16;:43;;-1:-1:-1;;10061:43:0;-1:-1:-1;;;;;10061:43:0;;;;;;;;;;9952:160::o;3218:164::-;3809:5;;-1:-1:-1;;;;;3809:5:0;3795:10;:19;3787:79;;;;;-1:-1:-1;;;;;;;;;;;3787:79:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3313:14;:23;;-1:-1:-1;;;;;3313:23:0;;-1:-1:-1;;3313:23:0;;;;;;;;3352:22;;;;;;;;;;;;;;;;3218:164;:::o;11814:26::-;;;;:::o;160345:167::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;160468:16;:36;;-1:-1:-1;;160468:36:0;-1:-1:-1;;;;;160468:36:0;;;;;;;;;;160345:167::o;12631:295::-;3809:5;;-1:-1:-1;;;;;3809:5:0;3795:10;:19;3787:79;;;;;-1:-1:-1;;;;;;;;;;;3787:79:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;12750:26:0;;;;12742:67;;;;;-1:-1:-1;;;;;;;;;;;12742:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;12820:23;:38;;-1:-1:-1;;;;;12820:38:0;;;;;;;;;;;;;;;;12874:44;;;;;;;;;;;;;;;;12631:295;:::o;156725:39::-;;;;:::o;161822:243::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;161952:1;161940:13;;;161932:54;;;;;-1:-1:-1;;;;;;;;;;;161932:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;162054:3;162028:15;:20;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;162028:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;162028:22:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;162028:22:0;162017:33;;162016:41;;;;;;;;161997:16;:60;-1:-1:-1;161822:243:0:o;13497:192::-;3809:5;;-1:-1:-1;;;;;3809:5:0;3795:10;:19;3787:79;;;;;-1:-1:-1;;;;;;;;;;;3787:79:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13600:1;13583:14;:18;;;13612:21;:29;;-1:-1:-1;;13612:29:0;;;13657:24;;;;13600:1;13657:24;13497:192::o;183438:2727::-;183525:41;;:::i;:::-;183688:28;183727:19;184332;184362:22;184773:6;184832:9;184864:27;;:::i;:::-;183801:12;;:45;;;;;;-1:-1:-1;;;;;183801:45:0;;;;;;;185465:21;183801:45;;;;;;;;185465:21;;183801:12;;;;;:33;;:45;;;;;;;;;;;185465:21;183801:12;:45;;;5:2:-1;;;;30:1;27;20:12;5:2;183801:45:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;183801:45:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;183801:45:0;;;;;;;;;-1:-1:-1;183801:45:0;-1:-1:-1;183963:19:0;;:51;;;;-1:-1:-1;183986:28:0;;183963:51;183959:64;;;184016:7;;183959:64;184109:9;;:34;;;;;;;;;;;;;-1:-1:-1;;;;;184109:9:0;;;;:27;;:34;;;;;;;;;;;;;;;:9;;:34;;;5:2:-1;;;;30:1;27;20:12;5:2;184109:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;184109:34:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;184109:34:0;:39;184105:52;;;184150:7;;184105:52;184433:69;184459:1;184462:23;184487:14;184433:25;:69::i;:::-;184515:10;;:30;;;184556:10;;184515;184556:13;:33;;;184395:107;;-1:-1:-1;184395:107:0;-1:-1:-1;184782:21:0;;-1:-1:-1;184768:1390:0;184809:1;184805;:5;184768:1390;;;-1:-1:-1;;184844:5:0;;;-1:-1:-1;184894:16:0;184844:5;184894:22;;;;;;;;;;184864:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;185035:1;185004:10;:28;;;:32;:112;;;;-1:-1:-1;185085:16:0;185102:1;185085:19;;;;;;;;;;:31;185053:29;185074:7;185053:20;:29::i;:::-;:63;185004:112;185000:1147;;;185489:28;;;;:35;;185522:1;185489:35;:32;:35;:::i;:::-;185838:12;;:62;;;;;;-1:-1:-1;;;;;185838:62:0;;;;;;;;;;;;;;;185465:59;;-1:-1:-1;185838:12:0;;;;:35;;:62;;;;;;;;;;;;:12;;:62;;;5:2:-1;;;;30:1;27;20:12;5:2;185838:62:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;185838:62:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;185838:62:0;;;;;;;;;-1:-1:-1;185838:62:0;-1:-1:-1;185959:69:0;185985:1;185838:62;;185959:25;:69::i;:::-;185921:107;;-1:-1:-1;185921:107:0;-1:-1:-1;185921:107:0;186049:7;186057:1;186049:10;;;;;;;;;;;:30;186114:17;186098:7;186106:1;186098:10;;;;;;;;;;;186109:1;186098:13;;;:33;185000:1147;-1:-1:-1;;184812:3:0;;;;184768:1390;;;183438:2727;;;;;;;;;;;:::o;154783:27::-;;;;:::o;163295:2966::-;163475:36;;:::i;:::-;163564:30;;:::i;:::-;163410:17;;163370:29;;164953:6;;;;163404:3;:23;;;;-1:-1:-1;163370:58:0;163362:100;;;;;-1:-1:-1;;;;;;;;;;;163362:100:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;163475:78;;;;;;;;;163514:39;163475:78;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;163564:72;;;;;;;163597:39;163564:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;164286:36;163475:78;;-1:-1:-1;163564:72:0;;-1:-1:-1;164192:131:0;;:75;;163564:72;164192:75;:48;:75;:::i;:::-;:93;:131;:93;:131;:::i;:::-;164133:56;:190;164496:39;;;;;164448:28;;;;164396:33;;;;:140;;:81;;:33;:81;:51;:81;:::i;:140::-;164334:59;:202;164351:21;;-1:-1:-1;164948:730:0;156366:1;164985:21;;164948:730;;;-1:-1:-1;165044:1:0;165040:5;;165097:16;165040:1;165097:19;;;;;;;;;;:31;165060:16;165077:4;165060:22;;;;;;;;;;:68;165186:16;165203:1;165186:19;;;;;;;;;;:37;;;165143:16;165160:4;165143:22;;;;;;;;;;;;:40;;:80;;;;165273:16;165290:1;165273:19;;;;;;;;;;;;:29;;;165238:16;165255:4;165238:22;;;;;;;;;;;;:32;;:64;;;;165359:16;165376:1;165359:19;;;;;;;;;;;;:36;;;165317:16;165334:4;165317:22;;;;;;;;;;;;:39;;:78;;;;165447:16;165464:1;165447:19;;;;;;;;;;;;:31;;;165410:16;165427:4;165410:22;;;;;;;;;;;;:34;;:68;;;;165538:16;165555:1;165538:19;;;;;;;;;;;;:39;;;165493:16;165510:4;165493:22;;;;;;;;;;;;:42;;:84;;;;165632:16;165649:1;165632:19;;;;;;;;;;;;:34;;;165592:16;165609:4;165592:22;;;;;;;;;;;;:37;;:74;;;;165008:3;;;;;;;;164948:730;;;165808:1;165791:16;165784:26;;;;;;;;;;;;;;;;;;;;;;;;;166020:19;:31;:38;;165784:26;166020:35;:38::i;:::-;165986:16;:72;166109:14;;:33;;;;;;;;-1:-1:-1;;;;;166109:14:0;;;;:31;;:33;;;;;;;;;;;;;;;166003:1;166109:14;:33;;;5:2:-1;;;;30:1;27;20:12;5:2;166109:33:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;166109:33:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;166109:33:0;166069:37;:73;166185:3;166153:29;:35;166221:19;:31;166201:52;;:19;:52::i;:::-;163295:2966;;;;:::o;156376:52::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;156376:52:0;;;;;;;;;:::o;169891:301::-;10478:5;;-1:-1:-1;;;;;10478:5:0;10463:10;10457:26;;;;:67;;-1:-1:-1;10508:16:0;;-1:-1:-1;;;;;10508:16:0;10493:10;10487:37;;10457:67;10453:126;;;10541:13;:26;;-1:-1:-1;;10541:26:0;10557:10;10541:26;;;10453:126;170001:9;;-1:-1:-1;;;;;170001:9:0;:23;;169993:62;;;;;-1:-1:-1;;;;;;;;;;;169993:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;170074:21:0;;;;170066:62;;;;;-1:-1:-1;;;;;;;;;;;170066:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;170139:9;;170161:13;;;170139:45;;;;;;-1:-1:-1;;;;;170161:13:0;;;170139:45;;;;;;;;;;;;;;;:9;;;:21;;:45;;;;;:9;;:45;;;;;;;;:9;;:45;;;5:2:-1;;;;30:1;27;20:12;5:2;170139:45:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;170139:45:0;;;;169891:301;:::o;154673:50::-;;;-1:-1:-1;;;;;154673:50:0;;:::o;2789:29::-;;;-1:-1:-1;;;;;2789:29:0;;:::o;159637:160::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;159755:15;:34;159637:160::o;182364:909::-;182654:9;;:41;;;;;;-1:-1:-1;;;;;182654:41:0;;;;;;;;;182452:4;;;;;;;;182654:9;;;;;:32;;:41;;;;;;;;;;;;;;182452:4;182654:9;:41;;;5:2:-1;;;;30:1;27;20:12;5:2;182654:41:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;182654:41:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;182654:41:0;182725:9;;:26;;;;;;;;182654:41;;-1:-1:-1;;;;;;182725:9:0;;;;:24;;:26;;;;;182654:41;;182725:26;;;;;;;;:9;;:26;;;5:2:-1;;;;30:1;27;20:12;5:2;182725:26:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;182725:26:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;182725:26:0;:42;;;;;;;;-1:-1:-1;;;;;182725:40:0;;;;;;:42;;;;;:26;;:42;;;;;;;;;:40;:42;;;5:2:-1;;;;30:1;27;20:12;5:2;182725:42:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;182725:42:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;182725:42:0;;-1:-1:-1;182845:19:0;;;182841:63;;;182888:4;182881:11;;;;182841:63;183026:73;183054:44;183081:16;;183054:15;:20;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;183054:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;183054:22:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;183054:22:0;;:44;:26;:44;:::i;:::-;183026:11;;:73;:27;:73;:::i;:::-;183003:96;;183186:15;183178:5;:23;183174:68;;;183225:5;183218:12;;;;183174:68;183261:4;183254:11;;182364:909;;;;;;;:::o;160857:157::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;160984:9;:22;;-1:-1:-1;;160984:22:0;-1:-1:-1;;;;;160984:22:0;;;;;;;;;;160857:157::o;155416:34::-;;;-1:-1:-1;;;;;155416:34:0;;:::o;180025:513::-;180123:4;;180262:1;180248:208;156366:1;180265:21;;180248:208;;;180320:51;180334:16;180351:1;180334:19;;;;;;;;;;:36;;;180320:9;:13;;:51;;;;:::i;:::-;180308:63;-1:-1:-1;180398:46:0;180412:16;180429:1;180412:19;;;;;;;;;;:31;;;180398:9;:13;;:46;;;;:::i;:::-;180386:58;-1:-1:-1;180288:3:0;;180248:208;;;180475:9;;:55;;;;;;;;;;;;;;;;;-1:-1:-1;;180475:55:0;;;;;;;;-1:-1:-1;;;;;180475:9:0;;;;:24;;:55;;;;;;;;;;;;;;;:9;;:55;;;5:2:-1;;;;30:1;27;20:12;5:2;180475:55:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;180475:55:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;180475:55:0;;180025:513;-1:-1:-1;;;;180025:513:0:o;170200:232::-;10478:5;;-1:-1:-1;;;;;10478:5:0;10463:10;10457:26;;;;:67;;-1:-1:-1;10508:16:0;;-1:-1:-1;;;;;10508:16:0;10493:10;10487:37;;10457:67;10453:126;;;10541:13;:26;;-1:-1:-1;;10541:26:0;10557:10;10541:26;;;10453:126;170309:9;;-1:-1:-1;;;;;170309:9:0;:23;;170301:62;;;;;-1:-1:-1;;;;;;;;;;;170301:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;170374:9;;170401:13;;;170374:50;;;;;;-1:-1:-1;;;;;170401:13:0;;;170374:50;;;;;;;;;;;;;;;:9;;;:26;;:50;;;;;:9;;:50;;;;;;;;:9;;:50;;;5:2:-1;;;;30:1;27;20:12;180642:479:0;180725:4;;180870:1;180856:226;156366:1;180873:21;;180856:226;;;180931:57;180948:16;180965:1;180948:19;;;;;;;;;;:39;;;180931:12;:16;;:57;;;;:::i;:::-;180916:72;-1:-1:-1;181018:52:0;181035:16;181052:1;181035:19;;;;;;;;;;:34;;;181018:12;:16;;:52;;;;:::i;:::-;181003:67;-1:-1:-1;180896:3:0;;180856:226;;;-1:-1:-1;181101:12:0;180642:479;-1:-1:-1;180642:479:0:o;154553:26::-;;;-1:-1:-1;;;;;154553:26:0;;:::o;154860:72::-;154930:2;154905:15;:20;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154905:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;154905:22:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;154905:22:0;:27;;;;;;;;154860:72;:::o;3459:285::-;3542:14;;-1:-1:-1;;;;;3542:14:0;3528:10;:28;3520:94;;;;;-1:-1:-1;;;;;;;;;;;3520:94:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3643:5;;;3650:14;3630:35;;;-1:-1:-1;;;;;3643:5:0;;;3630:35;;3650:14;;;;3630:35;;;;;;;;;;;;;;;;3684:14;;;;3676:22;;-1:-1:-1;;3676:22:0;;;-1:-1:-1;;;;;3684:14:0;;3676:22;;;;3709:27;;;3459:285::o;159072:385::-;190781:9;;-1:-1:-1;;;;;190781:9:0;190759:10;:32;190751:70;;;;;-1:-1:-1;;;;;;;;;;;190751:70:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;159220:12;;159297:37;;159220:115;;;;;;-1:-1:-1;;;;;159220:115:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;:12;;;;;:40;;:115;;;;;:12;;:115;;;;;;;:12;;:115;;;5:2:-1;;;;30:1;27;20:12;5:2;159220:115:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;159411:37:0;;159348:101;;-1:-1:-1;159375:7:0;;-1:-1:-1;159384:9:0;;159395:14;;159348:26;:101::i;:::-;159072:385;;;:::o;2762:20::-;;;-1:-1:-1;;;;;2762:20:0;;:::o;9792:152::-;3809:5;;-1:-1:-1;;;;;3809:5:0;3795:10;:19;3787:79;;;;;-1:-1:-1;;;;;;;;;;;3787:79:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9879:5;:21;;-1:-1:-1;;;;;9879:21:0;;-1:-1:-1;;9879:21:0;;;;;;;;9916:20;;;;;;;;;;;;;;;;9792:152;:::o;13912:377::-;14157:19;3809:5;;-1:-1:-1;;;;;3809:5:0;3795:10;:19;3787:79;;;;;-1:-1:-1;;;;;;;;;;;3787:79:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13997:21;;;;13989:65;;;;;;;-1:-1:-1;;;;;;;;;;;13989:65:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;14111:3;11974:7;14073:14;;:35;:41;14065:81;;;;;;;-1:-1:-1;;;;;;;;;;;14065:81:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;14179:23:0;;14218:27;;;-1:-1:-1;;;;;14179:23:0;;;;;;;;14218:27;;;;;14179:23;;14218:27;;;;;;;;;;14269:11;-1:-1:-1;;;;;14256:25:0;;9321:29;;;-1:-1:-1;;;;;9321:29:0;;:::o;162161:463::-;190781:9;;162268:14;;-1:-1:-1;;;;;190781:9:0;190759:10;:32;190751:70;;;;;-1:-1:-1;;;;;;;;;;;190751:70:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;162299:20;-1:-1:-1;;162299:20:0;;;162295:168;;162348:9;;:52;;;;;;-1:-1:-1;;162348:52:0;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;162348:9:0;;;;:24;;:52;;;;;;;;;;;;;;;:9;;:52;;;5:2:-1;;;;30:1;27;20:12;5:2;162348:52:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;162348:52:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;162348:52:0;;-1:-1:-1;162295:168:0;;;-1:-1:-1;162445:6:0;162295:168;162565:36;;:51;;162606:9;162565:51;:40;:51;:::i;:::-;162526:36;:90;-1:-1:-1;;;162161:463:0:o;154630:36::-;;;-1:-1:-1;;;;;154630:36:0;;:::o;11932:49::-;11974:7;11932:49;:::o;157054:66::-;;;;:::o;189907:268::-;189991:4;190013:16;190032:9;;;;;;;;;-1:-1:-1;;;;;190032:9:0;-1:-1:-1;;;;;190032:24:0;;:26;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;190032:26:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;190032:26:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;190032:26:0;:42;;;;;;;;-1:-1:-1;;;;;190032:40:0;;;;;;:42;;;;;:26;;:42;;;;;;;;;:40;:42;;;5:2:-1;;;;30:1;27;20:12;5:2;190032:42:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;190032:42:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;190032:42:0;190149:16;;190122:22;;;;;;;;190032:42;;-1:-1:-1;190094:73:0;;190122:44;;190149:16;190122:15;;:20;;:22;;;;;190032:42;;190122:22;;;;;;;;:15;:22;;;5:2:-1;;;;30:1;27;20:12;190122:44:0;190094:11;;:73;:27;:73;:::i;:::-;190087:80;;189907:268;;:::o;168499:821::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;68906:15;;68900:3;:21;68892:75;;;;;-1:-1:-1;;;;;;;;;;;68892:75:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;168847:11;168800:16;168817:14;168800:32;;;;;;;;;;:58;168922:17;168869:16;168886:14;168869:32;;;;;;;;;;:50;;:70;;;;168995:9;168950:16;168967:14;168950:32;;;;;;;;;;;;:42;;:54;;;;169067:16;169015;169032:14;169015:32;;;;;;;;;;;;:49;;:68;;;;169141:11;169094:16;169111:14;169094:32;;;;;;;;;;;;:44;;:58;;;;169218:19;169163:16;169180:14;169163:32;;;;;;;;;;;;:52;;:74;;;;169298:14;169248:16;169265:14;169248:32;;;;;;;;;;;;:47;;:64;;;;168499:821;;;;;;;;:::o;169528:355::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;169718:9;;169741:13;;;169756:12;;169718:61;;;;;;-1:-1:-1;;;;;169741:13:0;;;169718:61;;;;;;;169756:12;;;169718:61;;;;;;;;;;;:9;;;:22;;:61;;;;;;;;;;;;;;;:9;;:61;;;5:2:-1;;;;30:1;27;20:12;5:2;169718:61:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;169718:61:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;169825:12:0;;:50;;;;;;-1:-1:-1;;;;;169825:50:0;;;;;;;;;;;;;;;:12;;;;;:31;;:50;;;;;:12;;:50;;;;;;;:12;;:50;;;5:2:-1;;;;30:1;27;20:12;5:2;169825:50:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;169825:50:0;;;;169528:355;;:::o;179165:170::-;179261:4;179290:37;179300:26;179320:5;179300:19;:26::i;:::-;179290:5;;:37;:9;:37;:::i;:::-;179283:44;179165:170;-1:-1:-1;;179165:170:0:o;177986:199::-;178084:4;178113:64;178133:43;178153:15;:20;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;178153:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;178153:22:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;178153:22:0;178133:15;;;:43;:19;:43;:::i;:::-;178113:5;;:64;:19;:64;:::i;11847:33::-;;;;;;:::o;10120:125::-;10312:5;;-1:-1:-1;;;;;10312:5:0;10297:10;10291:26;;:67;;-1:-1:-1;10342:16:0;;-1:-1:-1;;;;;10342:16:0;10327:10;10321:37;10291:67;10283:103;;;;;;;-1:-1:-1;;;;;;;;;;;10283:103:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;10215:13;:22;;-1:-1:-1;;10215:22:0;-1:-1:-1;;;;;10215:22:0;;;;;;;;;;10120:125::o;13146:209::-;3809:5;;-1:-1:-1;;;;;3809:5:0;3795:10;:19;3787:79;;;;;-1:-1:-1;;;;;;;;;;;3787:79:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13248:3;13231:14;:20;13262:21;:28;;-1:-1:-1;;13262:28:0;13286:4;13262:28;;;13306:41;;;11974:7;13306:41;;;;;;;;;;;;;13146:209::o;11887:38::-;;;;;;-1:-1:-1;;;;;11887:38:0;;:::o;159977:257::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;154930:2;154905:15;:20;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154905:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;154905:22:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;154905:22:0;:27;;;;;;;;160103:41;;;160095:84;;;;;-1:-1:-1;;;;;;;;;;;160095:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;160192:15;:34;159977:257::o;178337:602::-;178426:4;178455:38;178477:15;;178455:5;:21;;:38;;;;:::i;166443:173::-;10478:5;;166541:4;;-1:-1:-1;;;;;10478:5:0;10463:10;10457:26;;;;:67;;-1:-1:-1;10508:16:0;;-1:-1:-1;;;;;10508:16:0;10493:10;10487:37;;10457:67;10453:126;;;10541:13;:26;;-1:-1:-1;;10541:26:0;10557:10;10541:26;;;10453:126;166581:13;;166570:38;;-1:-1:-1;;;;;166581:13:0;166596:11;166570:10;:38::i;156324:43::-;156366:1;156324:43;:::o;155231:31::-;;;-1:-1:-1;;;;;155231:31:0;;:::o;156829:53::-;156876:6;156829:53;:::o;176827:602::-;176916:4;176945:38;176967:15;;176945:5;:21;;:38;;;;:::i;154586:37::-;;;-1:-1:-1;;;;;154586:37:0;;:::o;179625:201::-;179723:4;179752:66;179774:43;179801:15;;179774;:20;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;179774:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;179774:22:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;179774:22:0;;:43;:26;:43;:::i;155321:32::-;;;-1:-1:-1;;;;;155321:32:0;;:::o;177632:172::-;177730:4;177759:37;177769:26;177789:5;177769:19;:26::i;155498:80::-;155536:42;155498:80;:::o;9296:18::-;;;-1:-1:-1;;;;;9296:18:0;;:::o;156889:54::-;156936:7;156889:54;:::o;162771:396::-;162875:16;;162858:13;;-1:-1:-1;;;;;162858:13:0;;;162875:16;;162858:33;;:67;;-1:-1:-1;162909:16:0;;-1:-1:-1;;;;;162909:16:0;162895:10;:30;162858:67;162850:110;;;;;;;-1:-1:-1;;;;;;;;;;;162850:110:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;163108:39;;:51;;163152:6;163108:51;:43;:51;:::i;:::-;163066:39;:93;-1:-1:-1;162771:396:0:o;161584:230::-;10680:5;;-1:-1:-1;;;;;10680:5:0;10665:10;10659:26;;;;:67;;-1:-1:-1;10710:16:0;;-1:-1:-1;;;;;10710:16:0;10695:10;10689:37;;10659:67;10655:126;;;10743:13;:26;;-1:-1:-1;;10743:26:0;10759:10;10743:26;;;10655:126;10816:5;;10799:13;;-1:-1:-1;;;;;10799:13:0;;;10816:5;;10799:22;10791:54;;;;;-1:-1:-1;;;;;;;;;;;10791:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;161703:33:0;;;;161695:76;;;;;-1:-1:-1;;;;;;;;;;;161695:76:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;161784:9;:22;;-1:-1:-1;;161784:22:0;-1:-1:-1;;;;;161784:22:0;;;;;;;;;;161584:230::o;192328:180::-;192413:5;;192425:32;;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;192425:32:0;;;;;;192275:46;;;;;;;;;;;;;;;;;;192413:87;;;:5;:87;;;;;;;;;;;;:5;:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;192413:5:0;;;;:11;;192425:32;192413:5;;;;;;;;:87;;;;;;;;;;;;:5;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;192413:87:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;15599:136:0;15657:7;;15681:6;;;;15673:15;;;;;;-1:-1:-1;;15707:5:0;;;;15599:136;;;;;;:::o;187679:730::-;187837:4;188140:27;187958:14;;;;;;;;;-1:-1:-1;;;;;187958:14:0;-1:-1:-1;;;;;187958:31:0;;:33;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;187958:33:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;187958:33:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;187958:33:0;187939:52;;187935:66;;;188000:1;187993:8;;;;187935:66;188254:14;;:41;;;;;;;;;;;;;;188170:189;;188339:19;;188170:126;;-1:-1:-1;;;;;188254:14:0;;;;:25;;:41;;;;;;;;;;;;;;;:14;;:41;;;5:2:-1;;;;30:1;27;20:12;5:2;188254:41:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;188254:41:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;188254:41:0;188170:14;;:43;;;;;;;;;;;;;;-1:-1:-1;;;;;188170:14:0;;;;:25;;:43;;;;;188254:41;;188170:43;;;;;;;;:14;;:43;;;5:2:-1;;;;30:1;27;20:12;5:2;188170:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;188170:43:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;188170:43:0;;:126;:83;:126;:::i;:::-;:168;:189;:168;:189;:::i;:::-;188140:219;;188379:22;188372:29;;187679:730;;;;;;;:::o;166952:1539::-;167053:4;167075:16;167102:13;167126:18;167155:21;167351:30;167365:15;167351:13;:30::i;:::-;167343:74;;;;;;;-1:-1:-1;;;;;;;;;;;167343:74:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;167529:37;167543:15;167529:37;:13;:37::i;:::-;167493:73;;-1:-1:-1;167493:73:0;-1:-1:-1;167603:1:0;167587:17;;;:41;;;167627:1;167608:16;:20;167587:41;167579:118;;;;;;;-1:-1:-1;;;;;;;;;;;167579:118:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;167808:19;:31;167769:71;;167791:15;;167769:21;:71::i;:::-;167873:1;167857:13;:17;167853:258;;;167965:32;167983:13;167965:17;:32::i;:::-;167954:43;;168051:48;168060:15;168077:8;168087:11;168051:8;:48::i;:::-;168146:1;168127:16;:20;168123:269;;;168244:38;168265:16;168244:20;:38::i;:::-;168230:52;;168339:41;168351:15;168368:11;168339;:41::i;:::-;168404:55;168420:15;168437:8;168447:11;168404:15;:55::i;:::-;-1:-1:-1;168479:4:0;;166952:1539;-1:-1:-1;;;;;;166952:1539:0:o;15803:136::-;15861:7;15889:5;;;15909:6;;;;15901:15;;;;;186447:1224;186578:4;;;;;;186691:24;;186687:43;;;186725:1;;-1:-1:-1;186725:1:0;;-1:-1:-1;186717:13:0;;186687:43;186773:19;186743:49;;186902:1;186893:6;:10;186889:243;;;186944:53;186995:1;186944:16;-1:-1:-1;;186961:10:0;;186944:28;;;;;;:53;186920:77;;187037:83;187066:16;187084:19;187105:14;187037:28;:83::i;:::-;187012:108;;186889:243;187288:95;187360:22;187288:16;187305:6;187288:24;;;;;;;;;;:41;;;:71;;:95;;;;:::i;:::-;187266:117;-1:-1:-1;187421:98:0;187496:22;187421:16;187438:6;187421:24;;;;;;;;;;:44;;;:74;;:98;;;;:::i;:::-;187396:123;;187554:40;:14;:38;:40::i;:::-;187609:43;:17;:41;:43::i;:::-;187532:131;;;;186447:1224;;;;;;;;;;;:::o;192645:144::-;192712:5;;192724:23;;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;192724:23:0;;;;;;192601:37;;;;;;;;;;;;;192712:69;;;:5;:69;;;;;;;;;;;;:5;:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;192712:5:0;;;;:11;;192724:23;192712:5;;;;;;;;:69;;;;;;;;;;;;:5;33:3:-1;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;18732:227:0;18823:4;17634:20;18936:8;:1;18942;18936:8;:5;:8;:::i;:::-;:15;;;;;;;;;18732:227;-1:-1:-1;;;18732:227:0:o;191285:284::-;191428:5;;;191440:65;;;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;191440:65:0;;;;;;191210:68;;;;;;;;;;;;;;;;;;191428:133;;;;;;;;;;;;;;;-1:-1:-1;;;;;191538:16:0;;;191428:133;;;;;;:5;:133;;;;;;;;;;;;;;;;;;;;;;;;;;;:5;;;;;:11;;:5;;191210:68;;191538:16;;191428:5;;;;:133;;;;;;;;;;;;;;;;:5;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;191428:133:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;191428:133:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;191428:133:0;;;;191285:284;;;;:::o;21968:218::-;22057:4;22160:18;22176:1;22160:11;:1;17634:20;22160:11;:5;:11;:::i;:::-;:15;:18;:15;:18;:::i;23879:177::-;23980:4;24009:39;24029:1;24032;17767:33;24009:19;:39::i;20586:181::-;20689:4;20718:41;20740:1;20743;17767:33;20718:21;:41::i;190470:234::-;190580:21;;190625:55;;;190642:19;190625:55;;;;;;;;-1:-1:-1;;;;;190625:55:0;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;190625:55:0;;;;;;;;190615:66;;190580:21;;;:34;;190625:55;;;190615:66;;;;;190625:55;190615:66;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;;;;365:33;;190615:66:0;;;;;;;;;;;;190580:116;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;190580:116:0;;;;;;;-1:-1:-1;190580:116:0;-1:-1:-1;190580:116:0;;;;5:2:-1;;;;30:1;27;20:12;170582:1620:0;170661:4;170752:9;170661:4;171037:21;170661:4;;171023:1144;156366:1;171060:21;;171023:1144;;;171116:73;171157:16;171174:1;171157:19;;;;;;;;;;:31;;;171116:16;171133:1;171116:19;;;;;;;;;;;;:36;;;:40;;:73;;;;:::i;:::-;171103:86;;171218:1;171210:5;:9;171206:950;;;171384:19;171376:5;:27;:57;;171414:19;171376:57;;;171406:5;171376:57;171354:79;-1:-1:-1;171488:51:0;171354:79;171488:16;171505:1;171488:19;;;;;;;;;;:31;;;:35;;:51;;;;:::i;:::-;171454:16;171471:1;171454:19;;;;;;;;;;:31;;:85;;;;171580:39;171604:14;171580:19;:23;;:39;;;;:::i;:::-;171558:61;-1:-1:-1;171649:28:0;:8;171662:14;171649:28;:12;:28;:::i;:::-;171638:39;-1:-1:-1;171788:24:0;;171784:45;;;171821:8;171814:15;;;;171784:45;172040:6;;:33;;;;;172072:1;172050:19;:23;172040:33;172036:105;;;172120:1;172098:23;;172036:105;-1:-1:-1;;171083:3:0;;;;171023:1144;;;172186:8;172179:15;;170582:1620;;;;;;;;;:::o;174393:1487::-;174835:14;;;174516:7;-1:-1:-1;;;;;190908:22:0;;155536:42;190908:22;;190900:58;;;;;-1:-1:-1;;;;;;;;;;;190900:58:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;174549:21:0;;;;174541:52;;;;;-1:-1:-1;;;;;;;;;;;174541:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;174612:24:0;;174631:4;174612:24;;174604:64;;;;;-1:-1:-1;;;;;;;;;;;174604:64:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;174706:5;;-1:-1:-1;;;;;174687:25:0;;;174706:5;;174687:25;;174679:62;;;;;-1:-1:-1;;;;;;;;;;;174679:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;174779:9;;-1:-1:-1;;;;;174760:29:0;;;174779:9;;174760:29;;174752:70;;;;;-1:-1:-1;;;;;;;;;;;174752:70:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;174852:9;;:23;;;;;;;;;;;;;-1:-1:-1;;;;;174852:9:0;;;;:16;;:23;;;;;;;;;;;;;;;:9;;:23;;;5:2:-1;;;;30:1;27;20:12;5:2;174852:23:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;174852:23:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;174852:23:0;174911:9;;:40;;;;;;-1:-1:-1;;174911:40:0;;;;;;;;174852:23;;-1:-1:-1;;;;;;174911:9:0;;;;:16;;:40;;;;;174852:23;;174911:40;;;;;;;;:9;;:40;;;5:2:-1;;;;30:1;27;20:12;5:2;174911:40:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;174911:40:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;174911:40:0;175223:37;;;;;;155536:42;175223:37;;;;;;;;;;;;174911:40;;-1:-1:-1;;;;;;175223:13:0;;;;;:37;;;;;-1:-1:-1;;175223:37:0;;;;;;;;-1:-1:-1;175223:13:0;:37;;;5:2:-1;;;;30:1;27;20:12;5:2;175223:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;175364:9:0;;:66;;;;;;;;;;;;;;;;;-1:-1:-1;;175364:66:0;;;;;;;;-1:-1:-1;;;;;175364:9:0;;;;-1:-1:-1;175364:24:0;;-1:-1:-1;175364:66:0;;;;;;;;;;;;;;;:9;;:66;;;5:2:-1;;;;30:1;27;20:12;5:2;175364:66:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;175364:66:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;175364:66:0;175554:50;;;;;;-1:-1:-1;;;;;175554:50:0;;;;;;;;;;;;;;;175364:66;;-1:-1:-1;175554:22:0;;;;;;:50;;;;;-1:-1:-1;;175554:50:0;;;;;;;;-1:-1:-1;175554:22:0;:50;;;5:2:-1;;;;30:1;27;20:12;5:2;175554:50:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;175786:86:0;;;;;;155536:42;175786:86;;;;-1:-1:-1;;;;;175786:86:0;;;;;;;;;;;;;;;:45;;;;-1:-1:-1;175786:45:0;;-1:-1:-1;175786:86:0;;;;;-1:-1:-1;;175786:86:0;;;;;;;;-1:-1:-1;175786:45:0;:86;;;5:2:-1;;;;30:1;27;20:12;5:2;175786:86:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;175786:86:0;;;;174393:1487;;;;;;;:::o;172346:1733::-;172428:4;172519:9;172428:4;172808:21;172428:4;;172794:1250;156366:1;172831:21;;172794:1250;;;172894:79;172938:16;172955:1;172938:19;;;;;;;;;;:34;;;172894:16;172911:1;172894:19;;;;;;;;;;;;:39;;;:43;;:79;;;;:::i;:::-;172874:99;;173009:1;172994:12;:16;172990:1043;;;173182:19;173167:12;:34;:71;;173219:19;173167:71;;;173204:12;173167:71;173145:93;-1:-1:-1;173296:54:0;173145:93;173296:16;173313:1;173296:19;;;;;;;;;;:34;;;:38;;:54;;;;:::i;:::-;173259:16;173276:1;173259:19;;;;;;;;;;:34;;:91;;;;173391:39;173415:14;173391:19;:23;;:39;;;;:::i;:::-;173369:61;-1:-1:-1;173462:30:0;:10;173477:14;173462:30;:14;:30;:::i;:::-;173449:43;-1:-1:-1;173603:24:0;;173599:47;;;173636:10;173629:17;;;;173599:47;173917:6;;:33;;;;;173949:1;173927:19;:23;173917:33;173913:105;;;173997:1;173975:23;;173913:105;-1:-1:-1;;172854:3:0;;;;172794:1250;;176089:602;176184:7;-1:-1:-1;;;;;190908:22:0;;155536:42;190908:22;;190900:58;;;;;-1:-1:-1;;;;;;;;;;;190900:58:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;176217:21:0;;;;176209:52;;;;;-1:-1:-1;;;;;;;;;;;176209:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;176280:24:0;;176299:4;176280:24;;176272:67;;;;;-1:-1:-1;;;;;;;;;;;176272:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;176377:5;;-1:-1:-1;;;;;176358:25:0;;;176377:5;;176358:25;;176350:65;;;;;-1:-1:-1;;;;;;;;;;;176350:65:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;176453:9;;-1:-1:-1;;;;;176434:29:0;;;176453:9;;176434:29;;176426:73;;;;;-1:-1:-1;;;;;;;;;;;176426:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;176632:12;;:51;;;;;;-1:-1:-1;;;;;176632:51:0;;;;;;;;;;;;;;;:12;;;;;:31;;:51;;;;;:12;;:51;;;;;;;:12;;:51;;;5:2:-1;;;;30:1;27;20:12;5:2;176632:51:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;176632:51:0;;;;176089:602;;;:::o;192962:187::-;193057:5;;193069:42;;;-1:-1:-1;;;;;193069:42:0;;;;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;193069:42:0;;;;;;192906:49;;;;;;;;;;;;;;;;;;;193057:84;;;:5;192906:49;193057:84;;;;;;;;;;;-1:-1:-1;193057:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:5;;;;;:11;;193069:42;193057:5;;192906:49;;-1:-1:-1;;;;;;193057:84:0;;;;;;;;;;;;-1:-1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;193057:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;24447:330:0;24538:4;24589:45;24584:51;;24677:1;24671:2;24652:21;;:26;24648:81;;24715:2;24695:22;24648:81;24767:2;24748:21;;;;-1:-1:-1;;24447:330:0:o;14697:393::-;14755:7;;14983:6;;14979:37;;;15007:1;15000:8;;;;14979:37;-1:-1:-1;15036:5:0;;;15040:1;15036;:5;15056;;;;;;;;:10;15048:19;;;;;15205:276;15263:7;;15287:5;;;15279:14;;;;;;15374:1;15370;:5;;;;;;;;;15205:276;-1:-1:-1;;;;15205:276:0:o;22613:326::-;22727:4;;22771:32;22801:1;22771:25;:1;22793:2;22777:18;;22771:25;:5;:25;:::i;:32::-;22749:54;-1:-1:-1;22843:1:0;22837:2;22749:54;22820:19;;:24;22816:77;;22879:2;22861:20;22816:77;22929:2;22912:19;;;;-1:-1:-1;;;;22613:326:0:o;19578:419::-;19694:4;;19852:2;19836:13;:18;19824:8;:1;19830;19824:8;:5;:8;:::i;:::-;:31;;;;;;;;;-1:-1:-1;19897:1:0;19891:2;19824:31;19872:21;;154413:38739;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;105:10:-1;154413:38739:0;88:34:-1;-1:-1;154413:38739:0;;;-1:-1:-1;;154413:38739:0:o

Swarm Source

bzzr://9f722499b8c471c72044deefbb62f60a0f851d8b6b6a3fe0a1db889e06bb9bf1

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 address for Synthetix: Fee Pool contract.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.