Contract 0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc

 

TxHash Block Age From To Value [TxFee]
0xf3205b4968842d6f51222b61e51cdabe0715ae07e77d133b650bab6bb16fd64372130273 days 18 hrs ago0x563153823d702516f92fc24edd9358d6973f60f9  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0xb784efa9277b66337fb98e08ca9e6671fc274d4973bf64c2488f0780dff7da0472130273 days 18 hrs ago0x563153823d702516f92fc24edd9358d6973f60f9  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0x145ef9d64cce9887476b3266f3adf86723280ac6db237bd109c82bea40e2183d72130273 days 18 hrs ago0x563153823d702516f92fc24edd9358d6973f60f9  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0x1bbe0322bbf03401915051a6b811c5da4da672e5a2f7c013525d8a2c5b7c25da72047035 days 17 hrs ago0xd81be2dd1fe5e3f9aada3ffea6d64e62506edacc  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0x4be1b45a2c8f8505c7eabf75e7cc96291f79c23f7e39707e124510b0299a557d72046975 days 17 hrs ago0xd81be2dd1fe5e3f9aada3ffea6d64e62506edacc  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0x92480760ea9566e9fdf001713cc60600c4f2cfe51e3d35d5f01b0a7e63aa7bb9716809313 days 7 hrs ago0x268d16707106bbd6fb748a1cc18d3c349de8cdb0  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0x4c60c17dbb3cbc8f17a12cd6a074883080f5dfd07ab44edb8d648726f8aa5d07713774819 days 12 hrs ago0x44aa2cce7ed479d19ab3fc5ffe8e5c2f1011bb54  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0.200752314814814 Ether0.00065184
0xaeaa422ef21366dfea9934016cc88f78d473dc3776c743e84e37ab3946924567704650036 days 12 hrs ago0xa2381223639181689cd6c46d38a1a4884bb6d83c  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0x1f168acc27d961e634935f8e6b3d1e4c96631a3128da855b017511fad3f41df9704649936 days 12 hrs ago0xa2381223639181689cd6c46d38a1a4884bb6d83c  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000340362
0xbd832027daf98901a9a3ad13fd0b3aba80a1acc43e8462512bc94d71564b636b695875251 days 19 hrs ago0xcecbe670c11d4d28678955f23e0d2d708d79c893  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0.197 Ether0.000484196
0x7c4ba5ea33bc1d8369fb4f8c4fcad2c31e2cd064ba580837c549a2031ae4e7db687222366 days 8 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000160506
0xa4d7cccb75189a425eb2d4543d846ea5a585de6bbfeee48234a2a28ee15b8ce1684429070 days 23 hrs ago0x3aa80b5a79854cdbb7b65f6c851946ce1d781c7c  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0.13 Ether0.000605245
0x180fbfbc4f87693a385c5cec0c43bceccfdc30b6a955e269dc48a66aaa9063aa682114074 days 19 hrs ago0xbe87ae75926aaf6765984b6a454aa77e095dec6c  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.00028901165
0x6e4e38ee9dd5312787fc6e27491c6422b1ba7f774eb4280ffffc2affe3097d41678268181 days 3 hrs ago0x31400d4673f4176df400424fef2b37ff4d9058d0  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0.25 Ether0.000484196
0xd875e79aabe0dd1aeb99c80cb88825d97773ce90beb13606574569db4f10faae6632619105 days 18 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000160506
0xdadebb3d008e5ae0af6185ab35f1b6632a2e3cee6b6ba0f46b477cf5986e6dfb6632613105 days 18 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000133755
0x8ba31bc58ac2b5d13834c4b7e5ec9d9e3436f508b2f24e6f18b3825cd5322b716606192110 days 2 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000160506
0x28db4fcda59b430e4a2d65912f76761ab8289253643fc35c64a267a09d1b027f6606164110 days 2 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000160506
0x78ec40a0a3676952d3afd3ec8444fb7e92dcc4c506a03360776183ea784380836606162110 days 2 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000160506
0xa8a807e229b648cf819b9ad5d17dc27b8bb5147029c4930478b5c80349cf954a6605998110 days 3 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.00056711
0x04d2e078887ab3941f3939496e2aa7b51a9a5293b127731bc10d2875c5155fe66605998110 days 3 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.00056711
0x9583340ba476793744682513f5f9b101d46577c19e50cacd735f3b06590b21896605998110 days 3 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.000133755
0x0690ebc2552ec4bd1d955a1678d90953be759255a30862ddba502da4792a6d5a6605919110 days 3 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.00056711
0x580299105055f33612cba0c14e006076c13bdf197bffdf7ef24d3fa9e16e419d6605915110 days 3 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.00056711
0x2078f6acea1fb4262ebcc306cd6c077edc79411bbc2b566f2fa3e3d4971686c46605910110 days 3 hrs ago0x80762e0955b2929ca879696d1e2011a9adb774c7  IN   0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0 Ether0.00056711
[ Download CSV Export 

Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0xbd832027daf98901a9a3ad13fd0b3aba80a1acc43e8462512bc94d71564b636b695875251 days 19 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x563153823d702516f92fc24edd9358d6973f60f90.197 Ether
0xa4d7cccb75189a425eb2d4543d846ea5a585de6bbfeee48234a2a28ee15b8ce1684429070 days 23 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x563153823d702516f92fc24edd9358d6973f60f90.13 Ether
0x180fbfbc4f87693a385c5cec0c43bceccfdc30b6a955e269dc48a66aaa9063aa682114074 days 19 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xbe87ae75926aaf6765984b6a454aa77e095dec6c231.940489969135802475 Ether
0x6e4e38ee9dd5312787fc6e27491c6422b1ba7f774eb4280ffffc2affe3097d41678268181 days 3 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xa2381223639181689cd6c46d38a1a4884bb6d83c0.25 Ether
0xe3ac0830483b89d8668bd9a1a94a89f8cd9a56fc82779438b93fa90e13824c896567292116 days 11 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x034bdad53890f6c0064527b506435aac6cde635a0.45 Ether
0x21ae6981e616b6a7c3d2f22f28278a20a37eef7824341807ddc4f867d22d30926370701148 days 13 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xa2381223639181689cd6c46d38a1a4884bb6d83c0.2 Ether
0x6c3b9eda009096fed27b7247f07c6b77cff05edd2e5b786cdcbc4ff87a2e35576305426159 days 8 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x87fc0cdb581f84456c02f20ec1a844d95803c4370.002623456790123457 Ether
0x6c3b9eda009096fed27b7247f07c6b77cff05edd2e5b786cdcbc4ff87a2e35576305426159 days 8 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc8.969174382716049383 Ether
0x0fa24067ccb0ca41293dfccb0565421ccc8b109eab397b341724eadac226026f6303001159 days 18 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x3a22282cbd2715e9d302b4a4ab0d6a117d8438b60.065108024691358024 Ether
0x0fa24067ccb0ca41293dfccb0565421ccc8b109eab397b341724eadac226026f6303001159 days 18 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc10.314891975308641976 Ether
0x53e3f3c57215a365e29b5651ac440e3586b781f30e052037d206357857066c016302220159 days 21 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x6af00393dd4577b78d913c3619aaec8a0f58fc4a0.002623456790123456 Ether
0x53e3f3c57215a365e29b5651ac440e3586b781f30e052037d206357857066c016302220159 days 21 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc10.835956790123456791 Ether
0x81c4885b0abc53aef89a5fe3ec1351e7f4abf9ed472bda35c623a1c60830b5b86301880159 days 22 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xbd40e2e91543ca70e133cba040040f29f83160850.002507716049382716 Ether
0x81c4885b0abc53aef89a5fe3ec1351e7f4abf9ed472bda35c623a1c60830b5b86301880159 days 22 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc11.005555555555555556 Ether
0x905bedcddef05187759b78bffa7b66916a4b314d9812c1d60086cfd2044f6f4d6301871159 days 22 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xbd40e2e91543ca70e133cba040040f29f83160850.003896604938271605 Ether
0x905bedcddef05187759b78bffa7b66916a4b314d9812c1d60086cfd2044f6f4d6301871159 days 22 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc10.972723765432098766 Ether
0x12a3934803c3ffea35599fbc7ca8de5bc8608fb89138cbb80518178a0d7e316c6301524159 days 23 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xbd40e2e91543ca70e133cba040040f29f83160850.005015432098765432 Ether
0x12a3934803c3ffea35599fbc7ca8de5bc8608fb89138cbb80518178a0d7e316c6301524159 days 23 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc11.25925925925925926 Ether
0x6946373a6266c2cc4d530d6c6f61b62cc2ea70c74a0d318a97bd449793e3b14a6300347160 days 4 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xf902d068920234957d2908b8b0156e61c0bea2c20.009645061728395062 Ether
0x6946373a6266c2cc4d530d6c6f61b62cc2ea70c74a0d318a97bd449793e3b14a6300347160 days 4 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc11.922299382716049383 Ether
0x8b5d57742589d03afd0ed9fcbae648dd4fd58d533f2052991cf46457e4421eb16297784160 days 15 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x411effde43d7406b4b5b680e0b715f41596845ea0.003549382716049382 Ether
0x8b5d57742589d03afd0ed9fcbae648dd4fd58d533f2052991cf46457e4421eb16297784160 days 15 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc13.304861111111111112 Ether
0x3d425b8a82509c45d464fa0d0ba3c44c1f871c95de2768d771648cfc567a26d96296750160 days 19 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x563153823d702516f92fc24edd9358d6973f60f90.249 Ether
0x4b3713398176d78c3af02cc99b013812a2a88e8a41d6d504175de4c58dacfa9f6296498160 days 20 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0x3aa80b5a79854cdbb7b65f6c851946ce1d781c7c0.003202160493827161 Ether
0x4b3713398176d78c3af02cc99b013812a2a88e8a41d6d504175de4c58dacfa9f6296498160 days 20 hrs ago0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc0xc19b4b5f76d8148bcc78329bd37a0ea2513440bc14.0125 Ether
[ Download CSV Export 
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: SaleManager
Compiler Version: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.23;

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

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

    uint256 c = _a * _b;
    require(c / _a == _b);

    return c;
  }

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

    return c;
  }

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

    return c;
  }

  /**
  * @dev Adds two numbers, reverts on overflow.
  */
  function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
    uint256 c = _a + _b;
    require(c >= _a);

    return c;
  }
}

/* Controls game play state and access rights for game functions
 * @title Operational Control
 * @author Fazri Zubair & Farhan Khwaja (Lucid Sight, Inc.)
 * Inspired and adapted from contract created by OpenZeppelin
 * Ref: https://github.com/OpenZeppelin/zeppelin-solidity/
 */
contract OperationalControl {
    // Facilitates access & control for the game.
    // Roles:
    //  -The Game Managers (Primary/Secondary): Has universal control of all game elements (No ability to withdraw)
    //  -The Banker: The Bank can withdraw funds and adjust fees / prices.

    /// @dev Emited when contract is upgraded
    event ContractUpgrade(address newContract);

    // The addresses of the accounts (or contracts) that can execute actions within each roles.
    address public gameManagerPrimary;
    address public gameManagerSecondary;
    address public bankManager;

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

    /// @dev Operation modifiers for limiting access
    modifier onlyGameManager() {
        require(msg.sender == gameManagerPrimary || msg.sender == gameManagerSecondary);
        _;
    }

    /// @dev Operation modifiers for limiting access to only Banker
    modifier onlyBanker() {
        require(msg.sender == bankManager);
        _;
    }

    /// @dev Operation modifiers for access to any Manager
    modifier anyOperator() {
        require(
            msg.sender == gameManagerPrimary ||
            msg.sender == gameManagerSecondary ||
            msg.sender == bankManager
        );
        _;
    }

    /// @dev Assigns a new address to act as the GM.
    function setPrimaryGameManager(address _newGM) external onlyGameManager {
        require(_newGM != address(0));

        gameManagerPrimary = _newGM;
    }

    /// @dev Assigns a new address to act as the GM.
    function setSecondaryGameManager(address _newGM) external onlyGameManager {
        require(_newGM != address(0));

        gameManagerSecondary = _newGM;
    }

    /// @dev Assigns a new address to act as the Banker.
    function setBanker(address _newBK) external onlyBanker {
        require(_newBK != address(0));

        bankManager = _newBK;
    }

    /*** Pausable functionality adapted from OpenZeppelin ***/

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

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

    /// @dev Called by any Operator role to pause the contract.
    /// Used only if a bug or exploit is discovered (Here to limit losses / damage)
    function pause() external onlyGameManager whenNotPaused {
        paused = true;
    }

    /// @dev Unpauses the smart contract. Can only be called by the Game Master
    /// @notice This is public rather than external so it can be called by derived contracts. 
    function unpause() public onlyGameManager whenPaused {
        // can't unpause if contract was upgraded
        paused = false;
    }
}

/* @title Interface for MLBNFT Contract
 * @author Fazri Zubair & Farhan Khwaja (Lucid Sight, Inc.)
 */
contract MLBNFT {
    function exists(uint256 _tokenId) public view returns (bool _exists);
    function ownerOf(uint256 _tokenId) public view returns (address _owner);
    function approve(address _to, uint256 _tokenId) public;
    function setApprovalForAll(address _to, bool _approved) public;
    function transferFrom(address _from, address _to, uint256 _tokenId) public;
    function safeTransferFrom(address _from, address _to, uint256 _tokenId) public;
    function createPromoCollectible(uint8 _teamId, uint8 _posId, uint256 _attributes, address _owner, uint256 _gameId, uint256 _playerOverrideId, uint256 _mlbPlayerId) external returns (uint256);
    function createSeedCollectible(uint8 _teamId, uint8 _posId, uint256 _attributes, address _owner, uint256 _gameId, uint256 _playerOverrideId, uint256 _mlbPlayerId) public returns (uint256);
    function checkIsAttached(uint256 _tokenId) public view returns (uint256);
    function getTeamId(uint256 _tokenId) external view returns (uint256);
    function getPlayerId(uint256 _tokenId) external view returns (uint256 playerId);
    function getApproved(uint256 _tokenId) public view returns (address _operator);
    function isApprovedForAll(address _owner, address _operator) public view returns (bool);
}

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 *  from ERC721 asset contracts.
 */
contract ERC721Receiver {
    /**
    * @dev Magic value to be returned upon successful reception of an NFT
    *  Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`,
    *  which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
    */
    bytes4 public constant ERC721_RECEIVED = 0x150b7a02;

    /**
    * @notice Handle the receipt of an NFT
    * @dev The ERC721 smart contract calls this function on the recipient
    *  after a `safetransfer`. This function MAY throw to revert and reject the
    *  transfer. This function MUST use 50,000 gas or less. Return of other
    *  than the magic value MUST result in the transaction being reverted.
    *  Note: the contract address is always the message sender.
    * @param _from The sending address
    * @param _tokenId The NFT identifier which is being transfered
    * @param _data Additional data with no specified format
    * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    */
    function onERC721Received(
        address _operator,
        address _from,
        uint256 _tokenId,
        bytes _data
    )
        public
        returns(bytes4);
}

contract ERC721Holder is ERC721Receiver {
    function onERC721Received(address,address, uint256, bytes) public returns(bytes4) {
        return ERC721_RECEIVED;
    }
}

/* Contains models, variables, and internal methods for the ERC-721 sales.
 * @title Sale Base
 * @author Fazri Zubair & Farhan Khwaja (Lucid Sight, Inc.)
 */
contract SaleBase is OperationalControl, ERC721Holder {
    using SafeMath for uint256;
    
    /// EVENTS 

    event SaleCreated(uint256 tokenID, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt);
    event TeamSaleCreated(uint256[9] tokenIDs, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt);
    event SaleWinner(uint256 tokenID, uint256 totalPrice, address winner);
    event TeamSaleWinner(uint256[9] tokenIDs, uint256 totalPrice, address winner);
    event SaleCancelled(uint256 tokenID, address sellerAddress);
    event EtherWithdrawed(uint256 value);

    /// STORAGE

    /**
     * @dev        Represents an Sale on MLB CryptoBaseball (ERC721)
     */
    struct Sale {
        // Current owner of NFT (ERC721)
        address seller;
        // Price (in wei) at beginning of sale
        uint256 startingPrice;
        // Price (in wei) at end of sale
        uint256 endingPrice;
        // Duration (in seconds) of sale
        uint256 duration;
        // Time when sale started
        // NOTE: 0 if this sale has been concluded
        uint256 startedAt;
        // ERC721 AssetID
        uint256[9] tokenIds;
    }

    /**
     * @dev        Reference to contract tracking ownership & asset details
     */
    MLBNFT public nonFungibleContract;

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

    // Map from token to their corresponding sale.
    mapping (uint256 => Sale) tokenIdToSale;

    /**
     * @dev        Returns true if the claimant owns the token.
     * @param      _claimant  The claimant
     * @param      _tokenId   The token identifier
     */
    function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
        return (nonFungibleContract.ownerOf(_tokenId) == _claimant);
    }

    /**
     * @dev        Internal function to ESCROW
     * @notice     Escrows the ERC721 Token, assigning ownership to this contract. Throws if the escrow fails.
     * @param      _owner    The owner
     * @param      _tokenId  The token identifier
     */
    function _escrow(address _owner, uint256 _tokenId) internal {
        nonFungibleContract.safeTransferFrom(_owner, this, _tokenId);
    }

    /**
     * @dev        Internal Transfer function
     * @notice     Transfers an ERC721 Token owned by this contract to another address. Returns true if the transfer succeeds.
     * @param      _owner     The owner
     * @param      _receiver  The receiver
     * @param      _tokenId   The token identifier
     */
    function _transfer(address _owner, address _receiver, uint256 _tokenId) internal {
        nonFungibleContract.transferFrom(_owner, _receiver, _tokenId);
    }

    /**
     * @dev        Internal Function to add Sale, which duration check (atleast 1 min duration required)
     * @notice     Adds an sale to the list of open sales. Also fires the SaleCreated event.
     * @param      _tokenId  The token identifier
     * @param      _sale     The sale
     */
    function _addSale(uint256 _tokenId, Sale _sale) internal {
        // Require that all sales have a duration of
        // at least one minute.
        require(_sale.duration >= 1 minutes);
        
        tokenIdToSale[_tokenId] = _sale;

        emit SaleCreated(
            uint256(_tokenId),
            uint256(_sale.startingPrice),
            uint256(_sale.endingPrice),
            uint256(_sale.duration),
            uint256(_sale.startedAt)
        );
    }

    /**
     * @dev        Internal Function to add Team Sale, which duration check (atleast 1 min duration required)
     * @notice     Adds an sale to the list of open sales. Also fires the SaleCreated event.
     * @param      _tokenIds  The token identifiers
     * @param      _sale      The sale
     */
    function _addTeamSale(uint256[9] _tokenIds, Sale _sale) internal {
        // Require that all sales have a duration of
        // at least one minute.
        require(_sale.duration >= 1 minutes);
        
        for(uint ii = 0; ii < 9; ii++) {
            require(_tokenIds[ii] != 0);
            require(nonFungibleContract.exists(_tokenIds[ii]));

            tokenIdToSale[_tokenIds[ii]] = _sale;
        }

        emit TeamSaleCreated(
            _tokenIds,
            uint256(_sale.startingPrice),
            uint256(_sale.endingPrice),
            uint256(_sale.duration),
            uint256(_sale.startedAt)
        );
    }

    /**
     * @dev        Facilites Sale cancellation. Also removed the Sale from the array
     * @notice        Cancels an sale (given the collectibleID is not 0). SaleCancelled Event
     * @param      _tokenId  The token identifier
     * @param      _seller   The seller
     */
    function _cancelSale(uint256 _tokenId, address _seller) internal {
        Sale memory saleItem = tokenIdToSale[_tokenId];

        //Check for team sale
        if(saleItem.tokenIds[1] != 0) {
            for(uint ii = 0; ii < 9; ii++) {
                _removeSale(saleItem.tokenIds[ii]);
                _transfer(address(this), _seller, saleItem.tokenIds[ii]);
            }
            emit SaleCancelled(_tokenId, _seller);
        } else {
            _removeSale(_tokenId);
            _transfer(address(this), _seller, _tokenId);
            emit SaleCancelled(_tokenId, _seller);
        }
    }

    /**
     * @dev        Computes the price and transfers winnings. Does NOT transfer ownership of token.
     * @param      _tokenId    The token identifier
     * @param      _bidAmount  The bid amount
     */
    function _bid(uint256 _tokenId, uint256 _bidAmount)
        internal
        returns (uint256)
    {
        // Get a reference to the sale struct
        Sale storage _sale = tokenIdToSale[_tokenId];
        uint256[9] memory tokenIdsStore = tokenIdToSale[_tokenId].tokenIds;
        // Explicitly check that this sale is currently live.
        // (Because of how Ethereum mappings work, we can't just count
        // on the lookup above failing. An invalid _tokenId will just
        // return an sale object that is all zeros.)
        require(_isOnSale(_sale));

        // Check that the bid is greater than or equal to the current price
        uint256 price = _currentPrice(_sale);
        require(_bidAmount >= price);

        // Grab a reference to the seller before the sale  struct
        // gets deleted.
        address seller = _sale.seller;

        if(tokenIdsStore[1] > 0) {
            for(uint ii = 0; ii < 9; ii++) {
                // The bid is good! Remove the sale before sending the fees
                // to the sender so we can't have a reentrancy attack.
                _removeSale(tokenIdsStore[ii]);
            }
        } else {
            // The bid is good! Remove the sale before sending the fees
            // to the sender so we can't have a reentrancy attack.
            _removeSale(_tokenId);
        }

        

        // Transfer proceeds to seller (if there are any!)
        if (price > 0) {
            // Calculate the marketplace's cut.
            // (NOTE: _computeCut() is guaranteed to return a
            // value <= price, so this subtraction can't go negative.)
            uint256 marketsCut = _computeCut(price);
            uint256 sellerProceeds = price.sub(marketsCut);

            // NOTE: Doing a transfer() in the middle of a complex
            // method like this is generally discouraged because of
            // reentrancy attacks and DoS attacks if the seller is
            // a contract with an invalid fallback function. We explicitly
            // guard against reentrancy attacks by removing the sale
            // before calling transfer(), and the only thing the seller
            // can DoS is the sale of their own asset! (And if it's an
            // accident, they can call cancelSale(). )
            seller.transfer(sellerProceeds);
        }

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

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

        // Tell the world!
        // uint256 assetID, uint256 totalPrice, address winner, uint16 generation
        if(tokenIdsStore[1] > 0) {
            emit TeamSaleWinner(tokenIdsStore, price, msg.sender);
        } else {
            emit SaleWinner(_tokenId, price, msg.sender);
        }
        
        return price;
    }

    /**
     * @dev        Removes an sale from the list of open sales.
     * @param      _tokenId  The token identifier
     */
    function _removeSale(uint256 _tokenId) internal {
        delete tokenIdToSale[_tokenId];
    }

    /**
     * @dev        Returns true if the FT (ERC721) is on sale.
     * @param      _sale  The sale
     */
    function _isOnSale(Sale memory _sale) internal pure returns (bool) {
        return (_sale.startedAt > 0);
    }

    /** @dev Returns current price of an FT (ERC721) on sale. Broken into two
     *  functions (this one, that computes the duration from the sale
     *  structure, and the other that does the price computation) so we
     *  can easily test that the price computation works correctly.
     */
    function _currentPrice(Sale memory _sale)
        internal
        view
        returns (uint256)
    {
        uint256 secondsPassed = 0;

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

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

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

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

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

            return uint256(currentPrice);
        }
    }

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

/* Clock sales functions and interfaces
 * @title SaleManager
 * @author Fazri Zubair & Farhan Khwaja (Lucid Sight, Inc.)
 */
contract SaleManager is SaleBase {

    /// @dev MAPINGS
    mapping (uint256 => uint256[3]) public lastTeamSalePrices;
    mapping (uint256 => uint256) public lastSingleSalePrices;
    mapping (uint256 => uint256) public seedTeamSaleCount;
    uint256 public seedSingleSaleCount = 0;

    /// @dev CONSTANTS
    uint256 public constant SINGLE_SALE_MULTIPLIER = 35;
    uint256 public constant TEAM_SALE_MULTIPLIER = 12;
    uint256 public constant STARTING_PRICE = 10 finney;
    uint256 public constant SALES_DURATION = 1 days;

    bool public isBatchSupported = true;

    /**
     * @dev        Constructor creates a reference to the MLB_NFT Sale Manager contract
     */
    constructor() public {
        require(ownerCut <= 10000); // You can't collect more than 100% silly ;)
        require(msg.sender != address(0));
        paused = true;
        gameManagerPrimary = msg.sender;
        gameManagerSecondary = msg.sender;
        bankManager = msg.sender;
    }

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

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

    /** @dev Remove all Ether from the contract, which is the owner's cuts
     *  as well as any Ether sent directly to the contract address.
     *  Always transfers to the NFT (ERC721) contract, but can be called either by
     *  the owner or the NFT (ERC721) contract.
     */
    function _withdrawBalance() internal {
        // We are using this boolean method to make sure that even if one fails it will still work
        bankManager.transfer(address(this).balance);
    }


    /** @dev Reject all Ether from being sent here, unless it's from one of the
     *  contracts. (Hopefully, we can prevent user accidents.)
     *  @notice No tipping!
     */
    function() external payable {
        address nftAddress = address(nonFungibleContract);
        require(
            msg.sender == address(this) || 
            msg.sender == gameManagerPrimary ||
            msg.sender == gameManagerSecondary ||
            msg.sender == bankManager ||
            msg.sender == nftAddress
        );
    }

    /**
     * @dev        Creates and begins a new sale.
     * @param      _tokenId        The token identifier
     * @param      _startingPrice  The starting price
     * @param      _endingPrice    The ending price
     * @param      _duration       The duration
     * @param      _seller         The seller
     */
    function _createSale(
        uint256 _tokenId,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        address _seller
    )
        internal
    {
        Sale memory sale = Sale(
            _seller,
            _startingPrice,
            _endingPrice,
            _duration,
            now,
            [_tokenId,0,0,0,0,0,0,0,0]
        );
        _addSale(_tokenId, sale);
    }

    /**
     * @dev        Internal Function, helps in creating team sale
     * @param      _tokenIds       The token identifiers
     * @param      _startingPrice  The starting price
     * @param      _endingPrice    The ending price
     * @param      _duration       The duration
     * @param      _seller         The seller
     */
    function _createTeamSale(
        uint256[9] _tokenIds,
        uint256 _startingPrice,
        uint256 _endingPrice,
        uint256 _duration,
        address _seller)
        internal {

        Sale memory sale = Sale(
            _seller,
            _startingPrice,
            _endingPrice,
            _duration,
            now,
            _tokenIds
        );

        /// Add sale obj to all tokens
        _addTeamSale(_tokenIds, sale);
    }

    /** @dev            Cancels an sale that hasn't been won yet. Returns the MLBNFT (ERC721) to original owner.
     *  @notice         This is a state-modifying function that can be called while the contract is paused.
     */
    function cancelSale(uint256 _tokenId) external whenNotPaused {
        Sale memory sale = tokenIdToSale[_tokenId];
        require(_isOnSale(sale));
        address seller = sale.seller;
        require(msg.sender == seller);
        _cancelSale(_tokenId, seller);
    }

    /** @dev        Cancels an sale that hasn't been won yet. Returns the MLBNFT (ERC721) to original owner.
     *  @notice     This is a state-modifying function that can be called while the contract is paused. Can be only called by the GameManagers
     */
    function cancelSaleWhenPaused(uint256 _tokenId) external whenPaused onlyGameManager {
        Sale memory sale = tokenIdToSale[_tokenId];
        require(_isOnSale(sale));
        address seller = sale.seller;
        _cancelSale(_tokenId, seller);
    }

    /** 
     * @dev    Returns sales info for an CSLCollectibles (ERC721) on sale.
     * @notice Fetches the details related to the Sale
     * @param  _tokenId    ID of the token on sale
     */
    function getSale(uint256 _tokenId) external view returns (address seller, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt, uint256[9] tokenIds) {
        Sale memory sale = tokenIdToSale[_tokenId];
        require(_isOnSale(sale));
        return (
            sale.seller,
            sale.startingPrice,
            sale.endingPrice,
            sale.duration,
            sale.startedAt,
            sale.tokenIds
        );
    }

    /**
     * @dev        Returns the current price of an sale.
     * @param      _tokenId  The token identifier
     */
    function getCurrentPrice(uint256 _tokenId) external view returns (uint256) {
        Sale memory sale = tokenIdToSale[_tokenId];
        require(_isOnSale(sale));
        return _currentPrice(sale);
    }

    /** @dev Calculates the new price for Sale Item
     * @param   _saleType     Sale Type Identifier (0 - Single Sale, 1 - Team Sale)
     * @param   _teamId       Team Identifier
     */
    function _averageSalePrice(uint256 _saleType, uint256 _teamId) internal view returns (uint256) {
        uint256 _price = 0;
        if(_saleType == 0) {
            for(uint256 ii = 0; ii < 10; ii++) {
                _price = _price.add(lastSingleSalePrices[ii]);
            }
            _price = (_price.div(10)).mul(SINGLE_SALE_MULTIPLIER.div(10));
        } else {
            for (uint256 i = 0; i < 3; i++) {
                _price = _price.add(lastTeamSalePrices[_teamId][i]);
            }
        
            _price = (_price.div(3)).mul(TEAM_SALE_MULTIPLIER.div(10));
            _price = _price.mul(9);
        }

        return _price;
    }
    
    /**
     * @dev        Put a Collectible up for sale. Does some ownership trickery to create sale in one tx.
     * @param      _tokenId        The token identifier
     * @param      _startingPrice  The starting price
     * @param      _endingPrice    The ending price
     * @param      _duration       The duration
     * @param      _owner          Owner of the token
     */
    function createSale(uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration, address _owner) external whenNotPaused {
        require(msg.sender == address(nonFungibleContract));

        // Check whether the collectible is inPlay. If inPlay cant put it on Sale
        require(nonFungibleContract.checkIsAttached(_tokenId) == 0);
        
        _escrow(_owner, _tokenId);

        // Sale throws if inputs are invalid and clears
        // transfer and sire approval after escrowing the CSLCollectible.
        _createSale(
            _tokenId,
            _startingPrice,
            _endingPrice,
            _duration,
            _owner
        );
    }

    /**
     * @dev        Put a Collectible up for sale. Only callable, if user approved contract for 1/All Collectibles
     * @param      _tokenId        The token identifier
     * @param      _startingPrice  The starting price
     * @param      _endingPrice    The ending price
     * @param      _duration       The duration
     */
    function userCreateSaleIfApproved (uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration) external whenNotPaused {
        
        require(nonFungibleContract.getApproved(_tokenId) == address(this) || nonFungibleContract.isApprovedForAll(msg.sender, address(this)));
        
        // Check whether the collectible is inPlay. If inPlay cant put it on Sale
        require(nonFungibleContract.checkIsAttached(_tokenId) == 0);
        
        _escrow(msg.sender, _tokenId);

        // Sale throws if inputs are invalid and clears
        // transfer and sire approval after escrowing the CSLCollectible.
        _createSale(
            _tokenId,
            _startingPrice,
            _endingPrice,
            _duration,
            msg.sender
        );
    }

    /** 
     * @dev        Transfers the balance of the sales manager contract to the CSLCollectible contract. We use two-step withdrawal to
     *              prevent two transfer calls in the sale bid function.
     */
    function withdrawSaleManagerBalances() public onlyBanker {
        _withdrawBalance();
    }

    /** 
     *  @dev Function to chnage the OwnerCut only accessible by the Owner of the contract
     *  @param _newCut - Sets the ownerCut to new value
     */
    function setOwnerCut(uint256 _newCut) external onlyBanker {
        require(_newCut <= 10000);
        ownerCut = _newCut;
    }
    
    /**
     * @dev        Facilitates seed collectible auction creation. Enforces strict check on the data being passed
     * @notice     Creates a new Collectible and creates an auction for it.
     * @param      _teamId            The team identifier
     * @param      _posId             The position identifier
     * @param      _attributes        The attributes
     * @param      _playerOverrideId  The player override identifier
     * @param      _mlbPlayerId       The mlb player identifier
     * @param      _startPrice        The start price
     * @param      _endPrice          The end price
     * @param      _saleDuration      The sale duration
     */
    function createSingleSeedAuction(
        uint8 _teamId,
        uint8 _posId,
        uint256 _attributes,
        uint256 _playerOverrideId,
        uint256 _mlbPlayerId,
        uint256 _startPrice,
        uint256 _endPrice,
        uint256 _saleDuration)
        public
        onlyGameManager
        whenNotPaused {
        // Check to see the NFT address is not 0
        require(nonFungibleContract != address(0));
        require(_teamId != 0);

        uint256 nftId = nonFungibleContract.createSeedCollectible(_teamId,_posId,_attributes,address(this),0, _playerOverrideId, _mlbPlayerId);

        uint256 startPrice = 0;
        uint256 endPrice = 0;
        uint256 duration = 0;
        
        if(_startPrice == 0) {
            startPrice = _computeNextSeedPrice(0, _teamId);
        } else {
            startPrice = _startPrice;
        }

        if(_endPrice != 0) {
            endPrice = _endPrice;
        } else {
            endPrice = 0;
        }

        if(_saleDuration == 0) {
            duration = SALES_DURATION;
        } else {
            duration = _saleDuration;
        }

        _createSale(
            nftId,
            startPrice,
            endPrice,
            duration,
            address(this)
        );
    }

    /**
     * @dev        Facilitates promo collectible auction creation. Enforces strict check on the data being passed
     * @notice     Creates a new Collectible and creates an auction for it.
     * @param      _teamId            The team identifier
     * @param      _posId             The position identifier
     * @param      _attributes        The attributes
     * @param      _playerOverrideId  The player override identifier
     * @param      _mlbPlayerId       The mlb player identifier
     * @param      _startPrice        The start price
     * @param      _endPrice          The end price
     * @param      _saleDuration      The sale duration
     */
    function createPromoSeedAuction(
        uint8 _teamId,
        uint8 _posId,
        uint256 _attributes,
        uint256 _playerOverrideId,
        uint256 _mlbPlayerId,
        uint256 _startPrice,
        uint256 _endPrice,
        uint256 _saleDuration)
        public
        onlyGameManager
        whenNotPaused {
        // Check to see the NFT address is not 0
        require(nonFungibleContract != address(0));
        require(_teamId != 0);

        uint256 nftId = nonFungibleContract.createPromoCollectible(_teamId, _posId, _attributes, address(this), 0, _playerOverrideId, _mlbPlayerId);

        uint256 startPrice = 0;
        uint256 endPrice = 0;
        uint256 duration = 0;
        
        if(_startPrice == 0) {
            startPrice = _computeNextSeedPrice(0, _teamId);
        } else {
            startPrice = _startPrice;
        }

        if(_endPrice != 0) {
            endPrice = _endPrice;
        } else {
            endPrice = 0;
        }

        if(_saleDuration == 0) {
            duration = SALES_DURATION;
        } else {
            duration = _saleDuration;
        }

        _createSale(
            nftId,
            startPrice,
            endPrice,
            duration,
            address(this)
        );
    }

    /**
     * @dev        Creates Team Sale Auction
     * @param      _teamId        The team identifier
     * @param      _tokenIds      The token identifiers
     * @param      _startPrice    The start price
     * @param      _endPrice      The end price
     * @param      _saleDuration  The sale duration
     */
    function createTeamSaleAuction(
        uint8 _teamId,
        uint256[9] _tokenIds,
        uint256 _startPrice,
        uint256 _endPrice,
        uint256 _saleDuration)
        public
        onlyGameManager
        whenNotPaused {

        require(_teamId != 0);

        // Helps in not creating sale with wrong team and player combination
        for(uint ii = 0; ii < _tokenIds.length; ii++){
            require(nonFungibleContract.getTeamId(_tokenIds[ii]) == _teamId);
        }
        
        uint256 startPrice = 0;
        uint256 endPrice = 0;
        uint256 duration = 0;
        
        if(_startPrice == 0) {
            startPrice = _computeNextSeedPrice(1, _teamId).mul(9);
        } else {
            startPrice = _startPrice;
        }

        if(_endPrice != 0) {
            endPrice = _endPrice;
        } else {
            endPrice = 0;
        }

        if(_saleDuration == 0) {
            duration = SALES_DURATION;
        } else {
            duration = _saleDuration;
        }

        _createTeamSale(
            _tokenIds,
            startPrice,
            endPrice,
            duration,
            address(this)
        );
    }

    /**
     * @dev        Computes the next auction starting price
     * @param      _saleType     The sale type
     * @param      _teamId       The team identifier
     */
    function _computeNextSeedPrice(uint256 _saleType, uint256 _teamId) internal view returns (uint256) {
        uint256 nextPrice = _averageSalePrice(_saleType, _teamId);

        // Sanity check to ensure we don't overflow arithmetic
        require(nextPrice == nextPrice);

        // We never auction for less than starting price
        if (nextPrice < STARTING_PRICE) {
            nextPrice = STARTING_PRICE;
        }

        return nextPrice;
    }

    /**
     * @dev        Sanity check that allows us to ensure that we are pointing to the right sale call.
     */
    bool public isSalesManager = true;

    /**
     * @dev        works the same as default bid method.
     * @param      _tokenId  The token identifier
     */
    function bid(uint256 _tokenId) public whenNotPaused payable {
        
        Sale memory sale = tokenIdToSale[_tokenId];
        address seller = sale.seller;
        uint256 price = _bid(_tokenId, msg.value);

        //If multi token sale
        if(sale.tokenIds[1] > 0) {
            
            for (uint256 i = 0; i < 9; i++) {
                _transfer(address(this), msg.sender, sale.tokenIds[i]);
            }

            //Gets Avg price
            price = price.div(9);
        } else {
            
            _transfer(address(this), msg.sender, _tokenId);
        }
        
        // If not a seed, exit
        if (seller == address(this)) {
            if(sale.tokenIds[1] > 0){
                uint256 _teamId = nonFungibleContract.getTeamId(_tokenId);

                lastTeamSalePrices[_teamId][seedTeamSaleCount[_teamId] % 3] = price;

                seedTeamSaleCount[_teamId]++;
            } else {
                lastSingleSalePrices[seedSingleSaleCount % 10] = price;
                seedSingleSaleCount++;
            }
        }
    }
    
    /**
     * @dev        Sets the address for the NFT Contract
     * @param      _nftAddress  The nft address
     */
    function setNFTContractAddress(address _nftAddress) public onlyGameManager {
        require (_nftAddress != address(0));        
        nonFungibleContract = MLBNFT(_nftAddress);
    }

    /**
     * @dev        Added this module to allow retrieve of accidental asset transfer to contract
     * @param      _to       { parameter_description }
     * @param      _tokenId  The token identifier
     */
    function assetTransfer(address _to, uint256 _tokenId) public onlyGameManager {
        require(_tokenId != 0);
        nonFungibleContract.transferFrom(address(this), _to, _tokenId);
    }

     /**
     * @dev        Added this module to allow retrieve of accidental asset transfer to contract
     * @param      _to       { parameter_description }
     * @param      _tokenIds  The token identifiers
     */
    function batchAssetTransfer(address _to, uint256[] _tokenIds) public onlyGameManager {
        require(isBatchSupported);
        require (_tokenIds.length > 0);
        
        for(uint i = 0; i < _tokenIds.length; i++){
            require(_tokenIds[i] != 0);
            nonFungibleContract.transferFrom(address(this), _to, _tokenIds[i]);
        }
    }

    /**
     * @dev        Creates new Seed Team Colelctibles
     * @param      _teamId       The team identifier
     * @param      _attributes   The attributes
     * @param      _mlbPlayerId  The mlb player identifier
     */
    function createSeedTeam(uint8 _teamId, uint256[9] _attributes, uint256[9] _mlbPlayerId) public onlyGameManager whenNotPaused {
        require(_teamId != 0);
        
        for(uint ii = 0; ii < 9; ii++) {
            nonFungibleContract.createSeedCollectible(_teamId, uint8(ii.add(1)), _attributes[ii], address(this), 0, 0, _mlbPlayerId[ii]);
        }
    }

    /**
     * @dev            Cancels an sale that hasn't been won yet. Returns the MLBNFT (ERC721) to original owner.
     * @notice         This is a state-modifying function that can be called while the contract is paused.
     */
    function batchCancelSale(uint256[] _tokenIds) external whenNotPaused {
        require(isBatchSupported);
        require(_tokenIds.length > 0);

        for(uint ii = 0; ii < _tokenIds.length; ii++){
            Sale memory sale = tokenIdToSale[_tokenIds[ii]];
            require(_isOnSale(sale));
            
            address seller = sale.seller;
            require(msg.sender == seller);

            _cancelSale(_tokenIds[ii], seller);
        }
    }

    /**
     * @dev        Helps to toggle batch supported flag
     * @param      _flag  The flag
     */
    function updateBatchSupport(bool _flag) public onlyGameManager {
        isBatchSupported = _flag;
    }

    /**
     * @dev        Batching Operation: Creates a new Collectible and creates an auction for it.
     * @param      _teamIds            The team identifier
     * @param      _posIds            The position identifier
     * @param      _attributes        The attributes
     * @param      _playerOverrideIds  The player override identifier
     * @param      _mlbPlayerIds       The mlb player identifier
     * @param      _startPrice         The start price
     */
    function batchCreateSingleSeedAuction(
        uint8[] _teamIds,
        uint8[] _posIds,
        uint256[] _attributes,
        uint256[] _playerOverrideIds,
        uint256[] _mlbPlayerIds,
        uint256 _startPrice)
        public
        onlyGameManager
        whenNotPaused {

        require (isBatchSupported);

        require (_teamIds.length > 0 &&
            _posIds.length > 0 &&
            _attributes.length > 0 &&
            _playerOverrideIds.length > 0 &&
            _mlbPlayerIds.length > 0 );
        
        // Check to see the NFT address is not 0
        require(nonFungibleContract != address(0));
        
        uint256 nftId;

        require (_startPrice != 0);

        for(uint ii = 0; ii < _mlbPlayerIds.length; ii++){
            require(_teamIds[ii] != 0);

            nftId = nonFungibleContract.createSeedCollectible(
                        _teamIds[ii],
                        _posIds[ii],
                        _attributes[ii],
                        address(this),
                        0,
                        _playerOverrideIds[ii],
                        _mlbPlayerIds[ii]);

            _createSale(
                nftId,
                _startPrice,
                0,
                SALES_DURATION,
                address(this)
            );
        }
    }
}

Contract ABI
[{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gameManagerSecondary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"TEAM_SALE_MULTIPLIER","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_nftAddress","type":"address"}],"name":"setNFTContractAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelSaleWhenPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_teamId","type":"uint8"},{"name":"_posId","type":"uint8"},{"name":"_attributes","type":"uint256"},{"name":"_playerOverrideId","type":"uint256"},{"name":"_mlbPlayerId","type":"uint256"},{"name":"_startPrice","type":"uint256"},{"name":"_endPrice","type":"uint256"},{"name":"_saleDuration","type":"uint256"}],"name":"createPromoSeedAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_flag","type":"bool"}],"name":"updateBatchSupport","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"bid","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenIds","type":"uint256[]"}],"name":"batchCancelSale","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":"_teamId","type":"uint8"},{"name":"_attributes","type":"uint256[9]"},{"name":"_mlbPlayerId","type":"uint256[9]"}],"name":"createSeedTeam","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isSalesManager","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPrice","type":"uint256"},{"name":"_endingPrice","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_owner","type":"address"}],"name":"createSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdrawSaleManagerBalances","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newCut","type":"uint256"}],"name":"setOwnerCut","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gameManagerPrimary","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newGM","type":"address"}],"name":"setSecondaryGameManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ownerCut","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPrice","type":"uint256"},{"name":"_endingPrice","type":"uint256"},{"name":"_duration","type":"uint256"}],"name":"userCreateSaleIfApproved","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"seedSingleSaleCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_teamId","type":"uint8"},{"name":"_tokenIds","type":"uint256[9]"},{"name":"_startPrice","type":"uint256"},{"name":"_endPrice","type":"uint256"},{"name":"_saleDuration","type":"uint256"}],"name":"createTeamSaleAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenIds","type":"uint256[]"}],"name":"batchAssetTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_teamId","type":"uint8"},{"name":"_posId","type":"uint8"},{"name":"_attributes","type":"uint256"},{"name":"_playerOverrideId","type":"uint256"},{"name":"_mlbPlayerId","type":"uint256"},{"name":"_startPrice","type":"uint256"},{"name":"_endPrice","type":"uint256"},{"name":"_saleDuration","type":"uint256"}],"name":"createSingleSeedAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"name":"lastTeamSalePrices","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isBatchSupported","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newGM","type":"address"}],"name":"setPrimaryGameManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_teamIds","type":"uint8[]"},{"name":"_posIds","type":"uint8[]"},{"name":"_attributes","type":"uint256[]"},{"name":"_playerOverrideIds","type":"uint256[]"},{"name":"_mlbPlayerIds","type":"uint256[]"},{"name":"_startPrice","type":"uint256"}],"name":"batchCreateSingleSeedAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"cancelSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SINGLE_SALE_MULTIPLIER","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getCurrentPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"STARTING_PRICE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"lastSingleSalePrices","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"getSale","outputs":[{"name":"seller","type":"address"},{"name":"startingPrice","type":"uint256"},{"name":"endingPrice","type":"uint256"},{"name":"duration","type":"uint256"},{"name":"startedAt","type":"uint256"},{"name":"tokenIds","type":"uint256[9]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"nonFungibleContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_tokenId","type":"uint256"}],"name":"assetTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"bankManager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"seedTeamSaleCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERC721_RECEIVED","outputs":[{"name":"","type":"bytes4"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newBK","type":"address"}],"name":"setBanker","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SALES_DURATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenID","type":"uint256"},{"indexed":false,"name":"startingPrice","type":"uint256"},{"indexed":false,"name":"endingPrice","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"SaleCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenIDs","type":"uint256[9]"},{"indexed":false,"name":"startingPrice","type":"uint256"},{"indexed":false,"name":"endingPrice","type":"uint256"},{"indexed":false,"name":"duration","type":"uint256"},{"indexed":false,"name":"startedAt","type":"uint256"}],"name":"TeamSaleCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenID","type":"uint256"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"SaleWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenIDs","type":"uint256[9]"},{"indexed":false,"name":"totalPrice","type":"uint256"},{"indexed":false,"name":"winner","type":"address"}],"name":"TeamSaleWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tokenID","type":"uint256"},{"indexed":false,"name":"sellerAddress","type":"address"}],"name":"SaleCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"EtherWithdrawed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newContract","type":"address"}],"name":"ContractUpgrade","type":"event"}]

Contract Creation Code
60806040526002805460a060020a60ff02191690556101f46004556000600955600a805461ff001960ff199091166001171661010017905534801561004357600080fd5b50600454612710101561005557600080fd5b33151561006157600080fd5b6002805460008054600160a060020a0319908116339081179092556001805482168317905560a060020a60ff0219909216740100000000000000000000000000000000000000001791909116179055612fde806100bf6000396000f3006080604052600436106101ea5763ffffffff60e060020a600035041663150b7a0281146102595780631740b479146102fd578063196776351461032e57806323949cd11461035557806323edfb89146103785780632598ab9d14610390578063362f74e7146103c35780633f4ba83a146103dd578063454a2ab3146103f2578063553ec6be146103fd5780635c975abb1461041d5780635da08c42146104465780636cfdc242146104b857806372a1b73f146104cd57806374eb7c90146104fa578063757de5731461050f5780637bf3f90014610527578063803734361461053c57806383b5ff8b1461055d5780638456cb591461057257806384ececf2146105875780638cd6c7fa146105a85780639951a2c8146105bd5780639a58c33d14610614578063a29626c214610677578063a888ff60146106aa578063aaeaa36c146106c5578063b5a54627146106da578063b792d022146106fb578063bd94b00514610836578063be86d9961461084e578063c55d0f5614610863578063d12f70291461087b578063d72d681914610890578063d8f6d596146108a8578063dd1b7a0f14610930578063e5d9dac414610945578063e9e2990e14610969578063ec8b96081461097e578063ecc98ce414610996578063f1ff732b146109ab578063f396e81b146109cc575b600354600160a060020a03163330148061020e5750600054600160a060020a031633145b806102235750600154600160a060020a031633145b806102385750600254600160a060020a031633145b8061024b575033600160a060020a038216145b151561025657600080fd5b50005b34801561026557600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526102c894600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506109e19650505050505050565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561030957600080fd5b50610312610a0a565b60408051600160a060020a039092168252519081900360200190f35b34801561033a57600080fd5b50610343610a19565b60408051918252519081900360200190f35b34801561036157600080fd5b50610376600160a060020a0360043516610a1e565b005b34801561038457600080fd5b50610376600435610a83565b34801561039c57600080fd5b5061037660ff6004358116906024351660443560643560843560a43560c43560e435610b87565b3480156103cf57600080fd5b506103766004351515610d40565b3480156103e957600080fd5b50610376610d81565b610376600435610de8565b34801561040957600080fd5b506103766004803560248101910135611054565b34801561042957600080fd5b506104326111a3565b604080519115158252519081900360200190f35b34801561045257600080fd5b5060408051610120808201909252610376916004803560ff1692369261014491906024906009908390839080828437505060408051610120818101909252949796958181019594509250600991508390839080828437509396506111b395505050505050565b3480156104c457600080fd5b50610432611319565b3480156104d957600080fd5b50610376600435602435604435606435600160a060020a0360843516611327565b34801561050657600080fd5b50610376611409565b34801561051b57600080fd5b50610376600435611428565b34801561053357600080fd5b50610312611453565b34801561054857600080fd5b50610376600160a060020a0360043516611462565b34801561056957600080fd5b506103436114c7565b34801561057e57600080fd5b506103766114cd565b34801561059357600080fd5b50610376600435602435604435606435611538565b3480156105b457600080fd5b50610343611749565b3480156105c957600080fd5b5060408051610120808201909252610376916004803560ff1692369261014491906024906009908390839080828437509396505083359450505060208201359160400135905061174f565b34801561062057600080fd5b50604080516020600460248035828101358481028087018601909752808652610376968435600160a060020a0316963696604495919490910192918291850190849080828437509497506118d29650505050505050565b34801561068357600080fd5b5061037660ff6004358116906024351660443560643560843560a43560c43560e435611a10565b3480156106b657600080fd5b50610343600435602435611b2f565b3480156106d157600080fd5b50610432611b51565b3480156106e657600080fd5b50610376600160a060020a0360043516611b5a565b34801561070757600080fd5b506040805160206004803580820135838102808601850190965280855261037695369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497505093359450611bbf9350505050565b34801561084257600080fd5b50610376600435611e06565b34801561085a57600080fd5b50610343611eeb565b34801561086f57600080fd5b50610343600435611ef0565b34801561088757600080fd5b50610343611fab565b34801561089c57600080fd5b50610343600435611fb6565b3480156108b457600080fd5b506108c0600435611fc8565b6040518087600160a060020a0316600160a060020a0316815260200186815260200185815260200184815260200183815260200182600960200280838360005b83811015610918578181015183820152602001610900565b50505050905001965050505050505060405180910390f35b34801561093c57600080fd5b506103126120b1565b34801561095157600080fd5b50610376600160a060020a03600435166024356120c0565b34801561097557600080fd5b50610312612182565b34801561098a57600080fd5b50610343600435612191565b3480156109a257600080fd5b506102c86121a3565b3480156109b757600080fd5b50610376600160a060020a03600435166121c7565b3480156109d857600080fd5b50610343612215565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b600154600160a060020a031681565b600c81565b600054600160a060020a0316331480610a415750600154600160a060020a031633145b1515610a4c57600080fd5b600160a060020a0381161515610a6157600080fd5b60038054600160a060020a031916600160a060020a0392909216919091179055565b610a8b612ee2565b60025460009060a060020a900460ff161515610aa657600080fd5b600054600160a060020a0316331480610ac95750600154600160a060020a031633145b1515610ad457600080fd5b600083815260056020818152604092839020835160c0810185528154600160a060020a03168152600182015492810192909252600281015482850152600381015460608301526004810154608083015283516101208101948590529193909260a0850192919084019060099082845b815481526020019060010190808311610b43575050505050815250509150610b6a8261221c565b1515610b7557600080fd5b508051610b828382612226565b505050565b60008054819081908190600160a060020a0316331480610bb15750600154600160a060020a031633145b1515610bbc57600080fd5b60025460a060020a900460ff1615610bd357600080fd5b600354600160a060020a03161515610bea57600080fd5b60ff8c161515610bf957600080fd5b600360009054906101000a9004600160a060020a0316600160a060020a031663b7dcf6a98d8d8d3060008f8f6040518863ffffffff1660e060020a028152600401808860ff1660ff1681526020018760ff1660ff16815260200186815260200185600160a060020a0316600160a060020a03168152602001848152602001838152602001828152602001975050505050505050602060405180830381600087803b158015610ca657600080fd5b505af1158015610cba573d6000803e3d6000fd5b505050506040513d6020811015610cd057600080fd5b5051935060009250829150819050861515610cfa57610cf360008d60ff166123ba565b9250610cfe565b8692505b8515610d0c57859150610d11565b600091505b841515610d22575062015180610d25565b50835b610d3284848484306123ed565b505050505050505050505050565b600054600160a060020a0316331480610d635750600154600160a060020a031633145b1515610d6e57600080fd5b600a805460ff1916911515919091179055565b600054600160a060020a0316331480610da45750600154600160a060020a031633145b1515610daf57600080fd5b60025460a060020a900460ff161515610dc757600080fd5b600354600160a060020a03161515610dde57600080fd5b610de6612480565b565b610df0612ee2565b60025460009081908190819060a060020a900460ff1615610e1057600080fd5b600086815260056020818152604092839020835160c0810185528154600160a060020a03168152600182015492810192909252600281015482850152600381015460608301526004810154608083015283516101208101948590529193909260a0850192919084019060099082845b815481526020019060010190808311610e7f57505050505081525050945084600001519350610eae86346124e6565b60a08601516020015190935060001015610f1457600091505b6009821015610efc57610ef130338760a0015185600981101515610ee757fe5b6020020151612823565b600190910190610ec7565b610f0d83600963ffffffff6128b616565b9250610f1f565b610f1f303388612823565b600160a060020a03841630141561104c5760a0850151602001516000101561101d57600354604080517f79428570000000000000000000000000000000000000000000000000000000008152600481018990529051600160a060020a03909216916379428570916024808201926020929091908290030181600087803b158015610fa857600080fd5b505af1158015610fbc573d6000803e3d6000fd5b505050506040513d6020811015610fd257600080fd5b505160008181526006602090815260408083206008909252909120549192508491600390066003811061100157fe5b015560008181526008602052604090208054600101905561104c565b8260076000600a60095481151561103057fe5b0681526020810191909152604001600020556009805460010190555b505050505050565b600061105e612ee2565b60025460009060a060020a900460ff161561107857600080fd5b600a5460ff16151561108957600080fd5b6000841161109657600080fd5b600092505b8383101561119c57600560008686868181106110b357fe5b60209081029290920135835250818101929092526040908101600020815160c0810183528154600160a060020a0316815260018201549381019390935260028101548383015260038101546060840152600481015460808401528151610120810192839052909160a084019190600584019060099082845b81548152602001906001019080831161112b5750505050508152505091506111528261221c565b151561115d57600080fd5b50805133600160a060020a0382161461117557600080fd5b61119185858581811061118457fe5b9050602002013582612226565b60019092019161109b565b5050505050565b60025460a060020a900460ff1681565b60008054600160a060020a03163314806111d75750600154600160a060020a031633145b15156111e257600080fd5b60025460a060020a900460ff16156111f957600080fd5b60ff8416151561120857600080fd5b5060005b600981101561131357600354600160a060020a0316634f6d04e78561123884600163ffffffff6128d916565b86856009811061124457fe5b60200201513060008089896009811061125957fe5b60200201516040518863ffffffff1660e060020a028152600401808860ff1660ff1681526020018760ff1660ff16815260200186815260200185600160a060020a0316600160a060020a03168152602001848152602001838152602001828152602001975050505050505050602060405180830381600087803b1580156112df57600080fd5b505af11580156112f3573d6000803e3d6000fd5b505050506040513d602081101561130957600080fd5b505060010161120c565b50505050565b600a54610100900460ff1681565b60025460a060020a900460ff161561133e57600080fd5b600354600160a060020a0316331461135557600080fd5b600354604080517f5265440c000000000000000000000000000000000000000000000000000000008152600481018890529051600160a060020a0390921691635265440c916024808201926020929091908290030181600087803b1580156113bc57600080fd5b505af11580156113d0573d6000803e3d6000fd5b505050506040513d60208110156113e657600080fd5b5051156113f257600080fd5b6113fc81866128eb565b61119c85858585856123ed565b600254600160a060020a0316331461142057600080fd5b610de661295f565b600254600160a060020a0316331461143f57600080fd5b61271081111561144e57600080fd5b600455565b600054600160a060020a031681565b600054600160a060020a03163314806114855750600154600160a060020a031633145b151561149057600080fd5b600160a060020a03811615156114a557600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b60045481565b600054600160a060020a03163314806114f05750600154600160a060020a031633145b15156114fb57600080fd5b60025460a060020a900460ff161561151257600080fd5b6002805474ff0000000000000000000000000000000000000000191660a060020a179055565b60025460a060020a900460ff161561154f57600080fd5b600354604080517f081812fc0000000000000000000000000000000000000000000000000000000081526004810187905290513092600160a060020a03169163081812fc9160248083019260209291908290030181600087803b1580156115b557600080fd5b505af11580156115c9573d6000803e3d6000fd5b505050506040513d60208110156115df57600080fd5b5051600160a060020a0316148061168a5750600354604080517fe985e9c50000000000000000000000000000000000000000000000000000000081523360048201523060248201529051600160a060020a039092169163e985e9c5916044808201926020929091908290030181600087803b15801561165d57600080fd5b505af1158015611671573d6000803e3d6000fd5b505050506040513d602081101561168757600080fd5b50515b151561169557600080fd5b600354604080517f5265440c000000000000000000000000000000000000000000000000000000008152600481018790529051600160a060020a0390921691635265440c916024808201926020929091908290030181600087803b1580156116fc57600080fd5b505af1158015611710573d6000803e3d6000fd5b505050506040513d602081101561172657600080fd5b50511561173257600080fd5b61173c33856128eb565b61131384848484336123ed565b60095481565b60008054819081908190600160a060020a03163314806117795750600154600160a060020a031633145b151561178457600080fd5b60025460a060020a900460ff161561179b57600080fd5b60ff891615156117aa57600080fd5b600093505b60098410156118595760035460ff8a1690600160a060020a031663794285708a87600981106117da57fe5b60200201516040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15801561181857600080fd5b505af115801561182c573d6000803e3d6000fd5b505050506040513d602081101561184257600080fd5b50511461184e57600080fd5b6001909301926117af565b50600091508190508086151561188f57611888600961187c60018c60ff166123ba565b9063ffffffff61299c16565b9250611893565b8692505b85156118a1578591506118a6565b600091505b8415156118b75750620151806118ba565b50835b6118c788848484306129ca565b505050505050505050565b60008054600160a060020a03163314806118f65750600154600160a060020a031633145b151561190157600080fd5b600a5460ff16151561191257600080fd5b815160001061192057600080fd5b5060005b8151811015610b8257818181518110151561193b57fe5b60209081029091010151151561195057600080fd5b6003548251600160a060020a03909116906323b872dd903090869086908690811061197757fe5b906020019060200201516040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a031681526020018281526020019350505050600060405180830381600087803b1580156119ec57600080fd5b505af1158015611a00573d6000803e3d6000fd5b5050600190920191506119249050565b60008054819081908190600160a060020a0316331480611a3a5750600154600160a060020a031633145b1515611a4557600080fd5b60025460a060020a900460ff1615611a5c57600080fd5b600354600160a060020a03161515611a7357600080fd5b60ff8c161515611a8257600080fd5b600360009054906101000a9004600160a060020a0316600160a060020a0316634f6d04e78d8d8d3060008f8f6040518863ffffffff1660e060020a028152600401808860ff1660ff1681526020018760ff1660ff16815260200186815260200185600160a060020a0316600160a060020a03168152602001848152602001838152602001828152602001975050505050505050602060405180830381600087803b158015610ca657600080fd5b60066020526000828152604090208160038110611b4857fe5b01549150829050565b600a5460ff1681565b600054600160a060020a0316331480611b7d5750600154600160a060020a031633145b1515611b8857600080fd5b600160a060020a0381161515611b9d57600080fd5b60008054600160a060020a031916600160a060020a0392909216919091179055565b600080548190600160a060020a0316331480611be55750600154600160a060020a031633145b1515611bf057600080fd5b60025460a060020a900460ff1615611c0757600080fd5b600a5460ff161515611c1857600080fd5b60008851118015611c2a575060008751115b8015611c37575060008651115b8015611c44575060008551115b8015611c51575060008451115b1515611c5c57600080fd5b600354600160a060020a03161515611c7357600080fd5b821515611c7f57600080fd5b5060005b8351811015611dfc578781815181101515611c9a57fe5b6020908102909101015160ff161515611cb257600080fd5b6003548851600160a060020a0390911690634f6d04e7908a9084908110611cd557fe5b906020019060200201518984815181101515611ced57fe5b906020019060200201518985815181101515611d0557fe5b906020019060200201513060008b88815181101515611d2057fe5b906020019060200201518b89815181101515611d3857fe5b60209081029091018101516040805160e060020a63ffffffff8c1602815260ff998a1660048201529790981660248801526044870195909552600160a060020a039093166064860152608485019190915260a484015260c4830191909152915160e480830193928290030181600087803b158015611db557600080fd5b505af1158015611dc9573d6000803e3d6000fd5b505050506040513d6020811015611ddf57600080fd5b50519150611df48284600062015180306123ed565b600101611c83565b5050505050505050565b611e0e612ee2565b60025460009060a060020a900460ff1615611e2857600080fd5b600083815260056020818152604092839020835160c0810185528154600160a060020a03168152600182015492810192909252600281015482850152600381015460608301526004810154608083015283516101208101948590529193909260a0850192919084019060099082845b815481526020019060010190808311611e97575050505050815250509150611ebe8261221c565b1515611ec957600080fd5b50805133600160a060020a03821614611ee157600080fd5b610b828382612226565b602381565b6000611efa612ee2565b600083815260056020818152604092839020835160c0810185528154600160a060020a03168152600182015492810192909252600281015482850152600381015460608301526004810154608083015283516101208101948590529193909260a0850192919084019060099082845b815481526020019060010190808311611f69575050505050815250509050611f908161221c565b1515611f9b57600080fd5b611fa481612a15565b9392505050565b662386f26fc1000081565b60076020526000908152604090205481565b6000806000806000611fd8612f28565b611fe0612ee2565b600088815260056020818152604092839020835160c0810185528154600160a060020a03168152600182015492810192909252600281015482850152600381015460608301526004810154608083015283516101208101948590529193909260a0850192919084019060099082845b81548152602001906001019080831161204f5750505050508152505090506120768161221c565b151561208157600080fd5b8051602082015160408301516060840151608085015160a090950151939c929b5090995097509195509350915050565b600354600160a060020a031681565b600054600160a060020a03163314806120e35750600154600160a060020a031633145b15156120ee57600080fd5b8015156120fa57600080fd5b600354604080517f23b872dd000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a03858116602483015260448201859052915191909216916323b872dd91606480830192600092919082900301818387803b15801561216e57600080fd5b505af115801561104c573d6000803e3d6000fd5b600254600160a060020a031681565b60086020526000908152604090205481565b7f150b7a020000000000000000000000000000000000000000000000000000000081565b600254600160a060020a031633146121de57600080fd5b600160a060020a03811615156121f357600080fd5b60028054600160a060020a031916600160a060020a0392909216919091179055565b6201518081565b6080015160001090565b61222e612ee2565b6000838152600560208181526040808420815160c0810183528154600160a060020a03168152600182015493810193909352600281015483830152600381015460608401526004810154608084015281516101208101909252919260a084019190830160098282826020028201915b81548152602001906001019080831161229d575050509190925250505060a0810151602001519092501561235d575060005b60098110156123155760a08201516122f69082600981106122ec57fe5b6020020151612a47565b61230d30848460a0015184600981101515610ee757fe5b6001016122cf565b60408051858152600160a060020a038516602082015281517fd9e530acb8429c8e5337d9d3230e4cc7d742e32c2fc8d76608c19f2e1701ed04929181900390910190a1611313565b61236684612a47565b612371308486612823565b60408051858152600160a060020a038516602082015281517fd9e530acb8429c8e5337d9d3230e4cc7d742e32c2fc8d76608c19f2e1701ed04929181900390910190a150505050565b6000806123c78484612a8f565b9050662386f26fc100008110156123e25750662386f26fc100005b8091505b5092915050565b6123f5612ee2565b60c06040519081016040528083600160a060020a0316815260200186815260200185815260200184815260200142815260200161012060405190810160405280898152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815250815250905061104c8682612b8c565b600054600160a060020a03163314806124a35750600154600160a060020a031633145b15156124ae57600080fd5b60025460a060020a900460ff1615156124c657600080fd5b6002805474ff000000000000000000000000000000000000000019169055565b6000806124f1612f28565b6000858152600560208190526040808320815161012081019283905290955083928392839283928392908a019060099082845b8154815260200190600101908083116125245750506040805160c0810182528d54600160a060020a0316815260018e0154602082015260028e01548183015260038e0154606082015260048e015460808201528151610120810192839052959c506125c2959094508d935060a08501925090600584019060099082845b8154815260200190600101908083116125a15750505050508152505061221c565b15156125cd57600080fd5b6040805160c0810182528954600160a060020a0316815260018a0154602082015260028a01548183015260038a0154606082015260048a01546080820152815161012081019283905261264d928b9160a0840191600584019060099082845b81548152602001906001019080831161262c57505050505081525050612a15565b9550858a101561265c57600080fd5b8754600160a060020a031694506000876001602002015111156126a657600093505b60098410156126a1576126968785600981106122ec57fe5b60019093019261267e565b6126af565b6126af8b612a47565b600086111561270e576126c186612c70565b92506126d3868463ffffffff612c9f16565b604051909250600160a060020a0386169083156108fc029084906000818181858888f1935050505015801561270c573d6000803e3d6000fd5b505b61271e8a8763ffffffff612c9f16565b604051909150339082156108fc029083906000818181858888f1935050505015801561274e573d6000803e3d6000fd5b506020870151600010156127d4577f3e26b609bdb78965c3cc474d081fd9416c228fc7f1600c1b6511c736798e4b9f8787336040518084600960200280838360005b838110156127a8578181015183820152602001612790565b50505050919091019384525050600160a060020a031660208201526040805191829003019150a1612814565b604080518c815260208101889052338183015290517fe7f91fae5e362a076a229ddbcc13864728b3f5dcceefc79cf8940e64997db9859181900360600190a15b50939998505050505050505050565b600354604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152858116602483015260448201859052915191909216916323b872dd91606480830192600092919082900301818387803b15801561289957600080fd5b505af11580156128ad573d6000803e3d6000fd5b50505050505050565b6000808083116128c557600080fd5b82848115156128d057fe5b04949350505050565b6000828201838110156123e257600080fd5b600354604080517f42842e0e000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015230602483015260448201859052915191909216916342842e0e91606480830192600092919082900301818387803b15801561216e57600080fd5b600254604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015612999573d6000803e3d6000fd5b50565b6000808315156129af57600091506123e6565b508282028284828115156129bf57fe5b04146123e257600080fd5b6129d2612ee2565b60c06040519081016040528083600160a060020a0316815260200186815260200185815260200184815260200142815260200187815250905061104c8682612cb6565b60808101516000908190421115612a2f5750608082015142035b611fa483602001518460400151856060015184612ea5565b600081815260056020819052604082208054600160a060020a0319168155600181018390556002810183905560038101839055600481018390559190610b8290830182612f48565b6000808080851515612b0357600091505b600a821015612ad657600082815260076020526040902054612ac990849063ffffffff6128d916565b9250600190910190612aa0565b612afc612aeb6023600a63ffffffff6128b616565b61187c85600a63ffffffff6128b616565b9250612b82565b5060005b6003811015612b46576000858152600660205260409020612b3c908260038110612b2d57fe5b0154849063ffffffff6128d916565b9250600101612b07565b612b6c612b5b600c600a63ffffffff6128b616565b61187c85600363ffffffff6128b616565b9250612b7f83600963ffffffff61299c16565b92505b5090949350505050565b6060810151603c1115612b9e57600080fd5b60008281526005602081815260409283902084518154600160a060020a031916600160a060020a03909116178155908401516001820155918301516002830155606083015160038301556080830151600483015560a0830151839291612c0991908301906009612f57565b50505060208082015160408084015160608086015160808088015185518a8152978801969096528685019390935290850152830191909152517f6688114a9b77bcf97076216092c6794f7c541749631612664980599eaff1f5329181900360a00190a15050565b6000612c99612c8c6127106004546128b690919063ffffffff16565b839063ffffffff61299c16565b92915050565b60008083831115612caf57600080fd5b5050900390565b6000603c826060015110151515612ccc57600080fd5b5060005b6009811015612e1457828160098110612ce557fe5b60200201511515612cf557600080fd5b600354600160a060020a0316634f558e79848360098110612d1257fe5b60200201516040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015612d5057600080fd5b505af1158015612d64573d6000803e3d6000fd5b505050506040513d6020811015612d7a57600080fd5b50511515612d8757600080fd5b8160056000858460098110612d9857fe5b60209081029190910151825281810192909252604090810160002083518154600160a060020a031916600160a060020a039091161781559183015160018301558201516002820155606082015160038201556080820151600482015560a0820151612e099060058301906009612f57565b505050600101612cd0565b7f67296fd73b6bfd01e6b0ad1dc90e93fd5018a084590dc8aa4634e01290a45c348383602001518460400151856060015186608001516040518086600960200280838360005b83811015612e72578181015183820152602001612e5a565b505050509050018581526020018481526020018381526020018281526020019550505050505060405180910390a1505050565b6000808080858510612eb957869350612ed7565b878703925085858402811515612ecb57fe5b05915081880190508093505b505050949350505050565b6101c0604051908101604052806000600160a060020a0316815260200160008152602001600081526020016000815260200160008152602001612f23612f28565b905290565b610120604051908101604052806009906020820280388339509192915050565b50612999906009810190612f95565b8260098101928215612f85579160200282015b82811115612f85578251825591602001919060010190612f6a565b50612f91929150612f95565b5090565b612faf91905b80821115612f915760008155600101612f9b565b905600a165627a7a72305820b3db1fb6e0e883b1bdf748c950161781f8b07cb7b947b82bbe96e6da4b78c5240029


   Swarm Source:
bzzr://b3db1fb6e0e883b1bdf748c950161781f8b07cb7b947b82bbe96e6da4b78c524
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.