Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 3 txns
 Latest 3 txns

TxHash Age From To Value [TxFee]
0x654ff774df0eca3d76f0780aac6a7148ee8ac2188cde18605957d6658d9d53fc157 days 15 hrs ago0xb144878128e9d6cd3d1a9d024e7b46b5c6b1c243  IN   0xb6e928db347dbaad2c06868b716a2cf4889045740 Ether0.0022736
0x2030b07902320079f3a31edcb74f40fe7c3a19ccf2c343386725d1e344fc5667157 days 16 hrs ago0xb144878128e9d6cd3d1a9d024e7b46b5c6b1c243  IN   0xb6e928db347dbaad2c06868b716a2cf4889045740 Ether0.0034736
0xe0eacb186ccc1d8edac99e196b19f8f95f26b9cedfec9f05dbab464b3c735b5c157 days 16 hrs ago0xb144878128e9d6cd3d1a9d024e7b46b5c6b1c243  IN    Contract Creation0 Ether0.1044352
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: ExchangeBase
Compiler Text: v0.4.23+commit.124ca40d
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.23;

// File: contracts/zeppelin-solidity/contracts/ownership/Ownable.sol

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

}

// File: contracts/Acceptable.sol

// @title Acceptable
// @author Takayuki Jimba
// @dev Provide basic access control.
contract Acceptable is Ownable {
    address public sender;

    // @dev Throws if called by any address other than the sender.
    modifier onlyAcceptable {
        require(msg.sender == sender);
        _;
    }

    // @dev Change acceptable address
    // @param _sender The address to new sender
    function setAcceptable(address _sender) public onlyOwner {
        sender = _sender;
    }
}

// File: contracts/ExchangeBase.sol

// @title ExchangeBase
// @author Takayuki Jimba
// @dev create, remove and succeed are supposed to be called from CryptoCrystal contract only.
contract ExchangeBase is Acceptable {
    struct Exchange {
        address owner;
        uint256 tokenId;
        uint8 kind;
        uint128 weight;
        uint64 createdAt;
    }

    Exchange[] exchanges;

    mapping(uint256 => Exchange) tokenIdToExchange;

    event ExchangeCreated(
        uint256 indexed id,
        address owner,
        uint256 ownerTokenId,
        uint256 ownerTokenGene,
        uint256 ownerTokenKind,
        uint256 ownerTokenWeight,
        uint256 kind,
        uint256 weight,
        uint256 createdAt
    );
    event ExchangeRemoved(uint256 indexed id, uint256 removedAt);

    function create(
        address _owner,
        uint256 _ownerTokenId,
        uint256 _ownerTokenGene,
        uint256 _ownerTokenKind,
        uint256 _ownerTokenWeight,
        uint256 _kind,
        uint256 _weight,
        uint256 _createdAt
    ) public onlyAcceptable returns(uint256) {
        require(!isOnExchange(_ownerTokenId));
        require(_ownerTokenWeight > 0);
        require(_weight > 0);
        require(_createdAt > 0);
        require(_weight <= 1384277343750);

        Exchange memory _exchange = Exchange({
            owner: _owner,
            tokenId: _ownerTokenId,
            kind: uint8(_kind),
            weight: uint128(_weight),
            createdAt: uint64(_createdAt)
            });
        uint256 _id = exchanges.push(_exchange) - 1;
        tokenIdToExchange[_ownerTokenId] = _exchange;
        emit ExchangeCreated(
            _id,
            _owner,
            _ownerTokenId,
            _ownerTokenGene,
            _ownerTokenKind,
            _ownerTokenWeight,
            _kind,
            _weight,
            _createdAt
        );
        return _id;
    }

    function remove(uint256 _id) public onlyAcceptable {
        require(isOnExchangeById(_id));

        Exchange memory _exchange = exchanges[_id];
        delete tokenIdToExchange[_exchange.tokenId];
        delete exchanges[_id];

        emit ExchangeRemoved(_id, now);
    }

    function getExchange(uint256 _id) public view returns(
        address owner,
        uint256 tokenId,
        uint256 kind,
        uint256 weight,
        uint256 createdAt
    ) {
        require(isOnExchangeById(_id));

        Exchange memory _exchange = exchanges[_id];
        owner = _exchange.owner;
        tokenId = _exchange.tokenId;
        kind = _exchange.kind;
        weight = _exchange.weight;
        createdAt = _exchange.createdAt;
    }

    function getTokenId(uint256 _id) public view returns(uint256) {
        require(isOnExchangeById(_id));

        Exchange memory _exchange = exchanges[_id];
        return _exchange.tokenId;
    }

    function ownerOf(uint256 _id) public view returns(address) {
        require(isOnExchangeById(_id));

        return exchanges[_id].owner;
    }

    function isOnExchange(uint256 _tokenId) public view returns(bool) {
        return tokenIdToExchange[_tokenId].createdAt > 0;
    }

    function isOnExchangeById(uint256 _id) public view returns(bool) {
        return (_id < exchanges.length) && (exchanges[_id].createdAt > 0);
    }
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"_sender","type":"address"}],"name":"setAcceptable","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"getExchange","outputs":[{"name":"owner","type":"address"},{"name":"tokenId","type":"uint256"},{"name":"kind","type":"uint256"},{"name":"weight","type":"uint256"},{"name":"createdAt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"getTokenId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"}],"name":"remove","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"},{"name":"_ownerTokenId","type":"uint256"},{"name":"_ownerTokenGene","type":"uint256"},{"name":"_ownerTokenKind","type":"uint256"},{"name":"_ownerTokenWeight","type":"uint256"},{"name":"_kind","type":"uint256"},{"name":"_weight","type":"uint256"},{"name":"_createdAt","type":"uint256"}],"name":"create","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"isOnExchange","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"ownerOf","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"sender","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"}],"name":"isOnExchangeById","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"ownerTokenId","type":"uint256"},{"indexed":false,"name":"ownerTokenGene","type":"uint256"},{"indexed":false,"name":"ownerTokenKind","type":"uint256"},{"indexed":false,"name":"ownerTokenWeight","type":"uint256"},{"indexed":false,"name":"kind","type":"uint256"},{"indexed":false,"name":"weight","type":"uint256"},{"indexed":false,"name":"createdAt","type":"uint256"}],"name":"ExchangeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"removedAt","type":"uint256"}],"name":"ExchangeRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061120a806100536000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806304d2cdbf146100b45780630b9d5847146100f757806314ff5ea3146101805780634cc82215146101c157806352638d75146101ee5780635fda0dc11461028b5780636352211e146102d057806367e404ce1461033d5780638da5cb5b14610394578063abd2ecb7146103eb578063f2fde38b14610430575b600080fd5b3480156100c057600080fd5b506100f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610473565b005b34801561010357600080fd5b5061012260048036038101908080359060200190929190505050610512565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b34801561018c57600080fd5b506101ab600480360381019080803590602001909291905050506106a6565b6040518082815260200191505060405180910390f35b3480156101cd57600080fd5b506101ec600480360381019080803590602001909291905050506107f5565b005b3480156101fa57600080fd5b50610275600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610b09565b6040518082815260200191505060405180910390f35b34801561029757600080fd5b506102b660048036038101908080359060200190929190505050610ee0565b604051808215151515815260200191505060405180910390f35b3480156102dc57600080fd5b506102fb60048036038101908080359060200190929190505050610f20565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034957600080fd5b50610352610f7e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610fa4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103f757600080fd5b5061041660048036038101908080359060200190929190505050610fc9565b604051808215151515815260200191505060405180910390f35b34801561043c57600080fd5b50610471600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611024565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104ce57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000806000610522611179565b61052b87610fc9565b151561053657600080fd5b60028781548110151561054557fe5b906000526020600020906003020160a060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820160009054906101000a900460ff1660ff1660ff1681526020016002820160019054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016002820160119054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505090508060000151955080602001519450806040015160ff16935080606001516fffffffffffffffffffffffffffffffff169250806080015167ffffffffffffffff1691505091939590929450565b60006106b0611179565b6106b983610fc9565b15156106c457600080fd5b6002838154811015156106d357fe5b906000526020600020906003020160a060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820160009054906101000a900460ff1660ff1660ff1681526020016002820160019054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016002820160119054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505090508060200151915050919050565b6107fd611179565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561085957600080fd5b61086282610fc9565b151561086d57600080fd5b60028281548110151561087c57fe5b906000526020600020906003020160a060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820160009054906101000a900460ff1660ff1660ff1681526020016002820160019054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016002820160119054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505090506003600082602001518152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006101000a81549060ff02191690556002820160016101000a8154906fffffffffffffffffffffffffffffffff02191690556002820160116101000a81549067ffffffffffffffff02191690555050600282815481101515610a3b57fe5b9060005260206000209060030201600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006101000a81549060ff02191690556002820160016101000a8154906fffffffffffffffffffffffffffffffff02191690556002820160116101000a81549067ffffffffffffffff02191690555050817f35990ba94475ece2576d0af9ffb76b5d67a235e4105874a909b8dc6b223c613f426040518082815260200191505060405180910390a25050565b6000610b13611179565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b7157600080fd5b610b7a8a610ee0565b151515610b8657600080fd5b600087111515610b9557600080fd5b600085111515610ba457600080fd5b600084111515610bb357600080fd5b6501424d5bfe068511151515610bc857600080fd5b60a0604051908101604052808c73ffffffffffffffffffffffffffffffffffffffff1681526020018b81526020018760ff168152602001866fffffffffffffffffffffffffffffffff1681526020018567ffffffffffffffff16815250915060016002839080600181540180825580915050906001820390600052602060002090600302016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff021916908360ff16021790555060608201518160020160016101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060808201518160020160116101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505003905081600360008c815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff021916908360ff16021790555060608201518160020160016101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060808201518160020160116101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550905050807ffc79bb65f973155aca681331e47ab76ffbaef71eee12b37a66a8250eaa22b7568c8c8c8c8c8c8c8c604051808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390a2809250505098975050505050505050565b6000806003600084815260200190815260200160002060020160119054906101000a900467ffffffffffffffff1667ffffffffffffffff16119050919050565b6000610f2b82610fc9565b1515610f3657600080fd5b600282815481101515610f4557fe5b906000526020600020906003020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006002805490508210801561101d57506000600283815481101515610feb57fe5b906000526020600020906003020160020160119054906101000a900467ffffffffffffffff1667ffffffffffffffff16115b9050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561107f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156110bb57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60a060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600060ff16815260200160006fffffffffffffffffffffffffffffffff168152602001600067ffffffffffffffff16815250905600a165627a7a72305820cab7a0183a7e26acecb552c33d11a6472b053c869d372965664b968678b0e7350029

   Swarm Source:
bzzr://cab7a0183a7e26acecb552c33d11a6472b053c869d372965664b968678b0e735

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.