ETH Price: $3,400.09 (+2.61%)

Token

DWorld Plots (DWP)
 

Overview

Max Total Supply

0 DWP

Holders

0

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 0 Decimals)

Balance
0 DWP

Value
$0.00
0x6f9f85c4e21b54592a8c746e2d20afbc4a40c0a7
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
DWorldCore

Compiler Version
v0.4.18+commit.9cf6e910

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-02-03
*/

pragma solidity ^0.4.18;


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {
  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;
  }

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

  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  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 Claimable
 * @dev Extension for the Ownable contract, where the ownership needs to be claimed.
 * This allows the new owner to accept the transfer.
 */
contract Claimable is Ownable {
  address public pendingOwner;

  /**
   * @dev Modifier throws if called by any account other than the pendingOwner.
   */
  modifier onlyPendingOwner() {
    require(msg.sender == pendingOwner);
    _;
  }

  /**
   * @dev Allows the current owner to set the pendingOwner address.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) onlyOwner public {
    pendingOwner = newOwner;
  }

  /**
   * @dev Allows the pendingOwner address to finalize the transfer.
   */
  function claimOwnership() onlyPendingOwner public {
    OwnershipTransferred(owner, pendingOwner);
    owner = pendingOwner;
    pendingOwner = address(0);
  }
}


/**
 * @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 make a function callable only when the contract is not paused.
   */
  modifier whenNotPaused() {
    require(!paused);
    _;
  }

  /**
   * @dev Modifier to make a function callable only when the contract is paused.
   */
  modifier whenPaused() {
    require(paused);
    _;
  }

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

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


/**
 * @title ERC20Basic
 * @dev Simpler version of ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/179
 */
contract ERC20Basic {
  uint256 public totalSupply;
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
}


/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender) public view returns (uint256);
  function transferFrom(address from, address to, uint256 value) public returns (bool);
  function approve(address spender, uint256 value) public returns (bool);
  event Approval(address indexed owner, address indexed spender, uint256 value);
}


/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure.
 * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
  function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
    assert(token.transfer(to, value));
  }

  function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
    assert(token.transferFrom(from, to, value));
  }

  function safeApprove(ERC20 token, address spender, uint256 value) internal {
    assert(token.approve(spender, value));
  }
}


/**
 * @title Contracts that should be able to recover tokens
 * @author SylTi
 * @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.
 * This will prevent any accidental loss of tokens.
 */
contract CanReclaimToken is Ownable {
  using SafeERC20 for ERC20Basic;

  /**
   * @dev Reclaim all ERC20Basic compatible tokens
   * @param token ERC20Basic The address of the token contract
   */
  function reclaimToken(ERC20Basic token) external onlyOwner {
    uint256 balance = token.balanceOf(this);
    token.safeTransfer(owner, balance);
  }

}


/// @title Interface for contracts conforming to ERC-721: Deed Standard
/// @author William Entriken (https://phor.net), et al.
/// @dev Specification at https://github.com/ethereum/EIPs/pull/841 (DRAFT)
interface ERC721 {

    // COMPLIANCE WITH ERC-165 (DRAFT) /////////////////////////////////////////

    /// @dev ERC-165 (draft) interface signature for itself
    // bytes4 internal constant INTERFACE_SIGNATURE_ERC165 = // 0x01ffc9a7
    //     bytes4(keccak256('supportsInterface(bytes4)'));

    /// @dev ERC-165 (draft) interface signature for ERC721
    // bytes4 internal constant INTERFACE_SIGNATURE_ERC721 = // 0xda671b9b
    //     bytes4(keccak256('ownerOf(uint256)')) ^
    //     bytes4(keccak256('countOfDeeds()')) ^
    //     bytes4(keccak256('countOfDeedsByOwner(address)')) ^
    //     bytes4(keccak256('deedOfOwnerByIndex(address,uint256)')) ^
    //     bytes4(keccak256('approve(address,uint256)')) ^
    //     bytes4(keccak256('takeOwnership(uint256)'));

    /// @notice Query a contract to see if it supports a certain interface
    /// @dev Returns `true` the interface is supported and `false` otherwise,
    ///  returns `true` for INTERFACE_SIGNATURE_ERC165 and
    ///  INTERFACE_SIGNATURE_ERC721, see ERC-165 for other interface signatures.
    function supportsInterface(bytes4 _interfaceID) external pure returns (bool);

    // PUBLIC QUERY FUNCTIONS //////////////////////////////////////////////////

    /// @notice Find the owner of a deed
    /// @param _deedId The identifier for a deed we are inspecting
    /// @dev Deeds assigned to zero address are considered destroyed, and
    ///  queries about them do throw.
    /// @return The non-zero address of the owner of deed `_deedId`, or `throw`
    ///  if deed `_deedId` is not tracked by this contract
    function ownerOf(uint256 _deedId) external view returns (address _owner);

    /// @notice Count deeds tracked by this contract
    /// @return A count of the deeds tracked by this contract, where each one of
    ///  them has an assigned and queryable owner
    function countOfDeeds() public view returns (uint256 _count);

    /// @notice Count all deeds assigned to an owner
    /// @dev Throws if `_owner` is the zero address, representing destroyed deeds.
    /// @param _owner An address where we are interested in deeds owned by them
    /// @return The number of deeds owned by `_owner`, possibly zero
    function countOfDeedsByOwner(address _owner) public view returns (uint256 _count);

    /// @notice Enumerate deeds assigned to an owner
    /// @dev Throws if `_index` >= `countOfDeedsByOwner(_owner)` or if
    ///  `_owner` is the zero address, representing destroyed deeds.
    /// @param _owner An address where we are interested in deeds owned by them
    /// @param _index A counter between zero and `countOfDeedsByOwner(_owner)`,
    ///  inclusive
    /// @return The identifier for the `_index`th deed assigned to `_owner`,
    ///   (sort order not specified)
    function deedOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256 _deedId);

    // TRANSFER MECHANISM //////////////////////////////////////////////////////

    /// @dev This event emits when ownership of any deed changes by any
    ///  mechanism. This event emits when deeds are created (`from` == 0) and
    ///  destroyed (`to` == 0). Exception: during contract creation, any
    ///  transfers may occur without emitting `Transfer`.
    event Transfer(address indexed from, address indexed to, uint256 indexed deedId);

    /// @dev This event emits on any successful call to
    ///  `approve(address _spender, uint256 _deedId)`. Exception: does not emit
    ///  if an owner revokes approval (`_to` == 0x0) on a deed with no existing
    ///  approval.
    event Approval(address indexed owner, address indexed approved, uint256 indexed deedId);

    /// @notice Approve a new owner to take your deed, or revoke approval by
    ///  setting the zero address. You may `approve` any number of times while
    ///  the deed is assigned to you, only the most recent approval matters.
    /// @dev Throws if `msg.sender` does not own deed `_deedId` or if `_to` ==
    ///  `msg.sender`.
    /// @param _deedId The deed you are granting ownership of
    function approve(address _to, uint256 _deedId) external;

    /// @notice Become owner of a deed for which you are currently approved
    /// @dev Throws if `msg.sender` is not approved to become the owner of
    ///  `deedId` or if `msg.sender` currently owns `_deedId`.
    /// @param _deedId The deed that is being transferred
    function takeOwnership(uint256 _deedId) external;
    
    // SPEC EXTENSIONS /////////////////////////////////////////////////////////
    
    /// @notice Transfer a deed to a new owner.
    /// @dev Throws if `msg.sender` does not own deed `_deedId` or if
    ///  `_to` == 0x0.
    /// @param _to The address of the new owner.
    /// @param _deedId The deed you are transferring.
    function transfer(address _to, uint256 _deedId) external;
}


/// @title Metadata extension to ERC-721 interface
/// @author William Entriken (https://phor.net)
/// @dev Specification at https://github.com/ethereum/EIPs/pull/841 (DRAFT)
interface ERC721Metadata {

    /// @dev ERC-165 (draft) interface signature for ERC721
    // bytes4 internal constant INTERFACE_SIGNATURE_ERC721Metadata = // 0x2a786f11
    //     bytes4(keccak256('name()')) ^
    //     bytes4(keccak256('symbol()')) ^
    //     bytes4(keccak256('deedUri(uint256)'));

    /// @notice A descriptive name for a collection of deeds managed by this
    ///  contract
    /// @dev Wallets and exchanges MAY display this to the end user.
    function name() public pure returns (string _deedName);

    /// @notice An abbreviated name for deeds managed by this contract
    /// @dev Wallets and exchanges MAY display this to the end user.
    function symbol() public pure returns (string _deedSymbol);

    /// @notice A distinct URI (RFC 3986) for a given token.
    /// @dev If:
    ///  * The URI is a URL
    ///  * The URL is accessible
    ///  * The URL points to a valid JSON file format (ECMA-404 2nd ed.)
    ///  * The JSON base element is an object
    ///  then these names of the base element SHALL have special meaning:
    ///  * "name": A string identifying the item to which `_deedId` grants
    ///    ownership
    ///  * "description": A string detailing the item to which `_deedId` grants
    ///    ownership
    ///  * "image": A URI pointing to a file of image/* mime type representing
    ///    the item to which `_deedId` grants ownership
    ///  Wallets and exchanges MAY display this to the end user.
    ///  Consider making any images at a width between 320 and 1080 pixels and
    ///  aspect ratio between 1.91:1 and 4:5 inclusive.
    function deedUri(uint256 _deedId) external pure returns (string _uri);
}


/// @dev Implements access control to the DWorld contract.
contract DWorldAccessControl is Claimable, Pausable, CanReclaimToken {
    address public cfoAddress;

    function DWorldAccessControl() public {
        // The creator of the contract is the initial CFO.
        cfoAddress = msg.sender;
    }
    
    /// @dev Access modifier for CFO-only functionality.
    modifier onlyCFO() {
        require(msg.sender == cfoAddress);
        _;
    }

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

        cfoAddress = _newCFO;
    }
}


/// @dev Defines base data structures for DWorld.
contract DWorldBase is DWorldAccessControl {
    using SafeMath for uint256;
    
    /// @dev All minted plots (array of plot identifiers). There are
    /// 2^16 * 2^16 possible plots (covering the entire world), thus
    /// 32 bits are required. This fits in a uint32. Storing
    /// the identifiers as uint32 instead of uint256 makes storage
    /// cheaper. (The impact of this in mappings is less noticeable,
    /// and using uint32 in the mappings below actually *increases*
    /// gas cost for minting).
    uint32[] public plots;
    
    mapping (uint256 => address) identifierToOwner;
    mapping (uint256 => address) identifierToApproved;
    mapping (address => uint256) ownershipDeedCount;
    
    // Boolean indicating whether the plot was bought before the migration.
    mapping (uint256 => bool) public identifierIsOriginal;
    
    /// @dev Event fired when a plot's data are changed. The plot
    /// data are not stored in the contract directly, instead the
    /// data are logged to the block. This gives significant
    /// reductions in gas requirements (~75k for minting with data
    /// instead of ~180k). However, it also means plot data are
    /// not available from *within* other contracts.
    event SetData(uint256 indexed deedId, string name, string description, string imageUrl, string infoUrl);
    
    /// @notice Get all minted plots.
    function getAllPlots() external view returns(uint32[]) {
        return plots;
    }
    
    /// @dev Represent a 2D coordinate as a single uint.
    /// @param x The x-coordinate.
    /// @param y The y-coordinate.
    function coordinateToIdentifier(uint256 x, uint256 y) public pure returns(uint256) {
        require(validCoordinate(x, y));
        
        return (y << 16) + x;
    }
    
    /// @dev Turn a single uint representation of a coordinate into its x and y parts.
    /// @param identifier The uint representation of a coordinate.
    function identifierToCoordinate(uint256 identifier) public pure returns(uint256 x, uint256 y) {
        require(validIdentifier(identifier));
    
        y = identifier >> 16;
        x = identifier - (y << 16);
    }
    
    /// @dev Test whether the coordinate is valid.
    /// @param x The x-part of the coordinate to test.
    /// @param y The y-part of the coordinate to test.
    function validCoordinate(uint256 x, uint256 y) public pure returns(bool) {
        return x < 65536 && y < 65536; // 2^16
    }
    
    /// @dev Test whether an identifier is valid.
    /// @param identifier The identifier to test.
    function validIdentifier(uint256 identifier) public pure returns(bool) {
        return identifier < 4294967296; // 2^16 * 2^16
    }
    
    /// @dev Set a plot's data.
    /// @param identifier The identifier of the plot to set data for.
    function _setPlotData(uint256 identifier, string name, string description, string imageUrl, string infoUrl) internal {
        SetData(identifier, name, description, imageUrl, infoUrl);
    }
}


/// @dev Holds deed functionality such as approving and transferring. Implements ERC721.
contract DWorldDeed is DWorldBase, ERC721, ERC721Metadata {
    
    /// @notice Name of the collection of deeds (non-fungible token), as defined in ERC721Metadata.
    function name() public pure returns (string _deedName) {
        _deedName = "DWorld Plots";
    }
    
    /// @notice Symbol of the collection of deeds (non-fungible token), as defined in ERC721Metadata.
    function symbol() public pure returns (string _deedSymbol) {
        _deedSymbol = "DWP";
    }
    
    /// @dev ERC-165 (draft) interface signature for itself
    bytes4 internal constant INTERFACE_SIGNATURE_ERC165 = // 0x01ffc9a7
        bytes4(keccak256('supportsInterface(bytes4)'));

    /// @dev ERC-165 (draft) interface signature for ERC721
    bytes4 internal constant INTERFACE_SIGNATURE_ERC721 = // 0xda671b9b
        bytes4(keccak256('ownerOf(uint256)')) ^
        bytes4(keccak256('countOfDeeds()')) ^
        bytes4(keccak256('countOfDeedsByOwner(address)')) ^
        bytes4(keccak256('deedOfOwnerByIndex(address,uint256)')) ^
        bytes4(keccak256('approve(address,uint256)')) ^
        bytes4(keccak256('takeOwnership(uint256)'));
        
    /// @dev ERC-165 (draft) interface signature for ERC721
    bytes4 internal constant INTERFACE_SIGNATURE_ERC721Metadata = // 0x2a786f11
        bytes4(keccak256('name()')) ^
        bytes4(keccak256('symbol()')) ^
        bytes4(keccak256('deedUri(uint256)'));
    
    /// @notice Introspection interface as per ERC-165 (https://github.com/ethereum/EIPs/issues/165).
    /// Returns true for any standardized interfaces implemented by this contract.
    /// (ERC-165 and ERC-721.)
    function supportsInterface(bytes4 _interfaceID) external pure returns (bool) {
        return (
            (_interfaceID == INTERFACE_SIGNATURE_ERC165)
            || (_interfaceID == INTERFACE_SIGNATURE_ERC721)
            || (_interfaceID == INTERFACE_SIGNATURE_ERC721Metadata)
        );
    }
    
    /// @dev Checks if a given address owns a particular plot.
    /// @param _owner The address of the owner to check for.
    /// @param _deedId The plot identifier to check for.
    function _owns(address _owner, uint256 _deedId) internal view returns (bool) {
        return identifierToOwner[_deedId] == _owner;
    }
    
    /// @dev Approve a given address to take ownership of a deed.
    /// @param _from The address approving taking ownership.
    /// @param _to The address to approve taking ownership.
    /// @param _deedId The identifier of the deed to give approval for.
    function _approve(address _from, address _to, uint256 _deedId) internal {
        identifierToApproved[_deedId] = _to;
        
        // Emit event.
        Approval(_from, _to, _deedId);
    }
    
    /// @dev Checks if a given address has approval to take ownership of a deed.
    /// @param _claimant The address of the claimant to check for.
    /// @param _deedId The identifier of the deed to check for.
    function _approvedFor(address _claimant, uint256 _deedId) internal view returns (bool) {
        return identifierToApproved[_deedId] == _claimant;
    }
    
    /// @dev Assigns ownership of a specific deed to an address.
    /// @param _from The address to transfer the deed from.
    /// @param _to The address to transfer the deed to.
    /// @param _deedId The identifier of the deed to transfer.
    function _transfer(address _from, address _to, uint256 _deedId) internal {
        // The number of plots is capped at 2^16 * 2^16, so this cannot
        // be overflowed.
        ownershipDeedCount[_to]++;
        
        // Transfer ownership.
        identifierToOwner[_deedId] = _to;
        
        // When a new deed is minted, the _from address is 0x0, but we
        // do not track deed ownership of 0x0.
        if (_from != address(0)) {
            ownershipDeedCount[_from]--;
            
            // Clear taking ownership approval.
            delete identifierToApproved[_deedId];
        }
        
        // Emit the transfer event.
        Transfer(_from, _to, _deedId);
    }
    
    // ERC 721 implementation
    
    /// @notice Returns the total number of deeds currently in existence.
    /// @dev Required for ERC-721 compliance.
    function countOfDeeds() public view returns (uint256) {
        return plots.length;
    }
    
    /// @notice Returns the number of deeds owned by a specific address.
    /// @param _owner The owner address to check.
    /// @dev Required for ERC-721 compliance
    function countOfDeedsByOwner(address _owner) public view returns (uint256) {
        return ownershipDeedCount[_owner];
    }
    
    /// @notice Returns the address currently assigned ownership of a given deed.
    /// @dev Required for ERC-721 compliance.
    function ownerOf(uint256 _deedId) external view returns (address _owner) {
        _owner = identifierToOwner[_deedId];

        require(_owner != address(0));
    }
    
    /// @notice Approve a given address to take ownership of a deed.
    /// @param _to The address to approve taking owernship.
    /// @param _deedId The identifier of the deed to give approval for.
    /// @dev Required for ERC-721 compliance.
    function approve(address _to, uint256 _deedId) external whenNotPaused {
        uint256[] memory _deedIds = new uint256[](1);
        _deedIds[0] = _deedId;
        
        approveMultiple(_to, _deedIds);
    }
    
    /// @notice Approve a given address to take ownership of multiple deeds.
    /// @param _to The address to approve taking ownership.
    /// @param _deedIds The identifiers of the deeds to give approval for.
    function approveMultiple(address _to, uint256[] _deedIds) public whenNotPaused {
        // Ensure the sender is not approving themselves.
        require(msg.sender != _to);
    
        for (uint256 i = 0; i < _deedIds.length; i++) {
            uint256 _deedId = _deedIds[i];
            
            // Require the sender is the owner of the deed.
            require(_owns(msg.sender, _deedId));
            
            // Perform the approval.
            _approve(msg.sender, _to, _deedId);
        }
    }
    
    /// @notice Transfer a deed to another address. If transferring to a smart
    /// contract be VERY CAREFUL to ensure that it is aware of ERC-721, or your
    /// deed may be lost forever.
    /// @param _to The address of the recipient, can be a user or contract.
    /// @param _deedId The identifier of the deed to transfer.
    /// @dev Required for ERC-721 compliance.
    function transfer(address _to, uint256 _deedId) external whenNotPaused {
        uint256[] memory _deedIds = new uint256[](1);
        _deedIds[0] = _deedId;
        
        transferMultiple(_to, _deedIds);
    }
    
    /// @notice Transfers multiple deeds to another address. If transferring to
    /// a smart contract be VERY CAREFUL to ensure that it is aware of ERC-721,
    /// or your deeds may be lost forever.
    /// @param _to The address of the recipient, can be a user or contract.
    /// @param _deedIds The identifiers of the deeds to transfer.
    function transferMultiple(address _to, uint256[] _deedIds) public whenNotPaused {
        // Safety check to prevent against an unexpected 0x0 default.
        require(_to != address(0));
        
        // Disallow transfers to this contract to prevent accidental misuse.
        require(_to != address(this));
    
        for (uint256 i = 0; i < _deedIds.length; i++) {
            uint256 _deedId = _deedIds[i];
            
            // One can only transfer their own plots.
            require(_owns(msg.sender, _deedId));

            // Transfer ownership
            _transfer(msg.sender, _to, _deedId);
        }
    }
    
    /// @notice Transfer a deed owned by another address, for which the calling
    /// address has previously been granted transfer approval by the owner.
    /// @param _deedId The identifier of the deed to be transferred.
    /// @dev Required for ERC-721 compliance.
    function takeOwnership(uint256 _deedId) external whenNotPaused {
        uint256[] memory _deedIds = new uint256[](1);
        _deedIds[0] = _deedId;
        
        takeOwnershipMultiple(_deedIds);
    }
    
    /// @notice Transfer multiple deeds owned by another address, for which the
    /// calling address has previously been granted transfer approval by the owner.
    /// @param _deedIds The identifier of the deed to be transferred.
    function takeOwnershipMultiple(uint256[] _deedIds) public whenNotPaused {
        for (uint256 i = 0; i < _deedIds.length; i++) {
            uint256 _deedId = _deedIds[i];
            address _from = identifierToOwner[_deedId];
            
            // Check for transfer approval
            require(_approvedFor(msg.sender, _deedId));

            // Reassign ownership (also clears pending approvals and emits Transfer event).
            _transfer(_from, msg.sender, _deedId);
        }
    }
    
    /// @notice Returns a list of all deed identifiers assigned to an address.
    /// @param _owner The owner whose deeds we are interested in.
    /// @dev This method MUST NEVER be called by smart contract code. It's very
    /// expensive and is not supported in contract-to-contract calls as it returns
    /// a dynamic array (only supported for web3 calls).
    function deedsOfOwner(address _owner) external view returns(uint256[]) {
        uint256 deedCount = countOfDeedsByOwner(_owner);

        if (deedCount == 0) {
            // Return an empty array.
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](deedCount);
            uint256 totalDeeds = countOfDeeds();
            uint256 resultIndex = 0;
            
            for (uint256 deedNumber = 0; deedNumber < totalDeeds; deedNumber++) {
                uint256 identifier = plots[deedNumber];
                if (identifierToOwner[identifier] == _owner) {
                    result[resultIndex] = identifier;
                    resultIndex++;
                }
            }

            return result;
        }
    }
    
    /// @notice Returns a deed identifier of the owner at the given index.
    /// @param _owner The address of the owner we want to get a deed for.
    /// @param _index The index of the deed we want.
    function deedOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256) {
        // The index should be valid.
        require(_index < countOfDeedsByOwner(_owner));

        // Loop through all plots, accounting the number of plots of the owner we've seen.
        uint256 seen = 0;
        uint256 totalDeeds = countOfDeeds();
        
        for (uint256 deedNumber = 0; deedNumber < totalDeeds; deedNumber++) {
            uint256 identifier = plots[deedNumber];
            if (identifierToOwner[identifier] == _owner) {
                if (seen == _index) {
                    return identifier;
                }
                
                seen++;
            }
        }
    }
    
    /// @notice Returns an (off-chain) metadata url for the given deed.
    /// @param _deedId The identifier of the deed to get the metadata
    /// url for.
    /// @dev Implementation of optional ERC-721 functionality.
    function deedUri(uint256 _deedId) external pure returns (string uri) {
        require(validIdentifier(_deedId));
    
        var (x, y) = identifierToCoordinate(_deedId);
    
        // Maximum coordinate length in decimals is 5 (65535)
        uri = "https://dworld.io/plot/xxxxx/xxxxx";
        bytes memory _uri = bytes(uri);
        
        for (uint256 i = 0; i < 5; i++) {
            _uri[27 - i] = byte(48 + (x / 10 ** i) % 10);
            _uri[33 - i] = byte(48 + (y / 10 ** i) % 10);
        }
    }
}


/// @dev Holds functionality for finance related to plots.
contract DWorldFinance is DWorldDeed {
    /// Total amount of Ether yet to be paid to auction beneficiaries.
    uint256 public outstandingEther = 0 ether;
    
    /// Amount of Ether yet to be paid per beneficiary.
    mapping (address => uint256) public addressToEtherOwed;
    
    /// Base price for unclaimed plots.
    uint256 public unclaimedPlotPrice = 0.0125 ether;
    
    /// Dividend per plot surrounding a new claim, in 1/1000th of percentages
    /// of the base unclaimed plot price.
    uint256 public claimDividendPercentage = 50000;
    
    /// Percentage of the buyout price that goes towards dividends.
    uint256 public buyoutDividendPercentage = 5000;
    
    /// Buyout fee in 1/1000th of a percentage.
    uint256 public buyoutFeePercentage = 3500;
    
    /// Number of free claims per address.
    mapping (address => uint256) freeClaimAllowance;
    
    /// Initial price paid for a plot.
    mapping (uint256 => uint256) public initialPricePaid;
    
    /// Current plot price.
    mapping (uint256 => uint256) public identifierToBuyoutPrice;
    
    /// Boolean indicating whether the plot has been bought out at least once.
    mapping (uint256 => bool) identifierToBoughtOutOnce;
    
    /// @dev Event fired when dividend is paid for a new plot claim.
    event ClaimDividend(address indexed from, address indexed to, uint256 deedIdFrom, uint256 indexed deedIdTo, uint256 dividend);
    
    /// @dev Event fired when a buyout is performed.
    event Buyout(address indexed buyer, address indexed seller, uint256 indexed deedId, uint256 winnings, uint256 totalCost, uint256 newPrice);
    
    /// @dev Event fired when dividend is paid for a buyout.
    event BuyoutDividend(address indexed from, address indexed to, uint256 deedIdFrom, uint256 indexed deedIdTo, uint256 dividend);
    
    /// @dev Event fired when the buyout price is manually changed for a plot.
    event SetBuyoutPrice(uint256 indexed deedId, uint256 newPrice);
    
    /// @dev The time after which buyouts will be enabled. Set in the DWorldCore constructor.
    uint256 public buyoutsEnabledFromTimestamp;
    
    /// @notice Sets the new price for unclaimed plots.
    /// @param _unclaimedPlotPrice The new price for unclaimed plots.
    function setUnclaimedPlotPrice(uint256 _unclaimedPlotPrice) external onlyCFO {
        unclaimedPlotPrice = _unclaimedPlotPrice;
    }
    
    /// @notice Sets the new dividend percentage for unclaimed plots.
    /// @param _claimDividendPercentage The new dividend percentage for unclaimed plots.
    function setClaimDividendPercentage(uint256 _claimDividendPercentage) external onlyCFO {
        // Claim dividend percentage must be 10% at the least.
        // Claim dividend percentage may be 100% at the most.
        require(10000 <= _claimDividendPercentage && _claimDividendPercentage <= 100000);
        
        claimDividendPercentage = _claimDividendPercentage;
    }
    
    /// @notice Sets the new dividend percentage for buyouts.
    /// @param _buyoutDividendPercentage The new dividend percentage for buyouts.
    function setBuyoutDividendPercentage(uint256 _buyoutDividendPercentage) external onlyCFO {
        // Buyout dividend must be 2% at the least.
        // Buyout dividend percentage may be 12.5% at the most.
        require(2000 <= _buyoutDividendPercentage && _buyoutDividendPercentage <= 12500);
        
        buyoutDividendPercentage = _buyoutDividendPercentage;
    }
    
    /// @notice Sets the new fee percentage for buyouts.
    /// @param _buyoutFeePercentage The new fee percentage for buyouts.
    function setBuyoutFeePercentage(uint256 _buyoutFeePercentage) external onlyCFO {
        // Buyout fee may be 5% at the most.
        require(0 <= _buyoutFeePercentage && _buyoutFeePercentage <= 5000);
        
        buyoutFeePercentage = _buyoutFeePercentage;
    }
    
    /// @notice The claim dividend to be paid for each adjacent plot, and
    /// as a flat dividend for each buyout.
    function claimDividend() public view returns (uint256) {
        return unclaimedPlotPrice.mul(claimDividendPercentage).div(100000);
    }
    
    /// @notice Set the free claim allowance for an address.
    /// @param addr The address to set the free claim allowance for.
    /// @param allowance The free claim allowance to set.
    function setFreeClaimAllowance(address addr, uint256 allowance) external onlyCFO {
        freeClaimAllowance[addr] = allowance;
    }
    
    /// @notice Get the free claim allowance of an address.
    /// @param addr The address to get the free claim allowance of.
    function freeClaimAllowanceOf(address addr) external view returns (uint256) {
        return freeClaimAllowance[addr];
    }
    
    /// @dev Assign balance to an account.
    /// @param addr The address to assign balance to.
    /// @param amount The amount to assign.
    function _assignBalance(address addr, uint256 amount) internal {
        addressToEtherOwed[addr] = addressToEtherOwed[addr].add(amount);
        outstandingEther = outstandingEther.add(amount);
    }
    
    /// @dev Find the _claimed_ plots surrounding a plot.
    /// @param _deedId The identifier of the plot to get the surrounding plots for.
    function _claimedSurroundingPlots(uint256 _deedId) internal view returns (uint256[] memory) {
        var (x, y) = identifierToCoordinate(_deedId);
        
        // Find all claimed surrounding plots.
        uint256 claimed = 0;
        
        // Create memory buffer capable of holding all plots.
        uint256[] memory _plots = new uint256[](8);
        
        // Loop through all neighbors.
        for (int256 dx = -1; dx <= 1; dx++) {
            for (int256 dy = -1; dy <= 1; dy++) {
                if (dx == 0 && dy == 0) {
                    // Skip the center (i.e., the plot itself).
                    continue;
                }
                
                // Get the coordinates of this neighboring identifier.
                uint256 neighborIdentifier = coordinateToIdentifier(
                    uint256(int256(x) + dx) % 65536,
                    uint256(int256(y) + dy) % 65536
                );
                
                if (identifierToOwner[neighborIdentifier] != 0x0) {
                    _plots[claimed] = neighborIdentifier;
                    claimed++;
                }
            }
        }
        
        // Memory arrays cannot be resized, so copy all
        // plots from the buffer to the plot array.
        uint256[] memory plots = new uint256[](claimed);
        
        for (uint256 i = 0; i < claimed; i++) {
            plots[i] = _plots[i];
        }
        
        return plots;
    }
    
    /// @dev Assign claim dividend to an address.
    /// @param _from The address who paid the dividend.
    /// @param _to The dividend beneficiary.
    /// @param _deedIdFrom The identifier of the deed the dividend is being paid for.
    /// @param _deedIdTo The identifier of the deed the dividend is being paid to.
    function _assignClaimDividend(address _from, address _to, uint256 _deedIdFrom, uint256 _deedIdTo) internal {
        uint256 _claimDividend = claimDividend();
        
        // Trigger event.
        ClaimDividend(_from, _to, _deedIdFrom, _deedIdTo, _claimDividend);
        
        // Assign the dividend.
        _assignBalance(_to, _claimDividend);
    }

    /// @dev Calculate and assign the dividend payable for the new plot claim.
    /// A new claim pays dividends to all existing surrounding plots.
    /// @param _deedId The identifier of the new plot to calculate and assign dividends for.
    /// Assumed to be valid.
    function _calculateAndAssignClaimDividends(uint256 _deedId)
        internal
        returns (uint256 totalClaimDividend)
    {
        // Get existing surrounding plots.
        uint256[] memory claimedSurroundingPlots = _claimedSurroundingPlots(_deedId);
        
        // Keep track of the claim dividend.
        uint256 _claimDividend = claimDividend();
        totalClaimDividend = 0;
        
        // Assign claim dividend.
        for (uint256 i = 0; i < claimedSurroundingPlots.length; i++) {
            if (identifierToOwner[claimedSurroundingPlots[i]] != msg.sender) {
                totalClaimDividend = totalClaimDividend.add(_claimDividend);
                _assignClaimDividend(msg.sender, identifierToOwner[claimedSurroundingPlots[i]], _deedId, claimedSurroundingPlots[i]);
            }
        }
    }
    
    /// @dev Calculate the next buyout price given the current total buyout cost.
    /// @param totalCost The current total buyout cost.
    function nextBuyoutPrice(uint256 totalCost) public pure returns (uint256) {
        if (totalCost < 0.05 ether) {
            return totalCost * 2;
        } else if (totalCost < 0.2 ether) {
            return totalCost * 170 / 100; // * 1.7
        } else if (totalCost < 0.5 ether) {
            return totalCost * 150 / 100; // * 1.5
        } else {
            return totalCost.mul(125).div(100); // * 1.25
        }
    }
    
    /// @notice Get the buyout cost for a given plot.
    /// @param _deedId The identifier of the plot to get the buyout cost for.
    function buyoutCost(uint256 _deedId) external view returns (uint256) {
        // The current buyout price.
        uint256 price = identifierToBuyoutPrice[_deedId];
    
        // Get existing surrounding plots.
        uint256[] memory claimedSurroundingPlots = _claimedSurroundingPlots(_deedId);
    
        // The total cost is the price plus flat rate dividends based on claim dividends.
        uint256 flatDividends = claimDividend().mul(claimedSurroundingPlots.length);
        return price.add(flatDividends);
    }
    
    /// @dev Assign the proceeds of the buyout.
    /// @param _deedId The identifier of the plot that is being bought out.
    function _assignBuyoutProceeds(
        address currentOwner,
        uint256 _deedId,
        uint256[] memory claimedSurroundingPlots,
        uint256 currentOwnerWinnings,
        uint256 totalDividendPerBeneficiary,
        uint256 totalCost
    )
        internal
    {
        // Calculate and assign the current owner's winnings.
        
        Buyout(msg.sender, currentOwner, _deedId, currentOwnerWinnings, totalCost, nextBuyoutPrice(totalCost));
        _assignBalance(currentOwner, currentOwnerWinnings);
        
        // Assign dividends to owners of surrounding plots.
        for (uint256 i = 0; i < claimedSurroundingPlots.length; i++) {
            address beneficiary = identifierToOwner[claimedSurroundingPlots[i]];
            BuyoutDividend(msg.sender, beneficiary, _deedId, claimedSurroundingPlots[i], totalDividendPerBeneficiary);
            _assignBalance(beneficiary, totalDividendPerBeneficiary);
        }
    }
    
    /// @dev Calculate and assign the proceeds from the buyout.
    /// @param currentOwner The current owner of the plot that is being bought out.
    /// @param _deedId The identifier of the plot that is being bought out.
    /// @param claimedSurroundingPlots The surrounding plots that have been claimed.
    function _calculateAndAssignBuyoutProceeds(address currentOwner, uint256 _deedId, uint256[] memory claimedSurroundingPlots)
        internal 
        returns (uint256 totalCost)
    {
        // The current price.
        uint256 price = identifierToBuyoutPrice[_deedId];
    
        // The total cost is the price plus flat rate dividends based on claim dividends.
        uint256 flatDividends = claimDividend().mul(claimedSurroundingPlots.length);
        totalCost = price.add(flatDividends);
        
        // Calculate the variable dividends based on the buyout price
        // (only to be paid if there are surrounding plots).
        uint256 variableDividends = price.mul(buyoutDividendPercentage).div(100000);
        
        // Calculate fees.
        uint256 fee = price.mul(buyoutFeePercentage).div(100000);
        
        // Calculate and assign buyout proceeds.
        uint256 currentOwnerWinnings = price.sub(fee);
        
        uint256 totalDividendPerBeneficiary;
        if (claimedSurroundingPlots.length > 0) {
            // If there are surrounding plots, variable dividend is to be paid
            // based on the buyout price..
            currentOwnerWinnings = currentOwnerWinnings.sub(variableDividends);
            
            // Calculate the dividend per surrounding plot.
            totalDividendPerBeneficiary = flatDividends.add(variableDividends) / claimedSurroundingPlots.length;
        }
        
        _assignBuyoutProceeds(
            currentOwner,
            _deedId,
            claimedSurroundingPlots,
            currentOwnerWinnings,
            totalDividendPerBeneficiary,
            totalCost
        );
    }
    
    /// @notice Buy the current owner out of the plot.
    function buyout(uint256 _deedId) external payable whenNotPaused {
        buyoutWithData(_deedId, "", "", "", "");
    }
    
    /// @notice Buy the current owner out of the plot.
    function buyoutWithData(uint256 _deedId, string name, string description, string imageUrl, string infoUrl)
        public
        payable
        whenNotPaused 
    {
        // Buyouts must be enabled.
        require(buyoutsEnabledFromTimestamp <= block.timestamp);
    
        address currentOwner = identifierToOwner[_deedId];
    
        // The plot must be owned before it can be bought out.
        require(currentOwner != 0x0);
        
        // Get existing surrounding plots.
        uint256[] memory claimedSurroundingPlots = _claimedSurroundingPlots(_deedId);
        
        // Assign the buyout proceeds and retrieve the total cost.
        uint256 totalCost = _calculateAndAssignBuyoutProceeds(currentOwner, _deedId, claimedSurroundingPlots);
        
        // Ensure the message has enough value.
        require(msg.value >= totalCost);
        
        // Transfer the plot.
        _transfer(currentOwner, msg.sender, _deedId);
        
        // Set the plot data
        SetData(_deedId, name, description, imageUrl, infoUrl);
        
        // Calculate and set the new plot price.
        identifierToBuyoutPrice[_deedId] = nextBuyoutPrice(totalCost);
        
        // Indicate the plot has been bought out at least once
        if (!identifierToBoughtOutOnce[_deedId]) {
            identifierToBoughtOutOnce[_deedId] = true;
        }
        
        // Calculate the excess Ether sent.
        // msg.value is greater than or equal to totalCost,
        // so this cannot underflow.
        uint256 excess = msg.value - totalCost;
        
        if (excess > 0) {
            // Refund any excess Ether (not susceptible to re-entry attack, as
            // the owner is assigned before the transfer takes place).
            msg.sender.transfer(excess);
        }
    }
    
    /// @notice Calculate the maximum initial buyout price for a plot.
    /// @param _deedId The identifier of the plot to get the maximum initial buyout price for.
    function maximumInitialBuyoutPrice(uint256 _deedId) public view returns (uint256) {
        // The initial buyout price can be set to 4x the initial plot price
        // (or 100x for the original pre-migration plots).
        uint256 mul = 4;
        
        if (identifierIsOriginal[_deedId]) {
            mul = 100;
        }
        
        return initialPricePaid[_deedId].mul(mul);
    }
    
    /// @notice Test whether a buyout price is valid.
    /// @param _deedId The identifier of the plot to test the buyout price for.
    /// @param price The buyout price to test.
    function validInitialBuyoutPrice(uint256 _deedId, uint256 price) public view returns (bool) {        
        return (price >= unclaimedPlotPrice && price <= maximumInitialBuyoutPrice(_deedId));
    }
    
    /// @notice Manually set the initial buyout price of a plot.
    /// @param _deedId The identifier of the plot to set the buyout price for.
    /// @param price The value to set the buyout price to.
    function setInitialBuyoutPrice(uint256 _deedId, uint256 price) public whenNotPaused {
        // One can only set the buyout price of their own plots.
        require(_owns(msg.sender, _deedId));
        
        // The initial buyout price can only be set if the plot has never been bought out before.
        require(!identifierToBoughtOutOnce[_deedId]);
        
        // The buyout price must be valid.
        require(validInitialBuyoutPrice(_deedId, price));
        
        // Set the buyout price.
        identifierToBuyoutPrice[_deedId] = price;
        
        // Trigger the buyout price event.
        SetBuyoutPrice(_deedId, price);
    }
}


/// @dev Holds functionality for minting new plot deeds.
contract DWorldMinting is DWorldFinance {       
    /// @notice Buy an unclaimed plot.
    /// @param _deedId The unclaimed plot to buy.
    /// @param _buyoutPrice The initial buyout price to set on the plot.
    function claimPlot(uint256 _deedId, uint256 _buyoutPrice) external payable whenNotPaused {
        claimPlotWithData(_deedId, _buyoutPrice, "", "", "", "");
    }
       
    /// @notice Buy an unclaimed plot.
    /// @param _deedId The unclaimed plot to buy.
    /// @param _buyoutPrice The initial buyout price to set on the plot.
    /// @param name The name to give the plot.
    /// @param description The description to add to the plot.
    /// @param imageUrl The image url for the plot.
    /// @param infoUrl The info url for the plot.
    function claimPlotWithData(uint256 _deedId, uint256 _buyoutPrice, string name, string description, string imageUrl, string infoUrl) public payable whenNotPaused {
        uint256[] memory _deedIds = new uint256[](1);
        _deedIds[0] = _deedId;
        
        claimPlotMultipleWithData(_deedIds, _buyoutPrice, name, description, imageUrl, infoUrl);
    }
    
    /// @notice Buy unclaimed plots.
    /// @param _deedIds The unclaimed plots to buy.
    /// @param _buyoutPrice The initial buyout price to set on the plot.
    function claimPlotMultiple(uint256[] _deedIds, uint256 _buyoutPrice) external payable whenNotPaused {
        claimPlotMultipleWithData(_deedIds, _buyoutPrice, "", "", "", "");
    }
    
    /// @notice Buy unclaimed plots.
    /// @param _deedIds The unclaimed plots to buy.
    /// @param _buyoutPrice The initial buyout price to set on the plot.
    /// @param name The name to give the plots.
    /// @param description The description to add to the plots.
    /// @param imageUrl The image url for the plots.
    /// @param infoUrl The info url for the plots.
    function claimPlotMultipleWithData(uint256[] _deedIds, uint256 _buyoutPrice, string name, string description, string imageUrl, string infoUrl) public payable whenNotPaused {
        uint256 buyAmount = _deedIds.length;
        uint256 etherRequired;
        if (freeClaimAllowance[msg.sender] > 0) {
            // The sender has a free claim allowance.
            if (freeClaimAllowance[msg.sender] > buyAmount) {
                // Subtract from allowance.
                freeClaimAllowance[msg.sender] -= buyAmount;
                
                // No ether is required.
                etherRequired = 0;
            } else {
                uint256 freeAmount = freeClaimAllowance[msg.sender];
                
                // The full allowance has been used.
                delete freeClaimAllowance[msg.sender];
                
                // The subtraction cannot underflow, as freeAmount <= buyAmount.
                etherRequired = unclaimedPlotPrice.mul(buyAmount - freeAmount);
            }
        } else {
            // The sender does not have a free claim allowance.
            etherRequired = unclaimedPlotPrice.mul(buyAmount);
        }
        
        uint256 offset = plots.length;
        
        // Allocate additional memory for the plots array
        // (this is more efficient than .push-ing each individual
        // plot, as that requires multiple dynamic allocations).
        plots.length = plots.length.add(_deedIds.length);
        
        for (uint256 i = 0; i < _deedIds.length; i++) { 
            uint256 _deedId = _deedIds[i];
            require(validIdentifier(_deedId));
            
            // The plot must be unowned (a plot deed cannot be transferred to
            // 0x0, so once a plot is claimed it will always be owned by a
            // non-zero address).
            require(identifierToOwner[_deedId] == address(0));
            
            // Create the plot
            plots[offset + i] = uint32(_deedId);
            
            // Transfer the new plot to the sender.
            _transfer(address(0), msg.sender, _deedId);
            
            // Set the plot data.
            _setPlotData(_deedId, name, description, imageUrl, infoUrl);
            
            // Calculate and assign claim dividends.
            uint256 claimDividends = _calculateAndAssignClaimDividends(_deedId);
            etherRequired = etherRequired.add(claimDividends);
            
            // Set the initial price paid for the plot.
            initialPricePaid[_deedId] = unclaimedPlotPrice.add(claimDividends);
            
            // Set the initial buyout price. Throws if it does not succeed.
            setInitialBuyoutPrice(_deedId, _buyoutPrice);
        }
        
        // Ensure enough ether is supplied.
        require(msg.value >= etherRequired);
        
        // Calculate the excess ether sent
        // msg.value is greater than or equal to etherRequired,
        // so this cannot underflow.
        uint256 excess = msg.value - etherRequired;
        
        if (excess > 0) {
            // Refund any excess ether (not susceptible to re-entry attack, as
            // the owner is assigned before the transfer takes place).
            msg.sender.transfer(excess);
        }
    }
}


/// @title The internal clock auction functionality.
/// Inspired by CryptoKitties' clock auction
contract ClockAuctionBase {

    // Address of the ERC721 contract this auction is linked to.
    ERC721 public deedContract;

    // Fee per successful auction in 1/1000th of a percentage.
    uint256 public fee;
    
    // Total amount of ether yet to be paid to auction beneficiaries.
    uint256 public outstandingEther = 0 ether;
    
    // Amount of ether yet to be paid per beneficiary.
    mapping (address => uint256) public addressToEtherOwed;
    
    /// @dev Represents a deed auction.
    /// Care has been taken to ensure the auction fits in
    /// two 256-bit words.
    struct Auction {
        address seller;
        uint128 startPrice;
        uint128 endPrice;
        uint64 duration;
        uint64 startedAt;
    }

    mapping (uint256 => Auction) identifierToAuction;
    
    // Events
    event AuctionCreated(address indexed seller, uint256 indexed deedId, uint256 startPrice, uint256 endPrice, uint256 duration);
    event AuctionSuccessful(address indexed buyer, uint256 indexed deedId, uint256 totalPrice);
    event AuctionCancelled(uint256 indexed deedId);
    
    /// @dev Modifier to check whether the value can be stored in a 64 bit uint.
    modifier fitsIn64Bits(uint256 _value) {
        require (_value == uint256(uint64(_value)));
        _;
    }
    
    /// @dev Modifier to check whether the value can be stored in a 128 bit uint.
    modifier fitsIn128Bits(uint256 _value) {
        require (_value == uint256(uint128(_value)));
        _;
    }
    
    function ClockAuctionBase(address _deedContractAddress, uint256 _fee) public {
        deedContract = ERC721(_deedContractAddress);
        
        // Contract must indicate support for ERC721 through its interface signature.
        require(deedContract.supportsInterface(0xda671b9b));
        
        // Fee must be between 0 and 100%.
        require(0 <= _fee && _fee <= 100000);
        fee = _fee;
    }
    
    /// @dev Checks whether the given auction is active.
    /// @param auction The auction to check for activity.
    function _activeAuction(Auction storage auction) internal view returns (bool) {
        return auction.startedAt > 0;
    }
    
    /// @dev Put the deed into escrow, thereby taking ownership of it.
    /// @param _deedId The identifier of the deed to place into escrow.
    function _escrow(uint256 _deedId) internal {
        // Throws if the transfer fails
        deedContract.takeOwnership(_deedId);
    }
    
    /// @dev Create the auction.
    /// @param _deedId The identifier of the deed to create the auction for.
    /// @param auction The auction to create.
    function _createAuction(uint256 _deedId, Auction auction) internal {
        // Add the auction to the auction mapping.
        identifierToAuction[_deedId] = auction;
        
        // Trigger auction created event.
        AuctionCreated(auction.seller, _deedId, auction.startPrice, auction.endPrice, auction.duration);
    }
    
    /// @dev Bid on an auction.
    /// @param _buyer The address of the buyer.
    /// @param _value The value sent by the sender (in ether).
    /// @param _deedId The identifier of the deed to bid on.
    function _bid(address _buyer, uint256 _value, uint256 _deedId) internal {
        Auction storage auction = identifierToAuction[_deedId];
        
        // The auction must be active.
        require(_activeAuction(auction));
        
        // Calculate the auction's current price.
        uint256 price = _currentPrice(auction);
        
        // Make sure enough funds were sent.
        require(_value >= price);
        
        address seller = auction.seller;
    
        if (price > 0) {
            uint256 totalFee = _calculateFee(price);
            uint256 proceeds = price - totalFee;
            
            // Assign the proceeds to the seller.
            // We do not send the proceeds directly, as to prevent
            // malicious sellers from denying auctions (and burning
            // the buyer's gas).
            _assignProceeds(seller, proceeds);
        }
        
        AuctionSuccessful(_buyer, _deedId, price);
        
        // The bid was won!
        _winBid(seller, _buyer, _deedId, price);
        
        // Remove the auction (we do this at the end, as
        // winBid might require some additional information
        // that will be removed when _removeAuction is
        // called. As we do not transfer funds here, we do
        // not have to worry about re-entry attacks.
        _removeAuction(_deedId);
    }

    /// @dev Perform the bid win logic (in this case: transfer the deed).
    /// @param _seller The address of the seller.
    /// @param _winner The address of the winner.
    /// @param _deedId The identifier of the deed.
    /// @param _price The price the auction was bought at.
    function _winBid(address _seller, address _winner, uint256 _deedId, uint256 _price) internal {
        _transfer(_winner, _deedId);
    }
    
    /// @dev Cancel an auction.
    /// @param _deedId The identifier of the deed for which the auction should be cancelled.
    /// @param auction The auction to cancel.
    function _cancelAuction(uint256 _deedId, Auction auction) internal {
        // Remove the auction
        _removeAuction(_deedId);
        
        // Transfer the deed back to the seller
        _transfer(auction.seller, _deedId);
        
        // Trigger auction cancelled event.
        AuctionCancelled(_deedId);
    }
    
    /// @dev Remove an auction.
    /// @param _deedId The identifier of the deed for which the auction should be removed.
    function _removeAuction(uint256 _deedId) internal {
        delete identifierToAuction[_deedId];
    }
    
    /// @dev Transfer a deed owned by this contract to another address.
    /// @param _to The address to transfer the deed to.
    /// @param _deedId The identifier of the deed.
    function _transfer(address _to, uint256 _deedId) internal {
        // Throws if the transfer fails
        deedContract.transfer(_to, _deedId);
    }
    
    /// @dev Assign proceeds to an address.
    /// @param _to The address to assign proceeds to.
    /// @param _value The proceeds to assign.
    function _assignProceeds(address _to, uint256 _value) internal {
        outstandingEther += _value;
        addressToEtherOwed[_to] += _value;
    }
    
    /// @dev Calculate the current price of an auction.
    function _currentPrice(Auction storage _auction) internal view returns (uint256) {
        require(now >= _auction.startedAt);
        
        uint256 secondsPassed = now - _auction.startedAt;
        
        if (secondsPassed >= _auction.duration) {
            return _auction.endPrice;
        } else {
            // Negative if the end price is higher than the start price!
            int256 totalPriceChange = int256(_auction.endPrice) - int256(_auction.startPrice);
            
            // Calculate the current price based on the total change over the entire
            // auction duration, and the amount of time passed since the start of the
            // auction.
            int256 currentPriceChange = totalPriceChange * int256(secondsPassed) / int256(_auction.duration);
            
            // Calculate the final price. Note this once again
            // is representable by a uint256, as the price can
            // never be negative.
            int256 price = int256(_auction.startPrice) + currentPriceChange;
            
            // This never throws.
            assert(price >= 0);
            
            return uint256(price);
        }
    }
    
    /// @dev Calculate the fee for a given price.
    /// @param _price The price to calculate the fee for.
    function _calculateFee(uint256 _price) internal view returns (uint256) {
        // _price is guaranteed to fit in a uint128 due to the createAuction entry
        // modifiers, so this cannot overflow.
        return _price * fee / 100000;
    }
}


contract ClockAuction is ClockAuctionBase, Pausable {
    function ClockAuction(address _deedContractAddress, uint256 _fee) 
        ClockAuctionBase(_deedContractAddress, _fee)
        public
    {}
    
    /// @notice Update the auction fee.
    /// @param _fee The new fee.
    function setFee(uint256 _fee) external onlyOwner {
        require(0 <= _fee && _fee <= 100000);
    
        fee = _fee;
    }
    
    /// @notice Get the auction for the given deed.
    /// @param _deedId The identifier of the deed to get the auction for.
    /// @dev Throws if there is no auction for the given deed.
    function getAuction(uint256 _deedId) external view returns (
            address seller,
            uint256 startPrice,
            uint256 endPrice,
            uint256 duration,
            uint256 startedAt
        )
    {
        Auction storage auction = identifierToAuction[_deedId];
        
        // The auction must be active
        require(_activeAuction(auction));
        
        return (
            auction.seller,
            auction.startPrice,
            auction.endPrice,
            auction.duration,
            auction.startedAt
        );
    }

    /// @notice Create an auction for a given deed.
    /// Must previously have been given approval to take ownership of the deed.
    /// @param _deedId The identifier of the deed to create an auction for.
    /// @param _startPrice The starting price of the auction.
    /// @param _endPrice The ending price of the auction.
    /// @param _duration The duration in seconds of the dynamic pricing part of the auction.
    function createAuction(uint256 _deedId, uint256 _startPrice, uint256 _endPrice, uint256 _duration)
        public
        fitsIn128Bits(_startPrice)
        fitsIn128Bits(_endPrice)
        fitsIn64Bits(_duration)
        whenNotPaused
    {
        // Get the owner of the deed to be auctioned
        address deedOwner = deedContract.ownerOf(_deedId);
    
        // Caller must either be the deed contract or the owner of the deed
        // to prevent abuse.
        require(
            msg.sender == address(deedContract) ||
            msg.sender == deedOwner
        );
    
        // The duration of the auction must be at least 60 seconds.
        require(_duration >= 60);
    
        // Throws if placing the deed in escrow fails (the contract requires
        // transfer approval prior to creating the auction).
        _escrow(_deedId);
        
        // Auction struct
        Auction memory auction = Auction(
            deedOwner,
            uint128(_startPrice),
            uint128(_endPrice),
            uint64(_duration),
            uint64(now)
        );
        
        _createAuction(_deedId, auction);
    }
    
    /// @notice Cancel an auction
    /// @param _deedId The identifier of the deed to cancel the auction for.
    function cancelAuction(uint256 _deedId) external whenNotPaused {
        Auction storage auction = identifierToAuction[_deedId];
        
        // The auction must be active.
        require(_activeAuction(auction));
        
        // The auction can only be cancelled by the seller
        require(msg.sender == auction.seller);
        
        _cancelAuction(_deedId, auction);
    }
    
    /// @notice Bid on an auction.
    /// @param _deedId The identifier of the deed to bid on.
    function bid(uint256 _deedId) external payable whenNotPaused {
        // Throws if the bid does not succeed.
        _bid(msg.sender, msg.value, _deedId);
    }
    
    /// @dev Returns the current price of an auction.
    /// @param _deedId The identifier of the deed to get the currency price for.
    function getCurrentPrice(uint256 _deedId) external view returns (uint256) {
        Auction storage auction = identifierToAuction[_deedId];
        
        // The auction must be active.
        require(_activeAuction(auction));
        
        return _currentPrice(auction);
    }
    
    /// @notice Withdraw ether owed to a beneficiary.
    /// @param beneficiary The address to withdraw the auction balance for.
    function withdrawAuctionBalance(address beneficiary) external {
        // The sender must either be the beneficiary or the core deed contract.
        require(
            msg.sender == beneficiary ||
            msg.sender == address(deedContract)
        );
        
        uint256 etherOwed = addressToEtherOwed[beneficiary];
        
        // Ensure ether is owed to the beneficiary.
        require(etherOwed > 0);
         
        // Set ether owed to 0   
        delete addressToEtherOwed[beneficiary];
        
        // Subtract from total outstanding balance. etherOwed is guaranteed
        // to be less than or equal to outstandingEther, so this cannot
        // underflow.
        outstandingEther -= etherOwed;
        
        // Transfer ether owed to the beneficiary (not susceptible to re-entry
        // attack, as the ether owed is set to 0 before the transfer takes place).
        beneficiary.transfer(etherOwed);
    }
    
    /// @notice Withdraw (unowed) contract balance.
    function withdrawFreeBalance() external {
        // Calculate the free (unowed) balance. This never underflows, as
        // outstandingEther is guaranteed to be less than or equal to the
        // contract balance.
        uint256 freeBalance = this.balance - outstandingEther;
        
        address deedContractAddress = address(deedContract);

        require(
            msg.sender == owner ||
            msg.sender == deedContractAddress
        );
        
        deedContractAddress.transfer(freeBalance);
    }
}


/// @dev Defines base data structures for DWorld.
contract OriginalDWorldBase is DWorldAccessControl {
    using SafeMath for uint256;
    
    /// @dev All minted plots (array of plot identifiers). There are
    /// 2^16 * 2^16 possible plots (covering the entire world), thus
    /// 32 bits are required. This fits in a uint32. Storing
    /// the identifiers as uint32 instead of uint256 makes storage
    /// cheaper. (The impact of this in mappings is less noticeable,
    /// and using uint32 in the mappings below actually *increases*
    /// gas cost for minting).
    uint32[] public plots;
    
    mapping (uint256 => address) identifierToOwner;
    mapping (uint256 => address) identifierToApproved;
    mapping (address => uint256) ownershipDeedCount;
    
    /// @dev Event fired when a plot's data are changed. The plot
    /// data are not stored in the contract directly, instead the
    /// data are logged to the block. This gives significant
    /// reductions in gas requirements (~75k for minting with data
    /// instead of ~180k). However, it also means plot data are
    /// not available from *within* other contracts.
    event SetData(uint256 indexed deedId, string name, string description, string imageUrl, string infoUrl);
    
    /// @notice Get all minted plots.
    function getAllPlots() external view returns(uint32[]) {
        return plots;
    }
    
    /// @dev Represent a 2D coordinate as a single uint.
    /// @param x The x-coordinate.
    /// @param y The y-coordinate.
    function coordinateToIdentifier(uint256 x, uint256 y) public pure returns(uint256) {
        require(validCoordinate(x, y));
        
        return (y << 16) + x;
    }
    
    /// @dev Turn a single uint representation of a coordinate into its x and y parts.
    /// @param identifier The uint representation of a coordinate.
    function identifierToCoordinate(uint256 identifier) public pure returns(uint256 x, uint256 y) {
        require(validIdentifier(identifier));
    
        y = identifier >> 16;
        x = identifier - (y << 16);
    }
    
    /// @dev Test whether the coordinate is valid.
    /// @param x The x-part of the coordinate to test.
    /// @param y The y-part of the coordinate to test.
    function validCoordinate(uint256 x, uint256 y) public pure returns(bool) {
        return x < 65536 && y < 65536; // 2^16
    }
    
    /// @dev Test whether an identifier is valid.
    /// @param identifier The identifier to test.
    function validIdentifier(uint256 identifier) public pure returns(bool) {
        return identifier < 4294967296; // 2^16 * 2^16
    }
    
    /// @dev Set a plot's data.
    /// @param identifier The identifier of the plot to set data for.
    function _setPlotData(uint256 identifier, string name, string description, string imageUrl, string infoUrl) internal {
        SetData(identifier, name, description, imageUrl, infoUrl);
    }
}


/// @dev Holds deed functionality such as approving and transferring. Implements ERC721.
contract OriginalDWorldDeed is OriginalDWorldBase, ERC721, ERC721Metadata {
    
    /// @notice Name of the collection of deeds (non-fungible token), as defined in ERC721Metadata.
    function name() public pure returns (string _deedName) {
        _deedName = "DWorld Plots";
    }
    
    /// @notice Symbol of the collection of deeds (non-fungible token), as defined in ERC721Metadata.
    function symbol() public pure returns (string _deedSymbol) {
        _deedSymbol = "DWP";
    }
    
    /// @dev ERC-165 (draft) interface signature for itself
    bytes4 internal constant INTERFACE_SIGNATURE_ERC165 = // 0x01ffc9a7
        bytes4(keccak256('supportsInterface(bytes4)'));

    /// @dev ERC-165 (draft) interface signature for ERC721
    bytes4 internal constant INTERFACE_SIGNATURE_ERC721 = // 0xda671b9b
        bytes4(keccak256('ownerOf(uint256)')) ^
        bytes4(keccak256('countOfDeeds()')) ^
        bytes4(keccak256('countOfDeedsByOwner(address)')) ^
        bytes4(keccak256('deedOfOwnerByIndex(address,uint256)')) ^
        bytes4(keccak256('approve(address,uint256)')) ^
        bytes4(keccak256('takeOwnership(uint256)'));
        
    /// @dev ERC-165 (draft) interface signature for ERC721
    bytes4 internal constant INTERFACE_SIGNATURE_ERC721Metadata = // 0x2a786f11
        bytes4(keccak256('name()')) ^
        bytes4(keccak256('symbol()')) ^
        bytes4(keccak256('deedUri(uint256)'));
    
    /// @notice Introspection interface as per ERC-165 (https://github.com/ethereum/EIPs/issues/165).
    /// Returns true for any standardized interfaces implemented by this contract.
    /// (ERC-165 and ERC-721.)
    function supportsInterface(bytes4 _interfaceID) external pure returns (bool) {
        return (
            (_interfaceID == INTERFACE_SIGNATURE_ERC165)
            || (_interfaceID == INTERFACE_SIGNATURE_ERC721)
            || (_interfaceID == INTERFACE_SIGNATURE_ERC721Metadata)
        );
    }
    
    /// @dev Checks if a given address owns a particular plot.
    /// @param _owner The address of the owner to check for.
    /// @param _deedId The plot identifier to check for.
    function _owns(address _owner, uint256 _deedId) internal view returns (bool) {
        return identifierToOwner[_deedId] == _owner;
    }
    
    /// @dev Approve a given address to take ownership of a deed.
    /// @param _from The address approving taking ownership.
    /// @param _to The address to approve taking ownership.
    /// @param _deedId The identifier of the deed to give approval for.
    function _approve(address _from, address _to, uint256 _deedId) internal {
        identifierToApproved[_deedId] = _to;
        
        // Emit event.
        Approval(_from, _to, _deedId);
    }
    
    /// @dev Checks if a given address has approval to take ownership of a deed.
    /// @param _claimant The address of the claimant to check for.
    /// @param _deedId The identifier of the deed to check for.
    function _approvedFor(address _claimant, uint256 _deedId) internal view returns (bool) {
        return identifierToApproved[_deedId] == _claimant;
    }
    
    /// @dev Assigns ownership of a specific deed to an address.
    /// @param _from The address to transfer the deed from.
    /// @param _to The address to transfer the deed to.
    /// @param _deedId The identifier of the deed to transfer.
    function _transfer(address _from, address _to, uint256 _deedId) internal {
        // The number of plots is capped at 2^16 * 2^16, so this cannot
        // be overflowed.
        ownershipDeedCount[_to]++;
        
        // Transfer ownership.
        identifierToOwner[_deedId] = _to;
        
        // When a new deed is minted, the _from address is 0x0, but we
        // do not track deed ownership of 0x0.
        if (_from != address(0)) {
            ownershipDeedCount[_from]--;
            
            // Clear taking ownership approval.
            delete identifierToApproved[_deedId];
        }
        
        // Emit the transfer event.
        Transfer(_from, _to, _deedId);
    }
    
    // ERC 721 implementation
    
    /// @notice Returns the total number of deeds currently in existence.
    /// @dev Required for ERC-721 compliance.
    function countOfDeeds() public view returns (uint256) {
        return plots.length;
    }
    
    /// @notice Returns the number of deeds owned by a specific address.
    /// @param _owner The owner address to check.
    /// @dev Required for ERC-721 compliance
    function countOfDeedsByOwner(address _owner) public view returns (uint256) {
        return ownershipDeedCount[_owner];
    }
    
    /// @notice Returns the address currently assigned ownership of a given deed.
    /// @dev Required for ERC-721 compliance.
    function ownerOf(uint256 _deedId) external view returns (address _owner) {
        _owner = identifierToOwner[_deedId];

        require(_owner != address(0));
    }
    
    /// @notice Approve a given address to take ownership of a deed.
    /// @param _to The address to approve taking owernship.
    /// @param _deedId The identifier of the deed to give approval for.
    /// @dev Required for ERC-721 compliance.
    function approve(address _to, uint256 _deedId) external whenNotPaused {
        uint256[] memory _deedIds = new uint256[](1);
        _deedIds[0] = _deedId;
        
        approveMultiple(_to, _deedIds);
    }
    
    /// @notice Approve a given address to take ownership of multiple deeds.
    /// @param _to The address to approve taking ownership.
    /// @param _deedIds The identifiers of the deeds to give approval for.
    function approveMultiple(address _to, uint256[] _deedIds) public whenNotPaused {
        // Ensure the sender is not approving themselves.
        require(msg.sender != _to);
    
        for (uint256 i = 0; i < _deedIds.length; i++) {
            uint256 _deedId = _deedIds[i];
            
            // Require the sender is the owner of the deed.
            require(_owns(msg.sender, _deedId));
            
            // Perform the approval.
            _approve(msg.sender, _to, _deedId);
        }
    }
    
    /// @notice Transfer a deed to another address. If transferring to a smart
    /// contract be VERY CAREFUL to ensure that it is aware of ERC-721, or your
    /// deed may be lost forever.
    /// @param _to The address of the recipient, can be a user or contract.
    /// @param _deedId The identifier of the deed to transfer.
    /// @dev Required for ERC-721 compliance.
    function transfer(address _to, uint256 _deedId) external whenNotPaused {
        uint256[] memory _deedIds = new uint256[](1);
        _deedIds[0] = _deedId;
        
        transferMultiple(_to, _deedIds);
    }
    
    /// @notice Transfers multiple deeds to another address. If transferring to
    /// a smart contract be VERY CAREFUL to ensure that it is aware of ERC-721,
    /// or your deeds may be lost forever.
    /// @param _to The address of the recipient, can be a user or contract.
    /// @param _deedIds The identifiers of the deeds to transfer.
    function transferMultiple(address _to, uint256[] _deedIds) public whenNotPaused {
        // Safety check to prevent against an unexpected 0x0 default.
        require(_to != address(0));
        
        // Disallow transfers to this contract to prevent accidental misuse.
        require(_to != address(this));
    
        for (uint256 i = 0; i < _deedIds.length; i++) {
            uint256 _deedId = _deedIds[i];
            
            // One can only transfer their own plots.
            require(_owns(msg.sender, _deedId));

            // Transfer ownership
            _transfer(msg.sender, _to, _deedId);
        }
    }
    
    /// @notice Transfer a deed owned by another address, for which the calling
    /// address has previously been granted transfer approval by the owner.
    /// @param _deedId The identifier of the deed to be transferred.
    /// @dev Required for ERC-721 compliance.
    function takeOwnership(uint256 _deedId) external whenNotPaused {
        uint256[] memory _deedIds = new uint256[](1);
        _deedIds[0] = _deedId;
        
        takeOwnershipMultiple(_deedIds);
    }
    
    /// @notice Transfer multiple deeds owned by another address, for which the
    /// calling address has previously been granted transfer approval by the owner.
    /// @param _deedIds The identifier of the deed to be transferred.
    function takeOwnershipMultiple(uint256[] _deedIds) public whenNotPaused {
        for (uint256 i = 0; i < _deedIds.length; i++) {
            uint256 _deedId = _deedIds[i];
            address _from = identifierToOwner[_deedId];
            
            // Check for transfer approval
            require(_approvedFor(msg.sender, _deedId));

            // Reassign ownership (also clears pending approvals and emits Transfer event).
            _transfer(_from, msg.sender, _deedId);
        }
    }
    
    /// @notice Returns a list of all deed identifiers assigned to an address.
    /// @param _owner The owner whose deeds we are interested in.
    /// @dev This method MUST NEVER be called by smart contract code. It's very
    /// expensive and is not supported in contract-to-contract calls as it returns
    /// a dynamic array (only supported for web3 calls).
    function deedsOfOwner(address _owner) external view returns(uint256[]) {
        uint256 deedCount = countOfDeedsByOwner(_owner);

        if (deedCount == 0) {
            // Return an empty array.
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](deedCount);
            uint256 totalDeeds = countOfDeeds();
            uint256 resultIndex = 0;
            
            for (uint256 deedNumber = 0; deedNumber < totalDeeds; deedNumber++) {
                uint256 identifier = plots[deedNumber];
                if (identifierToOwner[identifier] == _owner) {
                    result[resultIndex] = identifier;
                    resultIndex++;
                }
            }

            return result;
        }
    }
    
    /// @notice Returns a deed identifier of the owner at the given index.
    /// @param _owner The address of the owner we want to get a deed for.
    /// @param _index The index of the deed we want.
    function deedOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256) {
        // The index should be valid.
        require(_index < countOfDeedsByOwner(_owner));

        // Loop through all plots, accounting the number of plots of the owner we've seen.
        uint256 seen = 0;
        uint256 totalDeeds = countOfDeeds();
        
        for (uint256 deedNumber = 0; deedNumber < totalDeeds; deedNumber++) {
            uint256 identifier = plots[deedNumber];
            if (identifierToOwner[identifier] == _owner) {
                if (seen == _index) {
                    return identifier;
                }
                
                seen++;
            }
        }
    }
    
    /// @notice Returns an (off-chain) metadata url for the given deed.
    /// @param _deedId The identifier of the deed to get the metadata
    /// url for.
    /// @dev Implementation of optional ERC-721 functionality.
    function deedUri(uint256 _deedId) external pure returns (string uri) {
        require(validIdentifier(_deedId));
    
        var (x, y) = identifierToCoordinate(_deedId);
    
        // Maximum coordinate length in decimals is 5 (65535)
        uri = "https://dworld.io/plot/xxxxx/xxxxx";
        bytes memory _uri = bytes(uri);
        
        for (uint256 i = 0; i < 5; i++) {
            _uri[27 - i] = byte(48 + (x / 10 ** i) % 10);
            _uri[33 - i] = byte(48 + (y / 10 ** i) % 10);
        }
    }
}


/// @dev Migrate original data from the old contract.
contract DWorldUpgrade is DWorldMinting {
    OriginalDWorldDeed originalContract;
    ClockAuction originalSaleAuction;
    ClockAuction originalRentAuction;
    
    /// @notice Keep track of whether we have finished migrating.
    bool public migrationFinished = false;
    
    /// @dev Keep track of how many plots have been transferred so far.
    uint256 migrationNumPlotsTransferred = 0;
    
    function DWorldUpgrade(
        address originalContractAddress,
        address originalSaleAuctionAddress,
        address originalRentAuctionAddress
    )
        public
    {
        if (originalContractAddress != 0) {
            _startMigration(originalContractAddress, originalSaleAuctionAddress, originalRentAuctionAddress);
        } else {
            migrationFinished = true;
        }
    }
    
    /// @dev Migrate data from the original contract. Assumes the original
    /// contract is paused, and remains paused for the duration of the
    /// migration.
    /// @param originalContractAddress The address of the original contract.
    function _startMigration(
        address originalContractAddress,
        address originalSaleAuctionAddress,
        address originalRentAuctionAddress
    )
        internal
    {
        // Set contracts.
        originalContract = OriginalDWorldDeed(originalContractAddress);
        originalSaleAuction = ClockAuction(originalSaleAuctionAddress);
        originalRentAuction = ClockAuction(originalRentAuctionAddress);
        
        // Start paused.
        paused = true;
        
        // Get count of original plots.
        uint256 numPlots = originalContract.countOfDeeds();
        
        // Allocate storage for the plots array (this is more
        // efficient than .push-ing each individual plot, as
        // that requires multiple dynamic allocations).
        plots.length = numPlots;
    }
    
    function migrationStep(uint256 numPlotsTransfer) external onlyOwner whenPaused {
        // Migration must not be finished yet.
        require(!migrationFinished);
    
        // Get count of original plots.
        uint256 numPlots = originalContract.countOfDeeds();
    
        // Loop through plots and assign to original owner.
        uint256 i;
        for (i = migrationNumPlotsTransferred; i < numPlots && i < migrationNumPlotsTransferred + numPlotsTransfer; i++) {
            uint32 _deedId = originalContract.plots(i);
            
            // Set plot.
            plots[i] = _deedId;
            
            // Get the original owner and transfer.
            address owner = originalContract.ownerOf(_deedId);
            
            // If the owner of the plot is an auction contract,
            // get the actual owner of the plot.
            address seller;
            if (owner == address(originalSaleAuction)) {
                (seller, ) = originalSaleAuction.getAuction(_deedId);
                owner = seller;
            } else if (owner == address(originalRentAuction)) {
                (seller, ) = originalRentAuction.getAuction(_deedId);
                owner = seller;
            }
            
            _transfer(address(0), owner, _deedId);
            
            // Set the initial price paid for the plot.
            initialPricePaid[_deedId] = 0.0125 ether;
            
            // The initial buyout price.
            uint256 _initialBuyoutPrice = 0.050 ether;
            
            // Set the initial buyout price.
            identifierToBuyoutPrice[_deedId] = _initialBuyoutPrice;
            
            // Trigger the buyout price event.
            SetBuyoutPrice(_deedId, _initialBuyoutPrice);
            
            // Mark the plot as being an original.
            identifierIsOriginal[_deedId] = true;
        }
        
        migrationNumPlotsTransferred += numPlotsTransfer;
        
        // Finished migration.
        if (i == numPlots) {
            migrationFinished = true;
        }
    }
}


/// @dev Implements highest-level DWorld functionality.
contract DWorldCore is DWorldUpgrade {
    /// If this contract is broken, this will be used to publish the address at which an upgraded contract can be found
    address public upgradedContractAddress;
    event ContractUpgrade(address upgradedContractAddress);

    function DWorldCore(
        address originalContractAddress,
        address originalSaleAuctionAddress,
        address originalRentAuctionAddress,
        uint256 buyoutsEnabledAfterHours
    )
        DWorldUpgrade(originalContractAddress, originalSaleAuctionAddress, originalRentAuctionAddress)
        public 
    {
        buyoutsEnabledFromTimestamp = block.timestamp + buyoutsEnabledAfterHours * 3600;
    }
    
    /// @notice Only to be used when this contract is significantly broken,
    /// and an upgrade is required.
    function setUpgradedContractAddress(address _upgradedContractAddress) external onlyOwner whenPaused {
        upgradedContractAddress = _upgradedContractAddress;
        ContractUpgrade(_upgradedContractAddress);
    }

    /// @notice Set the data associated with a plot.
    function setPlotData(uint256 _deedId, string name, string description, string imageUrl, string infoUrl)
        public
        whenNotPaused
    {
        // The sender requesting the data update should be
        // the owner.
        require(_owns(msg.sender, _deedId));
    
        // Set the data
        _setPlotData(_deedId, name, description, imageUrl, infoUrl);
    }
    
    /// @notice Set the data associated with multiple plots.
    function setPlotDataMultiple(uint256[] _deedIds, string name, string description, string imageUrl, string infoUrl)
        external
        whenNotPaused
    {
        for (uint256 i = 0; i < _deedIds.length; i++) {
            uint256 _deedId = _deedIds[i];
        
            setPlotData(_deedId, name, description, imageUrl, infoUrl);
        }
    }
    
    /// @notice Withdraw Ether owed to the sender.
    function withdrawBalance() external {
        uint256 etherOwed = addressToEtherOwed[msg.sender];
        
        // Ensure Ether is owed to the sender.
        require(etherOwed > 0);
         
        // Set Ether owed to 0.
        delete addressToEtherOwed[msg.sender];
        
        // Subtract from total outstanding balance. etherOwed is guaranteed
        // to be less than or equal to outstandingEther, so this cannot
        // underflow.
        outstandingEther -= etherOwed;
        
        // Transfer Ether owed to the sender (not susceptible to re-entry
        // attack, as the Ether owed is set to 0 before the transfer takes place).
        msg.sender.transfer(etherOwed);
    }
    
    /// @notice Withdraw (unowed) contract balance.
    function withdrawFreeBalance() external onlyCFO {
        // Calculate the free (unowed) balance. This never underflows, as
        // outstandingEther is guaranteed to be less than or equal to the
        // contract balance.
        uint256 freeBalance = this.balance - outstandingEther;
        
        cfoAddress.transfer(freeBalance);
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"_interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"cfoAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"_deedName","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_deedId","type":"uint256"}],"name":"buyout","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_deedId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradedContractAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"identifier","type":"uint256"}],"name":"validIdentifier","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_claimDividendPercentage","type":"uint256"}],"name":"setClaimDividendPercentage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_deedIds","type":"uint256[]"},{"name":"name","type":"string"},{"name":"description","type":"string"},{"name":"imageUrl","type":"string"},{"name":"infoUrl","type":"string"}],"name":"setPlotDataMultiple","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"}],"name":"reclaimToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_deedIds","type":"uint256[]"}],"name":"transferMultiple","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_deedIds","type":"uint256[]"}],"name":"approveMultiple","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_unclaimedPlotPrice","type":"uint256"}],"name":"setUnclaimedPlotPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint256"},{"name":"y","type":"uint256"}],"name":"coordinateToIdentifier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"_deedId","type":"uint256"}],"name":"buyoutCost","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_deedIds","type":"uint256[]"},{"name":"_buyoutPrice","type":"uint256"}],"name":"claimPlotMultiple","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"deedsOfOwner","outputs":[{"name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_deedId","type":"uint256"},{"name":"name","type":"string"},{"name":"description","type":"string"},{"name":"imageUrl","type":"string"},{"name":"infoUrl","type":"string"}],"name":"buyoutWithData","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"migrationFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_deedId","type":"uint256"},{"name":"_buyoutPrice","type":"uint256"},{"name":"name","type":"string"},{"name":"description","type":"string"},{"name":"imageUrl","type":"string"},{"name":"infoUrl","type":"string"}],"name":"claimPlotWithData","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_deedId","type":"uint256"}],"name":"maximumInitialBuyoutPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"addr","type":"address"},{"name":"allowance","type":"uint256"}],"name":"setFreeClaimAllowance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_deedId","type":"uint256"},{"name":"_buyoutPrice","type":"uint256"}],"name":"claimPlot","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_newCFO","type":"address"}],"name":"setCFO","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"claimOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"identifierIsOriginal","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_index","type":"uint256"}],"name":"deedOfOwnerByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"outstandingEther","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"totalCost","type":"uint256"}],"name":"nextBuyoutPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_deedId","type":"uint256"},{"name":"name","type":"string"},{"name":"description","type":"string"},{"name":"imageUrl","type":"string"},{"name":"infoUrl","type":"string"}],"name":"setPlotData","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdrawBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"plots","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_deedId","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"buyoutFeePercentage","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"unclaimedPlotPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_buyoutDividendPercentage","type":"uint256"}],"name":"setBuyoutDividendPercentage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"identifier","type":"uint256"}],"name":"identifierToCoordinate","outputs":[{"name":"x","type":"uint256"},{"name":"y","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAllPlots","outputs":[{"name":"","type":"uint32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"countOfDeedsByOwner","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_deedId","type":"uint256"},{"name":"price","type":"uint256"}],"name":"validInitialBuyoutPrice","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"_deedSymbol","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"buyoutDividendPercentage","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint256"},{"name":"y","type":"uint256"}],"name":"validCoordinate","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_deedId","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"identifierToBuyoutPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_deedId","type":"uint256"}],"name":"takeOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"addressToEtherOwed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_deedId","type":"uint256"}],"name":"deedUri","outputs":[{"name":"uri","type":"string"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_deedIds","type":"uint256[]"},{"name":"_buyoutPrice","type":"uint256"},{"name":"name","type":"string"},{"name":"description","type":"string"},{"name":"imageUrl","type":"string"},{"name":"infoUrl","type":"string"}],"name":"claimPlotMultipleWithData","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"countOfDeeds","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"initialPricePaid","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_upgradedContractAddress","type":"address"}],"name":"setUpgradedContractAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"freeClaimAllowanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"claimDividendPercentage","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"numPlotsTransfer","type":"uint256"}],"name":"migrationStep","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"buyoutsEnabledFromTimestamp","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_deedIds","type":"uint256[]"}],"name":"takeOwnershipMultiple","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_deedId","type":"uint256"},{"name":"price","type":"uint256"}],"name":"setInitialBuyoutPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_buyoutFeePercentage","type":"uint256"}],"name":"setBuyoutFeePercentage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawFreeBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"claimDividend","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"originalContractAddress","type":"address"},{"name":"originalSaleAuctionAddress","type":"address"},{"name":"originalRentAuctionAddress","type":"address"},{"name":"buyoutsEnabledAfterHours","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"upgradedContractAddress","type":"address"}],"name":"ContractUpgrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"deedIdFrom","type":"uint256"},{"indexed":true,"name":"deedIdTo","type":"uint256"},{"indexed":false,"name":"dividend","type":"uint256"}],"name":"ClaimDividend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"buyer","type":"address"},{"indexed":true,"name":"seller","type":"address"},{"indexed":true,"name":"deedId","type":"uint256"},{"indexed":false,"name":"winnings","type":"uint256"},{"indexed":false,"name":"totalCost","type":"uint256"},{"indexed":false,"name":"newPrice","type":"uint256"}],"name":"Buyout","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"deedIdFrom","type":"uint256"},{"indexed":true,"name":"deedIdTo","type":"uint256"},{"indexed":false,"name":"dividend","type":"uint256"}],"name":"BuyoutDividend","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"deedId","type":"uint256"},{"indexed":false,"name":"newPrice","type":"uint256"}],"name":"SetBuyoutPrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":true,"name":"deedId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"approved","type":"address"},{"indexed":true,"name":"deedId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"deedId","type":"uint256"},{"indexed":false,"name":"name","type":"string"},{"indexed":false,"name":"description","type":"string"},{"indexed":false,"name":"imageUrl","type":"string"},{"indexed":false,"name":"infoUrl","type":"string"}],"name":"SetData","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

60606040526001805460a060020a60ff021990811690915560006008819055662c68af0bb14000600a5561c350600b55611388600c55610dac600d556015805490921690915560165534156200005457600080fd5b60405160808062003cb68339810160405280805191906020018051919060200180519190602001805160008054600160a060020a03338116600160a060020a0319928316811790935560028054909216909217905590925085915084908490831615620000dc57620000d6838383640100000000620039476200011a82021704565b62000104565b6015805460a060020a60ff021916740100000000000000000000000000000000000000001790555b505050610e10024201601255506200026a915050565b60138054600160a060020a03808616600160a060020a0319928316179283905560148054868316908416179055601580548583169316929092179091556001805460a060020a60ff021916740100000000000000000000000000000000000000001790556000911663c34588ba82604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515620001d757600080fd5b6102c65a03f11515620001e957600080fd5b50505060405180519150819050620002036003826200020a565b5050505050565b8154818355818115116200024157600701600890048160070160089004836000526020600020918201910162000241919062000246565b505050565b6200026791905b808211156200026357600081556001016200024d565b5090565b90565b613a3c806200027a6000396000f3006060604052600436106102fd5763ffffffff60e060020a60003504166301ffc9a781146103025780630519ce791461034e57806306fdde031461037d57806307bec66f14610407578063095ea7b3146104145780630da2e088146104365780630ec6b08d1461044957806313734a9f1461045f5780631680a0701461047557806317ffc320146104c35780631d976e05146104e25780631f5c3a3c1461053f578063249830d81461059c578063258a61d6146105b257806327bb6d8e146105dd5780632bd57604146105f35780632d620e1e1461060a5780633895f4661461067c5780633f4ba83a1461078d5780633f9e23e5146107a057806344210bbd146107b357806347006460146108ca5780634830e636146108e05780634b236401146109025780634e0a3379146109105780634e71e0c81461092f57806351edffed146109425780635327091014610958578063548b273a1461097a5780635678524f1461098d5780635b0088fb146109a35780635c975abb14610abf5780635fd8c71014610ad257806361bf49ee14610ae55780636352211e14610b145780636451447d14610b2a578063689f3f9914610b3d57806369b9e96b14610b505780636d6bc5f514610b665780638456cb5914610b945780638da5cb5b14610ba7578063925074ca14610bba57806392efd27714610bcd57806394d036bf14610bec57806395d89b4114610c055780639bc3135b14610c18578063a6da54a314610c2b578063a9059cbb14610c44578063b00bad5014610c66578063b2e6ceeb14610c7c578063b8fd1ffa14610c92578063b95d2a5314610cb1578063c072497a14610cc7578063c34588ba14610e1c578063c5a4eb3514610e2f578063c78e139a14610e45578063cfdb2eb714610e64578063d679c4f214610e83578063dc5d9bfe14610e96578063dd7b3e9714610eac578063e30c397814610ebf578063e435f2c914610ed2578063ec4c76bb14610f21578063ecc2183014610f3a578063ee8b39f614610f50578063f0fc6bca14610f63578063f2fde38b14610f76575b600080fd5b341561030d57600080fd5b61033a7fffffffff0000000000000000000000000000000000000000000000000000000060043516610f95565b604051901515815260200160405180910390f35b341561035957600080fd5b610361611206565b604051600160a060020a03909116815260200160405180910390f35b341561038857600080fd5b610390611215565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156103cc5780820151838201526020016103b4565b50505050905090810190601f1680156103f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610412600435611256565b005b341561041f57600080fd5b610412600160a060020a03600435166024356112bb565b341561044157600080fd5b610361611323565b341561045457600080fd5b61033a600435611332565b341561046a57600080fd5b61041260043561133d565b341561048057600080fd5b610412602460048035828101929082013591813580830192908201359160443580830192908201359160643580830192908201359160843591820191013561137d565b34156104ce57600080fd5b610412600160a060020a03600435166114a3565b34156104ed57600080fd5b61041260048035600160a060020a031690604460248035908101908301358060208082020160405190810160405280939291908181526020018383602002808284375094965061155795505050505050565b341561054a57600080fd5b61041260048035600160a060020a031690604460248035908101908301358060208082020160405190810160405280939291908181526020018383602002808284375094965061160095505050505050565b34156105a757600080fd5b61041260043561168e565b34156105bd57600080fd5b6105cb6004356024356116ae565b60405190815260200160405180910390f35b34156105e857600080fd5b6105cb6004356116cf565b61041260246004803582810192910135903561172c565b341561061557600080fd5b610629600160a060020a03600435166117be565b60405160208082528190810183818151815260200191508051906020019060200280838360005b83811015610668578082015183820152602001610650565b505050509050019250505060405180910390f35b610412600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506118da95505050505050565b341561079857600080fd5b610412611bd0565b34156107ab57600080fd5b61033a611c4f565b610412600480359060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611c5f95505050505050565b34156108d557600080fd5b6105cb600435611ccf565b34156108eb57600080fd5b610412600160a060020a0360043516602435611d13565b610412600435602435611d4a565b341561091b57600080fd5b610412600160a060020a0360043516611dad565b341561093a57600080fd5b610412611dff565b341561094d57600080fd5b61033a600435611e80565b341561096357600080fd5b6105cb600160a060020a0360043516602435611e95565b341561098557600080fd5b6105cb611f4f565b341561099857600080fd5b6105cb600435611f55565b34156109ae57600080fd5b610412600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611fd395505050505050565b3415610aca57600080fd5b61033a612013565b3415610add57600080fd5b610412612023565b3415610af057600080fd5b610afb600435612095565b60405163ffffffff909116815260200160405180910390f35b3415610b1f57600080fd5b6103616004356120cd565b3415610b3557600080fd5b6105cb6120f1565b3415610b4857600080fd5b6105cb6120f7565b3415610b5b57600080fd5b6104126004356120fd565b3415610b7157600080fd5b610b7c60043561213c565b60405191825260208201526040908101905180910390f35b3415610b9f57600080fd5b610412612165565b3415610bb257600080fd5b6103616121e9565b3415610bc557600080fd5b6106296121f8565b3415610bd857600080fd5b6105cb600160a060020a0360043516612283565b3415610bf757600080fd5b61033a60043560243561229e565b3415610c1057600080fd5b6103906122c0565b3415610c2357600080fd5b6105cb612301565b3415610c3657600080fd5b61033a600435602435612307565b3415610c4f57600080fd5b610412600160a060020a0360043516602435612322565b3415610c7157600080fd5b6105cb600435612385565b3415610c8757600080fd5b610412600435612397565b3415610c9d57600080fd5b6105cb600160a060020a03600435166123f9565b3415610cbc57600080fd5b61039060043561240b565b610412600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506125c095505050505050565b3415610e2757600080fd5b6105cb612838565b3415610e3a57600080fd5b6105cb60043561283e565b3415610e5057600080fd5b610412600160a060020a0360043516612850565b3415610e6f57600080fd5b6105cb600160a060020a03600435166128de565b3415610e8e57600080fd5b6105cb6128f9565b3415610ea157600080fd5b6104126004356128ff565b3415610eb757600080fd5b6105cb612d57565b3415610eca57600080fd5b610361612d5d565b3415610edd57600080fd5b6104126004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650612d6c95505050505050565b3415610f2c57600080fd5b610412600435602435612df6565b3415610f4557600080fd5b610412600435612e9f565b3415610f5b57600080fd5b610412612edd565b3415610f6e57600080fd5b6105cb612f3b565b3415610f8157600080fd5b610412600160a060020a0360043516612f60565b60006040517f737570706f727473496e7465726661636528627974657334290000000000000081526019016040518091039020600160e060020a03191682600160e060020a031916148061114c57506040517f74616b654f776e6572736869702875696e743235362900000000000000000000815260160160405180910390206040517f617070726f766528616464726573732c75696e74323536290000000000000000815260180160405180910390206040517f646565644f664f776e65724279496e64657828616464726573732c75696e743281527f3536290000000000000000000000000000000000000000000000000000000000602082015260230160405180910390206040517f636f756e744f66446565647342794f776e6572286164647265737329000000008152601c0160405180910390206040517f636f756e744f66446565647328290000000000000000000000000000000000008152600e0160405180910390206040517f6f776e65724f662875696e743235362900000000000000000000000000000000815260100160405180910390201818181818600160e060020a03191682600160e060020a031916145b806111fe57506040517f646565645572692875696e743235362900000000000000000000000000000000815260100160405180910390206040517f73796d626f6c2829000000000000000000000000000000000000000000000000815260080160405180910390206040517f6e616d6528290000000000000000000000000000000000000000000000000000815260060160405180910390201818600160e060020a03191682600160e060020a031916145b90505b919050565b600254600160a060020a031681565b61121d6138ed565b60408051908101604052600c81527f44576f726c6420506c6f747300000000000000000000000000000000000000006020820152919050565b60015460a060020a900460ff161561126d57600080fd5b6112b8816020604051908101604052806000815250602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052600081526118da565b50565b6112c36138ed565b60015460a060020a900460ff16156112da57600080fd5b60016040518059106112e95750595b90808252806020026020018201604052509050818160008151811061130a57fe5b6020908102909101015261131e8382611600565b505050565b601754600160a060020a031681565b640100000000901090565b60025433600160a060020a0390811691161461135857600080fd5b806127101115801561136d5750620186a08111155b151561137857600080fd5b600b55565b600154600090819060a060020a900460ff161561139957600080fd5b600091505b8a821015611495578b8b838181106113b257fe5b90506020020135905061148a818b8b8080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050508a8a8080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505089898080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505088888080601f016020809104026020016040519081016040528181529291906020840183838082843750611fd3945050505050565b60019091019061139e565b505050505050505050505050565b6000805433600160a060020a039081169116146114bf57600080fd5b81600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561151657600080fd5b6102c65a03f1151561152757600080fd5b50505060405180516000549092506115539150600160a060020a0384811691168363ffffffff612f9d16565b5050565b600154600090819060a060020a900460ff161561157357600080fd5b600160a060020a038416151561158857600080fd5b30600160a060020a031684600160a060020a0316141515156115a957600080fd5b600091505b82518210156115fa578282815181106115c357fe5b9060200190602002015190506115d9338261301d565b15156115e457600080fd5b6115ef33858361303d565b6001909101906115ae565b50505050565b600154600090819060a060020a900460ff161561161c57600080fd5b83600160a060020a031633600160a060020a03161415151561163d57600080fd5b600091505b82518210156115fa5782828151811061165757fe5b90602001906020020151905061166d338261301d565b151561167857600080fd5b611683338583613104565b600190910190611642565b60025433600160a060020a039081169116146116a957600080fd5b600a55565b60006116ba8383612307565b15156116c557600080fd5b5062010000020190565b6000806116da6138ed565b60008481526010602052604081205492506116f485613168565b915061170f8251611703612f3b565b9063ffffffff6132cd16565b9050611721838263ffffffff61330316565b93505b505050919050565b60015460a060020a900460ff161561174357600080fd5b61131e838380806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050826020604051908101604052806000815250602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052600081526125c0565b6117c66138ed565b60006117d06138ed565b6000806000806117df88612283565b955085151561180f5760006040518059106117f75750595b908082528060200260200182016040525096506118cf565b8560405180591061181d5750595b90808252806020026020018201604052509450611838612838565b935060009250600091505b838210156118cb57600380548390811061185957fe5b60009182526020808320600880840490910154920660049081026101000a90920463ffffffff16808452919052604090912054909150600160a060020a03898116911614156118c057808584815181106118af57fe5b602090810290910101526001909201915b600190910190611843565b8496505b505050505050919050565b60006118e46138ed565b600154600090819060a060020a900460ff161561190057600080fd5b6012544290111561191057600080fd5b600089815260046020526040902054600160a060020a0316935083151561193657600080fd5b61193f89613168565b925061194c848a85613312565b9150348290101561195c57600080fd5b61196784338b61303d565b887f494fb6227df1321e7605ad3dbe7f91fa4bb839754feeb2e2dcdb0a4c5cfc7fc7898989896040518080602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b838110156119d65780820151838201526020016119be565b50505050905090810190601f168015611a035780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b83811015611a39578082015183820152602001611a21565b50505050905090810190601f168015611a665780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015611a9c578082015183820152602001611a84565b50505050905090810190601f168015611ac95780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015611aff578082015183820152602001611ae7565b50505050905090810190601f168015611b2c5780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390a2611b4882611f55565b60008a81526010602090815260408083209390935560119052205460ff161515611b86576000898152601160205260409020805460ff191660011790555b81340390506000811115611bc557600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515611bc557600080fd5b505050505050505050565b60005433600160a060020a03908116911614611beb57600080fd5b60015460a060020a900460ff161515611c0357600080fd5b6001805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60155460a060020a900460ff1681565b611c676138ed565b60015460a060020a900460ff1615611c7e57600080fd5b6001604051805910611c8d5750595b908082528060200260200182016040525090508681600081518110611cae57fe5b60209081029091010152611cc68187878787876125c0565b50505050505050565b60008181526007602052604081205460049060ff1615611ced575060645b6000838152600f6020526040902054611d0c908263ffffffff6132cd16565b9392505050565b60025433600160a060020a03908116911614611d2e57600080fd5b600160a060020a039091166000908152600e6020526040902055565b60015460a060020a900460ff1615611d6157600080fd5b6115538282602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405260008152611c5f565b60005433600160a060020a03908116911614611dc857600080fd5b600160a060020a0381161515611ddd57600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b60015433600160a060020a03908116911614611e1a57600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60076020526000908152604090205460ff1681565b6000806000806000611ea687612283565b8610611eb157600080fd5b60009350611ebd612838565b9250600091505b82821015611f45576003805483908110611eda57fe5b60009182526020808320600880840490910154920660049081026101000a90920463ffffffff16808452919052604090912054909150600160a060020a0388811691161415611f3a5785841415611f3357809450611f45565b6001909301925b600190910190611ec4565b5050505092915050565b60085481565b600066b1a2bc2ec50000821015611f70575060028102611201565b6702c68af0bb140000821015611f8f57606460aa83025b049050611201565b6706f05b59d3b20000821015611faa57606460968302611f87565b611fcc6064611fc084607d63ffffffff6132cd16565b9063ffffffff6133eb16565b9050611201565b60015460a060020a900460ff1615611fea57600080fd5b611ff4338661301d565b1515611fff57600080fd5b61200c8585858585613402565b5050505050565b60015460a060020a900460ff1681565b600160a060020a03331660009081526009602052604081205490811161204857600080fd5b600160a060020a0333166000818152600960205260408082209190915560088054849003905582156108fc0290839051600060405180830381858888f1935050505015156112b857600080fd5b60038054829081106120a357fe5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b600081815260046020526040902054600160a060020a031680151561120157600080fd5b600d5481565b600a5481565b60025433600160a060020a0390811691161461211857600080fd5b806107d01115801561212c57506130d48111155b151561213757600080fd5b600c55565b60008061214883611332565b151561215357600080fd5b50506201000080820490810290910391565b60005433600160a060020a0390811691161461218057600080fd5b60015460a060020a900460ff161561219757600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b6122006138ed565b600380548060200260200160405190810160405280929190818152602001828054801561227857602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff168152602001906004019060208260030104928301926001038202915080841161223b5790505b505050505090505b90565b600160a060020a031660009081526006602052604090205490565b6000600a548210158015611d0c57506122b683611ccf565b8211159392505050565b6122c86138ed565b60408051908101604052600381527f44575000000000000000000000000000000000000000000000000000000000006020820152919050565b600c5481565b60006201000083108015611d0c575050620100009010919050565b61232a6138ed565b60015460a060020a900460ff161561234157600080fd5b60016040518059106123505750595b90808252806020026020018201604052509050818160008151811061237157fe5b6020908102909101015261131e8382611557565b60106020526000908152604090205481565b61239f6138ed565b60015460a060020a900460ff16156123b657600080fd5b60016040518059106123c55750595b9080825280602002602001820160405250905081816000815181106123e657fe5b6020908102909101015261155381612d6c565b60096020526000908152604090205481565b6124136138ed565b60008061241e6138ed565b600061242986611332565b151561243457600080fd5b61243d8661213c565b93509350606060405190810160405280602281526020017f68747470733a2f2f64776f726c642e696f2f706c6f742f78787878782f78787881526020017f78780000000000000000000000000000000000000000000000000000000000008152509450849150600090505b60058110156125b757600a81600a0a858115156124c157fe5b048115156124cb57fe5b066030017f0100000000000000000000000000000000000000000000000000000000000000028282601b038151811061250057fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a81600a0a8481151561254057fe5b0481151561254a57fe5b066030017f01000000000000000000000000000000000000000000000000000000000000000282826021038151811061257f57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016124a8565b50505050919050565b600080600080600080600080600160149054906101000a900460ff161515156125e857600080fd5b8d51600160a060020a0333166000908152600e602052604081205491995090111561269157600160a060020a0333166000908152600e60205260409020548890111561265457600160a060020a0333166000908152600e6020526040812080548a90039055965061268c565b600160a060020a0333166000908152600e602052604081208054919055600a5490965061268990878a0363ffffffff6132cd16565b96505b6126a7565b600a546126a4908963ffffffff6132cd16565b96505b60035494506126c08e516003549063ffffffff61330316565b6126cb6003826138ff565b50600093505b8d518410156127db578d84815181106126e657fe5b9060200190602002015192506126fb83611332565b151561270657600080fd5b600083815260046020526040902054600160a060020a03161561272857600080fd5b82600385870181548110151561273a57fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff1602179055506127796000338561303d565b612786838d8d8d8d613402565b61278f836135e1565b91506127a1878363ffffffff61330316565b600a549097506127b7908363ffffffff61330316565b6000848152600f60205260409020556127d0838e612df6565b6001909301926126d1565b34879010156127e957600080fd5b8634039050600081111561282857600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050151561282857600080fd5b5050505050505050505050505050565b60035490565b600f6020526000908152604090205481565b60005433600160a060020a0390811691161461286b57600080fd5b60015460a060020a900460ff16151561288357600080fd5b60178054600160a060020a031916600160a060020a0383161790557f450db8da6efbe9c22f2347f7c2021231df1fc58d3ae9a2fa75d39fa44619930581604051600160a060020a03909116815260200160405180910390a150565b600160a060020a03166000908152600e602052604090205490565b600b5481565b600080548190819081908190819033600160a060020a0390811691161461292557600080fd5b60015460a060020a900460ff16151561293d57600080fd5b60155460a060020a900460ff161561295457600080fd5b601354600160a060020a031663c34588ba6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561299c57600080fd5b6102c65a03f115156129ad57600080fd5b50505060405180519050955060165494505b85851080156129d15750866016540185105b15612d1a57601354600160a060020a03166361bf49ee8660006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515612a2757600080fd5b6102c65a03f11515612a3857600080fd5b50505060405180519050935083600386815481101515612a5457fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff160217905550601360009054906101000a9004600160a060020a0316600160a060020a0316636352211e856000604051602001526040518263ffffffff1660e060020a028152600401808263ffffffff168152602001915050602060405180830381600087803b1515612af357600080fd5b6102c65a03f11515612b0457600080fd5b5050506040518051601454909450600160a060020a03808616911614159050612bc257601454600160a060020a03166378bd793585600060405160a001526040518263ffffffff1660e060020a028152600401808263ffffffff16815260200191505060a060405180830381600087803b1515612b8057600080fd5b6102c65a03f11515612b9157600080fd5b505050604051805190602001805190602001805190602001805190602001805150939650869550612c6e9350505050565b601554600160a060020a0384811691161415612c6e57601554600160a060020a03166378bd793585600060405160a001526040518263ffffffff1660e060020a028152600401808263ffffffff16815260200191505060a060405180830381600087803b1515612c3157600080fd5b6102c65a03f11515612c4257600080fd5b505050604051805190602001805190602001805190602001805190602001805150939650869550505050505b612c806000848663ffffffff1661303d565b5063ffffffff83166000818152600f60209081526040808320662c68af0bb14000905560109091529081902066b1a2bc2ec500009081905591907fa54315fd6a6da96c81133ae36a774aabd6d6aba6a6e53df08e7d5065a89b8b759083905190815260200160405180910390a263ffffffff84166000908152600760205260409020805460ff1916600190811790915594909401936129bf565b601680548801905584861415611cc6576015805474ff0000000000000000000000000000000000000000191660a060020a17905550505050505050565b60125481565b600154600160a060020a031681565b6001546000908190819060a060020a900460ff1615612d8a57600080fd5b600092505b83518310156115fa57838381518110612da457fe5b90602001906020020151600081815260046020526040902054909250600160a060020a03169050612dd533836136c6565b1515612de057600080fd5b612deb81338461303d565b600190920191612d8f565b60015460a060020a900460ff1615612e0d57600080fd5b612e17338361301d565b1515612e2257600080fd5b60008281526011602052604090205460ff1615612e3e57600080fd5b612e48828261229e565b1515612e5357600080fd5b6000828152601060205260409081902082905582907fa54315fd6a6da96c81133ae36a774aabd6d6aba6a6e53df08e7d5065a89b8b759083905190815260200160405180910390a25050565b60025433600160a060020a03908116911614612eba57600080fd5b80600011158015612ecd57506113888111155b1515612ed857600080fd5b600d55565b60025460009033600160a060020a03908116911614612efb57600080fd5b50600854600254600160a060020a033081163192909203911681156108fc0282604051600060405180830381858888f1935050505015156112b857600080fd5b6000612f5b620186a0611fc0600b54600a546132cd90919063ffffffff16565b905090565b60005433600160a060020a03908116911614612f7b57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b82600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515612ffa57600080fd5b6102c65a03f1151561300b57600080fd5b50505060405180519050151561131e57fe5b600090815260046020526040902054600160a060020a0391821691161490565b600160a060020a03808316600081815260066020908152604080832080546001019055858352600490915290208054600160a060020a03191690911790558316156130be57600160a060020a03831660009081526006602090815260408083208054600019019055838352600590915290208054600160a060020a03191690555b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600081815260056020526040908190208054600160a060020a031916600160a060020a03858116918217909255839290918616907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925905160405180910390a4505050565b6131706138ed565b600080600061317d6138ed565b600080600061318a6138ed565b60006131958b61213c565b985098506000965060086040518059106131ac5750595b9080825280602002602001820160405250955060001994505b6001851361325d5760001993505b6001841361325257841580156131e7575083155b156131f157613247565b613209620100008a870106620100008a8701066116ae565b600081815260046020526040902054909350600160a060020a031615613247578286888151811061323657fe5b602090810290910101526001909601955b6001909301926131d3565b6001909401936131c5565b8660405180591061326b5750595b90808252806020026020018201604052509150600090505b868110156132bf5785818151811061329757fe5b906020019060200201518282815181106132ad57fe5b60209081029091010152600101613283565b509998505050505050505050565b6000808315156132e057600091506132fc565b508282028284828115156132f057fe5b04146132f857fe5b8091505b5092915050565b6000828201838110156132f857fe5b60008281526010602052604081205481808080806133338851611703612f3b565b9450613345868663ffffffff61330316565b9650613363620186a0611fc0600c54896132cd90919063ffffffff16565b9350613381620186a0611fc0600d54896132cd90919063ffffffff16565b9250613393868463ffffffff6136e616565b91506000885111156133d0576133af828563ffffffff6136e616565b915087516133c3868663ffffffff61330316565b8115156133cc57fe5b0490505b6133de8a8a8a85858c6136f8565b5050505050509392505050565b60008082848115156133f957fe5b04949350505050565b847f494fb6227df1321e7605ad3dbe7f91fa4bb839754feeb2e2dcdb0a4c5cfc7fc7858585856040518080602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b83811015613471578082015183820152602001613459565b50505050905090810190601f16801561349e5780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b838110156134d45780820151838201526020016134bc565b50505050905090810190601f1680156135015780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b8381101561353757808201518382015260200161351f565b50505050905090810190601f1680156135645780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b8381101561359a578082015183820152602001613582565b50505050905090810190601f1680156135c75780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390a25050505050565b60006135eb6138ed565b6000806135f785613168565b9250613601612f3b565b915060009350600090505b82518110156117245733600160a060020a03166004600085848151811061362f57fe5b906020019060200201518152602081019190915260400160002054600160a060020a0316146136be57613668848363ffffffff61330316565b93506136be336004600086858151811061367e57fe5b906020019060200201518152602081019190915260400160002054600160a060020a0316878685815181106136af57fe5b90602001906020020151613830565b60010161360c565b600090815260056020526040902054600160a060020a0391821691161490565b6000828211156136f257fe5b50900390565b6000808688600160a060020a031633600160a060020a03167f904da3d77bc80625b1aa2389e487e0ae13ce5df85c78a700fbd3dcadcf94d539888761373c89611f55565b60405180848152602001838152602001828152602001935050505060405180910390a46137698886613891565b600091505b8551821015613826576004600087848151811061378757fe5b906020019060200201518152602081019190915260400160002054600160a060020a031690508582815181106137b957fe5b9060200190602002015181600160a060020a031633600160a060020a03167f4e5497ded03fbd794bb93a88c0ba752079649608a1573063bfe40bf692be43a58a8860405191825260208201526040908101905180910390a461381b8185613891565b60019091019061376e565b5050505050505050565b600061383a612f3b565b90508184600160a060020a031686600160a060020a03167f189e688a8453ad6845d445a3e7ec07c79239cfbca0fb99fbbe0233af72475b76868560405191825260208201526040908101905180910390a461200c84825b600160a060020a0382166000908152600960205260409020546138ba908263ffffffff61330316565b600160a060020a0383166000908152600960205260409020556008546138e6908263ffffffff61330316565b6008555050565b60206040519081016040526000815290565b81548183558181151161131e5760008381526020902061131e916122809160086007928301819004820192860104015b80821115613943576000815560010161392f565b5090565b60138054600160a060020a03808616600160a060020a0319928316179283905560148054868316908416179055601580548583169316929092179091556001805474ff0000000000000000000000000000000000000000191660a060020a1790556000911663c34588ba82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156139e757600080fd5b6102c65a03f115156139f857600080fd5b5050506040518051915081905061200c6003826138ff5600a165627a7a72305820bc2d6a40b8c993c2bf29b30e2c63ee3c95740cec38ec2a94734649f1063a9e910029000000000000000000000000d4df33983ff82ce4469c6ea3cff390403e58d90a000000000000000000000000621ad3562f5141c4a0e7cad958b8b524d356332b0000000000000000000000005301f1ec2f48f86bbd5291dfd7998a3d733a3245000000000000000000000000000000000000000000000000000000000000000f

Deployed Bytecode

0x6060604052600436106102fd5763ffffffff60e060020a60003504166301ffc9a781146103025780630519ce791461034e57806306fdde031461037d57806307bec66f14610407578063095ea7b3146104145780630da2e088146104365780630ec6b08d1461044957806313734a9f1461045f5780631680a0701461047557806317ffc320146104c35780631d976e05146104e25780631f5c3a3c1461053f578063249830d81461059c578063258a61d6146105b257806327bb6d8e146105dd5780632bd57604146105f35780632d620e1e1461060a5780633895f4661461067c5780633f4ba83a1461078d5780633f9e23e5146107a057806344210bbd146107b357806347006460146108ca5780634830e636146108e05780634b236401146109025780634e0a3379146109105780634e71e0c81461092f57806351edffed146109425780635327091014610958578063548b273a1461097a5780635678524f1461098d5780635b0088fb146109a35780635c975abb14610abf5780635fd8c71014610ad257806361bf49ee14610ae55780636352211e14610b145780636451447d14610b2a578063689f3f9914610b3d57806369b9e96b14610b505780636d6bc5f514610b665780638456cb5914610b945780638da5cb5b14610ba7578063925074ca14610bba57806392efd27714610bcd57806394d036bf14610bec57806395d89b4114610c055780639bc3135b14610c18578063a6da54a314610c2b578063a9059cbb14610c44578063b00bad5014610c66578063b2e6ceeb14610c7c578063b8fd1ffa14610c92578063b95d2a5314610cb1578063c072497a14610cc7578063c34588ba14610e1c578063c5a4eb3514610e2f578063c78e139a14610e45578063cfdb2eb714610e64578063d679c4f214610e83578063dc5d9bfe14610e96578063dd7b3e9714610eac578063e30c397814610ebf578063e435f2c914610ed2578063ec4c76bb14610f21578063ecc2183014610f3a578063ee8b39f614610f50578063f0fc6bca14610f63578063f2fde38b14610f76575b600080fd5b341561030d57600080fd5b61033a7fffffffff0000000000000000000000000000000000000000000000000000000060043516610f95565b604051901515815260200160405180910390f35b341561035957600080fd5b610361611206565b604051600160a060020a03909116815260200160405180910390f35b341561038857600080fd5b610390611215565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156103cc5780820151838201526020016103b4565b50505050905090810190601f1680156103f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610412600435611256565b005b341561041f57600080fd5b610412600160a060020a03600435166024356112bb565b341561044157600080fd5b610361611323565b341561045457600080fd5b61033a600435611332565b341561046a57600080fd5b61041260043561133d565b341561048057600080fd5b610412602460048035828101929082013591813580830192908201359160443580830192908201359160643580830192908201359160843591820191013561137d565b34156104ce57600080fd5b610412600160a060020a03600435166114a3565b34156104ed57600080fd5b61041260048035600160a060020a031690604460248035908101908301358060208082020160405190810160405280939291908181526020018383602002808284375094965061155795505050505050565b341561054a57600080fd5b61041260048035600160a060020a031690604460248035908101908301358060208082020160405190810160405280939291908181526020018383602002808284375094965061160095505050505050565b34156105a757600080fd5b61041260043561168e565b34156105bd57600080fd5b6105cb6004356024356116ae565b60405190815260200160405180910390f35b34156105e857600080fd5b6105cb6004356116cf565b61041260246004803582810192910135903561172c565b341561061557600080fd5b610629600160a060020a03600435166117be565b60405160208082528190810183818151815260200191508051906020019060200280838360005b83811015610668578082015183820152602001610650565b505050509050019250505060405180910390f35b610412600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506118da95505050505050565b341561079857600080fd5b610412611bd0565b34156107ab57600080fd5b61033a611c4f565b610412600480359060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611c5f95505050505050565b34156108d557600080fd5b6105cb600435611ccf565b34156108eb57600080fd5b610412600160a060020a0360043516602435611d13565b610412600435602435611d4a565b341561091b57600080fd5b610412600160a060020a0360043516611dad565b341561093a57600080fd5b610412611dff565b341561094d57600080fd5b61033a600435611e80565b341561096357600080fd5b6105cb600160a060020a0360043516602435611e95565b341561098557600080fd5b6105cb611f4f565b341561099857600080fd5b6105cb600435611f55565b34156109ae57600080fd5b610412600480359060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611fd395505050505050565b3415610aca57600080fd5b61033a612013565b3415610add57600080fd5b610412612023565b3415610af057600080fd5b610afb600435612095565b60405163ffffffff909116815260200160405180910390f35b3415610b1f57600080fd5b6103616004356120cd565b3415610b3557600080fd5b6105cb6120f1565b3415610b4857600080fd5b6105cb6120f7565b3415610b5b57600080fd5b6104126004356120fd565b3415610b7157600080fd5b610b7c60043561213c565b60405191825260208201526040908101905180910390f35b3415610b9f57600080fd5b610412612165565b3415610bb257600080fd5b6103616121e9565b3415610bc557600080fd5b6106296121f8565b3415610bd857600080fd5b6105cb600160a060020a0360043516612283565b3415610bf757600080fd5b61033a60043560243561229e565b3415610c1057600080fd5b6103906122c0565b3415610c2357600080fd5b6105cb612301565b3415610c3657600080fd5b61033a600435602435612307565b3415610c4f57600080fd5b610412600160a060020a0360043516602435612322565b3415610c7157600080fd5b6105cb600435612385565b3415610c8757600080fd5b610412600435612397565b3415610c9d57600080fd5b6105cb600160a060020a03600435166123f9565b3415610cbc57600080fd5b61039060043561240b565b610412600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506125c095505050505050565b3415610e2757600080fd5b6105cb612838565b3415610e3a57600080fd5b6105cb60043561283e565b3415610e5057600080fd5b610412600160a060020a0360043516612850565b3415610e6f57600080fd5b6105cb600160a060020a03600435166128de565b3415610e8e57600080fd5b6105cb6128f9565b3415610ea157600080fd5b6104126004356128ff565b3415610eb757600080fd5b6105cb612d57565b3415610eca57600080fd5b610361612d5d565b3415610edd57600080fd5b6104126004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650612d6c95505050505050565b3415610f2c57600080fd5b610412600435602435612df6565b3415610f4557600080fd5b610412600435612e9f565b3415610f5b57600080fd5b610412612edd565b3415610f6e57600080fd5b6105cb612f3b565b3415610f8157600080fd5b610412600160a060020a0360043516612f60565b60006040517f737570706f727473496e7465726661636528627974657334290000000000000081526019016040518091039020600160e060020a03191682600160e060020a031916148061114c57506040517f74616b654f776e6572736869702875696e743235362900000000000000000000815260160160405180910390206040517f617070726f766528616464726573732c75696e74323536290000000000000000815260180160405180910390206040517f646565644f664f776e65724279496e64657828616464726573732c75696e743281527f3536290000000000000000000000000000000000000000000000000000000000602082015260230160405180910390206040517f636f756e744f66446565647342794f776e6572286164647265737329000000008152601c0160405180910390206040517f636f756e744f66446565647328290000000000000000000000000000000000008152600e0160405180910390206040517f6f776e65724f662875696e743235362900000000000000000000000000000000815260100160405180910390201818181818600160e060020a03191682600160e060020a031916145b806111fe57506040517f646565645572692875696e743235362900000000000000000000000000000000815260100160405180910390206040517f73796d626f6c2829000000000000000000000000000000000000000000000000815260080160405180910390206040517f6e616d6528290000000000000000000000000000000000000000000000000000815260060160405180910390201818600160e060020a03191682600160e060020a031916145b90505b919050565b600254600160a060020a031681565b61121d6138ed565b60408051908101604052600c81527f44576f726c6420506c6f747300000000000000000000000000000000000000006020820152919050565b60015460a060020a900460ff161561126d57600080fd5b6112b8816020604051908101604052806000815250602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052600081526118da565b50565b6112c36138ed565b60015460a060020a900460ff16156112da57600080fd5b60016040518059106112e95750595b90808252806020026020018201604052509050818160008151811061130a57fe5b6020908102909101015261131e8382611600565b505050565b601754600160a060020a031681565b640100000000901090565b60025433600160a060020a0390811691161461135857600080fd5b806127101115801561136d5750620186a08111155b151561137857600080fd5b600b55565b600154600090819060a060020a900460ff161561139957600080fd5b600091505b8a821015611495578b8b838181106113b257fe5b90506020020135905061148a818b8b8080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050508a8a8080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505089898080601f016020809104026020016040519081016040528181529291906020840183838082843782019150505050505088888080601f016020809104026020016040519081016040528181529291906020840183838082843750611fd3945050505050565b60019091019061139e565b505050505050505050505050565b6000805433600160a060020a039081169116146114bf57600080fd5b81600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561151657600080fd5b6102c65a03f1151561152757600080fd5b50505060405180516000549092506115539150600160a060020a0384811691168363ffffffff612f9d16565b5050565b600154600090819060a060020a900460ff161561157357600080fd5b600160a060020a038416151561158857600080fd5b30600160a060020a031684600160a060020a0316141515156115a957600080fd5b600091505b82518210156115fa578282815181106115c357fe5b9060200190602002015190506115d9338261301d565b15156115e457600080fd5b6115ef33858361303d565b6001909101906115ae565b50505050565b600154600090819060a060020a900460ff161561161c57600080fd5b83600160a060020a031633600160a060020a03161415151561163d57600080fd5b600091505b82518210156115fa5782828151811061165757fe5b90602001906020020151905061166d338261301d565b151561167857600080fd5b611683338583613104565b600190910190611642565b60025433600160a060020a039081169116146116a957600080fd5b600a55565b60006116ba8383612307565b15156116c557600080fd5b5062010000020190565b6000806116da6138ed565b60008481526010602052604081205492506116f485613168565b915061170f8251611703612f3b565b9063ffffffff6132cd16565b9050611721838263ffffffff61330316565b93505b505050919050565b60015460a060020a900460ff161561174357600080fd5b61131e838380806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050826020604051908101604052806000815250602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052600081526125c0565b6117c66138ed565b60006117d06138ed565b6000806000806117df88612283565b955085151561180f5760006040518059106117f75750595b908082528060200260200182016040525096506118cf565b8560405180591061181d5750595b90808252806020026020018201604052509450611838612838565b935060009250600091505b838210156118cb57600380548390811061185957fe5b60009182526020808320600880840490910154920660049081026101000a90920463ffffffff16808452919052604090912054909150600160a060020a03898116911614156118c057808584815181106118af57fe5b602090810290910101526001909201915b600190910190611843565b8496505b505050505050919050565b60006118e46138ed565b600154600090819060a060020a900460ff161561190057600080fd5b6012544290111561191057600080fd5b600089815260046020526040902054600160a060020a0316935083151561193657600080fd5b61193f89613168565b925061194c848a85613312565b9150348290101561195c57600080fd5b61196784338b61303d565b887f494fb6227df1321e7605ad3dbe7f91fa4bb839754feeb2e2dcdb0a4c5cfc7fc7898989896040518080602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b838110156119d65780820151838201526020016119be565b50505050905090810190601f168015611a035780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b83811015611a39578082015183820152602001611a21565b50505050905090810190601f168015611a665780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b83811015611a9c578082015183820152602001611a84565b50505050905090810190601f168015611ac95780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015611aff578082015183820152602001611ae7565b50505050905090810190601f168015611b2c5780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390a2611b4882611f55565b60008a81526010602090815260408083209390935560119052205460ff161515611b86576000898152601160205260409020805460ff191660011790555b81340390506000811115611bc557600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515611bc557600080fd5b505050505050505050565b60005433600160a060020a03908116911614611beb57600080fd5b60015460a060020a900460ff161515611c0357600080fd5b6001805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60155460a060020a900460ff1681565b611c676138ed565b60015460a060020a900460ff1615611c7e57600080fd5b6001604051805910611c8d5750595b908082528060200260200182016040525090508681600081518110611cae57fe5b60209081029091010152611cc68187878787876125c0565b50505050505050565b60008181526007602052604081205460049060ff1615611ced575060645b6000838152600f6020526040902054611d0c908263ffffffff6132cd16565b9392505050565b60025433600160a060020a03908116911614611d2e57600080fd5b600160a060020a039091166000908152600e6020526040902055565b60015460a060020a900460ff1615611d6157600080fd5b6115538282602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405260008152611c5f565b60005433600160a060020a03908116911614611dc857600080fd5b600160a060020a0381161515611ddd57600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b60015433600160a060020a03908116911614611e1a57600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60076020526000908152604090205460ff1681565b6000806000806000611ea687612283565b8610611eb157600080fd5b60009350611ebd612838565b9250600091505b82821015611f45576003805483908110611eda57fe5b60009182526020808320600880840490910154920660049081026101000a90920463ffffffff16808452919052604090912054909150600160a060020a0388811691161415611f3a5785841415611f3357809450611f45565b6001909301925b600190910190611ec4565b5050505092915050565b60085481565b600066b1a2bc2ec50000821015611f70575060028102611201565b6702c68af0bb140000821015611f8f57606460aa83025b049050611201565b6706f05b59d3b20000821015611faa57606460968302611f87565b611fcc6064611fc084607d63ffffffff6132cd16565b9063ffffffff6133eb16565b9050611201565b60015460a060020a900460ff1615611fea57600080fd5b611ff4338661301d565b1515611fff57600080fd5b61200c8585858585613402565b5050505050565b60015460a060020a900460ff1681565b600160a060020a03331660009081526009602052604081205490811161204857600080fd5b600160a060020a0333166000818152600960205260408082209190915560088054849003905582156108fc0290839051600060405180830381858888f1935050505015156112b857600080fd5b60038054829081106120a357fe5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b600081815260046020526040902054600160a060020a031680151561120157600080fd5b600d5481565b600a5481565b60025433600160a060020a0390811691161461211857600080fd5b806107d01115801561212c57506130d48111155b151561213757600080fd5b600c55565b60008061214883611332565b151561215357600080fd5b50506201000080820490810290910391565b60005433600160a060020a0390811691161461218057600080fd5b60015460a060020a900460ff161561219757600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b6122006138ed565b600380548060200260200160405190810160405280929190818152602001828054801561227857602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff168152602001906004019060208260030104928301926001038202915080841161223b5790505b505050505090505b90565b600160a060020a031660009081526006602052604090205490565b6000600a548210158015611d0c57506122b683611ccf565b8211159392505050565b6122c86138ed565b60408051908101604052600381527f44575000000000000000000000000000000000000000000000000000000000006020820152919050565b600c5481565b60006201000083108015611d0c575050620100009010919050565b61232a6138ed565b60015460a060020a900460ff161561234157600080fd5b60016040518059106123505750595b90808252806020026020018201604052509050818160008151811061237157fe5b6020908102909101015261131e8382611557565b60106020526000908152604090205481565b61239f6138ed565b60015460a060020a900460ff16156123b657600080fd5b60016040518059106123c55750595b9080825280602002602001820160405250905081816000815181106123e657fe5b6020908102909101015261155381612d6c565b60096020526000908152604090205481565b6124136138ed565b60008061241e6138ed565b600061242986611332565b151561243457600080fd5b61243d8661213c565b93509350606060405190810160405280602281526020017f68747470733a2f2f64776f726c642e696f2f706c6f742f78787878782f78787881526020017f78780000000000000000000000000000000000000000000000000000000000008152509450849150600090505b60058110156125b757600a81600a0a858115156124c157fe5b048115156124cb57fe5b066030017f0100000000000000000000000000000000000000000000000000000000000000028282601b038151811061250057fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a81600a0a8481151561254057fe5b0481151561254a57fe5b066030017f01000000000000000000000000000000000000000000000000000000000000000282826021038151811061257f57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506001016124a8565b50505050919050565b600080600080600080600080600160149054906101000a900460ff161515156125e857600080fd5b8d51600160a060020a0333166000908152600e602052604081205491995090111561269157600160a060020a0333166000908152600e60205260409020548890111561265457600160a060020a0333166000908152600e6020526040812080548a90039055965061268c565b600160a060020a0333166000908152600e602052604081208054919055600a5490965061268990878a0363ffffffff6132cd16565b96505b6126a7565b600a546126a4908963ffffffff6132cd16565b96505b60035494506126c08e516003549063ffffffff61330316565b6126cb6003826138ff565b50600093505b8d518410156127db578d84815181106126e657fe5b9060200190602002015192506126fb83611332565b151561270657600080fd5b600083815260046020526040902054600160a060020a03161561272857600080fd5b82600385870181548110151561273a57fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff1602179055506127796000338561303d565b612786838d8d8d8d613402565b61278f836135e1565b91506127a1878363ffffffff61330316565b600a549097506127b7908363ffffffff61330316565b6000848152600f60205260409020556127d0838e612df6565b6001909301926126d1565b34879010156127e957600080fd5b8634039050600081111561282857600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050151561282857600080fd5b5050505050505050505050505050565b60035490565b600f6020526000908152604090205481565b60005433600160a060020a0390811691161461286b57600080fd5b60015460a060020a900460ff16151561288357600080fd5b60178054600160a060020a031916600160a060020a0383161790557f450db8da6efbe9c22f2347f7c2021231df1fc58d3ae9a2fa75d39fa44619930581604051600160a060020a03909116815260200160405180910390a150565b600160a060020a03166000908152600e602052604090205490565b600b5481565b600080548190819081908190819033600160a060020a0390811691161461292557600080fd5b60015460a060020a900460ff16151561293d57600080fd5b60155460a060020a900460ff161561295457600080fd5b601354600160a060020a031663c34588ba6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561299c57600080fd5b6102c65a03f115156129ad57600080fd5b50505060405180519050955060165494505b85851080156129d15750866016540185105b15612d1a57601354600160a060020a03166361bf49ee8660006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515612a2757600080fd5b6102c65a03f11515612a3857600080fd5b50505060405180519050935083600386815481101515612a5457fe5b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff160217905550601360009054906101000a9004600160a060020a0316600160a060020a0316636352211e856000604051602001526040518263ffffffff1660e060020a028152600401808263ffffffff168152602001915050602060405180830381600087803b1515612af357600080fd5b6102c65a03f11515612b0457600080fd5b5050506040518051601454909450600160a060020a03808616911614159050612bc257601454600160a060020a03166378bd793585600060405160a001526040518263ffffffff1660e060020a028152600401808263ffffffff16815260200191505060a060405180830381600087803b1515612b8057600080fd5b6102c65a03f11515612b9157600080fd5b505050604051805190602001805190602001805190602001805190602001805150939650869550612c6e9350505050565b601554600160a060020a0384811691161415612c6e57601554600160a060020a03166378bd793585600060405160a001526040518263ffffffff1660e060020a028152600401808263ffffffff16815260200191505060a060405180830381600087803b1515612c3157600080fd5b6102c65a03f11515612c4257600080fd5b505050604051805190602001805190602001805190602001805190602001805150939650869550505050505b612c806000848663ffffffff1661303d565b5063ffffffff83166000818152600f60209081526040808320662c68af0bb14000905560109091529081902066b1a2bc2ec500009081905591907fa54315fd6a6da96c81133ae36a774aabd6d6aba6a6e53df08e7d5065a89b8b759083905190815260200160405180910390a263ffffffff84166000908152600760205260409020805460ff1916600190811790915594909401936129bf565b601680548801905584861415611cc6576015805474ff0000000000000000000000000000000000000000191660a060020a17905550505050505050565b60125481565b600154600160a060020a031681565b6001546000908190819060a060020a900460ff1615612d8a57600080fd5b600092505b83518310156115fa57838381518110612da457fe5b90602001906020020151600081815260046020526040902054909250600160a060020a03169050612dd533836136c6565b1515612de057600080fd5b612deb81338461303d565b600190920191612d8f565b60015460a060020a900460ff1615612e0d57600080fd5b612e17338361301d565b1515612e2257600080fd5b60008281526011602052604090205460ff1615612e3e57600080fd5b612e48828261229e565b1515612e5357600080fd5b6000828152601060205260409081902082905582907fa54315fd6a6da96c81133ae36a774aabd6d6aba6a6e53df08e7d5065a89b8b759083905190815260200160405180910390a25050565b60025433600160a060020a03908116911614612eba57600080fd5b80600011158015612ecd57506113888111155b1515612ed857600080fd5b600d55565b60025460009033600160a060020a03908116911614612efb57600080fd5b50600854600254600160a060020a033081163192909203911681156108fc0282604051600060405180830381858888f1935050505015156112b857600080fd5b6000612f5b620186a0611fc0600b54600a546132cd90919063ffffffff16565b905090565b60005433600160a060020a03908116911614612f7b57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b82600160a060020a031663a9059cbb838360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515612ffa57600080fd5b6102c65a03f1151561300b57600080fd5b50505060405180519050151561131e57fe5b600090815260046020526040902054600160a060020a0391821691161490565b600160a060020a03808316600081815260066020908152604080832080546001019055858352600490915290208054600160a060020a03191690911790558316156130be57600160a060020a03831660009081526006602090815260408083208054600019019055838352600590915290208054600160a060020a03191690555b8082600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600081815260056020526040908190208054600160a060020a031916600160a060020a03858116918217909255839290918616907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925905160405180910390a4505050565b6131706138ed565b600080600061317d6138ed565b600080600061318a6138ed565b60006131958b61213c565b985098506000965060086040518059106131ac5750595b9080825280602002602001820160405250955060001994505b6001851361325d5760001993505b6001841361325257841580156131e7575083155b156131f157613247565b613209620100008a870106620100008a8701066116ae565b600081815260046020526040902054909350600160a060020a031615613247578286888151811061323657fe5b602090810290910101526001909601955b6001909301926131d3565b6001909401936131c5565b8660405180591061326b5750595b90808252806020026020018201604052509150600090505b868110156132bf5785818151811061329757fe5b906020019060200201518282815181106132ad57fe5b60209081029091010152600101613283565b509998505050505050505050565b6000808315156132e057600091506132fc565b508282028284828115156132f057fe5b04146132f857fe5b8091505b5092915050565b6000828201838110156132f857fe5b60008281526010602052604081205481808080806133338851611703612f3b565b9450613345868663ffffffff61330316565b9650613363620186a0611fc0600c54896132cd90919063ffffffff16565b9350613381620186a0611fc0600d54896132cd90919063ffffffff16565b9250613393868463ffffffff6136e616565b91506000885111156133d0576133af828563ffffffff6136e616565b915087516133c3868663ffffffff61330316565b8115156133cc57fe5b0490505b6133de8a8a8a85858c6136f8565b5050505050509392505050565b60008082848115156133f957fe5b04949350505050565b847f494fb6227df1321e7605ad3dbe7f91fa4bb839754feeb2e2dcdb0a4c5cfc7fc7858585856040518080602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b83811015613471578082015183820152602001613459565b50505050905090810190601f16801561349e5780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b838110156134d45780820151838201526020016134bc565b50505050905090810190601f1680156135015780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b8381101561353757808201518382015260200161351f565b50505050905090810190601f1680156135645780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b8381101561359a578082015183820152602001613582565b50505050905090810190601f1680156135c75780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390a25050505050565b60006135eb6138ed565b6000806135f785613168565b9250613601612f3b565b915060009350600090505b82518110156117245733600160a060020a03166004600085848151811061362f57fe5b906020019060200201518152602081019190915260400160002054600160a060020a0316146136be57613668848363ffffffff61330316565b93506136be336004600086858151811061367e57fe5b906020019060200201518152602081019190915260400160002054600160a060020a0316878685815181106136af57fe5b90602001906020020151613830565b60010161360c565b600090815260056020526040902054600160a060020a0391821691161490565b6000828211156136f257fe5b50900390565b6000808688600160a060020a031633600160a060020a03167f904da3d77bc80625b1aa2389e487e0ae13ce5df85c78a700fbd3dcadcf94d539888761373c89611f55565b60405180848152602001838152602001828152602001935050505060405180910390a46137698886613891565b600091505b8551821015613826576004600087848151811061378757fe5b906020019060200201518152602081019190915260400160002054600160a060020a031690508582815181106137b957fe5b9060200190602002015181600160a060020a031633600160a060020a03167f4e5497ded03fbd794bb93a88c0ba752079649608a1573063bfe40bf692be43a58a8860405191825260208201526040908101905180910390a461381b8185613891565b60019091019061376e565b5050505050505050565b600061383a612f3b565b90508184600160a060020a031686600160a060020a03167f189e688a8453ad6845d445a3e7ec07c79239cfbca0fb99fbbe0233af72475b76868560405191825260208201526040908101905180910390a461200c84825b600160a060020a0382166000908152600960205260409020546138ba908263ffffffff61330316565b600160a060020a0383166000908152600960205260409020556008546138e6908263ffffffff61330316565b6008555050565b60206040519081016040526000815290565b81548183558181151161131e5760008381526020902061131e916122809160086007928301819004820192860104015b80821115613943576000815560010161392f565b5090565b60138054600160a060020a03808616600160a060020a0319928316179283905560148054868316908416179055601580548583169316929092179091556001805474ff0000000000000000000000000000000000000000191660a060020a1790556000911663c34588ba82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156139e757600080fd5b6102c65a03f115156139f857600080fd5b5050506040518051915081905061200c6003826138ff5600a165627a7a72305820bc2d6a40b8c993c2bf29b30e2c63ee3c95740cec38ec2a94734649f1063a9e910029

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

000000000000000000000000d4df33983ff82ce4469c6ea3cff390403e58d90a000000000000000000000000621ad3562f5141c4a0e7cad958b8b524d356332b0000000000000000000000005301f1ec2f48f86bbd5291dfd7998a3d733a3245000000000000000000000000000000000000000000000000000000000000000f

-----Decoded View---------------
Arg [0] : originalContractAddress (address): 0xd4Df33983FF82CE4469c6ea3CFf390403E58d90A
Arg [1] : originalSaleAuctionAddress (address): 0x621aD3562F5141c4A0E7Cad958b8b524d356332B
Arg [2] : originalRentAuctionAddress (address): 0x5301F1EC2F48F86bbd5291DfD7998a3d733A3245
Arg [3] : buyoutsEnabledAfterHours (uint256): 15

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d4df33983ff82ce4469c6ea3cff390403e58d90a
Arg [1] : 000000000000000000000000621ad3562f5141c4a0e7cad958b8b524d356332b
Arg [2] : 0000000000000000000000005301f1ec2f48f86bbd5291dfd7998a3d733a3245
Arg [3] : 000000000000000000000000000000000000000000000000000000000000000f


Swarm Source

bzzr://bc2d6a40b8c993c2bf29b30e2c63ee3c95740cec38ec2a94734649f1063a9e91
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.