Sponsored Link:   Trade.io - The Exchange You've Been Waiting For Has Arrived. Instant Verification, Fully Customizable. Pre-Register today
Contract Overview
Balance: 8.283080950742006403 Ether
Ether Value: $5,869.47 (@ $708.61/ETH)
Transactions: 2973 txns
Token Contract: Masterpieces (CMP)
 Latest 25 txns from a total Of 2973 transactions
View All

TxHash Age From To Value [TxFee]
0xb02cc81141be2af0f2cf5141c1cabcd752086904c388b8c0c797c7f1561d7ba117 hrs 11 mins ago0x61f5de19b72790c0e679d3c21f069a32585f6c8a  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000219716
0xfef4a79c984a8bac5b5fef761c367a8986c7a88ac8bb6b1d37db0d93c7bee92a1 day 27 mins ago0x61f5de19b72790c0e679d3c21f069a32585f6c8a  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000408044
0x07cd216d07555a9f39d79bc2643c430d8f88e965fb6a289c841e689a58e8c7272 days 22 hrs ago0x31acdbf193cda6902c7a4d8257ce4376c61d0b82  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000510268
0x2df53fa2e95e3d5dd555f549183db03f58cdb5d0365c1508b3ef280b8887c7b74 days 6 hrs ago0xdb4e18cf5e94b2cf59114a3231a0261e3497deb2  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.0004082144
0xf2eafe1bbb6485eb058550fd261287fa22203bc3c20e40bd3333c1b6f64fad215 days 23 hrs ago0x0c24c748ddab4afe06bc44988f5fe6e788c019f3  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.00046388
0x6d4bfce201e7801a8c6508bbf62f1316ca2c6016bcf94ce3a72a1c4abf3200205 days 23 hrs ago0x0c24c748ddab4afe06bc44988f5fe6e788c019f3  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.00046388
0x0bb3154c9e3a8c5c3607ba6438cedfe6681dd965e2234b7f1c271c34265c9c745 days 23 hrs ago0x0c24c748ddab4afe06bc44988f5fe6e788c019f3  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000376656
0xaf4012dcb2f36f4c3006c5cf47bfbfbfcdb4162f8db543da6dca6d55a9b8109d5 days 23 hrs ago0x0c24c748ddab4afe06bc44988f5fe6e788c019f3  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000510268
0x3385d60e7211f4ff7669d09c132b31307b33f0182f660cfdd701f2a3f91cc6fc6 days 23 hrs ago0xd04c453461a77b342fea9d1fec55861399401122  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.0002228548
0x3869405c4aa82076f3cad8a6ed78cbcdd053c130dd3dc40c936c5f9c8b8a43f87 days 2 hrs ago0x0c24c748ddab4afe06bc44988f5fe6e788c019f3  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.0003293548
0x961dc0c592b9ec16ab54d068e831010ba797ddd742246bc8055dc1e3f44e87c58 days 6 hrs ago0xd04c453461a77b342fea9d1fec55861399401122  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.00015694
0x055bd0e09ad60109c7b53dd3a323656f82ac79ea3bdc1bd64440423dcaa1f5f08 days 7 hrs ago0xd04c453461a77b342fea9d1fec55861399401122  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.00023194
0xf702e796347de7e26700e127cb793af56d7e1b8fe4fa67e7c874ce9bf2286b6c8 days 19 hrs ago0x31acdbf193cda6902c7a4d8257ce4376c61d0b82  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000188328
0x55da2894600797314f61e0b6e1fb2fc3634fbb89d986257d7afa2df806c5b8d38 days 19 hrs ago0x31acdbf193cda6902c7a4d8257ce4376c61d0b82  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000278328
0xc6d8561350a48276df46e3e064bb4e32715c72f9b4217ee820ed08611cf259b710 days 2 hrs ago0xdb4e18cf5e94b2cf59114a3231a0261e3497deb2  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000278328
0xafd2efb7afac9889b88d524b8945e737e75b090ecf348dad70ed6e67216821cb12 days 12 hrs ago0x55611b747af18e27ba99c251377912fcd96ea656  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.0000185552
0x5c9c75619f7651c6ea522771e0edf6b8ab0b235a9777c5ab1ad2cb4b6ad04ae516 days 20 hrs ago0x31acdbf193cda6902c7a4d8257ce4376c61d0b82  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000094164
0x44db643bce83a44e74b6e4184ca845b8b0bf9238cca98d5f7e726804c5bc8aec16 days 20 hrs ago0x31acdbf193cda6902c7a4d8257ce4376c61d0b82  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000139164
0xc8a426a76bb0d4a22cc8f334ee850a1f63f03af28330a36b326034030bc8bd2317 days 7 hrs ago0xd04c453461a77b342fea9d1fec55861399401122  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.0001224132
0xb3466d80f2b11bcaec1554bd1ff91a9016a1141f52051194aa8d0e1c6c1f822f17 days 7 hrs ago0xd04c453461a77b342fea9d1fec55861399401122  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000125552
0xcd8367bb730d6bd1fe7af12c5d6e1d30e84ca39b32821ba0e1681f29fabc537017 days 7 hrs ago0xd04c453461a77b342fea9d1fec55861399401122  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.00031388
0x47f71f05031486d4773767138b38e24c5b5b5d85d596bbc65acc5c43467dda2717 days 7 hrs ago0xd04c453461a77b342fea9d1fec55861399401122  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000185552
0x9cd6a5672b02dd2e8b7b440293d850fcd60af6e2053d148777ab914f6939300d17 days 13 hrs ago0x3950cf9d61851259b0694a0a3800f51658cb920a  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000139164
0xcfcf2f9f36cc61a6175270323d41fa5ebdd3c51f9afed147de04a9060a10aef219 days 8 hrs ago0x35ec6677232418ebaf0f1c3e5fa81a639460ea38  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000092776
0xd665fe86f6b8c4596aeb55fe6b1f668927984686cb87f37fe10965ee64d75c9b19 days 9 hrs ago0x35ec6677232418ebaf0f1c3e5fa81a639460ea38  IN   0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0 Ether0.000092776
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here to View More View All
ParentTxHash Block Age From To Value
0x669ec0fa6c5c013ecad5959e6b9f11f94a80e970877353bf61768f23ac1dcd22528552961 days 16 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xf47c10b4416ab748b33862746be869aa5dabb4910.117536325868783201 Ether
0xe6ed55aab42ebb0d06e5af91479a16835735b0cd838faf7e904fc2676710563e528549461 days 16 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x61f5de19b72790c0e679d3c21f069a32585f6c8a0.165285458252976377 Ether
0x01267152688581ccd8e2b59f429cb542e140742493e9bd080878fcf4711af5ee528527461 days 17 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xe632a7bd3018246b2c2667e33000652d4bba43a20.117536325868783201 Ether
0xe87ae62acae7e89213bf1acf5810057e673006555d69faa5f365674c12e30d76528524761 days 17 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xaa73a811a4898ca0e116376be752b3960d5540210.23243267566824803 Ether
0x21f24065af6723e65fada3a0a318b161d2a96f025e25b63a56cb09bac264833c528523761 days 17 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x7e35d275bb9885f6ac91aa75d1b7367341df0b1d0.165285458252976377 Ether
0xd4aa948bab36ac29c2164d4808f45987920cdc66cdafde0170ec84abc3cc9889528523261 days 17 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x8982e2f3308366f2e04226daa604555dddb185030.117536325868783201 Ether
0x857f1aae79b23ddff3a0e516b8deaf908bb2ebedd62aafecbf0cd9e3fbc91616528522861 days 17 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xe632a7bd3018246b2c2667e33000652d4bba43a20.083581387284468054 Ether
0x8870f0119c3ca641bc357b495b159d68e46eca0453c455b97d7a9056143602b2527654963 days 4 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xe632a7bd3018246b2c2667e33000652d4bba43a20.083581387284468054 Ether
0xac32305abae6492bebdd72d0d65474424b5adc9ed0ce8f65663c92c8854d0779525492266 days 20 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xd9a0010ef2ac396913bd3e0fa199c56fd24eac7e0.083581387284468054 Ether
0x29a400f1938969c2be390f48961b22950e16f1a2e7e1166db47491c0fcd81ba0525491666 days 20 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x3b0535c602078a22a9954209b3556549c4e5e9870.083581387284468054 Ether
0x131231655a11d6d02067ebf2aaf99fc88c97f254a4bcf98a53bbff29076141e3525067667 days 14 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x26a3b0c7244f017a350508549b3e56b75fce67770.039287605220954385 Ether
0x03fdb7232efba151d2d217a2fff3dbbead5eb09bca751e645cc8645240b46fba525039067 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x4a995e321796e2464081bdeb571af8bba6a075a80.083581387284468054 Ether
0xb59db974aee2d9df04d9e4b75189882699bc7915144805ad5b941a90ea9b38da525038967 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x26a3b0c7244f017a350508549b3e56b75fce67770.039287605220954385 Ether
0x42cc260f82cf6888fefdc23132985001b2b63e6bb3660ce3f0c8144f4be42675525038667 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xa0de22cb8d5a45af18081beced7c2517848505aa0.039287605220954385 Ether
0x2602de65eea1f605160600e299450afd394632dd6457cd6e7071fa953a889b41525037967 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x4a995e321796e2464081bdeb571af8bba6a075a80.02864462608320591 Ether
0x2602de65eea1f605160600e299450afd394632dd6457cd6e7071fa953a889b41525037967 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xa0de22cb8d5a45af18081beced7c2517848505aa0.039287605220954385 Ether
0x6490271b43c21668ad6c48cc85c20792711306e27974b8caf55fdb341dec7cfe525037367 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xa0de22cb8d5a45af18081beced7c2517848505aa0.001356197389522807 Ether
0x6490271b43c21668ad6c48cc85c20792711306e27974b8caf55fdb341dec7cfe525037367 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xa72b88b7b79bdcaaf5b666462fe917ae955642860.018661612479953333 Ether
0xdbf00f5854e5f5aea57c3714d5e41aebca09c6c2e79ca8c5e9e96cacd05a9d84525037367 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xa72b88b7b79bdcaaf5b666462fe917ae955642860.011669193760023333 Ether
0xdbf00f5854e5f5aea57c3714d5e41aebca09c6c2e79ca8c5e9e96cacd05a9d84525037367 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x3b0535c602078a22a9954209b3556549c4e5e9870.008864265927977833 Ether
0xaec5f57153b43c1e48f3f04cea3e7235ec27c5f4321617091373973fb64673ae525037367 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x84b562b694a0615d8d72e30e18134a1cc62855340.039287605220954385 Ether
0xf42a31e24aeb7fb79b74a137d867d6c8082884b6d0a6fdfc1e199e043cddc080525037167 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0xd33614943bcaadb857a58ff7c36157f21643df360.004210526315789471 Ether
0xb788ee98174bb4765002279deab4e96a6d06d0f2ffe102a17c708bee5c175fab525037167 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x26a3b0c7244f017a350508549b3e56b75fce67770.001356197389522807 Ether
0xb788ee98174bb4765002279deab4e96a6d06d0f2ffe102a17c708bee5c175fab525037167 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x7f20310058bb81b68515c2e94a5d522763c2e15c0.018661612479953333 Ether
0x61c132a1786d087f11fe367b22378b6609680c2d5c4a2e5b55ee14264061787f525037067 days 15 hrs ago0xa92e3ab42c195e52c9fbf129be47ecbb03845dfd0x7f20310058bb81b68515c2e94a5d522763c2e15c0.011669193760023333 Ether
[ Download CSV Export  ] 
Contract Source Code Verified (Similar match)
Note: Displaying similar matching verified source code at contract 0x77a62e46b2c62e9d9b8d76a8bb02304f3280ee55(excluding Constructor Arguments if any)
Contract Name: MasterpieceCore
Compiler Version: v0.4.21-nightly.2018.2.14+commit.bb3b327c
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.19;


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

    /**
    * @dev Multiplies two numbers, throws on overflow.
    */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        assert(c / a == b);
        return c;
    }

    /**
    * @dev Integer division of two numbers, truncating the quotient.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // assert(b > 0); // Solidity automatically throws 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 Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    /**
    * @dev Adds two numbers, throws on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }
}


/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
    address public owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev The Ownable constructor sets the original `owner` of the contract to the sender
     * account.
     */
    function Ownable() public {
        owner = msg.sender;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    /**
     * @dev Allows the current owner to transfer control of the contract to a newOwner.
     * @param newOwner The address to transfer ownership to.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0));
        OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

}


/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
contract Pausable is Ownable {
    event Pause();
    event Unpause();

    bool public paused = false;

    /**
     * @dev modifier to allow actions only when the contract IS paused
     */
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /**
     * @dev modifier to allow actions only when the contract IS NOT paused
     */
    modifier whenPaused {
        require(paused);
        _;
    }

    /**
     * @dev called by the owner to pause, triggers stopped state
     */
    function pause()
        public
        onlyOwner
        whenNotPaused
        returns (bool)
    {
        paused = true;
        Pause();
        return true;
    }

    /**
     * @dev called by the owner to unpause, returns to normal state
     */
    function unpause()
        public
        onlyOwner
        whenPaused
        returns (bool)
    {
        paused = false;
        Unpause();
        return true;
    }
}


/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <[email protected]> (https://github.com/dete)
contract ERC721 {
    event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
    event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);

    // Required methods for ERC-721 Compatibility.
    function approve(address _to, uint256 _tokenId) external;
    function transfer(address _to, uint256 _tokenId) external;
    function transferFrom(address _from, address _to, uint256 _tokenId) external;
    function ownerOf(uint256 _tokenId) external view returns (address _owner);

    // ERC-165 Compatibility (https://github.com/ethereum/EIPs/issues/165)
    function supportsInterface(bytes4 _interfaceID) external view returns (bool);

    function totalSupply() public view returns (uint256 total);
    function balanceOf(address _owner) public view returns (uint256 _balance);
}


contract MasterpieceAccessControl {
    /// - CEO: The CEO can reassign other roles, change the addresses of dependent smart contracts,
    /// and pause/unpause the MasterpieceCore contract.
    /// - CFO: The CFO can withdraw funds from its auction and sale contracts.
    /// - Curator: The Curator can mint regular and promo Masterpieces.

    /// @dev The addresses of the accounts (or contracts) that can execute actions within each role.
    address public ceoAddress;
    address public cfoAddress;
    address public curatorAddress;

    /// @dev Keeps track whether the contract is paused. When that is true, most actions are blocked.
    bool public paused = false;

    /// @dev Event is fired when contract is forked.
    event ContractFork(address newContract);

    /// @dev Access-modifier for CEO-only functionality.
    modifier onlyCEO() {
        require(msg.sender == ceoAddress);
        _;
    }

    /// @dev Access-modifier for CFO-only functionality.
    modifier onlyCFO() {
        require(msg.sender == cfoAddress);
        _;
    }

    /// @dev Access-modifier for Curator-only functionality.
    modifier onlyCurator() {
        require(msg.sender == curatorAddress);
        _;
    }

    /// @dev Access-modifier for C-level-only functionality.
    modifier onlyCLevel() {
        require(
            msg.sender == ceoAddress ||
            msg.sender == cfoAddress ||
            msg.sender == curatorAddress
        );
        _;
    }

    /// Assigns a new address to the CEO role. Only available to the current CEO.
    /// @param _newCEO The address of the new CEO
    function setCEO(address _newCEO) external onlyCEO {
        require(_newCEO != address(0));

        ceoAddress = _newCEO;
    }

    /// Assigns a new address to act as the CFO. Only available to the current CEO.
    /// @param _newCFO The address of the new CFO
    function setCFO(address _newCFO) external onlyCEO {
        require(_newCFO != address(0));

        cfoAddress = _newCFO;
    }

    /// Assigns a new address to the Curator role. Only available to the current CEO.
    /// @param _newCurator The address of the new Curator
    function setCurator(address _newCurator) external onlyCEO {
        require(_newCurator != address(0));

        curatorAddress = _newCurator;
    }

    /*** Pausable functionality adapted from OpenZeppelin ***/
    /// @dev Modifier to allow actions only when the contract IS NOT paused
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /// @dev Modifier to allow actions only when the contract IS paused
    modifier whenPaused {
        require(paused);
        _;
    }

    /// @dev Called by any "C-level" role to pause the contract. Used only when
    ///  a bug or exploit is detected and we need to limit damage.
    function pause()
        external
        onlyCLevel
        whenNotPaused
    {
        paused = true;
    }

    /// @dev Unpauses the smart contract. Can only be called by the CEO, since
    ///  one reason we may pause the contract is when CFO or COO accounts are
    ///  compromised.
    /// @notice This is public rather than external so it can be called by
    ///  derived contracts.
    function unpause()
        public
        onlyCEO
        whenPaused
    {
        // can't unpause if contract was forked
        paused = false;
    }

}


/// Core functionality for CrytpoMasterpieces.
contract MasterpieceBase is MasterpieceAccessControl {

    /*** DATA TYPES ***/
    /// The main masterpiece struct.
    struct Masterpiece {
        /// Name of the masterpiece
        string name;
        /// Name of the artist who created the masterpiece
        string artist;
        // The timestamp from the block when this masterpiece was created
        uint64 birthTime;
    }

    /*** EVENTS ***/
    /// The Birth event is fired whenever a new masterpiece comes into existence.
    event Birth(address owner, uint256 tokenId, uint256 snatchWindow, string name, string artist);
    /// Transfer event as defined in current draft of ERC721. Fired every time masterpiece ownership
    /// is assigned, including births.
    event TransferToken(address from, address to, uint256 tokenId);
    /// The TokenSold event is fired whenever a token is sold.
    event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 price, address prevOwner, address owner, string name);

    /*** STORAGE ***/
    /// An array containing all Masterpieces in existence. The id of each masterpiece
    /// is an index in this array.
    Masterpiece[] masterpieces;

    /// @dev The address of the ClockAuction contract that handles sale auctions
    /// for Masterpieces that users want to sell for less than or equal to the
    /// next price, which is automatically set by the contract.
    SaleClockAuction public saleAuction;

    /// @dev A mapping from masterpiece ids to the address that owns them.
    mapping (uint256 => address) public masterpieceToOwner;

    /// @dev A mapping from masterpiece ids to their snatch window.
    mapping (uint256 => uint256) public masterpieceToSnatchWindow;

    /// @dev A mapping from owner address to count of masterpieces that address owns.
    /// Used internally inside balanceOf() to resolve ownership count.
    mapping (address => uint256) public ownerMasterpieceCount;

    /// @dev A mapping from masterpiece ids to an address that has been approved to call
    ///  transferFrom(). Each masterpiece can only have 1 approved address for transfer
    ///  at any time. A 0 value means no approval is outstanding.
    mapping (uint256 => address) public masterpieceToApproved;

    // @dev A mapping from masterpiece ids to their price.
    mapping (uint256 => uint256) public masterpieceToPrice;

    // @dev Returns the snatch window of the given token.
    function snatchWindowOf(uint256 _tokenId)
        public
        view
        returns (uint256 price)
    {
        return masterpieceToSnatchWindow[_tokenId];
    }

    /// @dev Assigns ownership of a specific masterpiece to an address.
    function _transfer(address _from, address _to, uint256 _tokenId) internal {
        // Transfer ownership and update owner masterpiece counts.
        ownerMasterpieceCount[_to]++;
        masterpieceToOwner[_tokenId] = _to;
        // When creating new tokens _from is 0x0, but we can't account that address.
        if (_from != address(0)) {
            ownerMasterpieceCount[_from]--;
            // clear any previously approved ownership exchange
            delete masterpieceToApproved[_tokenId];
        }
        // Fire the transfer event.
        TransferToken(_from, _to, _tokenId);
    }

    /// @dev An internal method that creates a new masterpiece and stores it.
    /// @param _name The name of the masterpiece, e.g. Mona Lisa
    /// @param _artist The artist who created this masterpiece, e.g. Leonardo Da Vinci
    /// @param _owner The initial owner of this masterpiece
    function _createMasterpiece(
        string _name,
        string _artist,
        uint256 _price,
        uint256 _snatchWindow,
        address _owner
    )
        internal
        returns (uint)
    {
        Masterpiece memory _masterpiece = Masterpiece({
            name: _name,
            artist: _artist,
            birthTime: uint64(now)
        });
        uint256 newMasterpieceId = masterpieces.push(_masterpiece) - 1;

        // Fire the birth event.
        Birth(
            _owner,
            newMasterpieceId,
            _snatchWindow,
            _masterpiece.name,
            _masterpiece.artist
        );

        // Set the price for the masterpiece.
        masterpieceToPrice[newMasterpieceId] = _price;

        // Set the snatch window for the masterpiece.
        masterpieceToSnatchWindow[newMasterpieceId] = _snatchWindow;

        // This will assign ownership, and also fire the Transfer event as per ERC-721 draft.
        _transfer(0, _owner, newMasterpieceId);

        return newMasterpieceId;
    }

}


/// Pricing logic for CrytpoMasterpieces.
contract MasterpiecePricing is MasterpieceBase {

    /*** CONSTANTS ***/
    // Pricing steps.
    uint128 private constant FIRST_STEP_LIMIT = 0.05 ether;
    uint128 private constant SECOND_STEP_LIMIT = 0.5 ether;
    uint128 private constant THIRD_STEP_LIMIT = 2.0 ether;
    uint128 private constant FOURTH_STEP_LIMIT = 5.0 ether;

    /// @dev Computes the next listed price.
    /// @notice This contract doesn't handle setting the Masterpiece's next listing price.
    /// This next price is only used from inside bid() in MasterpieceAuction and inside
    /// purchase() in MasterpieceSale to set the next listed price.
    function setNextPriceOf(uint256 tokenId, uint256 salePrice)
        external
        whenNotPaused
    {
        // The next price of any token can only be set by the sale auction contract.
        // To set the next price for a token sold through the regular sale, use only
        // computeNextPrice and directly update the mapping.
        require(msg.sender == address(saleAuction));
        masterpieceToPrice[tokenId] = computeNextPrice(salePrice);
    }

    /// @dev Computes next price of token given the current sale price.
    function computeNextPrice(uint256 salePrice)
        internal
        pure
        returns (uint256)
    {
        if (salePrice < FIRST_STEP_LIMIT) {
            return SafeMath.div(SafeMath.mul(salePrice, 200), 95);
        } else if (salePrice < SECOND_STEP_LIMIT) {
            return SafeMath.div(SafeMath.mul(salePrice, 135), 96);
        } else if (salePrice < THIRD_STEP_LIMIT) {
            return SafeMath.div(SafeMath.mul(salePrice, 125), 97);
        } else if (salePrice < FOURTH_STEP_LIMIT) {
            return SafeMath.div(SafeMath.mul(salePrice, 120), 97);
        } else {
            return SafeMath.div(SafeMath.mul(salePrice, 115), 98);
        }
    }

    /// @dev Computes the payment for the token, which is the sale price of the token
    /// minus the house's cut.
    function computePayment(uint256 salePrice)
        internal
        pure
        returns (uint256)
    {
        if (salePrice < FIRST_STEP_LIMIT) {
            return SafeMath.div(SafeMath.mul(salePrice, 95), 100);
        } else if (salePrice < SECOND_STEP_LIMIT) {
            return SafeMath.div(SafeMath.mul(salePrice, 96), 100);
        } else if (salePrice < FOURTH_STEP_LIMIT) {
            return SafeMath.div(SafeMath.mul(salePrice, 97), 100);
        } else {
            return SafeMath.div(SafeMath.mul(salePrice, 98), 100);
        }
    }

}


/// Methods required for Non-Fungible Token Transactions in adherence to ERC721.
contract MasterpieceOwnership is MasterpiecePricing, ERC721 {

    /// Name of the collection of NFTs managed by this contract, as defined in ERC721.
    string public constant NAME = "Masterpieces";
    /// Symbol referencing the entire collection of NFTs managed in this contract, as
    /// defined in ERC721.
    string public constant SYMBOL = "CMP";

    bytes4 public constant INTERFACE_SIGNATURE_ERC165 =
    bytes4(keccak256("supportsInterface(bytes4)"));

    bytes4 public constant INTERFACE_SIGNATURE_ERC721 =
    bytes4(keccak256("name()")) ^
    bytes4(keccak256("symbol()")) ^
    bytes4(keccak256("totalSupply()")) ^
    bytes4(keccak256("balanceOf(address)")) ^
    bytes4(keccak256("ownerOf(uint256)")) ^
    bytes4(keccak256("approve(address,uint256)")) ^
    bytes4(keccak256("transfer(address,uint256)")) ^
    bytes4(keccak256("transferFrom(address,address,uint256)")) ^
    bytes4(keccak256("tokensOfOwner(address)")) ^
    bytes4(keccak256("tokenMetadata(uint256,string)"));

    /// @dev Grant another address the right to transfer a specific Masterpiece via
    ///  transferFrom(). This is the preferred flow for transfering NFTs to contracts.
    /// @param _to The address to be granted transfer approval. Pass address(0) to
    ///  clear all approvals.
    /// @param _tokenId The ID of the Masterpiece that can be transferred if this call succeeds.
    /// @notice Required for ERC-20 and ERC-721 compliance.
    function approve(address _to, uint256 _tokenId)
        external
        whenNotPaused
    {
        // Only an owner can grant transfer approval.
        require(_owns(msg.sender, _tokenId));

        // Register the approval (replacing any previous approval).
        _approve(_tokenId, _to);

        // Fire approval event upon successful approval.
        Approval(msg.sender, _to, _tokenId);
    }

    /// @dev Transfers a Masterpiece to another address. If transferring to a smart
    ///  contract be VERY CAREFUL to ensure that it is aware of ERC-721 or else your
    /// Masterpiece may be lost forever.
    /// @param _to The address of the recipient, can be a user or contract.
    /// @param _tokenId The ID of the Masterpiece to transfer.
    /// @notice Required for ERC-20 and ERC-721 compliance.
    function transfer(address _to, uint256 _tokenId)
        external
        whenNotPaused
    {
        // Safety check to prevent against an unexpected 0x0 default.
        require(_to != address(0));
        // Disallow transfers to this contract to prevent accidental misuse.
        // The contract should never own any Masterpieces (except very briefly
        // after a Masterpiece is created.
        require(_to != address(this));
        // Disallow transfers to the auction contract to prevent accidental
        // misuse. Auction contracts should only take ownership of Masterpieces
        // through the approve and transferFrom flow.
        require(_to != address(saleAuction));
        // You can only send your own Masterpiece.
        require(_owns(msg.sender, _tokenId));

        // Reassign ownership, clear pending approvals, fire Transfer event.
        _transfer(msg.sender, _to, _tokenId);
    }

    /// @dev Transfer a Masterpiece owned by another address, for which the calling address
    ///  has previously been granted transfer approval by the owner.
    /// @param _from The address that owns the Masterpiece to be transfered.
    /// @param _to The address that should take ownership of the Masterpiece. Can be any
    /// address, including the caller.
    /// @param _tokenId The ID of the Masterpiece to be transferred.
    /// @notice Required for ERC-20 and ERC-721 compliance.
    function transferFrom(address _from, address _to, uint256 _tokenId)
        external
        whenNotPaused
    {
        // Safety check to prevent against an unexpected 0x0 default.
        require(_to != address(0));
        // Check for approval and valid ownership
        require(_approvedFor(msg.sender, _tokenId));
        require(_owns(_from, _tokenId));

        // Reassign ownership (also clears pending approvals and fires Transfer event).
        _transfer(_from, _to, _tokenId);
    }

    /// @dev Returns a list of all Masterpiece IDs assigned to an address.
    /// @param _owner The owner whose Masterpieces we are interested in.
    ///  This method MUST NEVER be called by smart contract code. First, it is fairly
    ///  expensive (it walks the entire Masterpiece array looking for Masterpieces belonging
    /// to owner), but it also returns a dynamic array, which is only supported for web3
    /// calls, and not contract-to-contract calls. Thus, this method is external rather
    /// than public.
    function tokensOfOwner(address _owner)
        external
        view
        returns(uint256[] ownerTokens)
    {
        uint256 tokenCount = balanceOf(_owner);

        if (tokenCount == 0) {
            // Returns an empty array
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](tokenCount);
            uint256 totalMasterpieces = totalSupply();
            uint256 resultIndex = 0;

            uint256 masterpieceId;
            for (masterpieceId = 0; masterpieceId <= totalMasterpieces; masterpieceId++) {
                if (masterpieceToOwner[masterpieceId] == _owner) {
                    result[resultIndex] = masterpieceId;
                    resultIndex++;
                }
            }

            return result;
        }
    }

    /// @notice Introspection interface as per ERC-165 (https://github.com/ethereum/EIPs/issues/165).
    ///  Returns true for any standardized interfaces implemented by this contract. We implement
    ///  ERC-165 (obviously!) and ERC-721.
    function supportsInterface(bytes4 _interfaceID)
        external
        view
        returns (bool)
    {
        return ((_interfaceID == INTERFACE_SIGNATURE_ERC165) || (_interfaceID == INTERFACE_SIGNATURE_ERC721));
    }

    // @notice Optional for ERC-20 compliance.
    function name() external pure returns (string) {
        return NAME;
    }

    // @notice Optional for ERC-20 compliance.
    function symbol() external pure returns (string) {
        return SYMBOL;
    }

    /// @dev Returns the address currently assigned ownership of a given Masterpiece.
    /// @notice Required for ERC-721 compliance.
    function ownerOf(uint256 _tokenId)
        external
        view
        returns (address owner)
    {
        owner = masterpieceToOwner[_tokenId];
        require(owner != address(0));
    }

    /// @dev Returns the total number of Masterpieces currently in existence.
    /// @notice Required for ERC-20 and ERC-721 compliance.
    function totalSupply() public view returns (uint) {
        return masterpieces.length;
    }

    /// @dev Returns the number of Masterpieces owned by a specific address.
    /// @param _owner The owner address to check.
    /// @notice Required for ERC-20 and ERC-721 compliance.
    function balanceOf(address _owner)
        public
        view
        returns (uint256 count)
    {
        return ownerMasterpieceCount[_owner];
    }

    /// @dev Checks if a given address is the current owner of a particular Masterpiece.
    /// @param _claimant the address we are validating against.
    /// @param _tokenId Masterpiece id, only valid when > 0
    function _owns(address _claimant, uint256 _tokenId)
        internal
        view
        returns (bool)
    {
        return masterpieceToOwner[_tokenId] == _claimant;
    }

    /// @dev Marks an address as being approved for transferFrom(), overwriting any previous
    /// approval. Setting _approved to address(0) clears all transfer approval.
    /// NOTE: _approve() does NOT send the Approval event. This is intentional because
    /// _approve() and transferFrom() are used together for putting Masterpieces on auction, and
    /// there is no value in spamming the log with Approval events in that case.
    function _approve(uint256 _tokenId, address _approved) internal {
        masterpieceToApproved[_tokenId] = _approved;
    }

    /// @dev Checks if a given address currently has transferApproval for a particular Masterpiece.
    /// @param _claimant the address we are confirming Masterpiece is approved for.
    /// @param _tokenId Masterpiece id, only valid when > 0
    function _approvedFor(address _claimant, uint256 _tokenId)
        internal
        view
        returns (bool)
    {
        return masterpieceToApproved[_tokenId] == _claimant;
    }

    /// Safety check on _to address to prevent against an unexpected 0x0 default.
    function _addressNotNull(address _to) internal pure returns (bool) {
        return _to != address(0);
    }
}


/// @title Auction Core
/// @dev Contains models, variables, and internal methods for the auction.
/// @notice We omit a fallback function to prevent accidental sends to this contract.
contract ClockAuctionBase {

    // Represents an auction on an NFT
    struct Auction {
        // Current owner of NFT
        address seller;
        // Price (in wei) at beginning of auction
        uint128 startingPrice;
        // Price (in wei) at end of auction
        uint128 endingPrice;
        // Duration (in seconds) of auction
        uint64 duration;
        // Time when auction started
        // NOTE: 0 if this auction has been concluded
        uint64 startedAt;
    }

    // Reference to contract tracking NFT ownership
    MasterpieceOwnership public nonFungibleContract;

    // Cut owner takes on each auction, measured in basis points (1/100 of a percent).
    // Values 0-10,000 map to 0%-100%
    uint256 public ownerCut;

    // Map from token ID to their corresponding auction.
    mapping (uint256 => Auction) public tokenIdToAuction;

    event AuctionCreated(uint256 tokenId, uint256 startingPrice, uint256 endingPrice, uint256 duration);
    event AuctionSuccessful(uint256 tokenId, uint256 price, address winner);
    event AuctionCancelled(uint256 tokenId);

    /// @dev Returns true if the claimant owns the token.
    /// @param _claimant - Address claiming to own the token.
    /// @param _tokenId - ID of token whose ownership to verify.
    function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
        return (nonFungibleContract.ownerOf(_tokenId) == _claimant);
    }

    /// @dev Escrows the NFT, assigning ownership to this contract.
    /// Throws if the escrow fails.
    /// @param _owner - Current owner address of token to escrow.
    /// @param _tokenId - ID of token whose approval to verify.
    function _escrow(address _owner, uint256 _tokenId) internal {
        // it will throw if transfer fails
        nonFungibleContract.transferFrom(_owner, this, _tokenId);
    }

    /// @dev Transfers an NFT owned by this contract to another address.
    /// Returns true if the transfer succeeds.
    /// @param _receiver - Address to transfer NFT to.
    /// @param _tokenId - ID of token to transfer.
    function _transfer(address _receiver, uint256 _tokenId) internal {
        // it will throw if transfer fails
        nonFungibleContract.transfer(_receiver, _tokenId);
    }

    /// @dev Adds an auction to the list of open auctions. Also fires the
    ///  AuctionCreated event.
    /// @param _tokenId The ID of the token to be put on auction.
    /// @param _auction Auction to add.
    function _addAuction(uint256 _tokenId, Auction _auction) internal {
        // Require that all auctions have a duration of
        // at least one minute. (Keeps our math from getting hairy!)
        require(_auction.duration >= 1 minutes);

        tokenIdToAuction[_tokenId] = _auction;

        AuctionCreated(
            uint256(_tokenId),
            uint256(_auction.startingPrice),
            uint256(_auction.endingPrice),
            uint256(_auction.duration)
        );
    }

    /// @dev Cancels an auction unconditionally.
    function _cancelAuction(uint256 _tokenId, address _seller) internal {
        _removeAuction(_tokenId);
        _transfer(_seller, _tokenId);
        AuctionCancelled(_tokenId);
    }

    /// @dev Computes the price and transfers winnings.
    /// Does NOT transfer ownership of token.
    function _bid(uint256 _tokenId, uint256 _bidAmount)
        internal
        returns (uint256)
    {
        // Get a reference to the auction struct
        Auction storage auction = tokenIdToAuction[_tokenId];
        // Explicitly check that this auction is currently live.
        // (Because of how Ethereum mappings work, we can't just count
        // on the lookup above failing. An invalid _tokenId will just
        // return an auction object that is all zeros.)
        require(_isOnAuction(auction));
        // Check that the bid is greater than or equal to the current price
        uint256 price = _currentPrice(auction);
        require(_bidAmount >= price);
        // Grab a reference to the seller before the auction struct gets deleted.
        address seller = auction.seller;
        // Remove the auction before sending the fees to the sender so we can't have a reentrancy attack.
        _removeAuction(_tokenId);
        if (price > 0) {
            // Calculate the auctioneer's cut.
            uint256 auctioneerCut = _computeCut(price);
            uint256 sellerProceeds = price - auctioneerCut;
            // NOTE: Doing a transfer() in the middle of a complex
            // method like this is generally discouraged because of
            // reentrancy attacks and DoS attacks if the seller is
            // a contract with an invalid fallback function. We explicitly
            // guard against reentrancy attacks by removing the auction
            // before calling transfer(), and the only thing the seller
            // can DoS is the sale of their own asset! (And if it's an
            // accident, they can call cancelAuction(). )
            seller.transfer(sellerProceeds);
            _transfer(msg.sender, _tokenId);
            // Update the next listing price of the token.
            nonFungibleContract.setNextPriceOf(_tokenId, price);
        }

        // Calculate any excess funds included with the bid. If the excess
        // is anything worth worrying about, transfer it back to bidder.
        // NOTE: We checked above that the bid amount is greater than or
        // equal to the price so this cannot underflow.
        uint256 bidExcess = _bidAmount - price;

        // Return the funds. Similar to the previous transfer, this is
        // not susceptible to a re-entry attack because the auction is
        // removed before any transfers occur.
        msg.sender.transfer(bidExcess);

        // Tell the world!
        AuctionSuccessful(_tokenId, price, msg.sender);

        return price;
    }

    /// @dev Removes an auction from the list of open auctions.
    /// @param _tokenId - ID of NFT on auction.
    function _removeAuction(uint256 _tokenId) internal {
        delete tokenIdToAuction[_tokenId];
    }

    /// @dev Returns true if the NFT is on auction.
    /// @param _auction - Auction to check.
    function _isOnAuction(Auction storage _auction)
        internal
        view
        returns (bool)
    {
        return (_auction.startedAt > 0);
    }

    /// @dev Returns current price of an NFT on auction. Broken into two
    ///  functions (this one, that computes the duration from the auction
    ///  structure, and the other that does the price computation) so we
    ///  can easily test that the price computation works correctly.
    function _currentPrice(Auction storage _auction)
        internal
        view
        returns (uint256)
    {
        uint256 secondsPassed = 0;

        // A bit of insurance against negative values (or wraparound).
        // Probably not necessary (since Ethereum guarnatees that the
        // now variable doesn't ever go backwards).
        if (now > _auction.startedAt) {
            secondsPassed = now - _auction.startedAt;
        }

        return _computeCurrentPrice(
            _auction.startingPrice,
            _auction.endingPrice,
            _auction.duration,
            secondsPassed
        );
    }

    /// @dev Computes the current price of an auction. Factored out
    ///  from _currentPrice so we can run extensive unit tests.
    ///  When testing, make this function public and turn on
    ///  `Current price computation` test suite.
    function _computeCurrentPrice(
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        uint256 _secondsPassed
    )
        internal
        pure
        returns (uint256)
    {
        // NOTE: We don't use SafeMath (or similar) in this function because
        //  all of our public functions carefully cap the maximum values for
        //  time (at 64-bits) and currency (at 128-bits). _duration is
        //  also known to be non-zero (see the require() statement in
        //  _addAuction())
        if (_secondsPassed >= _duration) {
            // We've reached the end of the dynamic pricing portion
            // of the auction, just return the end price.
            return _endingPrice;
        } else {
            // Starting price can be higher than ending price (and often is!), so
            // this delta can be negative.
            int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice);

            // This multiplication can't overflow, _secondsPassed will easily fit within
            // 64-bits, and totalPriceChange will easily fit within 128-bits, their product
            // will always fit within 256-bits.
            int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration);

            // currentPriceChange can be negative, but if so, will have a magnitude
            // less that _startingPrice. Thus, this result will always end up positive.
            int256 currentPrice = int256(_startingPrice) + currentPriceChange;

            return uint256(currentPrice);
        }
    }

    /// @dev Computes owner's cut of a sale.
    /// @param _price - Sale price of NFT.
    function _computeCut(uint256 _price) internal view returns (uint256) {
        // NOTE: We don't use SafeMath (or similar) in this function because
        //  all of our entry functions carefully cap the maximum values for
        //  currency (at 128-bits), and ownerCut <= 10000 (see the require()
        //  statement in the ClockAuction constructor). The result of this
        //  function is always guaranteed to be <= _price.
        return _price * ownerCut / 10000;
    }

}


/// @title Clock auction for non-fungible tokens.
/// @notice We omit a fallback function to prevent accidental sends to this contract.
contract ClockAuction is Pausable, ClockAuctionBase {

    /// @dev The ERC-165 interface signature for ERC-721.
    ///  Ref: https://github.com/ethereum/EIPs/issues/165
    ///  Ref: https://github.com/ethereum/EIPs/issues/721
    bytes4 public constant INTERFACE_SIGNATURE_ERC721 = bytes4(0x9a20483d);

    /// @dev Constructor creates a reference to the NFT ownership contract
    ///  and verifies the owner cut is in the valid range.
    /// @param _nftAddress - address of a deployed contract implementing
    ///  the Nonfungible Interface.
    /// @param _cut - percent cut the owner takes on each auction, must be
    ///  between 0-10,000.
    function ClockAuction(address _nftAddress, uint256 _cut) public {
        require(_cut <= 10000);
        ownerCut = _cut;

        MasterpieceOwnership candidateContract = MasterpieceOwnership(_nftAddress);
        require(candidateContract.supportsInterface(INTERFACE_SIGNATURE_ERC721));
        nonFungibleContract = candidateContract;
    }

    /// @dev Remove all Ether from the contract, which is the owner's cuts
    ///  as well as any Ether sent directly to the contract address.
    ///  Always transfers to the NFT contract, but can be called either by
    ///  the owner or the NFT contract.
    function withdrawBalance() external {
        address nftAddress = address(nonFungibleContract);

        require(
            msg.sender == owner ||
            msg.sender == nftAddress
        );
        // We are using this boolean method to make sure that even if one fails it will still work
        bool res = nftAddress.send(this.balance);
    }

    /// @dev Creates and begins a new auction.
    /// @param _tokenId - ID of token to auction, sender must be owner.
    /// @param _startingPrice - Price of item (in wei) at beginning of auction.
    /// @param _endingPrice - Price of item (in wei) at end of auction.
    /// @param _duration - Length of time to move between starting
    ///  price and ending price (in seconds).
    /// @param _seller - Seller, if not the message sender
    function createAuction(
        uint256 _tokenId,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        address _seller
    )
        external
        whenNotPaused
    {
        // Sanity check that no inputs overflow how many bits we've allocated
        // to store them in the auction struct.
        require(_startingPrice == uint256(uint128(_startingPrice)));
        require(_endingPrice == uint256(uint128(_endingPrice)));
        require(_duration == uint256(uint64(_duration)));

        require(_owns(msg.sender, _tokenId));
        _escrow(msg.sender, _tokenId);
        Auction memory auction = Auction(
            _seller,
            uint128(_startingPrice),
            uint128(_endingPrice),
            uint64(_duration),
            uint64(now)
        );
        _addAuction(_tokenId, auction);
    }

    /// @dev Bids on an open auction, completing the auction and transferring
    ///  ownership of the NFT if enough Ether is supplied.
    /// @param _tokenId - ID of token to bid on.
    function bid(uint256 _tokenId)
        external
        payable
        whenNotPaused
    {
        // _bid will throw if the bid or funds transfer fails
        _bid(_tokenId, msg.value);
    }

    /// @dev Cancels an auction that hasn't been won yet.
    ///  Returns the NFT to original owner.
    /// @notice This is a state-modifying function that can
    ///  be called while the contract is paused.
    /// @param _tokenId - ID of token on auction
    function cancelAuction(uint256 _tokenId)
        external
    {
        Auction storage auction = tokenIdToAuction[_tokenId];
        require(_isOnAuction(auction));
        address seller = auction.seller;
        require(msg.sender == seller);
        _cancelAuction(_tokenId, seller);
    }

    /// @dev Cancels an auction when the contract is paused.
    ///  Only the owner may do this, and NFTs are returned to
    ///  the seller. This should only be used in emergencies.
    /// @param _tokenId - ID of the NFT on auction to cancel.
    function cancelAuctionWhenPaused(uint256 _tokenId)
        external
        whenPaused
        onlyOwner
    {
        Auction storage auction = tokenIdToAuction[_tokenId];
        require(_isOnAuction(auction));
        _cancelAuction(_tokenId, auction.seller);
    }

    /// @dev Returns auction info for an NFT on auction.
    /// @param _tokenId - ID of NFT on auction.
    function getAuction(uint256 _tokenId)
        external
        view
        returns
    (
        address seller,
        uint256 startingPrice,
        uint256 endingPrice,
        uint256 duration,
        uint256 startedAt
    ) {
            Auction storage auction = tokenIdToAuction[_tokenId];
            require(_isOnAuction(auction));
            return (
                auction.seller,
                auction.startingPrice,
                auction.endingPrice,
                auction.duration,
                auction.startedAt
            );
        }

    /// @dev Returns the current price of an auction.
    /// @param _tokenId - ID of the token price we are checking.
    function getCurrentPrice(uint256 _tokenId)
        external
        view
        returns (uint256)
    {
        Auction storage auction = tokenIdToAuction[_tokenId];
        require(_isOnAuction(auction));
        return _currentPrice(auction);
    }

}


/// @title Clock auction
/// @notice We omit a fallback function to prevent accidental sends to this contract.
contract SaleClockAuction is ClockAuction {

    // @dev Sanity check that allows us to ensure that we are pointing to the
    //  right auction in our setSaleAuctionAddress() call.
    bool public isSaleClockAuction = true;

    // Delegate constructor
    function SaleClockAuction(address _nftAddr, uint256 _cut) public
        ClockAuction(_nftAddr, _cut) {}

    /// @dev Creates and begins a new auction.
    /// @param _tokenId - ID of token to auction, sender must be owner.
    /// @param _startingPrice - Price of item (in wei) at beginning of auction.
    /// @param _endingPrice - Price of item (in wei) at end of auction.
    /// @param _duration - Length of auction (in seconds).
    /// @param _seller - Seller, if not the message sender
    function createAuction(
        uint256 _tokenId,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        address _seller
    )
        external
    {
        // Sanity check that no inputs overflow how many bits we've allocated
        // to store them in the auction struct.
        require(_startingPrice == uint256(uint128(_startingPrice)));
        require(_endingPrice == uint256(uint128(_endingPrice)));
        require(_duration == uint256(uint64(_duration)));

        require(msg.sender == address(nonFungibleContract));
        _escrow(_seller, _tokenId);
        Auction memory auction = Auction(
            _seller,
            uint128(_startingPrice),
            uint128(_endingPrice),
            uint64(_duration),
            uint64(now)
        );
        _addAuction(_tokenId, auction);
    }

    /// @dev Places a bid for the Masterpiece. Requires the sender
    /// is the Masterpiece Core contract because all bid methods
    /// should be wrapped.
    function bid(uint256 _tokenId)
        external
        payable
    {
        /* require(msg.sender == address(nonFungibleContract)); */
        // _bid checks that token ID is valid and will throw if bid fails
        _bid(_tokenId, msg.value);
    }
}


contract MasterpieceAuction is MasterpieceOwnership {

    /// @dev Transfers the balance of the sale auction contract
    /// to the MasterpieceCore contract. We use two-step withdrawal to
    /// prevent two transfer calls in the auction bid function.
    function withdrawAuctionBalances()
        external
        onlyCLevel
    {
        saleAuction.withdrawBalance();
    }

    /// @notice The auction contract variable (saleAuction) is defined in MasterpieceBase
    /// to allow us to refer to them in MasterpieceOwnership to prevent accidental transfers.
    /// @dev Sets the reference to the sale auction.
    /// @param _address - Address of sale contract.
    function setSaleAuctionAddress(address _address)
        external
        onlyCEO
    {
        SaleClockAuction candidateContract = SaleClockAuction(_address);

        // NOTE: verify that a contract is what we expect -
        // https://github.com/Lunyr/crowdsale-contracts/blob/
        // cfadd15986c30521d8ba7d5b6f57b4fefcc7ac38/contracts/LunyrToken.sol#L117
        require(candidateContract.isSaleClockAuction());

        // Set the new contract address
        saleAuction = candidateContract;
    }

    /// @dev The owner of a Masterpiece can put it up for auction.
    function createSaleAuction(
        uint256 _tokenId,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration
    )
        external
        whenNotPaused
    {
        // Check that the Masterpiece to be put on an auction sale is owned by
        // its current owner. If it's already in an auction, this validation
        // will fail because the MasterpieceAuction contract owns the
        // Masterpiece once it is put on an auction sale.
        require(_owns(msg.sender, _tokenId));
        _approve(_tokenId, saleAuction);
        // Sale auction throws if inputs are invalid and clears
        // transfer approval after escrow
        saleAuction.createAuction(
            _tokenId,
            _startingPrice,
            _endingPrice,
            _duration,
            msg.sender
        );
    }

}


contract MasterpieceSale is MasterpieceAuction {

    // Allows someone to send ether and obtain the token
    function purchase(uint256 _tokenId)
        public
        payable
        whenNotPaused
    {
        address newOwner = msg.sender;
        address oldOwner = masterpieceToOwner[_tokenId];
        uint256 salePrice = masterpieceToPrice[_tokenId];

        // Require that the masterpiece is either currently owned by the Masterpiece
        // Core contract or was born within the snatch window.
        require(
            (oldOwner == address(this)) ||
            (now - masterpieces[_tokenId].birthTime <= masterpieceToSnatchWindow[_tokenId])
        );

        // Require that the owner of the token is not sending to self.
        require(oldOwner != newOwner);

        // Require that the Masterpiece is not in an auction by checking that
        // the Sale Clock Auction contract is not the owner.
        require(address(oldOwner) != address(saleAuction));

        // Safety check to prevent against an unexpected 0x0 default.
        require(_addressNotNull(newOwner));

        // Check that sent amount is greater than or equal to the sale price
        require(msg.value >= salePrice);

        uint256 payment = uint256(computePayment(salePrice));
        uint256 purchaseExcess = SafeMath.sub(msg.value, salePrice);

        // Set next listing price.
        masterpieceToPrice[_tokenId] = computeNextPrice(salePrice);

        // Transfer the Masterpiece to the buyer.
        _transfer(oldOwner, newOwner, _tokenId);

        // Pay seller of the Masterpiece if they are not this contract.
        if (oldOwner != address(this)) {
            oldOwner.transfer(payment);
        }

        TokenSold(_tokenId, salePrice, masterpieceToPrice[_tokenId], oldOwner, newOwner, masterpieces[_tokenId].name);

        // Reimburse the buyer of any excess paid.
        msg.sender.transfer(purchaseExcess);
    }

    function priceOf(uint256 _tokenId)
        public
        view
        returns (uint256 price)
    {
        return masterpieceToPrice[_tokenId];
    }

}


contract MasterpieceMinting is MasterpieceSale {

    /*** CONSTANTS ***/
    /// @dev Starting price of a regular Masterpiece.
    uint128 private constant STARTING_PRICE = 0.001 ether;
    /// @dev Limit of number of promo masterpieces that can be created.
    uint16 private constant PROMO_CREATION_LIMIT = 10000;

    /// @dev Counts the number of Promotional Masterpieces the contract owner has created.
    uint16 public promoMasterpiecesCreatedCount;
    /// @dev Reference to contract tracking Non Fungible Token ownership
    ERC721 public nonFungibleContract;

    /// @dev Creates a new Masterpiece with the given name and artist.
    function createMasterpiece(
        string _name,
        string _artist,
        uint256 _snatchWindow
    )
        public
        onlyCurator
        returns (uint)
    {
        uint256 masterpieceId = _createMasterpiece(_name, _artist, STARTING_PRICE, _snatchWindow, address(this));
        return masterpieceId;
    }

    /// @dev Creates a new promotional Masterpiece with the given name, artist, starting
    /// price, and owner. If the owner or the price is not set, we default them to the
    /// curator's address and the starting price for all masterpieces.
    function createPromoMasterpiece(
        string _name,
        string _artist,
        uint256 _snatchWindow,
        uint256 _price,
        address _owner
    )
        public
        onlyCurator
        returns (uint)
    {
        require(promoMasterpiecesCreatedCount < PROMO_CREATION_LIMIT);

        address masterpieceOwner = _owner;
        if (masterpieceOwner == address(0)) {
            masterpieceOwner = curatorAddress;
        }

        if (_price <= 0) {
            _price = STARTING_PRICE;
        }

        uint256 masterpieceId = _createMasterpiece(_name, _artist, _price, _snatchWindow, masterpieceOwner);
        promoMasterpiecesCreatedCount++;
        return masterpieceId;
    }

}


/// CryptoMasterpieces: Collectible fine art masterpieces on the Ethereum blockchain.
contract MasterpieceCore is MasterpieceMinting {

    // - MasterpieceAccessControl: This contract defines which users are granted the given roles that are
    // required to execute specific operations.
    //
    // - MasterpieceBase: This contract inherits from the MasterpieceAccessControl contract and defines
    // the core functionality of CryptoMasterpieces, including the data types, storage, and constants.
    //
    // - MasterpiecePricing: This contract inherits from the MasterpieceBase contract and defines
    // the pricing logic for CryptoMasterpieces. With every purchase made through the Core contract or
    // through a sale auction, the next listed price will multiply based on 5 price tiers. This ensures
    // that the Masterpiece bought through CryptoMasterpieces will always be adjusted to its fair market
    // value.
    //
    // - MasterpieceOwnership: This contract inherits from the MasterpiecePricing contract and the ERC-721
    // (https://github.com/ethereum/EIPs/issues/721) contract and implements the methods required for
    //  Non-Fungible Token Transactions.
    //
    // - MasterpieceAuction: This contract inherits from the MasterpieceOwnership contract. It defines
    // the Dutch "clock" auction mechanism for owners of a masterpiece to place it on sale. The auction
    // starts off at the automatically generated next price and until it is sold, decrements the price
    // as time passes. The owner of the masterpiece can cancel the auction at any point and the price
    // cannot go lower than the price that the owner bought the masterpiece for.
    //
    // - MasterpieceSale: This contract inherits from the MasterpieceAuction contract. It defines the
    // tiered pricing logic and handles all sales. It also checks that a Masterpiece is not in an
    // auction before approving a purchase.
    //
    // - MasterpieceMinting: This contract inherits from the MasterpieceSale contract. It defines the
    // creation of new regular and promotional masterpieces.

    // Set in case the core contract is broken and a fork is required
    address public newContractAddress;

    function MasterpieceCore() public {
        // Starts paused.
        paused = true;

        // The creator of the contract is the initial CEO
        ceoAddress = msg.sender;

        // The creator of the contract is also the initial Curator
        curatorAddress = msg.sender;
    }

    /// @dev Used to mark the smart contract as upgraded, in case there is a serious
    ///  breaking bug. This method does nothing but keep track of the new contract and
    ///  emit a message indicating that the new address is set. It's up to clients of this
    ///  contract to update to the new contract address in that case. (This contract will
    ///  be paused indefinitely if such an upgrade takes place.)
    /// @param _v2Address new address
    function setNewAddress(address _v2Address)
        external
        onlyCEO
        whenPaused
    {
        // See README.md for updgrade plan
        newContractAddress = _v2Address;
        ContractFork(_v2Address);
    }

    /// @dev Withdraw all Ether from the contract. This includes the fee on every
    /// masterpiece sold and any Ether sent directly to the contract address.
    /// Only the CFO can withdraw the balance or specify the address to send
    /// the balance to.
    function withdrawBalance(address _to) external onlyCFO {
        // We are using this boolean method to make sure that even if one fails it will still work
        if (_to == address(0)) {
            cfoAddress.transfer(this.balance);
        } else {
            _to.transfer(this.balance);
        }
    }

    /// @notice Returns all the relevant information about a specific masterpiece.
    /// @param _tokenId The tokenId of the masterpiece of interest.
    function getMasterpiece(uint256 _tokenId) external view returns (
        string name,
        string artist,
        uint256 birthTime,
        uint256 snatchWindow,
        uint256 sellingPrice,
        address owner
    ) {
        Masterpiece storage masterpiece = masterpieces[_tokenId];
        name = masterpiece.name;
        artist = masterpiece.artist;
        birthTime = uint256(masterpiece.birthTime);
        snatchWindow = masterpieceToSnatchWindow[_tokenId];
        sellingPrice = masterpieceToPrice[_tokenId];
        owner = masterpieceToOwner[_tokenId];
    }

    /// @dev Override unpause so it requires all external contract addresses
    ///  to be set before contract can be unpaused. Also, we can't have
    ///  newContractAddress set either, because then the contract was upgraded.
    /// @notice This is public rather than external so we can call super.unpause
    ///  without using an expensive call.
    function unpause()
        public
        onlyCEO
        whenPaused
    {
        require(saleAuction != address(0));
        require(newContractAddress == address(0));

        // Actually unpause the contract.
        super.unpause();
    }

}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"curatorAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cfoAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ceoAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"ownerMasterpieceCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newCEO","type":"address"}],"name":"setCEO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INTERFACE_SIGNATURE_ERC165","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPrice","type":"uint256"},{"name":"_endingPrice","type":"uint256"},{"name":"_duration","type":"uint256"}],"name":"createSaleAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"snatchWindowOf","outputs":[{"name":"price","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newCFO","type":"address"}],"name":"setCFO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newContractAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"setSaleAuctionAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"count","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_v2Address","type":"address"}],"name":"setNewAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"withdrawBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_artist","type":"string"},{"name":"_snatchWindow","type":"uint256"}],"name":"createMasterpiece","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"name":"ownerTokens","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdrawAuctionBalances","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getMasterpiece","outputs":[{"name":"name","type":"string"},{"name":"artist","type":"string"},{"name":"birthTime","type":"uint256"},{"name":"snatchWindow","type":"uint256"},{"name":"sellingPrice","type":"uint256"},{"name":"owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"NAME","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_artist","type":"string"},{"name":"_snatchWindow","type":"uint256"},{"name":"_price","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createPromoMasterpiece","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"priceOf","outputs":[{"name":"price","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"promoMasterpiecesCreatedCount","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"nonFungibleContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"masterpieceToSnatchWindow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"saleAuction","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newCurator","type":"address"}],"name":"setCurator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"masterpieceToPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"purchase","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"masterpieceToOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"masterpieceToApproved","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tokenId","type":"uint256"},{"name":"salePrice","type":"uint256"}],"name":"setNextPriceOf","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SYMBOL","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"INTERFACE_SIGNATURE_ERC721","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_approved","type":"address"},{"indexed":false,"name":"_tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"snatchWindow","type":"uint256"},{"indexed":false,"name":"name","type":"string"},{"indexed":false,"name":"artist","type":"string"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"to","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"}],"name":"TransferToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"oldPrice","type":"uint256"},{"indexed":false,"name":"price","type":"uint256"},{"indexed":false,"name":"prevOwner","type":"address"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"name","type":"string"}],"name":"TokenSold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newContract","type":"address"}],"name":"ContractFork","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60606040526002805460a060020a60ff0219169055341561001f57600080fd5b6002805460008054600160a060020a033316600160a060020a0319918216811790925560a060020a60ff02199092167401000000000000000000000000000000000000000017919091161790556124fb8061007b6000396000f3006060604052600436106101ff5763ffffffff60e060020a6000350416621f91ce811461020457806301ffc9a7146102335780630519ce791461027c57806306fdde031461028f578063095ea7b3146103195780630a0f81681461033d57806318160ddd14610350578063201a59981461037557806323b872dd1461039457806327d7874c146103bc5780632b8af65b146103db5780633d7d3f5a146104205780633f4ba83a1461043f578063405ca219146104525780634e0a3379146104685780635c975abb146104875780636352211e1461049a5780636af04a57146104b05780636fbde40d146104c357806370a08231146104e25780637158798814610501578063756af45f1461052057806381b39e491461053f5780638456cb59146105d45780638462151c146105e757806391876e571461065957806394c6c2d11461066c57806395d89b4114610791578063a3f4df7e146107a4578063a873dcf9146107b7578063a9059cbb14610860578063b9186d7d14610882578063cb9a32a514610898578063dd1b7a0f146108c2578063e54d8fcb146108d5578063e6cbe351146108eb578063e90956cf146108fe578063eeb84eb51461091d578063efef39a114610933578063effca1fe1461093e578063f19bc42414610954578063f334a60c1461096a578063f76f8d7814610983578063fddf16b714610996575b600080fd5b341561020f57600080fd5b6102176109a9565b604051600160a060020a03909116815260200160405180910390f35b341561023e57600080fd5b6102687bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19600435166109b8565b604051901515815260200160405180910390f35b341561028757600080fd5b610217610c3f565b341561029a57600080fd5b6102a2610c4e565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156102de5780820151838201526020016102c6565b50505050905090810190601f16801561030b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561032457600080fd5b61033b600160a060020a0360043516602435610c90565b005b341561034857600080fd5b610217610d11565b341561035b57600080fd5b610363610d20565b60405190815260200160405180910390f35b341561038057600080fd5b610363600160a060020a0360043516610d26565b341561039f57600080fd5b61033b600160a060020a0360043581169060243516604435610d38565b34156103c757600080fd5b61033b600160a060020a0360043516610d9e565b34156103e657600080fd5b6103ee610df0565b6040517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19909116815260200160405180910390f35b341561042b57600080fd5b61033b600435602435604435606435610e24565b341561044a57600080fd5b61033b610ef0565b341561045d57600080fd5b610363600435610f5a565b341561047357600080fd5b61033b600160a060020a0360043516610f6c565b341561049257600080fd5b610268610fbe565b34156104a557600080fd5b610217600435610fce565b34156104bb57600080fd5b610217610ff2565b34156104ce57600080fd5b61033b600160a060020a0360043516611001565b34156104ed57600080fd5b610363600160a060020a03600435166110ae565b341561050c57600080fd5b61033b600160a060020a03600435166110c9565b341561052b57600080fd5b61033b600160a060020a0360043516611157565b341561054a57600080fd5b61036360046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650509335935061120092505050565b34156105df57600080fd5b61033b61123d565b34156105f257600080fd5b610606600160a060020a03600435166112c9565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561064557808201518382015260200161062d565b505050509050019250505060405180910390f35b341561066457600080fd5b61033b6113aa565b341561067757600080fd5b610682600435611449565b60405180806020018060200187815260200186815260200185815260200184600160a060020a0316600160a060020a03168152602001838103835289818151815260200191508051906020019080838360005b838110156106ed5780820151838201526020016106d5565b50505050905090810190601f16801561071a5780820380516001836020036101000a031916815260200191505b50838103825288818151815260200191508051906020019080838360005b83811015610750578082015183820152602001610738565b50505050905090810190601f16801561077d5780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390f35b341561079c57600080fd5b6102a261160b565b34156107af57600080fd5b6102a261164c565b34156107c257600080fd5b61036360046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650508435946020810135945060400135600160a060020a03169250611683915050565b341561086b57600080fd5b61033b600160a060020a0360043516602435611721565b341561088d57600080fd5b6103636004356117ad565b34156108a357600080fd5b6108ab6117bf565b60405161ffff909116815260200160405180910390f35b34156108cd57600080fd5b6102176117c9565b34156108e057600080fd5b6103636004356117de565b34156108f657600080fd5b6102176117f0565b341561090957600080fd5b61033b600160a060020a03600435166117ff565b341561092857600080fd5b610363600435611851565b61033b600435611863565b341561094957600080fd5b610217600435611b2d565b341561095f57600080fd5b610217600435611b48565b341561097557600080fd5b61033b600435602435611b63565b341561098e57600080fd5b6102a2611bb4565b34156109a157600080fd5b6103ee611beb565b600254600160a060020a031681565b60006040517f737570706f727473496e7465726661636528627974657334290000000000000081526019016040518091039020600160e060020a03191682600160e060020a0319161480610c3757506040517f746f6b656e4d657461646174612875696e743235362c737472696e67290000008152601d0160405180910390206040517f746f6b656e734f664f776e657228616464726573732900000000000000000000815260160160405180910390206040517f7472616e7366657246726f6d28616464726573732c616464726573732c75696e81527f7432353629000000000000000000000000000000000000000000000000000000602082015260250160405180910390206040517f7472616e7366657228616464726573732c75696e743235362900000000000000815260190160405180910390206040517f617070726f766528616464726573732c75696e74323536290000000000000000815260180160405180910390206040517f6f776e65724f662875696e743235362900000000000000000000000000000000815260100160405180910390206040517f62616c616e63654f662861646472657373290000000000000000000000000000815260120160405180910390206040517f746f74616c537570706c792829000000000000000000000000000000000000008152600d0160405180910390206040517f73796d626f6c2829000000000000000000000000000000000000000000000000815260080160405180910390206040517f6e616d652829000000000000000000000000000000000000000000000000000081526006016040518091039020181818181818181818600160e060020a03191682600160e060020a031916145b90505b919050565b600154600160a060020a031681565b610c56612343565b60408051908101604052600c81527f4d61737465727069656365730000000000000000000000000000000000000000602082015290505b90565b60025460a060020a900460ff1615610ca757600080fd5b610cb13382611e07565b1515610cbc57600080fd5b610cc68183611e27565b81600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405190815260200160405180910390a35050565b600054600160a060020a031681565b60035490565b60076020526000908152604090205481565b60025460a060020a900460ff1615610d4f57600080fd5b600160a060020a0382161515610d6457600080fd5b610d6e3382611e55565b1515610d7957600080fd5b610d838382611e07565b1515610d8e57600080fd5b610d99838383611e75565b505050565b60005433600160a060020a03908116911614610db957600080fd5b600160a060020a0381161515610dce57600080fd5b60008054600160a060020a031916600160a060020a0392909216919091179055565b6040517f737570706f727473496e746572666163652862797465733429000000000000008152601901604051809103902081565b60025460a060020a900460ff1615610e3b57600080fd5b610e453385611e07565b1515610e5057600080fd5b600454610e67908590600160a060020a0316611e27565b600454600160a060020a03166327ebe40a858585853360405160e060020a63ffffffff88160281526004810195909552602485019390935260448401919091526064830152600160a060020a0316608482015260a401600060405180830381600087803b1515610ed657600080fd5b6102c65a03f11515610ee757600080fd5b50505050505050565b60005433600160a060020a03908116911614610f0b57600080fd5b60025460a060020a900460ff161515610f2357600080fd5b600454600160a060020a03161515610f3a57600080fd5b600b54600160a060020a031615610f5057600080fd5b610f58611f4b565b565b60009081526006602052604090205490565b60005433600160a060020a03908116911614610f8757600080fd5b600160a060020a0381161515610f9c57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b60025460a060020a900460ff1681565b600081815260056020526040902054600160a060020a0316801515610c3a57600080fd5b600b54600160a060020a031681565b6000805433600160a060020a0390811691161461101d57600080fd5b5080600160a060020a0381166385b861886000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561106557600080fd5b6102c65a03f1151561107657600080fd5b50505060405180519050151561108b57600080fd5b60048054600160a060020a031916600160a060020a039290921691909117905550565b600160a060020a031660009081526007602052604090205490565b60005433600160a060020a039081169116146110e457600080fd5b60025460a060020a900460ff1615156110fc57600080fd5b600b8054600160a060020a031916600160a060020a0383161790557f7c8aa21b6d458495e0f3b9334bab682bc1ed68695864c87b662eb2783e9c227181604051600160a060020a03909116815260200160405180910390a150565b60015433600160a060020a0390811691161461117257600080fd5b600160a060020a03811615156111c057600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156111bb57600080fd5b6111fd565b80600160a060020a03166108fc30600160a060020a0316319081150290604051600060405180830381858888f1935050505015156111fd57600080fd5b50565b600254600090819033600160a060020a0390811691161461122057600080fd5b611234858566038d7ea4c680008630611f9e565b95945050505050565b60005433600160a060020a0390811691161480611268575060015433600160a060020a039081169116145b80611281575060025433600160a060020a039081169116145b151561128c57600080fd5b60025460a060020a900460ff16156112a357600080fd5b6002805474ff0000000000000000000000000000000000000000191660a060020a179055565b6112d1612343565b60006112db612343565b60008060006112e9876110ae565b94508415156113195760006040518059106113015750595b908082528060200260200182016040525095506113a0565b846040518059106113275750595b90808252806020026020018201604052509350611342610d20565b925060009150600090505b82811161139c57600081815260056020526040902054600160a060020a0388811691161415611394578084838151811061138357fe5b602090810290910101526001909101905b60010161134d565b8395505b5050505050919050565b60005433600160a060020a03908116911614806113d5575060015433600160a060020a039081169116145b806113ee575060025433600160a060020a039081169116145b15156113f957600080fd5b600454600160a060020a0316635fd8c7106040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561143857600080fd5b6102c65a03f11515610d9957600080fd5b611451612343565b611459612343565b600080600080600060038881548110151561147057fe5b90600052602060002090600302019050806000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115185780601f106114ed57610100808354040283529160200191611518565b820191906000526020600020905b8154815290600101906020018083116114fb57829003601f168201915b50505050509650806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115b75780601f1061158c576101008083540402835291602001916115b7565b820191906000526020600020905b81548152906001019060200180831161159a57829003601f168201915b50505060029093015460009a8b52600660209081526040808d205460098352818e205460059093529c20549a9c939b67ffffffffffffffff9092169a9199509750600160a060020a03169550909350505050565b611613612343565b60408051908101604052600381527f434d5000000000000000000000000000000000000000000000000000000000006020820152905090565b60408051908101604052600c81527f4d61737465727069656365730000000000000000000000000000000000000000602082015281565b6002546000908190819033600160a060020a039081169116146116a557600080fd5b600a5461271061ffff909116106116bb57600080fd5b839150600160a060020a03821615156116dd57600254600160a060020a031691505b600085116116f05766038d7ea4c6800094505b6116fd8888878986611f9e565b600a805461ffff8082166001011661ffff1990911617905598975050505050505050565b60025460a060020a900460ff161561173857600080fd5b600160a060020a038216151561174d57600080fd5b30600160a060020a031682600160a060020a03161415151561176e57600080fd5b600454600160a060020a038381169116141561178957600080fd5b6117933382611e07565b151561179e57600080fd5b6117a9338383611e75565b5050565b60009081526009602052604090205490565b600a5461ffff1681565b600a54620100009004600160a060020a031681565b60066020526000908152604090205481565b600454600160a060020a031681565b60005433600160a060020a0390811691161461181a57600080fd5b600160a060020a038116151561182f57600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b60096020526000908152604090205481565b6000806000806000600260149054906101000a900460ff1615151561188757600080fd5b600086815260056020908152604080832054600990925290912054339650600160a060020a039182169550935030168414806118fe575060008681526006602052604090205460038054889081106118db57fe5b600091825260209091206002600390920201015467ffffffffffffffff16420311155b151561190957600080fd5b600160a060020a03848116908616141561192257600080fd5b600454600160a060020a038581169116141561193d57600080fd5b611946856121bc565b151561195157600080fd5b348390101561195f57600080fd5b611968836121ca565b91506119743484612241565b905061197f83612253565b600087815260096020526040902055611999848688611e75565b30600160a060020a031684600160a060020a03161415156119e557600160a060020a03841682156108fc0283604051600060405180830381858888f1935050505015156119e557600080fd5b7e8201e7bcbf010c2c07de59d6e97cb7e3cf67a46125c49cbc89b9d2cde1f48f8684600960008a815260200190815260200160002054878960038c815481101515611a2c57fe5b90600052602060002090600302016000016040518681526020810186905260408101859052600160a060020a0380851660608301528316608082015260c060a082018181528354600260001961010060018416150201909116049183018290529060e083019084908015611ae15780601f10611ab657610100808354040283529160200191611ae1565b820191906000526020600020905b815481529060010190602001808311611ac457829003601f168201915b505097505050505050505060405180910390a1600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515611b2557600080fd5b505050505050565b600560205260009081526040902054600160a060020a031681565b600860205260009081526040902054600160a060020a031681565b60025460a060020a900460ff1615611b7a57600080fd5b60045433600160a060020a03908116911614611b9557600080fd5b611b9e81612253565b6000928352600960205260409092209190915550565b60408051908101604052600381527f434d500000000000000000000000000000000000000000000000000000000000602082015281565b6040517f746f6b656e4d657461646174612875696e743235362c737472696e67290000008152601d0160405180910390206040517f746f6b656e734f664f776e657228616464726573732900000000000000000000815260160160405180910390206040517f7472616e7366657246726f6d28616464726573732c616464726573732c75696e81527f7432353629000000000000000000000000000000000000000000000000000000602082015260250160405180910390206040517f7472616e7366657228616464726573732c75696e743235362900000000000000815260190160405180910390206040517f617070726f766528616464726573732c75696e74323536290000000000000000815260180160405180910390206040517f6f776e65724f662875696e743235362900000000000000000000000000000000815260100160405180910390206040517f62616c616e63654f662861646472657373290000000000000000000000000000815260120160405180910390206040517f746f74616c537570706c792829000000000000000000000000000000000000008152600d0160405180910390206040517f73796d626f6c2829000000000000000000000000000000000000000000000000815260080160405180910390206040517f6e616d65282900000000000000000000000000000000000000000000000000008152600601604051809103902018181818181818181881565b600090815260056020526040902054600160a060020a0391821691161490565b6000918252600860205260409091208054600160a060020a031916600160a060020a03909216919091179055565b600090815260086020526040902054600160a060020a0391821691161490565b600160a060020a03808316600081815260076020908152604080832080546001019055858352600590915290208054600160a060020a0319169091179055831615611ef657600160a060020a03831660009081526007602090815260408083208054600019019055838352600890915290208054600160a060020a03191690555b7f3844b7075ed6e7d4b61342769cb2b1b325cba410a62932affaa90aee247dadf5838383604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a1505050565b60005433600160a060020a03908116911614611f6657600080fd5b60025460a060020a900460ff161515611f7e57600080fd5b6002805474ff000000000000000000000000000000000000000019169055565b6000611fa8612355565b60006060604051908101604052808981526020018881526020014267ffffffffffffffff168152509150600160038054806001018281611fe89190612383565b6000928352602090922085916003020181518190805161200c9291602001906123af565b506020820151816001019080516120279291602001906123af565b506040820151600291909101805467ffffffffffffffff191667ffffffffffffffff909216919091179055500390507fbd5950d2f40e1826ab07e83d9637211654d83e07c533da3a9395dd169251901f848287855186602001516040518086600160a060020a0316600160a060020a031681526020018581526020018481526020018060200180602001838103835285818151815260200191508051906020019080838360005b838110156120e65780820151838201526020016120ce565b50505050905090810190601f1680156121135780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015612149578082015183820152602001612131565b50505050905090810190601f1680156121765780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390a16000818152600960209081526040808320899055600690915281208690556121b1908583611e75565b979650505050505050565b600160a060020a0316151590565b600066b1a2bc2ec500008210156121f7576121f06121e983605f6122f6565b606461232c565b9050610c3a565b6706f05b59d3b20000821015612215576121f06121e98360606122f6565b674563918244f40000821015612233576121f06121e98360616122f6565b6121f06121e98360626122f6565b60008282111561224d57fe5b50900390565b600066b1a2bc2ec50000821015612279576121f06122728360c86122f6565b605f61232c565b6706f05b59d3b2000082101561229e576121f06122978360876122f6565b606061232c565b671bc16d674ec800008210156122c3576121f06122bc83607d6122f6565b606161232c565b674563918244f400008210156122e1576121f06122bc8360786122f6565b6121f06122ef8360736122f6565b606261232c565b6000808315156123095760009150612325565b5082820282848281151561231957fe5b041461232157fe5b8091505b5092915050565b600080828481151561233a57fe5b04949350505050565b60206040519081016040526000815290565b606060405190810160405280612369612343565b8152602001612376612343565b8152600060209091015290565b815481835581811511610d9957600302816003028360005260206000209182019101610d99919061242d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106123f057805160ff191683800117855561241d565b8280016001018555821561241d579182015b8281111561241d578251825591602001919060010190612402565b50612429929150612471565b5090565b610c8d91905b80821115612429576000612447828261248b565b61245560018301600061248b565b5060028101805467ffffffffffffffff19169055600301612433565b610c8d91905b808211156124295760008155600101612477565b50805460018160011615610100020316600290046000825580601f106124b157506111fd565b601f0160209004906000526020600020908101906111fd91906124715600a165627a7a723058208c71ac52f39234f2e520b5b063b07c0dd20c077925452923e73d2ce0a7b8e31b0029

   Swarm Source:
bzzr://8c71ac52f39234f2e520b5b063b07c0dd20c077925452923e73d2ce0a7b8e31b

 

View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.