Contract 0xE1f64079aDa6Ef07b03982Ca34f1dD7152AA3b86

 
Ad
Crypto.com
Txn Hash
Block
From
To
Value
0x2a88b0ca152e9d7d3f5de6cecb6156c8ca2170f9974dac494d172cd764156994121896572021-04-07 1:20:414 days 16 hrs ago0x74dd5131bf9924d13336b1f171a9c627f6556f98 IN  Synthetix: Depot0 Ether0.019492676119
0x3a95215633b686080fc041229a5c361cdb286850be2d7827c02a4c2db8cad870121896102021-04-07 1:10:104 days 17 hrs ago0x74dd5131bf9924d13336b1f171a9c627f6556f98 IN  Synthetix: Depot0 Ether0.03146844120
0xdeefd485b6678cfdb73c0adf39daf0e5675602f0461d0b8d2a297ace26530bbd119633372021-03-03 5:12:0039 days 13 hrs ago0xc422e5526c70f2a9903acb469b25ef4df0fba2d9 IN  Synthetix: Depot0 Ether0.01031014464
0x96696f965c34a27672d44fd69429db16b545cb517cba3aaa1acb43cc7e4b7b0b119585902021-03-02 11:37:1740 days 6 hrs ago0xf14d5d376ffa0cf9b509bce00376b0c920d9e480 IN  Synthetix: Depot0 Ether0.01304877681
0x40c484e1fb8fc62b73c9dedad6770dd26a4f94f1b260e22eacc9f477669ff200119582272021-03-02 10:16:2040 days 8 hrs ago0x2f03e6f9d21029e926f7685c611d8ce087c3e600 IN  Synthetix: Depot0 Ether0.01417644888
0x2446804055851ff049d6e8b6cad17e4320b9ad0834ff38094d24266e178fe775119581752021-03-02 10:01:3540 days 8 hrs ago0x8ef9ba3b4bac4bc2d6a8a09ce34bc9067bbfb231 IN  Synthetix: Depot0 Ether0.01256548878
0x457c6716be8aba2ab87074afe184fe6675b7a9348d7058c2ca70e9fa1ad0d6f6119581342021-03-02 9:52:3540 days 8 hrs ago0x8ef9ba3b4bac4bc2d6a8a09ce34bc9067bbfb231 IN  Synthetix: Depot0 Ether0.01337242876
0x909141f280dc403eed4002978cb44fcf287b8baab81053c5375bc3ba14bdf4c6119575032021-03-02 7:36:4240 days 10 hrs ago0xf14d5d376ffa0cf9b509bce00376b0c920d9e480 IN  Synthetix: Depot0 Ether0.01266861672
0xe27045ba1ab9d3bdcbbd36de980319d3f32fe8ef62ab9eddebb867e5bea6fda1119499952021-03-01 3:48:1341 days 14 hrs ago0x2f03e6f9d21029e926f7685c611d8ce087c3e600 IN  Synthetix: Depot0 Ether0.013846556778.7
0x938ae03b35009db65c5537fa4cf6f04e0ce37268b2f24e59bf61540828723bbc119199302021-02-24 12:50:3946 days 5 hrs ago0xf14d5d376ffa0cf9b509bce00376b0c920d9e480 IN  Synthetix: Depot0 Ether0.02030628120
0x9031d6fd059cb3fc6544abb6010ed96ccd7f9c54daedd4a87d5f05213bae7913119167412021-02-24 0:57:1046 days 17 hrs ago0xd6b765fcd7696109a820f222208ae3a715a5bff0 IN  Synthetix: Depot0 Ether0.020644718122
0x4ed0603e7419230cd6a0911e595b9f323efc1eb4be677b9e3e58e793c17c30e9118836912021-02-18 23:09:1751 days 19 hrs ago0x2721d28690ace1045fabe0a662e2a0f9951ec4ea IN  Synthetix: Depot0 Ether0.026895974146
0x28338730cf802cbaebeaa0fa3dab735cd5faf434d3dc59bed6b001baa9a1c731118617922021-02-15 14:08:1355 days 4 hrs ago0xf14d5d376ffa0cf9b509bce00376b0c920d9e480 IN  Synthetix: Depot0 Ether0.019529451111
0x3b66a3aa993bb9f2276b6ddcd308646682a081b8f907e611375b827c3c2da2f8118352272021-02-11 12:22:2859 days 5 hrs ago0x08c91b9d1927c23c000b47441c656ed8eb6c9867 IN  Synthetix: Depot0 Ether0.01831621110
0x9f8fec93cbcead5f6310876b05771509b69db6a619b20bfcdb017aeb412e817f118335332021-02-11 6:01:2159 days 12 hrs ago0xcd917bf1dbae5dd0de7daae63926ec81b42faf77 IN  Synthetix: Depot0 Ether0.01515250191
0xe12b39f942cbe95cb4e1aacbe893a97ea5927b586d2580b382d1a369f0e80f34118272042021-02-10 6:41:5760 days 11 hrs ago0xcd917bf1dbae5dd0de7daae63926ec81b42faf77 IN  Synthetix: Depot0 Ether0.03343107190
0x716a6a6adadf33fa35232b56c75786c4f5c3260e6464441988ff7746ac23b1ba118012792021-02-06 6:58:5864 days 11 hrs ago0x7771bc48e9e1ebc7df672fd82525dcbadf985dec IN  Synthetix: Depot0 Ether0.02211354135
0xe00c3e8c489a42d897af83bd0ff9b9b0bc4416ccaada97d04a561cd2d74855c2117678252021-02-01 3:02:4569 days 15 hrs ago0xd6b765fcd7696109a820f222208ae3a715a5bff0 IN  Synthetix: Depot0 Ether0.01461347883
0x295fcdb5af881b2eebfcfd36853757fd2adbdd6959e065b514dddb3efd42a19b117629962021-01-31 9:38:1270 days 8 hrs ago0x2f03e6f9d21029e926f7685c611d8ce087c3e600 IN  Synthetix: Depot0 Ether0.0116645270
0xc06d7feb20b9d9471d9007f4cf924d9cdf17224d3ddf8a3f7c05ce7cf5f34a7f117621162021-01-31 6:26:0670 days 11 hrs ago0xf14d5d376ffa0cf9b509bce00376b0c920d9e480 IN  Synthetix: Depot0 Ether0.014280705285.7
0x42d4ea451465f8d1210e0dd3ed52760a6276d293787ee666fac06d32f9208e71117436492021-01-28 10:00:3673 days 8 hrs ago0xaa7eec6b62d55db20381af6d8e83210daf59ca77 IN  Synthetix: Depot0 Ether0.01399742484
0x9e52eec3cc4c0dc11d98f3bdf2e252d451862b4cb38a9734d0aba772e35c19cb117413922021-01-28 1:31:2573 days 16 hrs ago0x08c91b9d1927c23c000b47441c656ed8eb6c9867 IN  Synthetix: Depot0 Ether0.0082762347
0xe2ce214141799922b3c93da12f5f7752425c3398d155e520c265835d31c515ad117371042021-01-27 9:51:2874 days 8 hrs ago0xaa7eec6b62d55db20381af6d8e83210daf59ca77 IN  Synthetix: Depot0 Ether0.01848819105
0xc2404a5981f96bcf7ae43098de7226a50029845d3852bb9709d6a5e430c1aa3f117357442021-01-27 4:42:4474 days 13 hrs ago0x08c91b9d1927c23c000b47441c656ed8eb6c9867 IN  Synthetix: Depot0 Ether0.00789982949
0x19304654e532b40aa52c173f6b1d4bce09c8e101ff4de4214fa2a434c6673fbd117355352021-01-27 3:52:3174 days 14 hrs ago0x08c91b9d1927c23c000b47441c656ed8eb6c9867 IN  Synthetix: Depot0 Ether0.00809958846
[ Download CSV Export 

OVERVIEW

The Depot provides a way for users to acquire synths (Synth.sol) and SNX (Synthetix.sol) by paying ETH and a way for users to acquire SNX (Synthetix.sol) by paying synths.

Users can also deposit their synths and allow other users to purchase them with ETH. The ETH is sent to the user who offered their synths for sale.

Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x1ae171242ca13b356bf2b1547d063dcf24422677ab1b3617ea89f257ce3d6fe3120258062021-03-12 20:18:4329 days 21 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000000910402 Ether
0x1ae171242ca13b356bf2b1547d063dcf24422677ab1b3617ea89f257ce3d6fe3120258062021-03-12 20:18:4329 days 21 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.000000000000910403 Ether
0x041a881e33908a29840667d00dda0027a90cfc95ad8bc21e6cf825f6ac6f793f119973102021-03-08 10:37:1434 days 7 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000016159751 Ether
0x041a881e33908a29840667d00dda0027a90cfc95ad8bc21e6cf825f6ac6f793f119973102021-03-08 10:37:1434 days 7 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.000000000016159752 Ether
0x8c3578610cf1c2e6659edd05ff0751bbf16abf96572b6b60c3c5cac36993fd46119973102021-03-08 10:37:1434 days 7 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000019311199 Ether
0x8c3578610cf1c2e6659edd05ff0751bbf16abf96572b6b60c3c5cac36993fd46119973102021-03-08 10:37:1434 days 7 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.0000000000193112 Ether
0xda67208685e39aac1163850916c04f631ca847cdfd940195f27c4f056ef8c135119971942021-03-08 10:09:3334 days 8 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000024540543 Ether
0xda67208685e39aac1163850916c04f631ca847cdfd940195f27c4f056ef8c135119971942021-03-08 10:09:3334 days 8 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.000000000024540544 Ether
0x5a07625b4f4617a09774df564dd9b772193986f5fd694dd2289773832223e04c119971672021-03-08 10:02:4434 days 8 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000031268075 Ether
0x5a07625b4f4617a09774df564dd9b772193986f5fd694dd2289773832223e04c119971672021-03-08 10:02:4434 days 8 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.000000000031268076 Ether
0x224ae7ee24eac57652033c062b38bf6c88620b0343fe22d42fe4475e9dc593e4119971532021-03-08 9:58:3334 days 8 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000025116563 Ether
0x224ae7ee24eac57652033c062b38bf6c88620b0343fe22d42fe4475e9dc593e4119971532021-03-08 9:58:3334 days 8 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.000000000025116564 Ether
0xf6d7fbb6ce38c4e732f142b1813910584daa0e40c96f022c02d9b70be7fed1c3119971432021-03-08 9:55:5734 days 8 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000020529179 Ether
0xf6d7fbb6ce38c4e732f142b1813910584daa0e40c96f022c02d9b70be7fed1c3119971432021-03-08 9:55:5734 days 8 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.00000000002052918 Ether
0x50ab4791e3f96d7561472dcfa09ac3644be93284b44191f0c1ef7ae96e1e6628119968702021-03-08 8:52:3334 days 9 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000016487943 Ether
0x50ab4791e3f96d7561472dcfa09ac3644be93284b44191f0c1ef7ae96e1e6628119968702021-03-08 8:52:3334 days 9 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.000000000016487944 Ether
0x847af276a13deee72cbd13fdfebcc6d75f6b0e7244c103e200f6cb35adc7cf82119966782021-03-08 8:09:1134 days 10 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000012972639 Ether
0x847af276a13deee72cbd13fdfebcc6d75f6b0e7244c103e200f6cb35adc7cf82119966782021-03-08 8:09:1134 days 10 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.00000000001297264 Ether
0x53abf837e9a930327903ef20c27c9bd28468e9b51208ab51daf09f9164515f1c119910712021-03-07 11:25:3935 days 6 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000326465599 Ether
0x53abf837e9a930327903ef20c27c9bd28468e9b51208ab51daf09f9164515f1c119910712021-03-07 11:25:3935 days 6 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.0000000003264656 Ether
0x2a95bc14714b84a05f57e3fc535f111c1347690febb693913e6459b007d317f3119606232021-03-02 19:03:3039 days 23 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.000000000005807769 Ether
0x2a95bc14714b84a05f57e3fc535f111c1347690febb693913e6459b007d317f3119606232021-03-02 19:03:3039 days 23 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.00000000000580777 Ether
0x147bd75ffc251dc6a3e82e4d018fed175130f90514c4b773b1794baafa19a363119492722021-03-01 1:07:1741 days 17 hrs ago Synthetix: Depot0x67abbe5c79ce3473dc7c965e4af782395c1047400.0000000000000298 Ether
0x147bd75ffc251dc6a3e82e4d018fed175130f90514c4b773b1794baafa19a363119492722021-03-01 1:07:1741 days 17 hrs ago Synthetix: Ether Collateral Synthetix: Depot0.000000000000029801 Ether
0xfb2efb2de938fff34db02b3891006cf489be53960f3488fda16d6ecd533797f9118724182021-02-17 5:31:4753 days 12 hrs ago Synthetix: Depot0x2721d28690ace1045fabe0a662e2a0f9951ec4ea0.000000000000018719 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Depot

Compiler Version
v0.4.25+commit.59dbf8f1

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-02-20
*/

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


pragma solidity ^0.4.24;

/**
 * @title Helps contracts guard against reentrancy attacks.
 * @author Remco Bloemen <[email protected]π.com>, Eenae <[email protected]>
 * @dev If you mark a function `nonReentrant`, you should also
 * mark it `external`.
 */
contract ReentrancyGuard {

  /// @dev counter to allow mutex lock with only one SSTORE operation
  uint256 private _guardCounter;

  constructor() internal {
    // The counter starts at one to prevent changing it from zero to a non-zero
    // value, which is a more expensive operation.
    _guardCounter = 1;
  }

  /**
   * @dev Prevents a contract from calling itself, directly or indirectly.
   * Calling a `nonReentrant` function from another `nonReentrant`
   * function is not supported. It is possible to prevent this from happening
   * by making the `nonReentrant` function external, and make it call a
   * `private` function that does the actual work.
   */
  modifier nonReentrant() {
    _guardCounter += 1;
    uint256 localCounter = _guardCounter;
    _;
    require(localCounter == _guardCounter);
  }

}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       Owned.sol
version:    1.1
author:     Anton Jurisevic
            Dominic Romanowski

date:       2018-2-26

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

An Owned contract, to be inherited by other contracts.
Requires its owner to be explicitly set in the constructor.
Provides an onlyOwner access modifier.

To change owner, the current owner must nominate the next owner,
who then has to accept the nomination. The nomination can be
cancelled before it is accepted by the new owner by having the
previous owner change the nomination (setting it to 0).

-----------------------------------------------------------------
*/


/**
 * @title A contract with an owner.
 * @notice Contract ownership can be transferred by first nominating the new owner,
 * who must then accept the ownership, which prevents accidental incorrect ownership transfers.
 */
contract Owned {
    address public owner;
    address public nominatedOwner;

    /**
     * @dev Owned Constructor
     */
    constructor(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    /**
     * @notice Nominate a new owner of this contract.
     * @dev Only the current owner may nominate a new owner.
     */
    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    /**
     * @notice Accept the nomination to be owner.
     */
    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    modifier onlyOwner {
        require(msg.sender == owner, "Only the contract owner may perform this action");
        _;
    }

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


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       SelfDestructible.sol
version:    1.2
author:     Anton Jurisevic

date:       2018-05-29

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

This contract allows an inheriting contract to be destroyed after
its owner indicates an intention and then waits for a period
without changing their mind. All ether contained in the contract
is forwarded to a nominated beneficiary upon destruction.

-----------------------------------------------------------------
*/


/**
 * @title A contract that can be destroyed by its owner after a delay elapses.
 */
contract SelfDestructible is Owned {
    uint public initiationTime;
    bool public selfDestructInitiated;
    address public selfDestructBeneficiary;
    uint public constant SELFDESTRUCT_DELAY = 4 weeks;

    /**
     * @dev Constructor
     * @param _owner The account which controls this contract.
     */
    constructor(address _owner) public Owned(_owner) {
        require(_owner != address(0), "Owner must not be zero");
        selfDestructBeneficiary = _owner;
        emit SelfDestructBeneficiaryUpdated(_owner);
    }

    /**
     * @notice Set the beneficiary address of this contract.
     * @dev Only the contract owner may call this. The provided beneficiary must be non-null.
     * @param _beneficiary The address to pay any eth contained in this contract to upon self-destruction.
     */
    function setSelfDestructBeneficiary(address _beneficiary) external onlyOwner {
        require(_beneficiary != address(0), "Beneficiary must not be zero");
        selfDestructBeneficiary = _beneficiary;
        emit SelfDestructBeneficiaryUpdated(_beneficiary);
    }

    /**
     * @notice Begin the self-destruction counter of this contract.
     * Once the delay has elapsed, the contract may be self-destructed.
     * @dev Only the contract owner may call this.
     */
    function initiateSelfDestruct() external onlyOwner {
        initiationTime = now;
        selfDestructInitiated = true;
        emit SelfDestructInitiated(SELFDESTRUCT_DELAY);
    }

    /**
     * @notice Terminate and reset the self-destruction timer.
     * @dev Only the contract owner may call this.
     */
    function terminateSelfDestruct() external onlyOwner {
        initiationTime = 0;
        selfDestructInitiated = false;
        emit SelfDestructTerminated();
    }

    /**
     * @notice If the self-destruction delay has elapsed, destroy this contract and
     * remit any ether it owns to the beneficiary address.
     * @dev Only the contract owner may call this.
     */
    function selfDestruct() external onlyOwner {
        require(selfDestructInitiated, "Self Destruct not yet initiated");
        require(initiationTime + SELFDESTRUCT_DELAY < now, "Self destruct delay not met");
        address beneficiary = selfDestructBeneficiary;
        emit SelfDestructed(beneficiary);
        selfdestruct(beneficiary);
    }

    event SelfDestructTerminated();
    event SelfDestructed(address beneficiary);
    event SelfDestructInitiated(uint selfDestructDelay);
    event SelfDestructBeneficiaryUpdated(address newBeneficiary);
}


/*
-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       Pausable.sol
version:    1.0
author:     Kevin Brown

date:       2018-05-22

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

This contract allows an inheriting contract to be marked as
paused. It also defines a modifier which can be used by the
inheriting contract to prevent actions while paused.

-----------------------------------------------------------------
*/


/**
 * @title A contract that can be paused by its owner
 */
contract Pausable is Owned {
    uint public lastPauseTime;
    bool public paused;

    /**
     * @dev Constructor
     * @param _owner The account which controls this contract.
     */
    constructor(address _owner) public Owned(_owner) {
        // 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");
        _;
    }
}


/**
 * @title SafeMath
 * @dev Math operations with safety checks that revert on error
 */
library SafeMath {

  /**
  * @dev Multiplies two numbers, reverts on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b, "SafeMath.mul Error");

    return c;
  }

  /**
  * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b > 0, "SafeMath.div Error"); // Solidity only automatically asserts when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold

    return c;
  }

  /**
  * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b <= a, "SafeMath.sub Error");
    uint256 c = a - b;

    return c;
  }

  /**
  * @dev Adds two numbers, reverts on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a, "SafeMath.add Error");

    return c;
  }

  /**
  * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
  * reverts when dividing by zero.
  */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    require(b != 0, "SafeMath.mod Error");
    return a % b;
  }
}


/*

-----------------------------------------------------------------
FILE INFORMATION
-----------------------------------------------------------------

file:       SafeDecimalMath.sol
version:    2.0
author:     Kevin Brown
            Gavin Conway
date:       2018-10-18

-----------------------------------------------------------------
MODULE DESCRIPTION
-----------------------------------------------------------------

A library providing safe mathematical operations for division and
multiplication with the capability to round or truncate the results
to the nearest increment. Operations can return a standard precision
or high precision decimal. High precision decimals are useful for
example when attempting to calculate percentages or fractions
accurately.

-----------------------------------------------------------------
*/


/**
 * @title Safely manipulate unsigned fixed-point decimals at a given precision level.
 * @dev Functions accepting uints in this contract and derived contracts
 * are taken to be such fixed point decimals of a specified precision (either standard
 * or high).
 */
library SafeDecimalMath {
    using SafeMath for uint;

    /* Number of decimal places in the representations. */
    uint8 public constant decimals = 18;
    uint8 public constant highPrecisionDecimals = 27;

    /* The number representing 1.0. */
    uint public constant UNIT = 10**uint(decimals);

    /* The number representing 1.0 for higher fidelity numbers. */
    uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals);
    uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals);

    /** 
     * @return Provides an interface to UNIT.
     */
    function unit() external pure returns (uint) {
        return UNIT;
    }

    /** 
     * @return Provides an interface to PRECISE_UNIT.
     */
    function preciseUnit() external pure returns (uint) {
        return PRECISE_UNIT;
    }

    /**
     * @return The result of multiplying x and y, interpreting the operands as fixed-point
     * decimals.
     * 
     * @dev A unit factor is divided out after the product of x and y is evaluated,
     * so that product must be less than 2**256. As this is an integer division,
     * the internal division always rounds down. This helps save on gas. Rounding
     * is more expensive on gas.
     */
    function multiplyDecimal(uint x, uint y) internal pure returns (uint) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        return x.mul(y) / UNIT;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of the specified precision unit.
     *
     * @dev The operands should be in the form of a the specified unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function _multiplyDecimalRound(uint x, uint y, uint precisionUnit) private pure returns (uint) {
        /* Divide by UNIT to remove the extra factor introduced by the product. */
        uint quotientTimesTen = x.mul(y) / (precisionUnit / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a precise unit.
     *
     * @dev The operands should be in the precise unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
        return _multiplyDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @return The result of safely multiplying x and y, interpreting the operands
     * as fixed-point decimals of a standard unit.
     *
     * @dev The operands should be in the standard unit factor which will be
     * divided out after the product of x and y is evaluated, so that product must be
     * less than 2**256.
     *
     * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
     * Rounding is useful when you need to retain fidelity for small decimal numbers
     * (eg. small fractions or percentages).
     */
    function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) {
        return _multiplyDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is a high
     * precision decimal.
     * 
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and UNIT must be less than 2**256. As
     * this is an integer division, the result is always rounded down.
     * This helps save on gas. Rounding is more expensive on gas.
     */
    function divideDecimal(uint x, uint y) internal pure returns (uint) {
        /* Reintroduce the UNIT factor that will be divided out by y. */
        return x.mul(UNIT).div(y);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * decimal in the precision unit specified in the parameter.
     *
     * @dev y is divided after the product of x and the specified precision unit
     * is evaluated, so the product of x and the specified precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function _divideDecimalRound(uint x, uint y, uint precisionUnit) private pure returns (uint) {
        uint resultTimesTen = x.mul(precisionUnit * 10).div(y);

        if (resultTimesTen % 10 >= 5) {
            resultTimesTen += 10;
        }

        return resultTimesTen / 10;
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * standard precision decimal.
     *
     * @dev y is divided after the product of x and the standard precision unit
     * is evaluated, so the product of x and the standard precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRound(uint x, uint y) internal pure returns (uint) {
        return _divideDecimalRound(x, y, UNIT);
    }

    /**
     * @return The result of safely dividing x and y. The return value is as a rounded
     * high precision decimal.
     *
     * @dev y is divided after the product of x and the high precision unit
     * is evaluated, so the product of x and the high precision unit must
     * be less than 2**256. The result is rounded to the nearest increment.
     */
    function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) {
        return _divideDecimalRound(x, y, PRECISE_UNIT);
    }

    /**
     * @dev Convert a standard decimal representation to a high precision one.
     */
    function decimalToPreciseDecimal(uint i) internal pure returns (uint) {
        return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
    }

    /**
     * @dev Convert a high precision decimal to a standard decimal representation.
     */
    function preciseDecimalToDecimal(uint i) internal pure returns (uint) {
        uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);

        if (quotientTimesTen % 10 >= 5) {
            quotientTimesTen += 10;
        }

        return quotientTimesTen / 10;
    }
}


interface ISynth {
    function burn(address account, uint amount) external;

    function issue(address account, uint amount) external;

    function transfer(address to, uint value) external returns (bool);

    function transferFrom(address from, address to, uint value) external returns (bool);

    function transferFromAndSettle(address from, address to, uint value) external returns (bool);

    function balanceOf(address owner) external view returns (uint);
}


/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract IERC20 {
    function totalSupply() public view returns (uint);

    function balanceOf(address owner) public view returns (uint);

    function allowance(address owner, address spender) public view returns (uint);

    function transfer(address to, uint value) public returns (bool);

    function approve(address spender, uint value) public returns (bool);

    function transferFrom(address from, address to, uint value) public returns (bool);

    // ERC20 Optional
    function name() public view returns (string);

    function symbol() public view returns (string);

    function decimals() public view returns (uint8);

    event Transfer(address indexed from, address indexed to, uint value);

    event Approval(address indexed owner, address indexed spender, uint value);
}


/**
 * @title ExchangeRates interface
 */
interface IExchangeRates {
    function effectiveValue(bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey)
        external
        view
        returns (uint);

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

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

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

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

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

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

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

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

    function ratesAndStaleForCurrencies(bytes32[] currencyKeys) external view returns (uint[], bool);

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


contract AddressResolver is Owned {
    mapping(bytes32 => address) public repository;

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

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

    function importAddresses(bytes32[] names, address[] destinations) public onlyOwner {
        require(names.length == destinations.length, "Input lengths must match");

        for (uint i = 0; i < names.length; i++) {
            repository[names[i]] = destinations[i];
        }
    }

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

    function getAddress(bytes32 name) public view returns (address) {
        return repository[name];
    }

    function requireAndGetAddress(bytes32 name, string reason) public view returns (address) {
        address _foundAddress = repository[name];
        require(_foundAddress != address(0), reason);
        return _foundAddress;
    }
}


contract MixinResolver is Owned {
    AddressResolver public resolver;

    constructor(address _owner, address _resolver) public Owned(_owner) {
        resolver = AddressResolver(_resolver);
    }

    /* ========== SETTERS ========== */

    function setResolver(AddressResolver _resolver) public onlyOwner {
        resolver = _resolver;
    }
}


contract Depot is SelfDestructible, Pausable, ReentrancyGuard, MixinResolver {
    using SafeMath for uint;
    using SafeDecimalMath for uint;

    bytes32 constant SNX = "SNX";
    bytes32 constant ETH = "ETH";

    /* ========== STATE VARIABLES ========== */

    // Address where the ether and Synths raised for selling SNX is transfered to
    // Any ether raised for selling Synths gets sent back to whoever deposited the Synths,
    // and doesn't have anything to do with this address.
    address public fundsWallet;

    /* Stores deposits from users. */
    struct synthDeposit {
        // The user that made the deposit
        address user;
        // The amount (in Synths) that they deposited
        uint amount;
    }

    /* User deposits are sold on a FIFO (First in First out) basis. When users deposit
       synths with us, they get added this queue, which then gets fulfilled in order.
       Conceptually this fits well in an array, but then when users fill an order we
       end up copying the whole array around, so better to use an index mapping instead
       for gas performance reasons.

       The indexes are specified (inclusive, exclusive), so (0, 0) means there's nothing
       in the array, and (3, 6) means there are 3 elements at 3, 4, and 5. You can obtain
       the length of the "array" by querying depositEndIndex - depositStartIndex. All index
       operations use safeAdd, so there is no way to overflow, so that means there is a
       very large but finite amount of deposits this contract can handle before it fills up. */
    mapping(uint => synthDeposit) public deposits;
    // The starting index of our queue inclusive
    uint public depositStartIndex;
    // The ending index of our queue exclusive
    uint public depositEndIndex;

    /* This is a convenience variable so users and dApps can just query how much sUSD
       we have available for purchase without having to iterate the mapping with a
       O(n) amount of calls for something we'll probably want to display quite regularly. */
    uint public totalSellableDeposits;

    // The minimum amount of sUSD required to enter the FiFo queue
    uint public minimumDepositAmount = 50 * SafeDecimalMath.unit();

    // A cap on the amount of sUSD you can buy with ETH in 1 transaction
    uint public maxEthPurchase = 500 * SafeDecimalMath.unit();

    // If a user deposits a synth amount < the minimumDepositAmount the contract will keep
    // the total of small deposits which will not be sold on market and the sender
    // must call withdrawMyDepositedSynths() to get them back.
    mapping(address => uint) public smallDeposits;

    /* ========== CONSTRUCTOR ========== */

    constructor(
        // Ownable
        address _owner,
        // Funds Wallet
        address _fundsWallet,
        // Address Resolver
        address _resolver
    )
        public
        /* Owned is initialised in SelfDestructible */
        SelfDestructible(_owner)
        Pausable(_owner)
        MixinResolver(_owner, _resolver)
    {
        fundsWallet = _fundsWallet;
    }

    /* ========== SETTERS ========== */

    function setMaxEthPurchase(uint _maxEthPurchase) external onlyOwner {
        maxEthPurchase = _maxEthPurchase;
        emit MaxEthPurchaseUpdated(maxEthPurchase);
    }

    /**
     * @notice Set the funds wallet where ETH raised is held
     * @param _fundsWallet The new address to forward ETH and Synths to
     */
    function setFundsWallet(address _fundsWallet) external onlyOwner {
        fundsWallet = _fundsWallet;
        emit FundsWalletUpdated(fundsWallet);
    }

    /**
     * @notice Set the minimum deposit amount required to depoist sUSD into the FIFO queue
     * @param _amount The new new minimum number of sUSD required to deposit
     */
    function setMinimumDepositAmount(uint _amount) external onlyOwner {
        // Do not allow us to set it less than 1 dollar opening up to fractional desposits in the queue again
        require(_amount > SafeDecimalMath.unit(), "Minimum deposit amount must be greater than UNIT");
        minimumDepositAmount = _amount;
        emit MinimumDepositAmountUpdated(minimumDepositAmount);
    }

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

    /**
     * @notice Fallback function (exchanges ETH to sUSD)
     */
    function() external payable {
        exchangeEtherForSynths();
    }

    /**
     * @notice Exchange ETH to sUSD.
     */
    function exchangeEtherForSynths()
        public
        payable
        nonReentrant
        rateNotStale(ETH)
        notPaused
        returns (
            uint // Returns the number of Synths (sUSD) received
        )
    {
        require(msg.value <= maxEthPurchase, "ETH amount above maxEthPurchase limit");
        uint ethToSend;

        // The multiplication works here because exchangeRates().rateForCurrency(ETH) is specified in
        // 18 decimal places, just like our currency base.
        uint requestedToPurchase = msg.value.multiplyDecimal(exchangeRates().rateForCurrency(ETH));
        uint remainingToFulfill = requestedToPurchase;

        // Iterate through our outstanding deposits and sell them one at a time.
        for (uint i = depositStartIndex; remainingToFulfill > 0 && i < depositEndIndex; i++) {
            synthDeposit memory deposit = deposits[i];

            // If it's an empty spot in the queue from a previous withdrawal, just skip over it and
            // update the queue. It's already been deleted.
            if (deposit.user == address(0)) {
                depositStartIndex = depositStartIndex.add(1);
            } else {
                // If the deposit can more than fill the order, we can do this
                // without touching the structure of our queue.
                if (deposit.amount > remainingToFulfill) {
                    // Ok, this deposit can fulfill the whole remainder. We don't need
                    // to change anything about our queue we can just fulfill it.
                    // Subtract the amount from our deposit and total.
                    uint newAmount = deposit.amount.sub(remainingToFulfill);
                    deposits[i] = synthDeposit({user: deposit.user, amount: newAmount});

                    totalSellableDeposits = totalSellableDeposits.sub(remainingToFulfill);

                    // Transfer the ETH to the depositor. Send is used instead of transfer
                    // so a non payable contract won't block the FIFO queue on a failed
                    // ETH payable for synths transaction. The proceeds to be sent to the
                    // synthetix foundation funds wallet. This is to protect all depositors
                    // in the queue in this rare case that may occur.
                    ethToSend = remainingToFulfill.divideDecimal(exchangeRates().rateForCurrency(ETH));

                    // We need to use send here instead of transfer because transfer reverts
                    // if the recipient is a non-payable contract. Send will just tell us it
                    // failed by returning false at which point we can continue.
                    // solium-disable-next-line security/no-send
                    if (!deposit.user.send(ethToSend)) {
                        fundsWallet.transfer(ethToSend);
                        emit NonPayableContract(deposit.user, ethToSend);
                    } else {
                        emit ClearedDeposit(msg.sender, deposit.user, ethToSend, remainingToFulfill, i);
                    }

                    // And the Synths to the recipient.
                    // Note: Fees are calculated by the Synth contract, so when
                    //       we request a specific transfer here, the fee is
                    //       automatically deducted and sent to the fee pool.
                    synthsUSD().transfer(msg.sender, remainingToFulfill);

                    // And we have nothing left to fulfill on this order.
                    remainingToFulfill = 0;
                } else if (deposit.amount <= remainingToFulfill) {
                    // We need to fulfill this one in its entirety and kick it out of the queue.
                    // Start by kicking it out of the queue.
                    // Free the storage because we can.
                    delete deposits[i];
                    // Bump our start index forward one.
                    depositStartIndex = depositStartIndex.add(1);
                    // We also need to tell our total it's decreased
                    totalSellableDeposits = totalSellableDeposits.sub(deposit.amount);

                    // Now fulfill by transfering the ETH to the depositor. Send is used instead of transfer
                    // so a non payable contract won't block the FIFO queue on a failed
                    // ETH payable for synths transaction. The proceeds to be sent to the
                    // synthetix foundation funds wallet. This is to protect all depositors
                    // in the queue in this rare case that may occur.
                    ethToSend = deposit.amount.divideDecimal(exchangeRates().rateForCurrency(ETH));

                    // We need to use send here instead of transfer because transfer reverts
                    // if the recipient is a non-payable contract. Send will just tell us it
                    // failed by returning false at which point we can continue.
                    // solium-disable-next-line security/no-send
                    if (!deposit.user.send(ethToSend)) {
                        fundsWallet.transfer(ethToSend);
                        emit NonPayableContract(deposit.user, ethToSend);
                    } else {
                        emit ClearedDeposit(msg.sender, deposit.user, ethToSend, deposit.amount, i);
                    }

                    // And the Synths to the recipient.
                    // Note: Fees are calculated by the Synth contract, so when
                    //       we request a specific transfer here, the fee is
                    //       automatically deducted and sent to the fee pool.
                    synthsUSD().transfer(msg.sender, deposit.amount);

                    // And subtract the order from our outstanding amount remaining
                    // for the next iteration of the loop.
                    remainingToFulfill = remainingToFulfill.sub(deposit.amount);
                }
            }
        }

        // Ok, if we're here and 'remainingToFulfill' isn't zero, then
        // we need to refund the remainder of their ETH back to them.
        if (remainingToFulfill > 0) {
            msg.sender.transfer(remainingToFulfill.divideDecimal(exchangeRates().rateForCurrency(ETH)));
        }

        // How many did we actually give them?
        uint fulfilled = requestedToPurchase.sub(remainingToFulfill);

        if (fulfilled > 0) {
            // Now tell everyone that we gave them that many (only if the amount is greater than 0).
            emit Exchange("ETH", msg.value, "sUSD", fulfilled);
        }

        return fulfilled;
    }

    /**
     * @notice Exchange ETH to sUSD while insisting on a particular rate. This allows a user to
     *         exchange while protecting against frontrunning by the contract owner on the exchange rate.
     * @param guaranteedRate The exchange rate (ether price) which must be honored or the call will revert.
     */
    function exchangeEtherForSynthsAtRate(uint guaranteedRate)
        public
        payable
        rateNotStale(ETH)
        notPaused
        returns (
            uint // Returns the number of Synths (sUSD) received
        )
    {
        require(guaranteedRate == exchangeRates().rateForCurrency(ETH), "Guaranteed rate would not be received");

        return exchangeEtherForSynths();
    }

    /**
     * @notice Exchange ETH to SNX.
     */
    function exchangeEtherForSNX()
        public
        payable
        rateNotStale(SNX)
        rateNotStale(ETH)
        notPaused
        returns (
            uint // Returns the number of SNX received
        )
    {
        // How many SNX are they going to be receiving?
        uint synthetixToSend = synthetixReceivedForEther(msg.value);

        // Store the ETH in our funds wallet
        fundsWallet.transfer(msg.value);

        // And send them the SNX.
        synthetix().transfer(msg.sender, synthetixToSend);

        emit Exchange("ETH", msg.value, "SNX", synthetixToSend);

        return synthetixToSend;
    }

    /**
     * @notice Exchange ETH to SNX while insisting on a particular set of rates. This allows a user to
     *         exchange while protecting against frontrunning by the contract owner on the exchange rates.
     * @param guaranteedEtherRate The ether exchange rate which must be honored or the call will revert.
     * @param guaranteedSynthetixRate The synthetix exchange rate which must be honored or the call will revert.
     */
    function exchangeEtherForSNXAtRate(uint guaranteedEtherRate, uint guaranteedSynthetixRate)
        public
        payable
        rateNotStale(SNX)
        rateNotStale(ETH)
        notPaused
        returns (
            uint // Returns the number of SNX received
        )
    {
        require(guaranteedEtherRate == exchangeRates().rateForCurrency(ETH), "Guaranteed ether rate would not be received");
        require(
            guaranteedSynthetixRate == exchangeRates().rateForCurrency(SNX),
            "Guaranteed synthetix rate would not be received"
        );

        return exchangeEtherForSNX();
    }

    /**
     * @notice Exchange sUSD for SNX
     * @param synthAmount The amount of synths the user wishes to exchange.
     */
    function exchangeSynthsForSNX(uint synthAmount)
        public
        rateNotStale(SNX)
        notPaused
        returns (
            uint // Returns the number of SNX received
        )
    {
        // How many SNX are they going to be receiving?
        uint synthetixToSend = synthetixReceivedForSynths(synthAmount);

        // Ok, transfer the Synths to our funds wallet.
        // These do not go in the deposit queue as they aren't for sale as such unless
        // they're sent back in from the funds wallet.
        synthsUSD().transferFrom(msg.sender, fundsWallet, synthAmount);

        // And send them the SNX.
        synthetix().transfer(msg.sender, synthetixToSend);

        emit Exchange("sUSD", synthAmount, "SNX", synthetixToSend);

        return synthetixToSend;
    }

    /**
     * @notice Exchange sUSD for SNX while insisting on a particular rate. This allows a user to
     *         exchange while protecting against frontrunning by the contract owner on the exchange rate.
     * @param synthAmount The amount of synths the user wishes to exchange.
     * @param guaranteedRate A rate (synthetix price) the caller wishes to insist upon.
     */
    function exchangeSynthsForSNXAtRate(uint synthAmount, uint guaranteedRate)
        public
        rateNotStale(SNX)
        notPaused
        returns (
            uint // Returns the number of SNX received
        )
    {
        require(guaranteedRate == exchangeRates().rateForCurrency(SNX), "Guaranteed rate would not be received");

        return exchangeSynthsForSNX(synthAmount);
    }

    /**
     * @notice Allows the owner to withdraw SNX from this contract if needed.
     * @param amount The amount of SNX to attempt to withdraw (in 18 decimal places).
     */
    function withdrawSynthetix(uint amount) external onlyOwner {
        synthetix().transfer(owner, amount);

        // We don't emit our own events here because we assume that anyone
        // who wants to watch what the Depot is doing can
        // just watch ERC20 events from the Synth and/or Synthetix contracts
        // filtered to our address.
    }

    /**
     * @notice Allows a user to withdraw all of their previously deposited synths from this contract if needed.
     *         Developer note: We could keep an index of address to deposits to make this operation more efficient
     *         but then all the other operations on the queue become less efficient. It's expected that this
     *         function will be very rarely used, so placing the inefficiency here is intentional. The usual
     *         use case does not involve a withdrawal.
     */
    function withdrawMyDepositedSynths() external {
        uint synthsToSend = 0;

        for (uint i = depositStartIndex; i < depositEndIndex; i++) {
            synthDeposit memory deposit = deposits[i];

            if (deposit.user == msg.sender) {
                // The user is withdrawing this deposit. Remove it from our queue.
                // We'll just leave a gap, which the purchasing logic can walk past.
                synthsToSend = synthsToSend.add(deposit.amount);
                delete deposits[i];
                //Let the DApps know we've removed this deposit
                emit SynthDepositRemoved(deposit.user, deposit.amount, i);
            }
        }

        // Update our total
        totalSellableDeposits = totalSellableDeposits.sub(synthsToSend);

        // Check if the user has tried to send deposit amounts < the minimumDepositAmount to the FIFO
        // queue which would have been added to this mapping for withdrawal only
        synthsToSend = synthsToSend.add(smallDeposits[msg.sender]);
        smallDeposits[msg.sender] = 0;

        // If there's nothing to do then go ahead and revert the transaction
        require(synthsToSend > 0, "You have no deposits to withdraw.");

        // Send their deposits back to them (minus fees)
        synthsUSD().transfer(msg.sender, synthsToSend);

        emit SynthWithdrawal(msg.sender, synthsToSend);
    }

    /**
     * @notice depositSynths: Allows users to deposit synths via the approve / transferFrom workflow
     * @param amount The amount of sUSD you wish to deposit (must have been approved first)
     */
    function depositSynths(uint amount) external {
        // Grab the amount of synths. Will fail if not approved first
        synthsUSD().transferFrom(msg.sender, this, amount);

        // A minimum deposit amount is designed to protect purchasers from over paying
        // gas for fullfilling multiple small synth deposits
        if (amount < minimumDepositAmount) {
            // We cant fail/revert the transaction or send the synths back in a reentrant call.
            // So we will keep your synths balance seperate from the FIFO queue so you can withdraw them
            smallDeposits[msg.sender] = smallDeposits[msg.sender].add(amount);

            emit SynthDepositNotAccepted(msg.sender, amount, minimumDepositAmount);
        } else {
            // Ok, thanks for the deposit, let's queue it up.
            deposits[depositEndIndex] = synthDeposit({user: msg.sender, amount: amount});
            emit SynthDeposit(msg.sender, amount, depositEndIndex);

            // Walk our index forward as well.
            depositEndIndex = depositEndIndex.add(1);

            // And add it to our total.
            totalSellableDeposits = totalSellableDeposits.add(amount);
        }
    }

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

    /**
     * @notice Calculate how many SNX you will receive if you transfer
     *         an amount of synths.
     * @param amount The amount of synths (in 18 decimal places) you want to ask about
     */
    function synthetixReceivedForSynths(uint amount) public view returns (uint) {
        // And what would that be worth in SNX based on the current price?
        return amount.divideDecimal(exchangeRates().rateForCurrency(SNX));
    }

    /**
     * @notice Calculate how many SNX you will receive if you transfer
     *         an amount of ether.
     * @param amount The amount of ether (in wei) you want to ask about
     */
    function synthetixReceivedForEther(uint amount) public view returns (uint) {
        // How much is the ETH they sent us worth in sUSD (ignoring the transfer fee)?
        uint valueSentInSynths = amount.multiplyDecimal(exchangeRates().rateForCurrency(ETH));

        // Now, how many SNX will that USD amount buy?
        return synthetixReceivedForSynths(valueSentInSynths);
    }

    /**
     * @notice Calculate how many synths you will receive if you transfer
     *         an amount of ether.
     * @param amount The amount of ether (in wei) you want to ask about
     */
    function synthsReceivedForEther(uint amount) public view returns (uint) {
        // How many synths would that amount of ether be worth?
        return amount.multiplyDecimal(exchangeRates().rateForCurrency(ETH));
    }

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

    function synthsUSD() internal view returns (ISynth) {
        return ISynth(resolver.requireAndGetAddress("SynthsUSD", "Missing SynthsUSD address"));
    }

    function synthetix() internal view returns (IERC20) {
        return IERC20(resolver.requireAndGetAddress("Synthetix", "Missing Synthetix address"));
    }

    function exchangeRates() internal view returns (IExchangeRates) {
        return IExchangeRates(resolver.requireAndGetAddress("ExchangeRates", "Missing ExchangeRates address"));
    }

    // ========== MODIFIERS ==========

    modifier rateNotStale(bytes32 currencyKey) {
        require(!exchangeRates().rateIsStale(currencyKey), "Rate stale or not a synth");
        _;
    }

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

    event MaxEthPurchaseUpdated(uint amount);
    event FundsWalletUpdated(address newFundsWallet);
    event Exchange(string fromCurrency, uint fromAmount, string toCurrency, uint toAmount);
    event SynthWithdrawal(address user, uint amount);
    event SynthDeposit(address indexed user, uint amount, uint indexed depositIndex);
    event SynthDepositRemoved(address indexed user, uint amount, uint indexed depositIndex);
    event SynthDepositNotAccepted(address user, uint amount, uint minimum);
    event MinimumDepositAmountUpdated(uint amount);
    event NonPayableContract(address indexed receiver, uint amount);
    event ClearedDeposit(
        address indexed fromAddress,
        address indexed toAddress,
        uint fromETHAmount,
        uint toAmount,
        uint indexed depositIndex
    );
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[],"name":"exchangeEtherForSNX","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"resolver","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minimumDepositAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guaranteedRate","type":"uint256"}],"name":"exchangeEtherForSynthsAtRate","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"amount","type":"uint256"}],"name":"synthsReceivedForEther","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"initiationTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exchangeEtherForSynths","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_beneficiary","type":"address"}],"name":"setSelfDestructBeneficiary","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"fundsWallet","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"terminateSelfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSellableDeposits","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_resolver","type":"address"}],"name":"setResolver","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_fundsWallet","type":"address"}],"name":"setFundsWallet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"depositStartIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawMyDepositedSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPauseTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guaranteedEtherRate","type":"uint256"},{"name":"guaranteedSynthetixRate","type":"uint256"}],"name":"exchangeEtherForSNXAtRate","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"selfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"amount","type":"uint256"}],"name":"synthetixReceivedForSynths","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SELFDESTRUCT_DELAY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"setMinimumDepositAmount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"deposits","outputs":[{"name":"user","type":"address"},{"name":"amount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"synthAmount","type":"uint256"},{"name":"guaranteedRate","type":"uint256"}],"name":"exchangeSynthsForSNXAtRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"maxEthPurchase","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"selfDestructInitiated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_maxEthPurchase","type":"uint256"}],"name":"setMaxEthPurchase","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"initiateSelfDestruct","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"selfDestructBeneficiary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"smallDeposits","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"amount","type":"uint256"}],"name":"synthetixReceivedForEther","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"depositSynths","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdrawSynthetix","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"synthAmount","type":"uint256"}],"name":"exchangeSynthsForSNX","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"depositEndIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_owner","type":"address"},{"name":"_fundsWallet","type":"address"},{"name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"MaxEthPurchaseUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newFundsWallet","type":"address"}],"name":"FundsWalletUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"fromCurrency","type":"string"},{"indexed":false,"name":"fromAmount","type":"uint256"},{"indexed":false,"name":"toCurrency","type":"string"},{"indexed":false,"name":"toAmount","type":"uint256"}],"name":"Exchange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"user","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"SynthWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"user","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":true,"name":"depositIndex","type":"uint256"}],"name":"SynthDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"user","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":true,"name":"depositIndex","type":"uint256"}],"name":"SynthDepositRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"user","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"minimum","type":"uint256"}],"name":"SynthDepositNotAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"MinimumDepositAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"receiver","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"NonPayableContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"fromAddress","type":"address"},{"indexed":true,"name":"toAddress","type":"address"},{"indexed":false,"name":"fromETHAmount","type":"uint256"},{"indexed":false,"name":"toAmount","type":"uint256"},{"indexed":true,"name":"depositIndex","type":"uint256"}],"name":"ClearedDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"SelfDestructTerminated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"beneficiary","type":"address"}],"name":"SelfDestructed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"selfDestructDelay","type":"uint256"}],"name":"SelfDestructInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newBeneficiary","type":"address"}],"name":"SelfDestructBeneficiaryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldOwner","type":"address"},{"indexed":false,"name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"}]

608060408190527f907af6c00000000000000000000000000000000000000000000000000000000081527384d626b2bb4d0f064067e4bf80fce7055d8f3e7b9063907af6c09060849060209060048186803b1580156200005e57600080fd5b505af415801562000073573d6000803e3d6000fd5b505050506040513d60208110156200008a57600080fd5b5051603202600d55604080517f907af6c000000000000000000000000000000000000000000000000000000000815290517384d626b2bb4d0f064067e4bf80fce7055d8f3e7b9163907af6c0916004808301926020929190829003018186803b158015620000f757600080fd5b505af41580156200010c573d6000803e3d6000fd5b505050506040513d60208110156200012357600080fd5b50516101f402600e553480156200013957600080fd5b50604051606080620039568339810160409081528151602083015191909201518281818080600160a060020a0381161515620001d657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f74206265203000000000000000604482015290519081900360640190fd5b60008054600160a060020a031916600160a060020a038316908117825560408051928352602083019190915280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a150600160a060020a0381161515620002a757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f776e6572206d757374206e6f74206265207a65726f00000000000000000000604482015290519081900360640190fd5b60038054600160a060020a038316610100810261010060a860020a03199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a15050600160065560078054600160a060020a03928316600160a060020a031991821617909155600880549590921694169390931790925550505061360c806200034a6000396000f3006080604052600436106101d45763ffffffff60e060020a6000350416630227943881146101df57806304f3bcec146101f9578063080c279a1461022a5780630c928bc21461023f5780630c928f051461024a5780631627540c1461026257806316c38b3c1461028557806317c70de41461029f5780631f930115146102b457806320714f88146102bc5780632194f3a2146102dd5780633278c960146102f25780634d0387fb146103075780634e543b261461031c57806353a47bb71461033d5780635c975abb1461035257806364e39b871461037b5780636d5ab4a91461039c57806379ba5097146103b157806381b797dc146103c65780638da5cb5b146103db57806391b4ded9146103f05780639342c0eb146104055780639cb8a26a14610413578063a3d8829b14610428578063a461fc8214610440578063aab483d614610455578063b02c43d01461046d578063b0c2cb96146104a8578063b1338cc4146104c3578063b8225dec146104d8578063bb7df172146104ed578063bd32aa4414610505578063c58aaae61461051a578063c6abb7c71461052f578063c8d889f214610550578063dc8fa6c214610568578063e6d76a7614610580578063f852d39314610598578063fd12167f146105b0575b6101dc6105c5565b50005b6101e7610fae565b60408051918252519081900360200190f35b34801561020557600080fd5b5061020e611304565b60408051600160a060020a039092168252519081900360200190f35b34801561023657600080fd5b506101e7611313565b6101e7600435611319565b34801561025657600080fd5b506101e760043561155e565b34801561026e57600080fd5b50610283600160a060020a0360043516611601565b005b34801561029157600080fd5b5061028360043515156116b9565b3480156102ab57600080fd5b506101e761178f565b6101e76105c5565b3480156102c857600080fd5b50610283600160a060020a0360043516611795565b3480156102e957600080fd5b5061020e6118c2565b3480156102fe57600080fd5b506102836118d1565b34801561031357600080fd5b506101e761196f565b34801561032857600080fd5b50610283600160a060020a0360043516611975565b34801561034957600080fd5b5061020e6119fb565b34801561035e57600080fd5b50610367611a0a565b604080519115158252519081900360200190f35b34801561038757600080fd5b50610283600160a060020a0360043516611a13565b3480156103a857600080fd5b506101e7611ad1565b3480156103bd57600080fd5b50610283611ad7565b3480156103d257600080fd5b50610283611bd2565b3480156103e757600080fd5b5061020e611e5b565b3480156103fc57600080fd5b506101e7611e6a565b6101e7600435602435611e70565b34801561041f57600080fd5b5061028361228e565b34801561043457600080fd5b506101e7600435612407565b34801561044c57600080fd5b506101e76124a4565b34801561046157600080fd5b506102836004356124ab565b34801561047957600080fd5b50610485600435612639565b60408051600160a060020a03909316835260208301919091528051918290030190f35b3480156104b457600080fd5b506101e760043560243561265e565b3480156104cf57600080fd5b506101e76128a7565b3480156104e457600080fd5b506103676128ad565b3480156104f957600080fd5b506102836004356128b6565b34801561051157600080fd5b50610283612955565b34801561052657600080fd5b5061020e612a02565b34801561053b57600080fd5b506101e7600160a060020a0360043516612a16565b34801561055c57600080fd5b506101e7600435612a28565b34801561057457600080fd5b50610283600435612ad1565b34801561058c57600080fd5b50610283600435612cae565b3480156105a457600080fd5b506101e7600435612dbb565b3480156105bc57600080fd5b506101e76130cb565b60008060008060006105d5613529565b6006805460010190819055600090819060eb60020a6208aa89026105f76130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b15801561064657600080fd5b505af115801561065a573d6000803e3d6000fd5b505050506040513d602081101561067057600080fd5b5051156106b5576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60055460ff1615610712576040805160e560020a62461bcd02815260206004820152603c60248201526000805160206135a18339815191526044820152600080516020613541833981519152606482015290519081900360840190fd5b600e54341115610792576040805160e560020a62461bcd02815260206004820152602560248201527f45544820616d6f756e742061626f7665206d617845746850757263686173652060448201527f6c696d6974000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61082d61079d6130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b1580156107f457600080fd5b505af1158015610808573d6000803e3d6000fd5b505050506040513d602081101561081e57600080fd5b5051349063ffffffff6131bb16565b9750879650600a5495505b6000871180156108495750600b5486105b15610e175760008681526009602090815260409182902082518084019093528054600160a060020a03168084526001909101549183019190915290955015156108a857600a546108a090600163ffffffff6131e716565b600a55610e0c565b8685602001511115610b5b5760208501516108c9908863ffffffff61324416565b6040805180820182528751600160a060020a039081168252602080830185815260008c8152600990925293902091518254600160a060020a03191691161781559051600190910155600c549094506109219088613244565b600c556109bf61092f6130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b15801561098657600080fd5b505af115801561099a573d6000803e3d6000fd5b505050506040513d60208110156109b057600080fd5b5051889063ffffffff6132a616565b8551604051919a50600160a060020a0316908a156108fc02908b906000818181858888f193505050501515610a6f57600854604051600160a060020a03909116908a156108fc02908b906000818181858888f19350505050158015610a28573d6000803e3d6000fd5b508451604080518b81529051600160a060020a03909216917ff2435d3901399daa085f8b58d2409fff9b83ce4ca97c1f144b532f5a08b1c96c9181900360200190a2610abb565b8451604080518b8152602081018a905281518993600160a060020a03169233927f6d957e9e816107f67cb7118461e3c259e96896f80223c9af2972596c2fdd401c929081900390910190a45b610ac36132d0565b600160a060020a031663a9059cbb33896040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506040513d6020811015610b4f57600080fd5b5060009750610e0c9050565b60208501518710610e0c5760008681526009602052604081208054600160a060020a0319168155600190810191909155600a54610b9d9163ffffffff6131e716565b600a556020850151600c54610bb79163ffffffff61324416565b600c55610c59610bc56130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b158015610c1c57600080fd5b505af1158015610c30573d6000803e3d6000fd5b505050506040513d6020811015610c4657600080fd5b505160208701519063ffffffff6132a616565b8551604051919a50600160a060020a0316908a156108fc02908b906000818181858888f193505050501515610d0957600854604051600160a060020a03909116908a156108fc02908b906000818181858888f19350505050158015610cc2573d6000803e3d6000fd5b508451604080518b81529051600160a060020a03909216917ff2435d3901399daa085f8b58d2409fff9b83ce4ca97c1f144b532f5a08b1c96c9181900360200190a2610d59565b8451602080870151604080518d81529283019190915280518993600160a060020a03169233927f6d957e9e816107f67cb7118461e3c259e96896f80223c9af2972596c2fdd401c92918290030190a45b610d616132d0565b600160a060020a031663a9059cbb3387602001516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610dc757600080fd5b505af1158015610ddb573d6000803e3d6000fd5b505050506040513d6020811015610df157600080fd5b50506020850151610e0990889063ffffffff61324416565b96505b600190950194610838565b6000871115610ee957336108fc610ebf610e2f6130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b158015610e8657600080fd5b505af1158015610e9a573d6000803e3d6000fd5b505050506040513d6020811015610eb057600080fd5b50518a9063ffffffff6132a616565b6040518115909202916000818181858888f19350505050158015610ee7573d6000803e3d6000fd5b505b610ef9888863ffffffff61324416565b92506000831115610f91576040805134602082015260608101859052608080825260039082015260eb60020a6208aa890260a082015260c08183018190526004908201527f735553440000000000000000000000000000000000000000000000000000000060e082015290517fdb1741ffc6844b04a9284bb6337fb0ccfe543a493ef0ac8e725242201e93d4bd918190036101000190a15b829950506006548114610fa357600080fd5b505050505050505090565b60008060eb60020a620a69cb02610fc36130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b15801561101257600080fd5b505af1158015611026573d6000803e3d6000fd5b505050506040513d602081101561103c57600080fd5b505115611081576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60eb60020a6208aa89026110936130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b1580156110e257600080fd5b505af11580156110f6573d6000803e3d6000fd5b505050506040513d602081101561110c57600080fd5b505115611151576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60055460ff16156111ae576040805160e560020a62461bcd02815260206004820152603c60248201526000805160206135a18339815191526044820152600080516020613541833981519152606482015290519081900360840190fd5b6111b734612a28565b600854604051919450600160a060020a0316903480156108fc02916000818181858888f193505050501580156111f1573d6000803e3d6000fd5b506111fa613389565b600160a060020a031663a9059cbb33856040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561125c57600080fd5b505af1158015611270573d6000803e3d6000fd5b505050506040513d602081101561128657600080fd5b505060408051346020820152606081018590526080808252600390820181905260eb60020a6208aa890260a083015260c082840181905282015260eb60020a620a69cb0260e082015290517fdb1741ffc6844b04a9284bb6337fb0ccfe543a493ef0ac8e725242201e93d4bd918190036101000190a1509092915050565b600754600160a060020a031681565b600d5481565b600060eb60020a6208aa890261132d6130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b15801561137c57600080fd5b505af1158015611390573d6000803e3d6000fd5b505050506040513d60208110156113a657600080fd5b5051156113eb576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60055460ff1615611448576040805160e560020a62461bcd02815260206004820152603c60248201526000805160206135a18339815191526044820152600080516020613541833981519152606482015290519081900360840190fd5b6114506130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b1580156114a757600080fd5b505af11580156114bb573d6000803e3d6000fd5b505050506040513d60208110156114d157600080fd5b5051831461154f576040805160e560020a62461bcd02815260206004820152602560248201527f47756172616e74656564207261746520776f756c64206e6f742062652072656360448201527f6569766564000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6115576105c5565b9392505050565b60006115fb61156b6130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b1580156115c257600080fd5b505af11580156115d6573d6000803e3d6000fd5b505050506040513d60208110156115ec57600080fd5b5051839063ffffffff6131bb16565b92915050565b600054600160a060020a03163314611665576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b60018054600160a060020a038316600160a060020a0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b600054600160a060020a0316331461171d576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b60055460ff16151581151514156117335761178c565b6005805460ff1916821515179081905560ff161561175057426004555b6005546040805160ff90921615158252517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59181900360200190a15b50565b60025481565b600054600160a060020a031633146117f9576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b600160a060020a0381161515611859576040805160e560020a62461bcd02815260206004820152601c60248201527f42656e6566696369617279206d757374206e6f74206265207a65726f00000000604482015290519081900360640190fd5b60038054600160a060020a038316610100810274ffffffffffffffffffffffffffffffffffffffff00199092169190911790915560408051918252517fd5da63a0b864b315bc04128dedbc93888c8529ee6cf47ce664dc204339228c539181900360200190a150565b600854600160a060020a031681565b600054600160a060020a03163314611935576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b600060028190556003805460ff191690556040517f6adcc7125002935e0aa31697538ebbd65cfddf20431eb6ecdcfc3e238bfd082c9190a1565b600c5481565b600054600160a060020a031633146119d9576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b60078054600160a060020a031916600160a060020a0392909216919091179055565b600154600160a060020a031681565b60055460ff1681565b600054600160a060020a03163314611a77576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b60088054600160a060020a031916600160a060020a03838116919091179182905560408051929091168252517f4deb077bf9c4bc824cc2c989e01a5e53b0a4ecc44c5039d46abc9ffc88f8a050916020908290030190a150565b600a5481565b600154600160a060020a03163314611b5f576040805160e560020a62461bcd02815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e6572736869700000000000000000000000606482015290519081900360840190fd5b60005460015460408051600160a060020a03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b600080611bdd613529565b60009250600a5491505b600b54821015611cbd575060008181526009602090815260409182902082518084019093528054600160a060020a031680845260019091015491830191909152331415611cb2576020810151611c4490849063ffffffff6131e716565b60008381526009602090815260408083208054600160a060020a031916815560010192909255835184820151835190815292519396508593600160a060020a03909116927f3aa2b18eace5e5727a4ab525921b9b0a1ca1afdb0f96b599e3ab2d76cb5e7f7292908290030190a35b600190910190611be7565b600c54611cd0908463ffffffff61324416565b600c55336000908152600f6020526040902054611cf490849063ffffffff6131e716565b336000908152600f602052604081208190559093508311611d85576040805160e560020a62461bcd02815260206004820152602160248201527f596f752068617665206e6f206465706f7369747320746f20776974686472617760448201527f2e00000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b611d8d6132d0565b600160a060020a031663a9059cbb33856040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015611def57600080fd5b505af1158015611e03573d6000803e3d6000fd5b505050506040513d6020811015611e1957600080fd5b5050604080513381526020810185905281517faf6ec623f558c7b3527ff6c9c09432c7d81a3d38bd2e1eaaee2efe7aac23c28b929181900390910190a1505050565b600054600160a060020a031681565b60045481565b600060eb60020a620a69cb02611e846130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b158015611ed357600080fd5b505af1158015611ee7573d6000803e3d6000fd5b505050506040513d6020811015611efd57600080fd5b505115611f42576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60eb60020a6208aa8902611f546130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b158015611fa357600080fd5b505af1158015611fb7573d6000803e3d6000fd5b505050506040513d6020811015611fcd57600080fd5b505115612012576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60055460ff161561206f576040805160e560020a62461bcd02815260206004820152603c60248201526000805160206135a18339815191526044820152600080516020613541833981519152606482015290519081900360840190fd5b6120776130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b1580156120ce57600080fd5b505af11580156120e2573d6000803e3d6000fd5b505050506040513d60208110156120f857600080fd5b50518514612176576040805160e560020a62461bcd02815260206004820152602b60248201527f47756172616e74656564206574686572207261746520776f756c64206e6f742060448201527f6265207265636569766564000000000000000000000000000000000000000000606482015290519081900360840190fd5b61217e6130d1565b6040805160e360020a6315905ec102815260eb60020a620a69cb0260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b1580156121d557600080fd5b505af11580156121e9573d6000803e3d6000fd5b505050506040513d60208110156121ff57600080fd5b5051841461227d576040805160e560020a62461bcd02815260206004820152602f60248201527f47756172616e746565642073796e746865746978207261746520776f756c642060448201527f6e6f742062652072656365697665640000000000000000000000000000000000606482015290519081900360840190fd5b612285610fae565b95945050505050565b60008054600160a060020a031633146122f3576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b60035460ff16151561234f576040805160e560020a62461bcd02815260206004820152601f60248201527f53656c66204465737472756374206e6f742079657420696e6974696174656400604482015290519081900360640190fd5b426224ea00600254011015156123af576040805160e560020a62461bcd02815260206004820152601b60248201527f53656c662064657374727563742064656c6179206e6f74206d65740000000000604482015290519081900360640190fd5b5060035460408051600160a060020a0361010090930492909216808352905190917f8a09e1677ced846cb537dc2b172043bd05a1a81ad7e0033a7ef8ba762df990b7919081900360200190a180600160a060020a0316ff5b60006115fb6124146130d1565b6040805160e360020a6315905ec102815260eb60020a620a69cb0260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b15801561246b57600080fd5b505af115801561247f573d6000803e3d6000fd5b505050506040513d602081101561249557600080fd5b5051839063ffffffff6132a616565b6224ea0081565b600054600160a060020a0316331461250f576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b7384d626b2bb4d0f064067e4bf80fce7055d8f3e7b63907af6c06040518163ffffffff1660e060020a02815260040160206040518083038186803b15801561255657600080fd5b505af415801561256a573d6000803e3d6000fd5b505050506040513d602081101561258057600080fd5b505181116125fe576040805160e560020a62461bcd02815260206004820152603060248201527f4d696e696d756d206465706f73697420616d6f756e74206d757374206265206760448201527f726561746572207468616e20554e495400000000000000000000000000000000606482015290519081900360840190fd5b600d8190556040805182815290517fa39eacd162ee82c70b2b030a1bc8fe89adcccc61122fad4821a8772dbcc542679181900360200190a150565b60096020526000908152604090208054600190910154600160a060020a039091169082565b600060eb60020a620a69cb026126726130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b1580156126c157600080fd5b505af11580156126d5573d6000803e3d6000fd5b505050506040513d60208110156126eb57600080fd5b505115612730576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60055460ff161561278d576040805160e560020a62461bcd02815260206004820152603c60248201526000805160206135a18339815191526044820152600080516020613541833981519152606482015290519081900360840190fd5b6127956130d1565b6040805160e360020a6315905ec102815260eb60020a620a69cb0260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b1580156127ec57600080fd5b505af1158015612800573d6000803e3d6000fd5b505050506040513d602081101561281657600080fd5b50518314612894576040805160e560020a62461bcd02815260206004820152602560248201527f47756172616e74656564207261746520776f756c64206e6f742062652072656360448201527f6569766564000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61289d84612dbb565b91505b5092915050565b600e5481565b60035460ff1681565b600054600160a060020a0316331461291a576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b600e8190556040805182815290517fdc2be810a133e01cb21a41082f15b2863d96f9fe79d1f84d7e2d5b810c5c82439181900360200190a150565b600054600160a060020a031633146129b9576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b426002556003805460ff19166001179055604080516224ea00815290517fcbd94ca75b8dc45c9d80c77e851670e78843c0d75180cb81db3e2158228fa9a69181900360200190a1565b6003546101009004600160a060020a031681565b600f6020526000908152604090205481565b600080612ac6612a366130d1565b6040805160e360020a6315905ec102815260eb60020a6208aa890260048201529051600160a060020a03929092169163ac82f608916024808201926020929091908290030181600087803b158015612a8d57600080fd5b505af1158015612aa1573d6000803e3d6000fd5b505050506040513d6020811015612ab757600080fd5b5051849063ffffffff6131bb16565b905061155781612407565b612ad96132d0565b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490529051600160a060020a0392909216916323b872dd916064808201926020929091908290030181600087803b158015612b4a57600080fd5b505af1158015612b5e573d6000803e3d6000fd5b505050506040513d6020811015612b7457600080fd5b5050600d54811015612bfd57336000908152600f6020526040902054612ba0908263ffffffff6131e716565b336000818152600f602090815260409182902093909355600d5481519283529282018490528181019290925290517fbc3a12638d840d60760c64b39c73985a6498cf6eb8176f124995b0e07236cbd29181900360600190a161178c565b604080518082018252338082526020808301858152600b805460009081526009845286902094518554600160a060020a031916600160a060020a039091161785559051600190940193909355915483518581529351909391927fd9acabe6e09d178728ba5c366661c5be0621b4770f216305b059ec175b37e0b4928290030190a3600b54612c9290600163ffffffff6131e716565b600b55600c54612ca8908263ffffffff6131e716565b600c5550565b600054600160a060020a03163314612d12576040805160e560020a62461bcd02815260206004820152602f60248201526000805160206135618339815191526044820152600080516020613581833981519152606482015290519081900360840190fd5b612d1a613389565b60008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051939091169263a9059cbb92604480840193602093929083900390910190829087803b158015612d8c57600080fd5b505af1158015612da0573d6000803e3d6000fd5b505050506040513d6020811015612db657600080fd5b505050565b60008060eb60020a620a69cb02612dd06130d1565b600160a060020a0316629919c0826040518263ffffffff1660e060020a028152600401808260001916600019168152602001915050602060405180830381600087803b158015612e1f57600080fd5b505af1158015612e33573d6000803e3d6000fd5b505050506040513d6020811015612e4957600080fd5b505115612e8e576040805160e560020a62461bcd02815260206004820152601960248201526000805160206135c1833981519152604482015290519081900360640190fd5b60055460ff1615612eeb576040805160e560020a62461bcd02815260206004820152603c60248201526000805160206135a18339815191526044820152600080516020613541833981519152606482015290519081900360840190fd5b612ef484612407565b9150612efe6132d0565b600854604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a03928316602482015260448101889052905192909116916323b872dd916064808201926020929091908290030181600087803b158015612f7457600080fd5b505af1158015612f88573d6000803e3d6000fd5b505050506040513d6020811015612f9e57600080fd5b50612fa99050613389565b600160a060020a031663a9059cbb33846040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561300b57600080fd5b505af115801561301f573d6000803e3d6000fd5b505050506040513d602081101561303557600080fd5b505060408051602081018690526060810184905260808082526004908201527f735553440000000000000000000000000000000000000000000000000000000060a082015260c081830181905260039082015260eb60020a620a69cb0260e082015290517fdb1741ffc6844b04a9284bb6337fb0ccfe543a493ef0ac8e725242201e93d4bd918190036101000190a15092915050565b600b5481565b600754604080517fdacb2d010000000000000000000000000000000000000000000000000000000081527f45786368616e6765526174657300000000000000000000000000000000000000600482015260248101829052601d60448201527f4d697373696e672045786368616e67655261746573206164647265737300000060648201529051600092600160a060020a03169163dacb2d0191608480830192602092919082900301818787803b15801561318a57600080fd5b505af115801561319e573d6000803e3d6000fd5b505050506040513d60208110156131b457600080fd5b5051905090565b6000670de0b6b3a76400006131d6848463ffffffff61344216565b8115156131df57fe5b049392505050565b600082820183811015611557576040805160e560020a62461bcd02815260206004820152601260248201527f536166654d6174682e616464204572726f720000000000000000000000000000604482015290519081900360640190fd5b6000808383111561329f576040805160e560020a62461bcd02815260206004820152601260248201527f536166654d6174682e737562204572726f720000000000000000000000000000604482015290519081900360640190fd5b5050900390565b6000611557826132c485670de0b6b3a764000063ffffffff61344216565b9063ffffffff6134bb16565b600754604080517fdacb2d010000000000000000000000000000000000000000000000000000000081527f53796e7468735553440000000000000000000000000000000000000000000000600482015260248101829052601960448201527f4d697373696e672053796e74687355534420616464726573730000000000000060648201529051600092600160a060020a03169163dacb2d0191608480830192602092919082900301818787803b15801561318a57600080fd5b600754604080517fdacb2d010000000000000000000000000000000000000000000000000000000081527f53796e7468657469780000000000000000000000000000000000000000000000600482015260248101829052601960448201527f4d697373696e672053796e74686574697820616464726573730000000000000060648201529051600092600160a060020a03169163dacb2d0191608480830192602092919082900301818787803b15801561318a57600080fd5b60008083151561345557600091506128a0565b5082820282848281151561346557fe5b0414611557576040805160e560020a62461bcd02815260206004820152601260248201527f536166654d6174682e6d756c204572726f720000000000000000000000000000604482015290519081900360640190fd5b600080808311613515576040805160e560020a62461bcd02815260206004820152601260248201527f536166654d6174682e646976204572726f720000000000000000000000000000604482015290519081900360640190fd5b828481151561352057fe5b04949350505050565b60408051808201909152600080825260208201529056007768696c652074686520636f6e747261637420697320706175736564000000004f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e00000000000000000000000000000000005468697320616374696f6e2063616e6e6f7420626520706572666f726d65642052617465207374616c65206f72206e6f7420612073796e746800000000000000a165627a7a72305820b145e4ca7c27504d98e67e16a097b8198f1d3906b86e9ce1ac736f3c401e58420029000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882000000000000000000000000fbb6526ed92da8915d4843a86166020d0b7baad0

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

000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882000000000000000000000000fbb6526ed92da8915d4843a86166020d0b7baad0

-----Decoded View---------------
Arg [0] : _owner (address): 0xb64ff7a4a33acdf48d97dab0d764afd0f6176882
Arg [1] : _fundsWallet (address): 0xb64ff7a4a33acdf48d97dab0d764afd0f6176882
Arg [2] : _resolver (address): 0xfbb6526ed92da8915d4843a86166020d0b7baad0

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882
Arg [1] : 000000000000000000000000b64ff7a4a33acdf48d97dab0d764afd0f6176882
Arg [2] : 000000000000000000000000fbb6526ed92da8915d4843a86166020d0b7baad0


Library Used

SafeDecimalMath : 0x84d626b2bb4d0f064067e4bf80fce7055d8f3e7b

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.