Sepolia Testnet

Contract

0x8c40995955502B7d5F4555B43BA0aCe402B216B5

Overview

ETH Balance

0 ETH

Token Holdings

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Value
0x6080604054872892024-03-14 23:40:4896 days ago1710459648IN
 Create: EtherWrapper
0 ETH0.000277330.12845182

Advanced mode:
Parent Transaction Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EtherWrapper

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2024-03-15
*/

/*
   ____            __   __        __   _
  / __/__ __ ___  / /_ / /  ___  / /_ (_)__ __
 _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
     /___/

* Synthetix: EtherWrapper.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/EtherWrapper.sol
* Docs: https://docs.synthetix.io/contracts/EtherWrapper
*
* Contract Dependencies: 
*	- IAddressResolver
*	- IEtherWrapper
*	- MixinResolver
*	- MixinSystemSettings
*	- Owned
*	- Pausable
* Libraries: 
*	- SafeDecimalMath
*	- SafeMath
*
* MIT License
* ===========
*
* Copyright (c) 2024 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);
}


interface IWETH {
    // 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);

    // WETH-specific functions.
    function deposit() external payable;

    function withdraw(uint amount) external;

    // Events
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
    event Deposit(address indexed to, uint amount);
    event Withdrawal(address indexed to, uint amount);
}


// https://docs.synthetix.io/contracts/source/interfaces/ietherwrapper
contract IEtherWrapper {
    function mint(uint amount) external;

    function burn(uint amount) external;

    function distributeFees() external;

    function capacity() external view returns (uint);

    function getReserves() external view returns (uint);

    function totalIssuedSynths() external view returns (uint);

    function calculateMintFee(uint amount) public view returns (uint);

    function calculateBurnFee(uint amount) public view returns (uint);

    function maxETH() public view returns (uint256);

    function mintFeeRate() public view returns (uint256);

    function burnFeeRate() public view returns (uint256);

    function weth() public view returns (IWETH);
}


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


// Inheritance


// https://docs.synthetix.io/contracts/source/contracts/pausable
contract Pausable is Owned {
    uint public lastPauseTime;
    bool public paused;

    constructor() internal {
        // This contract is abstract, and thus cannot be instantiated directly
        require(owner != address(0), "Owner must be set");
        // Paused will be false, and lastPauseTime will be 0 upon initialisation
    }

    /**
     * @notice Change the paused state of the contract
     * @dev Only the contract owner may call this.
     */
    function setPaused(bool _paused) external onlyOwner {
        // Ensure we're actually changing the state before we do anything
        if (_paused == paused) {
            return;
        }

        // Set our paused state.
        paused = _paused;

        // If applicable, set the last pause time.
        if (paused) {
            lastPauseTime = now;
        }

        // Let everyone know that our pause state has changed.
        emit PauseChanged(paused);
    }

    event PauseChanged(bool isPaused);

    modifier notPaused {
        require(!paused, "This action cannot be performed while the contract is paused");
        _;
    }
}


// https://docs.synthetix.io/contracts/source/interfaces/iissuer
interface IIssuer {
    // Views

    function allNetworksDebtInfo()
        external
        view
        returns (
            uint256 debt,
            uint256 sharesSupply,
            bool isStale
        );

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

    function liquidationAmounts(address account, bool isSelfLiquidation)
        external
        view
        returns (
            uint totalRedeemed,
            uint debtToRemove,
            uint escrowToLiquidate,
            uint initialDebtBalance
        );

    // Restricted: used internally to Synthetix
    function addSynths(ISynth[] calldata synthsToAdd) external;

    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 setCurrentPeriodId(uint128 periodId) external;

    function liquidateAccount(address account, bool isSelfLiquidation)
        external
        returns (
            uint totalRedeemed,
            uint debtRemoved,
            uint escrowToLiquidate
        );

    function issueSynthsWithoutDebt(
        bytes32 currencyKey,
        address to,
        uint amount
    ) external returns (bool rateInvalid);

    function burnSynthsWithoutDebt(
        bytes32 currencyKey,
        address to,
        uint amount
    ) external returns (bool rateInvalid);

    function modifyDebtSharesForMigration(address account, uint amount) external;
}


pragma experimental ABIEncoderV2;

// https://docs.synthetix.io/contracts/source/interfaces/IDirectIntegration
interface IDirectIntegrationManager {
    struct ParameterIntegrationSettings {
        bytes32 currencyKey;
        address dexPriceAggregator;
        address atomicEquivalentForDexPricing;
        uint atomicExchangeFeeRate;
        uint atomicTwapWindow;
        uint atomicMaxVolumePerBlock;
        uint atomicVolatilityConsiderationWindow;
        uint atomicVolatilityUpdateThreshold;
        uint exchangeFeeRate;
        uint exchangeMaxDynamicFee;
        uint exchangeDynamicFeeRounds;
        uint exchangeDynamicFeeThreshold;
        uint exchangeDynamicFeeWeightDecay;
    }

    function getExchangeParameters(address integration, bytes32 key)
        external
        view
        returns (ParameterIntegrationSettings memory settings);

    function setExchangeParameters(
        address integration,
        bytes32[] calldata currencyKeys,
        ParameterIntegrationSettings calldata params
    ) 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 anyRateIsInvalidAtRound(bytes32[] calldata currencyKeys, uint[] calldata roundIds) external view returns (bool);

    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 effectiveValueAndRatesAtRound(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        uint roundIdForSrc,
        uint roundIdForDest
    )
        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 effectiveAtomicValueAndRates(
        IDirectIntegrationManager.ParameterIntegrationSettings calldata sourceSettings,
        uint sourceAmount,
        IDirectIntegrationManager.ParameterIntegrationSettings calldata destinationSettings,
        IDirectIntegrationManager.ParameterIntegrationSettings calldata usdSettings
    )
        external
        view
        returns (
            uint value,
            uint systemValue,
            uint systemSourceRate,
            uint systemDestinationRate
        );

    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 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,
        uint roundId
    ) 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);

    function synthTooVolatileForAtomicExchange(IDirectIntegrationManager.ParameterIntegrationSettings calldata settings)
        external
        view
        returns (bool);

    function rateWithSafetyChecks(bytes32 currencyKey)
        external
        returns (
            uint rate,
            bool broken,
            bool invalid
        );
}


// 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 feesBurned(address account) external view returns (uint);

    function feesToBurn(address account) external view returns (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 totalFeesBurned() 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;

    function closeSecondary(uint snxBackedDebt, uint debtShareSupply) external;

    function recordFeePaid(uint sUSDAmount) external;

    function setRewardsToDistribute(uint amount) external;
}


// 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 {
    // must match the one defined SystemSettingsLib, defined in both places due to sol v0.5 limitations
    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_ESCROW_DURATION = "liquidationEscrowDuration";
    bytes32 internal constant SETTING_LIQUIDATION_PENALTY = "liquidationPenalty";
    bytes32 internal constant SETTING_SNX_LIQUIDATION_PENALTY = "snxLiquidationPenalty";
    bytes32 internal constant SETTING_SELF_LIQUIDATION_PENALTY = "selfLiquidationPenalty";
    bytes32 internal constant SETTING_FLAG_REWARD = "flagReward";
    bytes32 internal constant SETTING_LIQUIDATE_REWARD = "liquidateReward";
    bytes32 internal constant SETTING_RATE_STALE_PERIOD = "rateStalePeriod";
    /* ========== Exchange Fees Related ========== */
    bytes32 internal constant SETTING_EXCHANGE_FEE_RATE = "exchangeFeeRate";
    bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD = "exchangeDynamicFeeThreshold";
    bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY = "exchangeDynamicFeeWeightDecay";
    bytes32 internal constant SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS = "exchangeDynamicFeeRounds";
    bytes32 internal constant SETTING_EXCHANGE_MAX_DYNAMIC_FEE = "exchangeMaxDynamicFee";
    /* ========== End Exchange Fees Related ========== */
    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_FEE_PERIOD_CLOSE_GAS_LIMIT = "crossDomainCloseGasLimit";
    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_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_VOLATILITY_CONSIDERATION_WINDOW = "atomicVolConsiderationWindow";
    bytes32 internal constant SETTING_ATOMIC_VOLATILITY_UPDATE_THRESHOLD = "atomicVolUpdateThreshold";
    bytes32 internal constant SETTING_PURE_CHAINLINK_PRICE_FOR_ATOMIC_SWAPS_ENABLED = "pureChainlinkForAtomicsEnabled";
    bytes32 internal constant SETTING_CROSS_SYNTH_TRANSFER_ENABLED = "crossChainSynthTransferEnabled";

    bytes32 internal constant CONTRACT_FLEXIBLESTORAGE = "FlexibleStorage";

    enum CrossDomainMessageGasLimits {Deposit, Escrow, Reward, Withdrawal, CloseFeePeriod, Relay}

    struct DynamicFeeConfig {
        uint threshold;
        uint weightDecay;
        uint rounds;
        uint maxFee;
    }

    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 if (gasLimitType == CrossDomainMessageGasLimits.CloseFeePeriod) {
            return SETTING_CROSS_DOMAIN_FEE_PERIOD_CLOSE_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 getLiquidationEscrowDuration() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_ESCROW_DURATION);
    }

    function getLiquidationPenalty() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATION_PENALTY);
    }

    function getSnxLiquidationPenalty() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_SNX_LIQUIDATION_PENALTY);
    }

    function getSelfLiquidationPenalty() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_SELF_LIQUIDATION_PENALTY);
    }

    function getFlagReward() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_FLAG_REWARD);
    }

    function getLiquidateReward() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_LIQUIDATE_REWARD);
    }

    function getRateStalePeriod() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_RATE_STALE_PERIOD);
    }

    /* ========== Exchange Related Fees ========== */
    function getExchangeFeeRate(bytes32 currencyKey) internal view returns (uint) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                keccak256(abi.encodePacked(SETTING_EXCHANGE_FEE_RATE, currencyKey))
            );
    }

    /// @notice Get exchange dynamic fee related keys
    /// @return threshold, weight decay, rounds, and max fee
    function getExchangeDynamicFeeConfig() internal view returns (DynamicFeeConfig memory) {
        bytes32[] memory keys = new bytes32[](4);
        keys[0] = SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD;
        keys[1] = SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY;
        keys[2] = SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS;
        keys[3] = SETTING_EXCHANGE_MAX_DYNAMIC_FEE;
        uint[] memory values = flexibleStorage().getUIntValues(SETTING_CONTRACT_NAME, keys);
        return DynamicFeeConfig({threshold: values[0], weightDecay: values[1], rounds: values[2], maxFee: values[3]});
    }

    /* ========== End Exchange Related Fees ========== */

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

    function getPureChainlinkPriceForAtomicSwapsEnabled(bytes32 currencyKey) internal view returns (bool) {
        return
            flexibleStorage().getBoolValue(
                SETTING_CONTRACT_NAME,
                keccak256(abi.encodePacked(SETTING_PURE_CHAINLINK_PRICE_FOR_ATOMIC_SWAPS_ENABLED, currencyKey))
            );
    }

    function getCrossChainSynthTransferEnabled(bytes32 currencyKey) internal view returns (uint) {
        return
            flexibleStorage().getUIntValue(
                SETTING_CONTRACT_NAME,
                keccak256(abi.encodePacked(SETTING_CROSS_SYNTH_TRANSFER_ENABLED, currencyKey))
            );
    }

    function getExchangeMaxDynamicFee() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_MAX_DYNAMIC_FEE);
    }

    function getExchangeDynamicFeeRounds() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_DYNAMIC_FEE_ROUNDS);
    }

    function getExchangeDynamicFeeThreshold() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_DYNAMIC_FEE_THRESHOLD);
    }

    function getExchangeDynamicFeeWeightDecay() internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_EXCHANGE_DYNAMIC_FEE_WEIGHT_DECAY);
    }
}


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


// Inheritance


// Internal references


// Libraries


// https://docs.synthetix.io/contracts/source/contracts/etherwrapper
contract EtherWrapper is Owned, Pausable, MixinResolver, MixinSystemSettings, IEtherWrapper {
    using SafeMath for uint;
    using SafeDecimalMath for uint;

    /* ========== CONSTANTS ============== */

    /* ========== ENCODED NAMES ========== */

    bytes32 internal constant sUSD = "sUSD";
    bytes32 internal constant sETH = "sETH";
    bytes32 internal constant ETH = "ETH";
    bytes32 internal constant SNX = "SNX";

    /* ========== ADDRESS RESOLVER CONFIGURATION ========== */
    bytes32 private constant CONTRACT_SYNTHSETH = "SynthsETH";
    bytes32 private constant CONTRACT_SYNTHSUSD = "SynthsUSD";
    bytes32 private constant CONTRACT_ISSUER = "Issuer";
    bytes32 private constant CONTRACT_EXRATES = "ExchangeRates";
    bytes32 private constant CONTRACT_FEEPOOL = "FeePool";

    // ========== STATE VARIABLES ==========
    IWETH internal _weth;

    uint public sETHIssued = 0;
    uint public sUSDIssued = 0;
    uint public feesEscrowed = 0;

    constructor(
        address _owner,
        address _resolver,
        address payable _WETH
    ) public Owned(_owner) Pausable() MixinSystemSettings(_resolver) {
        _weth = IWETH(_WETH);
    }

    /* ========== VIEWS ========== */
    function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
        bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired();
        bytes32[] memory newAddresses = new bytes32[](5);
        newAddresses[0] = CONTRACT_SYNTHSETH;
        newAddresses[1] = CONTRACT_SYNTHSUSD;
        newAddresses[2] = CONTRACT_EXRATES;
        newAddresses[3] = CONTRACT_ISSUER;
        newAddresses[4] = CONTRACT_FEEPOOL;
        addresses = combineArrays(existingAddresses, newAddresses);
        return addresses;
    }

    /* ========== INTERNAL VIEWS ========== */
    function synthsUSD() internal view returns (ISynth) {
        return ISynth(requireAndGetAddress(CONTRACT_SYNTHSUSD));
    }

    function synthsETH() internal view returns (ISynth) {
        return ISynth(requireAndGetAddress(CONTRACT_SYNTHSETH));
    }

    function feePool() internal view returns (IFeePool) {
        return IFeePool(requireAndGetAddress(CONTRACT_FEEPOOL));
    }

    function exchangeRates() internal view returns (IExchangeRates) {
        return IExchangeRates(requireAndGetAddress(CONTRACT_EXRATES));
    }

    function issuer() internal view returns (IIssuer) {
        return IIssuer(requireAndGetAddress(CONTRACT_ISSUER));
    }

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

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

    function capacity() public view returns (uint _capacity) {
        // capacity = max(maxETH - balance, 0)
        uint balance = getReserves();
        if (balance >= maxETH()) {
            return 0;
        }
        return maxETH().sub(balance);
    }

    function getReserves() public view returns (uint) {
        return _weth.balanceOf(address(this));
    }

    function totalIssuedSynths() public view returns (uint) {
        // This contract issues two different synths:
        // 1. sETH
        // 2. sUSD
        //
        // The sETH is always backed 1:1 with WETH.
        // The sUSD fees are backed by sETH that is withheld during minting and burning.
        return exchangeRates().effectiveValue(sETH, sETHIssued, sUSD).add(sUSDIssued);
    }

    function calculateMintFee(uint amount) public view returns (uint) {
        return amount.multiplyDecimalRound(mintFeeRate());
    }

    function calculateBurnFee(uint amount) public view returns (uint) {
        return amount.multiplyDecimalRound(burnFeeRate());
    }

    function maxETH() public view returns (uint256) {
        return getEtherWrapperMaxETH();
    }

    function mintFeeRate() public view returns (uint256) {
        return getEtherWrapperMintFeeRate();
    }

    function burnFeeRate() public view returns (uint256) {
        return getEtherWrapperBurnFeeRate();
    }

    function weth() public view returns (IWETH) {
        return _weth;
    }

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

    // Transfers `amountIn` WETH to mint `amountIn - fees` sETH.
    // `amountIn` is inclusive of fees, calculable via `calculateMintFee`.
    function mint(uint amountIn) external notPaused {
        require(amountIn <= _weth.allowance(msg.sender, address(this)), "Allowance not high enough");
        require(amountIn <= _weth.balanceOf(msg.sender), "Balance is too low");

        uint currentCapacity = capacity();
        require(currentCapacity > 0, "Contract has no spare capacity to mint");

        if (amountIn < currentCapacity) {
            _mint(amountIn);
        } else {
            _mint(currentCapacity);
        }
    }

    // Burns `amountIn` sETH for `amountIn - fees` WETH.
    // `amountIn` is inclusive of fees, calculable via `calculateBurnFee`.
    function burn(uint amountIn) external notPaused {
        uint reserves = getReserves();
        require(reserves > 0, "Contract cannot burn sETH for WETH, WETH balance is zero");

        // principal = [amountIn / (1 + burnFeeRate)]
        uint principal = amountIn.divideDecimalRound(SafeDecimalMath.unit().add(burnFeeRate()));

        if (principal < reserves) {
            _burn(principal, amountIn);
        } else {
            _burn(reserves, reserves.add(calculateBurnFee(reserves)));
        }
    }

    function distributeFees() external {
        // Normalize fee to sUSD
        require(!exchangeRates().rateIsInvalid(sETH), "Currency rate is invalid");
        uint amountSUSD = exchangeRates().effectiveValue(sETH, feesEscrowed, sUSD);

        // Burn sETH.
        synthsETH().burn(address(this), feesEscrowed);
        // Pay down as much sETH debt as we burn. Any other debt is taken on by the stakers.
        sETHIssued = sETHIssued < feesEscrowed ? 0 : sETHIssued.sub(feesEscrowed);

        // Issue sUSD to the fee pool
        issuer().synths(sUSD).issue(feePool().FEE_ADDRESS(), amountSUSD);
        sUSDIssued = sUSDIssued.add(amountSUSD);

        // Tell the fee pool about this
        feePool().recordFeePaid(amountSUSD);

        feesEscrowed = 0;
    }

    // ========== RESTRICTED ==========

    /**
     * @notice Fallback function
     */
    function() external payable {
        revert("Fallback disabled, use mint()");
    }

    /* ========== INTERNAL FUNCTIONS ========== */

    function _mint(uint amountIn) internal {
        // Calculate minting fee.
        uint feeAmountEth = calculateMintFee(amountIn);
        uint principal = amountIn.sub(feeAmountEth);

        // Transfer WETH from user.
        _weth.transferFrom(msg.sender, address(this), amountIn);

        // Mint `amountIn - fees` sETH to user.
        synthsETH().issue(msg.sender, principal);

        // Escrow fee.
        synthsETH().issue(address(this), feeAmountEth);
        feesEscrowed = feesEscrowed.add(feeAmountEth);

        // Add sETH debt.
        sETHIssued = sETHIssued.add(amountIn);

        emit Minted(msg.sender, principal, feeAmountEth, amountIn);
    }

    function _burn(uint principal, uint amountIn) internal {
        // for burn, amount is inclusive of the fee.
        uint feeAmountEth = amountIn.sub(principal);

        require(amountIn <= IERC20(address(synthsETH())).allowance(msg.sender, address(this)), "Allowance not high enough");
        require(amountIn <= IERC20(address(synthsETH())).balanceOf(msg.sender), "Balance is too low");

        // Burn `amountIn` sETH from user.
        synthsETH().burn(msg.sender, amountIn);
        // sETH debt is repaid by burning.
        sETHIssued = sETHIssued < principal ? 0 : sETHIssued.sub(principal);

        // We use burn/issue instead of burning the principal and transferring the fee.
        // This saves an approval and is cheaper.
        // Escrow fee.
        synthsETH().issue(address(this), feeAmountEth);
        // We don't update sETHIssued, as only the principal was subtracted earlier.
        feesEscrowed = feesEscrowed.add(feeAmountEth);

        // Transfer `amount - fees` WETH to user.
        _weth.transfer(msg.sender, principal);

        emit Burned(msg.sender, principal, feeAmountEth, amountIn);
    }

    /* ========== EVENTS ========== */
    event Minted(address indexed account, uint principal, uint fee, uint amountIn);
    event Burned(address indexed account, uint principal, uint fee, uint amountIn);
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_resolver","type":"address"},{"internalType":"address payable","name":"_WETH","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"principal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"Burned","type":"event"},{"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":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"principal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"Minted","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":"bool","name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"burnFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateBurnFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateMintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"capacity","outputs":[{"internalType":"uint256","name":"_capacity","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"distributeFees","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feesEscrowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"mintFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebuildCache","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":[],"name":"sETHIssued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"sUSDIssued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalIssuedSynths","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"weth","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

60806040526000600655600060075560006008553480156200002057600080fd5b506040516200275438038062002754833981016040819052620000439162000150565b8180846001600160a01b038116620000785760405162461bcd60e51b81526004016200006f9062000262565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0383161781556040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91620000c59184906200022a565b60405180910390a1506000546001600160a01b0316620000f95760405162461bcd60e51b81526004016200006f9062000250565b60038054610100600160a81b0319166101006001600160a01b0393841602179055600580546001600160a01b031916939091169290921790915550620002bd915050565b80516200014a81620002a3565b92915050565b6000806000606084860312156200016657600080fd5b60006200017486866200013d565b935050602062000187868287016200013d565b92505060406200019a868287016200013d565b9150509250925092565b620001af816200028f565b82525050565b620001af816200027d565b6000620001cf60118362000274565b7013dddb995c881b5d5cdd081899481cd95d607a1b815260200192915050565b6000620001fe60198362000274565b7f4f776e657220616464726573732063616e6e6f74206265203000000000000000815260200192915050565b604081016200023a8285620001a4565b620002496020830184620001b5565b9392505050565b602080825281016200014a81620001c0565b602080825281016200014a81620001ef565b90815260200190565b60006001600160a01b0382166200014a565b60006200014a8260006200014a826200027d565b620002ae816200027d565b8114620002ba57600080fd5b50565b61248780620002cd6000396000f3fe6080604052600436106101815760003560e01c80635cfc1a51116100d1578063899ffef41161008a578063a02a76f111610064578063a02a76f1146103f3578063a0712d6814610408578063bb57ad2014610428578063ee5f3f5c1461043d57610181565b8063899ffef4146103a75780638da5cb5b146103c957806391b4ded9146103de57610181565b80635cfc1a511461031e57806368eb5e4f146103335780636ad8826914610348578063741853601461036857806375d920a91461037d57806379ba50971461039257610181565b80632af64bd31161013e578063509bf42a11610118578063509bf42a146102b257806353a47bb7146102c75780635c095e54146102e95780635c975abb1461030957610181565b80632af64bd31461025b5780633fc8cef31461027d57806342966c681461029257610181565b806302814b86146101a257806304f3bcec146101cd5780630902f1ac146101ef5780631627540c1461020457806316c38b3c1461022657806318819a3114610246575b60405162461bcd60e51b8152600401610199906122d1565b60405180910390fd5b3480156101ae57600080fd5b506101b7610452565b6040516101c4919061223d565b60405180910390f35b3480156101d957600080fd5b506101e2610462565b6040516101c491906122a2565b3480156101fb57600080fd5b506101b7610476565b34801561021057600080fd5b5061022461021f366004611bb2565b6104f7565b005b34801561023257600080fd5b50610224610241366004611bf6565b610555565b34801561025257600080fd5b506101b76105ca565b34801561026757600080fd5b506102706105d4565b6040516101c4919061222f565b34801561028957600080fd5b506101e26106f0565b34801561029e57600080fd5b506102246102ad366004611c50565b6106ff565b3480156102be57600080fd5b506101b7610833565b3480156102d357600080fd5b506102dc61083d565b6040516101c4919061217b565b3480156102f557600080fd5b506101b7610304366004611c50565b61084c565b34801561031557600080fd5b5061027061086c565b34801561032a57600080fd5b506101b7610875565b34801561033f57600080fd5b506101b76108b8565b34801561035457600080fd5b506101b7610363366004611c50565b6108be565b34801561037457600080fd5b506102246108cb565b34801561038957600080fd5b506101b7610a21565b34801561039e57600080fd5b50610224610a27565b3480156103b357600080fd5b506103bc610ac3565b6040516101c4919061221e565b3480156103d557600080fd5b506102dc610bc3565b3480156103ea57600080fd5b506101b7610bd2565b3480156103ff57600080fd5b506101b7610bd8565b34801561041457600080fd5b50610224610423366004611c50565b610bde565b34801561043457600080fd5b50610224610d8c565b34801561044957600080fd5b506101b7611146565b600061045c6111c1565b90505b90565b60035461010090046001600160a01b031681565b6005546040516370a0823160e01b81526000916001600160a01b0316906370a08231906104a7903090600401612189565b60206040518083038186803b1580156104bf57600080fd5b505afa1580156104d3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061045c9190810190611c6e565b6104ff61121e565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229061054a90839061217b565b60405180910390a150565b61055d61121e565b60035460ff1615158115151415610573576105c7565b6003805460ff1916821515179081905560ff161561059057426002555b6003546040517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59161054a9160ff9091169061222f565b50565b600061045c61124a565b600060606105e0610ac3565b905060005b81518110156106e75760008282815181106105fc57fe5b60209081029190910181015160008181526004928390526040908190205460035491516321f8a72160e01b81529294506001600160a01b039081169361010090920416916321f8a721916106529186910161223d565b60206040518083038186803b15801561066a57600080fd5b505afa15801561067e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106a29190810190611bd8565b6001600160a01b03161415806106cd57506000818152600460205260409020546001600160a01b0316155b156106de576000935050505061045f565b506001016105e5565b50600191505090565b6005546001600160a01b031690565b60035460ff16156107225760405162461bcd60e51b815260040161019990612361565b600061072c610476565b90506000811161074e5760405162461bcd60e51b815260040161019990612381565b60006107f36107e661075e610833565b739d6d846d4546614a7e668e66886624c0ae21d78663907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a257600080fd5b505af41580156107b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107da9190810190611c6e565b9063ffffffff6112b216565b849063ffffffff6112de16565b90508181101561080c5761080781846112f3565b61082e565b61082e8261082961081c856108be565b859063ffffffff6112b216565b6112f3565b505050565b600061045c611628565b6001546001600160a01b031681565b60006108666108596105ca565b839063ffffffff61169016565b92915050565b60035460ff1681565b600080610880610476565b905061088a610452565b811061089a57600091505061045f565b6108b2816108a6610452565b9063ffffffff6116a516565b91505090565b60065481565b6000610866610859610833565b60606108d5610ac3565b905060005b8151811015610a1d5760008282815181106108f157fe5b602002602001015190506000600360019054906101000a90046001600160a01b03166001600160a01b031663dacb2d0183846040516020016109339190612170565b6040516020818303038152906040526040518363ffffffff1660e01b815260040161095f929190612267565b60206040518083038186803b15801561097757600080fd5b505afa15801561098b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109af9190810190611bd8565b6000838152600460205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa6890610a0b908490849061224b565b60405180910390a150506001016108da565b5050565b60085481565b6001546001600160a01b03163314610a515760405162461bcd60e51b8152600401610199906122c1565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92610a94926001600160a01b03918216929116906121f5565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b606080610ace6116cd565b60408051600580825260c08201909252919250606091906020820160a080388339019050509050680a6f2dce8d0e68aa8960bb1b81600081518110610b0f57fe5b6020026020010181815250506814de5b9d1a1cd554d160ba1b81600181518110610b3557fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110610b5f57fe5b6020026020010181815250506524b9b9bab2b960d11b81600381518110610b8257fe5b60200260200101818152505066119959541bdbdb60ca1b81600481518110610ba657fe5b602002602001018181525050610bbc828261171e565b9250505090565b6000546001600160a01b031681565b60025481565b60075481565b60035460ff1615610c015760405162461bcd60e51b815260040161019990612361565b600554604051636eb1769f60e11b81526001600160a01b039091169063dd62ed3e90610c339033903090600401612197565b60206040518083038186803b158015610c4b57600080fd5b505afa158015610c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c839190810190611c6e565b811115610ca25760405162461bcd60e51b8152600401610199906122e1565b6005546040516370a0823160e01b81526001600160a01b03909116906370a0823190610cd2903390600401612189565b60206040518083038186803b158015610cea57600080fd5b505afa158015610cfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d229190810190611c6e565b811115610d415760405162461bcd60e51b815260040161019990612351565b6000610d4b610875565b905060008111610d6d5760405162461bcd60e51b815260040161019990612371565b80821015610d8357610d7e826117da565b610a1d565b610a1d816117da565b610d946119b2565b6001600160a01b0316632528f0fe630e68aa8960e31b6040518263ffffffff1660e01b8152600401610dc6919061223d565b60206040518083038186803b158015610dde57600080fd5b505afa158015610df2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e169190810190611c14565b15610e335760405162461bcd60e51b815260040161019990612301565b6000610e3d6119b2565b6001600160a01b031663654a60ac630e68aa8960e31b600854631cd554d160e21b6040518463ffffffff1660e01b8152600401610e7c93929190612287565b60206040518083038186803b158015610e9457600080fd5b505afa158015610ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ecc9190810190611c6e565b9050610ed66119cd565b6001600160a01b0316639dc29fac306008546040518363ffffffff1660e01b8152600401610f059291906121da565b600060405180830381600087803b158015610f1f57600080fd5b505af1158015610f33573d6000803e3d6000fd5b5050505060085460065410610f5c57600854600654610f579163ffffffff6116a516565b610f5f565b60005b600655610f6a6119e4565b6001600160a01b03166332608039631cd554d160e21b6040518263ffffffff1660e01b8152600401610f9c919061223d565b60206040518083038186803b158015610fb457600080fd5b505afa158015610fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610fec9190810190611c32565b6001600160a01b031663867904b46110026119f8565b6001600160a01b031663eb1edd616040518163ffffffff1660e01b815260040160206040518083038186803b15801561103a57600080fd5b505afa15801561104e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110729190810190611bd8565b836040518363ffffffff1660e01b8152600401611090929190612210565b600060405180830381600087803b1580156110aa57600080fd5b505af11580156110be573d6000803e3d6000fd5b50506007546110d6925090508263ffffffff6112b216565b6007556110e16119f8565b6001600160a01b03166322bf55ef826040518263ffffffff1660e01b815260040161110c919061223d565b600060405180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b50506000600855505050565b600061045c6007546111566119b2565b6001600160a01b031663654a60ac630e68aa8960e31b600654631cd554d160e21b6040518463ffffffff1660e01b815260040161119593929190612287565b60206040518083038186803b1580156111ad57600080fd5b505afa1580156107b6573d6000803e3d6000fd5b60006111cb611a0d565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b710cae8d0cae4aee4c2e0e0cae49ac2f08aa8960731b6040518363ffffffff1660e01b81526004016104a7929190612259565b6000546001600160a01b031633146112485760405162461bcd60e51b815260040161019990612331565b565b6000611254611a0d565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724d696e74466565526174650000000000000000006040518363ffffffff1660e01b81526004016104a7929190612259565b6000828201838110156112d75760405162461bcd60e51b8152600401610199906122f1565b9392505050565b60006112d78383670de0b6b3a7640000611a2a565b6000611305828463ffffffff6116a516565b905061130f6119cd565b6001600160a01b031663dd62ed3e33306040518363ffffffff1660e01b815260040161133c929190612197565b60206040518083038186803b15801561135457600080fd5b505afa158015611368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061138c9190810190611c6e565b8211156113ab5760405162461bcd60e51b8152600401610199906122e1565b6113b36119cd565b6001600160a01b03166370a08231336040518263ffffffff1660e01b81526004016113de9190612189565b60206040518083038186803b1580156113f657600080fd5b505afa15801561140a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061142e9190810190611c6e565b82111561144d5760405162461bcd60e51b815260040161019990612351565b6114556119cd565b6001600160a01b0316639dc29fac33846040518363ffffffff1660e01b81526004016114829291906121da565b600060405180830381600087803b15801561149c57600080fd5b505af11580156114b0573d6000803e3d6000fd5b5050505082600654106114d5576006546114d0908463ffffffff6116a516565b6114d8565b60005b6006556114e36119cd565b6001600160a01b031663867904b430836040518363ffffffff1660e01b81526004016115109291906121da565b600060405180830381600087803b15801561152a57600080fd5b505af115801561153e573d6000803e3d6000fd5b5050600854611556925090508263ffffffff6112b216565b60085560055460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb9061158b90339087906004016121da565b602060405180830381600087803b1580156115a557600080fd5b505af11580156115b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115dd9190810190611c14565b50336001600160a01b03167f4c60206a5c1de41f3376d1d60f0949d96cb682033c90b1c2d9d9a62d4c4120c084838560405161161b93929190612287565b60405180910390a2505050565b6000611632611a0d565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724275726e466565526174650000000000000000006040518363ffffffff1660e01b81526004016104a7929190612259565b60006112d78383670de0b6b3a7640000611a6e565b6000828211156116c75760405162461bcd60e51b815260040161019990612311565b50900390565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b8160008151811061170f57fe5b60200260200101818152505090565b6060815183510160405190808252806020026020018201604052801561174e578160200160208202803883390190505b50905060005b83518110156117905783818151811061176957fe5b602002602001015182828151811061177d57fe5b6020908102919091010152600101611754565b5060005b82518110156117d3578281815181106117a957fe5b60200260200101518282865101815181106117c057fe5b6020908102919091010152600101611794565b5092915050565b60006117e58261084c565b905060006117f9838363ffffffff6116a516565b6005546040516323b872dd60e01b81529192506001600160a01b0316906323b872dd9061182e903390309088906004016121b2565b602060405180830381600087803b15801561184857600080fd5b505af115801561185c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118809190810190611c14565b506118896119cd565b6001600160a01b031663867904b433836040518363ffffffff1660e01b81526004016118b69291906121da565b600060405180830381600087803b1580156118d057600080fd5b505af11580156118e4573d6000803e3d6000fd5b505050506118f06119cd565b6001600160a01b031663867904b430846040518363ffffffff1660e01b815260040161191d9291906121da565b600060405180830381600087803b15801561193757600080fd5b505af115801561194b573d6000803e3d6000fd5b5050600854611963925090508363ffffffff6112b216565b600855600654611979908463ffffffff6112b216565b60065560405133907f5a3358a3d27a5373c0df2604662088d37894d56b7cfd27f315770440f4e0d9199061161b90849086908890612287565b600061045c6c45786368616e6765526174657360981b611a99565b600061045c680a6f2dce8d0e68aa8960bb1b611a99565b600061045c6524b9b9bab2b960d11b611a99565b600061045c66119959541bdbdb60ca1b611a99565b600061045c6e466c657869626c6553746f7261676560881b611a99565b600080611a5084611a4487600a870263ffffffff611af616565b9063ffffffff611b3016565b90506005600a825b0610611a6257600a015b600a9004949350505050565b600080600a8304611a85868663ffffffff611af616565b81611a8c57fe5b0490506005600a82611a58565b60008181526004602090815260408083205490516001600160a01b039091169182151591611ac991869101612150565b604051602081830303815290604052906117d35760405162461bcd60e51b815260040161019991906122b0565b600082611b0557506000610866565b82820282848281611b1257fe5b04146112d75760405162461bcd60e51b815260040161019990612341565b6000808211611b515760405162461bcd60e51b815260040161019990612321565b6000828481611b5c57fe5b04949350505050565b803561086681612415565b805161086681612415565b803561086681612429565b805161086681612429565b805161086681612432565b80356108668161243b565b80516108668161243b565b600060208284031215611bc457600080fd5b6000611bd08484611b65565b949350505050565b600060208284031215611bea57600080fd5b6000611bd08484611b70565b600060208284031215611c0857600080fd5b6000611bd08484611b7b565b600060208284031215611c2657600080fd5b6000611bd08484611b86565b600060208284031215611c4457600080fd5b6000611bd08484611b91565b600060208284031215611c6257600080fd5b6000611bd08484611b9c565b600060208284031215611c8057600080fd5b6000611bd08484611ba7565b6000611c988383611d1a565b505060200190565b611ca9816123d0565b82525050565b611ca9816123a9565b6000611cc382612397565b611ccd818561239b565b9350611cd883612391565b8060005b83811015611d06578151611cf08882611c8c565b9750611cfb83612391565b925050600101611cdc565b509495945050505050565b611ca9816123b4565b611ca98161045f565b611ca9611d2f8261045f565b61045f565b611ca9816123b9565b6000611d4882612397565b611d52818561239b565b9350611d628185602086016123db565b611d6b8161240b565b9093019392505050565b6000611d8260358361239b565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b6000611dd9601d8361239b565b7f46616c6c6261636b2064697361626c65642c20757365206d696e742829000000815260200192915050565b6000611e1260198361239b565b7f416c6c6f77616e6365206e6f74206869676820656e6f75676800000000000000815260200192915050565b6000611e4b601b8361239b565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000611e8460188361239b565b7f43757272656e6379207261746520697320696e76616c69640000000000000000815260200192915050565b6000611ebd601e8361239b565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000611ef6601a8361239b565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b6000611f2f6011836123a4565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b6000611f5c602f8361239b565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b6000611fad60218361239b565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b6000611ff060128361239b565b7142616c616e636520697320746f6f206c6f7760701b815260200192915050565b600061201e603c8361239b565b7f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642081527f7768696c652074686520636f6e74726163742069732070617573656400000000602082015260400192915050565b600061207d6019836123a4565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b60006120b660268361239b565b7f436f6e747261637420686173206e6f20737061726520636170616369747920748152651bc81b5a5b9d60d21b602082015260400192915050565b60006120fe60388361239b565b7f436f6e74726163742063616e6e6f74206275726e207345544820666f7220574581527f54482c20574554482062616c616e6365206973207a65726f0000000000000000602082015260400192915050565b600061215b82611f22565b91506121678284611d23565b50602001919050565b600061215b82612070565b602081016108668284611caf565b602081016108668284611ca0565b604081016121a58285611ca0565b6112d76020830184611ca0565b606081016121c08286611ca0565b6121cd6020830185611ca0565b611bd06040830184611d1a565b604081016121e88285611ca0565b6112d76020830184611d1a565b604081016122038285611caf565b6112d76020830184611caf565b604081016121e88285611caf565b602080825281016112d78184611cb8565b602081016108668284611d11565b602081016108668284611d1a565b604081016122038285611d1a565b604081016121e88285611d1a565b604081016122758285611d1a565b8181036020830152611bd08184611d3d565b606081016122958286611d1a565b6121cd6020830185611d1a565b602081016108668284611d34565b602080825281016112d78184611d3d565b6020808252810161086681611d75565b6020808252810161086681611dcc565b6020808252810161086681611e05565b6020808252810161086681611e3e565b6020808252810161086681611e77565b6020808252810161086681611eb0565b6020808252810161086681611ee9565b6020808252810161086681611f4f565b6020808252810161086681611fa0565b6020808252810161086681611fe3565b6020808252810161086681612011565b60208082528101610866816120a9565b60208082528101610866816120f1565b60200190565b5190565b90815260200190565b919050565b6000610866826123c4565b151590565b6000610866826123a9565b6001600160a01b031690565b6000610866826123b9565b60005b838110156123f65781810151838201526020016123de565b83811115612405576000848401525b50505050565b601f01601f191690565b61241e816123a9565b81146105c757600080fd5b61241e816123b4565b61241e816123b9565b61241e8161045f56fea365627a7a72315820f8efc17dab3155057d699d2274354d1f9ac183315200d1ccbd5fb0379416fc716c6578706572696d656e74616cf564736f6c6343000510004000000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee9000000000000000000000000b61a6af69e992e1bed69b0ae0cba5143ca25d4d10000000000000000000000007b79995e5f793a07bc00c21412e50ecae098e7f9

Deployed Bytecode

0x6080604052600436106101815760003560e01c80635cfc1a51116100d1578063899ffef41161008a578063a02a76f111610064578063a02a76f1146103f3578063a0712d6814610408578063bb57ad2014610428578063ee5f3f5c1461043d57610181565b8063899ffef4146103a75780638da5cb5b146103c957806391b4ded9146103de57610181565b80635cfc1a511461031e57806368eb5e4f146103335780636ad8826914610348578063741853601461036857806375d920a91461037d57806379ba50971461039257610181565b80632af64bd31161013e578063509bf42a11610118578063509bf42a146102b257806353a47bb7146102c75780635c095e54146102e95780635c975abb1461030957610181565b80632af64bd31461025b5780633fc8cef31461027d57806342966c681461029257610181565b806302814b86146101a257806304f3bcec146101cd5780630902f1ac146101ef5780631627540c1461020457806316c38b3c1461022657806318819a3114610246575b60405162461bcd60e51b8152600401610199906122d1565b60405180910390fd5b3480156101ae57600080fd5b506101b7610452565b6040516101c4919061223d565b60405180910390f35b3480156101d957600080fd5b506101e2610462565b6040516101c491906122a2565b3480156101fb57600080fd5b506101b7610476565b34801561021057600080fd5b5061022461021f366004611bb2565b6104f7565b005b34801561023257600080fd5b50610224610241366004611bf6565b610555565b34801561025257600080fd5b506101b76105ca565b34801561026757600080fd5b506102706105d4565b6040516101c4919061222f565b34801561028957600080fd5b506101e26106f0565b34801561029e57600080fd5b506102246102ad366004611c50565b6106ff565b3480156102be57600080fd5b506101b7610833565b3480156102d357600080fd5b506102dc61083d565b6040516101c4919061217b565b3480156102f557600080fd5b506101b7610304366004611c50565b61084c565b34801561031557600080fd5b5061027061086c565b34801561032a57600080fd5b506101b7610875565b34801561033f57600080fd5b506101b76108b8565b34801561035457600080fd5b506101b7610363366004611c50565b6108be565b34801561037457600080fd5b506102246108cb565b34801561038957600080fd5b506101b7610a21565b34801561039e57600080fd5b50610224610a27565b3480156103b357600080fd5b506103bc610ac3565b6040516101c4919061221e565b3480156103d557600080fd5b506102dc610bc3565b3480156103ea57600080fd5b506101b7610bd2565b3480156103ff57600080fd5b506101b7610bd8565b34801561041457600080fd5b50610224610423366004611c50565b610bde565b34801561043457600080fd5b50610224610d8c565b34801561044957600080fd5b506101b7611146565b600061045c6111c1565b90505b90565b60035461010090046001600160a01b031681565b6005546040516370a0823160e01b81526000916001600160a01b0316906370a08231906104a7903090600401612189565b60206040518083038186803b1580156104bf57600080fd5b505afa1580156104d3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061045c9190810190611c6e565b6104ff61121e565b600180546001600160a01b0319166001600160a01b0383161790556040517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229061054a90839061217b565b60405180910390a150565b61055d61121e565b60035460ff1615158115151415610573576105c7565b6003805460ff1916821515179081905560ff161561059057426002555b6003546040517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59161054a9160ff9091169061222f565b50565b600061045c61124a565b600060606105e0610ac3565b905060005b81518110156106e75760008282815181106105fc57fe5b60209081029190910181015160008181526004928390526040908190205460035491516321f8a72160e01b81529294506001600160a01b039081169361010090920416916321f8a721916106529186910161223d565b60206040518083038186803b15801561066a57600080fd5b505afa15801561067e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506106a29190810190611bd8565b6001600160a01b03161415806106cd57506000818152600460205260409020546001600160a01b0316155b156106de576000935050505061045f565b506001016105e5565b50600191505090565b6005546001600160a01b031690565b60035460ff16156107225760405162461bcd60e51b815260040161019990612361565b600061072c610476565b90506000811161074e5760405162461bcd60e51b815260040161019990612381565b60006107f36107e661075e610833565b739d6d846d4546614a7e668e66886624c0ae21d78663907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a257600080fd5b505af41580156107b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107da9190810190611c6e565b9063ffffffff6112b216565b849063ffffffff6112de16565b90508181101561080c5761080781846112f3565b61082e565b61082e8261082961081c856108be565b859063ffffffff6112b216565b6112f3565b505050565b600061045c611628565b6001546001600160a01b031681565b60006108666108596105ca565b839063ffffffff61169016565b92915050565b60035460ff1681565b600080610880610476565b905061088a610452565b811061089a57600091505061045f565b6108b2816108a6610452565b9063ffffffff6116a516565b91505090565b60065481565b6000610866610859610833565b60606108d5610ac3565b905060005b8151811015610a1d5760008282815181106108f157fe5b602002602001015190506000600360019054906101000a90046001600160a01b03166001600160a01b031663dacb2d0183846040516020016109339190612170565b6040516020818303038152906040526040518363ffffffff1660e01b815260040161095f929190612267565b60206040518083038186803b15801561097757600080fd5b505afa15801561098b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109af9190810190611bd8565b6000838152600460205260409081902080546001600160a01b0319166001600160a01b038416179055519091507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa6890610a0b908490849061224b565b60405180910390a150506001016108da565b5050565b60085481565b6001546001600160a01b03163314610a515760405162461bcd60e51b8152600401610199906122c1565b6000546001546040517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c92610a94926001600160a01b03918216929116906121f5565b60405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b606080610ace6116cd565b60408051600580825260c08201909252919250606091906020820160a080388339019050509050680a6f2dce8d0e68aa8960bb1b81600081518110610b0f57fe5b6020026020010181815250506814de5b9d1a1cd554d160ba1b81600181518110610b3557fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110610b5f57fe5b6020026020010181815250506524b9b9bab2b960d11b81600381518110610b8257fe5b60200260200101818152505066119959541bdbdb60ca1b81600481518110610ba657fe5b602002602001018181525050610bbc828261171e565b9250505090565b6000546001600160a01b031681565b60025481565b60075481565b60035460ff1615610c015760405162461bcd60e51b815260040161019990612361565b600554604051636eb1769f60e11b81526001600160a01b039091169063dd62ed3e90610c339033903090600401612197565b60206040518083038186803b158015610c4b57600080fd5b505afa158015610c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c839190810190611c6e565b811115610ca25760405162461bcd60e51b8152600401610199906122e1565b6005546040516370a0823160e01b81526001600160a01b03909116906370a0823190610cd2903390600401612189565b60206040518083038186803b158015610cea57600080fd5b505afa158015610cfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d229190810190611c6e565b811115610d415760405162461bcd60e51b815260040161019990612351565b6000610d4b610875565b905060008111610d6d5760405162461bcd60e51b815260040161019990612371565b80821015610d8357610d7e826117da565b610a1d565b610a1d816117da565b610d946119b2565b6001600160a01b0316632528f0fe630e68aa8960e31b6040518263ffffffff1660e01b8152600401610dc6919061223d565b60206040518083038186803b158015610dde57600080fd5b505afa158015610df2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e169190810190611c14565b15610e335760405162461bcd60e51b815260040161019990612301565b6000610e3d6119b2565b6001600160a01b031663654a60ac630e68aa8960e31b600854631cd554d160e21b6040518463ffffffff1660e01b8152600401610e7c93929190612287565b60206040518083038186803b158015610e9457600080fd5b505afa158015610ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ecc9190810190611c6e565b9050610ed66119cd565b6001600160a01b0316639dc29fac306008546040518363ffffffff1660e01b8152600401610f059291906121da565b600060405180830381600087803b158015610f1f57600080fd5b505af1158015610f33573d6000803e3d6000fd5b5050505060085460065410610f5c57600854600654610f579163ffffffff6116a516565b610f5f565b60005b600655610f6a6119e4565b6001600160a01b03166332608039631cd554d160e21b6040518263ffffffff1660e01b8152600401610f9c919061223d565b60206040518083038186803b158015610fb457600080fd5b505afa158015610fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610fec9190810190611c32565b6001600160a01b031663867904b46110026119f8565b6001600160a01b031663eb1edd616040518163ffffffff1660e01b815260040160206040518083038186803b15801561103a57600080fd5b505afa15801561104e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506110729190810190611bd8565b836040518363ffffffff1660e01b8152600401611090929190612210565b600060405180830381600087803b1580156110aa57600080fd5b505af11580156110be573d6000803e3d6000fd5b50506007546110d6925090508263ffffffff6112b216565b6007556110e16119f8565b6001600160a01b03166322bf55ef826040518263ffffffff1660e01b815260040161110c919061223d565b600060405180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b50506000600855505050565b600061045c6007546111566119b2565b6001600160a01b031663654a60ac630e68aa8960e31b600654631cd554d160e21b6040518463ffffffff1660e01b815260040161119593929190612287565b60206040518083038186803b1580156111ad57600080fd5b505afa1580156107b6573d6000803e3d6000fd5b60006111cb611a0d565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b710cae8d0cae4aee4c2e0e0cae49ac2f08aa8960731b6040518363ffffffff1660e01b81526004016104a7929190612259565b6000546001600160a01b031633146112485760405162461bcd60e51b815260040161019990612331565b565b6000611254611a0d565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724d696e74466565526174650000000000000000006040518363ffffffff1660e01b81526004016104a7929190612259565b6000828201838110156112d75760405162461bcd60e51b8152600401610199906122f1565b9392505050565b60006112d78383670de0b6b3a7640000611a2a565b6000611305828463ffffffff6116a516565b905061130f6119cd565b6001600160a01b031663dd62ed3e33306040518363ffffffff1660e01b815260040161133c929190612197565b60206040518083038186803b15801561135457600080fd5b505afa158015611368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061138c9190810190611c6e565b8211156113ab5760405162461bcd60e51b8152600401610199906122e1565b6113b36119cd565b6001600160a01b03166370a08231336040518263ffffffff1660e01b81526004016113de9190612189565b60206040518083038186803b1580156113f657600080fd5b505afa15801561140a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061142e9190810190611c6e565b82111561144d5760405162461bcd60e51b815260040161019990612351565b6114556119cd565b6001600160a01b0316639dc29fac33846040518363ffffffff1660e01b81526004016114829291906121da565b600060405180830381600087803b15801561149c57600080fd5b505af11580156114b0573d6000803e3d6000fd5b5050505082600654106114d5576006546114d0908463ffffffff6116a516565b6114d8565b60005b6006556114e36119cd565b6001600160a01b031663867904b430836040518363ffffffff1660e01b81526004016115109291906121da565b600060405180830381600087803b15801561152a57600080fd5b505af115801561153e573d6000803e3d6000fd5b5050600854611556925090508263ffffffff6112b216565b60085560055460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb9061158b90339087906004016121da565b602060405180830381600087803b1580156115a557600080fd5b505af11580156115b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506115dd9190810190611c14565b50336001600160a01b03167f4c60206a5c1de41f3376d1d60f0949d96cb682033c90b1c2d9d9a62d4c4120c084838560405161161b93929190612287565b60405180910390a2505050565b6000611632611a0d565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724275726e466565526174650000000000000000006040518363ffffffff1660e01b81526004016104a7929190612259565b60006112d78383670de0b6b3a7640000611a6e565b6000828211156116c75760405162461bcd60e51b815260040161019990612311565b50900390565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b8160008151811061170f57fe5b60200260200101818152505090565b6060815183510160405190808252806020026020018201604052801561174e578160200160208202803883390190505b50905060005b83518110156117905783818151811061176957fe5b602002602001015182828151811061177d57fe5b6020908102919091010152600101611754565b5060005b82518110156117d3578281815181106117a957fe5b60200260200101518282865101815181106117c057fe5b6020908102919091010152600101611794565b5092915050565b60006117e58261084c565b905060006117f9838363ffffffff6116a516565b6005546040516323b872dd60e01b81529192506001600160a01b0316906323b872dd9061182e903390309088906004016121b2565b602060405180830381600087803b15801561184857600080fd5b505af115801561185c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506118809190810190611c14565b506118896119cd565b6001600160a01b031663867904b433836040518363ffffffff1660e01b81526004016118b69291906121da565b600060405180830381600087803b1580156118d057600080fd5b505af11580156118e4573d6000803e3d6000fd5b505050506118f06119cd565b6001600160a01b031663867904b430846040518363ffffffff1660e01b815260040161191d9291906121da565b600060405180830381600087803b15801561193757600080fd5b505af115801561194b573d6000803e3d6000fd5b5050600854611963925090508363ffffffff6112b216565b600855600654611979908463ffffffff6112b216565b60065560405133907f5a3358a3d27a5373c0df2604662088d37894d56b7cfd27f315770440f4e0d9199061161b90849086908890612287565b600061045c6c45786368616e6765526174657360981b611a99565b600061045c680a6f2dce8d0e68aa8960bb1b611a99565b600061045c6524b9b9bab2b960d11b611a99565b600061045c66119959541bdbdb60ca1b611a99565b600061045c6e466c657869626c6553746f7261676560881b611a99565b600080611a5084611a4487600a870263ffffffff611af616565b9063ffffffff611b3016565b90506005600a825b0610611a6257600a015b600a9004949350505050565b600080600a8304611a85868663ffffffff611af616565b81611a8c57fe5b0490506005600a82611a58565b60008181526004602090815260408083205490516001600160a01b039091169182151591611ac991869101612150565b604051602081830303815290604052906117d35760405162461bcd60e51b815260040161019991906122b0565b600082611b0557506000610866565b82820282848281611b1257fe5b04146112d75760405162461bcd60e51b815260040161019990612341565b6000808211611b515760405162461bcd60e51b815260040161019990612321565b6000828481611b5c57fe5b04949350505050565b803561086681612415565b805161086681612415565b803561086681612429565b805161086681612429565b805161086681612432565b80356108668161243b565b80516108668161243b565b600060208284031215611bc457600080fd5b6000611bd08484611b65565b949350505050565b600060208284031215611bea57600080fd5b6000611bd08484611b70565b600060208284031215611c0857600080fd5b6000611bd08484611b7b565b600060208284031215611c2657600080fd5b6000611bd08484611b86565b600060208284031215611c4457600080fd5b6000611bd08484611b91565b600060208284031215611c6257600080fd5b6000611bd08484611b9c565b600060208284031215611c8057600080fd5b6000611bd08484611ba7565b6000611c988383611d1a565b505060200190565b611ca9816123d0565b82525050565b611ca9816123a9565b6000611cc382612397565b611ccd818561239b565b9350611cd883612391565b8060005b83811015611d06578151611cf08882611c8c565b9750611cfb83612391565b925050600101611cdc565b509495945050505050565b611ca9816123b4565b611ca98161045f565b611ca9611d2f8261045f565b61045f565b611ca9816123b9565b6000611d4882612397565b611d52818561239b565b9350611d628185602086016123db565b611d6b8161240b565b9093019392505050565b6000611d8260358361239b565b7f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7581527402063616e20616363657074206f776e65727368697605c1b602082015260400192915050565b6000611dd9601d8361239b565b7f46616c6c6261636b2064697361626c65642c20757365206d696e742829000000815260200192915050565b6000611e1260198361239b565b7f416c6c6f77616e6365206e6f74206869676820656e6f75676800000000000000815260200192915050565b6000611e4b601b8361239b565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000815260200192915050565b6000611e8460188361239b565b7f43757272656e6379207261746520697320696e76616c69640000000000000000815260200192915050565b6000611ebd601e8361239b565b7f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815260200192915050565b6000611ef6601a8361239b565b7f536166654d6174683a206469766973696f6e206279207a65726f000000000000815260200192915050565b6000611f2f6011836123a4565b70026b4b9b9b4b7339030b2323932b9b99d1607d1b815260110192915050565b6000611f5c602f8361239b565b7f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726681526e37b936903a3434b99030b1ba34b7b760891b602082015260400192915050565b6000611fad60218361239b565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f8152607760f81b602082015260400192915050565b6000611ff060128361239b565b7142616c616e636520697320746f6f206c6f7760701b815260200192915050565b600061201e603c8361239b565b7f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642081527f7768696c652074686520636f6e74726163742069732070617573656400000000602082015260400192915050565b600061207d6019836123a4565b7f5265736f6c766572206d697373696e67207461726765743a2000000000000000815260190192915050565b60006120b660268361239b565b7f436f6e747261637420686173206e6f20737061726520636170616369747920748152651bc81b5a5b9d60d21b602082015260400192915050565b60006120fe60388361239b565b7f436f6e74726163742063616e6e6f74206275726e207345544820666f7220574581527f54482c20574554482062616c616e6365206973207a65726f0000000000000000602082015260400192915050565b600061215b82611f22565b91506121678284611d23565b50602001919050565b600061215b82612070565b602081016108668284611caf565b602081016108668284611ca0565b604081016121a58285611ca0565b6112d76020830184611ca0565b606081016121c08286611ca0565b6121cd6020830185611ca0565b611bd06040830184611d1a565b604081016121e88285611ca0565b6112d76020830184611d1a565b604081016122038285611caf565b6112d76020830184611caf565b604081016121e88285611caf565b602080825281016112d78184611cb8565b602081016108668284611d11565b602081016108668284611d1a565b604081016122038285611d1a565b604081016121e88285611d1a565b604081016122758285611d1a565b8181036020830152611bd08184611d3d565b606081016122958286611d1a565b6121cd6020830185611d1a565b602081016108668284611d34565b602080825281016112d78184611d3d565b6020808252810161086681611d75565b6020808252810161086681611dcc565b6020808252810161086681611e05565b6020808252810161086681611e3e565b6020808252810161086681611e77565b6020808252810161086681611eb0565b6020808252810161086681611ee9565b6020808252810161086681611f4f565b6020808252810161086681611fa0565b6020808252810161086681611fe3565b6020808252810161086681612011565b60208082528101610866816120a9565b60208082528101610866816120f1565b60200190565b5190565b90815260200190565b919050565b6000610866826123c4565b151590565b6000610866826123a9565b6001600160a01b031690565b6000610866826123b9565b60005b838110156123f65781810151838201526020016123de565b83811115612405576000848401525b50505050565b601f01601f191690565b61241e816123a9565b81146105c757600080fd5b61241e816123b4565b61241e816123b9565b61241e8161045f56fea365627a7a72315820f8efc17dab3155057d699d2274354d1f9ac183315200d1ccbd5fb0379416fc716c6578706572696d656e74616cf564736f6c63430005100040

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

00000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee9000000000000000000000000b61a6af69e992e1bed69b0ae0cba5143ca25d4d10000000000000000000000007b79995e5f793a07bc00c21412e50ecae098e7f9

-----Decoded View---------------
Arg [0] : _owner (address): 0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9
Arg [1] : _resolver (address): 0xb61a6aF69e992e1bed69b0aE0CBa5143CA25D4D1
Arg [2] : _WETH (address): 0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000048914229dedd5a9922f44441ffccfc2cb7856ee9
Arg [1] : 000000000000000000000000b61a6af69e992e1bed69b0ae0cba5143ca25d4d1
Arg [2] : 0000000000000000000000007b79995e5f793a07bc00c21412e50ecae098e7f9


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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