Feature Tip: Add private address tag to any address under My Name Tag !
Synthetix: Synth SNX contract has migrated to a new address.
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 15 from a total of 15 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Escrow | 6839909 | 2104 days ago | IN | 0 ETH | 0.00060569 | ||||
Nominate New Own... | 6839792 | 2104 days ago | IN | 0 ETH | 0.00044738 | ||||
Add Synth | 6839676 | 2104 days ago | IN | 0 ETH | 0.00108789 | ||||
Add Synth | 6839671 | 2104 days ago | IN | 0 ETH | 0.00108789 | ||||
Add Synth | 6839667 | 2104 days ago | IN | 0 ETH | 0.00108789 | ||||
Add Synth | 6839653 | 2104 days ago | IN | 0 ETH | 0.00108789 | ||||
Add Synth | 6839644 | 2104 days ago | IN | 0 ETH | 0.00108725 | ||||
Remove Synth | 6839635 | 2104 days ago | IN | 0 ETH | 0.00040431 | ||||
Add Synth | 6839624 | 2104 days ago | IN | 0 ETH | 0.00108789 | ||||
Add Synth | 6839570 | 2104 days ago | IN | 0 ETH | 0.00098891 | ||||
Set Synthetix St... | 6839417 | 2104 days ago | IN | 0 ETH | 0.00054497 | ||||
Set Proxy | 6839413 | 2104 days ago | IN | 0 ETH | 0.00030586 | ||||
Set Proxy | 6839396 | 2104 days ago | IN | 0 ETH | 0.00030284 | ||||
Set Synthetix St... | 6836126 | 2105 days ago | IN | 0 ETH | 0.00026605 | ||||
0x60806040 | 6834865 | 2105 days ago | IN | 0 ETH | 0.09557125 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Synthetix
Compiler Version
v0.4.25+commit.59dbf8f1
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-12-06 */ /* =============================================== * Flattened with Solidifier by Coinage * * https://solidifier.coina.ge * =============================================== */ /* ----------------------------------------------------------------- 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; /* 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 setMessageSender(address sender) external onlyProxy { messageSender = sender; } modifier onlyProxy { require(Proxy(msg.sender) == proxy, "Only the proxy can call this function"); _; } modifier optionalProxy { if (Proxy(msg.sender) != proxy) { messageSender = msg.sender; } _; } modifier optionalProxy_onlyOwner { if (Proxy(msg.sender) != proxy) { messageSender = msg.sender; } require(messageSender == owner, "This action can only be performed by the owner"); _; } 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 the zero address"); 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 the zero address"); 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 has not yet been initiated"); require(initiationTime + SELFDESTRUCT_DELAY < now, "Self destruct delay has not yet elapsed"); 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 underlying contract"); require(to != address(proxy), "Cannot transfer to the proxy contract"); // 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: 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 ========== */ FeePool 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, FeePool _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(FeePool _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 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); } } /* ----------------------------------------------------------------- FILE INFORMATION ----------------------------------------------------------------- file: FeePool.sol version: 1.0 author: Kevin Brown 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 each transaction, 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 6 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 month. 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 { using SafeMath for uint; using SafeDecimalMath for uint; Synthetix public synthetix; // 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 fees. address public feeAuthority; // 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; } // The last 6 fee periods are all that you can claim from. // These are stored and managed from [0], such that [0] is always // the most recent fee period, and [5] is always the oldest fee // period that users can claim for. uint8 constant public FEE_PERIOD_LENGTH = 6; FeePeriod[FEE_PERIOD_LENGTH] public recentFeePeriods; // The next fee period will have this ID. uint public nextFeePeriodId; // 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; // The last period a user has withdrawn their fees in, identified by the feePeriodId mapping(address => uint) public lastFeeWithdrawal; // Users receive penalties if their collateralisation ratio drifts out of our desired brackets // We precompute the brackets and penalties to save gas. uint constant TWENTY_PERCENT = (20 * SafeDecimalMath.unit()) / 100; uint constant TWENTY_FIVE_PERCENT = (25 * SafeDecimalMath.unit()) / 100; uint constant THIRTY_PERCENT = (30 * SafeDecimalMath.unit()) / 100; uint constant FOURTY_PERCENT = (40 * SafeDecimalMath.unit()) / 100; uint constant FIFTY_PERCENT = (50 * SafeDecimalMath.unit()) / 100; uint constant SEVENTY_FIVE_PERCENT = (75 * SafeDecimalMath.unit()) / 100; constructor(address _proxy, address _owner, Synthetix _synthetix, address _feeAuthority, uint _transferFeeRate, uint _exchangeFeeRate) SelfDestructible(_owner) Proxyable(_proxy, _owner) public { // Constructed fee rates should respect the maximum fee rates. require(_transferFeeRate <= MAX_TRANSFER_FEE_RATE, "Constructed transfer fee rate should respect the maximum fee rate"); require(_exchangeFeeRate <= MAX_EXCHANGE_FEE_RATE, "Constructed exchange fee rate should respect the maximum fee rate"); synthetix = _synthetix; feeAuthority = _feeAuthority; transferFeeRate = _transferFeeRate; exchangeFeeRate = _exchangeFeeRate; // Set our initial fee period recentFeePeriods[0].feePeriodId = 1; recentFeePeriods[0].startTime = now; // Gas optimisation: These do not need to be initialised. They start at 0. // recentFeePeriods[0].startingDebtIndex = 0; // recentFeePeriods[0].feesToDistribute = 0; // And the next one starts at 2. nextFeePeriodId = 2; } /** * @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 { require(_exchangeFeeRate <= MAX_EXCHANGE_FEE_RATE, "Exchange fee rate must be below MAX_EXCHANGE_FEE_RATE"); exchangeFeeRate = _exchangeFeeRate; emitExchangeFeeUpdated(_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 must be below MAX_TRANSFER_FEE_RATE"); transferFeeRate = _transferFeeRate; emitTransferFeeUpdated(_transferFeeRate); } /** * @notice Set the address of the user/contract responsible for collecting or * distributing fees. */ function setFeeAuthority(address _feeAuthority) external optionalProxy_onlyOwner { feeAuthority = _feeAuthority; emitFeeAuthorityUpdated(_feeAuthority); } /** * @notice Set the fee period duration */ function setFeePeriodDuration(uint _feePeriodDuration) external optionalProxy_onlyOwner { require(_feePeriodDuration >= MIN_FEE_PERIOD_DURATION, "New fee period cannot be less than minimum fee period duration"); require(_feePeriodDuration <= MAX_FEE_PERIOD_DURATION, "New fee period cannot be greater than maximum 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; emitSynthetixUpdated(_synthetix); } /** * @notice The Synthetix contract informs us when fees are paid. */ function feePaid(bytes4 currencyKey, uint amount) external onlySynthetix { uint xdrAmount = synthetix.effectiveValue(currencyKey, amount, "XDR"); // Which we keep track of in XDRs in our fee pool. recentFeePeriods[0].feesToDistribute = recentFeePeriods[0].feesToDistribute.add(xdrAmount); } /** * @notice Close the current fee period and start a new one. Only callable by the fee authority. */ function closeCurrentFeePeriod() external onlyFeeAuthority { require(recentFeePeriods[0].startTime <= (now - feePeriodDuration), "It is too early to close the current 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); // 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; } // 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 recentFeePeriods[0].feePeriodId = nextFeePeriodId; recentFeePeriods[0].startingDebtIndex = synthetix.synthetixState().debtLedgerLength(); recentFeePeriods[0].startTime = now; nextFeePeriodId = nextFeePeriodId.add(1); 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) { uint availableFees = feesAvailable(messageSender, "XDR"); require(availableFees > 0, "No fees available for period, or fees already claimed"); lastFeeWithdrawal[messageSender] = recentFeePeriods[1].feePeriodId; // Record the fee payment in our recentFeePeriods _recordFeePayment(availableFees); // Send them their fees _payFees(messageSender, availableFees, currencyKey); emitFeesClaimed(messageSender, availableFees); return true; } /** * @notice Record the fee payment in our recentFeePeriods. * @param xdrAmount The amout of fees priced in XDRs. */ function _recordFeePayment(uint xdrAmount) internal { // Don't assign to the parameter uint remainingToAllocate = xdrAmount; // 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); // No need to continue iterating if we've recorded the whole amount; if (remainingToAllocate == 0) return; } } // If we hit this line, we've exhausted our fee periods, but still have more to allocate. Wat? // If this happens it's a definite bug in the code, so assert instead of require. assert(remainingToAllocate == 0); } /** * @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 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.divideDecimal(exchangeFeeRate.add(SafeDecimalMath.unit())); } /** * @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 fees available to be withdrawn by a specific account, priced in currencyKey currency * @param currencyKey The currency you want to price the fees in */ function feesAvailable(address account, bytes4 currencyKey) public view returns (uint) { // Add up the fees uint[FEE_PERIOD_LENGTH] memory userFees = feesByPeriod(account); 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(userFees[i]); } // And convert them to their desired currency return synthetix.effectiveValue("XDR", totalFees, currencyKey); } /** * @notice The penalty a particular address would incur if its fees were withdrawn right now * @param account The address you want to query the penalty for */ function currentPenalty(address account) public view returns (uint) { uint ratio = synthetix.collateralisationRatio(account); // Users receive a different amount of fees depending on how their collateralisation ratio looks right now. // 0% - 20%: Fee is calculated based on percentage of economy issued. // 20% - 30%: 25% reduction in fees // 30% - 40%: 50% reduction in fees // >40%: 75% reduction in fees if (ratio <= TWENTY_PERCENT) { return 0; } else if (ratio > TWENTY_PERCENT && ratio <= THIRTY_PERCENT) { return TWENTY_FIVE_PERCENT; } else if (ratio > THIRTY_PERCENT && ratio <= FOURTY_PERCENT) { return FIFTY_PERCENT; } return SEVENTY_FIVE_PERCENT; } /** * @notice Calculates fees by period for an account, priced in XDRs * @param account The address you want to query the fees by penalty for */ function feesByPeriod(address account) public view returns (uint[FEE_PERIOD_LENGTH]) { uint[FEE_PERIOD_LENGTH] memory result; // What's the user's debt entry index and the debt they owe to the system uint initialDebtOwnership; uint debtEntryIndex; (initialDebtOwnership, debtEntryIndex) = synthetix.synthetixState().issuanceData(account); // If they don't have any debt ownership, they don't have any fees if (initialDebtOwnership == 0) return result; // If there are no XDR synths, then they don't have any fees uint totalSynths = synthetix.totalIssuedSynths("XDR"); if (totalSynths == 0) return result; uint debtBalance = synthetix.debtBalanceOf(account, "XDR"); uint userOwnershipPercentage = debtBalance.divideDecimal(totalSynths); uint penalty = currentPenalty(account); // Go through our fee periods and figure out what we owe them. // 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. for (uint i = 0; i < FEE_PERIOD_LENGTH; i++) { // Were they a part of this period in its entirety? // We don't allow pro-rata participation to reduce the ability to game the system by // issuing and burning multiple times in a period or close to the ends of periods. if (recentFeePeriods[i].startingDebtIndex > debtEntryIndex && lastFeeWithdrawal[account] < recentFeePeriods[i].feePeriodId) { // And since they were, they're entitled to their percentage of the fees in this period uint feesFromPeriodWithoutPenalty = recentFeePeriods[i].feesToDistribute .multiplyDecimal(userOwnershipPercentage); // Less their penalty if they have one. uint penaltyFromPeriod = feesFromPeriodWithoutPenalty.multiplyDecimal(penalty); uint feesFromPeriod = feesFromPeriodWithoutPenalty.sub(penaltyFromPeriod); result[i] = feesFromPeriod; } } return result; } modifier onlyFeeAuthority { require(msg.sender == feeAuthority, "Only the fee authority can perform this action"); _; } modifier onlySynthetix { require(msg.sender == address(synthetix), "Only the synthetix contract can perform this action"); _; } modifier notFeeAddress(address account) { require(account != FEE_ADDRESS, "Fee address not allowed"); _; } 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 FeeAuthorityUpdated(address newFeeAuthority); bytes32 constant FEEAUTHORITYUPDATED_SIG = keccak256("FeeAuthorityUpdated(address)"); function emitFeeAuthorityUpdated(address newFeeAuthority) internal { proxy._emit(abi.encode(newFeeAuthority), 1, FEEAUTHORITYUPDATED_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); bytes32 constant FEESCLAIMED_SIG = keccak256("FeesClaimed(address,uint256)"); function emitFeesClaimed(address account, uint xdrAmount) internal { proxy._emit(abi.encode(account, xdrAmount), 1, FEESCLAIMED_SIG, 0, 0, 0); } 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); } } /* ----------------------------------------------------------------- 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: SynthetixEscrow.sol version: 1.1 author: Anton Jurisevic Dominic Romanowski Mike Spain date: 2018-05-29 ----------------------------------------------------------------- MODULE DESCRIPTION ----------------------------------------------------------------- This contract allows the foundation to apply unique vesting schedules to synthetix funds sold at various discounts in the token sale. SynthetixEscrow gives users the ability to inspect their vested funds, their quantities and vesting dates, and to withdraw the fees that accrue on those funds. The fees are handled by withdrawing the entire fee allocation for all SNX inside the escrow contract, and then allowing the contract itself to subdivide that pool up proportionally within itself. Every time the fee period rolls over in the main Synthetix contract, the SynthetixEscrow fee pool is remitted back into the main fee pool to be redistributed in the next fee period. ----------------------------------------------------------------- */ /** * @title A contract to hold escrowed SNX and free them at given schedules. */ contract SynthetixEscrow is Owned, LimitedSetup(8 weeks) { using SafeMath for uint; /* The corresponding Synthetix contract. */ Synthetix public synthetix; /* Lists of (timestamp, quantity) pairs per account, sorted in ascending time order. * These are the times at which each given quantity of SNX vests. */ mapping(address => uint[2][]) public vestingSchedules; /* An account's total vested synthetix balance to save recomputing this for fee extraction purposes. */ mapping(address => uint) public totalVestedAccountBalance; /* The total remaining vested balance, for verifying the actual synthetix balance of this contract against. */ uint public totalVestedBalance; uint constant TIME_INDEX = 0; uint constant QUANTITY_INDEX = 1; /* Limit vesting entries to disallow unbounded iteration over vesting schedules. */ uint constant MAX_VESTING_ENTRIES = 20; /* ========== CONSTRUCTOR ========== */ constructor(address _owner, Synthetix _synthetix) Owned(_owner) public { synthetix = _synthetix; } /* ========== SETTERS ========== */ function setSynthetix(Synthetix _synthetix) external onlyOwner { synthetix = _synthetix; emit SynthetixUpdated(_synthetix); } /* ========== VIEW FUNCTIONS ========== */ /** * @notice A simple alias to totalVestedAccountBalance: provides ERC20 balance integration. */ function balanceOf(address account) public view returns (uint) { return totalVestedAccountBalance[account]; } /** * @notice The number of vesting dates in an account's schedule. */ function numVestingEntries(address account) public view returns (uint) { return vestingSchedules[account].length; } /** * @notice Get a particular schedule entry for an account. * @return A pair of uints: (timestamp, synthetix quantity). */ function getVestingScheduleEntry(address account, uint index) public view returns (uint[2]) { return vestingSchedules[account][index]; } /** * @notice Get the time at which a given schedule entry will vest. */ function getVestingTime(address account, uint index) public view returns (uint) { return getVestingScheduleEntry(account,index)[TIME_INDEX]; } /** * @notice Get the quantity of SNX associated with a given schedule entry. */ function getVestingQuantity(address account, uint index) public view returns (uint) { return getVestingScheduleEntry(account,index)[QUANTITY_INDEX]; } /** * @notice Obtain the index of the next schedule entry that will vest for a given user. */ function getNextVestingIndex(address account) public view returns (uint) { uint len = numVestingEntries(account); for (uint i = 0; i < len; i++) { if (getVestingTime(account, i) != 0) { return i; } } return len; } /** * @notice Obtain the next schedule entry that will vest for a given user. * @return A pair of uints: (timestamp, synthetix quantity). */ function getNextVestingEntry(address account) public view returns (uint[2]) { uint index = getNextVestingIndex(account); if (index == numVestingEntries(account)) { return [uint(0), 0]; } return getVestingScheduleEntry(account, index); } /** * @notice Obtain the time at which the next schedule entry will vest for a given user. */ function getNextVestingTime(address account) external view returns (uint) { return getNextVestingEntry(account)[TIME_INDEX]; } /** * @notice Obtain the quantity which the next schedule entry will vest for a given user. */ function getNextVestingQuantity(address account) external view returns (uint) { return getNextVestingEntry(account)[QUANTITY_INDEX]; } /* ========== MUTATIVE FUNCTIONS ========== */ /** * @notice Withdraws a quantity of SNX back to the synthetix contract. * @dev This may only be called by the owner during the contract's setup period. */ function withdrawSynthetix(uint quantity) external onlyOwner onlyDuringSetup { synthetix.transfer(synthetix, quantity); } /** * @notice Destroy the vesting information associated with an account. */ function purgeAccount(address account) external onlyOwner onlyDuringSetup { delete vestingSchedules[account]; totalVestedBalance = totalVestedBalance.sub(totalVestedAccountBalance[account]); delete totalVestedAccountBalance[account]; } /** * @notice Add a new vesting entry at a given time and quantity to an account's schedule. * @dev A call to this should be accompanied by either enough balance already available * in this contract, or a corresponding call to synthetix.endow(), to ensure that when * the funds are withdrawn, there is enough balance, as well as correctly calculating * the fees. * This may only be called by the owner during the contract's setup period. * Note; although this function could technically be used to produce unbounded * arrays, it's only in the foundation's command to add to these lists. * @param account The account to append a new vesting entry to. * @param time The absolute unix timestamp after which the vested quantity may be withdrawn. * @param quantity The quantity of SNX that will vest. */ function appendVestingEntry(address account, uint time, uint quantity) public onlyOwner onlyDuringSetup { /* No empty or already-passed vesting entries allowed. */ require(now < time, "Time must be in the future"); require(quantity != 0, "Quantity cannot be zero"); /* There must be enough balance in the contract to provide for the vesting entry. */ totalVestedBalance = totalVestedBalance.add(quantity); require(totalVestedBalance <= synthetix.balanceOf(this), "Must be enough balance in the contract to provide for the vesting entry"); /* Disallow arbitrarily long vesting schedules in light of the gas limit. */ uint scheduleLength = vestingSchedules[account].length; require(scheduleLength <= MAX_VESTING_ENTRIES, "Vesting schedule is too long"); if (scheduleLength == 0) { totalVestedAccountBalance[account] = quantity; } else { /* Disallow adding new vested SNX earlier than the last one. * Since entries are only appended, this means that no vesting date can be repeated. */ require(getVestingTime(account, numVestingEntries(account) - 1) < time, "Cannot add new vested entries earlier than the last one"); totalVestedAccountBalance[account] = totalVestedAccountBalance[account].add(quantity); } vestingSchedules[account].push([time, quantity]); } /** * @notice Construct a vesting schedule to release a quantities of SNX * over a series of intervals. * @dev Assumes that the quantities are nonzero * and that the sequence of timestamps is strictly increasing. * This may only be called by the owner during the contract's setup period. */ function addVestingSchedule(address account, uint[] times, uint[] quantities) external onlyOwner onlyDuringSetup { for (uint i = 0; i < times.length; i++) { appendVestingEntry(account, times[i], quantities[i]); } } /** * @notice Allow a user to withdraw any SNX in their schedule that have vested. */ function vest() external { uint numEntries = numVestingEntries(msg.sender); uint total; for (uint i = 0; i < numEntries; i++) { uint time = getVestingTime(msg.sender, i); /* The list is sorted; when we reach the first future time, bail out. */ if (time > now) { break; } uint qty = getVestingQuantity(msg.sender, i); if (qty == 0) { continue; } vestingSchedules[msg.sender][i] = [0, 0]; total = total.add(qty); } if (total != 0) { totalVestedBalance = totalVestedBalance.sub(total); totalVestedAccountBalance[msg.sender] = totalVestedAccountBalance[msg.sender].sub(total); synthetix.transfer(msg.sender, total); emit Vested(msg.sender, now, total); } } /* ========== EVENTS ========== */ event SynthetixUpdated(address newSynthetix); event Vested(address indexed beneficiary, uint time, uint value); } /* ----------------------------------------------------------------- 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; // 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 of all issued synths of the system (priced in XDRs)? uint totalDebtIssued = synthetix.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 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); } /* ----------------------------------------------------------------- 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; // 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; // 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; // // ========== 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]]) { // 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); return true; } /** * @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); } /* ========== VIEWS ========== */ /** * @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) external 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 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 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); } /* ----------------------------------------------------------------- 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; FeePool public feePool; SynthetixEscrow public escrow; ExchangeRates public exchangeRates; SynthetixState public synthetixState; uint constant SYNTHETIX_SUPPLY = 1e8 * SafeDecimalMath.unit(); string constant TOKEN_NAME = "Synthetix Network Token"; string constant TOKEN_SYMBOL = "SNX"; uint8 constant DECIMALS = 18; // ========== 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, FeePool _feePool ) ExternStateToken(_proxy, _tokenState, TOKEN_NAME, TOKEN_SYMBOL, SYNTHETIX_SUPPLY, DECIMALS, _owner) public { synthetixState = _synthetixState; exchangeRates = _exchangeRates; feePool = _feePool; } // ========== SETTERS ========== */ /** * @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; emitSynthAdded(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]; emitSynthRemoved(currencyKey, synthToRemove); } /** * @notice Set the associated synthetix escrow contract. * @dev Only the contract owner may call this. */ function setEscrow(SynthetixEscrow _escrow) external optionalProxy_onlyOwner { escrow = _escrow; // 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. } /** * @notice Set the ExchangeRates contract address where rates are held. * @dev Only callable by the contract owner. */ function setExchangeRates(ExchangeRates _exchangeRates) external optionalProxy_onlyOwner { exchangeRates = _exchangeRates; // 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. } /** * @notice Set the synthetixState contract address where issuance data is held. * @dev Only callable by the contract owner. */ function setSynthetixState(SynthetixState _synthetixState) external optionalProxy_onlyOwner { synthetixState = _synthetixState; emitStateContractChanged(_synthetixState); } /** * @notice Set your preferred currency. Note: This does not automatically exchange any balances you've held previously in * other synth currencies in this address, it will apply for any new payments you receive at this address. */ function setPreferredCurrency(bytes4 currencyKey) external optionalProxy { require(currencyKey == 0 || !exchangeRates.rateIsStale(currencyKey), "Currency rate is stale or doesn't exist."); synthetixState.setPreferredCurrency(messageSender, currencyKey); emitPreferredCurrencyChanged(messageSender, currencyKey); } // ========== 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(exchangeRates.rateForCurrency(sourceCurrencyKey)) .divideDecimalRound(exchangeRates.rateForCurrency(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); for (uint8 i = 0; i < availableSynths.length; i++) { // Ensure the rate isn't stale. // TODO: Investigate gas cost optimisation of doing a single call with all keys in it vs // individual calls like this. require(!exchangeRates.rateIsStale(availableSynths[i].currencyKey()), "Rate is stale"); // 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 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 Where the result should go. If this is address(0) then it sends back to the message sender. * @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, "Exchange must use different synths"); require(sourceAmount > 0, "Zero amount"); // Pass it along, defaulting to the sender as the recipient. return _internalExchange( messageSender, sourceCurrencyKey, sourceAmount, destinationCurrencyKey, destinationAddress == address(0) ? messageSender : destinationAddress, 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 onlySynth returns (bool) { 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 onlySynth returns (bool) { 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(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); } // 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); // Gas optimisation: // No event emitted as it's assumed users will be able to track transfers to the zero address, followed // by a transfer on another synth from the zero address and ascertain the info required here. 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 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 nonZeroAmount(amount) // 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); } /** * @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 */ function burnSynths(bytes4 currencyKey, uint amount) external optionalProxy // No need to check for stale rates as _removeFromDebtRegister calls effectiveValue // which does this for us { // How much debt do they have? uint debt = 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 amountToBurn = debt < amount ? debt : amount; // Remove their debt from the ledger _removeFromDebtRegister(currencyKey, amountToBurn); // synth.burn does a safe subtraction on balance (so it will revert if there are not enough synths). synths[currencyKey].burn(messageSender, amountToBurn); } /** * @notice Remove a debt position from the register * @param currencyKey The currency the user is presenting to forgive their debt * @param amount The amount (in UNIT base) being presented */ function _removeFromDebtRegister(bytes4 currencyKey, uint amount) internal { // How much debt are they trying to remove in XDRs? uint debtToRemove = effectiveValue(currencyKey, amount, "XDR"); // How much debt do they have? uint existingDebt = debtBalanceOf(messageSender, "XDR"); // What percentage of the total debt are they trying to remove? uint totalDebtIssued = totalIssuedSynths("XDR"); uint debtPercentage = debtToRemove.divideDecimalRoundPrecise(totalDebtIssued); // 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. uint delta = SafeDecimalMath.preciseUnit().add(debtPercentage); // Are they exiting the system, or are they just decreasing their debt position? if (debtToRemove == existingDebt) { synthetixState.clearIssuanceData(messageSender); synthetixState.decrementTotalIssuerCount(); } else { // What percentage of the debt will they be left with? uint newDebt = existingDebt.sub(debtToRemove); uint newTotalDebtIssued = totalDebtIssued.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)); } 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); } } // ========== MODIFIERS ========== modifier rateNotStale(bytes4 currencyKey) { require(!exchangeRates.rateIsStale(currencyKey), "Rate stale or nonexistant currency"); _; } modifier notFeeAddress(address account) { require(account != feePool.FEE_ADDRESS(), "Fee address not allowed"); _; } modifier onlySynth() { 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 nonZeroAmount(uint _amount) { require(_amount > 0, "Amount needs to be larger than 0"); _; } // ========== EVENTS ========== event PreferredCurrencyChanged(address indexed account, bytes4 newPreferredCurrency); bytes32 constant PREFERREDCURRENCYCHANGED_SIG = keccak256("PreferredCurrencyChanged(address,bytes4)"); function emitPreferredCurrencyChanged(address account, bytes4 newPreferredCurrency) internal { proxy._emit(abi.encode(newPreferredCurrency), 2, PREFERREDCURRENCYCHANGED_SIG, bytes32(account), 0, 0); } event StateContractChanged(address stateContract); bytes32 constant STATECONTRACTCHANGED_SIG = keccak256("StateContractChanged(address)"); function emitStateContractChanged(address stateContract) internal { proxy._emit(abi.encode(stateContract), 1, STATECONTRACTCHANGED_SIG, 0, 0, 0); } event SynthAdded(bytes4 currencyKey, address newSynth); bytes32 constant SYNTHADDED_SIG = keccak256("SynthAdded(bytes4,address)"); function emitSynthAdded(bytes4 currencyKey, address newSynth) internal { proxy._emit(abi.encode(currencyKey, newSynth), 1, SYNTHADDED_SIG, 0, 0, 0); } event SynthRemoved(bytes4 currencyKey, address removedSynth); bytes32 constant SYNTHREMOVED_SIG = keccak256("SynthRemoved(bytes4,address)"); function emitSynthRemoved(bytes4 currencyKey, address removedSynth) internal { proxy._emit(abi.encode(currencyKey, removedSynth), 1, SYNTHREMOVED_SIG, 0, 0, 0); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initiationTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"}],"name":"setSelfDestructBeneficiary","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"},{"name":"currencyKey","type":"bytes4"}],"name":"debtBalanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"terminateSelfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"sourceCurrencyKey","type":"bytes4"},{"name":"sourceAmount","type":"uint256"},{"name":"destinationCurrencyKey","type":"bytes4"}],"name":"effectiveValue","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"currencyKey","type":"bytes4"}],"name":"totalIssuedSynths","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sourceCurrencyKey","type":"bytes4"},{"name":"sourceAmount","type":"uint256"},{"name":"destinationCurrencyKey","type":"bytes4"},{"name":"destinationAddress","type":"address"}],"name":"exchange","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes4"},{"name":"amount","type":"uint256"}],"name":"issueSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRates","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes4"}],"name":"synths","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_exchangeRates","type":"address"}],"name":"setExchangeRates","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"transferableSynthetix","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"},{"name":"currencyKey","type":"bytes4"}],"name":"maxIssuableSynths","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"availableSynths","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"synth","type":"address"}],"name":"addSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes4"}],"name":"removeSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"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":false,"inputs":[{"name":"_tokenState","type":"address"}],"name":"setTokenState","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"},{"name":"currencyKey","type":"bytes4"}],"name":"remainingIssuableSynths","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes4"}],"name":"issueMaxSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes4"}],"name":"setPreferredCurrency","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_synthetixState","type":"address"}],"name":"setSynthetixState","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"issuer","type":"address"}],"name":"collateralisationRatio","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SELFDESTRUCT_DELAY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"collateral","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feePool","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"currencyKey","type":"bytes4"},{"name":"amount","type":"uint256"}],"name":"burnSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"selfDestructInitiated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"}],"name":"setMessageSender","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"initiateSelfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"sourceCurrencyKey","type":"bytes4"},{"name":"sourceAmount","type":"uint256"},{"name":"destinationCurrencyKey","type":"bytes4"},{"name":"destinationAddress","type":"address"}],"name":"synthInitiatedExchange","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"},{"name":"data","type":"bytes"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"sourceCurrencyKey","type":"bytes4"},{"name":"sourceAmount","type":"uint256"}],"name":"synthInitiatedFeePayment","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_escrow","type":"address"}],"name":"setEscrow","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"selfDestructBeneficiary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"synthetixState","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableSynthCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"escrow","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenState","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proxy","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_proxy","type":"address"},{"name":"_tokenState","type":"address"},{"name":"_synthetixState","type":"address"},{"name":"_owner","type":"address"},{"name":"_exchangeRates","type":"address"},{"name":"_feePool","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"},{"indexed":false,"name":"newPreferredCurrency","type":"bytes4"}],"name":"PreferredCurrencyChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"stateContract","type":"address"}],"name":"StateContractChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"currencyKey","type":"bytes4"},{"indexed":false,"name":"newSynth","type":"address"}],"name":"SynthAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"currencyKey","type":"bytes4"},{"indexed":false,"name":"removedSynth","type":"address"}],"name":"SynthRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newTokenState","type":"address"}],"name":"TokenStateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"proxyAddress","type":"address"}],"name":"ProxyUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"SelfDestructTerminated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"beneficiary","type":"address"}],"name":"SelfDestructed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"selfDestructDelay","type":"uint256"}],"name":"SelfDestructInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newBeneficiary","type":"address"}],"name":"SelfDestructBeneficiaryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldOwner","type":"address"},{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"}]
Contract Creation Code
60806040526005805460a060020a60ff02191690553480156200002157600080fd5b5060405160c08062005e158339810160408181528251602080850151838601516060870151608088015160a0909801518688018752601788527f53796e746865746978204e6574776f726b20546f6b656e0000000000000000008589015286518088018852600381527f534e5800000000000000000000000000000000000000000000000000000000008187015287517f907af6c000000000000000000000000000000000000000000000000000000000815297519699949893979296949591948a948a9490937384d626b2bb4d0f064067e4bf80fce7055d8f3e7b9263907af6c0926004808201939291829003018186803b1580156200012157600080fd5b505af415801562000136573d6000803e3d6000fd5b505050506040513d60208110156200014d57600080fd5b50516305f5e1000260128886818080600160a060020a0381161515620001d457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b60008054600160a060020a031916600160a060020a038316908117825560408051928352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150600160a060020a0381161515620002cb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4f776e6572206d757374206e6f7420626520746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60038054600160a060020a038316610100810261010060a860020a03199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a15060048054600160a060020a038416600160a060020a0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a1505060068054600160a060020a031916600160a060020a0388161790558451620003a890600790602088019062000426565b508351620003be90600890602087019062000426565b5050600991909155600a805460ff191660ff909216919091179055505060108054600160a060020a0319908116600160a060020a0398891617909155600f80548216958816959095179094555050600d805490921693169290921790915550620004cb915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200046957805160ff191683800117855562000499565b8280016001018555821562000499579182015b82811115620004995782518255916020019190600101906200047c565b50620004a7929150620004ab565b5090565b620004c891905b80821115620004a75760008155600101620004b2565b90565b61593a80620004db6000396000f3006080604052600436106102795763ffffffff60e060020a60003504166306fdde03811461027e578063095ea7b3146103085780631627540c1461034057806317c70de41461036357806318160ddd1461038a57806320714f881461039f57806323b872dd146103c0578063274ed288146103ea578063313ce567146104185780633278c9601461044357806339d66fc014610458578063403dca5514610484578063405d3adf146104a657806349755b9e146104de5780634ffcd9df14610503578063502b8bda1461053457806353a47bb71461055657806356e449541461056b5780636ac0bf9c1461058c57806370a08231146105ad57806379ba5097146105ce578063807d94a7146105e3578063835e119c14610611578063849cf5881461062957806384dcde971461064a5780638da5cb5b1461066c57806395d89b411461068157806397107d6d146106965780639cb8a26a146106b75780639f769807146106cc5780639f9f83dd146106ed5780639ff8c63f1461071b578063a08038be1461073d578063a2f3ba5b1461075f578063a311c7c214610780578063a461fc82146107a1578063a5fdc5de146107b6578063a9059cbb146107d7578063ab67aa58146107fb578063ae2e933b1461086a578063af0233351461087f578063b8225dec146108a4578063bc67f832146108b9578063bd32aa44146108da578063be0ecd32146108ef578063be45fd621461092e578063be57636414610997578063c10c3546146109c8578063c58aaae6146109e9578063dbd4a422146109fe578063dbf6334014610a13578063dd62ed3e14610a28578063e2fdcc1714610a4f578063e90dd9e214610a64578063ec55688914610a79575b600080fd5b34801561028a57600080fd5b50610293610a8e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102cd5781810151838201526020016102b5565b50505050905090810190601f1680156102fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561031457600080fd5b5061032c600160a060020a0360043516602435610b1c565b604080519115158252519081900360200190f35b34801561034c57600080fd5b50610361600160a060020a0360043516610bf2565b005b34801561036f57600080fd5b50610378610caa565b60408051918252519081900360200190f35b34801561039657600080fd5b50610378610cb0565b3480156103ab57600080fd5b50610361600160a060020a0360043516610cb6565b3480156103cc57600080fd5b5061032c600160a060020a0360043581169060243516604435610e09565b3480156103f657600080fd5b50610378600160a060020a0360043516600160e060020a031960243516610e22565b34801561042457600080fd5b5061042d61104e565b6040805160ff9092168252519081900360200190f35b34801561044f57600080fd5b50610361611057565b34801561046457600080fd5b50610378600160e060020a031960043581169060243590604435166110f5565b34801561049057600080fd5b50610378600160e060020a031960043516611422565b3480156104b257600080fd5b5061032c600160e060020a03196004358116906024359060443516600160a060020a0360643516611925565b3480156104ea57600080fd5b50610361600160e060020a031960043516602435611a6a565b34801561050f57600080fd5b50610518611bfd565b60408051600160a060020a039092168252519081900360200190f35b34801561054057600080fd5b50610518600160e060020a031960043516611c0c565b34801561056257600080fd5b50610518611c27565b34801561057757600080fd5b50610361600160a060020a0360043516611c36565b34801561059857600080fd5b50610378600160a060020a0360043516611ce7565b3480156105b957600080fd5b50610378600160a060020a0360043516611f18565b3480156105da57600080fd5b50610361611f9f565b3480156105ef57600080fd5b50610378600160a060020a0360043516600160e060020a03196024351661209a565b34801561061d57600080fd5b50610518600435612152565b34801561063557600080fd5b50610361600160a060020a036004351661217a565b34801561065657600080fd5b50610361600160e060020a03196004351661236c565b34801561067857600080fd5b5061051861272b565b34801561068d57600080fd5b5061029361273a565b3480156106a257600080fd5b50610361600160a060020a0360043516612795565b3480156106c357600080fd5b5061036161284d565b3480156106d857600080fd5b50610361600160a060020a0360043516612a12565b3480156106f957600080fd5b50610378600160a060020a0360043516600160e060020a031960243516612ac8565b34801561072757600080fd5b50610361600160e060020a031960043516612b10565b34801561074957600080fd5b50610361600160e060020a031960043516612b5a565b34801561076b57600080fd5b50610361600160a060020a0360043516612d3e565b34801561078c57600080fd5b50610378600160a060020a0360043516612df1565b3480156107ad57600080fd5b50610378612e40565b3480156107c257600080fd5b50610378600160a060020a0360043516612e47565b3480156107e357600080fd5b5061032c600160a060020a0360043516602435612f73565b34801561080757600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261032c94600160a060020a038135811695602480359092169560443595369560849401918190840183828082843750949750612f829650505050505050565b34801561087657600080fd5b5061051861302f565b34801561088b57600080fd5b50610361600160e060020a03196004351660243561303e565b3480156108b057600080fd5b5061032c613192565b3480156108c557600080fd5b50610361600160a060020a036004351661319b565b3480156108e657600080fd5b50610361613245565b3480156108fb57600080fd5b5061032c600160a060020a03600435811690600160e060020a0319602435811691604435916064351690608435166132f2565b34801561093a57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261032c948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506134739650505050505050565b3480156109a357600080fd5b5061032c600160a060020a0360043516600160e060020a03196024351660443561352a565b3480156109d457600080fd5b50610361600160a060020a036004351661375e565b3480156109f557600080fd5b5061051861380f565b348015610a0a57600080fd5b50610518613823565b348015610a1f57600080fd5b50610378613832565b348015610a3457600080fd5b50610378600160a060020a0360043581169060243516613839565b348015610a5b57600080fd5b506105186138df565b348015610a7057600080fd5b506105186138ee565b348015610a8557600080fd5b506105186138fd565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b145780601f10610ae957610100808354040283529160200191610b14565b820191906000526020600020905b815481529060010190602001808311610af757829003601f168201915b505050505081565b6004546000908190600160a060020a03163314610b465760058054600160a060020a031916331790555b50600554600654604080517fda46098c000000000000000000000000000000000000000000000000000000008152600160a060020a0393841660048201819052878516602483015260448201879052915191939092169163da46098c91606480830192600092919082900301818387803b158015610bc357600080fd5b505af1158015610bd7573d6000803e3d6000fd5b50505050610be681858561390c565b600191505b5092915050565b600054600160a060020a03163314610c56576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b60018054600160a060020a038316600160a060020a0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60025481565b60095481565b600054600160a060020a03163314610d1a576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b600160a060020a0381161515610da0576040805160e560020a62461bcd02815260206004820152602860248201527f42656e6566696369617279206d757374206e6f7420626520746865207a65726f60448201527f2061646472657373000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60038054600160a060020a038316610100810274ffffffffffffffffffffffffffffffffffffffff00199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a150565b60006060610e1985858584612f82565b95945050505050565b601054604080517f8b3f8088000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301528251600094859485948594859485949190911692638b3f8088926024808201939182900301818787803b158015610e9257600080fd5b505af1158015610ea6573d6000803e3d6000fd5b505050506040513d6040811015610ebc57600080fd5b5080516020909101519095509350841515610eda5760009550611043565b601054604080517f08d95cd500000000000000000000000000000000000000000000000000000000815260048101879052905161101b92889261100f92600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b158015610f4b57600080fd5b505af1158015610f5f573d6000803e3d6000fd5b505050506040513d6020811015610f7557600080fd5b5051601054604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916346317712916004808201926020929091908290030181600087803b158015610fd757600080fd5b505af1158015610feb573d6000803e3d6000fd5b505050506040513d602081101561100157600080fd5b50519063ffffffff613a6016565b9063ffffffff613a8016565b925061102687611422565b91506110358361100f84613a99565b905061104081613aaf565b95505b505050505092915050565b600a5460ff1681565b600054600160a060020a031633146110bb576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b600060028190556003805460ff191690556040517f6adcc7125002935e0aa31697538ebbd65cfddf20431eb6ecdcfc3e238bfd082c9190a1565b600f546040805160e060020a63ea3d4109028152600160e060020a03198616600482015290516000928692600160a060020a039091169163ea3d41099160248082019260209290919082900301818887803b15801561115357600080fd5b505af1158015611167573d6000803e3d6000fd5b505050506040513d602081101561117d57600080fd5b5051156111d0576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b600f546040805160e060020a63ea3d4109028152600160e060020a03198616600482015290518592600160a060020a03169163ea3d41099160248083019260209291908290030181600087803b15801561122957600080fd5b505af115801561123d573d6000803e3d6000fd5b505050506040513d602081101561125357600080fd5b5051156112a6576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b600160e060020a031986811690851614156112c357849250611419565b600f54604080517faf1ff972000000000000000000000000000000000000000000000000000000008152600160e060020a031987166004820152905161141692600160a060020a03169163af1ff9729160248083019260209291908290030181600087803b15801561133457600080fd5b505af1158015611348573d6000803e3d6000fd5b505050506040513d602081101561135e57600080fd5b5051600f54604080517faf1ff972000000000000000000000000000000000000000000000000000000008152600160e060020a03198b166004820152905161140a92600160a060020a03169163af1ff9729160248083019260209291908290030181600087803b1580156113d157600080fd5b505af11580156113e5573d6000803e3d6000fd5b505050506040513d60208110156113fb57600080fd5b5051889063ffffffff613ad116565b9063ffffffff613ae616565b92505b50509392505050565b600f546040805160e060020a63ea3d4109028152600160e060020a031984166004820152905160009283928392839283928892600160a060020a039092169163ea3d41099160248082019260209290919082900301818887803b15801561148857600080fd5b505af115801561149c573d6000803e3d6000fd5b505050506040513d60208110156114b257600080fd5b505115611505576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b600f54604080517faf1ff972000000000000000000000000000000000000000000000000000000008152600160e060020a03198a166004820152905160009750600160a060020a039092169163af1ff9729160248082019260209290919082900301818b87803b15801561157857600080fd5b505af115801561158c573d6000803e3d6000fd5b505050506040513d60208110156115a257600080fd5b50519350600092505b600b5460ff8416101561191a57600f54600b8054600160a060020a039092169163ea3d4109919060ff87169081106115df57fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561163a57600080fd5b505af115801561164e573d6000803e3d6000fd5b505050506040513d602081101561166457600080fd5b50516040805160e060020a63ffffffff8516028152600160e060020a031990921660048301525160248083019260209291908290030181600087803b1580156116ac57600080fd5b505af11580156116c0573d6000803e3d6000fd5b505050506040513d60208110156116d657600080fd5b50511561172d576040805160e560020a62461bcd02815260206004820152600d60248201527f52617465206973207374616c6500000000000000000000000000000000000000604482015290519081900360640190fd5b600f54600b80546118fb92879261140a92600160a060020a039092169163af1ff972919060ff8a1690811061175e57fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156117b957600080fd5b505af11580156117cd573d6000803e3d6000fd5b505050506040513d60208110156117e357600080fd5b50516040805160e060020a63ffffffff8516028152600160e060020a031990921660048301525160248083019260209291908290030181600087803b15801561182b57600080fd5b505af115801561183f573d6000803e3d6000fd5b505050506040513d602081101561185557600080fd5b5051600b805460ff891690811061186857fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156118c357600080fd5b505af11580156118d7573d6000803e3d6000fd5b505050506040513d60208110156118ed57600080fd5b50519063ffffffff613ad116565b915061190d858363ffffffff613afb16565b94506001909201916115ab565b509295945050505050565b600454600090600160a060020a0316331461194d5760058054600160a060020a031916331790555b600160e060020a031985811690841614156119d8576040805160e560020a62461bcd02815260206004820152602260248201527f45786368616e6765206d7573742075736520646966666572656e742073796e7460448201527f6873000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008411611a30576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b600554610e1990600160a060020a0390811690879087908790871615611a565786611a63565b600554600160a060020a03165b6001613b0d565b600454600160a060020a03163314611a8f5760058054600160a060020a031916331790555b8060008111611ae8576040805160e560020a62461bcd02815260206004820181905260248201527f416d6f756e74206e6565647320746f206265206c6172676572207468616e2030604482015290519081900360640190fd5b600554611afe90600160a060020a031684612ac8565b821115611b55576040805160e560020a62461bcd02815260206004820152601060248201527f416d6f756e7420746f6f206c6172676500000000000000000000000000000000604482015290519081900360640190fd5b611b5f838361415d565b600160e060020a031983166000908152600c60205260408082205460055482517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015260248101879052925191169263867904b4926044808201939182900301818387803b158015611be057600080fd5b505af1158015611bf4573d6000803e3d6000fd5b50505050505050565b600f54600160a060020a031681565b600c60205260009081526040902054600160a060020a031681565b600154600160a060020a031681565b600454600160a060020a03163314611c5b5760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614611cc5576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b600f8054600160a060020a031916600160a060020a0392909216919091179055565b600f546040805160e060020a63ea3d410902815260eb60020a620a69cb02600482018190529151600093849384939092600160a060020a039092169163ea3d41099160248082019260209290919082900301818887803b158015611d4a57600080fd5b505af1158015611d5e573d6000803e3d6000fd5b505050506040513d6020811015611d7457600080fd5b505115611dc7576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b6006546040805160e060020a6370a08231028152600160a060020a038881166004830152915191909216916370a082319160248083019260209291908290030181600087803b158015611e1957600080fd5b505af1158015611e2d573d6000803e3d6000fd5b505050506040513d6020811015611e4357600080fd5b5051601054604080517fb410a0340000000000000000000000000000000000000000000000000000000081529051929550611eeb92600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b158015611eac57600080fd5b505af1158015611ec0573d6000803e3d6000fd5b505050506040513d6020811015611ed657600080fd5b505161140a8760eb60020a620a69cb02610e22565b9150828210611efd5760009350611f10565b611f0d838363ffffffff6146ba16565b93505b505050919050565b6006546040805160e060020a6370a08231028152600160a060020a038481166004830152915160009392909216916370a082319160248082019260209290919082900301818787803b158015611f6d57600080fd5b505af1158015611f81573d6000803e3d6000fd5b505050506040513d6020811015611f9757600080fd5b505192915050565b600154600160a060020a03163314612027576040805160e560020a62461bcd02815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e6572736869700000000000000000000000606482015290519081900360840190fd5b60005460015460408051600160a060020a03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b6000806120b960eb60020a620a69cb026120b386612e47565b856110f5565b905061214a601060009054906101000a9004600160a060020a0316600160a060020a031663b410a0346040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561211157600080fd5b505af1158015612125573d6000803e3d6000fd5b505050506040513d602081101561213b57600080fd5b5051829063ffffffff6146d116565b949350505050565b600b80548290811061216057fe5b600091825260209091200154600160a060020a0316905081565b600454600090600160a060020a031633146121a25760058054600160a060020a031916331790555b600054600554600160a060020a0390811691161461220c576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b81600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561224a57600080fd5b505af115801561225e573d6000803e3d6000fd5b505050506040513d602081101561227457600080fd5b5051600160e060020a031981166000908152600c6020526040902054909150600160a060020a0316156122f1576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820616c726561647920657869737473000000000000000000000000604482015290519081900360640190fd5b600b8054600181019091557f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9018054600160a060020a038416600160a060020a03199182168117909255600160e060020a031983166000908152600c602052604090208054909116909117905561236881836146fd565b5050565b6004546000908190600160a060020a031633146123965760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614612400576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b600160e060020a031983166000908152600c6020526040902054600160a060020a03161515612479576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b600160e060020a031983166000908152600c602090815260408083205481517f18160ddd0000000000000000000000000000000000000000000000000000000081529151600160a060020a03909116936318160ddd93600480850194919392918390030190829087803b1580156124ef57600080fd5b505af1158015612503573d6000803e3d6000fd5b505050506040513d602081101561251957600080fd5b505115612570576040805160e560020a62461bcd02815260206004820152601360248201527f53796e746820737570706c792065786973747300000000000000000000000000604482015290519081900360640190fd5b60e960020a622c222902600160e060020a0319841614156125db576040805160e560020a62461bcd02815260206004820152601760248201527f43616e6e6f742072656d6f7665205844522073796e7468000000000000000000604482015290519081900360640190fd5b5050600160e060020a031981166000908152600c6020526040812054600160a060020a0316905b600b5460ff821610156126f55781600160a060020a0316600b8260ff1681548110151561262b57fe5b600091825260209091200154600160a060020a031614156126ed57600b805460ff831690811061265757fe5b60009182526020909120018054600160a060020a0319169055600b8054600019810190811061268257fe5b600091825260209091200154600b8054600160a060020a039092169160ff84169081106126ab57fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600b8054906126e7906000198301615831565b506126f5565b600101612602565b600160e060020a031983166000908152600c602052604090208054600160a060020a03191690556127268383614856565b505050565b600054600160a060020a031681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b145780601f10610ae957610100808354040283529160200191610b14565b600054600160a060020a031633146127f9576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b60048054600160a060020a038316600160a060020a0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a150565b60008054600160a060020a031633146128b2576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b60035460ff161515612934576040805160e560020a62461bcd02815260206004820152602860248201527f53656c6620646573747275637420686173206e6f7420796574206265656e206960448201527f6e69746961746564000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b426224ea00600254011015156129ba576040805160e560020a62461bcd02815260206004820152602760248201527f53656c662064657374727563742064656c617920686173206e6f74207965742060448201527f656c617073656400000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5060035460408051600160a060020a0361010090930492909216808352905190917f8a09e1677ced846cb537dc2b172043bd05a1a81ad7e0033a7ef8ba762df990b7919081900360200190a180600160a060020a0316ff5b600454600160a060020a03163314612a375760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614612aa1576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b60068054600160a060020a031916600160a060020a038316179055612ac581614941565b50565b6000806000612ad78585610e22565b9150612ae3858561209a565b9050808210612af55760009250612b08565b612b05818363ffffffff6146ba16565b92505b505092915050565b600454600090600160a060020a03163314612b385760058054600160a060020a031916331790555b600554612b4e90600160a060020a031683612ac8565b90506123688282611a6a565b600454600160a060020a03163314612b7f5760058054600160a060020a031916331790555b600160e060020a031981161580612c195750600f546040805160e060020a63ea3d4109028152600160e060020a0319841660048201529051600160a060020a039092169163ea3d4109916024808201926020929091908290030181600087803b158015612beb57600080fd5b505af1158015612bff573d6000803e3d6000fd5b505050506040513d6020811015612c1557600080fd5b5051155b1515612c95576040805160e560020a62461bcd02815260206004820152602860248201527f43757272656e63792072617465206973207374616c65206f7220646f65736e2760448201527f742065786973742e000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b601054600554604080517f51dc7f7d000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152600160e060020a031985166024820152905191909216916351dc7f7d91604480830192600092919082900301818387803b158015612d0f57600080fd5b505af1158015612d23573d6000803e3d6000fd5b5050600554612ac59250600160a060020a0316905082614a88565b600454600160a060020a03163314612d635760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614612dcd576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b60108054600160a060020a031916600160a060020a038316179055612ac581614b94565b6000806000612dff84612e47565b9150811515612e115760009250612e39565b612e248460eb60020a620a69cb02610e22565b9050612e36818363ffffffff613ae616565b92505b5050919050565b6224ea0081565b6006546040805160e060020a6370a08231028152600160a060020a0384811660048301529151600093849316916370a0823191602480830192602092919082900301818787803b158015612e9a57600080fd5b505af1158015612eae573d6000803e3d6000fd5b505050506040513d6020811015612ec457600080fd5b5051600e54909150600160a060020a031615612f6d57600e546040805160e060020a6370a08231028152600160a060020a0386811660048301529151612f6a9392909216916370a08231916024808201926020929091908290030181600087803b158015612f3157600080fd5b505af1158015612f45573d6000803e3d6000fd5b505050506040513d6020811015612f5b57600080fd5b5051829063ffffffff613afb16565b90505b92915050565b6000606061214a848483613473565b600454600090600160a060020a03163314612faa5760058054600160a060020a031916331790555b612fb385611ce7565b83111561300a576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b60055461302390600160a060020a031686868686614c6e565b50600195945050505050565b600d54600160a060020a031681565b6004546000908190600160a060020a031633146130685760058054600160a060020a031916331790555b60055461307e90600160a060020a031685610e22565b9150600082116130d8576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f206465627420746f20666f72676976650000000000000000000000000000604482015290519081900360640190fd5b8282106130e557826130e7565b815b90506130f38482614d88565b600160e060020a031984166000908152600c60205260408082205460055482517f9dc29fac000000000000000000000000000000000000000000000000000000008152600160a060020a039182166004820152602481018690529251911692639dc29fac926044808201939182900301818387803b15801561317457600080fd5b505af1158015613188573d6000803e3d6000fd5b5050505050505050565b60035460ff1681565b600454600160a060020a03163314613223576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c79207468652070726f78792063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031633146132a9576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b426002556003805460ff19166001179055604080516224ea00815290517fcbd94ca75b8dc45c9d80c77e851670e78843c0d75180cb81db3e2158228fa9a69181900360200190a1565b600080805b600b5460ff8216101561334457600b805433919060ff841690811061331857fe5b600091825260209091200154600160a060020a0316141561333c5760019150613344565b6001016132f7565b81151561339b576040805160e560020a62461bcd02815260206004820152601260248201527f4f6e6c792073796e746820616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b600160e060020a03198781169086161415613400576040805160e560020a62461bcd02815260206004820152601360248201527f43616e27742062652073616d652073796e746800000000000000000000000000604482015290519081900360640190fd5b60008611613458576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b61346788888888886000613b0d565b98975050505050505050565b600454600090600160a060020a0316331461349b5760058054600160a060020a031916331790555b6005546134b090600160a060020a0316611ce7565b831115613507576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b60055461351f90600160a060020a03168585856150fc565b506001949350505050565b60008080805b600b5460ff8216101561357d57600b805433919060ff841690811061355157fe5b600091825260209091200154600160a060020a03161415613575576001915061357d565b600101613530565b8115156135d4576040805160e560020a62461bcd02815260206004820152601260248201527f4f6e6c792073796e746820616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6000851161362c576040805160e560020a62461bcd02815260206004820152601160248201527f536f757263652063616e27742062652030000000000000000000000000000000604482015290519081900360640190fd5b6136c287878760e960020a622c222902600d60009054906101000a9004600160a060020a0316600160a060020a031663eb1edd616040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561368f57600080fd5b505af11580156136a3573d6000803e3d6000fd5b505050506040513d60208110156136b957600080fd5b50516000613b0d565b600d54604080517fa3fd6d0e000000000000000000000000000000000000000000000000000000008152600160e060020a03198a166004820152602481018990529051929550600160a060020a039091169163a3fd6d0e9160448082019260009290919082900301818387803b15801561373b57600080fd5b505af115801561374f573d6000803e3d6000fd5b50949998505050505050505050565b600454600160a060020a031633146137835760058054600160a060020a031916331790555b600054600554600160a060020a039081169116146137ed576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b600e8054600160a060020a031916600160a060020a0392909216919091179055565b6003546101009004600160a060020a031681565b601054600160a060020a031681565b600b545b90565b600654604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015284811660248301529151600093929092169163dd62ed3e9160448082019260209290919082900301818787803b1580156138ac57600080fd5b505af11580156138c0573d6000803e3d6000fd5b505050506040513d60208110156138d657600080fd5b50519392505050565b600e54600160a060020a031681565b600654600160a060020a031681565b600454600160a060020a031681565b600480546040805160208082018690528251808303820181528284018085527f417070726f76616c28616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a0190808383885b83811015613a0f5781810151838201526020016139f7565b50505050905090810190601f168015613a3c5780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015611be057600080fd5b6000613a7983836b033b2e3c9fd0803ce800000061510a565b9392505050565b6000613a7983836b033b2e3c9fd0803ce800000061514e565b6000612f6d82633b9aca0063ffffffff61517b16565b60006305f5e10082046005600a820610613ac757600a015b600a900492915050565b6000613a798383670de0b6b3a764000061514e565b6000613a798383670de0b6b3a764000061510a565b600082820183811015613a7957600080fd5b60008060008060008a600d60009054906101000a9004600160a060020a0316600160a060020a031663eb1edd616040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015613b6957600080fd5b505af1158015613b7d573d6000803e3d6000fd5b505050506040513d6020811015613b9357600080fd5b5051600160a060020a0382811691161415613bf8576040805160e560020a62461bcd02815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b600160a060020a0388161515613c58576040805160e560020a62461bcd02815260206004820152601060248201527f5a65726f2064657374696e6174696f6e00000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038816301415613cb9576040805160e560020a62461bcd02815260206004820181905260248201527f53796e74686574697820697320696e76616c69642064657374696e6174696f6e604482015290519081900360640190fd5b600454600160a060020a0389811691161415613d1f576040805160e560020a62461bcd02815260206004820152601c60248201527f50726f787920697320696e76616c69642064657374696e6174696f6e00000000604482015290519081900360640190fd5b600c60008c600160e060020a031916600160e060020a031916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a0316639dc29fac8d8c6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015613dbc57600080fd5b505af1158015613dd0573d6000803e3d6000fd5b50505050613ddf8b8b8b6110f5565b9450849350600092508615613e9657600d54604080517fe05bac82000000000000000000000000000000000000000000000000000000008152600481018890529051600160a060020a039092169163e05bac82916024808201926020929091908290030181600087803b158015613e5557600080fd5b505af1158015613e69573d6000803e3d6000fd5b505050506040513d6020811015613e7f57600080fd5b50519350613e93858563ffffffff6146ba16565b92505b600160e060020a031989166000908152600c60205260408082205481517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038c81166004830152602482018990529251929091169263867904b49260448084019382900301818387803b158015613f1557600080fd5b505af1158015613f29573d6000803e3d6000fd5b50505050600083111561407c57613f4a898460e960020a622c2229026110f5565b60e960020a622c2229026000908152600c60209081527f45a9f72b289ce6682e761d7c5cca99acc283f3b6a9e0fc08d4369cafefd7ef1954600d54604080517feb1edd610000000000000000000000000000000000000000000000000000000081529051959750600160a060020a039283169563867904b495939092169363eb1edd619360048084019492938390030190829087803b158015613fec57600080fd5b505af1158015614000573d6000803e3d6000fd5b505050506040513d602081101561401657600080fd5b50516040805160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820186905251604480830192600092919082900301818387803b15801561406357600080fd5b505af1158015614077573d6000803e3d6000fd5b505050505b600c60008a600160e060020a031916600160e060020a031916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a031663eb6ecc038d8a876040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a031681526020018281526020019350505050600060405180830381600087803b15801561413357600080fd5b505af1158015614147573d6000803e3d6000fd5b5060019f9e505050505050505050505050505050565b60045460009081908190819081908190600160a060020a0316331461418f5760058054600160a060020a031916331790555b6141a3888860e960020a622c2229026110f5565b95506141b760e960020a622c222902611422565b94506141c9868663ffffffff613afb16565b93506141db868563ffffffff613a6016565b9250614260837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561422857600080fd5b505af415801561423c573d6000803e3d6000fd5b505050506040513d602081101561425257600080fd5b50519063ffffffff6146ba16565b60055490925061428290600160a060020a031660e960020a622c222902610e22565b905060008111156142b0576142ad846142a1888463ffffffff613afb16565b9063ffffffff613a6016565b92505b601054600554604080517fb992812e000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201529051919092169163b992812e9160248083019260209291908290030181600087803b15801561431b57600080fd5b505af115801561432f573d6000803e3d6000fd5b505050506040513d602081101561434557600080fd5b505115156143b957601060009054906101000a9004600160a060020a0316600160a060020a0316631bfba5956040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156143a057600080fd5b505af11580156143b4573d6000803e3d6000fd5b505050505b601054600554604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018790529051919092169163a764eb4591604480830192600092919082900301818387803b15801561442a57600080fd5b505af115801561443e573d6000803e3d6000fd5b505050506000601060009054906101000a9004600160a060020a0316600160a060020a031663cd92eba96040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561449757600080fd5b505af11580156144ab573d6000803e3d6000fd5b505050506040513d60208110156144c157600080fd5b505111156145c557601054604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161456f91869185916346317712916004808201926020929091908290030181600087803b15801561453757600080fd5b505af115801561454b573d6000803e3d6000fd5b505050506040513d602081101561456157600080fd5b50519063ffffffff613a8016565b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156145a857600080fd5b505af11580156145bc573d6000803e3d6000fd5b50505050613188565b601060009054906101000a9004600160a060020a0316600160a060020a0316633d31e97b7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561463057600080fd5b505af4158015614644573d6000803e3d6000fd5b505050506040513d602081101561465a57600080fd5b50516040805160e060020a63ffffffff8516028152600481019290925251602480830192600092919082900301818387803b15801561469857600080fd5b505af11580156146ac573d6000803e3d6000fd5b505050505050505050505050565b600080838311156146ca57600080fd5b5050900390565b6000670de0b6b3a76400006146ec848463ffffffff61517b16565b8115156146f557fe5b049392505050565b6004805460408051600160e060020a03198616602080830191909152600160a060020a0386811683850152835180840385018152606084018086527f53796e74684164646564286279746573342c61646472657373290000000000009052935192839003607a01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651939097169763907dff979791959294919384938493839260e490920191908a0190808383885b838110156147e95781810151838201526020016147d1565b50505050905090810190601f1680156148165780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561483a57600080fd5b505af115801561484e573d6000803e3d6000fd5b505050505050565b6004805460408051600160e060020a03198616602080830191909152600160a060020a0386811683850152835180840385018152606084018086527f53796e746852656d6f766564286279746573342c6164647265737329000000009052935192839003607c01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651939097169763907dff979791959294919384938493839260e490920191908a019080838388838110156147e95781810151838201526020016147d1565b6004805460408051600160a060020a038581166020808401919091528351808403820181528385018086527f546f6b656e5374617465557064617465642861646472657373290000000000009052935192839003605a01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651949097169763907dff979791959294919384938493839260e4909201918a0190808383885b83811015614a1c578181015183820152602001614a04565b50505050905090810190601f168015614a495780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015614a6d57600080fd5b505af1158015614a81573d6000803e3d6000fd5b5050505050565b6004805460408051600160e060020a031985166020808301919091528251808303820181528284018085527f50726566657272656443757272656e63794368616e676564286164647265737390527f2c627974657334290000000000000000000000000000000000000000000000006060840152925191829003606801822060e060020a63907dff9702835260026024840181905260448401829052600160a060020a038981166064860181905260006084870181905260a4870181905260c0998701998a52875160c48801528751929098169863907dff979893969495919484939192839260e490920191908a019080838388838110156147e95781810151838201526020016147d1565b6004805460408051600160a060020a038581166020808401919091528351808403820181528385018086527f5374617465436f6e74726163744368616e6765642861646472657373290000009052935192839003605d01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651949097169763907dff979791959294919384938493839260e4909201918a01908083838883811015614a1c578181015183820152602001614a04565b600654604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015288811660248301529151600093929092169163da46098c9188918a91614d07918991879163dd62ed3e9160448082019260209290919082900301818d87803b158015614cf357600080fd5b505af115801561423c573d6000803e3d6000fd5b6040805160e060020a63ffffffff8716028152600160a060020a03948516600482015292909316602483015260448201529051606480830192600092919082900301818387803b158015614d5a57600080fd5b505af1158015614d6e573d6000803e3d6000fd5b50505050614d7e858585856151a9565b9695505050505050565b600080600080600080600080614da88a8a60e960020a622c2229026110f5565b600554909850614dca90600160a060020a031660e960020a622c222902610e22565b9650614dde60e960020a622c222902611422565b9550614df0888763ffffffff613a6016565b9450614e75857384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b158015614e3d57600080fd5b505af4158015614e51573d6000803e3d6000fd5b505050506040513d6020811015614e6757600080fd5b50519063ffffffff613afb16565b935086881415614f7157601054600554604080517fb16c09f0000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201529051919092169163b16c09f091602480830192600092919082900301818387803b158015614ee957600080fd5b505af1158015614efd573d6000803e3d6000fd5b50505050601060009054906101000a9004600160a060020a0316600160a060020a031663ba08f2996040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015614f5457600080fd5b505af1158015614f68573d6000803e3d6000fd5b50505050615031565b614f81878963ffffffff6146ba16565b9250614f93868963ffffffff6146ba16565b9150614fa5838363ffffffff613a6016565b601054600554604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a764eb459160448082019260009290919082900301818387803b15801561501857600080fd5b505af115801561502c573d6000803e3d6000fd5b505050505b601054604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161509f91889185916346317712916004808201926020929091908290030181600087803b15801561453757600080fd5b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156150d857600080fd5b505af11580156150ec573d6000803e3d6000fd5b5050505050505050505050505050565b6000610e19858585856151a9565b6000806151308461512487600a870263ffffffff61517b16565b9063ffffffff6154e316565b90506005600a825b061061514257600a015b600a9004949350505050565b600080600a8304615165868663ffffffff61517b16565b81151561516e57fe5b0490506005600a82615138565b60008083151561518e5760009150610beb565b5082820282848281151561519e57fe5b0414613a7957600080fd5b6000600160a060020a038416151561520b576040805160e560020a62461bcd02815260206004820181905260248201527f43616e6e6f74207472616e7366657220746f2074686520302061646472657373604482015290519081900360640190fd5b600160a060020a038416301415615292576040805160e560020a62461bcd02815260206004820152602a60248201527f43616e6e6f74207472616e7366657220746f2074686520756e6465726c79696e60448201527f6720636f6e747261637400000000000000000000000000000000000000000000606482015290519081900360840190fd5b600454600160a060020a038581169116141561531e576040805160e560020a62461bcd02815260206004820152602560248201527f43616e6e6f74207472616e7366657220746f207468652070726f787920636f6e60448201527f7472616374000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6006546040805160e060020a6370a08231028152600160a060020a0388811660048301529151919092169163b46310f691889161538191889186916370a08231916024808201926020929091908290030181600087803b158015614cf357600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156153d357600080fd5b505af11580156153e7573d6000803e3d6000fd5b50506006546040805160e060020a6370a08231028152600160a060020a038981166004830152915191909216935063b46310f69250879161546291889186916370a08231916024808201926020929091908290030181600087803b15801561544e57600080fd5b505af1158015614e51573d6000803e3d6000fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156154b457600080fd5b505af11580156154c8573d6000803e3d6000fd5b505050506154d885858585615506565b61351f85858561572f565b6000808083116154f257600080fd5b82848115156154fd57fe5b04949350505050565b60055460009074010000000000000000000000000000000000000000900460ff161561557c576040805160e560020a62461bcd02815260206004820152601e60248201527f526576657274656420746f2070726576656e74207265656e7472616e63790000604482015290519081900360640190fd5b506005805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055823b600081111561570a5783600160a060020a03168584846040516024018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015615628578181015183820152602001615610565b50505050905090810190601f1680156156555780820380516001836020036101000a031916815260200191505b5060408051601f19818403018152918152602082018051600160e060020a03167fc0ee0b8a000000000000000000000000000000000000000000000000000000001781529051825192975095508594509250905080838360005b838110156156c75781810151838201526020016156af565b50505050905090810190601f1680156156f45780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af15050505b50506005805474ff000000000000000000000000000000000000000019169055505050565b600480546040805160208082018690528251808303820181528284018085527f5472616e7366657228616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a01908083838883811015613a0f5781810151838201526020016139f7565b8154818355818111156127265760008381526020902061272691810190830161383691905b8082111561586a5760008155600101615856565b509056004f6e6c792074686520636f6e7472616374206f776e6572206d617920706572665468697320616374696f6e2063616e206f6e6c7920626520706572666f726d656f726d207468697320616374696f6e000000000000000000000000000000000052617465207374616c65206f72206e6f6e6578697374616e742063757272656e6420627920746865206f776e6572000000000000000000000000000000000000a165627a7a723058207c9f49a69e94579502b6c3bc3df2a82d7090bbd1f75b2c1eb554eaf4834e466a0029000000000000000000000000c011a72400e58ecd99ee497cf89e3775d4bd732f0000000000000000000000005b1b5fea1b99d83ad479df0c222f0492385381dd0000000000000000000000007e295884f3f5e2ea462620018e9193a1c305c185000000000000000000000000ea5e288b4f9d7e66da162e2af0db371783f6245400000000000000000000000073b172756bd5ddf0110ba8d7b88816eb639eb21c000000000000000000000000ebdbac38835a1105851e80c7fa1f1e6e25a86e32
Deployed Bytecode
0x6080604052600436106102795763ffffffff60e060020a60003504166306fdde03811461027e578063095ea7b3146103085780631627540c1461034057806317c70de41461036357806318160ddd1461038a57806320714f881461039f57806323b872dd146103c0578063274ed288146103ea578063313ce567146104185780633278c9601461044357806339d66fc014610458578063403dca5514610484578063405d3adf146104a657806349755b9e146104de5780634ffcd9df14610503578063502b8bda1461053457806353a47bb71461055657806356e449541461056b5780636ac0bf9c1461058c57806370a08231146105ad57806379ba5097146105ce578063807d94a7146105e3578063835e119c14610611578063849cf5881461062957806384dcde971461064a5780638da5cb5b1461066c57806395d89b411461068157806397107d6d146106965780639cb8a26a146106b75780639f769807146106cc5780639f9f83dd146106ed5780639ff8c63f1461071b578063a08038be1461073d578063a2f3ba5b1461075f578063a311c7c214610780578063a461fc82146107a1578063a5fdc5de146107b6578063a9059cbb146107d7578063ab67aa58146107fb578063ae2e933b1461086a578063af0233351461087f578063b8225dec146108a4578063bc67f832146108b9578063bd32aa44146108da578063be0ecd32146108ef578063be45fd621461092e578063be57636414610997578063c10c3546146109c8578063c58aaae6146109e9578063dbd4a422146109fe578063dbf6334014610a13578063dd62ed3e14610a28578063e2fdcc1714610a4f578063e90dd9e214610a64578063ec55688914610a79575b600080fd5b34801561028a57600080fd5b50610293610a8e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102cd5781810151838201526020016102b5565b50505050905090810190601f1680156102fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561031457600080fd5b5061032c600160a060020a0360043516602435610b1c565b604080519115158252519081900360200190f35b34801561034c57600080fd5b50610361600160a060020a0360043516610bf2565b005b34801561036f57600080fd5b50610378610caa565b60408051918252519081900360200190f35b34801561039657600080fd5b50610378610cb0565b3480156103ab57600080fd5b50610361600160a060020a0360043516610cb6565b3480156103cc57600080fd5b5061032c600160a060020a0360043581169060243516604435610e09565b3480156103f657600080fd5b50610378600160a060020a0360043516600160e060020a031960243516610e22565b34801561042457600080fd5b5061042d61104e565b6040805160ff9092168252519081900360200190f35b34801561044f57600080fd5b50610361611057565b34801561046457600080fd5b50610378600160e060020a031960043581169060243590604435166110f5565b34801561049057600080fd5b50610378600160e060020a031960043516611422565b3480156104b257600080fd5b5061032c600160e060020a03196004358116906024359060443516600160a060020a0360643516611925565b3480156104ea57600080fd5b50610361600160e060020a031960043516602435611a6a565b34801561050f57600080fd5b50610518611bfd565b60408051600160a060020a039092168252519081900360200190f35b34801561054057600080fd5b50610518600160e060020a031960043516611c0c565b34801561056257600080fd5b50610518611c27565b34801561057757600080fd5b50610361600160a060020a0360043516611c36565b34801561059857600080fd5b50610378600160a060020a0360043516611ce7565b3480156105b957600080fd5b50610378600160a060020a0360043516611f18565b3480156105da57600080fd5b50610361611f9f565b3480156105ef57600080fd5b50610378600160a060020a0360043516600160e060020a03196024351661209a565b34801561061d57600080fd5b50610518600435612152565b34801561063557600080fd5b50610361600160a060020a036004351661217a565b34801561065657600080fd5b50610361600160e060020a03196004351661236c565b34801561067857600080fd5b5061051861272b565b34801561068d57600080fd5b5061029361273a565b3480156106a257600080fd5b50610361600160a060020a0360043516612795565b3480156106c357600080fd5b5061036161284d565b3480156106d857600080fd5b50610361600160a060020a0360043516612a12565b3480156106f957600080fd5b50610378600160a060020a0360043516600160e060020a031960243516612ac8565b34801561072757600080fd5b50610361600160e060020a031960043516612b10565b34801561074957600080fd5b50610361600160e060020a031960043516612b5a565b34801561076b57600080fd5b50610361600160a060020a0360043516612d3e565b34801561078c57600080fd5b50610378600160a060020a0360043516612df1565b3480156107ad57600080fd5b50610378612e40565b3480156107c257600080fd5b50610378600160a060020a0360043516612e47565b3480156107e357600080fd5b5061032c600160a060020a0360043516602435612f73565b34801561080757600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261032c94600160a060020a038135811695602480359092169560443595369560849401918190840183828082843750949750612f829650505050505050565b34801561087657600080fd5b5061051861302f565b34801561088b57600080fd5b50610361600160e060020a03196004351660243561303e565b3480156108b057600080fd5b5061032c613192565b3480156108c557600080fd5b50610361600160a060020a036004351661319b565b3480156108e657600080fd5b50610361613245565b3480156108fb57600080fd5b5061032c600160a060020a03600435811690600160e060020a0319602435811691604435916064351690608435166132f2565b34801561093a57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261032c948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506134739650505050505050565b3480156109a357600080fd5b5061032c600160a060020a0360043516600160e060020a03196024351660443561352a565b3480156109d457600080fd5b50610361600160a060020a036004351661375e565b3480156109f557600080fd5b5061051861380f565b348015610a0a57600080fd5b50610518613823565b348015610a1f57600080fd5b50610378613832565b348015610a3457600080fd5b50610378600160a060020a0360043581169060243516613839565b348015610a5b57600080fd5b506105186138df565b348015610a7057600080fd5b506105186138ee565b348015610a8557600080fd5b506105186138fd565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b145780601f10610ae957610100808354040283529160200191610b14565b820191906000526020600020905b815481529060010190602001808311610af757829003601f168201915b505050505081565b6004546000908190600160a060020a03163314610b465760058054600160a060020a031916331790555b50600554600654604080517fda46098c000000000000000000000000000000000000000000000000000000008152600160a060020a0393841660048201819052878516602483015260448201879052915191939092169163da46098c91606480830192600092919082900301818387803b158015610bc357600080fd5b505af1158015610bd7573d6000803e3d6000fd5b50505050610be681858561390c565b600191505b5092915050565b600054600160a060020a03163314610c56576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b60018054600160a060020a038316600160a060020a0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60025481565b60095481565b600054600160a060020a03163314610d1a576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b600160a060020a0381161515610da0576040805160e560020a62461bcd02815260206004820152602860248201527f42656e6566696369617279206d757374206e6f7420626520746865207a65726f60448201527f2061646472657373000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60038054600160a060020a038316610100810274ffffffffffffffffffffffffffffffffffffffff00199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a150565b60006060610e1985858584612f82565b95945050505050565b601054604080517f8b3f8088000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301528251600094859485948594859485949190911692638b3f8088926024808201939182900301818787803b158015610e9257600080fd5b505af1158015610ea6573d6000803e3d6000fd5b505050506040513d6040811015610ebc57600080fd5b5080516020909101519095509350841515610eda5760009550611043565b601054604080517f08d95cd500000000000000000000000000000000000000000000000000000000815260048101879052905161101b92889261100f92600160a060020a03909216916308d95cd5916024808201926020929091908290030181600087803b158015610f4b57600080fd5b505af1158015610f5f573d6000803e3d6000fd5b505050506040513d6020811015610f7557600080fd5b5051601054604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916346317712916004808201926020929091908290030181600087803b158015610fd757600080fd5b505af1158015610feb573d6000803e3d6000fd5b505050506040513d602081101561100157600080fd5b50519063ffffffff613a6016565b9063ffffffff613a8016565b925061102687611422565b91506110358361100f84613a99565b905061104081613aaf565b95505b505050505092915050565b600a5460ff1681565b600054600160a060020a031633146110bb576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b600060028190556003805460ff191690556040517f6adcc7125002935e0aa31697538ebbd65cfddf20431eb6ecdcfc3e238bfd082c9190a1565b600f546040805160e060020a63ea3d4109028152600160e060020a03198616600482015290516000928692600160a060020a039091169163ea3d41099160248082019260209290919082900301818887803b15801561115357600080fd5b505af1158015611167573d6000803e3d6000fd5b505050506040513d602081101561117d57600080fd5b5051156111d0576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b600f546040805160e060020a63ea3d4109028152600160e060020a03198616600482015290518592600160a060020a03169163ea3d41099160248083019260209291908290030181600087803b15801561122957600080fd5b505af115801561123d573d6000803e3d6000fd5b505050506040513d602081101561125357600080fd5b5051156112a6576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b600160e060020a031986811690851614156112c357849250611419565b600f54604080517faf1ff972000000000000000000000000000000000000000000000000000000008152600160e060020a031987166004820152905161141692600160a060020a03169163af1ff9729160248083019260209291908290030181600087803b15801561133457600080fd5b505af1158015611348573d6000803e3d6000fd5b505050506040513d602081101561135e57600080fd5b5051600f54604080517faf1ff972000000000000000000000000000000000000000000000000000000008152600160e060020a03198b166004820152905161140a92600160a060020a03169163af1ff9729160248083019260209291908290030181600087803b1580156113d157600080fd5b505af11580156113e5573d6000803e3d6000fd5b505050506040513d60208110156113fb57600080fd5b5051889063ffffffff613ad116565b9063ffffffff613ae616565b92505b50509392505050565b600f546040805160e060020a63ea3d4109028152600160e060020a031984166004820152905160009283928392839283928892600160a060020a039092169163ea3d41099160248082019260209290919082900301818887803b15801561148857600080fd5b505af115801561149c573d6000803e3d6000fd5b505050506040513d60208110156114b257600080fd5b505115611505576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b600f54604080517faf1ff972000000000000000000000000000000000000000000000000000000008152600160e060020a03198a166004820152905160009750600160a060020a039092169163af1ff9729160248082019260209290919082900301818b87803b15801561157857600080fd5b505af115801561158c573d6000803e3d6000fd5b505050506040513d60208110156115a257600080fd5b50519350600092505b600b5460ff8416101561191a57600f54600b8054600160a060020a039092169163ea3d4109919060ff87169081106115df57fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561163a57600080fd5b505af115801561164e573d6000803e3d6000fd5b505050506040513d602081101561166457600080fd5b50516040805160e060020a63ffffffff8516028152600160e060020a031990921660048301525160248083019260209291908290030181600087803b1580156116ac57600080fd5b505af11580156116c0573d6000803e3d6000fd5b505050506040513d60208110156116d657600080fd5b50511561172d576040805160e560020a62461bcd02815260206004820152600d60248201527f52617465206973207374616c6500000000000000000000000000000000000000604482015290519081900360640190fd5b600f54600b80546118fb92879261140a92600160a060020a039092169163af1ff972919060ff8a1690811061175e57fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156117b957600080fd5b505af11580156117cd573d6000803e3d6000fd5b505050506040513d60208110156117e357600080fd5b50516040805160e060020a63ffffffff8516028152600160e060020a031990921660048301525160248083019260209291908290030181600087803b15801561182b57600080fd5b505af115801561183f573d6000803e3d6000fd5b505050506040513d602081101561185557600080fd5b5051600b805460ff891690811061186857fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156118c357600080fd5b505af11580156118d7573d6000803e3d6000fd5b505050506040513d60208110156118ed57600080fd5b50519063ffffffff613ad116565b915061190d858363ffffffff613afb16565b94506001909201916115ab565b509295945050505050565b600454600090600160a060020a0316331461194d5760058054600160a060020a031916331790555b600160e060020a031985811690841614156119d8576040805160e560020a62461bcd02815260206004820152602260248201527f45786368616e6765206d7573742075736520646966666572656e742073796e7460448201527f6873000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008411611a30576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b600554610e1990600160a060020a0390811690879087908790871615611a565786611a63565b600554600160a060020a03165b6001613b0d565b600454600160a060020a03163314611a8f5760058054600160a060020a031916331790555b8060008111611ae8576040805160e560020a62461bcd02815260206004820181905260248201527f416d6f756e74206e6565647320746f206265206c6172676572207468616e2030604482015290519081900360640190fd5b600554611afe90600160a060020a031684612ac8565b821115611b55576040805160e560020a62461bcd02815260206004820152601060248201527f416d6f756e7420746f6f206c6172676500000000000000000000000000000000604482015290519081900360640190fd5b611b5f838361415d565b600160e060020a031983166000908152600c60205260408082205460055482517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015260248101879052925191169263867904b4926044808201939182900301818387803b158015611be057600080fd5b505af1158015611bf4573d6000803e3d6000fd5b50505050505050565b600f54600160a060020a031681565b600c60205260009081526040902054600160a060020a031681565b600154600160a060020a031681565b600454600160a060020a03163314611c5b5760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614611cc5576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b600f8054600160a060020a031916600160a060020a0392909216919091179055565b600f546040805160e060020a63ea3d410902815260eb60020a620a69cb02600482018190529151600093849384939092600160a060020a039092169163ea3d41099160248082019260209290919082900301818887803b158015611d4a57600080fd5b505af1158015611d5e573d6000803e3d6000fd5b505050506040513d6020811015611d7457600080fd5b505115611dc7576040805160e560020a62461bcd02815260206004820152602260248201526000805160206158cf833981519152604482015260f060020a61637902606482015290519081900360840190fd5b6006546040805160e060020a6370a08231028152600160a060020a038881166004830152915191909216916370a082319160248083019260209291908290030181600087803b158015611e1957600080fd5b505af1158015611e2d573d6000803e3d6000fd5b505050506040513d6020811015611e4357600080fd5b5051601054604080517fb410a0340000000000000000000000000000000000000000000000000000000081529051929550611eeb92600160a060020a039092169163b410a034916004808201926020929091908290030181600087803b158015611eac57600080fd5b505af1158015611ec0573d6000803e3d6000fd5b505050506040513d6020811015611ed657600080fd5b505161140a8760eb60020a620a69cb02610e22565b9150828210611efd5760009350611f10565b611f0d838363ffffffff6146ba16565b93505b505050919050565b6006546040805160e060020a6370a08231028152600160a060020a038481166004830152915160009392909216916370a082319160248082019260209290919082900301818787803b158015611f6d57600080fd5b505af1158015611f81573d6000803e3d6000fd5b505050506040513d6020811015611f9757600080fd5b505192915050565b600154600160a060020a03163314612027576040805160e560020a62461bcd02815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e6572736869700000000000000000000000606482015290519081900360840190fd5b60005460015460408051600160a060020a03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b6000806120b960eb60020a620a69cb026120b386612e47565b856110f5565b905061214a601060009054906101000a9004600160a060020a0316600160a060020a031663b410a0346040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561211157600080fd5b505af1158015612125573d6000803e3d6000fd5b505050506040513d602081101561213b57600080fd5b5051829063ffffffff6146d116565b949350505050565b600b80548290811061216057fe5b600091825260209091200154600160a060020a0316905081565b600454600090600160a060020a031633146121a25760058054600160a060020a031916331790555b600054600554600160a060020a0390811691161461220c576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b81600160a060020a031663dbd06c856040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561224a57600080fd5b505af115801561225e573d6000803e3d6000fd5b505050506040513d602081101561227457600080fd5b5051600160e060020a031981166000908152600c6020526040902054909150600160a060020a0316156122f1576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820616c726561647920657869737473000000000000000000000000604482015290519081900360640190fd5b600b8054600181019091557f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9018054600160a060020a038416600160a060020a03199182168117909255600160e060020a031983166000908152600c602052604090208054909116909117905561236881836146fd565b5050565b6004546000908190600160a060020a031633146123965760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614612400576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b600160e060020a031983166000908152600c6020526040902054600160a060020a03161515612479576040805160e560020a62461bcd02815260206004820152601460248201527f53796e746820646f6573206e6f74206578697374000000000000000000000000604482015290519081900360640190fd5b600160e060020a031983166000908152600c602090815260408083205481517f18160ddd0000000000000000000000000000000000000000000000000000000081529151600160a060020a03909116936318160ddd93600480850194919392918390030190829087803b1580156124ef57600080fd5b505af1158015612503573d6000803e3d6000fd5b505050506040513d602081101561251957600080fd5b505115612570576040805160e560020a62461bcd02815260206004820152601360248201527f53796e746820737570706c792065786973747300000000000000000000000000604482015290519081900360640190fd5b60e960020a622c222902600160e060020a0319841614156125db576040805160e560020a62461bcd02815260206004820152601760248201527f43616e6e6f742072656d6f7665205844522073796e7468000000000000000000604482015290519081900360640190fd5b5050600160e060020a031981166000908152600c6020526040812054600160a060020a0316905b600b5460ff821610156126f55781600160a060020a0316600b8260ff1681548110151561262b57fe5b600091825260209091200154600160a060020a031614156126ed57600b805460ff831690811061265757fe5b60009182526020909120018054600160a060020a0319169055600b8054600019810190811061268257fe5b600091825260209091200154600b8054600160a060020a039092169160ff84169081106126ab57fe5b60009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055600b8054906126e7906000198301615831565b506126f5565b600101612602565b600160e060020a031983166000908152600c602052604090208054600160a060020a03191690556127268383614856565b505050565b600054600160a060020a031681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b145780601f10610ae957610100808354040283529160200191610b14565b600054600160a060020a031633146127f9576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b60048054600160a060020a038316600160a060020a0319909116811790915560408051918252517ffc80377ca9c49cc11ae6982f390a42db976d5530af7c43889264b13fbbd7c57e9181900360200190a150565b60008054600160a060020a031633146128b2576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b60035460ff161515612934576040805160e560020a62461bcd02815260206004820152602860248201527f53656c6620646573747275637420686173206e6f7420796574206265656e206960448201527f6e69746961746564000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b426224ea00600254011015156129ba576040805160e560020a62461bcd02815260206004820152602760248201527f53656c662064657374727563742064656c617920686173206e6f74207965742060448201527f656c617073656400000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5060035460408051600160a060020a0361010090930492909216808352905190917f8a09e1677ced846cb537dc2b172043bd05a1a81ad7e0033a7ef8ba762df990b7919081900360200190a180600160a060020a0316ff5b600454600160a060020a03163314612a375760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614612aa1576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b60068054600160a060020a031916600160a060020a038316179055612ac581614941565b50565b6000806000612ad78585610e22565b9150612ae3858561209a565b9050808210612af55760009250612b08565b612b05818363ffffffff6146ba16565b92505b505092915050565b600454600090600160a060020a03163314612b385760058054600160a060020a031916331790555b600554612b4e90600160a060020a031683612ac8565b90506123688282611a6a565b600454600160a060020a03163314612b7f5760058054600160a060020a031916331790555b600160e060020a031981161580612c195750600f546040805160e060020a63ea3d4109028152600160e060020a0319841660048201529051600160a060020a039092169163ea3d4109916024808201926020929091908290030181600087803b158015612beb57600080fd5b505af1158015612bff573d6000803e3d6000fd5b505050506040513d6020811015612c1557600080fd5b5051155b1515612c95576040805160e560020a62461bcd02815260206004820152602860248201527f43757272656e63792072617465206973207374616c65206f7220646f65736e2760448201527f742065786973742e000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b601054600554604080517f51dc7f7d000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152600160e060020a031985166024820152905191909216916351dc7f7d91604480830192600092919082900301818387803b158015612d0f57600080fd5b505af1158015612d23573d6000803e3d6000fd5b5050600554612ac59250600160a060020a0316905082614a88565b600454600160a060020a03163314612d635760058054600160a060020a031916331790555b600054600554600160a060020a03908116911614612dcd576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b60108054600160a060020a031916600160a060020a038316179055612ac581614b94565b6000806000612dff84612e47565b9150811515612e115760009250612e39565b612e248460eb60020a620a69cb02610e22565b9050612e36818363ffffffff613ae616565b92505b5050919050565b6224ea0081565b6006546040805160e060020a6370a08231028152600160a060020a0384811660048301529151600093849316916370a0823191602480830192602092919082900301818787803b158015612e9a57600080fd5b505af1158015612eae573d6000803e3d6000fd5b505050506040513d6020811015612ec457600080fd5b5051600e54909150600160a060020a031615612f6d57600e546040805160e060020a6370a08231028152600160a060020a0386811660048301529151612f6a9392909216916370a08231916024808201926020929091908290030181600087803b158015612f3157600080fd5b505af1158015612f45573d6000803e3d6000fd5b505050506040513d6020811015612f5b57600080fd5b5051829063ffffffff613afb16565b90505b92915050565b6000606061214a848483613473565b600454600090600160a060020a03163314612faa5760058054600160a060020a031916331790555b612fb385611ce7565b83111561300a576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b60055461302390600160a060020a031686868686614c6e565b50600195945050505050565b600d54600160a060020a031681565b6004546000908190600160a060020a031633146130685760058054600160a060020a031916331790555b60055461307e90600160a060020a031685610e22565b9150600082116130d8576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f206465627420746f20666f72676976650000000000000000000000000000604482015290519081900360640190fd5b8282106130e557826130e7565b815b90506130f38482614d88565b600160e060020a031984166000908152600c60205260408082205460055482517f9dc29fac000000000000000000000000000000000000000000000000000000008152600160a060020a039182166004820152602481018690529251911692639dc29fac926044808201939182900301818387803b15801561317457600080fd5b505af1158015613188573d6000803e3d6000fd5b5050505050505050565b60035460ff1681565b600454600160a060020a03163314613223576040805160e560020a62461bcd02815260206004820152602560248201527f4f6e6c79207468652070726f78792063616e2063616c6c20746869732066756e60448201527f6374696f6e000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a031633146132a9576040805160e560020a62461bcd02815260206004820152602f602482015260008051602061586f83398151915260448201526000805160206158af833981519152606482015290519081900360840190fd5b426002556003805460ff19166001179055604080516224ea00815290517fcbd94ca75b8dc45c9d80c77e851670e78843c0d75180cb81db3e2158228fa9a69181900360200190a1565b600080805b600b5460ff8216101561334457600b805433919060ff841690811061331857fe5b600091825260209091200154600160a060020a0316141561333c5760019150613344565b6001016132f7565b81151561339b576040805160e560020a62461bcd02815260206004820152601260248201527f4f6e6c792073796e746820616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b600160e060020a03198781169086161415613400576040805160e560020a62461bcd02815260206004820152601360248201527f43616e27742062652073616d652073796e746800000000000000000000000000604482015290519081900360640190fd5b60008611613458576040805160e560020a62461bcd02815260206004820152600b60248201527f5a65726f20616d6f756e74000000000000000000000000000000000000000000604482015290519081900360640190fd5b61346788888888886000613b0d565b98975050505050505050565b600454600090600160a060020a0316331461349b5760058054600160a060020a031916331790555b6005546134b090600160a060020a0316611ce7565b831115613507576040805160e560020a62461bcd02815260206004820152601460248201527f496e73756666696369656e742062616c616e6365000000000000000000000000604482015290519081900360640190fd5b60055461351f90600160a060020a03168585856150fc565b506001949350505050565b60008080805b600b5460ff8216101561357d57600b805433919060ff841690811061355157fe5b600091825260209091200154600160a060020a03161415613575576001915061357d565b600101613530565b8115156135d4576040805160e560020a62461bcd02815260206004820152601260248201527f4f6e6c792073796e746820616c6c6f7765640000000000000000000000000000604482015290519081900360640190fd5b6000851161362c576040805160e560020a62461bcd02815260206004820152601160248201527f536f757263652063616e27742062652030000000000000000000000000000000604482015290519081900360640190fd5b6136c287878760e960020a622c222902600d60009054906101000a9004600160a060020a0316600160a060020a031663eb1edd616040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561368f57600080fd5b505af11580156136a3573d6000803e3d6000fd5b505050506040513d60208110156136b957600080fd5b50516000613b0d565b600d54604080517fa3fd6d0e000000000000000000000000000000000000000000000000000000008152600160e060020a03198a166004820152602481018990529051929550600160a060020a039091169163a3fd6d0e9160448082019260009290919082900301818387803b15801561373b57600080fd5b505af115801561374f573d6000803e3d6000fd5b50949998505050505050505050565b600454600160a060020a031633146137835760058054600160a060020a031916331790555b600054600554600160a060020a039081169116146137ed576040805160e560020a62461bcd02815260206004820152602e602482015260008051602061588f83398151915260448201526000805160206158ef833981519152606482015290519081900360840190fd5b600e8054600160a060020a031916600160a060020a0392909216919091179055565b6003546101009004600160a060020a031681565b601054600160a060020a031681565b600b545b90565b600654604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015284811660248301529151600093929092169163dd62ed3e9160448082019260209290919082900301818787803b1580156138ac57600080fd5b505af11580156138c0573d6000803e3d6000fd5b505050506040513d60208110156138d657600080fd5b50519392505050565b600e54600160a060020a031681565b600654600160a060020a031681565b600454600160a060020a031681565b600480546040805160208082018690528251808303820181528284018085527f417070726f76616c28616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a0190808383885b83811015613a0f5781810151838201526020016139f7565b50505050905090810190601f168015613a3c5780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015611be057600080fd5b6000613a7983836b033b2e3c9fd0803ce800000061510a565b9392505050565b6000613a7983836b033b2e3c9fd0803ce800000061514e565b6000612f6d82633b9aca0063ffffffff61517b16565b60006305f5e10082046005600a820610613ac757600a015b600a900492915050565b6000613a798383670de0b6b3a764000061514e565b6000613a798383670de0b6b3a764000061510a565b600082820183811015613a7957600080fd5b60008060008060008a600d60009054906101000a9004600160a060020a0316600160a060020a031663eb1edd616040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015613b6957600080fd5b505af1158015613b7d573d6000803e3d6000fd5b505050506040513d6020811015613b9357600080fd5b5051600160a060020a0382811691161415613bf8576040805160e560020a62461bcd02815260206004820152601760248201527f4665652061646472657373206e6f7420616c6c6f776564000000000000000000604482015290519081900360640190fd5b600160a060020a0388161515613c58576040805160e560020a62461bcd02815260206004820152601060248201527f5a65726f2064657374696e6174696f6e00000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038816301415613cb9576040805160e560020a62461bcd02815260206004820181905260248201527f53796e74686574697820697320696e76616c69642064657374696e6174696f6e604482015290519081900360640190fd5b600454600160a060020a0389811691161415613d1f576040805160e560020a62461bcd02815260206004820152601c60248201527f50726f787920697320696e76616c69642064657374696e6174696f6e00000000604482015290519081900360640190fd5b600c60008c600160e060020a031916600160e060020a031916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a0316639dc29fac8d8c6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015613dbc57600080fd5b505af1158015613dd0573d6000803e3d6000fd5b50505050613ddf8b8b8b6110f5565b9450849350600092508615613e9657600d54604080517fe05bac82000000000000000000000000000000000000000000000000000000008152600481018890529051600160a060020a039092169163e05bac82916024808201926020929091908290030181600087803b158015613e5557600080fd5b505af1158015613e69573d6000803e3d6000fd5b505050506040513d6020811015613e7f57600080fd5b50519350613e93858563ffffffff6146ba16565b92505b600160e060020a031989166000908152600c60205260408082205481517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038c81166004830152602482018990529251929091169263867904b49260448084019382900301818387803b158015613f1557600080fd5b505af1158015613f29573d6000803e3d6000fd5b50505050600083111561407c57613f4a898460e960020a622c2229026110f5565b60e960020a622c2229026000908152600c60209081527f45a9f72b289ce6682e761d7c5cca99acc283f3b6a9e0fc08d4369cafefd7ef1954600d54604080517feb1edd610000000000000000000000000000000000000000000000000000000081529051959750600160a060020a039283169563867904b495939092169363eb1edd619360048084019492938390030190829087803b158015613fec57600080fd5b505af1158015614000573d6000803e3d6000fd5b505050506040513d602081101561401657600080fd5b50516040805160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820186905251604480830192600092919082900301818387803b15801561406357600080fd5b505af1158015614077573d6000803e3d6000fd5b505050505b600c60008a600160e060020a031916600160e060020a031916815260200190815260200160002060009054906101000a9004600160a060020a0316600160a060020a031663eb6ecc038d8a876040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a031681526020018281526020019350505050600060405180830381600087803b15801561413357600080fd5b505af1158015614147573d6000803e3d6000fd5b5060019f9e505050505050505050505050505050565b60045460009081908190819081908190600160a060020a0316331461418f5760058054600160a060020a031916331790555b6141a3888860e960020a622c2229026110f5565b95506141b760e960020a622c222902611422565b94506141c9868663ffffffff613afb16565b93506141db868563ffffffff613a6016565b9250614260837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561422857600080fd5b505af415801561423c573d6000803e3d6000fd5b505050506040513d602081101561425257600080fd5b50519063ffffffff6146ba16565b60055490925061428290600160a060020a031660e960020a622c222902610e22565b905060008111156142b0576142ad846142a1888463ffffffff613afb16565b9063ffffffff613a6016565b92505b601054600554604080517fb992812e000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201529051919092169163b992812e9160248083019260209291908290030181600087803b15801561431b57600080fd5b505af115801561432f573d6000803e3d6000fd5b505050506040513d602081101561434557600080fd5b505115156143b957601060009054906101000a9004600160a060020a0316600160a060020a0316631bfba5956040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156143a057600080fd5b505af11580156143b4573d6000803e3d6000fd5b505050505b601054600554604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018790529051919092169163a764eb4591604480830192600092919082900301818387803b15801561442a57600080fd5b505af115801561443e573d6000803e3d6000fd5b505050506000601060009054906101000a9004600160a060020a0316600160a060020a031663cd92eba96040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561449757600080fd5b505af11580156144ab573d6000803e3d6000fd5b505050506040513d60208110156144c157600080fd5b505111156145c557601054604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161456f91869185916346317712916004808201926020929091908290030181600087803b15801561453757600080fd5b505af115801561454b573d6000803e3d6000fd5b505050506040513d602081101561456157600080fd5b50519063ffffffff613a8016565b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156145a857600080fd5b505af11580156145bc573d6000803e3d6000fd5b50505050613188565b601060009054906101000a9004600160a060020a0316600160a060020a0316633d31e97b7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561463057600080fd5b505af4158015614644573d6000803e3d6000fd5b505050506040513d602081101561465a57600080fd5b50516040805160e060020a63ffffffff8516028152600481019290925251602480830192600092919082900301818387803b15801561469857600080fd5b505af11580156146ac573d6000803e3d6000fd5b505050505050505050505050565b600080838311156146ca57600080fd5b5050900390565b6000670de0b6b3a76400006146ec848463ffffffff61517b16565b8115156146f557fe5b049392505050565b6004805460408051600160e060020a03198616602080830191909152600160a060020a0386811683850152835180840385018152606084018086527f53796e74684164646564286279746573342c61646472657373290000000000009052935192839003607a01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651939097169763907dff979791959294919384938493839260e490920191908a0190808383885b838110156147e95781810151838201526020016147d1565b50505050905090810190601f1680156148165780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b15801561483a57600080fd5b505af115801561484e573d6000803e3d6000fd5b505050505050565b6004805460408051600160e060020a03198616602080830191909152600160a060020a0386811683850152835180840385018152606084018086527f53796e746852656d6f766564286279746573342c6164647265737329000000009052935192839003607c01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651939097169763907dff979791959294919384938493839260e490920191908a019080838388838110156147e95781810151838201526020016147d1565b6004805460408051600160a060020a038581166020808401919091528351808403820181528385018086527f546f6b656e5374617465557064617465642861646472657373290000000000009052935192839003605a01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651949097169763907dff979791959294919384938493839260e4909201918a0190808383885b83811015614a1c578181015183820152602001614a04565b50505050905090810190601f168015614a495780820380516001836020036101000a031916815260200191505b50975050505050505050600060405180830381600087803b158015614a6d57600080fd5b505af1158015614a81573d6000803e3d6000fd5b5050505050565b6004805460408051600160e060020a031985166020808301919091528251808303820181528284018085527f50726566657272656443757272656e63794368616e676564286164647265737390527f2c627974657334290000000000000000000000000000000000000000000000006060840152925191829003606801822060e060020a63907dff9702835260026024840181905260448401829052600160a060020a038981166064860181905260006084870181905260a4870181905260c0998701998a52875160c48801528751929098169863907dff979893969495919484939192839260e490920191908a019080838388838110156147e95781810151838201526020016147d1565b6004805460408051600160a060020a038581166020808401919091528351808403820181528385018086527f5374617465436f6e74726163744368616e6765642861646472657373290000009052935192839003605d01832060e060020a63907dff97028452600160248501819052604485018290526000606486018190526084860181905260a4860181905260c0988601988952865160c48701528651949097169763907dff979791959294919384938493839260e4909201918a01908083838883811015614a1c578181015183820152602001614a04565b600654604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483015288811660248301529151600093929092169163da46098c9188918a91614d07918991879163dd62ed3e9160448082019260209290919082900301818d87803b158015614cf357600080fd5b505af115801561423c573d6000803e3d6000fd5b6040805160e060020a63ffffffff8716028152600160a060020a03948516600482015292909316602483015260448201529051606480830192600092919082900301818387803b158015614d5a57600080fd5b505af1158015614d6e573d6000803e3d6000fd5b50505050614d7e858585856151a9565b9695505050505050565b600080600080600080600080614da88a8a60e960020a622c2229026110f5565b600554909850614dca90600160a060020a031660e960020a622c222902610e22565b9650614dde60e960020a622c222902611422565b9550614df0888763ffffffff613a6016565b9450614e75857384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63d5e5e6e66040518163ffffffff1660e060020a02815260040160206040518083038186803b158015614e3d57600080fd5b505af4158015614e51573d6000803e3d6000fd5b505050506040513d6020811015614e6757600080fd5b50519063ffffffff613afb16565b935086881415614f7157601054600554604080517fb16c09f0000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201529051919092169163b16c09f091602480830192600092919082900301818387803b158015614ee957600080fd5b505af1158015614efd573d6000803e3d6000fd5b50505050601060009054906101000a9004600160a060020a0316600160a060020a031663ba08f2996040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015614f5457600080fd5b505af1158015614f68573d6000803e3d6000fd5b50505050615031565b614f81878963ffffffff6146ba16565b9250614f93868963ffffffff6146ba16565b9150614fa5838363ffffffff613a6016565b601054600554604080517fa764eb45000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a764eb459160448082019260009290919082900301818387803b15801561501857600080fd5b505af115801561502c573d6000803e3d6000fd5b505050505b601054604080517f463177120000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691633d31e97b9161509f91889185916346317712916004808201926020929091908290030181600087803b15801561453757600080fd5b6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b1580156150d857600080fd5b505af11580156150ec573d6000803e3d6000fd5b5050505050505050505050505050565b6000610e19858585856151a9565b6000806151308461512487600a870263ffffffff61517b16565b9063ffffffff6154e316565b90506005600a825b061061514257600a015b600a9004949350505050565b600080600a8304615165868663ffffffff61517b16565b81151561516e57fe5b0490506005600a82615138565b60008083151561518e5760009150610beb565b5082820282848281151561519e57fe5b0414613a7957600080fd5b6000600160a060020a038416151561520b576040805160e560020a62461bcd02815260206004820181905260248201527f43616e6e6f74207472616e7366657220746f2074686520302061646472657373604482015290519081900360640190fd5b600160a060020a038416301415615292576040805160e560020a62461bcd02815260206004820152602a60248201527f43616e6e6f74207472616e7366657220746f2074686520756e6465726c79696e60448201527f6720636f6e747261637400000000000000000000000000000000000000000000606482015290519081900360840190fd5b600454600160a060020a038581169116141561531e576040805160e560020a62461bcd02815260206004820152602560248201527f43616e6e6f74207472616e7366657220746f207468652070726f787920636f6e60448201527f7472616374000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6006546040805160e060020a6370a08231028152600160a060020a0388811660048301529151919092169163b46310f691889161538191889186916370a08231916024808201926020929091908290030181600087803b158015614cf357600080fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156153d357600080fd5b505af11580156153e7573d6000803e3d6000fd5b50506006546040805160e060020a6370a08231028152600160a060020a038981166004830152915191909216935063b46310f69250879161546291889186916370a08231916024808201926020929091908290030181600087803b15801561544e57600080fd5b505af1158015614e51573d6000803e3d6000fd5b6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b1580156154b457600080fd5b505af11580156154c8573d6000803e3d6000fd5b505050506154d885858585615506565b61351f85858561572f565b6000808083116154f257600080fd5b82848115156154fd57fe5b04949350505050565b60055460009074010000000000000000000000000000000000000000900460ff161561557c576040805160e560020a62461bcd02815260206004820152601e60248201527f526576657274656420746f2070726576656e74207265656e7472616e63790000604482015290519081900360640190fd5b506005805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055823b600081111561570a5783600160a060020a03168584846040516024018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015615628578181015183820152602001615610565b50505050905090810190601f1680156156555780820380516001836020036101000a031916815260200191505b5060408051601f19818403018152918152602082018051600160e060020a03167fc0ee0b8a000000000000000000000000000000000000000000000000000000001781529051825192975095508594509250905080838360005b838110156156c75781810151838201526020016156af565b50505050905090810190601f1680156156f45780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af15050505b50506005805474ff000000000000000000000000000000000000000019169055505050565b600480546040805160208082018690528251808303820181528284018085527f5472616e7366657228616464726573732c616464726573732c75696e7432353690527f29000000000000000000000000000000000000000000000000000000000000006060840152925191829003606101822060e060020a63907dff9702835260036024840181905260448401829052600160a060020a038a8116606486018190528a821660848701819052600060a4880181905260c09a88019a8b52885160c48901528851939099169963907dff97999497959692959194939092839260e40191908a01908083838883811015613a0f5781810151838201526020016139f7565b8154818355818111156127265760008381526020902061272691810190830161383691905b8082111561586a5760008155600101615856565b509056004f6e6c792074686520636f6e7472616374206f776e6572206d617920706572665468697320616374696f6e2063616e206f6e6c7920626520706572666f726d656f726d207468697320616374696f6e000000000000000000000000000000000052617465207374616c65206f72206e6f6e6578697374616e742063757272656e6420627920746865206f776e6572000000000000000000000000000000000000a165627a7a723058207c9f49a69e94579502b6c3bc3df2a82d7090bbd1f75b2c1eb554eaf4834e466a0029
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c011a72400e58ecd99ee497cf89e3775d4bd732f0000000000000000000000005b1b5fea1b99d83ad479df0c222f0492385381dd0000000000000000000000007e295884f3f5e2ea462620018e9193a1c305c185000000000000000000000000ea5e288b4f9d7e66da162e2af0db371783f6245400000000000000000000000073b172756bd5ddf0110ba8d7b88816eb639eb21c000000000000000000000000ebdbac38835a1105851e80c7fa1f1e6e25a86e32
-----Decoded View---------------
Arg [0] : _proxy (address): 0xC011A72400E58ecD99Ee497CF89E3775d4bd732F
Arg [1] : _tokenState (address): 0x5b1b5fEa1b99D83aD479dF0C222F0492385381dD
Arg [2] : _synthetixState (address): 0x7E295884F3f5e2ea462620018E9193a1C305C185
Arg [3] : _owner (address): 0xeA5e288b4f9d7e66DA162E2Af0dB371783f62454
Arg [4] : _exchangeRates (address): 0x73b172756BD5DDf0110Ba8D7b88816Eb639Eb21c
Arg [5] : _feePool (address): 0xEBdBac38835A1105851e80C7Fa1f1E6e25A86e32
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000c011a72400e58ecd99ee497cf89e3775d4bd732f
Arg [1] : 0000000000000000000000005b1b5fea1b99d83ad479df0c222f0492385381dd
Arg [2] : 0000000000000000000000007e295884f3f5e2ea462620018e9193a1c305c185
Arg [3] : 000000000000000000000000ea5e288b4f9d7e66da162e2af0db371783f62454
Arg [4] : 00000000000000000000000073b172756bd5ddf0110ba8d7b88816eb639eb21c
Arg [5] : 000000000000000000000000ebdbac38835a1105851e80c7fa1f1e6e25a86e32
Swarm Source
bzzr://7c9f49a69e94579502b6c3bc3df2a82d7090bbd1f75b2c1eb554eaf4834e466a
Loading...
Loading
Loading...
Loading
OVERVIEW
The legacy contract address for Synthetix: Synth SNX.Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.