Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 910 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Settle | 11512683 | 1891 days ago | IN | 0 ETH | 0.02868713 | ||||
| Settle | 11511549 | 1891 days ago | IN | 0 ETH | 0.00501782 | ||||
| Settle | 11511548 | 1891 days ago | IN | 0 ETH | 0.00501795 | ||||
| Settle | 11511547 | 1891 days ago | IN | 0 ETH | 0.00793249 | ||||
| Settle | 11511546 | 1891 days ago | IN | 0 ETH | 0.0048397 | ||||
| Settle | 11511545 | 1891 days ago | IN | 0 ETH | 0.00782804 | ||||
| Settle | 11511544 | 1891 days ago | IN | 0 ETH | 0.0051001 | ||||
| Settle | 11511540 | 1891 days ago | IN | 0 ETH | 0.00751443 | ||||
| Settle | 11511539 | 1891 days ago | IN | 0 ETH | 0.0051001 | ||||
| Settle | 11511537 | 1891 days ago | IN | 0 ETH | 0.00501744 | ||||
| Settle | 11511536 | 1891 days ago | IN | 0 ETH | 0.00782804 | ||||
| Settle | 11511536 | 1891 days ago | IN | 0 ETH | 0.00769074 | ||||
| Settle | 11511533 | 1891 days ago | IN | 0 ETH | 0.0051001 | ||||
| Settle | 11511529 | 1891 days ago | IN | 0 ETH | 0.01081899 | ||||
| Settle | 11511527 | 1891 days ago | IN | 0 ETH | 0.00814858 | ||||
| Settle | 11511526 | 1891 days ago | IN | 0 ETH | 0.00509854 | ||||
| Settle | 11511523 | 1891 days ago | IN | 0 ETH | 0.00533664 | ||||
| Settle | 11511522 | 1891 days ago | IN | 0 ETH | 0.00502143 | ||||
| Settle | 11511520 | 1891 days ago | IN | 0 ETH | 0.0077684 | ||||
| Settle | 11511518 | 1891 days ago | IN | 0 ETH | 0.00509867 | ||||
| Settle | 11511517 | 1891 days ago | IN | 0 ETH | 0.00509854 | ||||
| Settle | 11511515 | 1891 days ago | IN | 0 ETH | 0.00501757 | ||||
| Settle | 11511513 | 1891 days ago | IN | 0 ETH | 0.01328426 | ||||
| Settle | 11511512 | 1891 days ago | IN | 0 ETH | 0.00502105 | ||||
| Settle | 11511509 | 1891 days ago | IN | 0 ETH | 0.00866527 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
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:
ExchangerWithVirtualSynth
Compiler Version
v0.5.16+commit.9c3226ce
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2020-12-01
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: ExchangerWithVirtualSynth.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/ExchangerWithVirtualSynth.sol
* Docs: https://docs.synthetix.io/contracts/ExchangerWithVirtualSynth
*
* Contract Dependencies:
* - ERC20
* - Exchanger
* - IAddressResolver
* - IERC20
* - IExchanger
* - IVirtualSynth
* - MixinResolver
* - MixinSystemSettings
* - Owned
* Libraries:
* - SafeDecimalMath
* - SafeMath
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.5.16;
// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// https://docs.synthetix.io/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
function getSynth(bytes32 key) external view returns (address);
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}
// https://docs.synthetix.io/contracts/source/interfaces/isynth
interface ISynth {
// Views
function currencyKey() external view returns (bytes32);
function transferableSynths(address account) external view returns (uint);
// Mutative functions
function transferAndSettle(address to, uint value) external returns (bool);
function transferFromAndSettle(
address from,
address to,
uint value
) external returns (bool);
// Restricted: used internally to Synthetix
function burn(address account, uint amount) external;
function issue(address account, uint amount) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/iissuer
interface IIssuer {
// Views
function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availableSynthCount() external view returns (uint);
function availableSynths(uint index) external view returns (ISynth);
function canBurnSynths(address account) external view returns (bool);
function collateral(address account) external view returns (uint);
function collateralisationRatio(address issuer) external view returns (uint);
function collateralisationRatioAndAnyRatesInvalid(address _issuer)
external
view
returns (uint cratio, bool anyRateIsInvalid);
function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance);
function issuanceRatio() external view returns (uint);
function lastIssueEvent(address account) external view returns (uint);
function maxIssuableSynths(address issuer) external view returns (uint maxIssuable);
function minimumStakeTime() external view returns (uint);
function remainingIssuableSynths(address issuer)
external
view
returns (
uint maxIssuable,
uint alreadyIssued,
uint totalSystemDebt
);
function synths(bytes32 currencyKey) external view returns (ISynth);
function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory);
function synthsByAddress(address synthAddress) external view returns (bytes32);
function totalIssuedSynths(bytes32 currencyKey, bool excludeEtherCollateral) external view returns (uint);
function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance)
external
view
returns (uint transferable, bool anyRateIsInvalid);
// Restricted: used internally to Synthetix
function issueSynths(address from, uint amount) external;
function issueSynthsOnBehalf(
address issueFor,
address from,
uint amount
) external;
function issueMaxSynths(address from) external;
function issueMaxSynthsOnBehalf(address issueFor, address from) external;
function burnSynths(address from, uint amount) external;
function burnSynthsOnBehalf(
address burnForAddress,
address from,
uint amount
) external;
function burnSynthsToTarget(address from) external;
function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external;
function liquidateDelinquentAccount(
address account,
uint susdAmount,
address liquidator
) external returns (uint totalRedeemed, uint amountToLiquidate);
}
// Inheritance
// https://docs.synthetix.io/contracts/source/contracts/addressresolver
contract AddressResolver is Owned, IAddressResolver {
mapping(bytes32 => address) public repository;
constructor(address _owner) public Owned(_owner) {}
/* ========== MUTATIVE FUNCTIONS ========== */
function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner {
require(names.length == destinations.length, "Input lengths must match");
for (uint i = 0; i < names.length; i++) {
repository[names[i]] = destinations[i];
}
}
/* ========== VIEWS ========== */
function getAddress(bytes32 name) external view returns (address) {
return repository[name];
}
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) {
address _foundAddress = repository[name];
require(_foundAddress != address(0), reason);
return _foundAddress;
}
function getSynth(bytes32 key) external view returns (address) {
IIssuer issuer = IIssuer(repository["Issuer"]);
require(address(issuer) != address(0), "Cannot find Issuer address");
return address(issuer.synths(key));
}
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/mixinresolver
contract MixinResolver is Owned {
AddressResolver public resolver;
mapping(bytes32 => address) private addressCache;
bytes32[] public resolverAddressesRequired;
uint public constant MAX_ADDRESSES_FROM_RESOLVER = 24;
constructor(address _resolver, bytes32[MAX_ADDRESSES_FROM_RESOLVER] memory _addressesToCache) internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
for (uint i = 0; i < _addressesToCache.length; i++) {
if (_addressesToCache[i] != bytes32(0)) {
resolverAddressesRequired.push(_addressesToCache[i]);
} else {
// End early once an empty item is found - assumes there are no empty slots in
// _addressesToCache
break;
}
}
resolver = AddressResolver(_resolver);
// Do not sync the cache as addresses may not be in the resolver yet
}
/* ========== SETTERS ========== */
function setResolverAndSyncCache(AddressResolver _resolver) external onlyOwner {
resolver = _resolver;
for (uint i = 0; i < resolverAddressesRequired.length; i++) {
bytes32 name = resolverAddressesRequired[i];
// Note: can only be invoked once the resolver has all the targets needed added
addressCache[name] = resolver.requireAndGetAddress(name, "Resolver missing target");
}
}
/* ========== VIEWS ========== */
function requireAndGetAddress(bytes32 name, string memory reason) internal view returns (address) {
address _foundAddress = addressCache[name];
require(_foundAddress != address(0), reason);
return _foundAddress;
}
// Note: this could be made external in a utility contract if addressCache was made public
// (used for deployment)
function isResolverCached(AddressResolver _resolver) external view returns (bool) {
if (resolver != _resolver) {
return false;
}
// otherwise, check everything
for (uint i = 0; i < resolverAddressesRequired.length; i++) {
bytes32 name = resolverAddressesRequired[i];
// false if our cache is invalid or if the resolver doesn't have the required address
if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) {
return false;
}
}
return true;
}
// Note: can be made external into a utility contract (used for deployment)
function getResolverAddressesRequired()
external
view
returns (bytes32[MAX_ADDRESSES_FROM_RESOLVER] memory addressesRequired)
{
for (uint i = 0; i < resolverAddressesRequired.length; i++) {
addressesRequired[i] = resolverAddressesRequired[i];
}
}
/* ========== INTERNAL FUNCTIONS ========== */
function appendToAddressCache(bytes32 name) internal {
resolverAddressesRequired.push(name);
require(resolverAddressesRequired.length < MAX_ADDRESSES_FROM_RESOLVER, "Max resolver cache size met");
// Because this is designed to be called internally in constructors, we don't
// check the address exists already in the resolver
addressCache[name] = resolver.getAddress(name);
}
}
// https://docs.synthetix.io/contracts/source/interfaces/iflexiblestorage
interface IFlexibleStorage {
// Views
function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint);
function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory);
function getIntValue(bytes32 contractName, bytes32 record) external view returns (int);
function getIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (int[] memory);
function getAddressValue(bytes32 contractName, bytes32 record) external view returns (address);
function getAddressValues(bytes32 contractName, bytes32[] calldata records) external view returns (address[] memory);
function getBoolValue(bytes32 contractName, bytes32 record) external view returns (bool);
function getBoolValues(bytes32 contractName, bytes32[] calldata records) external view returns (bool[] memory);
function getBytes32Value(bytes32 contractName, bytes32 record) external view returns (bytes32);
function getBytes32Values(bytes32 contractName, bytes32[] calldata records) external view returns (bytes32[] memory);
// Mutative functions
function deleteUIntValue(bytes32 contractName, bytes32 record) external;
function deleteIntValue(bytes32 contractName, bytes32 record) external;
function deleteAddressValue(bytes32 contractName, bytes32 record) external;
function deleteBoolValue(bytes32 contractName, bytes32 record) external;
function deleteBytes32Value(bytes32 contractName, bytes32 record) external;
function setUIntValue(
bytes32 contractName,
bytes32 record,
uint value
) external;
function setUIntValues(
bytes32 contractName,
bytes32[] calldata records,
uint[] calldata values
) external;
function setIntValue(
bytes32 contractName,
bytes32 record,
int value
) external;
function setIntValues(
bytes32 contractName,
bytes32[] calldata records,
int[] calldata values
) external;
function setAddressValue(
bytes32 contractName,
bytes32 record,
address value
) external;
function setAddressValues(
bytes32 contractName,
bytes32[] calldata records,
address[] calldata values
) external;
function setBoolValue(
bytes32 contractName,
bytes32 record,
bool value
) external;
function setBoolValues(
bytes32 contractName,
bytes32[] calldata records,
bool[] calldata values
) external;
function setBytes32Value(
bytes32 contractName,
bytes32 record,
bytes32 value
) external;
function setBytes32Values(
bytes32 contractName,
bytes32[] calldata records,
bytes32[] calldata values
) external;
}
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/mixinsystemsettings
contract MixinSystemSettings is MixinResolver {
bytes32 internal constant SETTING_CONTRACT_NAME = "SystemSettings";
bytes32 internal constant SETTING_WAITING_PERIOD_SECS = "waitingPeriodSecs";
bytes32 internal constant SETTING_PRICE_DEVIATION_THRESHOLD_FACTOR = "priceDeviationThresholdFactor";
bytes32 internal constant SETTING_ISSUANCE_RATIO = "issuanceRatio";
bytes32 internal constant SETTING_FEE_PERIOD_DURATION = "feePeriodDuration";
bytes32 internal constant SETTING_TARGET_THRESHOLD = "targetThreshold";
bytes32 internal constant SETTING_LIQUIDATION_DELAY = "liquidationDelay";
bytes32 internal constant SETTING_LIQUIDATION_RATIO = "liquidationRatio";
bytes32 internal constant SETTING_LIQUIDATION_PENALTY = "liquidationPenalty";
bytes32 internal constant SETTING_RATE_STALE_PERIOD = "rateStalePeriod";
bytes32 internal constant SETTING_EXCHANGE_FEE_RATE = "exchangeFeeRate";
bytes32 internal constant SETTING_MINIMUM_STAKE_TIME = "minimumStakeTime";
bytes32 internal constant SETTING_AGGREGATOR_WARNING_FLAGS = "aggregatorWarningFlags";
bytes32 internal constant SETTING_TRADING_REWARDS_ENABLED = "tradingRewardsEnabled";
bytes32 internal constant SETTING_DEBT_SNAPSHOT_STALE_TIME = "debtSnapshotStaleTime";
bytes32 private constant CONTRACT_FLEXIBLESTORAGE = "FlexibleStorage";
constructor() internal {
appendToAddressCache(CONTRACT_FLEXIBLESTORAGE);
}
function flexibleStorage() internal view returns (IFlexibleStorage) {
return IFlexibleStorage(requireAndGetAddress(CONTRACT_FLEXIBLESTORAGE, "Missing FlexibleStorage address"));
}
function getTradingRewardsEnabled() internal view returns (bool) {
return flexibleStorage().getBoolValue(SETTING_CONTRACT_NAME, SETTING_TRADING_REWARDS_ENABLED);
}
function getWaitingPeriodSecs() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_WAITING_PERIOD_SECS);
}
function getPriceDeviationThresholdFactor() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_PRICE_DEVIATION_THRESHOLD_FACTOR);
}
function getIssuanceRatio() internal view returns (uint) {
// lookup on flexible storage directly for gas savings (rather than via SystemSettings)
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ISSUANCE_RATIO);
}
function getFeePeriodDuration() internal view returns (uint) {
// lookup on flexible storage directly for gas savings (rather than via SystemSettings)
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_FEE_PERIOD_DURATION);
}
function getTargetThreshold() internal view returns (uint) {
// lookup on flexible storage directly for gas savings (rather than via SystemSettings)
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_TARGET_THRESHOLD);
}
function getLiquidationDelay() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_DELAY);
}
function getLiquidationRatio() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_RATIO);
}
function getLiquidationPenalty() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_PENALTY);
}
function getRateStalePeriod() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_RATE_STALE_PERIOD);
}
function getExchangeFeeRate(bytes32 currencyKey) internal view returns (uint) {
return
flexibleStorage().getUIntValue(
SETTING_CONTRACT_NAME,
keccak256(abi.encodePacked(SETTING_EXCHANGE_FEE_RATE, currencyKey))
);
}
function getMinimumStakeTime() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_MINIMUM_STAKE_TIME);
}
function getAggregatorWarningFlags() internal view returns (address) {
return flexibleStorage().getAddressValue(SETTING_CONTRACT_NAME, SETTING_AGGREGATOR_WARNING_FLAGS);
}
function getDebtSnapshotStaleTime() internal view returns (uint) {
return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_DEBT_SNAPSHOT_STALE_TIME);
}
}
interface IVirtualSynth {
// Views
function balanceOfUnderlying(address account) external view returns (uint);
function rate() external view returns (uint);
function readyToSettle() external view returns (bool);
function secsLeftInWaitingPeriod() external view returns (uint);
function settled() external view returns (bool);
function synth() external view returns (ISynth);
// Mutative functions
function settle(address account) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/iexchanger
interface IExchanger {
// Views
function calculateAmountAfterSettlement(
address from,
bytes32 currencyKey,
uint amount,
uint refunded
) external view returns (uint amountAfterSettlement);
function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool);
function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) external view returns (uint);
function settlementOwing(address account, bytes32 currencyKey)
external
view
returns (
uint reclaimAmount,
uint rebateAmount,
uint numEntries
);
function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool);
function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
external
view
returns (uint exchangeFeeRate);
function getAmountsForExchange(
uint sourceAmount,
bytes32 sourceCurrencyKey,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint amountReceived,
uint fee,
uint exchangeFeeRate
);
function priceDeviationThresholdFactor() external view returns (uint);
function waitingPeriodSecs() external view returns (uint);
// Mutative functions
function exchange(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress
) external returns (uint amountReceived);
function exchangeOnBehalf(
address exchangeForAddress,
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
) external returns (uint amountReceived);
function exchangeWithTracking(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
address originator,
bytes32 trackingCode
) external returns (uint amountReceived);
function exchangeOnBehalfWithTracking(
address exchangeForAddress,
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address originator,
bytes32 trackingCode
) external returns (uint amountReceived);
function exchangeWithVirtual(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
bytes32 trackingCode
) external returns (uint amountReceived, IVirtualSynth vSynth);
function settle(address from, bytes32 currencyKey)
external
returns (
uint reclaimed,
uint refunded,
uint numEntries
);
function setLastExchangeRateForSynth(bytes32 currencyKey, uint rate) external;
function suspendSynthWithInvalidRate(bytes32 currencyKey) external;
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
// Libraries
// https://docs.synthetix.io/contracts/source/libraries/safedecimalmath
library SafeDecimalMath {
using SafeMath for uint;
/* Number of decimal places in the representations. */
uint8 public constant decimals = 18;
uint8 public constant highPrecisionDecimals = 27;
/* The number representing 1.0. */
uint public constant UNIT = 10**uint(decimals);
/* The number representing 1.0 for higher fidelity numbers. */
uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);
uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);
/**
* @return Provides an interface to UNIT.
*/
function unit() external pure returns (uint) {
return UNIT;
}
/**
* @return Provides an interface to PRECISE_UNIT.
*/
function preciseUnit() external pure returns (uint) {
return PRECISE_UNIT;
}
/**
* @return The result of multiplying x and y, interpreting the operands as fixed-point
* decimals.
*
* @dev A unit factor is divided out after the product of x and y is evaluated,
* so that product must be less than 2**256. As this is an integer division,
* the internal division always rounds down. This helps save on gas. Rounding
* is more expensive on gas.
*/
function multiplyDecimal(uint x, uint y) internal pure returns (uint) {
/* Divide by UNIT to remove the extra factor introduced by the product. */
return x.mul(y) / UNIT;
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of the specified precision unit.
*
* @dev The operands should be in the form of a the specified unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function _multiplyDecimalRound(
uint x,
uint y,
uint precisionUnit
) private pure returns (uint) {
/* Divide by UNIT to remove the extra factor introduced by the product. */
uint quotientTimesTen = x.mul(y) / (precisionUnit / 10);
if (quotientTimesTen % 10 >= 5) {
quotientTimesTen += 10;
}
return quotientTimesTen / 10;
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of a precise unit.
*
* @dev The operands should be in the precise unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, PRECISE_UNIT);
}
/**
* @return The result of safely multiplying x and y, interpreting the operands
* as fixed-point decimals of a standard unit.
*
* @dev The operands should be in the standard unit factor which will be
* divided out after the product of x and y is evaluated, so that product must be
* less than 2**256.
*
* Unlike multiplyDecimal, this function rounds the result to the nearest increment.
* Rounding is useful when you need to retain fidelity for small decimal numbers
* (eg. small fractions or percentages).
*/
function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) {
return _multiplyDecimalRound(x, y, UNIT);
}
/**
* @return The result of safely dividing x and y. The return value is a high
* precision decimal.
*
* @dev y is divided after the product of x and the standard precision unit
* is evaluated, so the product of x and UNIT must be less than 2**256. As
* this is an integer division, the result is always rounded down.
* This helps save on gas. Rounding is more expensive on gas.
*/
function divideDecimal(uint x, uint y) internal pure returns (uint) {
/* Reintroduce the UNIT factor that will be divided out by y. */
return x.mul(UNIT).div(y);
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* decimal in the precision unit specified in the parameter.
*
* @dev y is divided after the product of x and the specified precision unit
* is evaluated, so the product of x and the specified precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function _divideDecimalRound(
uint x,
uint y,
uint precisionUnit
) private pure returns (uint) {
uint resultTimesTen = x.mul(precisionUnit * 10).div(y);
if (resultTimesTen % 10 >= 5) {
resultTimesTen += 10;
}
return resultTimesTen / 10;
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* standard precision decimal.
*
* @dev y is divided after the product of x and the standard precision unit
* is evaluated, so the product of x and the standard precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function divideDecimalRound(uint x, uint y) internal pure returns (uint) {
return _divideDecimalRound(x, y, UNIT);
}
/**
* @return The result of safely dividing x and y. The return value is as a rounded
* high precision decimal.
*
* @dev y is divided after the product of x and the high precision unit
* is evaluated, so the product of x and the high precision unit must
* be less than 2**256. The result is rounded to the nearest increment.
*/
function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
return _divideDecimalRound(x, y, PRECISE_UNIT);
}
/**
* @dev Convert a standard decimal representation to a high precision one.
*/
function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
}
/**
* @dev Convert a high precision decimal to a standard decimal representation.
*/
function preciseDecimalToDecimal(uint i) internal pure returns (uint) {
uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);
if (quotientTimesTen % 10 >= 5) {
quotientTimesTen += 10;
}
return quotientTimesTen / 10;
}
}
// https://docs.synthetix.io/contracts/source/interfaces/isystemstatus
interface ISystemStatus {
struct Status {
bool canSuspend;
bool canResume;
}
struct Suspension {
bool suspended;
// reason is an integer code,
// 0 => no reason, 1 => upgrading, 2+ => defined by system usage
uint248 reason;
}
// Views
function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume);
function requireSystemActive() external view;
function requireIssuanceActive() external view;
function requireExchangeActive() external view;
function requireSynthActive(bytes32 currencyKey) external view;
function requireSynthsActive(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view;
function synthSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);
// Restricted functions
function suspendSynth(bytes32 currencyKey, uint256 reason) external;
function updateAccessControl(
bytes32 section,
address account,
bool canSuspend,
bool canResume
) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/iexchangestate
interface IExchangeState {
// Views
struct ExchangeEntry {
bytes32 src;
uint amount;
bytes32 dest;
uint amountReceived;
uint exchangeFeeRate;
uint timestamp;
uint roundIdForSrc;
uint roundIdForDest;
}
function getLengthOfEntries(address account, bytes32 currencyKey) external view returns (uint);
function getEntryAt(
address account,
bytes32 currencyKey,
uint index
)
external
view
returns (
bytes32 src,
uint amount,
bytes32 dest,
uint amountReceived,
uint exchangeFeeRate,
uint timestamp,
uint roundIdForSrc,
uint roundIdForDest
);
function getMaxTimestamp(address account, bytes32 currencyKey) external view returns (uint);
// Mutative functions
function appendExchangeEntry(
address account,
bytes32 src,
uint amount,
bytes32 dest,
uint amountReceived,
uint exchangeFeeRate,
uint timestamp,
uint roundIdForSrc,
uint roundIdForDest
) external;
function removeEntries(address account, bytes32 currencyKey) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/iexchangerates
interface IExchangeRates {
// Structs
struct RateAndUpdatedTime {
uint216 rate;
uint40 time;
}
struct InversePricing {
uint entryPoint;
uint upperLimit;
uint lowerLimit;
bool frozenAtUpperLimit;
bool frozenAtLowerLimit;
}
// Views
function aggregators(bytes32 currencyKey) external view returns (address);
function aggregatorWarningFlags() external view returns (address);
function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool);
function canFreezeRate(bytes32 currencyKey) external view returns (bool);
function currentRoundForRate(bytes32 currencyKey) external view returns (uint);
function currenciesUsingAggregator(address aggregator) external view returns (bytes32[] memory);
function effectiveValue(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
) external view returns (uint value);
function effectiveValueAndRates(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint value,
uint sourceRate,
uint destinationRate
);
function effectiveValueAtRound(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
uint roundIdForSrc,
uint roundIdForDest
) external view returns (uint value);
function getCurrentRoundId(bytes32 currencyKey) external view returns (uint);
function getLastRoundIdBeforeElapsedSecs(
bytes32 currencyKey,
uint startingRoundId,
uint startingTimestamp,
uint timediff
) external view returns (uint);
function inversePricing(bytes32 currencyKey)
external
view
returns (
uint entryPoint,
uint upperLimit,
uint lowerLimit,
bool frozenAtUpperLimit,
bool frozenAtLowerLimit
);
function lastRateUpdateTimes(bytes32 currencyKey) external view returns (uint256);
function oracle() external view returns (address);
function rateAndTimestampAtRound(bytes32 currencyKey, uint roundId) external view returns (uint rate, uint time);
function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time);
function rateAndInvalid(bytes32 currencyKey) external view returns (uint rate, bool isInvalid);
function rateForCurrency(bytes32 currencyKey) external view returns (uint);
function rateIsFlagged(bytes32 currencyKey) external view returns (bool);
function rateIsFrozen(bytes32 currencyKey) external view returns (bool);
function rateIsInvalid(bytes32 currencyKey) external view returns (bool);
function rateIsStale(bytes32 currencyKey) external view returns (bool);
function rateStalePeriod() external view returns (uint);
function ratesAndUpdatedTimeForCurrencyLastNRounds(bytes32 currencyKey, uint numRounds)
external
view
returns (uint[] memory rates, uint[] memory times);
function ratesAndInvalidForCurrencies(bytes32[] calldata currencyKeys)
external
view
returns (uint[] memory rates, bool anyRateInvalid);
function ratesForCurrencies(bytes32[] calldata currencyKeys) external view returns (uint[] memory);
// Mutative functions
function freezeRate(bytes32 currencyKey) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/isynthetix
interface ISynthetix {
// Views
function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);
function availableCurrencyKeys() external view returns (bytes32[] memory);
function availableSynthCount() external view returns (uint);
function availableSynths(uint index) external view returns (ISynth);
function collateral(address account) external view returns (uint);
function collateralisationRatio(address issuer) external view returns (uint);
function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint);
function isWaitingPeriod(bytes32 currencyKey) external view returns (bool);
function maxIssuableSynths(address issuer) external view returns (uint maxIssuable);
function remainingIssuableSynths(address issuer)
external
view
returns (
uint maxIssuable,
uint alreadyIssued,
uint totalSystemDebt
);
function synths(bytes32 currencyKey) external view returns (ISynth);
function synthsByAddress(address synthAddress) external view returns (bytes32);
function totalIssuedSynths(bytes32 currencyKey) external view returns (uint);
function totalIssuedSynthsExcludeEtherCollateral(bytes32 currencyKey) external view returns (uint);
function transferableSynthetix(address account) external view returns (uint transferable);
// Mutative Functions
function burnSynths(uint amount) external;
function burnSynthsOnBehalf(address burnForAddress, uint amount) external;
function burnSynthsToTarget() external;
function burnSynthsToTargetOnBehalf(address burnForAddress) external;
function exchange(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
) external returns (uint amountReceived);
function exchangeOnBehalf(
address exchangeForAddress,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
) external returns (uint amountReceived);
function exchangeWithTracking(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address originator,
bytes32 trackingCode
) external returns (uint amountReceived);
function exchangeOnBehalfWithTracking(
address exchangeForAddress,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address originator,
bytes32 trackingCode
) external returns (uint amountReceived);
function exchangeWithVirtual(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
bytes32 trackingCode
) external returns (uint amountReceived, IVirtualSynth vSynth);
function issueMaxSynths() external;
function issueMaxSynthsOnBehalf(address issueForAddress) external;
function issueSynths(uint amount) external;
function issueSynthsOnBehalf(address issueForAddress, uint amount) external;
function mint() external returns (bool);
function settle(bytes32 currencyKey)
external
returns (
uint reclaimed,
uint refunded,
uint numEntries
);
function liquidateDelinquentAccount(address account, uint susdAmount) external returns (bool);
// Restricted Functions
function mintSecondary(address account, uint amount) external;
function mintSecondaryRewards(uint amount) external;
function burnSecondary(address account, uint amount) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/ifeepool
interface IFeePool {
// Views
// solhint-disable-next-line func-name-mixedcase
function FEE_ADDRESS() external view returns (address);
function feesAvailable(address account) external view returns (uint, uint);
function feePeriodDuration() external view returns (uint);
function isFeesClaimable(address account) external view returns (bool);
function targetThreshold() external view returns (uint);
function totalFeesAvailable() external view returns (uint);
function totalRewardsAvailable() external view returns (uint);
// Mutative Functions
function claimFees() external returns (bool);
function claimOnBehalf(address claimingForAddress) external returns (bool);
function closeCurrentFeePeriod() external;
// Restricted: used internally to Synthetix
function appendAccountIssuanceRecord(
address account,
uint lockedAmount,
uint debtEntryIndex
) external;
function recordFeePaid(uint sUSDAmount) external;
function setRewardsToDistribute(uint amount) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/idelegateapprovals
interface IDelegateApprovals {
// Views
function canBurnFor(address authoriser, address delegate) external view returns (bool);
function canIssueFor(address authoriser, address delegate) external view returns (bool);
function canClaimFor(address authoriser, address delegate) external view returns (bool);
function canExchangeFor(address authoriser, address delegate) external view returns (bool);
// Mutative
function approveAllDelegatePowers(address delegate) external;
function removeAllDelegatePowers(address delegate) external;
function approveBurnOnBehalf(address delegate) external;
function removeBurnOnBehalf(address delegate) external;
function approveIssueOnBehalf(address delegate) external;
function removeIssueOnBehalf(address delegate) external;
function approveClaimOnBehalf(address delegate) external;
function removeClaimOnBehalf(address delegate) external;
function approveExchangeOnBehalf(address delegate) external;
function removeExchangeOnBehalf(address delegate) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/itradingrewards
interface ITradingRewards {
/* ========== VIEWS ========== */
function getAvailableRewards() external view returns (uint);
function getUnassignedRewards() external view returns (uint);
function getRewardsToken() external view returns (address);
function getPeriodController() external view returns (address);
function getCurrentPeriod() external view returns (uint);
function getPeriodIsClaimable(uint periodID) external view returns (bool);
function getPeriodIsFinalized(uint periodID) external view returns (bool);
function getPeriodRecordedFees(uint periodID) external view returns (uint);
function getPeriodTotalRewards(uint periodID) external view returns (uint);
function getPeriodAvailableRewards(uint periodID) external view returns (uint);
function getUnaccountedFeesForAccountForPeriod(address account, uint periodID) external view returns (uint);
function getAvailableRewardsForAccountForPeriod(address account, uint periodID) external view returns (uint);
function getAvailableRewardsForAccountForPeriods(address account, uint[] calldata periodIDs)
external
view
returns (uint totalRewards);
/* ========== MUTATIVE FUNCTIONS ========== */
function claimRewardsForPeriod(uint periodID) external;
function claimRewardsForPeriods(uint[] calldata periodIDs) external;
/* ========== RESTRICTED FUNCTIONS ========== */
function recordExchangeFeeForAccount(uint usdFeeAmount, address account) external;
function closeCurrentPeriodWithRewards(uint rewards) external;
function recoverEther(address payable recoverAddress) external;
function recoverTokens(address tokenAddress, address recoverAddress) external;
function recoverUnassignedRewardTokens(address recoverAddress) external;
function recoverAssignedRewardTokensAndDestroyPeriod(address recoverAddress, uint periodID) external;
function setPeriodController(address newPeriodController) external;
}
// https://docs.synthetix.io/contracts/source/interfaces/idebtcache
interface IDebtCache {
// Views
function cachedDebt() external view returns (uint);
function cachedSynthDebt(bytes32 currencyKey) external view returns (uint);
function cacheTimestamp() external view returns (uint);
function cacheInvalid() external view returns (bool);
function cacheStale() external view returns (bool);
function currentSynthDebts(bytes32[] calldata currencyKeys)
external
view
returns (uint[] memory debtValues, bool anyRateIsInvalid);
function cachedSynthDebts(bytes32[] calldata currencyKeys) external view returns (uint[] memory debtValues);
function currentDebt() external view returns (uint debt, bool anyRateIsInvalid);
function cacheInfo()
external
view
returns (
uint debt,
uint timestamp,
bool isInvalid,
bool isStale
);
// Mutative functions
function takeDebtSnapshot() external;
function updateCachedSynthDebts(bytes32[] calldata currencyKeys) external;
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/proxy
contract Proxy is Owned {
Proxyable public target;
constructor(address _owner) public Owned(_owner) {}
function setTarget(Proxyable _target) external onlyOwner {
target = _target;
emit TargetUpdated(_target);
}
function _emit(
bytes calldata callData,
uint numTopics,
bytes32 topic1,
bytes32 topic2,
bytes32 topic3,
bytes32 topic4
) external onlyTarget {
uint size = callData.length;
bytes memory _callData = callData;
assembly {
/* The first 32 bytes of callData contain its length (as specified by the abi).
* Length is assumed to be a uint256 and therefore maximum of 32 bytes
* in length. It is also leftpadded to be a multiple of 32 bytes.
* This means moving call_data across 32 bytes guarantees we correctly access
* the data itself. */
switch numTopics
case 0 {
log0(add(_callData, 32), size)
}
case 1 {
log1(add(_callData, 32), size, topic1)
}
case 2 {
log2(add(_callData, 32), size, topic1, topic2)
}
case 3 {
log3(add(_callData, 32), size, topic1, topic2, topic3)
}
case 4 {
log4(add(_callData, 32), size, topic1, topic2, topic3, topic4)
}
}
}
// solhint-disable no-complex-fallback
function() external payable {
// Mutable call setting Proxyable.messageSender as this is using call not delegatecall
target.setMessageSender(msg.sender);
assembly {
let free_ptr := mload(0x40)
calldatacopy(free_ptr, 0, calldatasize)
/* We must explicitly forward ether to the underlying contract as well. */
let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0)
returndatacopy(free_ptr, 0, returndatasize)
if iszero(result) {
revert(free_ptr, returndatasize)
}
return(free_ptr, returndatasize)
}
}
modifier onlyTarget {
require(Proxyable(msg.sender) == target, "Must be proxy target");
_;
}
event TargetUpdated(Proxyable newTarget);
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/proxyable
contract Proxyable is Owned {
// This contract should be treated like an abstract contract
/* The proxy this contract exists behind. */
Proxy public proxy;
Proxy public integrationProxy;
/* The caller of the proxy, passed through to this contract.
* Note that every function using this member must apply the onlyProxy or
* optionalProxy modifiers, otherwise their invocations can use stale values. */
address public messageSender;
constructor(address payable _proxy) internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setProxy(address payable _proxy) external onlyOwner {
proxy = Proxy(_proxy);
emit ProxyUpdated(_proxy);
}
function setIntegrationProxy(address payable _integrationProxy) external onlyOwner {
integrationProxy = Proxy(_integrationProxy);
}
function setMessageSender(address sender) external onlyProxy {
messageSender = sender;
}
modifier onlyProxy {
_onlyProxy();
_;
}
function _onlyProxy() private view {
require(Proxy(msg.sender) == proxy || Proxy(msg.sender) == integrationProxy, "Only the proxy can call");
}
modifier optionalProxy {
_optionalProxy();
_;
}
function _optionalProxy() private {
if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
}
modifier optionalProxy_onlyOwner {
_optionalProxy_onlyOwner();
_;
}
// solhint-disable-next-line func-name-mixedcase
function _optionalProxy_onlyOwner() private {
if (Proxy(msg.sender) != proxy && Proxy(msg.sender) != integrationProxy && messageSender != msg.sender) {
messageSender = msg.sender;
}
require(messageSender == owner, "Owner only function");
}
event ProxyUpdated(address proxyAddress);
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an `Approval` event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// Inheritance
// Libraries
// Internal references
// Note: use OZ's IERC20 here as using ours will complain about conflicting names
// during the build (VirtualSynth has IERC20 from the OZ ERC20 implementation)
// Used to have strongly-typed access to internal mutative functions in Synthetix
interface ISynthetixInternal {
function emitExchangeTracking(
bytes32 trackingCode,
bytes32 toCurrencyKey,
uint256 toAmount
) external;
function emitSynthExchange(
address account,
bytes32 fromCurrencyKey,
uint fromAmount,
bytes32 toCurrencyKey,
uint toAmount,
address toAddress
) external;
function emitExchangeReclaim(
address account,
bytes32 currencyKey,
uint amount
) external;
function emitExchangeRebate(
address account,
bytes32 currencyKey,
uint amount
) external;
}
interface IExchangerInternalDebtCache {
function updateCachedSynthDebtsWithRates(bytes32[] calldata currencyKeys, uint[] calldata currencyRates) external;
function updateCachedSynthDebts(bytes32[] calldata currencyKeys) external;
}
// https://docs.synthetix.io/contracts/source/contracts/exchanger
contract Exchanger is Owned, MixinResolver, MixinSystemSettings, IExchanger {
using SafeMath for uint;
using SafeDecimalMath for uint;
struct ExchangeEntrySettlement {
bytes32 src;
uint amount;
bytes32 dest;
uint reclaim;
uint rebate;
uint srcRoundIdAtPeriodEnd;
uint destRoundIdAtPeriodEnd;
uint timestamp;
}
bytes32 private constant sUSD = "sUSD";
// SIP-65: Decentralized circuit breaker
uint public constant CIRCUIT_BREAKER_SUSPENSION_REASON = 65;
mapping(bytes32 => uint) public lastExchangeRate;
/* ========== ADDRESS RESOLVER CONFIGURATION ========== */
bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus";
bytes32 private constant CONTRACT_EXCHANGESTATE = "ExchangeState";
bytes32 private constant CONTRACT_EXRATES = "ExchangeRates";
bytes32 private constant CONTRACT_SYNTHETIX = "Synthetix";
bytes32 private constant CONTRACT_FEEPOOL = "FeePool";
bytes32 private constant CONTRACT_TRADING_REWARDS = "TradingRewards";
bytes32 private constant CONTRACT_DELEGATEAPPROVALS = "DelegateApprovals";
bytes32 private constant CONTRACT_ISSUER = "Issuer";
bytes32 private constant CONTRACT_DEBTCACHE = "DebtCache";
bytes32[24] private addressesToCache = [
CONTRACT_SYSTEMSTATUS,
CONTRACT_EXCHANGESTATE,
CONTRACT_EXRATES,
CONTRACT_SYNTHETIX,
CONTRACT_FEEPOOL,
CONTRACT_TRADING_REWARDS,
CONTRACT_DELEGATEAPPROVALS,
CONTRACT_ISSUER,
CONTRACT_DEBTCACHE
];
constructor(address _owner, address _resolver)
public
Owned(_owner)
MixinResolver(_resolver, addressesToCache)
MixinSystemSettings()
{}
/* ========== VIEWS ========== */
function systemStatus() internal view returns (ISystemStatus) {
return ISystemStatus(requireAndGetAddress(CONTRACT_SYSTEMSTATUS, "Missing SystemStatus address"));
}
function exchangeState() internal view returns (IExchangeState) {
return IExchangeState(requireAndGetAddress(CONTRACT_EXCHANGESTATE, "Missing ExchangeState address"));
}
function exchangeRates() internal view returns (IExchangeRates) {
return IExchangeRates(requireAndGetAddress(CONTRACT_EXRATES, "Missing ExchangeRates address"));
}
function synthetix() internal view returns (ISynthetix) {
return ISynthetix(requireAndGetAddress(CONTRACT_SYNTHETIX, "Missing Synthetix address"));
}
function feePool() internal view returns (IFeePool) {
return IFeePool(requireAndGetAddress(CONTRACT_FEEPOOL, "Missing FeePool address"));
}
function tradingRewards() internal view returns (ITradingRewards) {
return ITradingRewards(requireAndGetAddress(CONTRACT_TRADING_REWARDS, "Missing TradingRewards address"));
}
function delegateApprovals() internal view returns (IDelegateApprovals) {
return IDelegateApprovals(requireAndGetAddress(CONTRACT_DELEGATEAPPROVALS, "Missing DelegateApprovals address"));
}
function issuer() internal view returns (IIssuer) {
return IIssuer(requireAndGetAddress(CONTRACT_ISSUER, "Missing Issuer address"));
}
function debtCache() internal view returns (IExchangerInternalDebtCache) {
return IExchangerInternalDebtCache(requireAndGetAddress(CONTRACT_DEBTCACHE, "Missing DebtCache address"));
}
function maxSecsLeftInWaitingPeriod(address account, bytes32 currencyKey) public view returns (uint) {
return secsLeftInWaitingPeriodForExchange(exchangeState().getMaxTimestamp(account, currencyKey));
}
function waitingPeriodSecs() external view returns (uint) {
return getWaitingPeriodSecs();
}
function tradingRewardsEnabled() external view returns (bool) {
return getTradingRewardsEnabled();
}
function priceDeviationThresholdFactor() external view returns (uint) {
return getPriceDeviationThresholdFactor();
}
function settlementOwing(address account, bytes32 currencyKey)
public
view
returns (
uint reclaimAmount,
uint rebateAmount,
uint numEntries
)
{
(reclaimAmount, rebateAmount, numEntries, ) = _settlementOwing(account, currencyKey);
}
// Internal function to emit events for each individual rebate and reclaim entry
function _settlementOwing(address account, bytes32 currencyKey)
internal
view
returns (
uint reclaimAmount,
uint rebateAmount,
uint numEntries,
ExchangeEntrySettlement[] memory
)
{
// Need to sum up all reclaim and rebate amounts for the user and the currency key
numEntries = exchangeState().getLengthOfEntries(account, currencyKey);
// For each unsettled exchange
ExchangeEntrySettlement[] memory settlements = new ExchangeEntrySettlement[](numEntries);
for (uint i = 0; i < numEntries; i++) {
uint reclaim;
uint rebate;
// fetch the entry from storage
IExchangeState.ExchangeEntry memory exchangeEntry = _getExchangeEntry(account, currencyKey, i);
// determine the last round ids for src and dest pairs when period ended or latest if not over
(uint srcRoundIdAtPeriodEnd, uint destRoundIdAtPeriodEnd) = getRoundIdsAtPeriodEnd(exchangeEntry);
// given these round ids, determine what effective value they should have received
uint destinationAmount = exchangeRates().effectiveValueAtRound(
exchangeEntry.src,
exchangeEntry.amount,
exchangeEntry.dest,
srcRoundIdAtPeriodEnd,
destRoundIdAtPeriodEnd
);
// and deduct the fee from this amount using the exchangeFeeRate from storage
uint amountShouldHaveReceived = _getAmountReceivedForExchange(destinationAmount, exchangeEntry.exchangeFeeRate);
// SIP-65 settlements where the amount at end of waiting period is beyond the threshold, then
// settle with no reclaim or rebate
if (!_isDeviationAboveThreshold(exchangeEntry.amountReceived, amountShouldHaveReceived)) {
if (exchangeEntry.amountReceived > amountShouldHaveReceived) {
// if they received more than they should have, add to the reclaim tally
reclaim = exchangeEntry.amountReceived.sub(amountShouldHaveReceived);
reclaimAmount = reclaimAmount.add(reclaim);
} else if (amountShouldHaveReceived > exchangeEntry.amountReceived) {
// if less, add to the rebate tally
rebate = amountShouldHaveReceived.sub(exchangeEntry.amountReceived);
rebateAmount = rebateAmount.add(rebate);
}
}
settlements[i] = ExchangeEntrySettlement({
src: exchangeEntry.src,
amount: exchangeEntry.amount,
dest: exchangeEntry.dest,
reclaim: reclaim,
rebate: rebate,
srcRoundIdAtPeriodEnd: srcRoundIdAtPeriodEnd,
destRoundIdAtPeriodEnd: destRoundIdAtPeriodEnd,
timestamp: exchangeEntry.timestamp
});
}
return (reclaimAmount, rebateAmount, numEntries, settlements);
}
function _getExchangeEntry(
address account,
bytes32 currencyKey,
uint index
) internal view returns (IExchangeState.ExchangeEntry memory) {
(
bytes32 src,
uint amount,
bytes32 dest,
uint amountReceived,
uint exchangeFeeRate,
uint timestamp,
uint roundIdForSrc,
uint roundIdForDest
) = exchangeState().getEntryAt(account, currencyKey, index);
return
IExchangeState.ExchangeEntry({
src: src,
amount: amount,
dest: dest,
amountReceived: amountReceived,
exchangeFeeRate: exchangeFeeRate,
timestamp: timestamp,
roundIdForSrc: roundIdForSrc,
roundIdForDest: roundIdForDest
});
}
function hasWaitingPeriodOrSettlementOwing(address account, bytes32 currencyKey) external view returns (bool) {
if (maxSecsLeftInWaitingPeriod(account, currencyKey) != 0) {
return true;
}
(uint reclaimAmount, , , ) = _settlementOwing(account, currencyKey);
return reclaimAmount > 0;
}
/* ========== SETTERS ========== */
function calculateAmountAfterSettlement(
address from,
bytes32 currencyKey,
uint amount,
uint refunded
) public view returns (uint amountAfterSettlement) {
amountAfterSettlement = amount;
// balance of a synth will show an amount after settlement
uint balanceOfSourceAfterSettlement = IERC20(address(issuer().synths(currencyKey))).balanceOf(from);
// when there isn't enough supply (either due to reclamation settlement or because the number is too high)
if (amountAfterSettlement > balanceOfSourceAfterSettlement) {
// then the amount to exchange is reduced to their remaining supply
amountAfterSettlement = balanceOfSourceAfterSettlement;
}
if (refunded > 0) {
amountAfterSettlement = amountAfterSettlement.add(refunded);
}
}
function isSynthRateInvalid(bytes32 currencyKey) external view returns (bool) {
return _isSynthRateInvalid(currencyKey, exchangeRates().rateForCurrency(currencyKey));
}
/* ========== MUTATIVE FUNCTIONS ========== */
function exchange(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress
) external onlySynthetixorSynth returns (uint amountReceived) {
uint fee;
(amountReceived, fee, ) = _exchange(
from,
sourceCurrencyKey,
sourceAmount,
destinationCurrencyKey,
destinationAddress,
false
);
_processTradingRewards(fee, destinationAddress);
}
function exchangeOnBehalf(
address exchangeForAddress,
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
) external onlySynthetixorSynth returns (uint amountReceived) {
require(delegateApprovals().canExchangeFor(exchangeForAddress, from), "Not approved to act on behalf");
uint fee;
(amountReceived, fee, ) = _exchange(
exchangeForAddress,
sourceCurrencyKey,
sourceAmount,
destinationCurrencyKey,
exchangeForAddress,
false
);
_processTradingRewards(fee, exchangeForAddress);
}
function exchangeWithTracking(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
address originator,
bytes32 trackingCode
) external onlySynthetixorSynth returns (uint amountReceived) {
uint fee;
(amountReceived, fee, ) = _exchange(
from,
sourceCurrencyKey,
sourceAmount,
destinationCurrencyKey,
destinationAddress,
false
);
_processTradingRewards(fee, originator);
_emitTrackingEvent(trackingCode, destinationCurrencyKey, amountReceived);
}
function exchangeOnBehalfWithTracking(
address exchangeForAddress,
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address originator,
bytes32 trackingCode
) external onlySynthetixorSynth returns (uint amountReceived) {
require(delegateApprovals().canExchangeFor(exchangeForAddress, from), "Not approved to act on behalf");
uint fee;
(amountReceived, fee, ) = _exchange(
exchangeForAddress,
sourceCurrencyKey,
sourceAmount,
destinationCurrencyKey,
exchangeForAddress,
false
);
_processTradingRewards(fee, originator);
_emitTrackingEvent(trackingCode, destinationCurrencyKey, amountReceived);
}
function exchangeWithVirtual(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
bytes32 trackingCode
) external onlySynthetixorSynth returns (uint amountReceived, IVirtualSynth vSynth) {
uint fee;
(amountReceived, fee, vSynth) = _exchange(
from,
sourceCurrencyKey,
sourceAmount,
destinationCurrencyKey,
destinationAddress,
true
);
_processTradingRewards(fee, destinationAddress);
if (trackingCode != bytes32(0)) {
_emitTrackingEvent(trackingCode, destinationCurrencyKey, amountReceived);
}
}
function _emitTrackingEvent(
bytes32 trackingCode,
bytes32 toCurrencyKey,
uint256 toAmount
) internal {
ISynthetixInternal(address(synthetix())).emitExchangeTracking(trackingCode, toCurrencyKey, toAmount);
}
function _processTradingRewards(uint fee, address originator) internal {
if (fee > 0 && originator != address(0) && getTradingRewardsEnabled()) {
tradingRewards().recordExchangeFeeForAccount(fee, originator);
}
}
function _suspendIfRateInvalid(bytes32 currencyKey, uint rate) internal returns (bool circuitBroken) {
if (_isSynthRateInvalid(currencyKey, rate)) {
systemStatus().suspendSynth(currencyKey, CIRCUIT_BREAKER_SUSPENSION_REASON);
circuitBroken = true;
} else {
lastExchangeRate[currencyKey] = rate;
}
}
function _updateSNXIssuedDebtOnExchange(bytes32[2] memory currencyKeys, uint[2] memory currencyRates) internal {
bool includesSUSD = currencyKeys[0] == sUSD || currencyKeys[1] == sUSD;
uint numKeys = includesSUSD ? 2 : 3;
bytes32[] memory keys = new bytes32[](numKeys);
keys[0] = currencyKeys[0];
keys[1] = currencyKeys[1];
uint[] memory rates = new uint[](numKeys);
rates[0] = currencyRates[0];
rates[1] = currencyRates[1];
if (!includesSUSD) {
keys[2] = sUSD; // And we'll also update sUSD to account for any fees if it wasn't one of the exchanged currencies
rates[2] = SafeDecimalMath.unit();
}
// Note that exchanges can't invalidate the debt cache, since if a rate is invalid,
// the exchange will have failed already.
debtCache().updateCachedSynthDebtsWithRates(keys, rates);
}
function _settleAndCalcSourceAmountRemaining(
uint sourceAmount,
address from,
bytes32 sourceCurrencyKey
) internal returns (uint sourceAmountAfterSettlement) {
(, uint refunded, uint numEntriesSettled) = _internalSettle(from, sourceCurrencyKey, false);
sourceAmountAfterSettlement = sourceAmount;
// when settlement was required
if (numEntriesSettled > 0) {
// ensure the sourceAmount takes this into account
sourceAmountAfterSettlement = calculateAmountAfterSettlement(from, sourceCurrencyKey, sourceAmount, refunded);
}
}
function _exchange(
address from,
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey,
address destinationAddress,
bool virtualSynth
)
internal
returns (
uint amountReceived,
uint fee,
IVirtualSynth vSynth
)
{
_ensureCanExchange(sourceCurrencyKey, sourceAmount, destinationCurrencyKey);
uint sourceAmountAfterSettlement = _settleAndCalcSourceAmountRemaining(sourceAmount, from, sourceCurrencyKey);
// If, after settlement the user has no balance left (highly unlikely), then return to prevent
// emitting events of 0 and don't revert so as to ensure the settlement queue is emptied
if (sourceAmountAfterSettlement == 0) {
return (0, 0, IVirtualSynth(0));
}
uint exchangeFeeRate;
uint sourceRate;
uint destinationRate;
// Note: `fee` is denominated in the destinationCurrencyKey.
(amountReceived, fee, exchangeFeeRate, sourceRate, destinationRate) = _getAmountsForExchangeMinusFees(
sourceAmountAfterSettlement,
sourceCurrencyKey,
destinationCurrencyKey
);
// SIP-65: Decentralized Circuit Breaker
if (
_suspendIfRateInvalid(sourceCurrencyKey, sourceRate) ||
_suspendIfRateInvalid(destinationCurrencyKey, destinationRate)
) {
return (0, 0, IVirtualSynth(0));
}
// 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.
vSynth = _convert(
sourceCurrencyKey,
from,
sourceAmountAfterSettlement,
destinationCurrencyKey,
amountReceived,
destinationAddress,
virtualSynth
);
// When using a virtual synth, it becomes the destinationAddress for event and settlement tracking
if (vSynth != IVirtualSynth(0)) {
destinationAddress = address(vSynth);
}
// Remit the fee if required
if (fee > 0) {
// Normalize fee to sUSD
// Note: `fee` is being reused to avoid stack too deep errors.
fee = exchangeRates().effectiveValue(destinationCurrencyKey, fee, sUSD);
// Remit the fee in sUSDs
issuer().synths(sUSD).issue(feePool().FEE_ADDRESS(), fee);
// Tell the fee pool about this
feePool().recordFeePaid(fee);
}
// Note: As of this point, `fee` is denominated in sUSD.
// Nothing changes as far as issuance data goes because the total value in the system hasn't changed.
// But we will update the debt snapshot in case exchange rates have fluctuated since the last exchange
// in these currencies
_updateSNXIssuedDebtOnExchange([sourceCurrencyKey, destinationCurrencyKey], [sourceRate, destinationRate]);
// Let the DApps know there was a Synth exchange
ISynthetixInternal(address(synthetix())).emitSynthExchange(
from,
sourceCurrencyKey,
sourceAmountAfterSettlement,
destinationCurrencyKey,
amountReceived,
destinationAddress
);
// persist the exchange information for the dest key
appendExchange(
destinationAddress,
sourceCurrencyKey,
sourceAmountAfterSettlement,
destinationCurrencyKey,
amountReceived,
exchangeFeeRate
);
}
function _convert(
bytes32 sourceCurrencyKey,
address from,
uint sourceAmountAfterSettlement,
bytes32 destinationCurrencyKey,
uint amountReceived,
address recipient,
bool virtualSynth
) internal returns (IVirtualSynth vSynth) {
// Burn the source amount
issuer().synths(sourceCurrencyKey).burn(from, sourceAmountAfterSettlement);
// Issue their new synths
ISynth dest = issuer().synths(destinationCurrencyKey);
if (virtualSynth) {
Proxyable synth = Proxyable(address(dest));
vSynth = _createVirtualSynth(IERC20(address(synth.proxy())), recipient, amountReceived, destinationCurrencyKey);
dest.issue(address(vSynth), amountReceived);
} else {
dest.issue(recipient, amountReceived);
}
}
function _createVirtualSynth(
IERC20,
address,
uint,
bytes32
) internal returns (IVirtualSynth) {
revert("Not supported in this layer");
}
// Note: this function can intentionally be called by anyone on behalf of anyone else (the caller just pays the gas)
function settle(address from, bytes32 currencyKey)
external
returns (
uint reclaimed,
uint refunded,
uint numEntriesSettled
)
{
systemStatus().requireSynthActive(currencyKey);
return _internalSettle(from, currencyKey, true);
}
function suspendSynthWithInvalidRate(bytes32 currencyKey) external {
systemStatus().requireSystemActive();
require(issuer().synths(currencyKey) != ISynth(0), "No such synth");
require(_isSynthRateInvalid(currencyKey, exchangeRates().rateForCurrency(currencyKey)), "Synth price is valid");
systemStatus().suspendSynth(currencyKey, CIRCUIT_BREAKER_SUSPENSION_REASON);
}
// SIP-78
function setLastExchangeRateForSynth(bytes32 currencyKey, uint rate) external onlyExchangeRates {
require(rate > 0, "Rate must be above 0");
lastExchangeRate[currencyKey] = rate;
}
/* ========== INTERNAL FUNCTIONS ========== */
function _ensureCanExchange(
bytes32 sourceCurrencyKey,
uint sourceAmount,
bytes32 destinationCurrencyKey
) internal view {
require(sourceCurrencyKey != destinationCurrencyKey, "Can't be same synth");
require(sourceAmount > 0, "Zero amount");
bytes32[] memory synthKeys = new bytes32[](2);
synthKeys[0] = sourceCurrencyKey;
synthKeys[1] = destinationCurrencyKey;
require(!exchangeRates().anyRateIsInvalid(synthKeys), "Src/dest rate invalid or not found");
}
function _isSynthRateInvalid(bytes32 currencyKey, uint currentRate) internal view returns (bool) {
if (currentRate == 0) {
return true;
}
uint lastRateFromExchange = lastExchangeRate[currencyKey];
if (lastRateFromExchange > 0) {
return _isDeviationAboveThreshold(lastRateFromExchange, currentRate);
}
// if no last exchange for this synth, then we need to look up last 3 rates (+1 for current rate)
(uint[] memory rates, ) = exchangeRates().ratesAndUpdatedTimeForCurrencyLastNRounds(currencyKey, 4);
// start at index 1 to ignore current rate
for (uint i = 1; i < rates.length; i++) {
// ignore any empty rates in the past (otherwise we will never be able to get validity)
if (rates[i] > 0 && _isDeviationAboveThreshold(rates[i], currentRate)) {
return true;
}
}
return false;
}
function _isDeviationAboveThreshold(uint base, uint comparison) internal view returns (bool) {
if (base == 0 || comparison == 0) {
return true;
}
uint factor;
if (comparison > base) {
factor = comparison.divideDecimal(base);
} else {
factor = base.divideDecimal(comparison);
}
return factor >= getPriceDeviationThresholdFactor();
}
function _internalSettle(
address from,
bytes32 currencyKey,
bool updateCache
)
internal
returns (
uint reclaimed,
uint refunded,
uint numEntriesSettled
)
{
require(maxSecsLeftInWaitingPeriod(from, currencyKey) == 0, "Cannot settle during waiting period");
(
uint reclaimAmount,
uint rebateAmount,
uint entries,
ExchangeEntrySettlement[] memory settlements
) = _settlementOwing(from, currencyKey);
if (reclaimAmount > rebateAmount) {
reclaimed = reclaimAmount.sub(rebateAmount);
reclaim(from, currencyKey, reclaimed);
} else if (rebateAmount > reclaimAmount) {
refunded = rebateAmount.sub(reclaimAmount);
refund(from, currencyKey, refunded);
}
if (updateCache) {
bytes32[] memory key = new bytes32[](1);
key[0] = currencyKey;
debtCache().updateCachedSynthDebts(key);
}
// emit settlement event for each settled exchange entry
for (uint i = 0; i < settlements.length; i++) {
emit ExchangeEntrySettled(
from,
settlements[i].src,
settlements[i].amount,
settlements[i].dest,
settlements[i].reclaim,
settlements[i].rebate,
settlements[i].srcRoundIdAtPeriodEnd,
settlements[i].destRoundIdAtPeriodEnd,
settlements[i].timestamp
);
}
numEntriesSettled = entries;
// Now remove all entries, even if no reclaim and no rebate
exchangeState().removeEntries(from, currencyKey);
}
function reclaim(
address from,
bytes32 currencyKey,
uint amount
) internal {
// burn amount from user
issuer().synths(currencyKey).burn(from, amount);
ISynthetixInternal(address(synthetix())).emitExchangeReclaim(from, currencyKey, amount);
}
function refund(
address from,
bytes32 currencyKey,
uint amount
) internal {
// issue amount to user
issuer().synths(currencyKey).issue(from, amount);
ISynthetixInternal(address(synthetix())).emitExchangeRebate(from, currencyKey, amount);
}
function secsLeftInWaitingPeriodForExchange(uint timestamp) internal view returns (uint) {
uint _waitingPeriodSecs = getWaitingPeriodSecs();
if (timestamp == 0 || now >= timestamp.add(_waitingPeriodSecs)) {
return 0;
}
return timestamp.add(_waitingPeriodSecs).sub(now);
}
function feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
external
view
returns (uint exchangeFeeRate)
{
exchangeFeeRate = _feeRateForExchange(sourceCurrencyKey, destinationCurrencyKey);
}
function _feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey)
internal
view
returns (uint exchangeFeeRate)
{
// Get the exchange fee rate as per destination currencyKey
exchangeFeeRate = getExchangeFeeRate(destinationCurrencyKey);
if (sourceCurrencyKey == sUSD || destinationCurrencyKey == sUSD) {
return exchangeFeeRate;
}
// Is this a swing trade? long to short or short to long skipping sUSD.
if (
(sourceCurrencyKey[0] == 0x73 && destinationCurrencyKey[0] == 0x69) ||
(sourceCurrencyKey[0] == 0x69 && destinationCurrencyKey[0] == 0x73)
) {
// Double the exchange fee
exchangeFeeRate = exchangeFeeRate.mul(2);
}
return exchangeFeeRate;
}
function getAmountsForExchange(
uint sourceAmount,
bytes32 sourceCurrencyKey,
bytes32 destinationCurrencyKey
)
external
view
returns (
uint amountReceived,
uint fee,
uint exchangeFeeRate
)
{
(amountReceived, fee, exchangeFeeRate, , ) = _getAmountsForExchangeMinusFees(
sourceAmount,
sourceCurrencyKey,
destinationCurrencyKey
);
}
function _getAmountsForExchangeMinusFees(
uint sourceAmount,
bytes32 sourceCurrencyKey,
bytes32 destinationCurrencyKey
)
internal
view
returns (
uint amountReceived,
uint fee,
uint exchangeFeeRate,
uint sourceRate,
uint destinationRate
)
{
uint destinationAmount;
(destinationAmount, sourceRate, destinationRate) = exchangeRates().effectiveValueAndRates(
sourceCurrencyKey,
sourceAmount,
destinationCurrencyKey
);
exchangeFeeRate = _feeRateForExchange(sourceCurrencyKey, destinationCurrencyKey);
amountReceived = _getAmountReceivedForExchange(destinationAmount, exchangeFeeRate);
fee = destinationAmount.sub(amountReceived);
}
function _getAmountReceivedForExchange(uint destinationAmount, uint exchangeFeeRate)
internal
pure
returns (uint amountReceived)
{
amountReceived = destinationAmount.multiplyDecimal(SafeDecimalMath.unit().sub(exchangeFeeRate));
}
function appendExchange(
address account,
bytes32 src,
uint amount,
bytes32 dest,
uint amountReceived,
uint exchangeFeeRate
) internal {
IExchangeRates exRates = exchangeRates();
uint roundIdForSrc = exRates.getCurrentRoundId(src);
uint roundIdForDest = exRates.getCurrentRoundId(dest);
exchangeState().appendExchangeEntry(
account,
src,
amount,
dest,
amountReceived,
exchangeFeeRate,
now,
roundIdForSrc,
roundIdForDest
);
emit ExchangeEntryAppended(
account,
src,
amount,
dest,
amountReceived,
exchangeFeeRate,
roundIdForSrc,
roundIdForDest
);
}
function getRoundIdsAtPeriodEnd(IExchangeState.ExchangeEntry memory exchangeEntry)
internal
view
returns (uint srcRoundIdAtPeriodEnd, uint destRoundIdAtPeriodEnd)
{
IExchangeRates exRates = exchangeRates();
uint _waitingPeriodSecs = getWaitingPeriodSecs();
srcRoundIdAtPeriodEnd = exRates.getLastRoundIdBeforeElapsedSecs(
exchangeEntry.src,
exchangeEntry.roundIdForSrc,
exchangeEntry.timestamp,
_waitingPeriodSecs
);
destRoundIdAtPeriodEnd = exRates.getLastRoundIdBeforeElapsedSecs(
exchangeEntry.dest,
exchangeEntry.roundIdForDest,
exchangeEntry.timestamp,
_waitingPeriodSecs
);
}
// ========== MODIFIERS ==========
modifier onlySynthetixorSynth() {
ISynthetix _synthetix = synthetix();
require(
msg.sender == address(_synthetix) || _synthetix.synthsByAddress(msg.sender) != bytes32(0),
"Exchanger: Only synthetix or a synth contract can perform this action"
);
_;
}
modifier onlyExchangeRates() {
IExchangeRates _exchangeRates = exchangeRates();
require(msg.sender == address(_exchangeRates), "Restricted to ExchangeRates");
_;
}
// ========== EVENTS ==========
event ExchangeEntryAppended(
address indexed account,
bytes32 src,
uint256 amount,
bytes32 dest,
uint256 amountReceived,
uint256 exchangeFeeRate,
uint256 roundIdForSrc,
uint256 roundIdForDest
);
event ExchangeEntrySettled(
address indexed from,
bytes32 src,
uint256 amount,
bytes32 dest,
uint256 reclaim,
uint256 rebate,
uint256 srcRoundIdAtPeriodEnd,
uint256 destRoundIdAtPeriodEnd,
uint256 exchangeTimestamp
);
}
/**
* @dev Implementation of the `IERC20` interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using `_mint`.
* For a generic mechanism see `ERC20Mintable`.
*
* *For a detailed writeup see our guide [How to implement supply
* mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).*
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an `Approval` event is emitted on calls to `transferFrom`.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard `decreaseAllowance` and `increaseAllowance`
* functions have been added to mitigate the well-known issues around setting
* allowances. See `IERC20.approve`.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
// Inheritance
// Libraries
// Internal references
// Note: use OZ's IERC20 here as using ours will complain about conflicting names
// during the build
// https://docs.synthetix.io/contracts/source/contracts/virtualsynth
contract VirtualSynth is ERC20, IVirtualSynth {
using SafeMath for uint;
using SafeDecimalMath for uint;
IERC20 public synth;
IAddressResolver public resolver;
bool public settled = false;
uint8 public constant decimals = 18;
// track initial supply so we can calculate the rate even after all supply is burned
uint public initialSupply;
// track final settled amount of the synth so we can calculate the rate after settlement
uint public settledAmount;
bytes32 public currencyKey;
constructor(
IERC20 _synth,
IAddressResolver _resolver,
address _recipient,
uint _amount,
bytes32 _currencyKey
) public ERC20() {
synth = _synth;
resolver = _resolver;
currencyKey = _currencyKey;
// Assumption: the synth will be issued to us within the same transaction,
// and this supply matches that
_mint(_recipient, _amount);
initialSupply = _amount;
}
// INTERNALS
function exchanger() internal view returns (IExchanger) {
return IExchanger(resolver.requireAndGetAddress("Exchanger", "Exchanger contract not found"));
}
function secsLeft() internal view returns (uint) {
return exchanger().maxSecsLeftInWaitingPeriod(address(this), currencyKey);
}
function calcRate() internal view returns (uint) {
if (initialSupply == 0) {
return 0;
}
uint synthBalance;
if (!settled) {
synthBalance = IERC20(address(synth)).balanceOf(address(this));
(uint reclaim, uint rebate, ) = exchanger().settlementOwing(address(this), currencyKey);
if (reclaim > 0) {
synthBalance = synthBalance.sub(reclaim);
} else if (rebate > 0) {
synthBalance = synthBalance.add(rebate);
}
} else {
synthBalance = settledAmount;
}
return synthBalance.divideDecimalRound(initialSupply);
}
function balanceUnderlying(address account) internal view returns (uint) {
uint vBalanceOfAccount = balanceOf(account);
return vBalanceOfAccount.multiplyDecimalRound(calcRate());
}
function settleSynth() internal {
if (settled) {
return;
}
settled = true;
exchanger().settle(address(this), currencyKey);
settledAmount = IERC20(address(synth)).balanceOf(address(this));
emit Settled(totalSupply(), settledAmount);
}
// VIEWS
function name() external view returns (string memory) {
return string(abi.encodePacked("Virtual Synth ", currencyKey));
}
function symbol() external view returns (string memory) {
return string(abi.encodePacked("v", currencyKey));
}
// get the rate of the vSynth to the synth.
function rate() external view returns (uint) {
return calcRate();
}
// show the balance of the underlying synth that the given address has, given
// their proportion of totalSupply
function balanceOfUnderlying(address account) external view returns (uint) {
return balanceUnderlying(account);
}
function secsLeftInWaitingPeriod() external view returns (uint) {
return secsLeft();
}
function readyToSettle() external view returns (bool) {
return secsLeft() == 0;
}
// PUBLIC FUNCTIONS
// Perform settlement of the underlying exchange if required,
// then burn the accounts vSynths and transfer them their owed balanceOfUnderlying
function settle(address account) external {
settleSynth();
IERC20(address(synth)).transfer(account, balanceUnderlying(account));
_burn(account, balanceOf(account));
}
event Settled(uint totalSupply, uint amountAfterSettled);
}
// Inheritance
// Internal references
// https://docs.synthetix.io/contracts/source/contracts/exchangerwithvirtualsynth
contract ExchangerWithVirtualSynth is Exchanger {
constructor(address _owner, address _resolver) public Exchanger(_owner, _resolver) {}
function _createVirtualSynth(
IERC20 synth,
address recipient,
uint amount,
bytes32 currencyKey
) internal returns (IVirtualSynth vSynth) {
// prevent inverse synths from being allowed due to purgeability
require(currencyKey[0] != 0x69, "Cannot virtualize this synth");
vSynth = new VirtualSynth(synth, resolver, recipient, amount, currencyKey);
emit VirtualSynthCreated(address(synth), recipient, address(vSynth), currencyKey, amount);
}
event VirtualSynthCreated(
address indexed synth,
address indexed recipient,
address vSynth,
bytes32 currencyKey,
uint amount
);
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bytes32","name":"src","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"dest","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountReceived","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"exchangeFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roundIdForSrc","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roundIdForDest","type":"uint256"}],"name":"ExchangeEntryAppended","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"bytes32","name":"src","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"dest","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"reclaim","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rebate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcRoundIdAtPeriodEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destRoundIdAtPeriodEnd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"exchangeTimestamp","type":"uint256"}],"name":"ExchangeEntrySettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"synth","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"vSynth","type":"address"},{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VirtualSynthCreated","type":"event"},{"constant":true,"inputs":[],"name":"CIRCUIT_BREAKER_SUSPENSION_REASON","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAX_ADDRESSES_FROM_RESOLVER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"refunded","type":"uint256"}],"name":"calculateAmountAfterSettlement","outputs":[{"internalType":"uint256","name":"amountAfterSettlement","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"},{"internalType":"address","name":"destinationAddress","type":"address"}],"name":"exchange","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"}],"name":"exchangeOnBehalf","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"exchangeForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"},{"internalType":"address","name":"originator","type":"address"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"exchangeOnBehalfWithTracking","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"},{"internalType":"address","name":"destinationAddress","type":"address"},{"internalType":"address","name":"originator","type":"address"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"exchangeWithTracking","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"},{"internalType":"address","name":"destinationAddress","type":"address"},{"internalType":"bytes32","name":"trackingCode","type":"bytes32"}],"name":"exchangeWithVirtual","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"},{"internalType":"contract IVirtualSynth","name":"vSynth","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"}],"name":"feeRateForExchange","outputs":[{"internalType":"uint256","name":"exchangeFeeRate","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"sourceAmount","type":"uint256"},{"internalType":"bytes32","name":"sourceCurrencyKey","type":"bytes32"},{"internalType":"bytes32","name":"destinationCurrencyKey","type":"bytes32"}],"name":"getAmountsForExchange","outputs":[{"internalType":"uint256","name":"amountReceived","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"exchangeFeeRate","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getResolverAddressesRequired","outputs":[{"internalType":"bytes32[24]","name":"addressesRequired","type":"bytes32[24]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"hasWaitingPeriodOrSettlementOwing","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract AddressResolver","name":"_resolver","type":"address"}],"name":"isResolverCached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"isSynthRateInvalid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"lastExchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"maxSecsLeftInWaitingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"priceDeviationThresholdFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolver","outputs":[{"internalType":"contract AddressResolver","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"resolverAddressesRequired","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"uint256","name":"rate","type":"uint256"}],"name":"setLastExchangeRateForSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract AddressResolver","name":"_resolver","type":"address"}],"name":"setResolverAndSyncCache","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"settle","outputs":[{"internalType":"uint256","name":"reclaimed","type":"uint256"},{"internalType":"uint256","name":"refunded","type":"uint256"},{"internalType":"uint256","name":"numEntriesSettled","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"settlementOwing","outputs":[{"internalType":"uint256","name":"reclaimAmount","type":"uint256"},{"internalType":"uint256","name":"rebateAmount","type":"uint256"},{"internalType":"uint256","name":"numEntries","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"suspendSynthWithInvalidRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tradingRewardsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"waitingPeriodSecs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]Contract Creation Code
6101a06040526b53797374656d53746174757360a01b60809081526c45786368616e6765537461746560981b60a0526c45786368616e6765526174657360981b60c052680a6f2dce8d0cae8d2f60bb1b60e05266119959541bdbdb60ca1b610100526d54726164696e675265776172647360901b610120527044656c6567617465417070726f76616c7360781b610140526524b9b9bab2b960d11b610160526844656274436163686560b81b61018052620000bf9060069060096200041e565b50348015620000cd57600080fd5b5060405162005e0b38038062005e0b83398181016040526040811015620000f357600080fd5b5080516020909101516040805161030081019182905283918391829160069060189082845b8154815260200190600101908083116200011857508793505050506001600160a01b0381166200018f576040805162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b038316908117825560408051928352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a1506000546001600160a01b03166200023a576040805162461bcd60e51b815260206004820152601160248201527013dddb995c881b5d5cdd081899481cd95d607a1b604482015290519081900360640190fd5b60005b6018811015620002a25760008282601881106200025657fe5b602002015114620002935760048282601881106200027057fe5b602090810291909101518254600181018455600093845291909220015562000299565b620002a2565b6001016200023d565b5050600280546001600160a01b0319166001600160a01b0392909216919091179055620002e16e466c657869626c6553746f7261676560881b620002eb565b5050505062000481565b6004805460018101825560008290527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018290555460181162000375576040805162461bcd60e51b815260206004820152601b60248201527f4d6178207265736f6c7665722063616368652073697a65206d65740000000000604482015290519081900360640190fd5b600254604080516321f8a72160e01b81526004810184905290516001600160a01b03909216916321f8a72191602480820192602092909190829003018186803b158015620003c257600080fd5b505afa158015620003d7573d6000803e3d6000fd5b505050506040513d6020811015620003ee57600080fd5b505160009182526003602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b82601881019282156200044f579160200282015b828111156200044f57825182559160200191906001019062000432565b506200045d92915062000461565b5090565b6200047e91905b808211156200045d576000815560010162000468565b90565b61597a80620004916000396000f3fe60806040523480156200001157600080fd5b5060043610620002085760003560e01c80636a1c4758116200011d578063c193f0d811620000b1578063dfffca76116200007b578063dfffca76146200061f578063e3235c911462000672578063f3995224146200067c578063f450aa3414620006e65762000208565b8063c193f0d814620005a0578063c6c9d82814620005aa578063ce09694014620005ca578063d6f32e0614620005f05762000208565b806386baa45c11620000f357806386baa45c14620004f45780638925711714620005475780638da5cb5b1462000551578063ab49848c146200055b5762000208565b80636a1c4758146200048557806379ba509714620004ca5780637dd1a57a14620004d45762000208565b80631b16802c11620001a15780634c268fc8116200016b5780634c268fc814620003e357806353a47bb7146200041e57806357af302c1462000428578063631e1444146200045c5762000208565b80631b16802c1462000377578063372a395a14620003a65780633be99e6f14620003b05780633fa70f4514620003d95762000208565b80630b9e31c911620001e35780630b9e31c914620002b95780631627540c14620002db57806319d5c66514620003045780631a5c609514620003515762000208565b806304f3bcec146200020d578063059c29ec14620002335780630a1e187d1462000274575b600080fd5b6200021762000712565b604080516001600160a01b039092168252519081900360200190f35b62000262600480360360408110156200024b57600080fd5b506001600160a01b03813516906020013562000721565b60408051918252519081900360200190f35b62000262600480360360a08110156200028c57600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160809091013516620007cc565b620002d960048036036020811015620002d157600080fd5b5035620008d7565b005b620002d960048036036020811015620002f357600080fd5b50356001600160a01b031662000b4c565b62000333600480360360408110156200031c57600080fd5b506001600160a01b03813516906020013562000baa565b60408051938452602084019290925282820152519081900360600190f35b62000262600480360360408110156200036957600080fd5b508035906020013562000bca565b62000333600480360360408110156200038f57600080fd5b506001600160a01b03813516906020013562000bd8565b6200026262000c5f565b620002d960048036036020811015620003c857600080fd5b50356001600160a01b031662000c70565b6200026262000da5565b6200026260048036036080811015620003fb57600080fd5b506001600160a01b03813516906020810135906040810135906060013562000daa565b6200021762000ed6565b62000448600480360360208110156200044057600080fd5b503562000ee5565b604080519115158252519081900360200190f35b62000448600480360360208110156200047457600080fd5b50356001600160a01b031662000f42565b62000262600480360360a08110156200049d57600080fd5b506001600160a01b0381358116916020810135909116906040810135906060810135906080013562001068565b620002d962001246565b6200026260048036036020811015620004ec57600080fd5b503562001304565b62000262600480360360e08110156200050c57600080fd5b506001600160a01b038135811691602081013591604082013591606081013591608082013581169160a08101359091169060c0013562001316565b6200026262001430565b620002176200143c565b620005656200144b565b604051808261030080838360005b838110156200058d57818101518382015260200162000573565b5050505090500191505060405180910390f35b620004486200149b565b6200026260048036036020811015620005c257600080fd5b5035620014a7565b620002d960048036036040811015620005e257600080fd5b5080359060200135620014c6565b62000448600480360360408110156200060857600080fd5b506001600160a01b03813516906020013562001592565b62000262600480360360e08110156200063757600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160808201359160a08101359091169060c00135620015ca565b62000262620017b5565b620006c5600480360360c08110156200069457600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a00135620017ba565b604080519283526001600160a01b0390911660208301528051918290030190f35b6200033360048036036060811015620006fe57600080fd5b5080359060208101359060400135620018df565b6002546001600160a01b031681565b6000620007c36200073162001901565b6001600160a01b031663f1406dc885856040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b1580156200078f57600080fd5b505afa158015620007a4573d6000803e3d6000fd5b505050506040513d6020811015620007bb57600080fd5b505162001954565b90505b92915050565b600080620007d9620019be565b9050336001600160a01b03821614806200086a5750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200083957600080fd5b505afa1580156200084e573d6000803e3d6000fd5b505050506040513d60208110156200086557600080fd5b505114155b620008a75760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6000620008ba8888888888600062001a0d565b509093509050620008cc818562001e3f565b505095945050505050565b620008e162001ef7565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b1580156200091a57600080fd5b505afa1580156200092f573d6000803e3d6000fd5b5050505060006001600160a01b03166200094862001f49565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200098c57600080fd5b505afa158015620009a1573d6000803e3d6000fd5b505050506040513d6020811015620009b857600080fd5b50516001600160a01b0316141562000a07576040805162461bcd60e51b815260206004820152600d60248201526c09cde40e6eac6d040e6f2dce8d609b1b604482015290519081900360640190fd5b62000a8e8162000a1662001f8e565b6001600160a01b031663ac82f608846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562000a5a57600080fd5b505afa15801562000a6f573d6000803e3d6000fd5b505050506040513d602081101562000a8657600080fd5b505162001fe1565b62000ad7576040805162461bcd60e51b815260206004820152601460248201527314de5b9d1a081c1c9a58d9481a5cc81d985b1a5960621b604482015290519081900360640190fd5b62000ae162001ef7565b6001600160a01b031663abc0bb6e8260416040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801562000b3057600080fd5b505af115801562000b45573d6000803e3d6000fd5b5050505050565b62000b566200224f565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b600080600062000bbb85856200229c565b50919790965090945092505050565b6000620007c3838362002591565b600080600062000be762001ef7565b6001600160a01b03166342a28e21856040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b15801562000c2b57600080fd5b505afa15801562000c40573d6000803e3d6000fd5b5050505062000c52858560016200265a565b9250925092509250925092565b600062000c6b620029f0565b905090565b62000c7a6200224f565b600280546001600160a01b0319166001600160a01b03831617905560005b60045481101562000da15760006004828154811062000cb357fe5b600091825260209182902001546002546040805163dacb2d0160e01b81526004810184905260248101829052601760448201527f5265736f6c766572206d697373696e6720746172676574000000000000000000606482015290519294506001600160a01b039091169263dacb2d0192608480840193829003018186803b15801562000d3e57600080fd5b505afa15801562000d53573d6000803e3d6000fd5b505050506040513d602081101562000d6a57600080fd5b505160009182526003602052604090912080546001600160a01b0319166001600160a01b0390921691909117905560010162000c98565b5050565b604181565b81600062000db762001f49565b6001600160a01b03166332608039866040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562000dfb57600080fd5b505afa15801562000e10573d6000803e3d6000fd5b505050506040513d602081101562000e2757600080fd5b5051604080516370a0823160e01b81526001600160a01b038981166004830152915191909216916370a08231916024808301926020929190829003018186803b15801562000e7457600080fd5b505afa15801562000e89573d6000803e3d6000fd5b505050506040513d602081101562000ea057600080fd5b505190508082111562000eb1578091505b821562000ecd5762000eca828463ffffffff62002aac16565b91505b50949350505050565b6001546001600160a01b031681565b600062000f3a8262000ef662001f8e565b6001600160a01b031663ac82f608856040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562000a5a57600080fd5b90505b919050565b6002546000906001600160a01b0383811691161462000f645750600062000f3d565b60005b6004548110156200105f5760006004828154811062000f8257fe5b6000918252602080832090910154808352600382526040928390205460025484516321f8a72160e01b81526004810184905294519295506001600160a01b03918216949116926321f8a72192602480840193829003018186803b15801562000fe957600080fd5b505afa15801562000ffe573d6000803e3d6000fd5b505050506040513d60208110156200101557600080fd5b50516001600160a01b03161415806200104357506000818152600360205260409020546001600160a01b0316155b15620010555760009250505062000f3d565b5060010162000f67565b50600192915050565b60008062001075620019be565b9050336001600160a01b0382161480620011065750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b158015620010d557600080fd5b505afa158015620010ea573d6000803e3d6000fd5b505050506040513d60208110156200110157600080fd5b505114155b620011435760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6200114d62002b07565b6040805163faf431bb60e01b81526001600160a01b038a8116600483015289811660248301529151929091169163faf431bb91604480820192602092909190829003018186803b158015620011a157600080fd5b505afa158015620011b6573d6000803e3d6000fd5b505050506040513d6020811015620011cd57600080fd5b505162001221576040805162461bcd60e51b815260206004820152601d60248201527f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000604482015290519081900360640190fd5b600062001234888787878c600062001a0d565b509093509050620008cc818962001e3f565b6001546001600160a01b03163314620012915760405162461bcd60e51b8152600401808060200182810382526035815260200180620058166035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60056020526000908152604090205481565b60008062001323620019be565b9050336001600160a01b0382161480620013b45750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200138357600080fd5b505afa15801562001398573d6000803e3d6000fd5b505050506040513d6020811015620013af57600080fd5b505114155b620013f15760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6000620014048a8a8a8a8a600062001a0d565b50909350905062001416818662001e3f565b6200142384888562002b42565b5050979650505050505050565b600062000c6b62002bc0565b6000546001600160a01b031681565b6200145562004414565b60005b6004548110156200149757600481815481106200147157fe5b90600052602060002001548282601881106200148957fe5b602002015260010162001458565b5090565b600062000c6b62002c3d565b60048181548110620014b557fe5b600091825260209091200154905081565b6000620014d262001f8e565b9050336001600160a01b0382161462001532576040805162461bcd60e51b815260206004820152601b60248201527f5265737472696374656420746f2045786368616e676552617465730000000000604482015290519081900360640190fd5b600082116200157f576040805162461bcd60e51b8152602060048201526014602482015273052617465206d7573742062652061626f766520360641b604482015290519081900360640190fd5b5060009182526005602052604090912055565b6000620015a0838362000721565b15620015af57506001620007c6565b6000620015bd84846200229c565b5050501515949350505050565b600080620015d7620019be565b9050336001600160a01b0382161480620016685750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200163757600080fd5b505afa1580156200164c573d6000803e3d6000fd5b505050506040513d60208110156200166357600080fd5b505114155b620016a55760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b620016af62002b07565b6040805163faf431bb60e01b81526001600160a01b038c811660048301528b811660248301529151929091169163faf431bb91604480820192602092909190829003018186803b1580156200170357600080fd5b505afa15801562001718573d6000803e3d6000fd5b505050506040513d60208110156200172f57600080fd5b505162001783576040805162461bcd60e51b815260206004820152601d60248201527f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000604482015290519081900360640190fd5b6000620017968a8989898e600062001a0d565b509093509050620017a8818662001e3f565b6200142384878562002b42565b601881565b6000806000620017c9620019be565b9050336001600160a01b03821614806200185a5750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200182957600080fd5b505afa1580156200183e573d6000803e3d6000fd5b505050506040513d60208110156200185557600080fd5b505114155b620018975760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6000620018aa8a8a8a8a8a600162001a0d565b9195509093509050620018be818762001e3f565b8415620018d257620018d285888662002b42565b5050965096945050505050565b6000806000620018f186868662002cbe565b5092999198509650945050505050565b600062000c6b6c45786368616e6765537461746560981b6040518060400160405280601d81526020017f4d697373696e672045786368616e67655374617465206164647265737300000081525062002da3565b6000806200196162002bc0565b90508215806200198257506200197e838263ffffffff62002aac16565b4210155b156200199357600091505062000f3d565b620019b742620019aa858463ffffffff62002aac16565b9063ffffffff62002e5116565b9392505050565b600062000c6b680a6f2dce8d0cae8d2f60bb1b6040518060400160405280601981526020017f4d697373696e672053796e74686574697820616464726573730000000000000081525062002da3565b600080600062001a1f88888862002eaf565b600062001a2e888b8b62003095565b90508062001a4757506000925082915081905062001e33565b600080600062001a59848d8c62002cbe565b939a5091985094509250905062001a718c83620030d2565b8062001a84575062001a848a82620030d2565b1562001a9f57506000955085945084935062001e3392505050565b62001ab08c8e868d8b8e8e62003175565b94506001600160a01b0385161562001ac6578498505b851562001d355762001ad762001f8e565b6001600160a01b031663654a60ac8b88631cd554d160e21b6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b15801562001b3257600080fd5b505afa15801562001b47573d6000803e3d6000fd5b505050506040513d602081101562001b5e57600080fd5b5051955062001b6c62001f49565b6001600160a01b03166332608039631cd554d160e21b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562001bb757600080fd5b505afa15801562001bcc573d6000803e3d6000fd5b505050506040513d602081101562001be357600080fd5b50516001600160a01b031663867904b462001bfd6200346a565b6001600160a01b031663eb1edd616040518163ffffffff1660e01b815260040160206040518083038186803b15801562001c3657600080fd5b505afa15801562001c4b573d6000803e3d6000fd5b505050506040513d602081101562001c6257600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482018a905251604480830192600092919082900301818387803b15801562001cb257600080fd5b505af115801562001cc7573d6000803e3d6000fd5b5050505062001cd56200346a565b6001600160a01b03166322bf55ef876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801562001d1b57600080fd5b505af115801562001d30573d6000803e3d6000fd5b505050505b62001d6960405180604001604052808e81526020018c815250604051806040016040528085815260200184815250620034b7565b62001d73620019be565b6001600160a01b0316636c00f3108e8e878e8c8f6040518763ffffffff1660e01b815260040180876001600160a01b03166001600160a01b03168152602001868152602001858152602001848152602001838152602001826001600160a01b03166001600160a01b031681526020019650505050505050600060405180830381600087803b15801562001e0557600080fd5b505af115801562001e1a573d6000803e3d6000fd5b5050505062001e2e898d868d8b886200378c565b505050505b96509650969350505050565b60008211801562001e5857506001600160a01b03811615155b801562001e6a575062001e6a62002c3d565b1562000da15762001e7a620039a9565b6001600160a01b03166321cad77483836040518363ffffffff1660e01b815260040180838152602001826001600160a01b03166001600160a01b0316815260200192505050600060405180830381600087803b15801562001eda57600080fd5b505af115801562001eef573d6000803e3d6000fd5b505050505050565b600062000c6b6b53797374656d53746174757360a01b6040518060400160405280601c81526020017f4d697373696e672053797374656d53746174757320616464726573730000000081525062002da3565b600062000c6b6524b9b9bab2b960d11b604051806040016040528060168152602001754d697373696e6720497373756572206164647265737360501b81525062002da3565b600062000c6b6c45786368616e6765526174657360981b6040518060400160405280601d81526020017f4d697373696e672045786368616e67655261746573206164647265737300000081525062002da3565b60008162001ff257506001620007c6565b60008381526005602052604090205480156200201d57620020148184620039fd565b915050620007c6565b60606200202962001f8e565b6001600160a01b0316632d7371e18660046040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b1580156200207657600080fd5b505afa1580156200208b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040908152811015620020b557600080fd5b8101908080516040519392919084640100000000821115620020d657600080fd5b908301906020820185811115620020ec57600080fd5b82518660208202830111640100000000821117156200210a57600080fd5b82525081516020918201928201910280838360005b83811015620021395781810151838201526020016200211f565b50505050905001604052602001805160405193929190846401000000008211156200216357600080fd5b9083019060208201858111156200217957600080fd5b82518660208202830111640100000000821117156200219757600080fd5b82525081516020918201928201910280838360005b83811015620021c6578181015183820152602001620021ac565b505050509050016040525050505090506000600190505b815181101562002243576000828281518110620021f657fe5b6020026020010151118015620022275750620022278282815181106200221857fe5b602002602001015186620039fd565b156200223a5760019350505050620007c6565b600101620021dd565b50600095945050505050565b6000546001600160a01b031633146200229a5760405162461bcd60e51b815260040180806020018281038252602f815260200180620058b1602f913960400191505060405180910390fd5b565b60008060006060620022ad62001901565b6001600160a01b031663b44e975387876040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b1580156200230b57600080fd5b505afa15801562002320573d6000803e3d6000fd5b505050506040513d60208110156200233757600080fd5b50516040805182815260208084028201019091529092506060908380156200237c57816020015b6200236862004433565b8152602001906001900390816200235e5790505b50905060005b8381101562002585576000806200239862004433565b620023a58b8b8662003a67565b9050600080620023b58362003b89565b915091506000620023c562001f8e565b6001600160a01b031663266da16b85600001518660200151876040015187876040518663ffffffff1660e01b8152600401808681526020018581526020018481526020018381526020018281526020019550505050505060206040518083038186803b1580156200243557600080fd5b505afa1580156200244a573d6000803e3d6000fd5b505050506040513d60208110156200246157600080fd5b505160808501519091506000906200247b90839062003ce6565b90506200248d856060015182620039fd565b6200250e578085606001511115620024d2576060850151620024b6908263ffffffff62002e5116565b9650620024ca8d8863ffffffff62002aac16565b9c506200250e565b84606001518111156200250e576060850151620024f790829063ffffffff62002e5116565b95506200250b8c8763ffffffff62002aac16565b9b505b6040518061010001604052808660000151815260200186602001518152602001866040015181526020018881526020018781526020018581526020018481526020018660a001518152508989815181106200256557fe5b602002602001018190525050505050505050808060010191505062002382565b50905092959194509250565b60006200259e8262003d7f565b9050631cd554d160e21b831480620025bc5750631cd554d160e21b82145b15620025c857620007c6565b607360f81b6001600160f81b0319600085901a60f81b16148015620026015750606960f81b6001600160f81b0319600084901a60f81b16145b80620026415750606960f81b6001600160f81b0319600085901a60f81b16148015620026415750607360f81b6001600160f81b0319600084901a60f81b16145b15620007c657620007c381600263ffffffff62003e5c16565b60008060006200266b868662000721565b15620026a95760405162461bcd60e51b8152600401808060200182810382526023815260200180620059236023913960400191505060405180910390fd5b60008060006060620026bc8a8a6200229c565b935093509350935082841115620026f457620026df848463ffffffff62002e5116565b9650620026ee8a8a8962003eba565b6200271e565b838311156200271e576200270f838563ffffffff62002e5116565b95506200271e8a8a8862004014565b87156200280d576040805160018082528183019092526060916020808301908038833901905050905089816000815181106200275657fe5b6020026020010181815250506200276c6200416e565b6001600160a01b031663cda218c7826040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019060200280838360005b83811015620027cc578181015183820152602001620027b2565b5050505090500192505050600060405180830381600087803b158015620027f257600080fd5b505af115801562002807573d6000803e3d6000fd5b50505050505b60005b81518110156200295c578a6001600160a01b03167f8e3ad1f68bec55de3b6fa12ae2674a2a683a17c918a4cbf5157ac5d9ddc6e9408383815181106200285257fe5b6020026020010151600001518484815181106200286b57fe5b6020026020010151602001518585815181106200288457fe5b6020026020010151604001518686815181106200289d57fe5b602002602001015160600151878781518110620028b657fe5b602002602001015160800151888881518110620028cf57fe5b602002602001015160a00151898981518110620028e857fe5b602002602001015160c001518a8a815181106200290157fe5b602002602001015160e00151604051808981526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390a260010162002810565b508194506200296a62001901565b6001600160a01b031663d0d3d62a8b8b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015620029ca57600080fd5b505af1158015620029df573d6000803e3d6000fd5b505050505050505093509350939050565b6000620029fc620041bd565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f7072696365446576696174696f6e5468726573686f6c64466163746f720000006040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562002a7957600080fd5b505afa15801562002a8e573d6000803e3d6000fd5b505050506040513d602081101562002aa557600080fd5b5051905090565b600082820183811015620007c3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600062000c6b7044656c6567617465417070726f76616c7360781b6040518060600160405280602181526020016200584b6021913962002da3565b62002b4c620019be565b6001600160a01b031663ddd03a3f8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801562002ba257600080fd5b505af115801562002bb7573d6000803e3d6000fd5b50505050505050565b600062002bcc620041bd565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7077616974696e67506572696f645365637360781b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562002a7957600080fd5b600062002c49620041bd565b6001600160a01b031663d994502d6d53797374656d53657474696e677360901b741d1c98591a5b99d4995dd85c991cd15b98589b1959605a1b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562002a7957600080fd5b60008060008060008062002cd162001f8e565b6001600160a01b0316638295016a898b8a6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060606040518083038186803b15801562002d2557600080fd5b505afa15801562002d3a573d6000803e3d6000fd5b505050506040513d606081101562002d5157600080fd5b5080516020820151604090920151919450909250905062002d73888862002591565b935062002d81818562003ce6565b955062002d95818763ffffffff62002e5116565b945050939792965093509350565b6000828152600360205260408120546001600160a01b0316828162002e495760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562002e0d57818101518382015260200162002df3565b50505050905090810190601f16801562002e3b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509392505050565b60008282111562002ea9576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b8083141562002efb576040805162461bcd60e51b8152602060048201526013602482015272086c2dc4ee840c4ca40e6c2daca40e6f2dce8d606b1b604482015290519081900360640190fd5b6000821162002f3f576040805162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b604482015290519081900360640190fd5b6040805160028082526060808301845292602083019080388339019050509050838160008151811062002f6e57fe5b602002602001018181525050818160018151811062002f8957fe5b60200260200101818152505062002f9f62001f8e565b6001600160a01b0316630a7d36d1826040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019060200280838360005b8381101562002fff57818101518382015260200162002fe5565b505050509050019250505060206040518083038186803b1580156200302357600080fd5b505afa15801562003038573d6000803e3d6000fd5b505050506040513d60208110156200304f57600080fd5b5051156200308f5760405162461bcd60e51b8152600401808060200182810382526022815260200180620059016022913960400191505060405180910390fd5b50505050565b6000806000620030a8858560006200265a565b8895509093509150508015620030c957620030c68585888562000daa565b92505b50509392505050565b6000620030e0838362001fe1565b156200316257620030f062001ef7565b6001600160a01b031663abc0bb6e8460416040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156200313f57600080fd5b505af115801562003154573d6000803e3d6000fd5b5050505060019050620007c6565b6000928352600560205260409092205590565b60006200318162001f49565b6001600160a01b03166332608039896040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620031c557600080fd5b505afa158015620031da573d6000803e3d6000fd5b505050506040513d6020811015620031f157600080fd5b505160408051632770a7eb60e21b81526001600160a01b038a81166004830152602482018a905291519190921691639dc29fac91604480830192600092919082900301818387803b1580156200324657600080fd5b505af11580156200325b573d6000803e3d6000fd5b5050505060006200326b62001f49565b6001600160a01b03166332608039876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620032af57600080fd5b505afa158015620032c4573d6000803e3d6000fd5b505050506040513d6020811015620032db57600080fd5b505190508215620033e357600081905062003360816001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b1580156200332957600080fd5b505afa1580156200333e573d6000803e3d6000fd5b505050506040513d60208110156200335557600080fd5b505186888a62004212565b9250816001600160a01b031663867904b484886040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015620033c357600080fd5b505af1158015620033d8573d6000803e3d6000fd5b50505050506200345e565b806001600160a01b031663867904b485876040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156200344457600080fd5b505af115801562003459573d6000803e3d6000fd5b505050505b50979650505050505050565b600062000c6b66119959541bdbdb60ca1b6040518060400160405280601781526020017f4d697373696e6720466565506f6f6c206164647265737300000000000000000081525062002da3565b8151600090631cd554d160e21b1480620034db57506020830151631cd554d160e21b145b9050600081620034ed576003620034f0565b60025b60ff16905060608160405190808252806020026020018201604052801562003522578160200160208202803883390190505b5090508460006020020151816000815181106200353b57fe5b60209081029190910101528460016020020151816001815181106200355c57fe5b60200260200101818152505060608260405190808252806020026020018201604052801562003595578160200160208202803883390190505b509050846000602002015181600081518110620035ae57fe5b6020908102919091010152846001602002015181600181518110620035cf57fe5b602002602001018181525050836200369357631cd554d160e21b82600281518110620035f757fe5b6020026020010181815250507384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156200364857600080fd5b505af41580156200365d573d6000803e3d6000fd5b505050506040513d60208110156200367457600080fd5b50518151829060029081106200368657fe5b6020026020010181815250505b6200369d6200416e565b6001600160a01b03166317b38db483836040518363ffffffff1660e01b8152600401808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101562003702578181015183820152602001620036e8565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156200374357818101518382015260200162003729565b50505050905001945050505050600060405180830381600087803b1580156200376b57600080fd5b505af115801562003780573d6000803e3d6000fd5b50505050505050505050565b60006200379862001f8e565b90506000816001600160a01b0316637a018a1e886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620037e157600080fd5b505afa158015620037f6573d6000803e3d6000fd5b505050506040513d60208110156200380d57600080fd5b505160408051633d00c50f60e11b81526004810188905290519192506000916001600160a01b03851691637a018a1e916024808301926020929190829003018186803b1580156200385d57600080fd5b505afa15801562003872573d6000803e3d6000fd5b505050506040513d60208110156200388957600080fd5b505190506200389762001901565b60408051630f2a761760e21b81526001600160a01b038c81166004830152602482018c9052604482018b9052606482018a90526084820189905260a482018890524260c483015260e48201869052610104820185905291519290911691633ca9d85c916101248082019260009290919082900301818387803b1580156200391d57600080fd5b505af115801562003932573d6000803e3d6000fd5b5050604080518b8152602081018b90528082018a9052606081018990526080810188905260a0810186905260c0810185905290516001600160a01b038d1693507f62e40d554c7abcdd31074960d8347a2225daeb04d93bc748f049ba2ce946239892509081900360e00190a2505050505050505050565b600062000c6b6d54726164696e675265776172647360901b6040518060400160405280601e81526020017f4d697373696e672054726164696e67526577617264732061646472657373000081525062002da3565b600082158062003a0b575081155b1562003a1a57506001620007c6565b60008383111562003a3f5762003a37838563ffffffff6200434d16565b905062003a54565b62003a51848463ffffffff6200434d16565b90505b62003a5e620029f0565b11159392505050565b62003a7162004433565b60008060008060008060008062003a8762001901565b6001600160a01b03166315987eb68d8d8d6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b0316815260200183815260200182815260200193505050506101006040518083038186803b15801562003aee57600080fd5b505afa15801562003b03573d6000803e3d6000fd5b505050506040513d61010081101562003b1b57600080fd5b50805160208083015160408085015160608087015160808089015160a0808b015160c0808d015160e09d8e01518a5161010081018c529d8e529b8d019a909a52978b019690965293890192909252870152850152830152918101919091529c9b505050505050505050505050565b600080600062003b9862001f8e565b9050600062003ba662002bc0565b9050816001600160a01b031663109e46a286600001518760c001518860a00151856040518563ffffffff1660e01b81526004018085815260200184815260200183815260200182815260200194505050505060206040518083038186803b15801562003c1157600080fd5b505afa15801562003c26573d6000803e3d6000fd5b505050506040513d602081101562003c3d57600080fd5b505160408087015160e088015160a0890151835163084f235160e11b81526004810193909352602483019190915260448201526064810184905290519195506001600160a01b0384169163109e46a291608480820192602092909190829003018186803b15801562003cae57600080fd5b505afa15801562003cc3573d6000803e3d6000fd5b505050506040513d602081101562003cda57600080fd5b50519395939450505050565b6000620007c362003d71837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801562003d3657600080fd5b505af415801562003d4b573d6000803e3d6000fd5b505050506040513d602081101562003d6257600080fd5b50519063ffffffff62002e5116565b849063ffffffff6200437b16565b600062003d8b620041bd565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6e65786368616e67654665655261746560881b856040516020018083815260200182815260200192505050604051602081830303815290604052805190602001206040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562003e2857600080fd5b505afa15801562003e3d573d6000803e3d6000fd5b505050506040513d602081101562003e5457600080fd5b505192915050565b60008262003e6d57506000620007c6565b8282028284828162003e7b57fe5b0414620007c35760405162461bcd60e51b8152600401808060200182810382526021815260200180620058e06021913960400191505060405180910390fd5b62003ec462001f49565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562003f0857600080fd5b505afa15801562003f1d573d6000803e3d6000fd5b505050506040513d602081101562003f3457600080fd5b505160408051632770a7eb60e21b81526001600160a01b0386811660048301526024820185905291519190921691639dc29fac91604480830192600092919082900301818387803b15801562003f8957600080fd5b505af115801562003f9e573d6000803e3d6000fd5b5050505062003fac620019be565b6001600160a01b031663ace88afd8484846040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050600060405180830381600087803b15801562002ba257600080fd5b6200401e62001f49565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200406257600080fd5b505afa15801562004077573d6000803e3d6000fd5b505050506040513d60208110156200408e57600080fd5b50516040805163219e412d60e21b81526001600160a01b038681166004830152602482018590529151919092169163867904b491604480830192600092919082900301818387803b158015620040e357600080fd5b505af1158015620040f8573d6000803e3d6000fd5b5050505062004106620019be565b6001600160a01b0316636f01a9868484846040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050600060405180830381600087803b15801562002ba257600080fd5b600062000c6b6844656274436163686560b81b6040518060400160405280601981526020017f4d697373696e672044656274436163686520616464726573730000000000000081525062002da3565b600062000c6b6e466c657869626c6553746f7261676560881b6040518060400160405280601f81526020017f4d697373696e6720466c657869626c6553746f7261676520616464726573730081525062002da3565b6000606960f81b6001600160f81b031983831a60f81b1614156200427d576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f74207669727475616c697a6520746869732073796e746800000000604482015290519081900360640190fd5b60025460405186916001600160a01b031690869086908690620042a0906200447e565b6001600160a01b0395861681529385166020850152919093166040808401919091526060830193909352608082015290519081900360a001906000f080158015620042ef573d6000803e3d6000fd5b50604080516001600160a01b03808416825260208201869052818301879052915192935081871692918816917fb5ec76d79549c775883022e4426db5cd36bd5307f216cdb341554c301548ef9f9181900360600190a3949350505050565b6000620007c3826200436e85670de0b6b3a764000063ffffffff62003e5c16565b9063ffffffff620043a816565b6000670de0b6b3a764000062004398848463ffffffff62003e5c16565b81620043a057fe5b049392505050565b6000808211620043ff576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816200440b57fe5b04949350505050565b6040518061030001604052806018906020820280388339509192915050565b60405180610100016040528060008019168152602001600081526020016000801916815260200160008152602001600081526020016000815260200160008152602001600081525090565b611389806200448d8339019056fe60806040526004805460ff60a01b1916905534801561001d57600080fd5b50604051611389380380611389833981810160405260a081101561004057600080fd5b508051602082015160408301516060840151608090940151600380546001600160a01b038087166001600160a01b03199283161790925560048054928616929091169190911790556007819055929391929091906100a783836001600160e01b036100b416565b506005555061020f915050565b6001600160a01b03821661010f576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610128816002546101ae60201b610b011790919060201c565b6002556001600160a01b03821660009081526020818152604090912054610158918390610b016101ae821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015610208576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b61116b8061021e6000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c80633db3dc9b116100b85780638f7758391161007c5780638f7758391461036657806395d89b411461036e578063a457c2d714610376578063a9059cbb146103a2578063dbd06c85146103ce578063dd62ed3e146103d657610142565b80633db3dc9b146103005780634be37cea146103085780636a256b291461031057806370a082311461033857806378f2ac261461035e57610142565b806323b872dd1161010a57806323b872dd1461024a5780632c4e722e14610280578063313ce56714610288578063378dc3dc146102a657806339509351146102ae5780633af9e669146102da57610142565b806304f3bcec1461014757806306fdde031461016b578063095ea7b3146101e8578063115f4fee1461022857806318160ddd14610230575b600080fd5b61014f610404565b604080516001600160a01b039092168252519081900360200190f35b610173610413565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ad578181015183820152602001610195565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610214600480360360408110156101fe57600080fd5b506001600160a01b03813516906020013561044d565b604080519115158252519081900360200190f35b61014f610464565b610238610473565b60408051918252519081900360200190f35b6102146004803603606081101561026057600080fd5b506001600160a01b03813581169160208101359091169060400135610479565b6102386104d0565b6102906104df565b6040805160ff9092168252519081900360200190f35b6102386104e4565b610214600480360360408110156102c457600080fd5b506001600160a01b0381351690602001356104ea565b610238600480360360208110156102f057600080fd5b50356001600160a01b0316610526565b610238610531565b610238610537565b6103366004803603602081101561032657600080fd5b50356001600160a01b0316610541565b005b6102386004803603602081101561034e57600080fd5b50356001600160a01b03166105f5565b610214610610565b610214610620565b610173610630565b6102146004803603604081101561038c57600080fd5b506001600160a01b03813516906020013561065c565b610214600480360360408110156103b857600080fd5b506001600160a01b038135169060200135610698565b6102386106a5565b610238600480360360408110156103ec57600080fd5b506001600160a01b03813581169160200135166106ab565b6004546001600160a01b031681565b600754604080516d02b34b93a3ab0b61029bcb73a34160951b6020820152602e8082019390935281518082039093018352604e0190525b90565b600061045a3384846106d6565b5060015b92915050565b6003546001600160a01b031681565b60025490565b60006104868484846107c2565b6001600160a01b0384166000908152600160209081526040808320338085529252909120546104c69186916104c1908663ffffffff61090416565b6106d6565b5060019392505050565b60006104da610961565b905090565b601281565b60055481565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161045a9185906104c1908663ffffffff610b0116565b600061045e82610b62565b60065481565b60006104da610b88565b610549610c22565b6003546001600160a01b031663a9059cbb8261056481610b62565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156105b357600080fd5b505af11580156105c7573d6000803e3d6000fd5b505050506040513d60208110156105dd57600080fd5b506105f29050816105ed816105f5565b610da2565b50565b6001600160a01b031660009081526020819052604090205490565b600061061a610b88565b15905090565b600454600160a01b900460ff1681565b60075460408051603b60f91b602082015260218082019390935281518082039093018352604101905290565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161045a9185906104c1908663ffffffff61090416565b600061045a3384846107c2565b60075481565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b03831661071b5760405162461bcd60e51b81526004018080602001828103825260248152602001806111136024913960400191505060405180910390fd5b6001600160a01b0382166107605760405162461bcd60e51b815260040180806020018281038252602281526020018061108a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166108075760405162461bcd60e51b81526004018080602001828103825260258152602001806110ee6025913960400191505060405180910390fd5b6001600160a01b03821661084c5760405162461bcd60e51b81526004018080602001828103825260238152602001806110676023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610875908263ffffffff61090416565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546108aa908263ffffffff610b0116565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008282111561095b576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000600554600014156109765750600061044a565b600454600090600160a01b900460ff16610ae257600354604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156109d557600080fd5b505afa1580156109e9573d6000803e3d6000fd5b505050506040513d60208110156109ff57600080fd5b50519050600080610a0e610e7b565b6001600160a01b03166319d5c665306007546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060606040518083038186803b158015610a6d57600080fd5b505afa158015610a81573d6000803e3d6000fd5b505050506040513d6060811015610a9757600080fd5b50805160209091015190925090508115610ac257610abb838363ffffffff61090416565b9250610adb565b8015610adb57610ad8838263ffffffff610b0116565b92505b5050610ae7565b506006545b600554610afb90829063ffffffff610f0a16565b91505090565b600082820183811015610b5b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600080610b6e836105f5565b9050610b5b610b7b610961565b829063ffffffff610f1f16565b6000610b92610e7b565b6001600160a01b031663059c29ec306007546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b158015610bf157600080fd5b505afa158015610c05573d6000803e3d6000fd5b505050506040513d6020811015610c1b57600080fd5b5051905090565b600454600160a01b900460ff1615610c3957610da0565b6004805460ff60a01b1916600160a01b179055610c54610e7b565b6001600160a01b0316631b16802c306007546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050606060405180830381600087803b158015610cb557600080fd5b505af1158015610cc9573d6000803e3d6000fd5b505050506040513d6060811015610cdf57600080fd5b5050600354604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610d2c57600080fd5b505afa158015610d40573d6000803e3d6000fd5b505050506040513d6020811015610d5657600080fd5b50516006557ff5b268a3ff315cc44ccceeef86259c9e8eef81ceecb14001543809115380dd62610d84610473565b6006546040805192835260208301919091528051918290030190a15b565b6001600160a01b038216610de75760405162461bcd60e51b81526004018080602001828103825260218152602001806110cd6021913960400191505060405180910390fd5b600254610dfa908263ffffffff61090416565b6002556001600160a01b038216600090815260208190526040902054610e26908263ffffffff61090416565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b600480546040805163dacb2d0160e01b81526822bc31b430b733b2b960b91b9381019390935260248301819052601c60448401527f45786368616e67657220636f6e7472616374206e6f7420666f756e64000000006064840152516000926001600160a01b039092169163dacb2d01916084808301926020929190829003018186803b158015610bf157600080fd5b6000610b5b8383670de0b6b3a7640000610f34565b6000610b5b8383670de0b6b3a7640000610f78565b600080610f5a84610f4e87600a870263ffffffff610fa316565b9063ffffffff610ffc16565b90506005600a825b0610610f6c57600a015b600a9004949350505050565b600080600a8304610f8f868663ffffffff610fa316565b81610f9657fe5b0490506005600a82610f62565b600082610fb25750600061045e565b82820282848281610fbf57fe5b0414610b5b5760405162461bcd60e51b81526004018080602001828103825260218152602001806110ac6021913960400191505060405180910390fd5b6000808211611052576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161105d57fe5b0494935050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820f91ab21c429f4aaf52c1c2b720f4e46d897c02998a626aeb8f9400ec86166d5964736f6c63430005100032596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704d697373696e672044656c6567617465417070726f76616c73206164647265737345786368616e6765723a204f6e6c792073796e746865746978206f7220612073796e746820636f6e74726163742063616e20706572666f726d207468697320616374696f6e4f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775372632f64657374207261746520696e76616c6964206f72206e6f7420666f756e6443616e6e6f7420736574746c6520647572696e672077616974696e6720706572696f64a265627a7a72315820f087004155ddad9ca59e0d4d7eec8d151442c0ceaf5cd308bad73670fef2fc5364736f6c63430005100032000000000000000000000000de910777c787903f78c89e7a0bf7f4c435cbb1fe0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2
Deployed Bytecode
0x60806040523480156200001157600080fd5b5060043610620002085760003560e01c80636a1c4758116200011d578063c193f0d811620000b1578063dfffca76116200007b578063dfffca76146200061f578063e3235c911462000672578063f3995224146200067c578063f450aa3414620006e65762000208565b8063c193f0d814620005a0578063c6c9d82814620005aa578063ce09694014620005ca578063d6f32e0614620005f05762000208565b806386baa45c11620000f357806386baa45c14620004f45780638925711714620005475780638da5cb5b1462000551578063ab49848c146200055b5762000208565b80636a1c4758146200048557806379ba509714620004ca5780637dd1a57a14620004d45762000208565b80631b16802c11620001a15780634c268fc8116200016b5780634c268fc814620003e357806353a47bb7146200041e57806357af302c1462000428578063631e1444146200045c5762000208565b80631b16802c1462000377578063372a395a14620003a65780633be99e6f14620003b05780633fa70f4514620003d95762000208565b80630b9e31c911620001e35780630b9e31c914620002b95780631627540c14620002db57806319d5c66514620003045780631a5c609514620003515762000208565b806304f3bcec146200020d578063059c29ec14620002335780630a1e187d1462000274575b600080fd5b6200021762000712565b604080516001600160a01b039092168252519081900360200190f35b62000262600480360360408110156200024b57600080fd5b506001600160a01b03813516906020013562000721565b60408051918252519081900360200190f35b62000262600480360360a08110156200028c57600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160809091013516620007cc565b620002d960048036036020811015620002d157600080fd5b5035620008d7565b005b620002d960048036036020811015620002f357600080fd5b50356001600160a01b031662000b4c565b62000333600480360360408110156200031c57600080fd5b506001600160a01b03813516906020013562000baa565b60408051938452602084019290925282820152519081900360600190f35b62000262600480360360408110156200036957600080fd5b508035906020013562000bca565b62000333600480360360408110156200038f57600080fd5b506001600160a01b03813516906020013562000bd8565b6200026262000c5f565b620002d960048036036020811015620003c857600080fd5b50356001600160a01b031662000c70565b6200026262000da5565b6200026260048036036080811015620003fb57600080fd5b506001600160a01b03813516906020810135906040810135906060013562000daa565b6200021762000ed6565b62000448600480360360208110156200044057600080fd5b503562000ee5565b604080519115158252519081900360200190f35b62000448600480360360208110156200047457600080fd5b50356001600160a01b031662000f42565b62000262600480360360a08110156200049d57600080fd5b506001600160a01b0381358116916020810135909116906040810135906060810135906080013562001068565b620002d962001246565b6200026260048036036020811015620004ec57600080fd5b503562001304565b62000262600480360360e08110156200050c57600080fd5b506001600160a01b038135811691602081013591604082013591606081013591608082013581169160a08101359091169060c0013562001316565b6200026262001430565b620002176200143c565b620005656200144b565b604051808261030080838360005b838110156200058d57818101518382015260200162000573565b5050505090500191505060405180910390f35b620004486200149b565b6200026260048036036020811015620005c257600080fd5b5035620014a7565b620002d960048036036040811015620005e257600080fd5b5080359060200135620014c6565b62000448600480360360408110156200060857600080fd5b506001600160a01b03813516906020013562001592565b62000262600480360360e08110156200063757600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160808201359160a08101359091169060c00135620015ca565b62000262620017b5565b620006c5600480360360c08110156200069457600080fd5b506001600160a01b0381358116916020810135916040820135916060810135916080820135169060a00135620017ba565b604080519283526001600160a01b0390911660208301528051918290030190f35b6200033360048036036060811015620006fe57600080fd5b5080359060208101359060400135620018df565b6002546001600160a01b031681565b6000620007c36200073162001901565b6001600160a01b031663f1406dc885856040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b1580156200078f57600080fd5b505afa158015620007a4573d6000803e3d6000fd5b505050506040513d6020811015620007bb57600080fd5b505162001954565b90505b92915050565b600080620007d9620019be565b9050336001600160a01b03821614806200086a5750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200083957600080fd5b505afa1580156200084e573d6000803e3d6000fd5b505050506040513d60208110156200086557600080fd5b505114155b620008a75760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6000620008ba8888888888600062001a0d565b509093509050620008cc818562001e3f565b505095945050505050565b620008e162001ef7565b6001600160a01b031663086dabd16040518163ffffffff1660e01b815260040160006040518083038186803b1580156200091a57600080fd5b505afa1580156200092f573d6000803e3d6000fd5b5050505060006001600160a01b03166200094862001f49565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200098c57600080fd5b505afa158015620009a1573d6000803e3d6000fd5b505050506040513d6020811015620009b857600080fd5b50516001600160a01b0316141562000a07576040805162461bcd60e51b815260206004820152600d60248201526c09cde40e6eac6d040e6f2dce8d609b1b604482015290519081900360640190fd5b62000a8e8162000a1662001f8e565b6001600160a01b031663ac82f608846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562000a5a57600080fd5b505afa15801562000a6f573d6000803e3d6000fd5b505050506040513d602081101562000a8657600080fd5b505162001fe1565b62000ad7576040805162461bcd60e51b815260206004820152601460248201527314de5b9d1a081c1c9a58d9481a5cc81d985b1a5960621b604482015290519081900360640190fd5b62000ae162001ef7565b6001600160a01b031663abc0bb6e8260416040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b15801562000b3057600080fd5b505af115801562000b45573d6000803e3d6000fd5b5050505050565b62000b566200224f565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b600080600062000bbb85856200229c565b50919790965090945092505050565b6000620007c3838362002591565b600080600062000be762001ef7565b6001600160a01b03166342a28e21856040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b15801562000c2b57600080fd5b505afa15801562000c40573d6000803e3d6000fd5b5050505062000c52858560016200265a565b9250925092509250925092565b600062000c6b620029f0565b905090565b62000c7a6200224f565b600280546001600160a01b0319166001600160a01b03831617905560005b60045481101562000da15760006004828154811062000cb357fe5b600091825260209182902001546002546040805163dacb2d0160e01b81526004810184905260248101829052601760448201527f5265736f6c766572206d697373696e6720746172676574000000000000000000606482015290519294506001600160a01b039091169263dacb2d0192608480840193829003018186803b15801562000d3e57600080fd5b505afa15801562000d53573d6000803e3d6000fd5b505050506040513d602081101562000d6a57600080fd5b505160009182526003602052604090912080546001600160a01b0319166001600160a01b0390921691909117905560010162000c98565b5050565b604181565b81600062000db762001f49565b6001600160a01b03166332608039866040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562000dfb57600080fd5b505afa15801562000e10573d6000803e3d6000fd5b505050506040513d602081101562000e2757600080fd5b5051604080516370a0823160e01b81526001600160a01b038981166004830152915191909216916370a08231916024808301926020929190829003018186803b15801562000e7457600080fd5b505afa15801562000e89573d6000803e3d6000fd5b505050506040513d602081101562000ea057600080fd5b505190508082111562000eb1578091505b821562000ecd5762000eca828463ffffffff62002aac16565b91505b50949350505050565b6001546001600160a01b031681565b600062000f3a8262000ef662001f8e565b6001600160a01b031663ac82f608856040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562000a5a57600080fd5b90505b919050565b6002546000906001600160a01b0383811691161462000f645750600062000f3d565b60005b6004548110156200105f5760006004828154811062000f8257fe5b6000918252602080832090910154808352600382526040928390205460025484516321f8a72160e01b81526004810184905294519295506001600160a01b03918216949116926321f8a72192602480840193829003018186803b15801562000fe957600080fd5b505afa15801562000ffe573d6000803e3d6000fd5b505050506040513d60208110156200101557600080fd5b50516001600160a01b03161415806200104357506000818152600360205260409020546001600160a01b0316155b15620010555760009250505062000f3d565b5060010162000f67565b50600192915050565b60008062001075620019be565b9050336001600160a01b0382161480620011065750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b158015620010d557600080fd5b505afa158015620010ea573d6000803e3d6000fd5b505050506040513d60208110156200110157600080fd5b505114155b620011435760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6200114d62002b07565b6040805163faf431bb60e01b81526001600160a01b038a8116600483015289811660248301529151929091169163faf431bb91604480820192602092909190829003018186803b158015620011a157600080fd5b505afa158015620011b6573d6000803e3d6000fd5b505050506040513d6020811015620011cd57600080fd5b505162001221576040805162461bcd60e51b815260206004820152601d60248201527f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000604482015290519081900360640190fd5b600062001234888787878c600062001a0d565b509093509050620008cc818962001e3f565b6001546001600160a01b03163314620012915760405162461bcd60e51b8152600401808060200182810382526035815260200180620058166035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60056020526000908152604090205481565b60008062001323620019be565b9050336001600160a01b0382161480620013b45750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200138357600080fd5b505afa15801562001398573d6000803e3d6000fd5b505050506040513d6020811015620013af57600080fd5b505114155b620013f15760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6000620014048a8a8a8a8a600062001a0d565b50909350905062001416818662001e3f565b6200142384888562002b42565b5050979650505050505050565b600062000c6b62002bc0565b6000546001600160a01b031681565b6200145562004414565b60005b6004548110156200149757600481815481106200147157fe5b90600052602060002001548282601881106200148957fe5b602002015260010162001458565b5090565b600062000c6b62002c3d565b60048181548110620014b557fe5b600091825260209091200154905081565b6000620014d262001f8e565b9050336001600160a01b0382161462001532576040805162461bcd60e51b815260206004820152601b60248201527f5265737472696374656420746f2045786368616e676552617465730000000000604482015290519081900360640190fd5b600082116200157f576040805162461bcd60e51b8152602060048201526014602482015273052617465206d7573742062652061626f766520360641b604482015290519081900360640190fd5b5060009182526005602052604090912055565b6000620015a0838362000721565b15620015af57506001620007c6565b6000620015bd84846200229c565b5050501515949350505050565b600080620015d7620019be565b9050336001600160a01b0382161480620016685750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200163757600080fd5b505afa1580156200164c573d6000803e3d6000fd5b505050506040513d60208110156200166357600080fd5b505114155b620016a55760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b620016af62002b07565b6040805163faf431bb60e01b81526001600160a01b038c811660048301528b811660248301529151929091169163faf431bb91604480820192602092909190829003018186803b1580156200170357600080fd5b505afa15801562001718573d6000803e3d6000fd5b505050506040513d60208110156200172f57600080fd5b505162001783576040805162461bcd60e51b815260206004820152601d60248201527f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000604482015290519081900360640190fd5b6000620017968a8989898e600062001a0d565b509093509050620017a8818662001e3f565b6200142384878562002b42565b601881565b6000806000620017c9620019be565b9050336001600160a01b03821614806200185a5750604080516316b2213f60e01b815233600482015290516000916001600160a01b038416916316b2213f91602480820192602092909190829003018186803b1580156200182957600080fd5b505afa1580156200183e573d6000803e3d6000fd5b505050506040513d60208110156200185557600080fd5b505114155b620018975760405162461bcd60e51b81526004018080602001828103825260458152602001806200586c6045913960600191505060405180910390fd5b6000620018aa8a8a8a8a8a600162001a0d565b9195509093509050620018be818762001e3f565b8415620018d257620018d285888662002b42565b5050965096945050505050565b6000806000620018f186868662002cbe565b5092999198509650945050505050565b600062000c6b6c45786368616e6765537461746560981b6040518060400160405280601d81526020017f4d697373696e672045786368616e67655374617465206164647265737300000081525062002da3565b6000806200196162002bc0565b90508215806200198257506200197e838263ffffffff62002aac16565b4210155b156200199357600091505062000f3d565b620019b742620019aa858463ffffffff62002aac16565b9063ffffffff62002e5116565b9392505050565b600062000c6b680a6f2dce8d0cae8d2f60bb1b6040518060400160405280601981526020017f4d697373696e672053796e74686574697820616464726573730000000000000081525062002da3565b600080600062001a1f88888862002eaf565b600062001a2e888b8b62003095565b90508062001a4757506000925082915081905062001e33565b600080600062001a59848d8c62002cbe565b939a5091985094509250905062001a718c83620030d2565b8062001a84575062001a848a82620030d2565b1562001a9f57506000955085945084935062001e3392505050565b62001ab08c8e868d8b8e8e62003175565b94506001600160a01b0385161562001ac6578498505b851562001d355762001ad762001f8e565b6001600160a01b031663654a60ac8b88631cd554d160e21b6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b15801562001b3257600080fd5b505afa15801562001b47573d6000803e3d6000fd5b505050506040513d602081101562001b5e57600080fd5b5051955062001b6c62001f49565b6001600160a01b03166332608039631cd554d160e21b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562001bb757600080fd5b505afa15801562001bcc573d6000803e3d6000fd5b505050506040513d602081101562001be357600080fd5b50516001600160a01b031663867904b462001bfd6200346a565b6001600160a01b031663eb1edd616040518163ffffffff1660e01b815260040160206040518083038186803b15801562001c3657600080fd5b505afa15801562001c4b573d6000803e3d6000fd5b505050506040513d602081101562001c6257600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482018a905251604480830192600092919082900301818387803b15801562001cb257600080fd5b505af115801562001cc7573d6000803e3d6000fd5b5050505062001cd56200346a565b6001600160a01b03166322bf55ef876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801562001d1b57600080fd5b505af115801562001d30573d6000803e3d6000fd5b505050505b62001d6960405180604001604052808e81526020018c815250604051806040016040528085815260200184815250620034b7565b62001d73620019be565b6001600160a01b0316636c00f3108e8e878e8c8f6040518763ffffffff1660e01b815260040180876001600160a01b03166001600160a01b03168152602001868152602001858152602001848152602001838152602001826001600160a01b03166001600160a01b031681526020019650505050505050600060405180830381600087803b15801562001e0557600080fd5b505af115801562001e1a573d6000803e3d6000fd5b5050505062001e2e898d868d8b886200378c565b505050505b96509650969350505050565b60008211801562001e5857506001600160a01b03811615155b801562001e6a575062001e6a62002c3d565b1562000da15762001e7a620039a9565b6001600160a01b03166321cad77483836040518363ffffffff1660e01b815260040180838152602001826001600160a01b03166001600160a01b0316815260200192505050600060405180830381600087803b15801562001eda57600080fd5b505af115801562001eef573d6000803e3d6000fd5b505050505050565b600062000c6b6b53797374656d53746174757360a01b6040518060400160405280601c81526020017f4d697373696e672053797374656d53746174757320616464726573730000000081525062002da3565b600062000c6b6524b9b9bab2b960d11b604051806040016040528060168152602001754d697373696e6720497373756572206164647265737360501b81525062002da3565b600062000c6b6c45786368616e6765526174657360981b6040518060400160405280601d81526020017f4d697373696e672045786368616e67655261746573206164647265737300000081525062002da3565b60008162001ff257506001620007c6565b60008381526005602052604090205480156200201d57620020148184620039fd565b915050620007c6565b60606200202962001f8e565b6001600160a01b0316632d7371e18660046040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b1580156200207657600080fd5b505afa1580156200208b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040908152811015620020b557600080fd5b8101908080516040519392919084640100000000821115620020d657600080fd5b908301906020820185811115620020ec57600080fd5b82518660208202830111640100000000821117156200210a57600080fd5b82525081516020918201928201910280838360005b83811015620021395781810151838201526020016200211f565b50505050905001604052602001805160405193929190846401000000008211156200216357600080fd5b9083019060208201858111156200217957600080fd5b82518660208202830111640100000000821117156200219757600080fd5b82525081516020918201928201910280838360005b83811015620021c6578181015183820152602001620021ac565b505050509050016040525050505090506000600190505b815181101562002243576000828281518110620021f657fe5b6020026020010151118015620022275750620022278282815181106200221857fe5b602002602001015186620039fd565b156200223a5760019350505050620007c6565b600101620021dd565b50600095945050505050565b6000546001600160a01b031633146200229a5760405162461bcd60e51b815260040180806020018281038252602f815260200180620058b1602f913960400191505060405180910390fd5b565b60008060006060620022ad62001901565b6001600160a01b031663b44e975387876040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b1580156200230b57600080fd5b505afa15801562002320573d6000803e3d6000fd5b505050506040513d60208110156200233757600080fd5b50516040805182815260208084028201019091529092506060908380156200237c57816020015b6200236862004433565b8152602001906001900390816200235e5790505b50905060005b8381101562002585576000806200239862004433565b620023a58b8b8662003a67565b9050600080620023b58362003b89565b915091506000620023c562001f8e565b6001600160a01b031663266da16b85600001518660200151876040015187876040518663ffffffff1660e01b8152600401808681526020018581526020018481526020018381526020018281526020019550505050505060206040518083038186803b1580156200243557600080fd5b505afa1580156200244a573d6000803e3d6000fd5b505050506040513d60208110156200246157600080fd5b505160808501519091506000906200247b90839062003ce6565b90506200248d856060015182620039fd565b6200250e578085606001511115620024d2576060850151620024b6908263ffffffff62002e5116565b9650620024ca8d8863ffffffff62002aac16565b9c506200250e565b84606001518111156200250e576060850151620024f790829063ffffffff62002e5116565b95506200250b8c8763ffffffff62002aac16565b9b505b6040518061010001604052808660000151815260200186602001518152602001866040015181526020018881526020018781526020018581526020018481526020018660a001518152508989815181106200256557fe5b602002602001018190525050505050505050808060010191505062002382565b50905092959194509250565b60006200259e8262003d7f565b9050631cd554d160e21b831480620025bc5750631cd554d160e21b82145b15620025c857620007c6565b607360f81b6001600160f81b0319600085901a60f81b16148015620026015750606960f81b6001600160f81b0319600084901a60f81b16145b80620026415750606960f81b6001600160f81b0319600085901a60f81b16148015620026415750607360f81b6001600160f81b0319600084901a60f81b16145b15620007c657620007c381600263ffffffff62003e5c16565b60008060006200266b868662000721565b15620026a95760405162461bcd60e51b8152600401808060200182810382526023815260200180620059236023913960400191505060405180910390fd5b60008060006060620026bc8a8a6200229c565b935093509350935082841115620026f457620026df848463ffffffff62002e5116565b9650620026ee8a8a8962003eba565b6200271e565b838311156200271e576200270f838563ffffffff62002e5116565b95506200271e8a8a8862004014565b87156200280d576040805160018082528183019092526060916020808301908038833901905050905089816000815181106200275657fe5b6020026020010181815250506200276c6200416e565b6001600160a01b031663cda218c7826040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019060200280838360005b83811015620027cc578181015183820152602001620027b2565b5050505090500192505050600060405180830381600087803b158015620027f257600080fd5b505af115801562002807573d6000803e3d6000fd5b50505050505b60005b81518110156200295c578a6001600160a01b03167f8e3ad1f68bec55de3b6fa12ae2674a2a683a17c918a4cbf5157ac5d9ddc6e9408383815181106200285257fe5b6020026020010151600001518484815181106200286b57fe5b6020026020010151602001518585815181106200288457fe5b6020026020010151604001518686815181106200289d57fe5b602002602001015160600151878781518110620028b657fe5b602002602001015160800151888881518110620028cf57fe5b602002602001015160a00151898981518110620028e857fe5b602002602001015160c001518a8a815181106200290157fe5b602002602001015160e00151604051808981526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390a260010162002810565b508194506200296a62001901565b6001600160a01b031663d0d3d62a8b8b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015620029ca57600080fd5b505af1158015620029df573d6000803e3d6000fd5b505050505050505093509350939050565b6000620029fc620041bd565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f7072696365446576696174696f6e5468726573686f6c64466163746f720000006040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562002a7957600080fd5b505afa15801562002a8e573d6000803e3d6000fd5b505050506040513d602081101562002aa557600080fd5b5051905090565b600082820183811015620007c3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600062000c6b7044656c6567617465417070726f76616c7360781b6040518060600160405280602181526020016200584b6021913962002da3565b62002b4c620019be565b6001600160a01b031663ddd03a3f8484846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b15801562002ba257600080fd5b505af115801562002bb7573d6000803e3d6000fd5b50505050505050565b600062002bcc620041bd565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7077616974696e67506572696f645365637360781b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562002a7957600080fd5b600062002c49620041bd565b6001600160a01b031663d994502d6d53797374656d53657474696e677360901b741d1c98591a5b99d4995dd85c991cd15b98589b1959605a1b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562002a7957600080fd5b60008060008060008062002cd162001f8e565b6001600160a01b0316638295016a898b8a6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060606040518083038186803b15801562002d2557600080fd5b505afa15801562002d3a573d6000803e3d6000fd5b505050506040513d606081101562002d5157600080fd5b5080516020820151604090920151919450909250905062002d73888862002591565b935062002d81818562003ce6565b955062002d95818763ffffffff62002e5116565b945050939792965093509350565b6000828152600360205260408120546001600160a01b0316828162002e495760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562002e0d57818101518382015260200162002df3565b50505050905090810190601f16801562002e3b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509392505050565b60008282111562002ea9576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b8083141562002efb576040805162461bcd60e51b8152602060048201526013602482015272086c2dc4ee840c4ca40e6c2daca40e6f2dce8d606b1b604482015290519081900360640190fd5b6000821162002f3f576040805162461bcd60e51b815260206004820152600b60248201526a16995c9bc8185b5bdd5b9d60aa1b604482015290519081900360640190fd5b6040805160028082526060808301845292602083019080388339019050509050838160008151811062002f6e57fe5b602002602001018181525050818160018151811062002f8957fe5b60200260200101818152505062002f9f62001f8e565b6001600160a01b0316630a7d36d1826040518263ffffffff1660e01b81526004018080602001828103825283818151815260200191508051906020019060200280838360005b8381101562002fff57818101518382015260200162002fe5565b505050509050019250505060206040518083038186803b1580156200302357600080fd5b505afa15801562003038573d6000803e3d6000fd5b505050506040513d60208110156200304f57600080fd5b5051156200308f5760405162461bcd60e51b8152600401808060200182810382526022815260200180620059016022913960400191505060405180910390fd5b50505050565b6000806000620030a8858560006200265a565b8895509093509150508015620030c957620030c68585888562000daa565b92505b50509392505050565b6000620030e0838362001fe1565b156200316257620030f062001ef7565b6001600160a01b031663abc0bb6e8460416040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156200313f57600080fd5b505af115801562003154573d6000803e3d6000fd5b5050505060019050620007c6565b6000928352600560205260409092205590565b60006200318162001f49565b6001600160a01b03166332608039896040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620031c557600080fd5b505afa158015620031da573d6000803e3d6000fd5b505050506040513d6020811015620031f157600080fd5b505160408051632770a7eb60e21b81526001600160a01b038a81166004830152602482018a905291519190921691639dc29fac91604480830192600092919082900301818387803b1580156200324657600080fd5b505af11580156200325b573d6000803e3d6000fd5b5050505060006200326b62001f49565b6001600160a01b03166332608039876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620032af57600080fd5b505afa158015620032c4573d6000803e3d6000fd5b505050506040513d6020811015620032db57600080fd5b505190508215620033e357600081905062003360816001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b1580156200332957600080fd5b505afa1580156200333e573d6000803e3d6000fd5b505050506040513d60208110156200335557600080fd5b505186888a62004212565b9250816001600160a01b031663867904b484886040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015620033c357600080fd5b505af1158015620033d8573d6000803e3d6000fd5b50505050506200345e565b806001600160a01b031663867904b485876040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156200344457600080fd5b505af115801562003459573d6000803e3d6000fd5b505050505b50979650505050505050565b600062000c6b66119959541bdbdb60ca1b6040518060400160405280601781526020017f4d697373696e6720466565506f6f6c206164647265737300000000000000000081525062002da3565b8151600090631cd554d160e21b1480620034db57506020830151631cd554d160e21b145b9050600081620034ed576003620034f0565b60025b60ff16905060608160405190808252806020026020018201604052801562003522578160200160208202803883390190505b5090508460006020020151816000815181106200353b57fe5b60209081029190910101528460016020020151816001815181106200355c57fe5b60200260200101818152505060608260405190808252806020026020018201604052801562003595578160200160208202803883390190505b509050846000602002015181600081518110620035ae57fe5b6020908102919091010152846001602002015181600181518110620035cf57fe5b602002602001018181525050836200369357631cd554d160e21b82600281518110620035f757fe5b6020026020010181815250507384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156200364857600080fd5b505af41580156200365d573d6000803e3d6000fd5b505050506040513d60208110156200367457600080fd5b50518151829060029081106200368657fe5b6020026020010181815250505b6200369d6200416e565b6001600160a01b03166317b38db483836040518363ffffffff1660e01b8152600401808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101562003702578181015183820152602001620036e8565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156200374357818101518382015260200162003729565b50505050905001945050505050600060405180830381600087803b1580156200376b57600080fd5b505af115801562003780573d6000803e3d6000fd5b50505050505050505050565b60006200379862001f8e565b90506000816001600160a01b0316637a018a1e886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015620037e157600080fd5b505afa158015620037f6573d6000803e3d6000fd5b505050506040513d60208110156200380d57600080fd5b505160408051633d00c50f60e11b81526004810188905290519192506000916001600160a01b03851691637a018a1e916024808301926020929190829003018186803b1580156200385d57600080fd5b505afa15801562003872573d6000803e3d6000fd5b505050506040513d60208110156200388957600080fd5b505190506200389762001901565b60408051630f2a761760e21b81526001600160a01b038c81166004830152602482018c9052604482018b9052606482018a90526084820189905260a482018890524260c483015260e48201869052610104820185905291519290911691633ca9d85c916101248082019260009290919082900301818387803b1580156200391d57600080fd5b505af115801562003932573d6000803e3d6000fd5b5050604080518b8152602081018b90528082018a9052606081018990526080810188905260a0810186905260c0810185905290516001600160a01b038d1693507f62e40d554c7abcdd31074960d8347a2225daeb04d93bc748f049ba2ce946239892509081900360e00190a2505050505050505050565b600062000c6b6d54726164696e675265776172647360901b6040518060400160405280601e81526020017f4d697373696e672054726164696e67526577617264732061646472657373000081525062002da3565b600082158062003a0b575081155b1562003a1a57506001620007c6565b60008383111562003a3f5762003a37838563ffffffff6200434d16565b905062003a54565b62003a51848463ffffffff6200434d16565b90505b62003a5e620029f0565b11159392505050565b62003a7162004433565b60008060008060008060008062003a8762001901565b6001600160a01b03166315987eb68d8d8d6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b0316815260200183815260200182815260200193505050506101006040518083038186803b15801562003aee57600080fd5b505afa15801562003b03573d6000803e3d6000fd5b505050506040513d61010081101562003b1b57600080fd5b50805160208083015160408085015160608087015160808089015160a0808b015160c0808d015160e09d8e01518a5161010081018c529d8e529b8d019a909a52978b019690965293890192909252870152850152830152918101919091529c9b505050505050505050505050565b600080600062003b9862001f8e565b9050600062003ba662002bc0565b9050816001600160a01b031663109e46a286600001518760c001518860a00151856040518563ffffffff1660e01b81526004018085815260200184815260200183815260200182815260200194505050505060206040518083038186803b15801562003c1157600080fd5b505afa15801562003c26573d6000803e3d6000fd5b505050506040513d602081101562003c3d57600080fd5b505160408087015160e088015160a0890151835163084f235160e11b81526004810193909352602483019190915260448201526064810184905290519195506001600160a01b0384169163109e46a291608480820192602092909190829003018186803b15801562003cae57600080fd5b505afa15801562003cc3573d6000803e3d6000fd5b505050506040513d602081101562003cda57600080fd5b50519395939450505050565b6000620007c362003d71837384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801562003d3657600080fd5b505af415801562003d4b573d6000803e3d6000fd5b505050506040513d602081101562003d6257600080fd5b50519063ffffffff62002e5116565b849063ffffffff6200437b16565b600062003d8b620041bd565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6e65786368616e67654665655261746560881b856040516020018083815260200182815260200192505050604051602081830303815290604052805190602001206040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801562003e2857600080fd5b505afa15801562003e3d573d6000803e3d6000fd5b505050506040513d602081101562003e5457600080fd5b505192915050565b60008262003e6d57506000620007c6565b8282028284828162003e7b57fe5b0414620007c35760405162461bcd60e51b8152600401808060200182810382526021815260200180620058e06021913960400191505060405180910390fd5b62003ec462001f49565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801562003f0857600080fd5b505afa15801562003f1d573d6000803e3d6000fd5b505050506040513d602081101562003f3457600080fd5b505160408051632770a7eb60e21b81526001600160a01b0386811660048301526024820185905291519190921691639dc29fac91604480830192600092919082900301818387803b15801562003f8957600080fd5b505af115801562003f9e573d6000803e3d6000fd5b5050505062003fac620019be565b6001600160a01b031663ace88afd8484846040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050600060405180830381600087803b15801562002ba257600080fd5b6200401e62001f49565b6001600160a01b03166332608039836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156200406257600080fd5b505afa15801562004077573d6000803e3d6000fd5b505050506040513d60208110156200408e57600080fd5b50516040805163219e412d60e21b81526001600160a01b038681166004830152602482018590529151919092169163867904b491604480830192600092919082900301818387803b158015620040e357600080fd5b505af1158015620040f8573d6000803e3d6000fd5b5050505062004106620019be565b6001600160a01b0316636f01a9868484846040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b031681526020018381526020018281526020019350505050600060405180830381600087803b15801562002ba257600080fd5b600062000c6b6844656274436163686560b81b6040518060400160405280601981526020017f4d697373696e672044656274436163686520616464726573730000000000000081525062002da3565b600062000c6b6e466c657869626c6553746f7261676560881b6040518060400160405280601f81526020017f4d697373696e6720466c657869626c6553746f7261676520616464726573730081525062002da3565b6000606960f81b6001600160f81b031983831a60f81b1614156200427d576040805162461bcd60e51b815260206004820152601c60248201527f43616e6e6f74207669727475616c697a6520746869732073796e746800000000604482015290519081900360640190fd5b60025460405186916001600160a01b031690869086908690620042a0906200447e565b6001600160a01b0395861681529385166020850152919093166040808401919091526060830193909352608082015290519081900360a001906000f080158015620042ef573d6000803e3d6000fd5b50604080516001600160a01b03808416825260208201869052818301879052915192935081871692918816917fb5ec76d79549c775883022e4426db5cd36bd5307f216cdb341554c301548ef9f9181900360600190a3949350505050565b6000620007c3826200436e85670de0b6b3a764000063ffffffff62003e5c16565b9063ffffffff620043a816565b6000670de0b6b3a764000062004398848463ffffffff62003e5c16565b81620043a057fe5b049392505050565b6000808211620043ff576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816200440b57fe5b04949350505050565b6040518061030001604052806018906020820280388339509192915050565b60405180610100016040528060008019168152602001600081526020016000801916815260200160008152602001600081526020016000815260200160008152602001600081525090565b611389806200448d8339019056fe60806040526004805460ff60a01b1916905534801561001d57600080fd5b50604051611389380380611389833981810160405260a081101561004057600080fd5b508051602082015160408301516060840151608090940151600380546001600160a01b038087166001600160a01b03199283161790925560048054928616929091169190911790556007819055929391929091906100a783836001600160e01b036100b416565b506005555061020f915050565b6001600160a01b03821661010f576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610128816002546101ae60201b610b011790919060201c565b6002556001600160a01b03821660009081526020818152604090912054610158918390610b016101ae821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015610208576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b61116b8061021e6000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c80633db3dc9b116100b85780638f7758391161007c5780638f7758391461036657806395d89b411461036e578063a457c2d714610376578063a9059cbb146103a2578063dbd06c85146103ce578063dd62ed3e146103d657610142565b80633db3dc9b146103005780634be37cea146103085780636a256b291461031057806370a082311461033857806378f2ac261461035e57610142565b806323b872dd1161010a57806323b872dd1461024a5780632c4e722e14610280578063313ce56714610288578063378dc3dc146102a657806339509351146102ae5780633af9e669146102da57610142565b806304f3bcec1461014757806306fdde031461016b578063095ea7b3146101e8578063115f4fee1461022857806318160ddd14610230575b600080fd5b61014f610404565b604080516001600160a01b039092168252519081900360200190f35b610173610413565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ad578181015183820152602001610195565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610214600480360360408110156101fe57600080fd5b506001600160a01b03813516906020013561044d565b604080519115158252519081900360200190f35b61014f610464565b610238610473565b60408051918252519081900360200190f35b6102146004803603606081101561026057600080fd5b506001600160a01b03813581169160208101359091169060400135610479565b6102386104d0565b6102906104df565b6040805160ff9092168252519081900360200190f35b6102386104e4565b610214600480360360408110156102c457600080fd5b506001600160a01b0381351690602001356104ea565b610238600480360360208110156102f057600080fd5b50356001600160a01b0316610526565b610238610531565b610238610537565b6103366004803603602081101561032657600080fd5b50356001600160a01b0316610541565b005b6102386004803603602081101561034e57600080fd5b50356001600160a01b03166105f5565b610214610610565b610214610620565b610173610630565b6102146004803603604081101561038c57600080fd5b506001600160a01b03813516906020013561065c565b610214600480360360408110156103b857600080fd5b506001600160a01b038135169060200135610698565b6102386106a5565b610238600480360360408110156103ec57600080fd5b506001600160a01b03813581169160200135166106ab565b6004546001600160a01b031681565b600754604080516d02b34b93a3ab0b61029bcb73a34160951b6020820152602e8082019390935281518082039093018352604e0190525b90565b600061045a3384846106d6565b5060015b92915050565b6003546001600160a01b031681565b60025490565b60006104868484846107c2565b6001600160a01b0384166000908152600160209081526040808320338085529252909120546104c69186916104c1908663ffffffff61090416565b6106d6565b5060019392505050565b60006104da610961565b905090565b601281565b60055481565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161045a9185906104c1908663ffffffff610b0116565b600061045e82610b62565b60065481565b60006104da610b88565b610549610c22565b6003546001600160a01b031663a9059cbb8261056481610b62565b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156105b357600080fd5b505af11580156105c7573d6000803e3d6000fd5b505050506040513d60208110156105dd57600080fd5b506105f29050816105ed816105f5565b610da2565b50565b6001600160a01b031660009081526020819052604090205490565b600061061a610b88565b15905090565b600454600160a01b900460ff1681565b60075460408051603b60f91b602082015260218082019390935281518082039093018352604101905290565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161045a9185906104c1908663ffffffff61090416565b600061045a3384846107c2565b60075481565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b03831661071b5760405162461bcd60e51b81526004018080602001828103825260248152602001806111136024913960400191505060405180910390fd5b6001600160a01b0382166107605760405162461bcd60e51b815260040180806020018281038252602281526020018061108a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166108075760405162461bcd60e51b81526004018080602001828103825260258152602001806110ee6025913960400191505060405180910390fd5b6001600160a01b03821661084c5760405162461bcd60e51b81526004018080602001828103825260238152602001806110676023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610875908263ffffffff61090416565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546108aa908263ffffffff610b0116565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008282111561095b576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000600554600014156109765750600061044a565b600454600090600160a01b900460ff16610ae257600354604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156109d557600080fd5b505afa1580156109e9573d6000803e3d6000fd5b505050506040513d60208110156109ff57600080fd5b50519050600080610a0e610e7b565b6001600160a01b03166319d5c665306007546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060606040518083038186803b158015610a6d57600080fd5b505afa158015610a81573d6000803e3d6000fd5b505050506040513d6060811015610a9757600080fd5b50805160209091015190925090508115610ac257610abb838363ffffffff61090416565b9250610adb565b8015610adb57610ad8838263ffffffff610b0116565b92505b5050610ae7565b506006545b600554610afb90829063ffffffff610f0a16565b91505090565b600082820183811015610b5b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600080610b6e836105f5565b9050610b5b610b7b610961565b829063ffffffff610f1f16565b6000610b92610e7b565b6001600160a01b031663059c29ec306007546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b031681526020018281526020019250505060206040518083038186803b158015610bf157600080fd5b505afa158015610c05573d6000803e3d6000fd5b505050506040513d6020811015610c1b57600080fd5b5051905090565b600454600160a01b900460ff1615610c3957610da0565b6004805460ff60a01b1916600160a01b179055610c54610e7b565b6001600160a01b0316631b16802c306007546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050606060405180830381600087803b158015610cb557600080fd5b505af1158015610cc9573d6000803e3d6000fd5b505050506040513d6060811015610cdf57600080fd5b5050600354604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610d2c57600080fd5b505afa158015610d40573d6000803e3d6000fd5b505050506040513d6020811015610d5657600080fd5b50516006557ff5b268a3ff315cc44ccceeef86259c9e8eef81ceecb14001543809115380dd62610d84610473565b6006546040805192835260208301919091528051918290030190a15b565b6001600160a01b038216610de75760405162461bcd60e51b81526004018080602001828103825260218152602001806110cd6021913960400191505060405180910390fd5b600254610dfa908263ffffffff61090416565b6002556001600160a01b038216600090815260208190526040902054610e26908263ffffffff61090416565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b600480546040805163dacb2d0160e01b81526822bc31b430b733b2b960b91b9381019390935260248301819052601c60448401527f45786368616e67657220636f6e7472616374206e6f7420666f756e64000000006064840152516000926001600160a01b039092169163dacb2d01916084808301926020929190829003018186803b158015610bf157600080fd5b6000610b5b8383670de0b6b3a7640000610f34565b6000610b5b8383670de0b6b3a7640000610f78565b600080610f5a84610f4e87600a870263ffffffff610fa316565b9063ffffffff610ffc16565b90506005600a825b0610610f6c57600a015b600a9004949350505050565b600080600a8304610f8f868663ffffffff610fa316565b81610f9657fe5b0490506005600a82610f62565b600082610fb25750600061045e565b82820282848281610fbf57fe5b0414610b5b5760405162461bcd60e51b81526004018080602001828103825260218152602001806110ac6021913960400191505060405180910390fd5b6000808211611052576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161105d57fe5b0494935050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820f91ab21c429f4aaf52c1c2b720f4e46d897c02998a626aeb8f9400ec86166d5964736f6c63430005100032596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704d697373696e672044656c6567617465417070726f76616c73206164647265737345786368616e6765723a204f6e6c792073796e746865746978206f7220612073796e746820636f6e74726163742063616e20706572666f726d207468697320616374696f6e4f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775372632f64657374207261746520696e76616c6964206f72206e6f7420666f756e6443616e6e6f7420736574746c6520647572696e672077616974696e6720706572696f64a265627a7a72315820f087004155ddad9ca59e0d4d7eec8d151442c0ceaf5cd308bad73670fef2fc5364736f6c63430005100032
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000de910777c787903f78c89e7a0bf7f4c435cbb1fe0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2
-----Decoded View---------------
Arg [0] : _owner (address): 0xDe910777C787903F78C89e7a0bf7F4C435cBB1Fe
Arg [1] : _resolver (address): 0x4E3b31eB0E5CB73641EE1E65E7dCEFe520bA3ef2
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000de910777c787903f78c89e7a0bf7f4c435cbb1fe
Arg [1] : 0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.