Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Issuer
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 optimistic.etherscan.io on 2021-11-23 */ /* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: Issuer.sol * * Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/Issuer.sol * Docs: https://docs.synthetix.io/contracts/Issuer * * Contract Dependencies: * - IAddressResolver * - IIssuer * - MixinResolver * - MixinSystemSettings * - Owned * Libraries: * - SafeCast * - SafeDecimalMath * - SafeMath * - VestingEntries * * MIT License * =========== * * Copyright (c) 2021 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 excludeOtherCollateral) 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 burnForRedemption( address deprecatedSynthProxy, address account, uint balance ) external; function liquidateDelinquentAccount( address account, uint susdAmount, address liquidator ) external returns (uint totalRedeemed, uint amountToLiquidate); } // Inheritance // Internal references // https://docs.synthetix.io/contracts/source/contracts/addressresolver contract AddressResolver is Owned, IAddressResolver { mapping(bytes32 => address) public repository; constructor(address _owner) public Owned(_owner) {} /* ========== RESTRICTED FUNCTIONS ========== */ function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner { require(names.length == destinations.length, "Input lengths must match"); for (uint i = 0; i < names.length; i++) { bytes32 name = names[i]; address destination = destinations[i]; repository[name] = destination; emit AddressImported(name, destination); } } /* ========= PUBLIC FUNCTIONS ========== */ function rebuildCaches(MixinResolver[] calldata destinations) external { for (uint i = 0; i < destinations.length; i++) { destinations[i].rebuildCache(); } } /* ========== VIEWS ========== */ function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) { for (uint i = 0; i < names.length; i++) { if (repository[names[i]] != destinations[i]) { return false; } } return true; } function getAddress(bytes32 name) external view returns (address) { return repository[name]; } function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) { address _foundAddress = repository[name]; require(_foundAddress != address(0), reason); return _foundAddress; } function getSynth(bytes32 key) external view returns (address) { IIssuer issuer = IIssuer(repository["Issuer"]); require(address(issuer) != address(0), "Cannot find Issuer address"); return address(issuer.synths(key)); } /* ========== EVENTS ========== */ event AddressImported(bytes32 name, address destination); } // Internal references // https://docs.synthetix.io/contracts/source/contracts/mixinresolver contract MixinResolver { AddressResolver public resolver; mapping(bytes32 => address) private addressCache; constructor(address _resolver) internal { resolver = AddressResolver(_resolver); } /* ========== INTERNAL FUNCTIONS ========== */ function combineArrays(bytes32[] memory first, bytes32[] memory second) internal pure returns (bytes32[] memory combination) { combination = new bytes32[](first.length + second.length); for (uint i = 0; i < first.length; i++) { combination[i] = first[i]; } for (uint j = 0; j < second.length; j++) { combination[first.length + j] = second[j]; } } /* ========== PUBLIC FUNCTIONS ========== */ // Note: this function is public not external in order for it to be overridden and invoked via super in subclasses function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // Note: can only be invoked once the resolver has all the targets needed added address destination = resolver.requireAndGetAddress(name, string(abi.encodePacked("Resolver missing target: ", name))); addressCache[name] = destination; emit CacheUpdated(name, destination); } } /* ========== VIEWS ========== */ function isResolverCached() external view returns (bool) { bytes32[] memory requiredAddresses = resolverAddressesRequired(); for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // false if our cache is invalid or if the resolver doesn't have the required address if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) { return false; } } return true; } /* ========== INTERNAL FUNCTIONS ========== */ function requireAndGetAddress(bytes32 name) internal view returns (address) { address _foundAddress = addressCache[name]; require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name))); return _foundAddress; } /* ========== EVENTS ========== */ event CacheUpdated(bytes32 name, address destination); } // 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 internal constant SETTING_CROSS_DOMAIN_DEPOSIT_GAS_LIMIT = "crossDomainDepositGasLimit"; bytes32 internal constant SETTING_CROSS_DOMAIN_ESCROW_GAS_LIMIT = "crossDomainEscrowGasLimit"; bytes32 internal constant SETTING_CROSS_DOMAIN_REWARD_GAS_LIMIT = "crossDomainRewardGasLimit"; bytes32 internal constant SETTING_CROSS_DOMAIN_WITHDRAWAL_GAS_LIMIT = "crossDomainWithdrawalGasLimit"; bytes32 internal constant SETTING_CROSS_DOMAIN_RELAY_GAS_LIMIT = "crossDomainRelayGasLimit"; bytes32 internal constant SETTING_ETHER_WRAPPER_MAX_ETH = "etherWrapperMaxETH"; bytes32 internal constant SETTING_ETHER_WRAPPER_MINT_FEE_RATE = "etherWrapperMintFeeRate"; bytes32 internal constant SETTING_ETHER_WRAPPER_BURN_FEE_RATE = "etherWrapperBurnFeeRate"; bytes32 internal constant SETTING_WRAPPER_MAX_TOKEN_AMOUNT = "wrapperMaxTokens"; bytes32 internal constant SETTING_WRAPPER_MINT_FEE_RATE = "wrapperMintFeeRate"; bytes32 internal constant SETTING_WRAPPER_BURN_FEE_RATE = "wrapperBurnFeeRate"; bytes32 internal constant SETTING_MIN_CRATIO = "minCratio"; bytes32 internal constant SETTING_NEW_COLLATERAL_MANAGER = "newCollateralManager"; bytes32 internal constant SETTING_INTERACTION_DELAY = "interactionDelay"; bytes32 internal constant SETTING_COLLAPSE_FEE_RATE = "collapseFeeRate"; bytes32 internal constant SETTING_ATOMIC_MAX_VOLUME_PER_BLOCK = "atomicMaxVolumePerBlock"; bytes32 internal constant SETTING_ATOMIC_TWAP_WINDOW = "atomicTwapWindow"; bytes32 internal constant SETTING_ATOMIC_EQUIVALENT_FOR_DEX_PRICING = "atomicEquivalentForDexPricing"; bytes32 internal constant SETTING_ATOMIC_EXCHANGE_FEE_RATE = "atomicExchangeFeeRate"; bytes32 internal constant SETTING_ATOMIC_PRICE_BUFFER = "atomicPriceBuffer"; bytes32 internal constant SETTING_ATOMIC_VOLATILITY_CONSIDERATION_WINDOW = "atomicVolConsiderationWindow"; bytes32 internal constant SETTING_ATOMIC_VOLATILITY_UPDATE_THRESHOLD = "atomicVolUpdateThreshold"; bytes32 internal constant CONTRACT_FLEXIBLESTORAGE = "FlexibleStorage"; enum CrossDomainMessageGasLimits {Deposit, Escrow, Reward, Withdrawal, Relay} constructor(address _resolver) internal MixinResolver(_resolver) {} function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { addresses = new bytes32[](1); addresses[0] = CONTRACT_FLEXIBLESTORAGE; } function flexibleStorage() internal view returns (IFlexibleStorage) { return IFlexibleStorage(requireAndGetAddress(CONTRACT_FLEXIBLESTORAGE)); } function _getGasLimitSetting(CrossDomainMessageGasLimits gasLimitType) internal pure returns (bytes32) { if (gasLimitType == CrossDomainMessageGasLimits.Deposit) { return SETTING_CROSS_DOMAIN_DEPOSIT_GAS_LIMIT; } else if (gasLimitType == CrossDomainMessageGasLimits.Escrow) { return SETTING_CROSS_DOMAIN_ESCROW_GAS_LIMIT; } else if (gasLimitType == CrossDomainMessageGasLimits.Reward) { return SETTING_CROSS_DOMAIN_REWARD_GAS_LIMIT; } else if (gasLimitType == CrossDomainMessageGasLimits.Withdrawal) { return SETTING_CROSS_DOMAIN_WITHDRAWAL_GAS_LIMIT; } else if (gasLimitType == CrossDomainMessageGasLimits.Relay) { return SETTING_CROSS_DOMAIN_RELAY_GAS_LIMIT; } else { revert("Unknown gas limit type"); } } function getCrossDomainMessageGasLimit(CrossDomainMessageGasLimits gasLimitType) internal view returns (uint) { return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, _getGasLimitSetting(gasLimitType)); } 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); } function getEtherWrapperMaxETH() internal view returns (uint) { return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ETHER_WRAPPER_MAX_ETH); } function getEtherWrapperMintFeeRate() internal view returns (uint) { return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ETHER_WRAPPER_MINT_FEE_RATE); } function getEtherWrapperBurnFeeRate() internal view returns (uint) { return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ETHER_WRAPPER_BURN_FEE_RATE); } function getWrapperMaxTokenAmount(address wrapper) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_WRAPPER_MAX_TOKEN_AMOUNT, wrapper)) ); } function getWrapperMintFeeRate(address wrapper) internal view returns (int) { return flexibleStorage().getIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_WRAPPER_MINT_FEE_RATE, wrapper)) ); } function getWrapperBurnFeeRate(address wrapper) internal view returns (int) { return flexibleStorage().getIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_WRAPPER_BURN_FEE_RATE, wrapper)) ); } function getMinCratio(address collateral) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_MIN_CRATIO, collateral)) ); } function getNewCollateralManager(address collateral) internal view returns (address) { return flexibleStorage().getAddressValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_NEW_COLLATERAL_MANAGER, collateral)) ); } function getInteractionDelay(address collateral) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_INTERACTION_DELAY, collateral)) ); } function getCollapseFeeRate(address collateral) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_COLLAPSE_FEE_RATE, collateral)) ); } function getAtomicMaxVolumePerBlock() internal view returns (uint) { return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ATOMIC_MAX_VOLUME_PER_BLOCK); } function getAtomicTwapWindow() internal view returns (uint) { return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ATOMIC_TWAP_WINDOW); } function getAtomicEquivalentForDexPricing(bytes32 currencyKey) internal view returns (address) { return flexibleStorage().getAddressValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_ATOMIC_EQUIVALENT_FOR_DEX_PRICING, currencyKey)) ); } function getAtomicExchangeFeeRate(bytes32 currencyKey) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_ATOMIC_EXCHANGE_FEE_RATE, currencyKey)) ); } function getAtomicPriceBuffer(bytes32 currencyKey) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_ATOMIC_PRICE_BUFFER, currencyKey)) ); } function getAtomicVolatilityConsiderationWindow(bytes32 currencyKey) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_ATOMIC_VOLATILITY_CONSIDERATION_WINDOW, currencyKey)) ); } function getAtomicVolatilityUpdateThreshold(bytes32 currencyKey) internal view returns (uint) { return flexibleStorage().getUIntValue( SETTING_CONTRACT_NAME, keccak256(abi.encodePacked(SETTING_ATOMIC_VOLATILITY_UPDATE_THRESHOLD, currencyKey)) ); } } // SPDX-License-Identifier: MIT /** * @dev Wrappers over Solidity's uintXX casting operators with added overflow * checks. * * Downcasting from uint256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such 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. * * Can be combined with {SafeMath} to extend it to smaller types, by performing * all math on `uint256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // Libraries // https://docs.synthetix.io/contracts/source/libraries/safedecimalmath library SafeDecimalMath { using SafeMath for uint; /* Number of decimal places in the representations. */ uint8 public constant decimals = 18; uint8 public constant highPrecisionDecimals = 27; /* The number representing 1.0. */ uint public constant UNIT = 10**uint(decimals); /* The number representing 1.0 for higher fidelity numbers. */ uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals); uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals); /** * @return Provides an interface to UNIT. */ function unit() external pure returns (uint) { return UNIT; } /** * @return Provides an interface to PRECISE_UNIT. */ function preciseUnit() external pure returns (uint) { return PRECISE_UNIT; } /** * @return The result of multiplying x and y, interpreting the operands as fixed-point * decimals. * * @dev A unit factor is divided out after the product of x and y is evaluated, * so that product must be less than 2**256. As this is an integer division, * the internal division always rounds down. This helps save on gas. Rounding * is more expensive on gas. */ function multiplyDecimal(uint x, uint y) internal pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ return x.mul(y) / UNIT; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of the specified precision unit. * * @dev The operands should be in the form of a the specified unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function _multiplyDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ uint quotientTimesTen = x.mul(y) / (precisionUnit / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a precise unit. * * @dev The operands should be in the precise unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, PRECISE_UNIT); } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a standard unit. * * @dev The operands should be in the standard unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is a high * precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and UNIT must be less than 2**256. As * this is an integer division, the result is always rounded down. * This helps save on gas. Rounding is more expensive on gas. */ function divideDecimal(uint x, uint y) internal pure returns (uint) { /* Reintroduce the UNIT factor that will be divided out by y. */ return x.mul(UNIT).div(y); } /** * @return The result of safely dividing x and y. The return value is as a rounded * decimal in the precision unit specified in the parameter. * * @dev y is divided after the product of x and the specified precision unit * is evaluated, so the product of x and the specified precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function _divideDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { uint resultTimesTen = x.mul(precisionUnit * 10).div(y); if (resultTimesTen % 10 >= 5) { resultTimesTen += 10; } return resultTimesTen / 10; } /** * @return The result of safely dividing x and y. The return value is as a rounded * standard precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and the standard precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRound(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is as a rounded * high precision decimal. * * @dev y is divided after the product of x and the high precision unit * is evaluated, so the product of x and the high precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, PRECISE_UNIT); } /** * @dev Convert a standard decimal representation to a high precision one. */ function decimalToPreciseDecimal(uint i) internal pure returns (uint) { return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); } /** * @dev Convert a high precision decimal to a standard decimal representation. */ function preciseDecimalToDecimal(uint i) internal pure returns (uint) { uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } // Computes `a - b`, setting the value to 0 if b > a. function floorsub(uint a, uint b) internal pure returns (uint) { return b >= a ? 0 : a - b; } /* ---------- Utilities ---------- */ /* * Absolute value of the input, returned as a signed number. */ function signedAbs(int x) internal pure returns (int) { return x < 0 ? -x : x; } /* * Absolute value of the input, returned as an unsigned number. */ function abs(int x) internal pure returns (uint) { return uint(signedAbs(x)); } } interface IVirtualSynth { // Views function balanceOfUnderlying(address account) external view returns (uint); function rate() external view returns (uint); function readyToSettle() external view returns (bool); function secsLeftInWaitingPeriod() external view returns (uint); function settled() external view returns (bool); function synth() external view returns (ISynth); // Mutative functions function settle(address account) external; } // https://docs.synthetix.io/contracts/source/interfaces/isynthetix interface ISynthetix { // Views function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid); function availableCurrencyKeys() external view returns (bytes32[] memory); function availableSynthCount() external view returns (uint); function availableSynths(uint index) external view returns (ISynth); function collateral(address account) external view returns (uint); function collateralisationRatio(address issuer) external view returns (uint); function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint); function isWaitingPeriod(bytes32 currencyKey) external view returns (bool); function maxIssuableSynths(address issuer) external view returns (uint maxIssuable); function remainingIssuableSynths(address issuer) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ); function synths(bytes32 currencyKey) external view returns (ISynth); function synthsByAddress(address synthAddress) external view returns (bytes32); function totalIssuedSynths(bytes32 currencyKey) external view returns (uint); function totalIssuedSynthsExcludeOtherCollateral(bytes32 currencyKey) external view returns (uint); function transferableSynthetix(address account) external view returns (uint transferable); // Mutative Functions function burnSynths(uint amount) external; function burnSynthsOnBehalf(address burnForAddress, uint amount) external; function burnSynthsToTarget() external; function burnSynthsToTargetOnBehalf(address burnForAddress) external; function exchange( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external returns (uint amountReceived); function exchangeOnBehalf( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external returns (uint amountReceived); function exchangeWithTracking( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeWithTrackingForInitiator( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeOnBehalfWithTracking( address exchangeForAddress, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived); function exchangeWithVirtual( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external returns (uint amountReceived, IVirtualSynth vSynth); function exchangeAtomically( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, bytes32 trackingCode ) external returns (uint amountReceived); function issueMaxSynths() external; function issueMaxSynthsOnBehalf(address issueForAddress) external; function issueSynths(uint amount) external; function issueSynthsOnBehalf(address issueForAddress, uint amount) external; function mint() external returns (bool); function settle(bytes32 currencyKey) external returns ( uint reclaimed, uint refunded, uint numEntries ); // Liquidations function liquidateDelinquentAccount(address account, 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/isynthetixstate interface ISynthetixState { // Views function debtLedger(uint index) external view returns (uint); function issuanceData(address account) external view returns (uint initialDebtOwnership, uint debtEntryIndex); function debtLedgerLength() external view returns (uint); function hasIssued(address account) external view returns (bool); function lastDebtLedgerEntry() external view returns (uint); // Mutative functions function incrementTotalIssuerCount() external; function decrementTotalIssuerCount() external; function setCurrentIssuanceData(address account, uint initialDebtOwnership) external; function appendDebtLedgerValue(uint value) external; function clearIssuanceData(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 exchangeForAddress, address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress, bool virtualSynth, address rewardAddress, bytes32 trackingCode ) external returns (uint amountReceived, IVirtualSynth vSynth); function exchangeAtomically( address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress, bytes32 trackingCode ) external returns (uint amountReceived); function settle(address from, bytes32 currencyKey) external returns ( uint reclaimed, uint refunded, uint numEntries ); function resetLastExchangeRate(bytes32[] calldata currencyKeys) external; function suspendSynthWithInvalidRate(bytes32 currencyKey) 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/iexchangerates interface IExchangeRates { // Structs struct RateAndUpdatedTime { uint216 rate; uint40 time; } // 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 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 effectiveAtomicValueAndRates( bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey ) external view returns ( uint value, uint systemValue, uint systemSourceRate, uint systemDestinationRate ); 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 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 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); function synthTooVolatileForAtomicExchange(bytes32 currencyKey) external view returns (bool); } // https://docs.synthetix.io/contracts/source/interfaces/ihasbalance interface IHasBalance { // Views function balanceOf(address account) external view returns (uint); } // https://docs.synthetix.io/contracts/source/interfaces/ierc20 interface IERC20 { // ERC20 Optional Views function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); // Views function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); // Mutative functions function transfer(address to, uint value) external returns (bool); function approve(address spender, uint value) external returns (bool); function transferFrom( address from, address to, uint value ) external returns (bool); // Events event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } // https://docs.synthetix.io/contracts/source/interfaces/iliquidations interface ILiquidations { // Views function isOpenForLiquidation(address account) external view returns (bool); function getLiquidationDeadlineForAccount(address account) external view returns (uint); function isLiquidationDeadlinePassed(address account) external view returns (bool); function liquidationDelay() external view returns (uint); function liquidationRatio() external view returns (uint); function liquidationPenalty() external view returns (uint); function calculateAmountToFixCollateral(uint debtBalance, uint collateral) external view returns (uint); // Mutative Functions function flagAccountForLiquidation(address account) external; // Restricted: used internally to Synthetix function removeAccountInLiquidation(address account) external; function checkAndRemoveAccountInLiquidation(address account) external; } interface ICollateralManager { // Manager information function hasCollateral(address collateral) external view returns (bool); function isSynthManaged(bytes32 currencyKey) external view returns (bool); // State information function long(bytes32 synth) external view returns (uint amount); function short(bytes32 synth) external view returns (uint amount); function totalLong() external view returns (uint susdValue, bool anyRateIsInvalid); function totalShort() external view returns (uint susdValue, bool anyRateIsInvalid); function getBorrowRate() external view returns (uint borrowRate, bool anyRateIsInvalid); function getShortRate(bytes32 synth) external view returns (uint shortRate, bool rateIsInvalid); function getRatesAndTime(uint index) external view returns ( uint entryRate, uint lastRate, uint lastUpdated, uint newIndex ); function getShortRatesAndTime(bytes32 currency, uint index) external view returns ( uint entryRate, uint lastRate, uint lastUpdated, uint newIndex ); function exceedsDebtLimit(uint amount, bytes32 currency) external view returns (bool canIssue, bool anyRateIsInvalid); function areSynthsAndCurrenciesSet(bytes32[] calldata requiredSynthNamesInResolver, bytes32[] calldata synthKeys) external view returns (bool); function areShortableSynthsSet(bytes32[] calldata requiredSynthNamesInResolver, bytes32[] calldata synthKeys) external view returns (bool); // Loans function getNewLoanId() external returns (uint id); // Manager mutative function addCollaterals(address[] calldata collaterals) external; function removeCollaterals(address[] calldata collaterals) external; function addSynths(bytes32[] calldata synthNamesInResolver, bytes32[] calldata synthKeys) external; function removeSynths(bytes32[] calldata synths, bytes32[] calldata synthKeys) external; function addShortableSynths(bytes32[] calldata requiredSynthNamesInResolver, bytes32[] calldata synthKeys) external; function removeShortableSynths(bytes32[] calldata synths) external; // State mutative function incrementLongs(bytes32 synth, uint amount) external; function decrementLongs(bytes32 synth, uint amount) external; function incrementShorts(bytes32 synth, uint amount) external; function decrementShorts(bytes32 synth, uint amount) external; function accrueInterest( uint interestIndex, bytes32 currency, bool isShort ) external returns (uint difference, uint index); function updateBorrowRatesCollateral(uint rate) external; function updateShortRatesCollateral(bytes32 currency, uint rate) external; } pragma experimental ABIEncoderV2; library VestingEntries { struct VestingEntry { uint64 endTime; uint256 escrowAmount; } struct VestingEntryWithID { uint64 endTime; uint256 escrowAmount; uint256 entryID; } } interface IRewardEscrowV2 { // Views function balanceOf(address account) external view returns (uint); function numVestingEntries(address account) external view returns (uint); function totalEscrowedAccountBalance(address account) external view returns (uint); function totalVestedAccountBalance(address account) external view returns (uint); function getVestingQuantity(address account, uint256[] calldata entryIDs) external view returns (uint); function getVestingSchedules( address account, uint256 index, uint256 pageSize ) external view returns (VestingEntries.VestingEntryWithID[] memory); function getAccountVestingEntryIDs( address account, uint256 index, uint256 pageSize ) external view returns (uint256[] memory); function getVestingEntryClaimable(address account, uint256 entryID) external view returns (uint); function getVestingEntry(address account, uint256 entryID) external view returns (uint64, uint256); // Mutative functions function vest(uint256[] calldata entryIDs) external; function createEscrowEntry( address beneficiary, uint256 deposit, uint256 duration ) external; function appendVestingEntry( address account, uint256 quantity, uint256 duration ) external; function migrateVestingSchedule(address _addressToMigrate) external; function migrateAccountEscrowBalances( address[] calldata accounts, uint256[] calldata escrowBalances, uint256[] calldata vestedBalances ) external; // Account Merging function startMergingWindow() external; function mergeAccount(address accountToMerge, uint256[] calldata entryIDs) external; function nominateAccountToMerge(address account) external; function accountMergingIsOpen() external view returns (bool); // L2 Migration function importVestingEntries( address account, uint256 escrowedAmount, VestingEntries.VestingEntry[] calldata vestingEntries ) external; // Return amount of SNX transfered to SynthetixBridgeToOptimism deposit contract function burnForMigration(address account, uint256[] calldata entryIDs) external returns (uint256 escrowedAccountBalance, VestingEntries.VestingEntry[] memory vestingEntries); } interface ISynthRedeemer { // Rate of redemption - 0 for none function redemptions(address synthProxy) external view returns (uint redeemRate); // sUSD balance of deprecated token holder function balanceOf(IERC20 synthProxy, address account) external view returns (uint balanceOfInsUSD); // Full sUSD supply of token function totalSupply(IERC20 synthProxy) external view returns (uint totalSupplyInsUSD); function redeem(IERC20 synthProxy) external; function redeemAll(IERC20[] calldata synthProxies) external; function redeemPartial(IERC20 synthProxy, uint amountOfSynth) external; // Restricted to Issuer function deprecate(IERC20 synthProxy, uint rateToRedeem) 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; /* The caller of the proxy, passed through to this contract. * Note that every function using this member must apply the onlyProxy or * optionalProxy modifiers, otherwise their invocations can use stale values. */ address public messageSender; constructor(address payable _proxy) internal { // This contract is abstract, and thus cannot be instantiated directly require(owner != address(0), "Owner must be set"); proxy = Proxy(_proxy); emit ProxyUpdated(_proxy); } function setProxy(address payable _proxy) external onlyOwner { proxy = Proxy(_proxy); emit ProxyUpdated(_proxy); } function setMessageSender(address sender) external onlyProxy { messageSender = sender; } modifier onlyProxy { _onlyProxy(); _; } function _onlyProxy() private view { require(Proxy(msg.sender) == proxy, "Only the proxy can call"); } modifier optionalProxy { _optionalProxy(); _; } function _optionalProxy() private { if (Proxy(msg.sender) != proxy && messageSender != msg.sender) { messageSender = msg.sender; } } modifier optionalProxy_onlyOwner { _optionalProxy_onlyOwner(); _; } // solhint-disable-next-line func-name-mixedcase function _optionalProxy_onlyOwner() private { if (Proxy(msg.sender) != proxy && messageSender != msg.sender) { messageSender = msg.sender; } require(messageSender == owner, "Owner only function"); } event ProxyUpdated(address proxyAddress); } // Inheritance // Libraries // Internal references interface IProxy { function target() external view returns (address); } interface IIssuerInternalDebtCache { function updateCachedSynthDebtWithRate(bytes32 currencyKey, uint currencyRate) external; function updateCachedSynthDebtsWithRates(bytes32[] calldata currencyKeys, uint[] calldata currencyRates) external; function updateDebtCacheValidity(bool currentlyInvalid) external; function totalNonSnxBackedDebt() external view returns (uint excludedDebt, bool isInvalid); function cacheInfo() external view returns ( uint cachedDebt, uint timestamp, bool isInvalid, bool isStale ); function updateCachedsUSDDebt(int amount) external; } // https://docs.synthetix.io/contracts/source/contracts/issuer contract Issuer is Owned, MixinSystemSettings, IIssuer { using SafeMath for uint; using SafeDecimalMath for uint; bytes32 public constant CONTRACT_NAME = "Issuer"; // Available Synths which can be used with the system ISynth[] public availableSynths; mapping(bytes32 => ISynth) public synths; mapping(address => bytes32) public synthsByAddress; /* ========== ENCODED NAMES ========== */ bytes32 internal constant sUSD = "sUSD"; bytes32 internal constant sETH = "sETH"; bytes32 internal constant SNX = "SNX"; // Flexible storage names bytes32 internal constant LAST_ISSUE_EVENT = "lastIssueEvent"; /* ========== ADDRESS RESOLVER CONFIGURATION ========== */ bytes32 private constant CONTRACT_SYNTHETIX = "Synthetix"; bytes32 private constant CONTRACT_EXCHANGER = "Exchanger"; bytes32 private constant CONTRACT_EXRATES = "ExchangeRates"; bytes32 private constant CONTRACT_SYNTHETIXSTATE = "SynthetixState"; bytes32 private constant CONTRACT_FEEPOOL = "FeePool"; bytes32 private constant CONTRACT_DELEGATEAPPROVALS = "DelegateApprovals"; bytes32 private constant CONTRACT_COLLATERALMANAGER = "CollateralManager"; bytes32 private constant CONTRACT_REWARDESCROW_V2 = "RewardEscrowV2"; bytes32 private constant CONTRACT_SYNTHETIXESCROW = "SynthetixEscrow"; bytes32 private constant CONTRACT_LIQUIDATIONS = "Liquidations"; bytes32 private constant CONTRACT_DEBTCACHE = "DebtCache"; bytes32 private constant CONTRACT_SYNTHREDEEMER = "SynthRedeemer"; constructor(address _owner, address _resolver) public Owned(_owner) MixinSystemSettings(_resolver) {} /* ========== VIEWS ========== */ function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired(); bytes32[] memory newAddresses = new bytes32[](12); newAddresses[0] = CONTRACT_SYNTHETIX; newAddresses[1] = CONTRACT_EXCHANGER; newAddresses[2] = CONTRACT_EXRATES; newAddresses[3] = CONTRACT_SYNTHETIXSTATE; newAddresses[4] = CONTRACT_FEEPOOL; newAddresses[5] = CONTRACT_DELEGATEAPPROVALS; newAddresses[6] = CONTRACT_REWARDESCROW_V2; newAddresses[7] = CONTRACT_SYNTHETIXESCROW; newAddresses[8] = CONTRACT_LIQUIDATIONS; newAddresses[9] = CONTRACT_DEBTCACHE; newAddresses[10] = CONTRACT_COLLATERALMANAGER; newAddresses[11] = CONTRACT_SYNTHREDEEMER; return combineArrays(existingAddresses, newAddresses); } function synthetix() internal view returns (ISynthetix) { return ISynthetix(requireAndGetAddress(CONTRACT_SYNTHETIX)); } function exchanger() internal view returns (IExchanger) { return IExchanger(requireAndGetAddress(CONTRACT_EXCHANGER)); } function exchangeRates() internal view returns (IExchangeRates) { return IExchangeRates(requireAndGetAddress(CONTRACT_EXRATES)); } function synthetixState() internal view returns (ISynthetixState) { return ISynthetixState(requireAndGetAddress(CONTRACT_SYNTHETIXSTATE)); } function feePool() internal view returns (IFeePool) { return IFeePool(requireAndGetAddress(CONTRACT_FEEPOOL)); } function liquidations() internal view returns (ILiquidations) { return ILiquidations(requireAndGetAddress(CONTRACT_LIQUIDATIONS)); } function delegateApprovals() internal view returns (IDelegateApprovals) { return IDelegateApprovals(requireAndGetAddress(CONTRACT_DELEGATEAPPROVALS)); } function collateralManager() internal view returns (ICollateralManager) { return ICollateralManager(requireAndGetAddress(CONTRACT_COLLATERALMANAGER)); } function rewardEscrowV2() internal view returns (IRewardEscrowV2) { return IRewardEscrowV2(requireAndGetAddress(CONTRACT_REWARDESCROW_V2)); } function synthetixEscrow() internal view returns (IHasBalance) { return IHasBalance(requireAndGetAddress(CONTRACT_SYNTHETIXESCROW)); } function debtCache() internal view returns (IIssuerInternalDebtCache) { return IIssuerInternalDebtCache(requireAndGetAddress(CONTRACT_DEBTCACHE)); } function synthRedeemer() internal view returns (ISynthRedeemer) { return ISynthRedeemer(requireAndGetAddress(CONTRACT_SYNTHREDEEMER)); } function issuanceRatio() external view returns (uint) { return getIssuanceRatio(); } function _availableCurrencyKeysWithOptionalSNX(bool withSNX) internal view returns (bytes32[] memory) { bytes32[] memory currencyKeys = new bytes32[](availableSynths.length + (withSNX ? 1 : 0)); for (uint i = 0; i < availableSynths.length; i++) { currencyKeys[i] = synthsByAddress[address(availableSynths[i])]; } if (withSNX) { currencyKeys[availableSynths.length] = SNX; } return currencyKeys; } // Returns the total value of the debt pool in currency specified by `currencyKey`. // To return only the SNX-backed debt, set `excludeCollateral` to true. function _totalIssuedSynths(bytes32 currencyKey, bool excludeCollateral) internal view returns (uint totalIssued, bool anyRateIsInvalid) { (uint debt, , bool cacheIsInvalid, bool cacheIsStale) = debtCache().cacheInfo(); anyRateIsInvalid = cacheIsInvalid || cacheIsStale; IExchangeRates exRates = exchangeRates(); // Add total issued synths from non snx collateral back into the total if not excluded if (!excludeCollateral) { (uint nonSnxDebt, bool invalid) = debtCache().totalNonSnxBackedDebt(); debt = debt.add(nonSnxDebt); anyRateIsInvalid = anyRateIsInvalid || invalid; } if (currencyKey == sUSD) { return (debt, anyRateIsInvalid); } (uint currencyRate, bool currencyRateInvalid) = exRates.rateAndInvalid(currencyKey); return (debt.divideDecimalRound(currencyRate), anyRateIsInvalid || currencyRateInvalid); } function _debtBalanceOfAndTotalDebt(address _issuer, bytes32 currencyKey) internal view returns ( uint debtBalance, uint totalSystemValue, bool anyRateIsInvalid ) { ISynthetixState state = synthetixState(); // What was their initial debt ownership? (uint initialDebtOwnership, uint debtEntryIndex) = state.issuanceData(_issuer); // What's the total value of the system excluding ETH backed synths in their requested currency? (totalSystemValue, anyRateIsInvalid) = _totalIssuedSynths(currencyKey, true); // If it's zero, they haven't issued, and they have no debt. // Note: it's more gas intensive to put this check here rather than before _totalIssuedSynths // if they have 0 SNX, but it's a necessary trade-off if (initialDebtOwnership == 0) return (0, totalSystemValue, anyRateIsInvalid); // Figure out the global debt percentage delta from when they entered the system. // This is a high precision integer of 27 (1e27) decimals. uint currentDebtOwnership = state .lastDebtLedgerEntry() .divideDecimalRoundPrecise(state.debtLedger(debtEntryIndex)) .multiplyDecimalRoundPrecise(initialDebtOwnership); // Their debt balance is their portion of the total system value. uint highPrecisionBalance = totalSystemValue.decimalToPreciseDecimal().multiplyDecimalRoundPrecise(currentDebtOwnership); // Convert back into 18 decimals (1e18) debtBalance = highPrecisionBalance.preciseDecimalToDecimal(); } function _canBurnSynths(address account) internal view returns (bool) { return now >= _lastIssueEvent(account).add(getMinimumStakeTime()); } function _lastIssueEvent(address account) internal view returns (uint) { // Get the timestamp of the last issue this account made return flexibleStorage().getUIntValue(CONTRACT_NAME, keccak256(abi.encodePacked(LAST_ISSUE_EVENT, account))); } function _remainingIssuableSynths(address _issuer) internal view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt, bool anyRateIsInvalid ) { (alreadyIssued, totalSystemDebt, anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_issuer, sUSD); (uint issuable, bool isInvalid) = _maxIssuableSynths(_issuer); maxIssuable = issuable; anyRateIsInvalid = anyRateIsInvalid || isInvalid; if (alreadyIssued >= maxIssuable) { maxIssuable = 0; } else { maxIssuable = maxIssuable.sub(alreadyIssued); } } function _snxToUSD(uint amount, uint snxRate) internal pure returns (uint) { return amount.multiplyDecimalRound(snxRate); } function _usdToSnx(uint amount, uint snxRate) internal pure returns (uint) { return amount.divideDecimalRound(snxRate); } function _maxIssuableSynths(address _issuer) internal view returns (uint, bool) { // What is the value of their SNX balance in sUSD (uint snxRate, bool isInvalid) = exchangeRates().rateAndInvalid(SNX); uint destinationValue = _snxToUSD(_collateral(_issuer), snxRate); // They're allowed to issue up to issuanceRatio of that value return (destinationValue.multiplyDecimal(getIssuanceRatio()), isInvalid); } function _collateralisationRatio(address _issuer) internal view returns (uint, bool) { uint totalOwnedSynthetix = _collateral(_issuer); (uint debtBalance, , bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(_issuer, SNX); // it's more gas intensive to put this check here if they have 0 SNX, but it complies with the interface if (totalOwnedSynthetix == 0) return (0, anyRateIsInvalid); return (debtBalance.divideDecimalRound(totalOwnedSynthetix), anyRateIsInvalid); } function _collateral(address account) internal view returns (uint) { uint balance = IERC20(address(synthetix())).balanceOf(account); if (address(synthetixEscrow()) != address(0)) { balance = balance.add(synthetixEscrow().balanceOf(account)); } if (address(rewardEscrowV2()) != address(0)) { balance = balance.add(rewardEscrowV2().balanceOf(account)); } return balance; } function minimumStakeTime() external view returns (uint) { return getMinimumStakeTime(); } function canBurnSynths(address account) external view returns (bool) { return _canBurnSynths(account); } function availableCurrencyKeys() external view returns (bytes32[] memory) { return _availableCurrencyKeysWithOptionalSNX(false); } function availableSynthCount() external view returns (uint) { return availableSynths.length; } function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid) { (, anyRateInvalid) = exchangeRates().ratesAndInvalidForCurrencies(_availableCurrencyKeysWithOptionalSNX(true)); } function totalIssuedSynths(bytes32 currencyKey, bool excludeOtherCollateral) external view returns (uint totalIssued) { (totalIssued, ) = _totalIssuedSynths(currencyKey, excludeOtherCollateral); } function lastIssueEvent(address account) external view returns (uint) { return _lastIssueEvent(account); } function collateralisationRatio(address _issuer) external view returns (uint cratio) { (cratio, ) = _collateralisationRatio(_issuer); } function collateralisationRatioAndAnyRatesInvalid(address _issuer) external view returns (uint cratio, bool anyRateIsInvalid) { return _collateralisationRatio(_issuer); } function collateral(address account) external view returns (uint) { return _collateral(account); } function debtBalanceOf(address _issuer, bytes32 currencyKey) external view returns (uint debtBalance) { ISynthetixState state = synthetixState(); // What was their initial debt ownership? (uint initialDebtOwnership, ) = state.issuanceData(_issuer); // If it's zero, they haven't issued, and they have no debt. if (initialDebtOwnership == 0) return 0; (debtBalance, , ) = _debtBalanceOfAndTotalDebt(_issuer, currencyKey); } function remainingIssuableSynths(address _issuer) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ) { (maxIssuable, alreadyIssued, totalSystemDebt, ) = _remainingIssuableSynths(_issuer); } function maxIssuableSynths(address _issuer) external view returns (uint) { (uint maxIssuable, ) = _maxIssuableSynths(_issuer); return maxIssuable; } function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance) external view returns (uint transferable, bool anyRateIsInvalid) { // How many SNX do they have, excluding escrow? // Note: We're excluding escrow here because we're interested in their transferable amount // and escrowed SNX are not transferable. // How many of those will be locked by the amount they've issued? // Assuming issuance ratio is 20%, then issuing 20 SNX of value would require // 100 SNX to be locked in their wallet to maintain their collateralisation ratio // The locked synthetix value can exceed their balance. uint debtBalance; (debtBalance, , anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(account, SNX); uint lockedSynthetixValue = debtBalance.divideDecimalRound(getIssuanceRatio()); // If we exceed the balance, no SNX are transferable, otherwise the difference is. if (lockedSynthetixValue >= balance) { transferable = 0; } else { transferable = balance.sub(lockedSynthetixValue); } } function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory) { uint numKeys = currencyKeys.length; ISynth[] memory addresses = new ISynth[](numKeys); for (uint i = 0; i < numKeys; i++) { addresses[i] = synths[currencyKeys[i]]; } return addresses; } /* ========== MUTATIVE FUNCTIONS ========== */ function _addSynth(ISynth synth) internal { bytes32 currencyKey = synth.currencyKey(); require(synths[currencyKey] == ISynth(0), "Synth exists"); require(synthsByAddress[address(synth)] == bytes32(0), "Synth address already exists"); availableSynths.push(synth); synths[currencyKey] = synth; synthsByAddress[address(synth)] = currencyKey; emit SynthAdded(currencyKey, address(synth)); } function addSynth(ISynth synth) external onlyOwner { _addSynth(synth); // Invalidate the cache to force a snapshot to be recomputed. If a synth were to be added // back to the system and it still somehow had cached debt, this would force the value to be // updated. debtCache().updateDebtCacheValidity(true); } function addSynths(ISynth[] calldata synthsToAdd) external onlyOwner { uint numSynths = synthsToAdd.length; for (uint i = 0; i < numSynths; i++) { _addSynth(synthsToAdd[i]); } // Invalidate the cache to force a snapshot to be recomputed. debtCache().updateDebtCacheValidity(true); } function _removeSynth(bytes32 currencyKey) internal { address synthToRemove = address(synths[currencyKey]); require(synthToRemove != address(0), "Synth does not exist"); require(currencyKey != sUSD, "Cannot remove synth"); uint synthSupply = IERC20(synthToRemove).totalSupply(); if (synthSupply > 0) { (uint amountOfsUSD, uint rateToRedeem, ) = exchangeRates().effectiveValueAndRates(currencyKey, synthSupply, "sUSD"); require(rateToRedeem > 0, "Cannot remove synth to redeem without rate"); ISynthRedeemer _synthRedeemer = synthRedeemer(); synths[sUSD].issue(address(_synthRedeemer), amountOfsUSD); // ensure the debt cache is aware of the new sUSD issued debtCache().updateCachedsUSDDebt(SafeCast.toInt256(amountOfsUSD)); _synthRedeemer.deprecate(IERC20(address(Proxyable(address(synthToRemove)).proxy())), rateToRedeem); } // Remove the synth from the availableSynths array. for (uint i = 0; i < availableSynths.length; i++) { if (address(availableSynths[i]) == synthToRemove) { delete availableSynths[i]; // Copy the last synth into the place of the one we just deleted // If there's only one synth, this is synths[0] = synths[0]. // If we're deleting the last one, it's also a NOOP in the same way. availableSynths[i] = availableSynths[availableSynths.length - 1]; // Decrease the size of the array by one. availableSynths.length--; break; } } // And remove it from the synths mapping delete synthsByAddress[synthToRemove]; delete synths[currencyKey]; emit SynthRemoved(currencyKey, synthToRemove); } function removeSynth(bytes32 currencyKey) external onlyOwner { // Remove its contribution from the debt pool snapshot, and // invalidate the cache to force a new snapshot. IIssuerInternalDebtCache cache = debtCache(); cache.updateCachedSynthDebtWithRate(currencyKey, 0); cache.updateDebtCacheValidity(true); _removeSynth(currencyKey); } function removeSynths(bytes32[] calldata currencyKeys) external onlyOwner { uint numKeys = currencyKeys.length; // Remove their contributions from the debt pool snapshot, and // invalidate the cache to force a new snapshot. IIssuerInternalDebtCache cache = debtCache(); uint[] memory zeroRates = new uint[](numKeys); cache.updateCachedSynthDebtsWithRates(currencyKeys, zeroRates); cache.updateDebtCacheValidity(true); for (uint i = 0; i < numKeys; i++) { _removeSynth(currencyKeys[i]); } } function issueSynths(address from, uint amount) external onlySynthetix { _issueSynths(from, amount, false); } function issueMaxSynths(address from) external onlySynthetix { _issueSynths(from, 0, true); } function issueSynthsOnBehalf( address issueForAddress, address from, uint amount ) external onlySynthetix { _requireCanIssueOnBehalf(issueForAddress, from); _issueSynths(issueForAddress, amount, false); } function issueMaxSynthsOnBehalf(address issueForAddress, address from) external onlySynthetix { _requireCanIssueOnBehalf(issueForAddress, from); _issueSynths(issueForAddress, 0, true); } function burnSynths(address from, uint amount) external onlySynthetix { _voluntaryBurnSynths(from, amount, false); } function burnSynthsOnBehalf( address burnForAddress, address from, uint amount ) external onlySynthetix { _requireCanBurnOnBehalf(burnForAddress, from); _voluntaryBurnSynths(burnForAddress, amount, false); } function burnSynthsToTarget(address from) external onlySynthetix { _voluntaryBurnSynths(from, 0, true); } function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external onlySynthetix { _requireCanBurnOnBehalf(burnForAddress, from); _voluntaryBurnSynths(burnForAddress, 0, true); } function burnForRedemption( address deprecatedSynthProxy, address account, uint balance ) external onlySynthRedeemer { ISynth(IProxy(deprecatedSynthProxy).target()).burn(account, balance); } function liquidateDelinquentAccount( address account, uint susdAmount, address liquidator ) external onlySynthetix returns (uint totalRedeemed, uint amountToLiquidate) { // Ensure waitingPeriod and sUSD balance is settled as burning impacts the size of debt pool require(!exchanger().hasWaitingPeriodOrSettlementOwing(liquidator, sUSD), "sUSD needs to be settled"); // Check account is liquidation open require(liquidations().isOpenForLiquidation(account), "Account not open for liquidation"); // require liquidator has enough sUSD require(IERC20(address(synths[sUSD])).balanceOf(liquidator) >= susdAmount, "Not enough sUSD"); uint liquidationPenalty = liquidations().liquidationPenalty(); // What is their debt in sUSD? (uint debtBalance, uint totalDebtIssued, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(account, sUSD); (uint snxRate, bool snxRateInvalid) = exchangeRates().rateAndInvalid(SNX); _requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid); uint collateralForAccount = _collateral(account); uint amountToFixRatio = liquidations().calculateAmountToFixCollateral(debtBalance, _snxToUSD(collateralForAccount, snxRate)); // Cap amount to liquidate to repair collateral ratio based on issuance ratio amountToLiquidate = amountToFixRatio < susdAmount ? amountToFixRatio : susdAmount; // what's the equivalent amount of snx for the amountToLiquidate? uint snxRedeemed = _usdToSnx(amountToLiquidate, snxRate); // Add penalty totalRedeemed = snxRedeemed.multiplyDecimal(SafeDecimalMath.unit().add(liquidationPenalty)); // if total SNX to redeem is greater than account's collateral // account is under collateralised, liquidate all collateral and reduce sUSD to burn if (totalRedeemed > collateralForAccount) { // set totalRedeemed to all transferable collateral totalRedeemed = collateralForAccount; // whats the equivalent sUSD to burn for all collateral less penalty amountToLiquidate = _snxToUSD( collateralForAccount.divideDecimal(SafeDecimalMath.unit().add(liquidationPenalty)), snxRate ); } // burn sUSD from messageSender (liquidator) and reduce account's debt _burnSynths(account, liquidator, amountToLiquidate, debtBalance, totalDebtIssued); // Remove liquidation flag if amount liquidated fixes ratio if (amountToLiquidate == amountToFixRatio) { // Remove liquidation liquidations().removeAccountInLiquidation(account); } } /* ========== INTERNAL FUNCTIONS ========== */ function _requireRatesNotInvalid(bool anyRateIsInvalid) internal pure { require(!anyRateIsInvalid, "A synth or SNX rate is invalid"); } function _requireCanIssueOnBehalf(address issueForAddress, address from) internal view { require(delegateApprovals().canIssueFor(issueForAddress, from), "Not approved to act on behalf"); } function _requireCanBurnOnBehalf(address burnForAddress, address from) internal view { require(delegateApprovals().canBurnFor(burnForAddress, from), "Not approved to act on behalf"); } function _issueSynths( address from, uint amount, bool issueMax ) internal { (uint maxIssuable, uint existingDebt, uint totalSystemDebt, bool anyRateIsInvalid) = _remainingIssuableSynths(from); _requireRatesNotInvalid(anyRateIsInvalid); if (!issueMax) { require(amount <= maxIssuable, "Amount too large"); } else { amount = maxIssuable; } // Keep track of the debt they're about to create _addToDebtRegister(from, amount, existingDebt, totalSystemDebt); // record issue timestamp _setLastIssueEvent(from); // Create their synths synths[sUSD].issue(from, amount); // Account for the issued debt in the cache debtCache().updateCachedsUSDDebt(SafeCast.toInt256(amount)); // Store their locked SNX amount to determine their fee % for the period _appendAccountIssuanceRecord(from); } function _burnSynths( address debtAccount, address burnAccount, uint amount, uint existingDebt, uint totalDebtIssued ) internal returns (uint amountBurnt) { // liquidation requires sUSD to be already settled / not in waiting period // If they're trying to burn more debt than they actually owe, rather than fail the transaction, let's just // clear their debt and leave them be. amountBurnt = existingDebt < amount ? existingDebt : amount; // Remove liquidated debt from the ledger _removeFromDebtRegister(debtAccount, amountBurnt, existingDebt, totalDebtIssued); // synth.burn does a safe subtraction on balance (so it will revert if there are not enough synths). synths[sUSD].burn(burnAccount, amountBurnt); // Account for the burnt debt in the cache. debtCache().updateCachedsUSDDebt(-SafeCast.toInt256(amountBurnt)); // Store their debtRatio against a fee period to determine their fee/rewards % for the period _appendAccountIssuanceRecord(debtAccount); } // If burning to target, `amount` is ignored, and the correct quantity of sUSD is burnt to reach the target // c-ratio, allowing fees to be claimed. In this case, pending settlements will be skipped as the user // will still have debt remaining after reaching their target. function _voluntaryBurnSynths( address from, uint amount, bool burnToTarget ) internal { if (!burnToTarget) { // If not burning to target, then burning requires that the minimum stake time has elapsed. require(_canBurnSynths(from), "Minimum stake time not reached"); // First settle anything pending into sUSD as burning or issuing impacts the size of the debt pool (, uint refunded, uint numEntriesSettled) = exchanger().settle(from, sUSD); if (numEntriesSettled > 0) { amount = exchanger().calculateAmountAfterSettlement(from, sUSD, amount, refunded); } } (uint existingDebt, uint totalSystemValue, bool anyRateIsInvalid) = _debtBalanceOfAndTotalDebt(from, sUSD); (uint maxIssuableSynthsForAccount, bool snxRateInvalid) = _maxIssuableSynths(from); _requireRatesNotInvalid(anyRateIsInvalid || snxRateInvalid); require(existingDebt > 0, "No debt to forgive"); if (burnToTarget) { amount = existingDebt.sub(maxIssuableSynthsForAccount); } uint amountBurnt = _burnSynths(from, from, amount, existingDebt, totalSystemValue); // Check and remove liquidation if existingDebt after burning is <= maxIssuableSynths // Issuance ratio is fixed so should remove any liquidations if (existingDebt.sub(amountBurnt) <= maxIssuableSynthsForAccount) { liquidations().removeAccountInLiquidation(from); } } function _setLastIssueEvent(address account) internal { // Set the timestamp of the last issueSynths flexibleStorage().setUIntValue( CONTRACT_NAME, keccak256(abi.encodePacked(LAST_ISSUE_EVENT, account)), block.timestamp ); } function _appendAccountIssuanceRecord(address from) internal { uint initialDebtOwnership; uint debtEntryIndex; (initialDebtOwnership, debtEntryIndex) = synthetixState().issuanceData(from); feePool().appendAccountIssuanceRecord(from, initialDebtOwnership, debtEntryIndex); } function _addToDebtRegister( address from, uint amount, uint existingDebt, uint totalDebtIssued ) internal { ISynthetixState state = synthetixState(); // What will the new total be including the new value? uint newTotalDebtIssued = amount.add(totalDebtIssued); // What is their percentage (as a high precision int) of the total debt? uint debtPercentage = amount.divideDecimalRoundPrecise(newTotalDebtIssued); // And what effect does this percentage change have on the global debt holding of other issuers? // The delta specifically needs to not take into account any existing debt as it's already // accounted for in the delta from when they issued previously. // The delta is a high precision integer. uint delta = SafeDecimalMath.preciseUnit().sub(debtPercentage); // And what does their debt ownership look like including this previous stake? if (existingDebt > 0) { debtPercentage = amount.add(existingDebt).divideDecimalRoundPrecise(newTotalDebtIssued); } else { // If they have no debt, they're a new issuer; record this. state.incrementTotalIssuerCount(); } // Save the debt entry parameters state.setCurrentIssuanceData(from, debtPercentage); // And if we're the first, push 1 as there was no effect to any other holders, otherwise push // the change for the rest of the debt holders. The debt ledger holds high precision integers. if (state.debtLedgerLength() > 0) { state.appendDebtLedgerValue(state.lastDebtLedgerEntry().multiplyDecimalRoundPrecise(delta)); } else { state.appendDebtLedgerValue(SafeDecimalMath.preciseUnit()); } } function _removeFromDebtRegister( address from, uint debtToRemove, uint existingDebt, uint totalDebtIssued ) internal { ISynthetixState state = synthetixState(); // What will the new total after taking out the withdrawn amount uint newTotalDebtIssued = totalDebtIssued.sub(debtToRemove); uint delta = 0; // What will the debt delta be if there is any debt left? // Set delta to 0 if no more debt left in system after user if (newTotalDebtIssued > 0) { // What is the percentage of the withdrawn debt (as a high precision int) of the total debt after? uint debtPercentage = debtToRemove.divideDecimalRoundPrecise(newTotalDebtIssued); // And what effect does this percentage change have on the global debt holding of other issuers? // The delta specifically needs to not take into account any existing debt as it's already // accounted for in the delta from when they issued previously. delta = SafeDecimalMath.preciseUnit().add(debtPercentage); } // Are they exiting the system, or are they just decreasing their debt position? if (debtToRemove == existingDebt) { state.setCurrentIssuanceData(from, 0); state.decrementTotalIssuerCount(); } else { // What percentage of the debt will they be left with? uint newDebt = existingDebt.sub(debtToRemove); uint newDebtPercentage = newDebt.divideDecimalRoundPrecise(newTotalDebtIssued); // Store the debt percentage and debt ledger as high precision integers state.setCurrentIssuanceData(from, newDebtPercentage); } // Update our cumulative ledger. This is also a high precision integer. state.appendDebtLedgerValue(state.lastDebtLedgerEntry().multiplyDecimalRoundPrecise(delta)); } /* ========== MODIFIERS ========== */ function _onlySynthetix() internal view { require(msg.sender == address(synthetix()), "Issuer: Only the synthetix contract can perform this action"); } modifier onlySynthetix() { _onlySynthetix(); // Use an internal function to save code size. _; } function _onlySynthRedeemer() internal view { require(msg.sender == address(synthRedeemer()), "Issuer: Only the SynthRedeemer contract can perform this action"); } modifier onlySynthRedeemer() { _onlySynthRedeemer(); _; } /* ========== EVENTS ========== */ event SynthAdded(bytes32 currencyKey, address synth); event SynthRemoved(bytes32 currencyKey, address synth); }
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":false,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"CacheUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"synth","type":"address"}],"name":"SynthAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"synth","type":"address"}],"name":"SynthRemoved","type":"event"},{"constant":true,"inputs":[],"name":"CONTRACT_NAME","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ISynth","name":"synth","type":"address"}],"name":"addSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ISynth[]","name":"synthsToAdd","type":"address[]"}],"name":"addSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"anySynthOrSNXRateIsInvalid","outputs":[{"internalType":"bool","name":"anyRateInvalid","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableCurrencyKeys","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"availableSynthCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"availableSynths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"deprecatedSynthProxy","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"burnForRedemption","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"burnForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"burnSynthsToTarget","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"burnForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"}],"name":"burnSynthsToTargetOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"canBurnSynths","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"collateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"collateralisationRatio","outputs":[{"internalType":"uint256","name":"cratio","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"collateralisationRatioAndAnyRatesInvalid","outputs":[{"internalType":"uint256","name":"cratio","type":"uint256"},{"internalType":"bool","name":"anyRateIsInvalid","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"},{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"debtBalanceOf","outputs":[{"internalType":"uint256","name":"debtBalance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32[]","name":"currencyKeys","type":"bytes32[]"}],"name":"getSynths","outputs":[{"internalType":"contract ISynth[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isResolverCached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"issuanceRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"}],"name":"issueMaxSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"issueForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"}],"name":"issueMaxSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issueSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"issueForAddress","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"issueSynthsOnBehalf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"lastIssueEvent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"susdAmount","type":"uint256"},{"internalType":"address","name":"liquidator","type":"address"}],"name":"liquidateDelinquentAccount","outputs":[{"internalType":"uint256","name":"totalRedeemed","type":"uint256"},{"internalType":"uint256","name":"amountToLiquidate","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"maxIssuableSynths","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minimumStakeTime","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":false,"inputs":[],"name":"rebuildCache","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_issuer","type":"address"}],"name":"remainingIssuableSynths","outputs":[{"internalType":"uint256","name":"maxIssuable","type":"uint256"},{"internalType":"uint256","name":"alreadyIssued","type":"uint256"},{"internalType":"uint256","name":"totalSystemDebt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"removeSynth","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bytes32[]","name":"currencyKeys","type":"bytes32[]"}],"name":"removeSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"resolver","outputs":[{"internalType":"contract AddressResolver","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolverAddressesRequired","outputs":[{"internalType":"bytes32[]","name":"addresses","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"synths","outputs":[{"internalType":"contract ISynth","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"synthsByAddress","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"bool","name":"excludeOtherCollateral","type":"bool"}],"name":"totalIssuedSynths","outputs":[{"internalType":"uint256","name":"totalIssued","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"transferableSynthetixAndAnyRateIsInvalid","outputs":[{"internalType":"uint256","name":"transferable","type":"uint256"},{"internalType":"bool","name":"anyRateIsInvalid","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162004f7d38038062004f7d8339810160408190526200003491620000fc565b8080836001600160a01b038116620000695760405162461bcd60e51b81526004016200006090620001b8565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0383161781556040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91620000b691849062000192565b60405180910390a150600280546001600160a01b0319166001600160a01b03929092169190911790555062000213915050565b8051620000f681620001f9565b92915050565b600080604083850312156200011057600080fd5b60006200011e8585620000e9565b92505060206200013185828601620000e9565b9150509250929050565b6200014681620001e5565b82525050565b6200014681620001d3565b600062000166601983620001ca565b7f4f776e657220616464726573732063616e6e6f74206265203000000000000000815260200192915050565b60408101620001a282856200013b565b620001b160208301846200014c565b9392505050565b60208082528101620000f68162000157565b90815260200190565b60006001600160a01b038216620000f6565b6000620000f6826000620000f682620001d3565b6200020481620001d3565b81146200021057600080fd5b50565b614d5a80620002236000396000f3fe608060405234801561001057600080fd5b506004361061025e5760003560e01c80637418536011610146578063a63c4df4116100c3578063c897713211610087578063c89771321461050f578063d37c4d8b14610522578063d686c06c14610535578063dbf6334014610548578063dd3d2b2e14610550578063fd864ccf146105635761025e565b8063a63c4df4146104ad578063ae3bbbbb146104ce578063b06e8c65146104e1578063b410a034146104f4578063bff4fdfc146104fc5761025e565b8063899ffef41161010a578063899ffef4146104645780638da5cb5b1461046c5780639a5154b414610474578063a311c7c214610487578063a5fdc5de1461049a5761025e565b8063741853601461041b57806379ba5097146104235780637b1001b71461042b578063835e119c1461043e578063849cf588146104515761025e565b806332608039116101df5780634e99bda9116101a35780634e99bda9146103ad57806353a47bb7146103b5578063614d08f8146103ca5780636bed0415146103d25780637168d2c2146103f357806372cb051f146104065761025e565b806332608039146103415780633b6afe401461035457806344ec6b621461037457806347a9b6db14610387578063497d704a1461039a5761025e565b80631627540c116102265780631627540c146102eb57806316b2213f146102fe578063242df9e1146103115780632af64bd3146103195780632b3f41aa1461032e5761025e565b8063042e06881461026357806304f3bcec1461027857806305b3c1c9146102965780630b887dae146102b65780631137aedf146102c9575b600080fd5b610276610271366004613df3565b610576565b005b61028061058e565b60405161028d9190614a31565b60405180910390f35b6102a96102a4366004613d28565b61059d565b60405161028d91906149a4565b6102766102c4366004613f0d565b6105b1565b6102dc6102d7366004613d28565b61068f565b60405161028d939291906149ce565b6102766102f9366004613d28565b6106ab565b6102a961030c366004613d28565b610709565b6102a961071b565b61032161072b565b60405161028d9190614996565b61027661033c366004613d6c565b610842565b61028061034f366004613f0d565b610861565b610367610362366004613e66565b61087c565b60405161028d9190614985565b610276610382366004613da6565b61092a565b610276610395366004613e66565b61094d565b6102766103a8366004613d28565b6109fe565b610321610a16565b6103bd610aa8565b60405161028d9190614892565b6102a9610ab7565b6103e56103e0366004613df3565b610ac4565b60405161028d929190614bbe565b610276610401366004613e66565b610b28565b61040e610c65565b60405161028d9190614974565b610276610c71565b610276610dc3565b6102a9610439366004613f49565b610e68565b61028061044c366004613f0d565b610e74565b61027661045f366004613f79565b610e9b565b61040e610f15565b6103bd61114b565b610276610482366004613da6565b61115a565b6102a9610495366004613d28565b611178565b6102a96104a8366004613d28565b61118a565b6104c06104bb366004613e23565b611195565b60405161028d9291906149c0565b6103e56104dc366004613d28565b611733565b6102766104ef366004613df3565b611749565b6102a961175d565b61032161050a366004613d28565b611767565b61027661051d366004613d28565b611772565b6102a9610530366004613df3565b611787565b610276610543366004613da6565b61183a565b6102a96118e0565b6102a961055e366004613d28565b6118e6565b610276610571366004613d6c565b6118f1565b61057e611910565b61058a8282600061194a565b5050565b6002546001600160a01b031681565b6000806105a983611aa4565b509392505050565b6105b9611b63565b60006105c3611b8d565b604051636b42ba1d60e11b81529091506001600160a01b0382169063d685743a906105f59085906000906004016149dc565b600060405180830381600087803b15801561060f57600080fd5b505af1158015610623573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03841692506304bd11e5915061065490600190600401614996565b600060405180830381600087803b15801561066e57600080fd5b505af1158015610682573d6000803e3d6000fd5b5050505061058a82611ba4565b600080600061069d84612052565b509196909550909350915050565b6106b3611b63565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906106fe908390614892565b60405180910390a150565b60066020526000908152604090205481565b60006107256120ba565b90505b90565b60006060610737610f15565b905060005b815181101561083957600082828151811061075357fe5b602090810291909101810151600081815260039092526040918290205460025492516321f8a72160e01b81529193506001600160a01b039081169216906321f8a721906107a49085906004016149a4565b60206040518083038186803b1580156107bc57600080fd5b505afa1580156107d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107f49190810190613d4e565b6001600160a01b031614158061081f57506000818152600360205260409020546001600160a01b0316155b156108305760009350505050610728565b5060010161073c565b50600191505090565b61084a611910565b6108548282612165565b61058a8260006001612206565b6005602052600090815260409020546001600160a01b031681565b604080518281526020808402820101909152606090829082908280156108ac578160200160208202803883390190505b50905060005b8281101561091f57600560008787848181106108ca57fe5b90506020020135815260200190815260200160002060009054906101000a90046001600160a01b03168282815181106108ff57fe5b6001600160a01b03909216602092830291909101909101526001016108b2565b509150505b92915050565b610932611910565b61093c8383612470565b6109488382600061194a565b505050565b610955611b63565b8060005b818110156109925761098a84848381811061097057fe5b90506020020160206109859190810190613f79565b6124a5565b600101610959565b5061099b611b8d565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b81526004016109c79190614996565b600060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b50505050505050565b610a06611910565b610a138160006001612206565b50565b6000610a20612636565b6001600160a01b031663c8e5bbd5610a386001612651565b6040518263ffffffff1660e01b8152600401610a549190614974565b60006040518083038186803b158015610a6c57600080fd5b505afa158015610a80573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109249190810190613ea8565b6001546001600160a01b031681565b6524b9b9bab2b960d11b81565b6000806000610ad985620a69cb60eb1b61272d565b935090915060009050610afa610aed61291a565b839063ffffffff61297216565b9050848110610b0c5760009350610b1f565b610b1c858263ffffffff61298e16565b93505b50509250929050565b610b30611b63565b806000610b3b611b8d565b9050606082604051908082528060200260200182016040528015610b69578160200160208202803883390190505b506040516305ece36d60e21b81529091506001600160a01b038316906317b38db490610b9d9088908890869060040161494e565b600060405180830381600087803b158015610bb757600080fd5b505af1158015610bcb573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03851692506304bd11e59150610bfc90600190600401614996565b600060405180830381600087803b158015610c1657600080fd5b505af1158015610c2a573d6000803e3d6000fd5b506000925050505b83811015610c5d57610c55868683818110610c4957fe5b90506020020135611ba4565b600101610c32565b505050505050565b60606107256000612651565b6060610c7b610f15565b905060005b815181101561058a576000828281518110610c9757fe5b602002602001015190506000600260009054906101000a90046001600160a01b03166001600160a01b031663dacb2d018384604051602001610cd99190614887565b6040516020818303038152906040526040518363ffffffff1660e01b8152600401610d059291906149ea565b60206040518083038186803b158015610d1d57600080fd5b505afa158015610d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d559190810190613d4e565b6000838152600360205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa6890610db190849084906149b2565b60405180910390a15050600101610c80565b6001546001600160a01b03163314610df65760405162461bcd60e51b8152600401610ded90614a5e565b60405180910390fd5b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92610e39926001600160a01b03918216929116906148a0565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60006105a983836129b6565b60048181548110610e8157fe5b6000918252602090912001546001600160a01b0316905081565b610ea3611b63565b610eac816124a5565b610eb4611b8d565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b8152600401610ee09190614996565b600060405180830381600087803b158015610efa57600080fd5b505af1158015610f0e573d6000803e3d6000fd5b5050505050565b606080610f20612bc1565b60408051600c8082526101a08201909252919250606091906020820161018080388339019050509050680a6f2dce8d0cae8d2f60bb1b81600081518110610f6357fe5b6020026020010181815250506822bc31b430b733b2b960b91b81600181518110610f8957fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110610fb357fe5b6020026020010181815250506d53796e746865746978537461746560901b81600381518110610fde57fe5b60200260200101818152505066119959541bdbdb60ca1b8160048151811061100257fe5b6020026020010181815250507044656c6567617465417070726f76616c7360781b8160058151811061103057fe5b6020026020010181815250506d2932bbb0b93222b9b1b937bbab1960911b8160068151811061105b57fe5b6020026020010181815250506e53796e746865746978457363726f7760881b8160078151811061108757fe5b6020026020010181815250506b4c69717569646174696f6e7360a01b816008815181106110b057fe5b6020026020010181815250506844656274436163686560b81b816009815181106110d657fe5b6020026020010181815250507021b7b63630ba32b930b626b0b730b3b2b960791b81600a8151811061110457fe5b6020026020010181815250506c29bcb73a342932b232b2b6b2b960991b81600b8151811061112e57fe5b6020026020010181815250506111448282612c12565b9250505090565b6000546001600160a01b031681565b611162611910565b61116c8383612165565b61094883826000612206565b600061118382612cc7565b5092915050565b600061092482612d21565b6000806111a0611910565b6111a8612e7a565b6001600160a01b031663d6f32e0684631cd554d160e21b6040518363ffffffff1660e01b81526004016111dc9291906148bb565b60206040518083038186803b1580156111f457600080fd5b505afa158015611208573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061122c9190810190613eef565b156112495760405162461bcd60e51b8152600401610ded90614b5e565b611251612e91565b6001600160a01b031663c49e80a6866040518263ffffffff1660e01b815260040161127c9190614892565b60206040518083038186803b15801561129457600080fd5b505afa1580156112a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112cc9190810190613eef565b6112e85760405162461bcd60e51b8152600401610ded90614b7e565b631cd554d160e21b6000526005602052600080516020614cf8833981519152546040516370a0823160e01b815285916001600160a01b0316906370a0823190611335908790600401614892565b60206040518083038186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506113859190810190613f2b565b10156113a35760405162461bcd60e51b8152600401610ded90614b9e565b60006113ad612e91565b6001600160a01b03166323f5589a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156113e557600080fd5b505afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061141d9190810190613f2b565b9050600080600061143589631cd554d160e21b61272d565b925092509250600080611446612636565b6001600160a01b0316630c71cd23620a69cb60eb1b6040518263ffffffff1660e01b815260040161147791906149a4565b604080518083038186803b15801561148e57600080fd5b505afa1580156114a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506114c69190810190613fb5565b915091506114db83806114d65750815b612eab565b60006114e68c612d21565b905060006114f2612e91565b6001600160a01b0316630ac045d58861150b8588612ec9565b6040518363ffffffff1660e01b81526004016115289291906149c0565b60206040518083038186803b15801561154057600080fd5b505afa158015611554573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115789190810190613f2b565b90508b8110611587578b611589565b805b985060006115978a86612edb565b90506116356116288a730142f40c25ce1f1177ed131101fa19217396cb8863907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e457600080fd5b505af41580156115f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061161c9190810190613f2b565b9063ffffffff612eed16565b829063ffffffff612f1216565b9a50828b11156116a657829a506116a361169d6116908b730142f40c25ce1f1177ed131101fa19217396cb8863907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e457600080fd5b859063ffffffff612f3c16565b86612ec9565b99505b6116b38e8d8c8b8b612f66565b50818a1415611722576116c4612e91565b6001600160a01b031663974e9e7f8f6040518263ffffffff1660e01b81526004016116ef9190614892565b600060405180830381600087803b15801561170957600080fd5b505af115801561171d573d6000803e3d6000fd5b505050505b505050505050505050935093915050565b60008061173f83612cc7565b915091505b915091565b611751611910565b61058a82826000612206565b600061072561291a565b600061092482613088565b61177a611910565b610a13816000600161194a565b6000806117926130a7565b90506000816001600160a01b0316638b3f8088866040518263ffffffff1660e01b81526004016117c29190614892565b604080518083038186803b1580156117d957600080fd5b505afa1580156117ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118119190810190613fd4565b5090508061182457600092505050610924565b61182e858561272d565b50909695505050505050565b6118426130c3565b826001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118b39190810190613d4e565b6001600160a01b0316639dc29fac83836040518363ffffffff1660e01b81526004016109c79291906148bb565b60045490565b6000610924826130fb565b6118f9611910565b6119038282612470565b61058a826000600161194a565b6119186131c4565b6001600160a01b0316336001600160a01b0316146119485760405162461bcd60e51b8152600401610ded90614ade565b565b60008060008061195987612052565b935093509350935061196a81612eab565b84611994578386111561198f5760405162461bcd60e51b8152600401610ded90614aae565b611998565b8395505b6119a4878785856131db565b6119ad876135a8565b631cd554d160e21b6000526005602052600080516020614cf88339815191525460405163219e412d60e21b81526001600160a01b039091169063867904b4906119fc908a908a906004016148bb565b600060405180830381600087803b158015611a1657600080fd5b505af1158015611a2a573d6000803e3d6000fd5b50505050611a36611b8d565b6001600160a01b03166342c7b819611a4d88613621565b6040518263ffffffff1660e01b8152600401611a6991906149a4565b600060405180830381600087803b158015611a8357600080fd5b505af1158015611a97573d6000803e3d6000fd5b505050506109f58761364a565b600080600080611ab2612636565b6001600160a01b0316630c71cd23620a69cb60eb1b6040518263ffffffff1660e01b8152600401611ae391906149a4565b604080518083038186803b158015611afa57600080fd5b505afa158015611b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b329190810190613fb5565b915091506000611b4a611b4487612d21565b84612ec9565b9050611b5761162861291a565b94509092505050915091565b6000546001600160a01b031633146119485760405162461bcd60e51b8152600401610ded90614b1e565b60006107256844656274436163686560b81b61370b565b6000818152600560205260409020546001600160a01b031680611bd95760405162461bcd60e51b8152600401610ded90614afe565b631cd554d160e21b821415611c005760405162461bcd60e51b8152600401610ded90614b4e565b6000816001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c3b57600080fd5b505afa158015611c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c739190810190613f2b565b90508015611ef557600080611c86612636565b6001600160a01b0316638295016a86856040518363ffffffff1660e01b8152600401611cb3929190614a0a565b60606040518083038186803b158015611ccb57600080fd5b505afa158015611cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d039190810190614065565b509150915060008111611d285760405162461bcd60e51b8152600401610ded90614b0e565b6000611d32613768565b631cd554d160e21b6000526005602052600080516020614cf88339815191525460405163219e412d60e21b81529192506001600160a01b03169063867904b490611d8290849087906004016148bb565b600060405180830381600087803b158015611d9c57600080fd5b505af1158015611db0573d6000803e3d6000fd5b50505050611dbc611b8d565b6001600160a01b03166342c7b819611dd385613621565b6040518263ffffffff1660e01b8152600401611def91906149a4565b600060405180830381600087803b158015611e0957600080fd5b505af1158015611e1d573d6000803e3d6000fd5b50505050806001600160a01b0316633a70599c866001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6957600080fd5b505afa158015611e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611ea19190810190613f97565b846040518363ffffffff1660e01b8152600401611ebf929190614a3f565b600060405180830381600087803b158015611ed957600080fd5b505af1158015611eed573d6000803e3d6000fd5b505050505050505b60005b600454811015611fdc57826001600160a01b031660048281548110611f1957fe5b6000918252602090912001546001600160a01b03161415611fd45760048181548110611f4157fe5b600091825260209091200180546001600160a01b0319169055600480546000198101908110611f6c57fe5b600091825260209091200154600480546001600160a01b039092169183908110611f9257fe5b600091825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556004805490611fce906000198301613bd6565b50611fdc565b600101611ef8565b506001600160a01b038216600090815260066020908152604080832083905585835260059091529081902080546001600160a01b0319169055517f6166f5c475cc1cd535c6cdf14a6d5edb811e34117031fc2863392a136eb655d09061204590859085906149b2565b60405180910390a1505050565b60008060008061206985631cd554d160e21b61272d565b9194509250905060008061207c87611aa4565b91509150819550828061208c5750805b925085851061209e57600095506120b1565b6120ae868663ffffffff61298e16565b95505b50509193509193565b60006120c4613783565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6f6d696e696d756d5374616b6554696d6560801b6040518363ffffffff1660e01b81526004016121159291906149c0565b60206040518083038186803b15801561212d57600080fd5b505afa158015612141573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107259190810190613f2b565b61216d6137a0565b6001600160a01b0316637d3f0ba283836040518363ffffffff1660e01b815260040161219a9291906148a0565b60206040518083038186803b1580156121b257600080fd5b505afa1580156121c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121ea9190810190613eef565b61058a5760405162461bcd60e51b8152600401610ded90614a6e565b806123635761221483613088565b6122305760405162461bcd60e51b8152600401610ded90614b8e565b60008061223b612e7a565b6001600160a01b0316631b16802c86631cd554d160e21b6040518363ffffffff1660e01b815260040161226f9291906148bb565b606060405180830381600087803b15801561228957600080fd5b505af115801561229d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506122c19190810190614065565b9093509150508015612360576122d5612e7a565b6001600160a01b0316634c268fc886631cd554d160e21b87866040518563ffffffff1660e01b815260040161230d94939291906148d6565b60206040518083038186803b15801561232557600080fd5b505afa158015612339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061235d9190810190613f2b565b93505b50505b600080600061237986631cd554d160e21b61272d565b92509250925060008061238b88611aa4565b9150915061239f83806114d6575081612eab565b600085116123bf5760405162461bcd60e51b8152600401610ded90614a9e565b85156123d8576123d5858363ffffffff61298e16565b96505b60006123e7898a8a8989612f66565b9050826123fa878363ffffffff61298e16565b1161246557612407612e91565b6001600160a01b031663974e9e7f8a6040518263ffffffff1660e01b81526004016124329190614892565b600060405180830381600087803b15801561244c57600080fd5b505af1158015612460573d6000803e3d6000fd5b505050505b505050505050505050565b6124786137a0565b6001600160a01b0316630487261783836040518363ffffffff1660e01b815260040161219a9291906148a0565b6000816001600160a01b031663dbd06c856040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e057600080fd5b505afa1580156124f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125189190810190613f2b565b6000818152600560205260409020549091506001600160a01b0316156125505760405162461bcd60e51b8152600401610ded90614b6e565b6001600160a01b038216600090815260066020526040902054156125865760405162461bcd60e51b8152600401610ded90614b2e565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0384166001600160a01b03199182168117909255600083815260056020908152604080832080549094168517909355928152600690925290819020829055517f0a2b6ebf143b3e9fcd67e17748ad315174746100c27228468b2c98c302c628849061262a90839085906149b2565b60405180910390a15050565b60006107256c45786368616e6765526174657360981b61370b565b60608082612660576000612663565b60015b60ff1660048054905001604051908082528060200260200182016040528015612696578160200160208202803883390190505b50905060005b6004548110156126fd5760066000600483815481106126b757fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205482518390839081106126ea57fe5b602090810291909101015260010161269c565b508215610924576004548151620a69cb60eb1b918391811061271b57fe5b60200260200101818152505092915050565b60008060008061273b6130a7565b9050600080826001600160a01b0316638b3f8088896040518263ffffffff1660e01b815260040161276c9190614892565b604080518083038186803b15801561278357600080fd5b505afa158015612797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506127bb9190810190613fd4565b915091506127ca8760016129b6565b9095509350816127e1575060009450612913915050565b60006128ef836128e3866001600160a01b03166308d95cd5866040518263ffffffff1660e01b815260040161281691906149a4565b60206040518083038186803b15801561282e57600080fd5b505afa158015612842573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128669190810190613f2b565b876001600160a01b031663463177126040518163ffffffff1660e01b815260040160206040518083038186803b15801561289f57600080fd5b505afa1580156128b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128d79190810190613f2b565b9063ffffffff6137bf16565b9063ffffffff6137d816565b90506000612900826128e3896137f1565b905061290b81613807565b975050505050505b9250925092565b6000612924613783565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6c69737375616e6365526174696f60981b6040518363ffffffff1660e01b81526004016121159291906149c0565b60006129878383670de0b6b3a7640000613829565b9392505050565b6000828211156129b05760405162461bcd60e51b8152600401610ded90614abe565b50900390565b60008060008060006129c6611b8d565b6001600160a01b0316633a900a2e6040518163ffffffff1660e01b815260040160806040518083038186803b1580156129fe57600080fd5b505afa158015612a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612a369190810190614004565b935093505092508180612a465750805b93506000612a52612636565b905086612af857600080612a64611b8d565b6001600160a01b0316632992dba26040518163ffffffff1660e01b8152600401604080518083038186803b158015612a9b57600080fd5b505afa158015612aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612ad39190810190613fb5565b9092509050612ae8868363ffffffff612eed16565b95508680612af35750805b965050505b631cd554d160e21b881415612b135750919350612bba915050565b600080826001600160a01b0316630c71cd238b6040518263ffffffff1660e01b8152600401612b4291906149a4565b604080518083038186803b158015612b5957600080fd5b505afa158015612b6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612b919190810190613fb5565b9092509050612ba6868363ffffffff61297216565b8780612baf5750815b975097505050505050505b9250929050565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b81600081518110612c0357fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015612c42578160200160208202803883390190505b50905060005b8351811015612c8457838181518110612c5d57fe5b6020026020010151828281518110612c7157fe5b6020908102919091010152600101612c48565b5060005b825181101561118357828181518110612c9d57fe5b6020026020010151828286510181518110612cb457fe5b6020908102919091010152600101612c88565b6000806000612cd584612d21565b9050600080612cea86620a69cb60eb1b61272d565b92505091508260001415612d0657600094509250611744915050565b612d16828463ffffffff61297216565b945092505050915091565b600080612d2c6131c4565b6001600160a01b03166370a08231846040518263ffffffff1660e01b8152600401612d579190614892565b60206040518083038186803b158015612d6f57600080fd5b505afa158015612d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612da79190810190613f2b565b90506000612db3613861565b6001600160a01b031614612e5757612e54612dcc613861565b6001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401612df79190614892565b60206040518083038186803b158015612e0f57600080fd5b505afa158015612e23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612e479190810190613f2b565b829063ffffffff612eed16565b90505b6000612e6161387e565b6001600160a01b03161461092457612987612dcc61387e565b60006107256822bc31b430b733b2b960b91b61370b565b60006107256b4c69717569646174696f6e7360a01b61370b565b8015610a135760405162461bcd60e51b8152600401610ded90614aee565b6000612987838363ffffffff61389a16565b6000612987838363ffffffff61297216565b6000828201838110156129875760405162461bcd60e51b8152600401610ded90614a7e565b6000670de0b6b3a7640000612f2d848463ffffffff6138af16565b81612f3457fe5b049392505050565b600061298782612f5a85670de0b6b3a764000063ffffffff6138af16565b9063ffffffff6138e916565b6000838310612f755783612f77565b825b9050612f858682858561391e565b631cd554d160e21b6000526005602052600080516020614cf883398151915254604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90612fd490889085906004016148bb565b600060405180830381600087803b158015612fee57600080fd5b505af1158015613002573d6000803e3d6000fd5b5050505061300e611b8d565b6001600160a01b03166342c7b81961302583613621565b6000036040518263ffffffff1660e01b815260040161304491906149a4565b600060405180830381600087803b15801561305e57600080fd5b505af1158015613072573d6000803e3d6000fd5b5050505061307f8661364a565b95945050505050565b600061309e6130956120ba565b61161c846130fb565b42101592915050565b60006107256d53796e746865746978537461746560901b61370b565b6130cb613768565b6001600160a01b0316336001600160a01b0316146119485760405162461bcd60e51b8152600401610ded90614a8e565b6000613105613783565b6001600160a01b03166323257c2b6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b85604051602001613141929190614841565b604051602081830303815290604052805190602001206040518363ffffffff1660e01b81526004016131749291906149c0565b60206040518083038186803b15801561318c57600080fd5b505afa1580156131a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109249190810190613f2b565b6000610725680a6f2dce8d0cae8d2f60bb1b61370b565b60006131e56130a7565b905060006131f9858463ffffffff612eed16565b9050600061320d868363ffffffff6137bf16565b9050600061329d82730142f40c25ce1f1177ed131101fa19217396cb8863d5e5e6e66040518163ffffffff1660e01b815260040160206040518083038186803b15801561325957600080fd5b505af415801561326d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506132919190810190613f2b565b9063ffffffff61298e16565b905085156132c0576132b9836128d7898963ffffffff612eed16565b9150613314565b836001600160a01b0316631bfba5956040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156132fb57600080fd5b505af115801561330f573d6000803e3d6000fd5b505050505b60405163a764eb4560e01b81526001600160a01b0385169063a764eb4590613342908b9086906004016148bb565b600060405180830381600087803b15801561335c57600080fd5b505af1158015613370573d6000803e3d6000fd5b505050506000846001600160a01b031663cd92eba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156133af57600080fd5b505afa1580156133c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506133e79190810190613f2b565b11156134c457836001600160a01b0316633d31e97b61347183876001600160a01b031663463177126040518163ffffffff1660e01b815260040160206040518083038186803b15801561343957600080fd5b505afa15801561344d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128e39190810190613f2b565b6040518263ffffffff1660e01b815260040161348d91906149a4565b600060405180830381600087803b1580156134a757600080fd5b505af11580156134bb573d6000803e3d6000fd5b5050505061359e565b836001600160a01b0316633d31e97b730142f40c25ce1f1177ed131101fa19217396cb8863d5e5e6e66040518163ffffffff1660e01b815260040160206040518083038186803b15801561351757600080fd5b505af415801561352b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061354f9190810190613f2b565b6040518263ffffffff1660e01b815260040161356b91906149a4565b600060405180830381600087803b15801561358557600080fd5b505af1158015613599573d6000803e3d6000fd5b505050505b5050505050505050565b6135b0613783565b6001600160a01b0316631d5b277f6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b846040516020016135ec929190614841565b60405160208183030381529060405280519060200120426040518463ffffffff1660e01b8152600401610ee0939291906149ce565b6000600160ff1b82106136465760405162461bcd60e51b8152600401610ded90614bae565b5090565b6000806136556130a7565b6001600160a01b0316638b3f8088846040518263ffffffff1660e01b81526004016136809190614892565b604080518083038186803b15801561369757600080fd5b505afa1580156136ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506136cf9190810190613fd4565b90925090506136dc613b96565b6001600160a01b031663866452748484846040518463ffffffff1660e01b81526004016109c793929190614926565b60008181526003602090815260408083205490516001600160a01b03909116918215159161373b91869101614867565b604051602081830303815290604052906111835760405162461bcd60e51b8152600401610ded9190614a4d565b60006107256c29bcb73a342932b232b2b6b2b960991b61370b565b60006107256e466c657869626c6553746f7261676560881b61370b565b60006107257044656c6567617465417070726f76616c7360781b61370b565b600061298783836b033b2e3c9fd0803ce8000000613829565b600061298783836b033b2e3c9fd0803ce8000000613bab565b600061092482633b9aca0063ffffffff6138af16565b60006305f5e10082046005600a82061061381f57600a015b600a900492915050565b60008061384384612f5a87600a870263ffffffff6138af16565b90506005600a825b061061385557600a015b600a9004949350505050565b60006107256e53796e746865746978457363726f7760881b61370b565b60006107256d2932bbb0b93222b9b1b937bbab1960911b61370b565b60006129878383670de0b6b3a7640000613bab565b6000826138be57506000610924565b828202828482816138cb57fe5b04146129875760405162461bcd60e51b8152600401610ded90614b3e565b600080821161390a5760405162461bcd60e51b8152600401610ded90614ace565b600082848161391557fe5b04949350505050565b60006139286130a7565b9050600061393c838663ffffffff61298e16565b9050600081156139a6576000613958878463ffffffff6137bf16565b90506139a281730142f40c25ce1f1177ed131101fa19217396cb8863d5e5e6e66040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e457600080fd5b9150505b84861415613a675760405163a764eb4560e01b81526001600160a01b0384169063a764eb45906139dd908a9060009060040161490b565b600060405180830381600087803b1580156139f757600080fd5b505af1158015613a0b573d6000803e3d6000fd5b50505050826001600160a01b031663ba08f2996040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613a4a57600080fd5b505af1158015613a5e573d6000803e3d6000fd5b50505050613af3565b6000613a79868863ffffffff61298e16565b90506000613a8d828563ffffffff6137bf16565b60405163a764eb4560e01b81529091506001600160a01b0386169063a764eb4590613abe908c9085906004016148bb565b600060405180830381600087803b158015613ad857600080fd5b505af1158015613aec573d6000803e3d6000fd5b5050505050505b826001600160a01b0316633d31e97b613b3f83866001600160a01b031663463177126040518163ffffffff1660e01b815260040160206040518083038186803b15801561343957600080fd5b6040518263ffffffff1660e01b8152600401613b5b91906149a4565b600060405180830381600087803b158015613b7557600080fd5b505af1158015613b89573d6000803e3d6000fd5b5050505050505050505050565b600061072566119959541bdbdb60ca1b61370b565b600080600a8304613bc2868663ffffffff6138af16565b81613bc957fe5b0490506005600a8261384b565b8154818355818111156109485760008381526020902061094891810190830161072891905b808211156136465760008155600101613bfb565b803561092481614cc8565b805161092481614cc8565b60008083601f840112613c3757600080fd5b50813567ffffffffffffffff811115613c4f57600080fd5b602083019150836020820283011115612bba57600080fd5b600082601f830112613c7857600080fd5b8151613c8b613c8682614c00565b614bd9565b91508181835260208401935060208101905083856020840282011115613cb057600080fd5b60005b83811015613cdc5781613cc68882613d07565b8452506020928301929190910190600101613cb3565b5050505092915050565b803561092481614cdc565b805161092481614cdc565b803561092481614ce5565b805161092481614ce5565b803561092481614cee565b805161092481614cee565b600060208284031215613d3a57600080fd5b6000613d468484613c0f565b949350505050565b600060208284031215613d6057600080fd5b6000613d468484613c1a565b60008060408385031215613d7f57600080fd5b6000613d8b8585613c0f565b9250506020613d9c85828601613c0f565b9150509250929050565b600080600060608486031215613dbb57600080fd5b6000613dc78686613c0f565b9350506020613dd886828701613c0f565b9250506040613de986828701613cfc565b9150509250925092565b60008060408385031215613e0657600080fd5b6000613e128585613c0f565b9250506020613d9c85828601613cfc565b600080600060608486031215613e3857600080fd5b6000613e448686613c0f565b9350506020613e5586828701613cfc565b9250506040613de986828701613c0f565b60008060208385031215613e7957600080fd5b823567ffffffffffffffff811115613e9057600080fd5b613e9c85828601613c25565b92509250509250929050565b60008060408385031215613ebb57600080fd5b825167ffffffffffffffff811115613ed257600080fd5b613ede85828601613c67565b9250506020613d9c85828601613cf1565b600060208284031215613f0157600080fd5b6000613d468484613cf1565b600060208284031215613f1f57600080fd5b6000613d468484613cfc565b600060208284031215613f3d57600080fd5b6000613d468484613d07565b60008060408385031215613f5c57600080fd5b6000613f688585613cfc565b9250506020613d9c85828601613ce6565b600060208284031215613f8b57600080fd5b6000613d468484613d12565b600060208284031215613fa957600080fd5b6000613d468484613d1d565b60008060408385031215613fc857600080fd5b6000613ede8585613d07565b60008060408385031215613fe757600080fd5b6000613ff38585613d07565b9250506020613d9c85828601613d07565b6000806000806080858703121561401a57600080fd5b60006140268787613d07565b945050602061403787828801613d07565b935050604061404887828801613cf1565b925050606061405987828801613cf1565b91505092959194509250565b60008060006060848603121561407a57600080fd5b60006140868686613d07565b935050602061409786828701613d07565b9250506040613de986828701613d07565b60006140b4838361421f565b505060200190565b60006140b48383614239565b6140d181614c39565b82525050565b6140d16140e382614c39565b614ca7565b60006140f48385614c2b565b93506001600160fb1b0383111561410a57600080fd5b60208302925061411b838584614c6b565b50500190565b600061412c82614c27565b6141368185614c2b565b935061414183614c21565b8060005b8381101561416f57815161415988826140a8565b975061416483614c21565b925050600101614145565b509495945050505050565b600061418582614c27565b61418f8185614c2b565b935061419a83614c21565b8060005b8381101561416f5781516141b288826140bc565b97506141bd83614c21565b92505060010161419e565b60006141d382614c27565b6141dd8185614c2b565b93506141e883614c21565b8060005b8381101561416f57815161420088826140a8565b975061420b83614c21565b9250506001016141ec565b6140d181614c44565b6140d181610728565b6140d161423482610728565b610728565b6140d181614c49565b6140d181614c60565b600061425682614c27565b6142608185614c2b565b9350614270818560208601614c77565b61427981614cb8565b9093019392505050565b6000614290603583614c2b565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b60006142e7601d83614c2b565b7f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000815260200192915050565b6000614320601b83614c2b565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000614359603f83614c2b565b7f4973737565723a204f6e6c79207468652053796e746852656465656d6572206381527f6f6e74726163742063616e20706572666f726d207468697320616374696f6e00602082015260400192915050565b60006143b8601283614c2b565b714e6f206465627420746f20666f726769766560701b815260200192915050565b60006143e6601083614c2b565b6f416d6f756e7420746f6f206c6172676560801b815260200192915050565b6000614412601e83614c2b565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b600061444b601a83614c2b565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b6000614484601183614c34565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b60006144b1603b83614c2b565b7f4973737565723a204f6e6c79207468652073796e74686574697820636f6e747281527f6163742063616e20706572666f726d207468697320616374696f6e0000000000602082015260400192915050565b6000614510601e83614c2b565b7f412073796e7468206f7220534e58207261746520697320696e76616c69640000815260200192915050565b6000614549601483614c2b565b7314de5b9d1a08191bd95cc81b9bdd08195e1a5cdd60621b815260200192915050565b6000614579602a83614c2b565b7f43616e6e6f742072656d6f76652073796e746820746f2072656465656d20776981526974686f7574207261746560b01b602082015260400192915050565b60006145c5602f83614c2b565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b631cd554d160e21b9052565b6000614622601c83614c2b565b7f53796e7468206164647265737320616c72656164792065786973747300000000815260200192915050565b600061465b602183614c2b565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b600061469e601383614c2b565b72086c2dcdcdee840e4cadadeecca40e6f2dce8d606b1b815260200192915050565b60006146cd601983614c34565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b6000614706601883614c2b565b7f73555344206e6565647320746f20626520736574746c65640000000000000000815260200192915050565b600061473f600c83614c2b565b6b53796e74682065786973747360a01b815260200192915050565b6000614767602083614c2b565b7f4163636f756e74206e6f74206f70656e20666f72206c69717569646174696f6e815260200192915050565b60006147a0601e83614c2b565b7f4d696e696d756d207374616b652074696d65206e6f7420726561636865640000815260200192915050565b60006147d9600f83614c2b565b6e139bdd08195b9bdd59da081cd554d1608a1b815260200192915050565b6000614804602883614c2b565b7f53616665436173743a2076616c756520646f65736e27742066697420696e2061815267371034b73a191a9b60c11b602082015260400192915050565b600061484d8285614228565b60208201915061485d82846140d7565b5060140192915050565b600061487282614477565b915061487e8284614228565b50602001919050565b6000614872826146c0565b6020810161092482846140c8565b604081016148ae82856140c8565b61298760208301846140c8565b604081016148c982856140c8565b612987602083018461421f565b608081016148e482876140c8565b6148f1602083018661421f565b6148fe604083018561421f565b61307f606083018461421f565b6040810161491982856140c8565b6129876020830184614242565b6060810161493482866140c8565b614941602083018561421f565b613d46604083018461421f565b604080825281016149608185876140e8565b9050818103602083015261307f81846141c8565b602080825281016129878184614121565b60208082528101612987818461417a565b602081016109248284614216565b60208101610924828461421f565b604081016148ae828561421f565b604081016148c9828561421f565b60608101614934828661421f565b60408101614919828561421f565b604081016149f8828561421f565b8181036020830152613d46818461424b565b60608101614a18828561421f565b614a25602083018461421f565b61298760408301614609565b602081016109248284614239565b604081016148c98285614239565b60208082528101612987818461424b565b6020808252810161092481614283565b60208082528101610924816142da565b6020808252810161092481614313565b602080825281016109248161434c565b60208082528101610924816143ab565b60208082528101610924816143d9565b6020808252810161092481614405565b602080825281016109248161443e565b60208082528101610924816144a4565b6020808252810161092481614503565b602080825281016109248161453c565b602080825281016109248161456c565b60208082528101610924816145b8565b6020808252810161092481614615565b602080825281016109248161464e565b6020808252810161092481614691565b60208082528101610924816146f9565b6020808252810161092481614732565b602080825281016109248161475a565b6020808252810161092481614793565b60208082528101610924816147cc565b60208082528101610924816147f7565b60408101614bcc828561421f565b6129876020830184614216565b60405181810167ffffffffffffffff81118282101715614bf857600080fd5b604052919050565b600067ffffffffffffffff821115614c1757600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b919050565b600061092482614c54565b151590565b600061092482614c39565b6001600160a01b031690565b600061092482610728565b82818337506000910152565b60005b83811015614c92578181015183820152602001614c7a565b83811115614ca1576000848401525b50505050565b600061092482600061092482614cc2565b601f01601f191690565b60601b90565b614cd181614c39565b8114610a1357600080fd5b614cd181614c44565b614cd181610728565b614cd181614c4956fe74c62d09fbc50aefae0794a9a068f786a692826fbdfe63828ec23a875865823fa365627a7a72315820cb8e58857a500e8078fed2a963431c83ea1b048ed5e1f43ba1d546aa9ee476f76c6578706572696d656e74616cf564736f6c634300051000400000000000000000000000003c05b1239b223c969540fefc0270227a2b00e0470000000000000000000000001cb059b7e74fd21665968c908806143e744d5f30
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061025e5760003560e01c80637418536011610146578063a63c4df4116100c3578063c897713211610087578063c89771321461050f578063d37c4d8b14610522578063d686c06c14610535578063dbf6334014610548578063dd3d2b2e14610550578063fd864ccf146105635761025e565b8063a63c4df4146104ad578063ae3bbbbb146104ce578063b06e8c65146104e1578063b410a034146104f4578063bff4fdfc146104fc5761025e565b8063899ffef41161010a578063899ffef4146104645780638da5cb5b1461046c5780639a5154b414610474578063a311c7c214610487578063a5fdc5de1461049a5761025e565b8063741853601461041b57806379ba5097146104235780637b1001b71461042b578063835e119c1461043e578063849cf588146104515761025e565b806332608039116101df5780634e99bda9116101a35780634e99bda9146103ad57806353a47bb7146103b5578063614d08f8146103ca5780636bed0415146103d25780637168d2c2146103f357806372cb051f146104065761025e565b806332608039146103415780633b6afe401461035457806344ec6b621461037457806347a9b6db14610387578063497d704a1461039a5761025e565b80631627540c116102265780631627540c146102eb57806316b2213f146102fe578063242df9e1146103115780632af64bd3146103195780632b3f41aa1461032e5761025e565b8063042e06881461026357806304f3bcec1461027857806305b3c1c9146102965780630b887dae146102b65780631137aedf146102c9575b600080fd5b610276610271366004613df3565b610576565b005b61028061058e565b60405161028d9190614a31565b60405180910390f35b6102a96102a4366004613d28565b61059d565b60405161028d91906149a4565b6102766102c4366004613f0d565b6105b1565b6102dc6102d7366004613d28565b61068f565b60405161028d939291906149ce565b6102766102f9366004613d28565b6106ab565b6102a961030c366004613d28565b610709565b6102a961071b565b61032161072b565b60405161028d9190614996565b61027661033c366004613d6c565b610842565b61028061034f366004613f0d565b610861565b610367610362366004613e66565b61087c565b60405161028d9190614985565b610276610382366004613da6565b61092a565b610276610395366004613e66565b61094d565b6102766103a8366004613d28565b6109fe565b610321610a16565b6103bd610aa8565b60405161028d9190614892565b6102a9610ab7565b6103e56103e0366004613df3565b610ac4565b60405161028d929190614bbe565b610276610401366004613e66565b610b28565b61040e610c65565b60405161028d9190614974565b610276610c71565b610276610dc3565b6102a9610439366004613f49565b610e68565b61028061044c366004613f0d565b610e74565b61027661045f366004613f79565b610e9b565b61040e610f15565b6103bd61114b565b610276610482366004613da6565b61115a565b6102a9610495366004613d28565b611178565b6102a96104a8366004613d28565b61118a565b6104c06104bb366004613e23565b611195565b60405161028d9291906149c0565b6103e56104dc366004613d28565b611733565b6102766104ef366004613df3565b611749565b6102a961175d565b61032161050a366004613d28565b611767565b61027661051d366004613d28565b611772565b6102a9610530366004613df3565b611787565b610276610543366004613da6565b61183a565b6102a96118e0565b6102a961055e366004613d28565b6118e6565b610276610571366004613d6c565b6118f1565b61057e611910565b61058a8282600061194a565b5050565b6002546001600160a01b031681565b6000806105a983611aa4565b509392505050565b6105b9611b63565b60006105c3611b8d565b604051636b42ba1d60e11b81529091506001600160a01b0382169063d685743a906105f59085906000906004016149dc565b600060405180830381600087803b15801561060f57600080fd5b505af1158015610623573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03841692506304bd11e5915061065490600190600401614996565b600060405180830381600087803b15801561066e57600080fd5b505af1158015610682573d6000803e3d6000fd5b5050505061058a82611ba4565b600080600061069d84612052565b509196909550909350915050565b6106b3611b63565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906106fe908390614892565b60405180910390a150565b60066020526000908152604090205481565b60006107256120ba565b90505b90565b60006060610737610f15565b905060005b815181101561083957600082828151811061075357fe5b602090810291909101810151600081815260039092526040918290205460025492516321f8a72160e01b81529193506001600160a01b039081169216906321f8a721906107a49085906004016149a4565b60206040518083038186803b1580156107bc57600080fd5b505afa1580156107d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107f49190810190613d4e565b6001600160a01b031614158061081f57506000818152600360205260409020546001600160a01b0316155b156108305760009350505050610728565b5060010161073c565b50600191505090565b61084a611910565b6108548282612165565b61058a8260006001612206565b6005602052600090815260409020546001600160a01b031681565b604080518281526020808402820101909152606090829082908280156108ac578160200160208202803883390190505b50905060005b8281101561091f57600560008787848181106108ca57fe5b90506020020135815260200190815260200160002060009054906101000a90046001600160a01b03168282815181106108ff57fe5b6001600160a01b03909216602092830291909101909101526001016108b2565b509150505b92915050565b610932611910565b61093c8383612470565b6109488382600061194a565b505050565b610955611b63565b8060005b818110156109925761098a84848381811061097057fe5b90506020020160206109859190810190613f79565b6124a5565b600101610959565b5061099b611b8d565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b81526004016109c79190614996565b600060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b50505050505050565b610a06611910565b610a138160006001612206565b50565b6000610a20612636565b6001600160a01b031663c8e5bbd5610a386001612651565b6040518263ffffffff1660e01b8152600401610a549190614974565b60006040518083038186803b158015610a6c57600080fd5b505afa158015610a80573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109249190810190613ea8565b6001546001600160a01b031681565b6524b9b9bab2b960d11b81565b6000806000610ad985620a69cb60eb1b61272d565b935090915060009050610afa610aed61291a565b839063ffffffff61297216565b9050848110610b0c5760009350610b1f565b610b1c858263ffffffff61298e16565b93505b50509250929050565b610b30611b63565b806000610b3b611b8d565b9050606082604051908082528060200260200182016040528015610b69578160200160208202803883390190505b506040516305ece36d60e21b81529091506001600160a01b038316906317b38db490610b9d9088908890869060040161494e565b600060405180830381600087803b158015610bb757600080fd5b505af1158015610bcb573d6000803e3d6000fd5b50506040516304bd11e560e01b81526001600160a01b03851692506304bd11e59150610bfc90600190600401614996565b600060405180830381600087803b158015610c1657600080fd5b505af1158015610c2a573d6000803e3d6000fd5b506000925050505b83811015610c5d57610c55868683818110610c4957fe5b90506020020135611ba4565b600101610c32565b505050505050565b60606107256000612651565b6060610c7b610f15565b905060005b815181101561058a576000828281518110610c9757fe5b602002602001015190506000600260009054906101000a90046001600160a01b03166001600160a01b031663dacb2d018384604051602001610cd99190614887565b6040516020818303038152906040526040518363ffffffff1660e01b8152600401610d059291906149ea565b60206040518083038186803b158015610d1d57600080fd5b505afa158015610d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d559190810190613d4e565b6000838152600360205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa6890610db190849084906149b2565b60405180910390a15050600101610c80565b6001546001600160a01b03163314610df65760405162461bcd60e51b8152600401610ded90614a5e565b60405180910390fd5b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92610e39926001600160a01b03918216929116906148a0565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60006105a983836129b6565b60048181548110610e8157fe5b6000918252602090912001546001600160a01b0316905081565b610ea3611b63565b610eac816124a5565b610eb4611b8d565b6001600160a01b03166304bd11e560016040518263ffffffff1660e01b8152600401610ee09190614996565b600060405180830381600087803b158015610efa57600080fd5b505af1158015610f0e573d6000803e3d6000fd5b5050505050565b606080610f20612bc1565b60408051600c8082526101a08201909252919250606091906020820161018080388339019050509050680a6f2dce8d0cae8d2f60bb1b81600081518110610f6357fe5b6020026020010181815250506822bc31b430b733b2b960b91b81600181518110610f8957fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110610fb357fe5b6020026020010181815250506d53796e746865746978537461746560901b81600381518110610fde57fe5b60200260200101818152505066119959541bdbdb60ca1b8160048151811061100257fe5b6020026020010181815250507044656c6567617465417070726f76616c7360781b8160058151811061103057fe5b6020026020010181815250506d2932bbb0b93222b9b1b937bbab1960911b8160068151811061105b57fe5b6020026020010181815250506e53796e746865746978457363726f7760881b8160078151811061108757fe5b6020026020010181815250506b4c69717569646174696f6e7360a01b816008815181106110b057fe5b6020026020010181815250506844656274436163686560b81b816009815181106110d657fe5b6020026020010181815250507021b7b63630ba32b930b626b0b730b3b2b960791b81600a8151811061110457fe5b6020026020010181815250506c29bcb73a342932b232b2b6b2b960991b81600b8151811061112e57fe5b6020026020010181815250506111448282612c12565b9250505090565b6000546001600160a01b031681565b611162611910565b61116c8383612165565b61094883826000612206565b600061118382612cc7565b5092915050565b600061092482612d21565b6000806111a0611910565b6111a8612e7a565b6001600160a01b031663d6f32e0684631cd554d160e21b6040518363ffffffff1660e01b81526004016111dc9291906148bb565b60206040518083038186803b1580156111f457600080fd5b505afa158015611208573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061122c9190810190613eef565b156112495760405162461bcd60e51b8152600401610ded90614b5e565b611251612e91565b6001600160a01b031663c49e80a6866040518263ffffffff1660e01b815260040161127c9190614892565b60206040518083038186803b15801561129457600080fd5b505afa1580156112a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506112cc9190810190613eef565b6112e85760405162461bcd60e51b8152600401610ded90614b7e565b631cd554d160e21b6000526005602052600080516020614cf8833981519152546040516370a0823160e01b815285916001600160a01b0316906370a0823190611335908790600401614892565b60206040518083038186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506113859190810190613f2b565b10156113a35760405162461bcd60e51b8152600401610ded90614b9e565b60006113ad612e91565b6001600160a01b03166323f5589a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156113e557600080fd5b505afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061141d9190810190613f2b565b9050600080600061143589631cd554d160e21b61272d565b925092509250600080611446612636565b6001600160a01b0316630c71cd23620a69cb60eb1b6040518263ffffffff1660e01b815260040161147791906149a4565b604080518083038186803b15801561148e57600080fd5b505afa1580156114a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506114c69190810190613fb5565b915091506114db83806114d65750815b612eab565b60006114e68c612d21565b905060006114f2612e91565b6001600160a01b0316630ac045d58861150b8588612ec9565b6040518363ffffffff1660e01b81526004016115289291906149c0565b60206040518083038186803b15801561154057600080fd5b505afa158015611554573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115789190810190613f2b565b90508b8110611587578b611589565b805b985060006115978a86612edb565b90506116356116288a730142f40c25ce1f1177ed131101fa19217396cb8863907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e457600080fd5b505af41580156115f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061161c9190810190613f2b565b9063ffffffff612eed16565b829063ffffffff612f1216565b9a50828b11156116a657829a506116a361169d6116908b730142f40c25ce1f1177ed131101fa19217396cb8863907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e457600080fd5b859063ffffffff612f3c16565b86612ec9565b99505b6116b38e8d8c8b8b612f66565b50818a1415611722576116c4612e91565b6001600160a01b031663974e9e7f8f6040518263ffffffff1660e01b81526004016116ef9190614892565b600060405180830381600087803b15801561170957600080fd5b505af115801561171d573d6000803e3d6000fd5b505050505b505050505050505050935093915050565b60008061173f83612cc7565b915091505b915091565b611751611910565b61058a82826000612206565b600061072561291a565b600061092482613088565b61177a611910565b610a13816000600161194a565b6000806117926130a7565b90506000816001600160a01b0316638b3f8088866040518263ffffffff1660e01b81526004016117c29190614892565b604080518083038186803b1580156117d957600080fd5b505afa1580156117ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118119190810190613fd4565b5090508061182457600092505050610924565b61182e858561272d565b50909695505050505050565b6118426130c3565b826001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b15801561187b57600080fd5b505afa15801561188f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118b39190810190613d4e565b6001600160a01b0316639dc29fac83836040518363ffffffff1660e01b81526004016109c79291906148bb565b60045490565b6000610924826130fb565b6118f9611910565b6119038282612470565b61058a826000600161194a565b6119186131c4565b6001600160a01b0316336001600160a01b0316146119485760405162461bcd60e51b8152600401610ded90614ade565b565b60008060008061195987612052565b935093509350935061196a81612eab565b84611994578386111561198f5760405162461bcd60e51b8152600401610ded90614aae565b611998565b8395505b6119a4878785856131db565b6119ad876135a8565b631cd554d160e21b6000526005602052600080516020614cf88339815191525460405163219e412d60e21b81526001600160a01b039091169063867904b4906119fc908a908a906004016148bb565b600060405180830381600087803b158015611a1657600080fd5b505af1158015611a2a573d6000803e3d6000fd5b50505050611a36611b8d565b6001600160a01b03166342c7b819611a4d88613621565b6040518263ffffffff1660e01b8152600401611a6991906149a4565b600060405180830381600087803b158015611a8357600080fd5b505af1158015611a97573d6000803e3d6000fd5b505050506109f58761364a565b600080600080611ab2612636565b6001600160a01b0316630c71cd23620a69cb60eb1b6040518263ffffffff1660e01b8152600401611ae391906149a4565b604080518083038186803b158015611afa57600080fd5b505afa158015611b0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b329190810190613fb5565b915091506000611b4a611b4487612d21565b84612ec9565b9050611b5761162861291a565b94509092505050915091565b6000546001600160a01b031633146119485760405162461bcd60e51b8152600401610ded90614b1e565b60006107256844656274436163686560b81b61370b565b6000818152600560205260409020546001600160a01b031680611bd95760405162461bcd60e51b8152600401610ded90614afe565b631cd554d160e21b821415611c005760405162461bcd60e51b8152600401610ded90614b4e565b6000816001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611c3b57600080fd5b505afa158015611c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611c739190810190613f2b565b90508015611ef557600080611c86612636565b6001600160a01b0316638295016a86856040518363ffffffff1660e01b8152600401611cb3929190614a0a565b60606040518083038186803b158015611ccb57600080fd5b505afa158015611cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d039190810190614065565b509150915060008111611d285760405162461bcd60e51b8152600401610ded90614b0e565b6000611d32613768565b631cd554d160e21b6000526005602052600080516020614cf88339815191525460405163219e412d60e21b81529192506001600160a01b03169063867904b490611d8290849087906004016148bb565b600060405180830381600087803b158015611d9c57600080fd5b505af1158015611db0573d6000803e3d6000fd5b50505050611dbc611b8d565b6001600160a01b03166342c7b819611dd385613621565b6040518263ffffffff1660e01b8152600401611def91906149a4565b600060405180830381600087803b158015611e0957600080fd5b505af1158015611e1d573d6000803e3d6000fd5b50505050806001600160a01b0316633a70599c866001600160a01b031663ec5568896040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6957600080fd5b505afa158015611e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611ea19190810190613f97565b846040518363ffffffff1660e01b8152600401611ebf929190614a3f565b600060405180830381600087803b158015611ed957600080fd5b505af1158015611eed573d6000803e3d6000fd5b505050505050505b60005b600454811015611fdc57826001600160a01b031660048281548110611f1957fe5b6000918252602090912001546001600160a01b03161415611fd45760048181548110611f4157fe5b600091825260209091200180546001600160a01b0319169055600480546000198101908110611f6c57fe5b600091825260209091200154600480546001600160a01b039092169183908110611f9257fe5b600091825260209091200180546001600160a01b0319166001600160a01b03929092169190911790556004805490611fce906000198301613bd6565b50611fdc565b600101611ef8565b506001600160a01b038216600090815260066020908152604080832083905585835260059091529081902080546001600160a01b0319169055517f6166f5c475cc1cd535c6cdf14a6d5edb811e34117031fc2863392a136eb655d09061204590859085906149b2565b60405180910390a1505050565b60008060008061206985631cd554d160e21b61272d565b9194509250905060008061207c87611aa4565b91509150819550828061208c5750805b925085851061209e57600095506120b1565b6120ae868663ffffffff61298e16565b95505b50509193509193565b60006120c4613783565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6f6d696e696d756d5374616b6554696d6560801b6040518363ffffffff1660e01b81526004016121159291906149c0565b60206040518083038186803b15801561212d57600080fd5b505afa158015612141573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107259190810190613f2b565b61216d6137a0565b6001600160a01b0316637d3f0ba283836040518363ffffffff1660e01b815260040161219a9291906148a0565b60206040518083038186803b1580156121b257600080fd5b505afa1580156121c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506121ea9190810190613eef565b61058a5760405162461bcd60e51b8152600401610ded90614a6e565b806123635761221483613088565b6122305760405162461bcd60e51b8152600401610ded90614b8e565b60008061223b612e7a565b6001600160a01b0316631b16802c86631cd554d160e21b6040518363ffffffff1660e01b815260040161226f9291906148bb565b606060405180830381600087803b15801561228957600080fd5b505af115801561229d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506122c19190810190614065565b9093509150508015612360576122d5612e7a565b6001600160a01b0316634c268fc886631cd554d160e21b87866040518563ffffffff1660e01b815260040161230d94939291906148d6565b60206040518083038186803b15801561232557600080fd5b505afa158015612339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061235d9190810190613f2b565b93505b50505b600080600061237986631cd554d160e21b61272d565b92509250925060008061238b88611aa4565b9150915061239f83806114d6575081612eab565b600085116123bf5760405162461bcd60e51b8152600401610ded90614a9e565b85156123d8576123d5858363ffffffff61298e16565b96505b60006123e7898a8a8989612f66565b9050826123fa878363ffffffff61298e16565b1161246557612407612e91565b6001600160a01b031663974e9e7f8a6040518263ffffffff1660e01b81526004016124329190614892565b600060405180830381600087803b15801561244c57600080fd5b505af1158015612460573d6000803e3d6000fd5b505050505b505050505050505050565b6124786137a0565b6001600160a01b0316630487261783836040518363ffffffff1660e01b815260040161219a9291906148a0565b6000816001600160a01b031663dbd06c856040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e057600080fd5b505afa1580156124f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506125189190810190613f2b565b6000818152600560205260409020549091506001600160a01b0316156125505760405162461bcd60e51b8152600401610ded90614b6e565b6001600160a01b038216600090815260066020526040902054156125865760405162461bcd60e51b8152600401610ded90614b2e565b60048054600181019091557f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0180546001600160a01b0384166001600160a01b03199182168117909255600083815260056020908152604080832080549094168517909355928152600690925290819020829055517f0a2b6ebf143b3e9fcd67e17748ad315174746100c27228468b2c98c302c628849061262a90839085906149b2565b60405180910390a15050565b60006107256c45786368616e6765526174657360981b61370b565b60608082612660576000612663565b60015b60ff1660048054905001604051908082528060200260200182016040528015612696578160200160208202803883390190505b50905060005b6004548110156126fd5760066000600483815481106126b757fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205482518390839081106126ea57fe5b602090810291909101015260010161269c565b508215610924576004548151620a69cb60eb1b918391811061271b57fe5b60200260200101818152505092915050565b60008060008061273b6130a7565b9050600080826001600160a01b0316638b3f8088896040518263ffffffff1660e01b815260040161276c9190614892565b604080518083038186803b15801561278357600080fd5b505afa158015612797573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506127bb9190810190613fd4565b915091506127ca8760016129b6565b9095509350816127e1575060009450612913915050565b60006128ef836128e3866001600160a01b03166308d95cd5866040518263ffffffff1660e01b815260040161281691906149a4565b60206040518083038186803b15801561282e57600080fd5b505afa158015612842573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128669190810190613f2b565b876001600160a01b031663463177126040518163ffffffff1660e01b815260040160206040518083038186803b15801561289f57600080fd5b505afa1580156128b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128d79190810190613f2b565b9063ffffffff6137bf16565b9063ffffffff6137d816565b90506000612900826128e3896137f1565b905061290b81613807565b975050505050505b9250925092565b6000612924613783565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b6c69737375616e6365526174696f60981b6040518363ffffffff1660e01b81526004016121159291906149c0565b60006129878383670de0b6b3a7640000613829565b9392505050565b6000828211156129b05760405162461bcd60e51b8152600401610ded90614abe565b50900390565b60008060008060006129c6611b8d565b6001600160a01b0316633a900a2e6040518163ffffffff1660e01b815260040160806040518083038186803b1580156129fe57600080fd5b505afa158015612a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612a369190810190614004565b935093505092508180612a465750805b93506000612a52612636565b905086612af857600080612a64611b8d565b6001600160a01b0316632992dba26040518163ffffffff1660e01b8152600401604080518083038186803b158015612a9b57600080fd5b505afa158015612aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612ad39190810190613fb5565b9092509050612ae8868363ffffffff612eed16565b95508680612af35750805b965050505b631cd554d160e21b881415612b135750919350612bba915050565b600080826001600160a01b0316630c71cd238b6040518263ffffffff1660e01b8152600401612b4291906149a4565b604080518083038186803b158015612b5957600080fd5b505afa158015612b6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612b919190810190613fb5565b9092509050612ba6868363ffffffff61297216565b8780612baf5750815b975097505050505050505b9250929050565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b81600081518110612c0357fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015612c42578160200160208202803883390190505b50905060005b8351811015612c8457838181518110612c5d57fe5b6020026020010151828281518110612c7157fe5b6020908102919091010152600101612c48565b5060005b825181101561118357828181518110612c9d57fe5b6020026020010151828286510181518110612cb457fe5b6020908102919091010152600101612c88565b6000806000612cd584612d21565b9050600080612cea86620a69cb60eb1b61272d565b92505091508260001415612d0657600094509250611744915050565b612d16828463ffffffff61297216565b945092505050915091565b600080612d2c6131c4565b6001600160a01b03166370a08231846040518263ffffffff1660e01b8152600401612d579190614892565b60206040518083038186803b158015612d6f57600080fd5b505afa158015612d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612da79190810190613f2b565b90506000612db3613861565b6001600160a01b031614612e5757612e54612dcc613861565b6001600160a01b03166370a08231856040518263ffffffff1660e01b8152600401612df79190614892565b60206040518083038186803b158015612e0f57600080fd5b505afa158015612e23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612e479190810190613f2b565b829063ffffffff612eed16565b90505b6000612e6161387e565b6001600160a01b03161461092457612987612dcc61387e565b60006107256822bc31b430b733b2b960b91b61370b565b60006107256b4c69717569646174696f6e7360a01b61370b565b8015610a135760405162461bcd60e51b8152600401610ded90614aee565b6000612987838363ffffffff61389a16565b6000612987838363ffffffff61297216565b6000828201838110156129875760405162461bcd60e51b8152600401610ded90614a7e565b6000670de0b6b3a7640000612f2d848463ffffffff6138af16565b81612f3457fe5b049392505050565b600061298782612f5a85670de0b6b3a764000063ffffffff6138af16565b9063ffffffff6138e916565b6000838310612f755783612f77565b825b9050612f858682858561391e565b631cd554d160e21b6000526005602052600080516020614cf883398151915254604051632770a7eb60e21b81526001600160a01b0390911690639dc29fac90612fd490889085906004016148bb565b600060405180830381600087803b158015612fee57600080fd5b505af1158015613002573d6000803e3d6000fd5b5050505061300e611b8d565b6001600160a01b03166342c7b81961302583613621565b6000036040518263ffffffff1660e01b815260040161304491906149a4565b600060405180830381600087803b15801561305e57600080fd5b505af1158015613072573d6000803e3d6000fd5b5050505061307f8661364a565b95945050505050565b600061309e6130956120ba565b61161c846130fb565b42101592915050565b60006107256d53796e746865746978537461746560901b61370b565b6130cb613768565b6001600160a01b0316336001600160a01b0316146119485760405162461bcd60e51b8152600401610ded90614a8e565b6000613105613783565b6001600160a01b03166323257c2b6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b85604051602001613141929190614841565b604051602081830303815290604052805190602001206040518363ffffffff1660e01b81526004016131749291906149c0565b60206040518083038186803b15801561318c57600080fd5b505afa1580156131a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109249190810190613f2b565b6000610725680a6f2dce8d0cae8d2f60bb1b61370b565b60006131e56130a7565b905060006131f9858463ffffffff612eed16565b9050600061320d868363ffffffff6137bf16565b9050600061329d82730142f40c25ce1f1177ed131101fa19217396cb8863d5e5e6e66040518163ffffffff1660e01b815260040160206040518083038186803b15801561325957600080fd5b505af415801561326d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506132919190810190613f2b565b9063ffffffff61298e16565b905085156132c0576132b9836128d7898963ffffffff612eed16565b9150613314565b836001600160a01b0316631bfba5956040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156132fb57600080fd5b505af115801561330f573d6000803e3d6000fd5b505050505b60405163a764eb4560e01b81526001600160a01b0385169063a764eb4590613342908b9086906004016148bb565b600060405180830381600087803b15801561335c57600080fd5b505af1158015613370573d6000803e3d6000fd5b505050506000846001600160a01b031663cd92eba96040518163ffffffff1660e01b815260040160206040518083038186803b1580156133af57600080fd5b505afa1580156133c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506133e79190810190613f2b565b11156134c457836001600160a01b0316633d31e97b61347183876001600160a01b031663463177126040518163ffffffff1660e01b815260040160206040518083038186803b15801561343957600080fd5b505afa15801561344d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506128e39190810190613f2b565b6040518263ffffffff1660e01b815260040161348d91906149a4565b600060405180830381600087803b1580156134a757600080fd5b505af11580156134bb573d6000803e3d6000fd5b5050505061359e565b836001600160a01b0316633d31e97b730142f40c25ce1f1177ed131101fa19217396cb8863d5e5e6e66040518163ffffffff1660e01b815260040160206040518083038186803b15801561351757600080fd5b505af415801561352b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061354f9190810190613f2b565b6040518263ffffffff1660e01b815260040161356b91906149a4565b600060405180830381600087803b15801561358557600080fd5b505af1158015613599573d6000803e3d6000fd5b505050505b5050505050505050565b6135b0613783565b6001600160a01b0316631d5b277f6524b9b9bab2b960d11b6d1b185cdd125cdcdd59515d995b9d60921b846040516020016135ec929190614841565b60405160208183030381529060405280519060200120426040518463ffffffff1660e01b8152600401610ee0939291906149ce565b6000600160ff1b82106136465760405162461bcd60e51b8152600401610ded90614bae565b5090565b6000806136556130a7565b6001600160a01b0316638b3f8088846040518263ffffffff1660e01b81526004016136809190614892565b604080518083038186803b15801561369757600080fd5b505afa1580156136ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506136cf9190810190613fd4565b90925090506136dc613b96565b6001600160a01b031663866452748484846040518463ffffffff1660e01b81526004016109c793929190614926565b60008181526003602090815260408083205490516001600160a01b03909116918215159161373b91869101614867565b604051602081830303815290604052906111835760405162461bcd60e51b8152600401610ded9190614a4d565b60006107256c29bcb73a342932b232b2b6b2b960991b61370b565b60006107256e466c657869626c6553746f7261676560881b61370b565b60006107257044656c6567617465417070726f76616c7360781b61370b565b600061298783836b033b2e3c9fd0803ce8000000613829565b600061298783836b033b2e3c9fd0803ce8000000613bab565b600061092482633b9aca0063ffffffff6138af16565b60006305f5e10082046005600a82061061381f57600a015b600a900492915050565b60008061384384612f5a87600a870263ffffffff6138af16565b90506005600a825b061061385557600a015b600a9004949350505050565b60006107256e53796e746865746978457363726f7760881b61370b565b60006107256d2932bbb0b93222b9b1b937bbab1960911b61370b565b60006129878383670de0b6b3a7640000613bab565b6000826138be57506000610924565b828202828482816138cb57fe5b04146129875760405162461bcd60e51b8152600401610ded90614b3e565b600080821161390a5760405162461bcd60e51b8152600401610ded90614ace565b600082848161391557fe5b04949350505050565b60006139286130a7565b9050600061393c838663ffffffff61298e16565b9050600081156139a6576000613958878463ffffffff6137bf16565b90506139a281730142f40c25ce1f1177ed131101fa19217396cb8863d5e5e6e66040518163ffffffff1660e01b815260040160206040518083038186803b1580156115e457600080fd5b9150505b84861415613a675760405163a764eb4560e01b81526001600160a01b0384169063a764eb45906139dd908a9060009060040161490b565b600060405180830381600087803b1580156139f757600080fd5b505af1158015613a0b573d6000803e3d6000fd5b50505050826001600160a01b031663ba08f2996040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613a4a57600080fd5b505af1158015613a5e573d6000803e3d6000fd5b50505050613af3565b6000613a79868863ffffffff61298e16565b90506000613a8d828563ffffffff6137bf16565b60405163a764eb4560e01b81529091506001600160a01b0386169063a764eb4590613abe908c9085906004016148bb565b600060405180830381600087803b158015613ad857600080fd5b505af1158015613aec573d6000803e3d6000fd5b5050505050505b826001600160a01b0316633d31e97b613b3f83866001600160a01b031663463177126040518163ffffffff1660e01b815260040160206040518083038186803b15801561343957600080fd5b6040518263ffffffff1660e01b8152600401613b5b91906149a4565b600060405180830381600087803b158015613b7557600080fd5b505af1158015613b89573d6000803e3d6000fd5b5050505050505050505050565b600061072566119959541bdbdb60ca1b61370b565b600080600a8304613bc2868663ffffffff6138af16565b81613bc957fe5b0490506005600a8261384b565b8154818355818111156109485760008381526020902061094891810190830161072891905b808211156136465760008155600101613bfb565b803561092481614cc8565b805161092481614cc8565b60008083601f840112613c3757600080fd5b50813567ffffffffffffffff811115613c4f57600080fd5b602083019150836020820283011115612bba57600080fd5b600082601f830112613c7857600080fd5b8151613c8b613c8682614c00565b614bd9565b91508181835260208401935060208101905083856020840282011115613cb057600080fd5b60005b83811015613cdc5781613cc68882613d07565b8452506020928301929190910190600101613cb3565b5050505092915050565b803561092481614cdc565b805161092481614cdc565b803561092481614ce5565b805161092481614ce5565b803561092481614cee565b805161092481614cee565b600060208284031215613d3a57600080fd5b6000613d468484613c0f565b949350505050565b600060208284031215613d6057600080fd5b6000613d468484613c1a565b60008060408385031215613d7f57600080fd5b6000613d8b8585613c0f565b9250506020613d9c85828601613c0f565b9150509250929050565b600080600060608486031215613dbb57600080fd5b6000613dc78686613c0f565b9350506020613dd886828701613c0f565b9250506040613de986828701613cfc565b9150509250925092565b60008060408385031215613e0657600080fd5b6000613e128585613c0f565b9250506020613d9c85828601613cfc565b600080600060608486031215613e3857600080fd5b6000613e448686613c0f565b9350506020613e5586828701613cfc565b9250506040613de986828701613c0f565b60008060208385031215613e7957600080fd5b823567ffffffffffffffff811115613e9057600080fd5b613e9c85828601613c25565b92509250509250929050565b60008060408385031215613ebb57600080fd5b825167ffffffffffffffff811115613ed257600080fd5b613ede85828601613c67565b9250506020613d9c85828601613cf1565b600060208284031215613f0157600080fd5b6000613d468484613cf1565b600060208284031215613f1f57600080fd5b6000613d468484613cfc565b600060208284031215613f3d57600080fd5b6000613d468484613d07565b60008060408385031215613f5c57600080fd5b6000613f688585613cfc565b9250506020613d9c85828601613ce6565b600060208284031215613f8b57600080fd5b6000613d468484613d12565b600060208284031215613fa957600080fd5b6000613d468484613d1d565b60008060408385031215613fc857600080fd5b6000613ede8585613d07565b60008060408385031215613fe757600080fd5b6000613ff38585613d07565b9250506020613d9c85828601613d07565b6000806000806080858703121561401a57600080fd5b60006140268787613d07565b945050602061403787828801613d07565b935050604061404887828801613cf1565b925050606061405987828801613cf1565b91505092959194509250565b60008060006060848603121561407a57600080fd5b60006140868686613d07565b935050602061409786828701613d07565b9250506040613de986828701613d07565b60006140b4838361421f565b505060200190565b60006140b48383614239565b6140d181614c39565b82525050565b6140d16140e382614c39565b614ca7565b60006140f48385614c2b565b93506001600160fb1b0383111561410a57600080fd5b60208302925061411b838584614c6b565b50500190565b600061412c82614c27565b6141368185614c2b565b935061414183614c21565b8060005b8381101561416f57815161415988826140a8565b975061416483614c21565b925050600101614145565b509495945050505050565b600061418582614c27565b61418f8185614c2b565b935061419a83614c21565b8060005b8381101561416f5781516141b288826140bc565b97506141bd83614c21565b92505060010161419e565b60006141d382614c27565b6141dd8185614c2b565b93506141e883614c21565b8060005b8381101561416f57815161420088826140a8565b975061420b83614c21565b9250506001016141ec565b6140d181614c44565b6140d181610728565b6140d161423482610728565b610728565b6140d181614c49565b6140d181614c60565b600061425682614c27565b6142608185614c2b565b9350614270818560208601614c77565b61427981614cb8565b9093019392505050565b6000614290603583614c2b565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b60006142e7601d83614c2b565b7f4e6f7420617070726f76656420746f20616374206f6e20626568616c66000000815260200192915050565b6000614320601b83614c2b565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000614359603f83614c2b565b7f4973737565723a204f6e6c79207468652053796e746852656465656d6572206381527f6f6e74726163742063616e20706572666f726d207468697320616374696f6e00602082015260400192915050565b60006143b8601283614c2b565b714e6f206465627420746f20666f726769766560701b815260200192915050565b60006143e6601083614c2b565b6f416d6f756e7420746f6f206c6172676560801b815260200192915050565b6000614412601e83614c2b565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b600061444b601a83614c2b565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b6000614484601183614c34565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b60006144b1603b83614c2b565b7f4973737565723a204f6e6c79207468652073796e74686574697820636f6e747281527f6163742063616e20706572666f726d207468697320616374696f6e0000000000602082015260400192915050565b6000614510601e83614c2b565b7f412073796e7468206f7220534e58207261746520697320696e76616c69640000815260200192915050565b6000614549601483614c2b565b7314de5b9d1a08191bd95cc81b9bdd08195e1a5cdd60621b815260200192915050565b6000614579602a83614c2b565b7f43616e6e6f742072656d6f76652073796e746820746f2072656465656d20776981526974686f7574207261746560b01b602082015260400192915050565b60006145c5602f83614c2b565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b631cd554d160e21b9052565b6000614622601c83614c2b565b7f53796e7468206164647265737320616c72656164792065786973747300000000815260200192915050565b600061465b602183614c2b565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b600061469e601383614c2b565b72086c2dcdcdee840e4cadadeecca40e6f2dce8d606b1b815260200192915050565b60006146cd601983614c34565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b6000614706601883614c2b565b7f73555344206e6565647320746f20626520736574746c65640000000000000000815260200192915050565b600061473f600c83614c2b565b6b53796e74682065786973747360a01b815260200192915050565b6000614767602083614c2b565b7f4163636f756e74206e6f74206f70656e20666f72206c69717569646174696f6e815260200192915050565b60006147a0601e83614c2b565b7f4d696e696d756d207374616b652074696d65206e6f7420726561636865640000815260200192915050565b60006147d9600f83614c2b565b6e139bdd08195b9bdd59da081cd554d1608a1b815260200192915050565b6000614804602883614c2b565b7f53616665436173743a2076616c756520646f65736e27742066697420696e2061815267371034b73a191a9b60c11b602082015260400192915050565b600061484d8285614228565b60208201915061485d82846140d7565b5060140192915050565b600061487282614477565b915061487e8284614228565b50602001919050565b6000614872826146c0565b6020810161092482846140c8565b604081016148ae82856140c8565b61298760208301846140c8565b604081016148c982856140c8565b612987602083018461421f565b608081016148e482876140c8565b6148f1602083018661421f565b6148fe604083018561421f565b61307f606083018461421f565b6040810161491982856140c8565b6129876020830184614242565b6060810161493482866140c8565b614941602083018561421f565b613d46604083018461421f565b604080825281016149608185876140e8565b9050818103602083015261307f81846141c8565b602080825281016129878184614121565b60208082528101612987818461417a565b602081016109248284614216565b60208101610924828461421f565b604081016148ae828561421f565b604081016148c9828561421f565b60608101614934828661421f565b60408101614919828561421f565b604081016149f8828561421f565b8181036020830152613d46818461424b565b60608101614a18828561421f565b614a25602083018461421f565b61298760408301614609565b602081016109248284614239565b604081016148c98285614239565b60208082528101612987818461424b565b6020808252810161092481614283565b60208082528101610924816142da565b6020808252810161092481614313565b602080825281016109248161434c565b60208082528101610924816143ab565b60208082528101610924816143d9565b6020808252810161092481614405565b602080825281016109248161443e565b60208082528101610924816144a4565b6020808252810161092481614503565b602080825281016109248161453c565b602080825281016109248161456c565b60208082528101610924816145b8565b6020808252810161092481614615565b602080825281016109248161464e565b6020808252810161092481614691565b60208082528101610924816146f9565b6020808252810161092481614732565b602080825281016109248161475a565b6020808252810161092481614793565b60208082528101610924816147cc565b60208082528101610924816147f7565b60408101614bcc828561421f565b6129876020830184614216565b60405181810167ffffffffffffffff81118282101715614bf857600080fd5b604052919050565b600067ffffffffffffffff821115614c1757600080fd5b5060209081020190565b60200190565b5190565b90815260200190565b919050565b600061092482614c54565b151590565b600061092482614c39565b6001600160a01b031690565b600061092482610728565b82818337506000910152565b60005b83811015614c92578181015183820152602001614c7a565b83811115614ca1576000848401525b50505050565b600061092482600061092482614cc2565b601f01601f191690565b60601b90565b614cd181614c39565b8114610a1357600080fd5b614cd181614c44565b614cd181610728565b614cd181614c4956fe74c62d09fbc50aefae0794a9a068f786a692826fbdfe63828ec23a875865823fa365627a7a72315820cb8e58857a500e8078fed2a963431c83ea1b048ed5e1f43ba1d546aa9ee476f76c6578706572696d656e74616cf564736f6c63430005100040
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003c05b1239b223c969540fefc0270227a2b00e0470000000000000000000000001cb059b7e74fd21665968c908806143e744d5f30
-----Decoded View---------------
Arg [0] : _owner (address): 0x3C05B1239B223c969540FeFc0270227a2B00e047
Arg [1] : _resolver (address): 0x1Cb059b7e74fD21665968C908806143E744D5F30
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000003c05b1239b223c969540fefc0270227a2b00e047
Arg [1] : 0000000000000000000000001cb059b7e74fd21665968c908806143e744d5f30
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.