ETH Price: $3,428.49 (-2.07%)
Gas: 2 Gwei

Contract

0xC1AAE9d18bBe386B102435a8632C8063d31e747C
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Rebuild Cache151011092022-07-08 9:33:59716 days ago1657272839IN
Synthetix: Ether Wrapper
0 ETH0.001513518.542836
Mint127314362021-06-29 21:53:461090 days ago1625003626IN
Synthetix: Ether Wrapper
0 ETH0.0006303820
Mint125535472021-06-02 6:59:381117 days ago1622617178IN
Synthetix: Ether Wrapper
0 ETH0.0033874422.1
Mint125305062021-05-29 17:01:401121 days ago1622307700IN
Synthetix: Ether Wrapper
0 ETH0.0073170945
Mint124823342021-05-22 5:46:351128 days ago1621662395IN
Synthetix: Ether Wrapper
0 ETH0.0136587276
Mint124781132021-05-21 14:12:021129 days ago1621606322IN
Synthetix: Ether Wrapper
0 ETH0.013836984
Mint124779682021-05-21 13:35:401129 days ago1621604140IN
Synthetix: Ether Wrapper
0 ETH0.0123543775
Mint124771432021-05-21 10:21:241129 days ago1621592484IN
Synthetix: Ether Wrapper
0 ETH0.0084009751
Mint124766322021-05-21 8:29:571129 days ago1621585797IN
Synthetix: Ether Wrapper
0 ETH0.0097194859
Mint124764692021-05-21 7:55:261129 days ago1621583726IN
Synthetix: Ether Wrapper
0 ETH0.0063483943
Mint124268102021-05-13 15:24:461137 days ago1620919486IN
Synthetix: Ether Wrapper
0 ETH0.02537239154.04
Set Paused124264612021-05-13 14:05:511137 days ago1620914751IN
Synthetix: Ether Wrapper
0 ETH0.00510697170
Nominate New Own...124263562021-05-13 13:44:041137 days ago1620913444IN
Synthetix: Ether Wrapper
0 ETH0.009423200
Set Paused124257212021-05-13 11:18:141137 days ago1620904694IN
Synthetix: Ether Wrapper
0 ETH0.00964923185
0x60806040124256752021-05-13 11:08:221137 days ago1620904102IN
 Create: EtherWrapper
0 ETH0.398301200

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
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 2021-05-13
*/

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

* 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) 2021 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/



pragma solidity ^0.5.16;

// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
    address public owner;
    address public nominatedOwner;

    constructor(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}


// https://docs.synthetix.io/contracts/source/interfaces/iaddressresolver
interface IAddressResolver {
    function getAddress(bytes32 name) external view returns (address);

    function getSynth(bytes32 key) external view returns (address);

    function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}


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 anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid);

    function availableCurrencyKeys() external view returns (bytes32[] memory);

    function availableSynthCount() external view returns (uint);

    function availableSynths(uint index) external view returns (ISynth);

    function canBurnSynths(address account) external view returns (bool);

    function collateral(address account) external view returns (uint);

    function collateralisationRatio(address issuer) external view returns (uint);

    function collateralisationRatioAndAnyRatesInvalid(address _issuer)
        external
        view
        returns (uint cratio, bool anyRateIsInvalid);

    function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance);

    function issuanceRatio() external view returns (uint);

    function lastIssueEvent(address account) external view returns (uint);

    function maxIssuableSynths(address issuer) external view returns (uint maxIssuable);

    function minimumStakeTime() external view returns (uint);

    function remainingIssuableSynths(address issuer)
        external
        view
        returns (
            uint maxIssuable,
            uint alreadyIssued,
            uint totalSystemDebt
        );

    function synths(bytes32 currencyKey) external view returns (ISynth);

    function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory);

    function synthsByAddress(address synthAddress) external view returns (bytes32);

    function totalIssuedSynths(bytes32 currencyKey, bool excludeEtherCollateral) external view returns (uint);

    function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance)
        external
        view
        returns (uint transferable, bool anyRateIsInvalid);

    // Restricted: used internally to Synthetix
    function issueSynths(address from, uint amount) external;

    function issueSynthsOnBehalf(
        address issueFor,
        address from,
        uint amount
    ) external;

    function issueMaxSynths(address from) external;

    function issueMaxSynthsOnBehalf(address issueFor, address from) external;

    function burnSynths(address from, uint amount) external;

    function burnSynthsOnBehalf(
        address burnForAddress,
        address from,
        uint amount
    ) external;

    function burnSynthsToTarget(address from) external;

    function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external;

    function liquidateDelinquentAccount(
        address account,
        uint susdAmount,
        address liquidator
    ) external returns (uint totalRedeemed, uint amountToLiquidate);
}


// https://docs.synthetix.io/contracts/source/interfaces/iexchangerates
interface IExchangeRates {
    // Structs
    struct RateAndUpdatedTime {
        uint216 rate;
        uint40 time;
    }

    struct InversePricing {
        uint entryPoint;
        uint upperLimit;
        uint lowerLimit;
        bool frozenAtUpperLimit;
        bool frozenAtLowerLimit;
    }

    // Views
    function aggregators(bytes32 currencyKey) external view returns (address);

    function aggregatorWarningFlags() external view returns (address);

    function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool);

    function canFreezeRate(bytes32 currencyKey) external view returns (bool);

    function currentRoundForRate(bytes32 currencyKey) external view returns (uint);

    function currenciesUsingAggregator(address aggregator) external view returns (bytes32[] memory);

    function effectiveValue(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey
    ) external view returns (uint value);

    function effectiveValueAndRates(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey
    )
        external
        view
        returns (
            uint value,
            uint sourceRate,
            uint destinationRate
        );

    function effectiveValueAtRound(
        bytes32 sourceCurrencyKey,
        uint sourceAmount,
        bytes32 destinationCurrencyKey,
        uint roundIdForSrc,
        uint roundIdForDest
    ) external view returns (uint value);

    function getCurrentRoundId(bytes32 currencyKey) external view returns (uint);

    function getLastRoundIdBeforeElapsedSecs(
        bytes32 currencyKey,
        uint startingRoundId,
        uint startingTimestamp,
        uint timediff
    ) external view returns (uint);

    function inversePricing(bytes32 currencyKey)
        external
        view
        returns (
            uint entryPoint,
            uint upperLimit,
            uint lowerLimit,
            bool frozenAtUpperLimit,
            bool frozenAtLowerLimit
        );

    function lastRateUpdateTimes(bytes32 currencyKey) external view returns (uint256);

    function oracle() external view returns (address);

    function rateAndTimestampAtRound(bytes32 currencyKey, uint roundId) external view returns (uint rate, uint time);

    function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time);

    function rateAndInvalid(bytes32 currencyKey) external view returns (uint rate, bool isInvalid);

    function rateForCurrency(bytes32 currencyKey) external view returns (uint);

    function rateIsFlagged(bytes32 currencyKey) external view returns (bool);

    function rateIsFrozen(bytes32 currencyKey) external view returns (bool);

    function rateIsInvalid(bytes32 currencyKey) external view returns (bool);

    function rateIsStale(bytes32 currencyKey) external view returns (bool);

    function rateStalePeriod() external view returns (uint);

    function ratesAndUpdatedTimeForCurrencyLastNRounds(bytes32 currencyKey, uint numRounds)
        external
        view
        returns (uint[] memory rates, uint[] memory times);

    function ratesAndInvalidForCurrencies(bytes32[] calldata currencyKeys)
        external
        view
        returns (uint[] memory rates, bool anyRateInvalid);

    function ratesForCurrencies(bytes32[] calldata currencyKeys) external view returns (uint[] memory);

    // Mutative functions
    function freezeRate(bytes32 currencyKey) external;
}


// https://docs.synthetix.io/contracts/source/interfaces/ifeepool
interface IFeePool {
    // Views

    // solhint-disable-next-line func-name-mixedcase
    function FEE_ADDRESS() external view returns (address);

    function feesAvailable(address account) external view returns (uint, uint);

    function feePeriodDuration() external view returns (uint);

    function isFeesClaimable(address account) external view returns (bool);

    function targetThreshold() external view returns (uint);

    function totalFeesAvailable() external view returns (uint);

    function totalRewardsAvailable() external view returns (uint);

    // Mutative Functions
    function claimFees() external returns (bool);

    function claimOnBehalf(address claimingForAddress) external returns (bool);

    function closeCurrentFeePeriod() external;

    // Restricted: used internally to Synthetix
    function appendAccountIssuanceRecord(
        address account,
        uint lockedAmount,
        uint debtEntryIndex
    ) external;

    function recordFeePaid(uint sUSDAmount) external;

    function setRewardsToDistribute(uint amount) external;
}


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


// solhint-disable payable-fallback

// https://docs.synthetix.io/contracts/source/contracts/readproxy
contract ReadProxy is Owned {
    address public target;

    constructor(address _owner) public Owned(_owner) {}

    function setTarget(address _target) external onlyOwner {
        target = _target;
        emit TargetUpdated(target);
    }

    function() external {
        // The basics of a proxy read call
        // Note that msg.sender in the underlying will always be the address of this contract.
        assembly {
            calldatacopy(0, 0, calldatasize)

            // Use of staticcall - this will revert if the underlying function mutates state
            let result := staticcall(gas, sload(target_slot), 0, calldatasize, 0, 0)
            returndatacopy(0, 0, returndatasize)

            if iszero(result) {
                revert(0, returndatasize)
            }
            return(0, returndatasize)
        }
    }

    event TargetUpdated(address newTarget);
}


// Inheritance


// Internal references


// https://docs.synthetix.io/contracts/source/contracts/mixinresolver
contract MixinResolver {
    AddressResolver public resolver;

    mapping(bytes32 => address) private addressCache;

    constructor(address _resolver) internal {
        resolver = AddressResolver(_resolver);
    }

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

    function combineArrays(bytes32[] memory first, bytes32[] memory second)
        internal
        pure
        returns (bytes32[] memory combination)
    {
        combination = new bytes32[](first.length + second.length);

        for (uint i = 0; i < first.length; i++) {
            combination[i] = first[i];
        }

        for (uint j = 0; j < second.length; j++) {
            combination[first.length + j] = second[j];
        }
    }

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

    // Note: this function is public not external in order for it to be overridden and invoked via super in subclasses
    function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {}

    function rebuildCache() public {
        bytes32[] memory requiredAddresses = resolverAddressesRequired();
        // The resolver must call this function whenver it updates its state
        for (uint i = 0; i < requiredAddresses.length; i++) {
            bytes32 name = requiredAddresses[i];
            // Note: can only be invoked once the resolver has all the targets needed added
            address destination =
                resolver.requireAndGetAddress(name, string(abi.encodePacked("Resolver missing target: ", name)));
            addressCache[name] = destination;
            emit CacheUpdated(name, destination);
        }
    }

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

    function isResolverCached() external view returns (bool) {
        bytes32[] memory requiredAddresses = resolverAddressesRequired();
        for (uint i = 0; i < requiredAddresses.length; i++) {
            bytes32 name = requiredAddresses[i];
            // false if our cache is invalid or if the resolver doesn't have the required address
            if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) {
                return false;
            }
        }

        return true;
    }

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

    function requireAndGetAddress(bytes32 name) internal view returns (address) {
        address _foundAddress = addressCache[name];
        require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name)));
        return _foundAddress;
    }

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

    event CacheUpdated(bytes32 name, address destination);
}


// https://docs.synthetix.io/contracts/source/interfaces/iflexiblestorage
interface IFlexibleStorage {
    // Views
    function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint);

    function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory);

    function getIntValue(bytes32 contractName, bytes32 record) external view returns (int);

    function getIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (int[] memory);

    function getAddressValue(bytes32 contractName, bytes32 record) external view returns (address);

    function getAddressValues(bytes32 contractName, bytes32[] calldata records) external view returns (address[] memory);

    function getBoolValue(bytes32 contractName, bytes32 record) external view returns (bool);

    function getBoolValues(bytes32 contractName, bytes32[] calldata records) external view returns (bool[] memory);

    function getBytes32Value(bytes32 contractName, bytes32 record) external view returns (bytes32);

    function getBytes32Values(bytes32 contractName, bytes32[] calldata records) external view returns (bytes32[] memory);

    // Mutative functions
    function deleteUIntValue(bytes32 contractName, bytes32 record) external;

    function deleteIntValue(bytes32 contractName, bytes32 record) external;

    function deleteAddressValue(bytes32 contractName, bytes32 record) external;

    function deleteBoolValue(bytes32 contractName, bytes32 record) external;

    function deleteBytes32Value(bytes32 contractName, bytes32 record) external;

    function setUIntValue(
        bytes32 contractName,
        bytes32 record,
        uint value
    ) external;

    function setUIntValues(
        bytes32 contractName,
        bytes32[] calldata records,
        uint[] calldata values
    ) external;

    function setIntValue(
        bytes32 contractName,
        bytes32 record,
        int value
    ) external;

    function setIntValues(
        bytes32 contractName,
        bytes32[] calldata records,
        int[] calldata values
    ) external;

    function setAddressValue(
        bytes32 contractName,
        bytes32 record,
        address value
    ) external;

    function setAddressValues(
        bytes32 contractName,
        bytes32[] calldata records,
        address[] calldata values
    ) external;

    function setBoolValue(
        bytes32 contractName,
        bytes32 record,
        bool value
    ) external;

    function setBoolValues(
        bytes32 contractName,
        bytes32[] calldata records,
        bool[] calldata values
    ) external;

    function setBytes32Value(
        bytes32 contractName,
        bytes32 record,
        bytes32 value
    ) external;

    function setBytes32Values(
        bytes32 contractName,
        bytes32[] calldata records,
        bytes32[] calldata values
    ) external;
}


// Internal references


// https://docs.synthetix.io/contracts/source/contracts/mixinsystemsettings
contract MixinSystemSettings is MixinResolver {
    bytes32 internal constant SETTING_CONTRACT_NAME = "SystemSettings";

    bytes32 internal constant SETTING_WAITING_PERIOD_SECS = "waitingPeriodSecs";
    bytes32 internal constant SETTING_PRICE_DEVIATION_THRESHOLD_FACTOR = "priceDeviationThresholdFactor";
    bytes32 internal constant SETTING_ISSUANCE_RATIO = "issuanceRatio";
    bytes32 internal constant SETTING_FEE_PERIOD_DURATION = "feePeriodDuration";
    bytes32 internal constant SETTING_TARGET_THRESHOLD = "targetThreshold";
    bytes32 internal constant SETTING_LIQUIDATION_DELAY = "liquidationDelay";
    bytes32 internal constant SETTING_LIQUIDATION_RATIO = "liquidationRatio";
    bytes32 internal constant SETTING_LIQUIDATION_PENALTY = "liquidationPenalty";
    bytes32 internal constant SETTING_RATE_STALE_PERIOD = "rateStalePeriod";
    bytes32 internal constant SETTING_EXCHANGE_FEE_RATE = "exchangeFeeRate";
    bytes32 internal constant SETTING_MINIMUM_STAKE_TIME = "minimumStakeTime";
    bytes32 internal constant SETTING_AGGREGATOR_WARNING_FLAGS = "aggregatorWarningFlags";
    bytes32 internal constant SETTING_TRADING_REWARDS_ENABLED = "tradingRewardsEnabled";
    bytes32 internal constant SETTING_DEBT_SNAPSHOT_STALE_TIME = "debtSnapshotStaleTime";
    bytes32 internal constant SETTING_CROSS_DOMAIN_DEPOSIT_GAS_LIMIT = "crossDomainDepositGasLimit";
    bytes32 internal constant SETTING_CROSS_DOMAIN_ESCROW_GAS_LIMIT = "crossDomainEscrowGasLimit";
    bytes32 internal constant SETTING_CROSS_DOMAIN_REWARD_GAS_LIMIT = "crossDomainRewardGasLimit";
    bytes32 internal constant SETTING_CROSS_DOMAIN_WITHDRAWAL_GAS_LIMIT = "crossDomainWithdrawalGasLimit";
    bytes32 internal constant SETTING_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 CONTRACT_FLEXIBLESTORAGE = "FlexibleStorage";

    enum CrossDomainMessageGasLimits {Deposit, Escrow, Reward, Withdrawal}

    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 {
            revert("Unknown gas limit type");
        }
    }

    function getCrossDomainMessageGasLimit(CrossDomainMessageGasLimits gasLimitType) internal view returns (uint) {
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, _getGasLimitSetting(gasLimitType));
    }

    function getTradingRewardsEnabled() internal view returns (bool) {
        return flexibleStorage().getBoolValue(SETTING_CONTRACT_NAME, SETTING_TRADING_REWARDS_ENABLED);
    }

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

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

    function getIssuanceRatio() internal view returns (uint) {
        // lookup on flexible storage directly for gas savings (rather than via SystemSettings)
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_ISSUANCE_RATIO);
    }

    function getFeePeriodDuration() internal view returns (uint) {
        // lookup on flexible storage directly for gas savings (rather than via SystemSettings)
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_FEE_PERIOD_DURATION);
    }

    function getTargetThreshold() internal view returns (uint) {
        // lookup on flexible storage directly for gas savings (rather than via SystemSettings)
        return flexibleStorage().getUIntValue(SETTING_CONTRACT_NAME, SETTING_TARGET_THRESHOLD);
    }

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

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

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

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

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

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

    function getAggregatorWarningFlags() internal view returns (address) {
        return flexibleStorage().getAddressValue(SETTING_CONTRACT_NAME, SETTING_AGGREGATOR_WARNING_FLAGS);
    }

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

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

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

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


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


// 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 Security Audit

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"}]

608060405260006006556000600755600060085534801561001f57600080fd5b506040516123403803806123408339818101604052606081101561004257600080fd5b50805160208201516040909201519091908180846001600160a01b0381166100b1576040805162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b038316908117825560408051928352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a1506000546001600160a01b031661015b576040805162461bcd60e51b815260206004820152601160248201527013dddb995c881b5d5cdd081899481cd95d607a1b604482015290519081900360640190fd5b60038054610100600160a81b0319166101006001600160a01b0393841602179055600580546001600160a01b03191693909116929092179091555061219791508190506101a96000396000f3fe6080604052600436106101815760003560e01c80635cfc1a51116100d1578063899ffef41161008a578063a02a76f111610064578063a02a76f1146104a4578063a0712d68146104b9578063bb57ad20146104e3578063ee5f3f5c146104f857610181565b8063899ffef4146104155780638da5cb5b1461047a57806391b4ded91461048f57610181565b80635cfc1a511461038257806368eb5e4f146103975780636ad88269146103ac57806374185360146103d657806375d920a9146103eb57806379ba50971461040057610181565b80632af64bd31161013e578063509bf42a11610118578063509bf42a1461031957806353a47bb71461032e5780635c095e54146103435780635c975abb1461036d57610181565b80632af64bd3146102b15780633fc8cef3146102da57806342966c68146102ef57610181565b806302814b86146101ce57806304f3bcec146101f55780630902f1ac146102265780631627540c1461023b57806316c38b3c1461027057806318819a311461029c575b6040805162461bcd60e51b815260206004820152601d60248201527f46616c6c6261636b2064697361626c65642c20757365206d696e742829000000604482015290519081900360640190fd5b3480156101da57600080fd5b506101e361050d565b60408051918252519081900360200190f35b34801561020157600080fd5b5061020a61051d565b604080516001600160a01b039092168252519081900360200190f35b34801561023257600080fd5b506101e3610531565b34801561024757600080fd5b5061026e6004803603602081101561025e57600080fd5b50356001600160a01b03166105ad565b005b34801561027c57600080fd5b5061026e6004803603602081101561029357600080fd5b50351515610609565b3480156102a857600080fd5b506101e3610683565b3480156102bd57600080fd5b506102c661068d565b604080519115158252519081900360200190f35b3480156102e657600080fd5b5061020a61079d565b3480156102fb57600080fd5b5061026e6004803603602081101561031257600080fd5b50356107ac565b34801561032557600080fd5b506101e3610912565b34801561033a57600080fd5b5061020a61091c565b34801561034f57600080fd5b506101e36004803603602081101561036657600080fd5b503561092b565b34801561037957600080fd5b506102c661094b565b34801561038e57600080fd5b506101e3610954565b3480156103a357600080fd5b506101e3610997565b3480156103b857600080fd5b506101e3600480360360208110156103cf57600080fd5b503561099d565b3480156103e257600080fd5b5061026e6109aa565b3480156103f757600080fd5b506101e3610b87565b34801561040c57600080fd5b5061026e610b8d565b34801561042157600080fd5b5061042a610c49565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561046657818101518382015260200161044e565b505050509050019250505060405180910390f35b34801561048657600080fd5b5061020a610d49565b34801561049b57600080fd5b506101e3610d58565b3480156104b057600080fd5b506101e3610d5e565b3480156104c557600080fd5b5061026e600480360360208110156104dc57600080fd5b5035610d64565b3480156104ef57600080fd5b5061026e610f9d565b34801561050457600080fd5b506101e3611395565b600061051761141c565b90505b90565b60035461010090046001600160a01b031681565b600554604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561057c57600080fd5b505afa158015610590573d6000803e3d6000fd5b505050506040513d60208110156105a657600080fd5b5051905090565b6105b5611497565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b610611611497565b60035460ff161515811515141561062757610680565b6003805460ff1916821515179081905560ff161561064457426002555b6003546040805160ff90921615158252517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59181900360200190a15b50565b60006105176114e2565b60006060610699610c49565b905060005b81518110156107945760008282815181106106b557fe5b602090810291909101810151600081815260048084526040918290205460035483516321f8a72160e01b815292830185905292519395506001600160a01b039081169461010090930416926321f8a72192602480840193919291829003018186803b15801561072357600080fd5b505afa158015610737573d6000803e3d6000fd5b505050506040513d602081101561074d57600080fd5b50516001600160a01b031614158061077a57506000818152600460205260409020546001600160a01b0316155b1561078b576000935050505061051a565b5060010161069e565b50600191505090565b6005546001600160a01b031690565b60035460ff16156107ee5760405162461bcd60e51b815260040180806020018281038252603c8152602001806120c9603c913960400191505060405180910390fd5b60006107f8610531565b9050600081116108395760405162461bcd60e51b815260040180806020018281038252603881526020018061212b6038913960400191505060405180910390fd5b60006108d26108c5610849610912565b7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561088d57600080fd5b505af41580156108a1573d6000803e3d6000fd5b505050506040513d60208110156108b757600080fd5b50519063ffffffff61156816565b849063ffffffff6115c916565b9050818110156108eb576108e681846115de565b61090d565b61090d826109086108fb8561099d565b859063ffffffff61156816565b6115de565b505050565b600061051761199b565b6001546001600160a01b031681565b6000610945610938610683565b839063ffffffff611a2116565b92915050565b60035460ff1681565b60008061095f610531565b905061096961050d565b811061097957600091505061051a565b6109918161098561050d565b9063ffffffff611a3616565b91505090565b60065481565b6000610945610938610912565b60606109b4610c49565b905060005b8151811015610b835760008282815181106109d057fe5b602002602001015190506000600360019054906101000a90046001600160a01b03166001600160a01b031663dacb2d01838460405160200180807f5265736f6c766572206d697373696e67207461726765743a20000000000000008152506019018281526020019150506040516020818303038152906040526040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a9b578181015183820152602001610a83565b50505050905090810190601f168015610ac85780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b158015610ae657600080fd5b505afa158015610afa573d6000803e3d6000fd5b505050506040513d6020811015610b1057600080fd5b505160008381526004602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582518681529182015281519293507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa68929081900390910190a150506001016109b9565b5050565b60085481565b6001546001600160a01b03163314610bd65760405162461bcd60e51b81526004018080602001828103825260358152602001806120446035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b606080610c54611a93565b60408051600580825260c08201909252919250606091906020820160a080388339019050509050680a6f2dce8d0e68aa8960bb1b81600081518110610c9557fe5b6020026020010181815250506814de5b9d1a1cd554d160ba1b81600181518110610cbb57fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110610ce557fe5b6020026020010181815250506524b9b9bab2b960d11b81600381518110610d0857fe5b60200260200101818152505066119959541bdbdb60ca1b81600481518110610d2c57fe5b602002602001018181525050610d428282611ae4565b9250505090565b6000546001600160a01b031681565b60025481565b60075481565b60035460ff1615610da65760405162461bcd60e51b815260040180806020018281038252603c8152602001806120c9603c913960400191505060405180910390fd5b60055460408051636eb1769f60e11b815233600482015230602482015290516001600160a01b039092169163dd62ed3e91604480820192602092909190829003018186803b158015610df757600080fd5b505afa158015610e0b573d6000803e3d6000fd5b505050506040513d6020811015610e2157600080fd5b5051811115610e73576040805162461bcd60e51b8152602060048201526019602482015278082d8d8deeec2dcc6ca40dcdee840d0d2ced040cadcdeeaced603b1b604482015290519081900360640190fd5b600554604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610ebe57600080fd5b505afa158015610ed2573d6000803e3d6000fd5b505050506040513d6020811015610ee857600080fd5b5051811115610f33576040805162461bcd60e51b815260206004820152601260248201527142616c616e636520697320746f6f206c6f7760701b604482015290519081900360640190fd5b6000610f3d610954565b905060008111610f7e5760405162461bcd60e51b81526004018080602001828103825260268152602001806121056026913960400191505060405180910390fd5b80821015610f9457610f8f82611ba0565b610b83565b610b8381611ba0565b610fa5611dbc565b6001600160a01b0316632528f0fe630e68aa8960e31b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610fef57600080fd5b505afa158015611003573d6000803e3d6000fd5b505050506040513d602081101561101957600080fd5b50511561106d576040805162461bcd60e51b815260206004820152601860248201527f43757272656e6379207261746520697320696e76616c69640000000000000000604482015290519081900360640190fd5b6000611077611dbc565b6001600160a01b031663654a60ac630e68aa8960e31b600854631cd554d160e21b6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b1580156110da57600080fd5b505afa1580156110ee573d6000803e3d6000fd5b505050506040513d602081101561110457600080fd5b50519050611110611dd7565b6001600160a01b0316639dc29fac306008546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561117157600080fd5b505af1158015611185573d6000803e3d6000fd5b50505050600854600654106111ae576008546006546111a99163ffffffff611a3616565b6111b1565b60005b6006556111bc611dee565b6001600160a01b03166332608039631cd554d160e21b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561120657600080fd5b505afa15801561121a573d6000803e3d6000fd5b505050506040513d602081101561123057600080fd5b50516001600160a01b031663867904b4611248611e02565b6001600160a01b031663eb1edd616040518163ffffffff1660e01b815260040160206040518083038186803b15801561128057600080fd5b505afa158015611294573d6000803e3d6000fd5b505050506040513d60208110156112aa57600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820185905251604480830192600092919082900301818387803b1580156112f957600080fd5b505af115801561130d573d6000803e3d6000fd5b5050600754611325925090508263ffffffff61156816565b600755611330611e02565b6001600160a01b03166322bf55ef826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561137557600080fd5b505af1158015611389573d6000803e3d6000fd5b50506000600855505050565b60006105176007546113a5611dbc565b6001600160a01b031663654a60ac630e68aa8960e31b600654631cd554d160e21b6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b15801561140857600080fd5b505afa1580156108a1573d6000803e3d6000fd5b6000611426611e17565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b710cae8d0cae4aee4c2e0e0cae49ac2f08aa8960731b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561057c57600080fd5b6000546001600160a01b031633146114e05760405162461bcd60e51b815260040180806020018281038252602f815260200180612079602f913960400191505060405180910390fd5b565b60006114ec611e17565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724d696e74466565526174650000000000000000006040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561057c57600080fd5b6000828201838110156115c2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60006115c28383670de0b6b3a7640000611e34565b60006115f0828463ffffffff611a3616565b90506115fa611dd7565b60408051636eb1769f60e11b815233600482015230602482015290516001600160a01b03929092169163dd62ed3e91604480820192602092909190829003018186803b15801561164957600080fd5b505afa15801561165d573d6000803e3d6000fd5b505050506040513d602081101561167357600080fd5b50518211156116c5576040805162461bcd60e51b8152602060048201526019602482015278082d8d8deeec2dcc6ca40dcdee840d0d2ced040cadcdeeaced603b1b604482015290519081900360640190fd5b6116cd611dd7565b6001600160a01b03166370a08231336040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561172257600080fd5b505afa158015611736573d6000803e3d6000fd5b505050506040513d602081101561174c57600080fd5b5051821115611797576040805162461bcd60e51b815260206004820152601260248201527142616c616e636520697320746f6f206c6f7760701b604482015290519081900360640190fd5b61179f611dd7565b6001600160a01b0316639dc29fac33846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156117fe57600080fd5b505af1158015611812573d6000803e3d6000fd5b50505050826006541061183757600654611832908463ffffffff611a3616565b61183a565b60005b600655611845611dd7565b6001600160a01b031663867904b430836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156118a457600080fd5b505af11580156118b8573d6000803e3d6000fd5b50506008546118d0925090508263ffffffff61156816565b6008556005546040805163a9059cbb60e01b81523360048201526024810186905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561192757600080fd5b505af115801561193b573d6000803e3d6000fd5b505050506040513d602081101561195157600080fd5b50506040805184815260208101839052808201849052905133917f4c60206a5c1de41f3376d1d60f0949d96cb682033c90b1c2d9d9a62d4c4120c0919081900360600190a2505050565b60006119a5611e17565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724275726e466565526174650000000000000000006040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561057c57600080fd5b60006115c28383670de0b6b3a7640000611e78565b600082821115611a8d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b81600081518110611ad557fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015611b14578160200160208202803883390190505b50905060005b8351811015611b5657838181518110611b2f57fe5b6020026020010151828281518110611b4357fe5b6020908102919091010152600101611b1a565b5060005b8251811015611b9957828181518110611b6f57fe5b6020026020010151828286510181518110611b8657fe5b6020908102919091010152600101611b5a565b5092915050565b6000611bab8261092b565b90506000611bbf838363ffffffff611a3616565b600554604080516323b872dd60e01b81523360048201523060248201526044810187905290519293506001600160a01b03909116916323b872dd916064808201926020929091908290030181600087803b158015611c1c57600080fd5b505af1158015611c30573d6000803e3d6000fd5b505050506040513d6020811015611c4657600080fd5b50611c519050611dd7565b6001600160a01b031663867904b433836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611cb057600080fd5b505af1158015611cc4573d6000803e3d6000fd5b50505050611cd0611dd7565b6001600160a01b031663867904b430846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611d2f57600080fd5b505af1158015611d43573d6000803e3d6000fd5b5050600854611d5b925090508363ffffffff61156816565b600855600654611d71908463ffffffff61156816565b6006556040805182815260208101849052808201859052905133917f5a3358a3d27a5373c0df2604662088d37894d56b7cfd27f315770440f4e0d919919081900360600190a2505050565b60006105176c45786368616e6765526174657360981b611ea3565b6000610517680a6f2dce8d0e68aa8960bb1b611ea3565b60006105176524b9b9bab2b960d11b611ea3565b600061051766119959541bdbdb60ca1b611ea3565b60006105176e466c657869626c6553746f7261676560881b611ea3565b600080611e5a84611e4e87600a870263ffffffff611f8016565b9063ffffffff611fd916565b90506005600a825b0610611e6c57600a015b600a9004949350505050565b600080600a8304611e8f868663ffffffff611f8016565b81611e9657fe5b0490506005600a82611e62565b600081815260046020908152604080832054815170026b4b9b9b4b7339030b2323932b9b99d1607d1b9381019390935260318084018690528251808503909101815260519093019091526001600160a01b03169081611b995760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611f45578181015183820152602001611f2d565b50505050905090810190601f168015611f725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b600082611f8f57506000610945565b82820282848281611f9c57fe5b04146115c25760405162461bcd60e51b81526004018080602001828103825260218152602001806120a86021913960400191505060405180910390fd5b600080821161202f576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161203a57fe5b0494935050505056fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775468697320616374696f6e2063616e6e6f7420626520706572666f726d6564207768696c652074686520636f6e747261637420697320706175736564436f6e747261637420686173206e6f20737061726520636170616369747920746f206d696e74436f6e74726163742063616e6e6f74206275726e207345544820666f7220574554482c20574554482062616c616e6365206973207a65726fa265627a7a7231582061cf11c9011e67bb852831a9194451327609f64ea00fb2b3e9807afbbc48b9d864736f6c63430005100032000000000000000000000000de910777c787903f78c89e7a0bf7f4c435cbb1fe0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x6080604052600436106101815760003560e01c80635cfc1a51116100d1578063899ffef41161008a578063a02a76f111610064578063a02a76f1146104a4578063a0712d68146104b9578063bb57ad20146104e3578063ee5f3f5c146104f857610181565b8063899ffef4146104155780638da5cb5b1461047a57806391b4ded91461048f57610181565b80635cfc1a511461038257806368eb5e4f146103975780636ad88269146103ac57806374185360146103d657806375d920a9146103eb57806379ba50971461040057610181565b80632af64bd31161013e578063509bf42a11610118578063509bf42a1461031957806353a47bb71461032e5780635c095e54146103435780635c975abb1461036d57610181565b80632af64bd3146102b15780633fc8cef3146102da57806342966c68146102ef57610181565b806302814b86146101ce57806304f3bcec146101f55780630902f1ac146102265780631627540c1461023b57806316c38b3c1461027057806318819a311461029c575b6040805162461bcd60e51b815260206004820152601d60248201527f46616c6c6261636b2064697361626c65642c20757365206d696e742829000000604482015290519081900360640190fd5b3480156101da57600080fd5b506101e361050d565b60408051918252519081900360200190f35b34801561020157600080fd5b5061020a61051d565b604080516001600160a01b039092168252519081900360200190f35b34801561023257600080fd5b506101e3610531565b34801561024757600080fd5b5061026e6004803603602081101561025e57600080fd5b50356001600160a01b03166105ad565b005b34801561027c57600080fd5b5061026e6004803603602081101561029357600080fd5b50351515610609565b3480156102a857600080fd5b506101e3610683565b3480156102bd57600080fd5b506102c661068d565b604080519115158252519081900360200190f35b3480156102e657600080fd5b5061020a61079d565b3480156102fb57600080fd5b5061026e6004803603602081101561031257600080fd5b50356107ac565b34801561032557600080fd5b506101e3610912565b34801561033a57600080fd5b5061020a61091c565b34801561034f57600080fd5b506101e36004803603602081101561036657600080fd5b503561092b565b34801561037957600080fd5b506102c661094b565b34801561038e57600080fd5b506101e3610954565b3480156103a357600080fd5b506101e3610997565b3480156103b857600080fd5b506101e3600480360360208110156103cf57600080fd5b503561099d565b3480156103e257600080fd5b5061026e6109aa565b3480156103f757600080fd5b506101e3610b87565b34801561040c57600080fd5b5061026e610b8d565b34801561042157600080fd5b5061042a610c49565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561046657818101518382015260200161044e565b505050509050019250505060405180910390f35b34801561048657600080fd5b5061020a610d49565b34801561049b57600080fd5b506101e3610d58565b3480156104b057600080fd5b506101e3610d5e565b3480156104c557600080fd5b5061026e600480360360208110156104dc57600080fd5b5035610d64565b3480156104ef57600080fd5b5061026e610f9d565b34801561050457600080fd5b506101e3611395565b600061051761141c565b90505b90565b60035461010090046001600160a01b031681565b600554604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561057c57600080fd5b505afa158015610590573d6000803e3d6000fd5b505050506040513d60208110156105a657600080fd5b5051905090565b6105b5611497565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b610611611497565b60035460ff161515811515141561062757610680565b6003805460ff1916821515179081905560ff161561064457426002555b6003546040805160ff90921615158252517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59181900360200190a15b50565b60006105176114e2565b60006060610699610c49565b905060005b81518110156107945760008282815181106106b557fe5b602090810291909101810151600081815260048084526040918290205460035483516321f8a72160e01b815292830185905292519395506001600160a01b039081169461010090930416926321f8a72192602480840193919291829003018186803b15801561072357600080fd5b505afa158015610737573d6000803e3d6000fd5b505050506040513d602081101561074d57600080fd5b50516001600160a01b031614158061077a57506000818152600460205260409020546001600160a01b0316155b1561078b576000935050505061051a565b5060010161069e565b50600191505090565b6005546001600160a01b031690565b60035460ff16156107ee5760405162461bcd60e51b815260040180806020018281038252603c8152602001806120c9603c913960400191505060405180910390fd5b60006107f8610531565b9050600081116108395760405162461bcd60e51b815260040180806020018281038252603881526020018061212b6038913960400191505060405180910390fd5b60006108d26108c5610849610912565b7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff1660e01b815260040160206040518083038186803b15801561088d57600080fd5b505af41580156108a1573d6000803e3d6000fd5b505050506040513d60208110156108b757600080fd5b50519063ffffffff61156816565b849063ffffffff6115c916565b9050818110156108eb576108e681846115de565b61090d565b61090d826109086108fb8561099d565b859063ffffffff61156816565b6115de565b505050565b600061051761199b565b6001546001600160a01b031681565b6000610945610938610683565b839063ffffffff611a2116565b92915050565b60035460ff1681565b60008061095f610531565b905061096961050d565b811061097957600091505061051a565b6109918161098561050d565b9063ffffffff611a3616565b91505090565b60065481565b6000610945610938610912565b60606109b4610c49565b905060005b8151811015610b835760008282815181106109d057fe5b602002602001015190506000600360019054906101000a90046001600160a01b03166001600160a01b031663dacb2d01838460405160200180807f5265736f6c766572206d697373696e67207461726765743a20000000000000008152506019018281526020019150506040516020818303038152906040526040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a9b578181015183820152602001610a83565b50505050905090810190601f168015610ac85780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b158015610ae657600080fd5b505afa158015610afa573d6000803e3d6000fd5b505050506040513d6020811015610b1057600080fd5b505160008381526004602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582518681529182015281519293507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa68929081900390910190a150506001016109b9565b5050565b60085481565b6001546001600160a01b03163314610bd65760405162461bcd60e51b81526004018080602001828103825260358152602001806120446035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b606080610c54611a93565b60408051600580825260c08201909252919250606091906020820160a080388339019050509050680a6f2dce8d0e68aa8960bb1b81600081518110610c9557fe5b6020026020010181815250506814de5b9d1a1cd554d160ba1b81600181518110610cbb57fe5b6020026020010181815250506c45786368616e6765526174657360981b81600281518110610ce557fe5b6020026020010181815250506524b9b9bab2b960d11b81600381518110610d0857fe5b60200260200101818152505066119959541bdbdb60ca1b81600481518110610d2c57fe5b602002602001018181525050610d428282611ae4565b9250505090565b6000546001600160a01b031681565b60025481565b60075481565b60035460ff1615610da65760405162461bcd60e51b815260040180806020018281038252603c8152602001806120c9603c913960400191505060405180910390fd5b60055460408051636eb1769f60e11b815233600482015230602482015290516001600160a01b039092169163dd62ed3e91604480820192602092909190829003018186803b158015610df757600080fd5b505afa158015610e0b573d6000803e3d6000fd5b505050506040513d6020811015610e2157600080fd5b5051811115610e73576040805162461bcd60e51b8152602060048201526019602482015278082d8d8deeec2dcc6ca40dcdee840d0d2ced040cadcdeeaced603b1b604482015290519081900360640190fd5b600554604080516370a0823160e01b815233600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610ebe57600080fd5b505afa158015610ed2573d6000803e3d6000fd5b505050506040513d6020811015610ee857600080fd5b5051811115610f33576040805162461bcd60e51b815260206004820152601260248201527142616c616e636520697320746f6f206c6f7760701b604482015290519081900360640190fd5b6000610f3d610954565b905060008111610f7e5760405162461bcd60e51b81526004018080602001828103825260268152602001806121056026913960400191505060405180910390fd5b80821015610f9457610f8f82611ba0565b610b83565b610b8381611ba0565b610fa5611dbc565b6001600160a01b0316632528f0fe630e68aa8960e31b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610fef57600080fd5b505afa158015611003573d6000803e3d6000fd5b505050506040513d602081101561101957600080fd5b50511561106d576040805162461bcd60e51b815260206004820152601860248201527f43757272656e6379207261746520697320696e76616c69640000000000000000604482015290519081900360640190fd5b6000611077611dbc565b6001600160a01b031663654a60ac630e68aa8960e31b600854631cd554d160e21b6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b1580156110da57600080fd5b505afa1580156110ee573d6000803e3d6000fd5b505050506040513d602081101561110457600080fd5b50519050611110611dd7565b6001600160a01b0316639dc29fac306008546040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561117157600080fd5b505af1158015611185573d6000803e3d6000fd5b50505050600854600654106111ae576008546006546111a99163ffffffff611a3616565b6111b1565b60005b6006556111bc611dee565b6001600160a01b03166332608039631cd554d160e21b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561120657600080fd5b505afa15801561121a573d6000803e3d6000fd5b505050506040513d602081101561123057600080fd5b50516001600160a01b031663867904b4611248611e02565b6001600160a01b031663eb1edd616040518163ffffffff1660e01b815260040160206040518083038186803b15801561128057600080fd5b505afa158015611294573d6000803e3d6000fd5b505050506040513d60208110156112aa57600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820185905251604480830192600092919082900301818387803b1580156112f957600080fd5b505af115801561130d573d6000803e3d6000fd5b5050600754611325925090508263ffffffff61156816565b600755611330611e02565b6001600160a01b03166322bf55ef826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561137557600080fd5b505af1158015611389573d6000803e3d6000fd5b50506000600855505050565b60006105176007546113a5611dbc565b6001600160a01b031663654a60ac630e68aa8960e31b600654631cd554d160e21b6040518463ffffffff1660e01b815260040180848152602001838152602001828152602001935050505060206040518083038186803b15801561140857600080fd5b505afa1580156108a1573d6000803e3d6000fd5b6000611426611e17565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b710cae8d0cae4aee4c2e0e0cae49ac2f08aa8960731b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561057c57600080fd5b6000546001600160a01b031633146114e05760405162461bcd60e51b815260040180806020018281038252602f815260200180612079602f913960400191505060405180910390fd5b565b60006114ec611e17565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724d696e74466565526174650000000000000000006040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561057c57600080fd5b6000828201838110156115c2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60006115c28383670de0b6b3a7640000611e34565b60006115f0828463ffffffff611a3616565b90506115fa611dd7565b60408051636eb1769f60e11b815233600482015230602482015290516001600160a01b03929092169163dd62ed3e91604480820192602092909190829003018186803b15801561164957600080fd5b505afa15801561165d573d6000803e3d6000fd5b505050506040513d602081101561167357600080fd5b50518211156116c5576040805162461bcd60e51b8152602060048201526019602482015278082d8d8deeec2dcc6ca40dcdee840d0d2ced040cadcdeeaced603b1b604482015290519081900360640190fd5b6116cd611dd7565b6001600160a01b03166370a08231336040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561172257600080fd5b505afa158015611736573d6000803e3d6000fd5b505050506040513d602081101561174c57600080fd5b5051821115611797576040805162461bcd60e51b815260206004820152601260248201527142616c616e636520697320746f6f206c6f7760701b604482015290519081900360640190fd5b61179f611dd7565b6001600160a01b0316639dc29fac33846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156117fe57600080fd5b505af1158015611812573d6000803e3d6000fd5b50505050826006541061183757600654611832908463ffffffff611a3616565b61183a565b60005b600655611845611dd7565b6001600160a01b031663867904b430836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156118a457600080fd5b505af11580156118b8573d6000803e3d6000fd5b50506008546118d0925090508263ffffffff61156816565b6008556005546040805163a9059cbb60e01b81523360048201526024810186905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561192757600080fd5b505af115801561193b573d6000803e3d6000fd5b505050506040513d602081101561195157600080fd5b50506040805184815260208101839052808201849052905133917f4c60206a5c1de41f3376d1d60f0949d96cb682033c90b1c2d9d9a62d4c4120c0919081900360600190a2505050565b60006119a5611e17565b6001600160a01b03166323257c2b6d53797374656d53657474696e677360901b7f6574686572577261707065724275726e466565526174650000000000000000006040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561057c57600080fd5b60006115c28383670de0b6b3a7640000611e78565b600082821115611a8d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001808252818301909252606091602080830190803883390190505090506e466c657869626c6553746f7261676560881b81600081518110611ad557fe5b60200260200101818152505090565b60608151835101604051908082528060200260200182016040528015611b14578160200160208202803883390190505b50905060005b8351811015611b5657838181518110611b2f57fe5b6020026020010151828281518110611b4357fe5b6020908102919091010152600101611b1a565b5060005b8251811015611b9957828181518110611b6f57fe5b6020026020010151828286510181518110611b8657fe5b6020908102919091010152600101611b5a565b5092915050565b6000611bab8261092b565b90506000611bbf838363ffffffff611a3616565b600554604080516323b872dd60e01b81523360048201523060248201526044810187905290519293506001600160a01b03909116916323b872dd916064808201926020929091908290030181600087803b158015611c1c57600080fd5b505af1158015611c30573d6000803e3d6000fd5b505050506040513d6020811015611c4657600080fd5b50611c519050611dd7565b6001600160a01b031663867904b433836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611cb057600080fd5b505af1158015611cc4573d6000803e3d6000fd5b50505050611cd0611dd7565b6001600160a01b031663867904b430846040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611d2f57600080fd5b505af1158015611d43573d6000803e3d6000fd5b5050600854611d5b925090508363ffffffff61156816565b600855600654611d71908463ffffffff61156816565b6006556040805182815260208101849052808201859052905133917f5a3358a3d27a5373c0df2604662088d37894d56b7cfd27f315770440f4e0d919919081900360600190a2505050565b60006105176c45786368616e6765526174657360981b611ea3565b6000610517680a6f2dce8d0e68aa8960bb1b611ea3565b60006105176524b9b9bab2b960d11b611ea3565b600061051766119959541bdbdb60ca1b611ea3565b60006105176e466c657869626c6553746f7261676560881b611ea3565b600080611e5a84611e4e87600a870263ffffffff611f8016565b9063ffffffff611fd916565b90506005600a825b0610611e6c57600a015b600a9004949350505050565b600080600a8304611e8f868663ffffffff611f8016565b81611e9657fe5b0490506005600a82611e62565b600081815260046020908152604080832054815170026b4b9b9b4b7339030b2323932b9b99d1607d1b9381019390935260318084018690528251808503909101815260519093019091526001600160a01b03169081611b995760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611f45578181015183820152602001611f2d565b50505050905090810190601f168015611f725780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b600082611f8f57506000610945565b82820282848281611f9c57fe5b04146115c25760405162461bcd60e51b81526004018080602001828103825260218152602001806120a86021913960400191505060405180910390fd5b600080821161202f576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b600082848161203a57fe5b0494935050505056fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775468697320616374696f6e2063616e6e6f7420626520706572666f726d6564207768696c652074686520636f6e747261637420697320706175736564436f6e747261637420686173206e6f20737061726520636170616369747920746f206d696e74436f6e74726163742063616e6e6f74206275726e207345544820666f7220574554482c20574554482062616c616e6365206973207a65726fa265627a7a7231582061cf11c9011e67bb852831a9194451327609f64ea00fb2b3e9807afbbc48b9d864736f6c63430005100032

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

000000000000000000000000de910777c787903f78c89e7a0bf7f4c435cbb1fe0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _owner (address): 0xDe910777C787903F78C89e7a0bf7F4C435cBB1Fe
Arg [1] : _resolver (address): 0x4E3b31eB0E5CB73641EE1E65E7dCEFe520bA3ef2
Arg [2] : _WETH (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000de910777c787903f78c89e7a0bf7f4c435cbb1fe
Arg [1] : 0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2
Arg [2] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


Libraries Used


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.