More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 52 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 9556697 | 1716 days ago | IN | 0 ETH | 0.00025304 | ||||
Withdraw | 9556412 | 1716 days ago | IN | 0 ETH | 0.00015809 | ||||
Purchase | 7136911 | 2110 days ago | IN | 0.5 ETH | 0.00018671 | ||||
Withdraw | 6767993 | 2174 days ago | IN | 0 ETH | 0.00011182 | ||||
Set Addresses | 6767993 | 2174 days ago | IN | 0 ETH | 0.00011431 | ||||
Set Addresses | 6767993 | 2174 days ago | IN | 0 ETH | 0.00011431 | ||||
Purchase | 6689850 | 2187 days ago | IN | 0.25 ETH | 0.00257609 | ||||
Purchase | 6689841 | 2187 days ago | IN | 0.5 ETH | 0.00631975 | ||||
Purchase | 6689787 | 2187 days ago | IN | 0.25 ETH | 0.00225945 | ||||
Set Withdrawer | 6689362 | 2187 days ago | IN | 0 ETH | 0.00021793 | ||||
Purchase | 6687616 | 2187 days ago | IN | 2.5 ETH | 0.02299532 | ||||
Purchase | 6687600 | 2187 days ago | IN | 2.5 ETH | 0.02294771 | ||||
Purchase | 6687590 | 2187 days ago | IN | 2.5 ETH | 0.02292416 | ||||
Purchase | 6687585 | 2187 days ago | IN | 2.5 ETH | 0.0233319 | ||||
Purchase | 6687575 | 2187 days ago | IN | 2.5 ETH | 0.02306835 | ||||
Purchase | 6687544 | 2187 days ago | IN | 2.5 ETH | 0.02302073 | ||||
Purchase | 6687508 | 2187 days ago | IN | 2.5 ETH | 0.01738106 | ||||
Purchase | 6687497 | 2187 days ago | IN | 2.5 ETH | 0.02001759 | ||||
Purchase | 6687459 | 2187 days ago | IN | 2.5 ETH | 0.01432026 | ||||
Purchase | 6687441 | 2187 days ago | IN | 2.5 ETH | 0.01440308 | ||||
Purchase | 6687437 | 2187 days ago | IN | 2.5 ETH | 0.01750807 | ||||
Purchase | 6687425 | 2187 days ago | IN | 2.5 ETH | 0.01446456 | ||||
Purchase | 6687386 | 2187 days ago | IN | 2.5 ETH | 0.01173673 | ||||
Purchase | 6687361 | 2187 days ago | IN | 2.5 ETH | 0.01151072 | ||||
Purchase | 6687344 | 2187 days ago | IN | 2.5 ETH | 0.01168353 |
Loading...
Loading
Contract Name:
CryptantCrabPresale
Compiler Version
v0.4.24+commit.e67f0147
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-11-12 */ pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting '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; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage role, address addr) internal { role.bearer[addr] = true; } /** * @dev remove an address' access to this role */ function remove(Role storage role, address addr) internal { role.bearer[addr] = false; } /** * @dev check if an address has this role * // reverts */ function check(Role storage role, address addr) view internal { require(has(role, addr)); } /** * @dev check if an address has this role * @return bool */ function has(Role storage role, address addr) view internal returns (bool) { return role.bearer[addr]; } } /** * @title RBAC (Role-Based Access Control) * @author Matt Condon (@Shrugs) * @dev Stores and provides setters and getters for roles and addresses. * Supports unlimited numbers of roles and addresses. * See //contracts/mocks/RBACMock.sol for an example of usage. * This RBAC method uses strings to key roles. It may be beneficial * for you to write your own implementation of this interface using Enums or similar. * It's also recommended that you define constants in the contract, like ROLE_ADMIN below, * to avoid typos. */ contract RBAC { using Roles for Roles.Role; mapping (string => Roles.Role) private roles; event RoleAdded(address indexed operator, string role); event RoleRemoved(address indexed operator, string role); /** * @dev reverts if addr does not have role * @param _operator address * @param _role the name of the role * // reverts */ function checkRole(address _operator, string _role) view public { roles[_role].check(_operator); } /** * @dev determine if addr has role * @param _operator address * @param _role the name of the role * @return bool */ function hasRole(address _operator, string _role) view public returns (bool) { return roles[_role].has(_operator); } /** * @dev add a role to an address * @param _operator address * @param _role the name of the role */ function addRole(address _operator, string _role) internal { roles[_role].add(_operator); emit RoleAdded(_operator, _role); } /** * @dev remove a role from an address * @param _operator address * @param _role the name of the role */ function removeRole(address _operator, string _role) internal { roles[_role].remove(_operator); emit RoleRemoved(_operator, _role); } /** * @dev modifier to scope access to a single role (uses msg.sender as addr) * @param _role the name of the role * // reverts */ modifier onlyRole(string _role) { checkRole(msg.sender, _role); _; } /** * @dev modifier to scope access to a set of roles (uses msg.sender as addr) * @param _roles the names of the roles to scope access to * // reverts * * @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this * see: https://github.com/ethereum/solidity/issues/2467 */ // modifier onlyRoles(string[] _roles) { // bool hasAnyRole = false; // for (uint8 i = 0; i < _roles.length; i++) { // if (hasRole(msg.sender, _roles[i])) { // hasAnyRole = true; // break; // } // } // require(hasAnyRole); // _; // } } /** * @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 OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() 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 relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @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 { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } /** * @title Contracts that should not own Ether * @author Remco Bloemen <remco@2π.com> * @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up * in the contract, it will allow the owner to reclaim this ether. * @notice Ether can still be sent to this contract by: * calling functions labeled `payable` * `selfdestruct(contract_address)` * mining directly to the contract address */ contract HasNoEther is Ownable { /** * @dev Constructor that rejects incoming Ether * The `payable` flag is added so we can access `msg.value` without compiler warning. If we * leave out payable, then Solidity will allow inheriting contracts to implement a payable * constructor. By doing it this way we prevent a payable constructor from working. Alternatively * we could use assembly to access msg.value. */ constructor() public payable { require(msg.value == 0); } /** * @dev Disallows direct send by settings a default function without the `payable` flag. */ function() external { } /** * @dev Transfer all Ether held by the contract to the owner. */ function reclaimEther() external onlyOwner { owner.transfer(address(this).balance); } } /** * @title Whitelist * @dev The Whitelist contract has a whitelist of addresses, and provides basic authorization control functions. * This simplifies the implementation of "user permissions". */ contract Whitelist is Ownable, RBAC { string public constant ROLE_WHITELISTED = "whitelist"; /** * @dev Throws if operator is not whitelisted. * @param _operator address */ modifier onlyIfWhitelisted(address _operator) { checkRole(_operator, ROLE_WHITELISTED); _; } /** * @dev add an address to the whitelist * @param _operator address * @return true if the address was added to the whitelist, false if the address was already in the whitelist */ function addAddressToWhitelist(address _operator) onlyOwner public { addRole(_operator, ROLE_WHITELISTED); } /** * @dev getter to determine if address is in whitelist */ function whitelist(address _operator) public view returns (bool) { return hasRole(_operator, ROLE_WHITELISTED); } /** * @dev add addresses to the whitelist * @param _operators addresses * @return true if at least one address was added to the whitelist, * false if all addresses were already in the whitelist */ function addAddressesToWhitelist(address[] _operators) onlyOwner public { for (uint256 i = 0; i < _operators.length; i++) { addAddressToWhitelist(_operators[i]); } } /** * @dev remove an address from the whitelist * @param _operator address * @return true if the address was removed from the whitelist, * false if the address wasn't in the whitelist in the first place */ function removeAddressFromWhitelist(address _operator) onlyOwner public { removeRole(_operator, ROLE_WHITELISTED); } /** * @dev remove addresses from the whitelist * @param _operators addresses * @return true if at least one address was removed from the whitelist, * false if all addresses weren't in the whitelist in the first place */ function removeAddressesFromWhitelist(address[] _operators) onlyOwner public { for (uint256 i = 0; i < _operators.length; i++) { removeAddressFromWhitelist(_operators[i]); } } } /** * Utility library of inline functions on addresses */ library AddressUtils { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param addr address to check * @return whether the target address is a contract */ function isContract(address addr) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solium-disable-next-line security/no-inline-assembly assembly { size := extcodesize(addr) } return size > 0; } } /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface ERC165 { /** * @notice Query if a contract implements an interface * @param _interfaceId The interface identifier, as specified in ERC-165 * @dev Interface identification is specified in ERC-165. This function * uses less than 30,000 gas. */ function supportsInterface(bytes4 _interfaceId) external view returns (bool); } /** * @title SupportsInterfaceWithLookup * @author Matt Condon (@shrugs) * @dev Implements ERC165 using a lookup table. */ contract SupportsInterfaceWithLookup is ERC165 { bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; /** * 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(bytes4)')) */ /** * @dev a mapping of interface id to whether or not it's supported */ mapping(bytes4 => bool) internal supportedInterfaces; /** * @dev A contract implementing SupportsInterfaceWithLookup * implement ERC165 itself */ constructor() public { _registerInterface(InterfaceId_ERC165); } /** * @dev implement supportsInterface(bytes4) using a lookup table */ function supportsInterface(bytes4 _interfaceId) external view returns (bool) { return supportedInterfaces[_interfaceId]; } /** * @dev private method for registering an interface */ function _registerInterface(bytes4 _interfaceId) internal { require(_interfaceId != 0xffffffff); supportedInterfaces[_interfaceId] = true; } } /** * @title ERC721 Non-Fungible Token Standard basic interface * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Basic is ERC165 { event Transfer( address indexed _from, address indexed _to, uint256 indexed _tokenId ); event Approval( address indexed _owner, address indexed _approved, uint256 indexed _tokenId ); event ApprovalForAll( address indexed _owner, address indexed _operator, bool _approved ); function balanceOf(address _owner) public view returns (uint256 _balance); function ownerOf(uint256 _tokenId) public view returns (address _owner); function exists(uint256 _tokenId) public view returns (bool _exists); function approve(address _to, uint256 _tokenId) public; function getApproved(uint256 _tokenId) public view returns (address _operator); function setApprovalForAll(address _operator, bool _approved) public; function isApprovedForAll(address _owner, address _operator) public view returns (bool); function transferFrom(address _from, address _to, uint256 _tokenId) public; function safeTransferFrom(address _from, address _to, uint256 _tokenId) public; function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes _data ) public; } /** * @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 internal 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. Return of other than the magic value MUST result in the * transaction being reverted. * Note: the contract address is always the message sender. * @param _operator The address which called `safeTransferFrom` function * @param _from The address which previously owned the token * @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); } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Enumerable is ERC721Basic { function totalSupply() public view returns (uint256); function tokenOfOwnerByIndex( address _owner, uint256 _index ) public view returns (uint256 _tokenId); function tokenByIndex(uint256 _index) public view returns (uint256); } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Metadata is ERC721Basic { function name() external view returns (string _name); function symbol() external view returns (string _symbol); function tokenURI(uint256 _tokenId) public view returns (string); } /** * @title ERC-721 Non-Fungible Token Standard, full implementation interface * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { } /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic { bytes4 private constant InterfaceId_ERC721 = 0x80ac58cd; /* * 0x80ac58cd === * bytes4(keccak256('balanceOf(address)')) ^ * bytes4(keccak256('ownerOf(uint256)')) ^ * bytes4(keccak256('approve(address,uint256)')) ^ * bytes4(keccak256('getApproved(uint256)')) ^ * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ * bytes4(keccak256('isApprovedForAll(address,address)')) ^ * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) */ bytes4 private constant InterfaceId_ERC721Exists = 0x4f558e79; /* * 0x4f558e79 === * bytes4(keccak256('exists(uint256)')) */ using SafeMath for uint256; using AddressUtils for address; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` bytes4 private constant ERC721_RECEIVED = 0x150b7a02; // Mapping from token ID to owner mapping (uint256 => address) internal tokenOwner; // Mapping from token ID to approved address mapping (uint256 => address) internal tokenApprovals; // Mapping from owner to number of owned token mapping (address => uint256) internal ownedTokensCount; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) internal operatorApprovals; /** * @dev Guarantees msg.sender is owner of the given token * @param _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender */ modifier onlyOwnerOf(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender); _; } /** * @dev Checks msg.sender can transfer a token, by being owner, approved, or operator * @param _tokenId uint256 ID of the token to validate */ modifier canTransfer(uint256 _tokenId) { require(isApprovedOrOwner(msg.sender, _tokenId)); _; } constructor() public { // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(InterfaceId_ERC721); _registerInterface(InterfaceId_ERC721Exists); } /** * @dev Gets the balance of the specified address * @param _owner address to query the balance of * @return uint256 representing the amount owned by the passed address */ function balanceOf(address _owner) public view returns (uint256) { require(_owner != address(0)); return ownedTokensCount[_owner]; } /** * @dev Gets the owner of the specified token ID * @param _tokenId uint256 ID of the token to query the owner of * @return owner address currently marked as the owner of the given token ID */ function ownerOf(uint256 _tokenId) public view returns (address) { address owner = tokenOwner[_tokenId]; require(owner != address(0)); return owner; } /** * @dev Returns whether the specified token exists * @param _tokenId uint256 ID of the token to query the existence of * @return whether the token exists */ function exists(uint256 _tokenId) public view returns (bool) { address owner = tokenOwner[_tokenId]; return owner != address(0); } /** * @dev Approves another address to transfer the given token ID * The zero address indicates there is no approved address. * There can only be one approved address per token at a given time. * Can only be called by the token owner or an approved operator. * @param _to address to be approved for the given token ID * @param _tokenId uint256 ID of the token to be approved */ function approve(address _to, uint256 _tokenId) public { address owner = ownerOf(_tokenId); require(_to != owner); require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); tokenApprovals[_tokenId] = _to; emit Approval(owner, _to, _tokenId); } /** * @dev Gets the approved address for a token ID, or zero if no address set * @param _tokenId uint256 ID of the token to query the approval of * @return address currently approved for the given token ID */ function getApproved(uint256 _tokenId) public view returns (address) { return tokenApprovals[_tokenId]; } /** * @dev Sets or unsets the approval of a given operator * An operator is allowed to transfer all tokens of the sender on their behalf * @param _to operator address to set the approval * @param _approved representing the status of the approval to be set */ function setApprovalForAll(address _to, bool _approved) public { require(_to != msg.sender); operatorApprovals[msg.sender][_to] = _approved; emit ApprovalForAll(msg.sender, _to, _approved); } /** * @dev Tells whether an operator is approved by a given owner * @param _owner owner address which you want to query the approval of * @param _operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll( address _owner, address _operator ) public view returns (bool) { return operatorApprovals[_owner][_operator]; } /** * @dev Transfers the ownership of a given token ID to another address * Usage of this method is discouraged, use `safeTransferFrom` whenever possible * Requires the msg sender to be the owner, approved, or operator * @param _from current owner of the token * @param _to address to receive the ownership of the given token ID * @param _tokenId uint256 ID of the token to be transferred */ function transferFrom( address _from, address _to, uint256 _tokenId ) public canTransfer(_tokenId) { require(_from != address(0)); require(_to != address(0)); clearApproval(_from, _tokenId); removeTokenFrom(_from, _tokenId); addTokenTo(_to, _tokenId); emit Transfer(_from, _to, _tokenId); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * * Requires the msg sender to be the owner, approved, or operator * @param _from current owner of the token * @param _to address to receive the ownership of the given token ID * @param _tokenId uint256 ID of the token to be transferred */ function safeTransferFrom( address _from, address _to, uint256 _tokenId ) public canTransfer(_tokenId) { // solium-disable-next-line arg-overflow safeTransferFrom(_from, _to, _tokenId, ""); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg sender to be the owner, approved, or operator * @param _from current owner of the token * @param _to address to receive the ownership of the given token ID * @param _tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes _data ) public canTransfer(_tokenId) { transferFrom(_from, _to, _tokenId); // solium-disable-next-line arg-overflow require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data)); } /** * @dev Returns whether the given spender can transfer a given token ID * @param _spender address of the spender to query * @param _tokenId uint256 ID of the token to be transferred * @return bool whether the msg.sender is approved for the given token ID, * is an operator of the owner, or is the owner of the token */ function isApprovedOrOwner( address _spender, uint256 _tokenId ) internal view returns (bool) { address owner = ownerOf(_tokenId); // Disable solium check because of // https://github.com/duaraghav8/Solium/issues/175 // solium-disable-next-line operator-whitespace return ( _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender) ); } /** * @dev Internal function to mint a new token * Reverts if the given token ID already exists * @param _to The address that will own the minted token * @param _tokenId uint256 ID of the token to be minted by the msg.sender */ function _mint(address _to, uint256 _tokenId) internal { require(_to != address(0)); addTokenTo(_to, _tokenId); emit Transfer(address(0), _to, _tokenId); } /** * @dev Internal function to burn a specific token * Reverts if the token does not exist * @param _tokenId uint256 ID of the token being burned by the msg.sender */ function _burn(address _owner, uint256 _tokenId) internal { clearApproval(_owner, _tokenId); removeTokenFrom(_owner, _tokenId); emit Transfer(_owner, address(0), _tokenId); } /** * @dev Internal function to clear current approval of a given token ID * Reverts if the given address is not indeed the owner of the token * @param _owner owner of the token * @param _tokenId uint256 ID of the token to be transferred */ function clearApproval(address _owner, uint256 _tokenId) internal { require(ownerOf(_tokenId) == _owner); if (tokenApprovals[_tokenId] != address(0)) { tokenApprovals[_tokenId] = address(0); } } /** * @dev Internal function to add a token ID to the list of a given address * @param _to address representing the new owner of the given token ID * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address */ function addTokenTo(address _to, uint256 _tokenId) internal { require(tokenOwner[_tokenId] == address(0)); tokenOwner[_tokenId] = _to; ownedTokensCount[_to] = ownedTokensCount[_to].add(1); } /** * @dev Internal function to remove a token ID from the list of a given address * @param _from address representing the previous owner of the given token ID * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function removeTokenFrom(address _from, uint256 _tokenId) internal { require(ownerOf(_tokenId) == _from); ownedTokensCount[_from] = ownedTokensCount[_from].sub(1); tokenOwner[_tokenId] = address(0); } /** * @dev Internal function to invoke `onERC721Received` on a target address * The call is not executed if the target address is not a contract * @param _from address representing the previous owner of the given token ID * @param _to target address that will receive the tokens * @param _tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return whether the call correctly returned the expected magic value */ function checkAndCallSafeTransfer( address _from, address _to, uint256 _tokenId, bytes _data ) internal returns (bool) { if (!_to.isContract()) { return true; } bytes4 retval = ERC721Receiver(_to).onERC721Received( msg.sender, _from, _tokenId, _data); return (retval == ERC721_RECEIVED); } } /** * @title Full ERC721 Token * This implementation includes all the required and some optional functionality of the ERC721 standard * Moreover, it includes approve all functionality using operator terminology * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 { bytes4 private constant InterfaceId_ERC721Enumerable = 0x780e9d63; /** * 0x780e9d63 === * bytes4(keccak256('totalSupply()')) ^ * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ * bytes4(keccak256('tokenByIndex(uint256)')) */ bytes4 private constant InterfaceId_ERC721Metadata = 0x5b5e139f; /** * 0x5b5e139f === * bytes4(keccak256('name()')) ^ * bytes4(keccak256('symbol()')) ^ * bytes4(keccak256('tokenURI(uint256)')) */ // Token name string internal name_; // Token symbol string internal symbol_; // Mapping from owner to list of owned token IDs mapping(address => uint256[]) internal ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) internal ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] internal allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) internal allTokensIndex; // Optional mapping for token URIs mapping(uint256 => string) internal tokenURIs; /** * @dev Constructor function */ constructor(string _name, string _symbol) public { name_ = _name; symbol_ = _symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(InterfaceId_ERC721Enumerable); _registerInterface(InterfaceId_ERC721Metadata); } /** * @dev Gets the token name * @return string representing the token name */ function name() external view returns (string) { return name_; } /** * @dev Gets the token symbol * @return string representing the token symbol */ function symbol() external view returns (string) { return symbol_; } /** * @dev Returns an URI for a given token ID * Throws if the token ID does not exist. May return an empty string. * @param _tokenId uint256 ID of the token to query */ function tokenURI(uint256 _tokenId) public view returns (string) { require(exists(_tokenId)); return tokenURIs[_tokenId]; } /** * @dev Gets the token ID at a given index of the tokens list of the requested owner * @param _owner address owning the tokens list to be accessed * @param _index uint256 representing the index to be accessed of the requested tokens list * @return uint256 token ID at the given index of the tokens list owned by the requested address */ function tokenOfOwnerByIndex( address _owner, uint256 _index ) public view returns (uint256) { require(_index < balanceOf(_owner)); return ownedTokens[_owner][_index]; } /** * @dev Gets the total amount of tokens stored by the contract * @return uint256 representing the total amount of tokens */ function totalSupply() public view returns (uint256) { return allTokens.length; } /** * @dev Gets the token ID at a given index of all the tokens in this contract * Reverts if the index is greater or equal to the total number of tokens * @param _index uint256 representing the index to be accessed of the tokens list * @return uint256 token ID at the given index of the tokens list */ function tokenByIndex(uint256 _index) public view returns (uint256) { require(_index < totalSupply()); return allTokens[_index]; } /** * @dev Internal function to set the token URI for a given token * Reverts if the token ID does not exist * @param _tokenId uint256 ID of the token to set its URI * @param _uri string URI to assign */ function _setTokenURI(uint256 _tokenId, string _uri) internal { require(exists(_tokenId)); tokenURIs[_tokenId] = _uri; } /** * @dev Internal function to add a token ID to the list of a given address * @param _to address representing the new owner of the given token ID * @param _tokenId uint256 ID of the token to be added to the tokens list of the given address */ function addTokenTo(address _to, uint256 _tokenId) internal { super.addTokenTo(_to, _tokenId); uint256 length = ownedTokens[_to].length; ownedTokens[_to].push(_tokenId); ownedTokensIndex[_tokenId] = length; } /** * @dev Internal function to remove a token ID from the list of a given address * @param _from address representing the previous owner of the given token ID * @param _tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function removeTokenFrom(address _from, uint256 _tokenId) internal { super.removeTokenFrom(_from, _tokenId); uint256 tokenIndex = ownedTokensIndex[_tokenId]; uint256 lastTokenIndex = ownedTokens[_from].length.sub(1); uint256 lastToken = ownedTokens[_from][lastTokenIndex]; ownedTokens[_from][tokenIndex] = lastToken; ownedTokens[_from][lastTokenIndex] = 0; // Note that this will handle single-element arrays. In that case, both tokenIndex and lastTokenIndex are going to // be zero. Then we can make sure that we will remove _tokenId from the ownedTokens list since we are first swapping // the lastToken to the first position, and then dropping the element placed in the last position of the list ownedTokens[_from].length--; ownedTokensIndex[_tokenId] = 0; ownedTokensIndex[lastToken] = tokenIndex; } /** * @dev Internal function to mint a new token * Reverts if the given token ID already exists * @param _to address the beneficiary that will own the minted token * @param _tokenId uint256 ID of the token to be minted by the msg.sender */ function _mint(address _to, uint256 _tokenId) internal { super._mint(_to, _tokenId); allTokensIndex[_tokenId] = allTokens.length; allTokens.push(_tokenId); } /** * @dev Internal function to burn a specific token * Reverts if the token does not exist * @param _owner owner of the token to burn * @param _tokenId uint256 ID of the token being burned by the msg.sender */ function _burn(address _owner, uint256 _tokenId) internal { super._burn(_owner, _tokenId); // Clear metadata (if any) if (bytes(tokenURIs[_tokenId]).length != 0) { delete tokenURIs[_tokenId]; } // Reorg all tokens array uint256 tokenIndex = allTokensIndex[_tokenId]; uint256 lastTokenIndex = allTokens.length.sub(1); uint256 lastToken = allTokens[lastTokenIndex]; allTokens[tokenIndex] = lastToken; allTokens[lastTokenIndex] = 0; allTokens.length--; allTokensIndex[_tokenId] = 0; allTokensIndex[lastToken] = tokenIndex; } } contract CryptantCrabStoreInterface { function createAddress(bytes32 key, address value) external returns (bool); function createAddresses(bytes32[] keys, address[] values) external returns (bool); function updateAddress(bytes32 key, address value) external returns (bool); function updateAddresses(bytes32[] keys, address[] values) external returns (bool); function removeAddress(bytes32 key) external returns (bool); function removeAddresses(bytes32[] keys) external returns (bool); function readAddress(bytes32 key) external view returns (address); function readAddresses(bytes32[] keys) external view returns (address[]); // Bool related functions function createBool(bytes32 key, bool value) external returns (bool); function createBools(bytes32[] keys, bool[] values) external returns (bool); function updateBool(bytes32 key, bool value) external returns (bool); function updateBools(bytes32[] keys, bool[] values) external returns (bool); function removeBool(bytes32 key) external returns (bool); function removeBools(bytes32[] keys) external returns (bool); function readBool(bytes32 key) external view returns (bool); function readBools(bytes32[] keys) external view returns (bool[]); // Bytes32 related functions function createBytes32(bytes32 key, bytes32 value) external returns (bool); function createBytes32s(bytes32[] keys, bytes32[] values) external returns (bool); function updateBytes32(bytes32 key, bytes32 value) external returns (bool); function updateBytes32s(bytes32[] keys, bytes32[] values) external returns (bool); function removeBytes32(bytes32 key) external returns (bool); function removeBytes32s(bytes32[] keys) external returns (bool); function readBytes32(bytes32 key) external view returns (bytes32); function readBytes32s(bytes32[] keys) external view returns (bytes32[]); // uint256 related functions function createUint256(bytes32 key, uint256 value) external returns (bool); function createUint256s(bytes32[] keys, uint256[] values) external returns (bool); function updateUint256(bytes32 key, uint256 value) external returns (bool); function updateUint256s(bytes32[] keys, uint256[] values) external returns (bool); function removeUint256(bytes32 key) external returns (bool); function removeUint256s(bytes32[] keys) external returns (bool); function readUint256(bytes32 key) external view returns (uint256); function readUint256s(bytes32[] keys) external view returns (uint256[]); // int256 related functions function createInt256(bytes32 key, int256 value) external returns (bool); function createInt256s(bytes32[] keys, int256[] values) external returns (bool); function updateInt256(bytes32 key, int256 value) external returns (bool); function updateInt256s(bytes32[] keys, int256[] values) external returns (bool); function removeInt256(bytes32 key) external returns (bool); function removeInt256s(bytes32[] keys) external returns (bool); function readInt256(bytes32 key) external view returns (int256); function readInt256s(bytes32[] keys) external view returns (int256[]); // internal functions function parseKey(bytes32 key) internal pure returns (bytes32); function parseKeys(bytes32[] _keys) internal pure returns (bytes32[]); } interface GenesisCrabInterface { function generateCrabGene(bool isPresale, bool hasLegendaryPart) external returns (uint256 _gene, uint256 _skin, uint256 _heartValue, uint256 _growthValue); function mutateCrabPart(uint256 _part, uint256 _existingPartGene, uint256 _legendaryPercentage) external view returns (uint256); function generateCrabHeart() external view returns (uint256, uint256); } contract CrabData { modifier crabDataLength(uint256[] memory _crabData) { require(_crabData.length == 8); _; } struct CrabPartData { uint256 hp; uint256 dps; uint256 blockRate; uint256 resistanceBonus; uint256 hpBonus; uint256 dpsBonus; uint256 blockBonus; uint256 mutiplierBonus; } function arrayToCrabPartData( uint256[] _partData ) internal pure crabDataLength(_partData) returns (CrabPartData memory _parsedData) { _parsedData = CrabPartData( _partData[0], // hp _partData[1], // dps _partData[2], // block rate _partData[3], // resistance bonus _partData[4], // hp bonus _partData[5], // dps bonus _partData[6], // block bonus _partData[7]); // multiplier bonus } function crabPartDataToArray(CrabPartData _crabPartData) internal pure returns (uint256[] memory _resultData) { _resultData = new uint256[](8); _resultData[0] = _crabPartData.hp; _resultData[1] = _crabPartData.dps; _resultData[2] = _crabPartData.blockRate; _resultData[3] = _crabPartData.resistanceBonus; _resultData[4] = _crabPartData.hpBonus; _resultData[5] = _crabPartData.dpsBonus; _resultData[6] = _crabPartData.blockBonus; _resultData[7] = _crabPartData.mutiplierBonus; } } contract GeneSurgeon { //0 - filler, 1 - body, 2 - leg, 3 - left claw, 4 - right claw uint256[] internal crabPartMultiplier = [0, 10**9, 10**6, 10**3, 1]; function extractElementsFromGene(uint256 _gene) internal view returns (uint256[] memory _elements) { _elements = new uint256[](4); _elements[0] = _gene / crabPartMultiplier[1] / 100 % 10; _elements[1] = _gene / crabPartMultiplier[2] / 100 % 10; _elements[2] = _gene / crabPartMultiplier[3] / 100 % 10; _elements[3] = _gene / crabPartMultiplier[4] / 100 % 10; } function extractPartsFromGene(uint256 _gene) internal view returns (uint256[] memory _parts) { _parts = new uint256[](4); _parts[0] = _gene / crabPartMultiplier[1] % 100; _parts[1] = _gene / crabPartMultiplier[2] % 100; _parts[2] = _gene / crabPartMultiplier[3] % 100; _parts[3] = _gene / crabPartMultiplier[4] % 100; } } contract CryptantCrabNFT is ERC721Token, Whitelist, CrabData, GeneSurgeon { event CrabPartAdded(uint256 hp, uint256 dps, uint256 blockAmount); event GiftTransfered(address indexed _from, address indexed _to, uint256 indexed _tokenId); event DefaultMetadataURIChanged(string newUri); /** * @dev Pre-generated keys to save gas * keys are generated with: * CRAB_BODY = bytes4(keccak256("crab_body")) = 0xc398430e * CRAB_LEG = bytes4(keccak256("crab_leg")) = 0x889063b1 * CRAB_LEFT_CLAW = bytes4(keccak256("crab_left_claw")) = 0xdb6290a2 * CRAB_RIGHT_CLAW = bytes4(keccak256("crab_right_claw")) = 0x13453f89 */ bytes4 internal constant CRAB_BODY = 0xc398430e; bytes4 internal constant CRAB_LEG = 0x889063b1; bytes4 internal constant CRAB_LEFT_CLAW = 0xdb6290a2; bytes4 internal constant CRAB_RIGHT_CLAW = 0x13453f89; /** * @dev Stores all the crab data */ mapping(bytes4 => mapping(uint256 => CrabPartData[])) internal crabPartData; /** * @dev Mapping from tokenId to its corresponding special skin * tokenId with default skin will not be stored. */ mapping(uint256 => uint256) internal crabSpecialSkins; /** * @dev default MetadataURI */ string public defaultMetadataURI = "https://www.cryptantcrab.io/md/"; constructor(string _name, string _symbol) public ERC721Token(_name, _symbol) { // constructor initiateCrabPartData(); } /** * @dev Returns an URI for a given token ID * Throws if the token ID does not exist. * Will return the token's metadata URL if it has one, * otherwise will just return base on the default metadata URI * @param _tokenId uint256 ID of the token to query */ function tokenURI(uint256 _tokenId) public view returns (string) { require(exists(_tokenId)); string memory _uri = tokenURIs[_tokenId]; if(bytes(_uri).length == 0) { _uri = getMetadataURL(bytes(defaultMetadataURI), _tokenId); } return _uri; } /** * @dev Returns the data of a specific parts * @param _partIndex the part to retrieve. 1 = Body, 2 = Legs, 3 = Left Claw, 4 = Right Claw * @param _element the element of part to retrieve. 1 = Fire, 2 = Earth, 3 = Metal, 4 = Spirit, 5 = Water * @param _setIndex the set index of for the specified part. This will starts from 1. */ function dataOfPart(uint256 _partIndex, uint256 _element, uint256 _setIndex) public view returns (uint256[] memory _resultData) { bytes4 _key; if(_partIndex == 1) { _key = CRAB_BODY; } else if(_partIndex == 2) { _key = CRAB_LEG; } else if(_partIndex == 3) { _key = CRAB_LEFT_CLAW; } else if(_partIndex == 4) { _key = CRAB_RIGHT_CLAW; } else { revert(); } CrabPartData storage _crabPartData = crabPartData[_key][_element][_setIndex]; _resultData = crabPartDataToArray(_crabPartData); } /** * @dev Gift(Transfer) a token to another address. Caller must be token owner * @param _from current owner of the token * @param _to address to receive the ownership of the given token ID * @param _tokenId uint256 ID of the token to be transferred */ function giftToken(address _from, address _to, uint256 _tokenId) external { safeTransferFrom(_from, _to, _tokenId); emit GiftTransfered(_from, _to, _tokenId); } /** * @dev External function to mint a new token, for whitelisted address only. * Reverts if the given token ID already exists * @param _tokenOwner address the beneficiary that will own the minted token * @param _tokenId uint256 ID of the token to be minted by the msg.sender * @param _skinId the skin ID to be applied for all the token minted */ function mintToken(address _tokenOwner, uint256 _tokenId, uint256 _skinId) external onlyIfWhitelisted(msg.sender) { super._mint(_tokenOwner, _tokenId); if(_skinId > 0) { crabSpecialSkins[_tokenId] = _skinId; } } /** * @dev Returns crab data base on the gene provided * @param _gene the gene info where crab data will be retrieved base on it * @return 4 uint arrays: * 1st Array = Body's Data * 2nd Array = Leg's Data * 3rd Array = Left Claw's Data * 4th Array = Right Claw's Data */ function crabPartDataFromGene(uint256 _gene) external view returns ( uint256[] _bodyData, uint256[] _legData, uint256[] _leftClawData, uint256[] _rightClawData ) { uint256[] memory _parts = extractPartsFromGene(_gene); uint256[] memory _elements = extractElementsFromGene(_gene); _bodyData = dataOfPart(1, _elements[0], _parts[0]); _legData = dataOfPart(2, _elements[1], _parts[1]); _leftClawData = dataOfPart(3, _elements[2], _parts[2]); _rightClawData = dataOfPart(4, _elements[3], _parts[3]); } /** * @dev For developer to add new parts, notice that this is the only method to add crab data * so that developer can add extra content. there's no other method for developer to modify * the data. This is to assure token owner actually owns their data. * @param _partIndex the part to add. 1 = Body, 2 = Legs, 3 = Left Claw, 4 = Right Claw * @param _element the element of part to add. 1 = Fire, 2 = Earth, 3 = Metal, 4 = Spirit, 5 = Water * @param _partDataArray data of the parts. */ function setPartData(uint256 _partIndex, uint256 _element, uint256[] _partDataArray) external onlyOwner { CrabPartData memory _partData = arrayToCrabPartData(_partDataArray); bytes4 _key; if(_partIndex == 1) { _key = CRAB_BODY; } else if(_partIndex == 2) { _key = CRAB_LEG; } else if(_partIndex == 3) { _key = CRAB_LEFT_CLAW; } else if(_partIndex == 4) { _key = CRAB_RIGHT_CLAW; } // if index 1 is empty will fill at index 1 if(crabPartData[_key][_element][1].hp == 0 && crabPartData[_key][_element][1].dps == 0) { crabPartData[_key][_element][1] = _partData; } else { crabPartData[_key][_element].push(_partData); } emit CrabPartAdded(_partDataArray[0], _partDataArray[1], _partDataArray[2]); } /** * @dev Updates the default metadata URI * @param _defaultUri the new metadata URI */ function setDefaultMetadataURI(string _defaultUri) external onlyOwner { defaultMetadataURI = _defaultUri; emit DefaultMetadataURIChanged(_defaultUri); } /** * @dev Updates the metadata URI for existing token * @param _tokenId the tokenID that metadata URI to be changed * @param _uri the new metadata URI for the specified token */ function setTokenURI(uint256 _tokenId, string _uri) external onlyIfWhitelisted(msg.sender) { _setTokenURI(_tokenId, _uri); } /** * @dev Returns the special skin of the provided tokenId * @param _tokenId cryptant crab's tokenId * @return Special skin belongs to the _tokenId provided. * 0 will be returned if no special skin found. */ function specialSkinOfTokenId(uint256 _tokenId) external view returns (uint256) { return crabSpecialSkins[_tokenId]; } /** * @dev This functions will adjust the length of crabPartData * so that when adding data the index can start with 1. * Reason of doing this is because gene cannot have parts with index 0. */ function initiateCrabPartData() internal { require(crabPartData[CRAB_BODY][1].length == 0); for(uint256 i = 1 ; i <= 5 ; i++) { crabPartData[CRAB_BODY][i].length = 2; crabPartData[CRAB_LEG][i].length = 2; crabPartData[CRAB_LEFT_CLAW][i].length = 2; crabPartData[CRAB_RIGHT_CLAW][i].length = 2; } } /** * @dev Returns whether the given spender can transfer a given token ID * @param _spender address of the spender to query * @param _tokenId uint256 ID of the token to be transferred * @return bool whether the msg.sender is approved for the given token ID, * is an operator of the owner, or is the owner of the token, * or has been whitelisted by contract owner */ function isApprovedOrOwner(address _spender, uint256 _tokenId) internal view returns (bool) { address owner = ownerOf(_tokenId); return _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender) || whitelist(_spender); } /** * @dev Will merge the uri and tokenId together. * @param _uri URI to be merge. This will be the first part of the result URL. * @param _tokenId tokenID to be merge. This will be the last part of the result URL. * @return the merged urL */ function getMetadataURL(bytes _uri, uint256 _tokenId) internal pure returns (string) { uint256 _tmpTokenId = _tokenId; uint256 _tokenLength; // Getting the length(number of digits) of token ID do { _tokenLength++; _tmpTokenId /= 10; } while (_tmpTokenId > 0); // creating a byte array with the length of URL + token digits bytes memory _result = new bytes(_uri.length + _tokenLength); // cloning the uri bytes into the result bytes for(uint256 i = 0 ; i < _uri.length ; i ++) { _result[i] = _uri[i]; } // appending the tokenId to the end of the result bytes uint256 lastIndex = _result.length - 1; for(_tmpTokenId = _tokenId ; _tmpTokenId > 0 ; _tmpTokenId /= 10) { _result[lastIndex--] = byte(48 + _tmpTokenId % 10); } return string(_result); } } contract CryptantCrabBase is Ownable { GenesisCrabInterface public genesisCrab; CryptantCrabNFT public cryptantCrabToken; CryptantCrabStoreInterface public cryptantCrabStorage; constructor(address _genesisCrabAddress, address _cryptantCrabTokenAddress, address _cryptantCrabStorageAddress) public { // constructor _setAddresses(_genesisCrabAddress, _cryptantCrabTokenAddress, _cryptantCrabStorageAddress); } function setAddresses( address _genesisCrabAddress, address _cryptantCrabTokenAddress, address _cryptantCrabStorageAddress ) external onlyOwner { _setAddresses(_genesisCrabAddress, _cryptantCrabTokenAddress, _cryptantCrabStorageAddress); } function _setAddresses( address _genesisCrabAddress, address _cryptantCrabTokenAddress, address _cryptantCrabStorageAddress ) internal { if(_genesisCrabAddress != address(0)) { GenesisCrabInterface genesisCrabContract = GenesisCrabInterface(_genesisCrabAddress); genesisCrab = genesisCrabContract; } if(_cryptantCrabTokenAddress != address(0)) { CryptantCrabNFT cryptantCrabTokenContract = CryptantCrabNFT(_cryptantCrabTokenAddress); cryptantCrabToken = cryptantCrabTokenContract; } if(_cryptantCrabStorageAddress != address(0)) { CryptantCrabStoreInterface cryptantCrabStorageContract = CryptantCrabStoreInterface(_cryptantCrabStorageAddress); cryptantCrabStorage = cryptantCrabStorageContract; } } } contract CryptantCrabInformant is CryptantCrabBase{ constructor ( address _genesisCrabAddress, address _cryptantCrabTokenAddress, address _cryptantCrabStorageAddress ) public CryptantCrabBase ( _genesisCrabAddress, _cryptantCrabTokenAddress, _cryptantCrabStorageAddress ) { // constructor } function _getCrabData(uint256 _tokenId) internal view returns ( uint256 _gene, uint256 _level, uint256 _exp, uint256 _mutationCount, uint256 _trophyCount, uint256 _heartValue, uint256 _growthValue ) { require(cryptantCrabStorage != address(0)); bytes32[] memory keys = new bytes32[](7); uint256[] memory values; keys[0] = keccak256(abi.encodePacked(_tokenId, "gene")); keys[1] = keccak256(abi.encodePacked(_tokenId, "level")); keys[2] = keccak256(abi.encodePacked(_tokenId, "exp")); keys[3] = keccak256(abi.encodePacked(_tokenId, "mutationCount")); keys[4] = keccak256(abi.encodePacked(_tokenId, "trophyCount")); keys[5] = keccak256(abi.encodePacked(_tokenId, "heartValue")); keys[6] = keccak256(abi.encodePacked(_tokenId, "growthValue")); values = cryptantCrabStorage.readUint256s(keys); // process heart value uint256 _processedHeartValue; for(uint256 i = 1 ; i <= 1000 ; i *= 10) { if(uint256(values[5]) / i % 10 > 0) { _processedHeartValue += i; } } _gene = values[0]; _level = values[1]; _exp = values[2]; _mutationCount = values[3]; _trophyCount = values[4]; _heartValue = _processedHeartValue; _growthValue = values[6]; } function _geneOfCrab(uint256 _tokenId) internal view returns (uint256 _gene) { require(cryptantCrabStorage != address(0)); _gene = cryptantCrabStorage.readUint256(keccak256(abi.encodePacked(_tokenId, "gene"))); } } contract CryptantCrabPurchasable is CryptantCrabInformant { using SafeMath for uint256; event CrabHatched(address indexed owner, uint256 tokenId, uint256 gene, uint256 specialSkin, uint256 crabPrice, uint256 growthValue); event CryptantFragmentsAdded(address indexed cryptantOwner, uint256 amount, uint256 newBalance); event CryptantFragmentsRemoved(address indexed cryptantOwner, uint256 amount, uint256 newBalance); event Refund(address indexed refundReceiver, uint256 reqAmt, uint256 paid, uint256 refundAmt); constructor ( address _genesisCrabAddress, address _cryptantCrabTokenAddress, address _cryptantCrabStorageAddress ) public CryptantCrabInformant ( _genesisCrabAddress, _cryptantCrabTokenAddress, _cryptantCrabStorageAddress ) { // constructor } function getCryptantFragments(address _sender) public view returns (uint256) { return cryptantCrabStorage.readUint256(keccak256(abi.encodePacked(_sender, "cryptant"))); } function createCrab(uint256 _customTokenId, uint256 _crabPrice, uint256 _customGene, uint256 _customSkin, uint256 _customHeart, bool _hasLegendary) external onlyOwner { return _createCrab(false, _customTokenId, _crabPrice, _customGene, _customSkin, _customHeart, _hasLegendary); } function _addCryptantFragments(address _cryptantOwner, uint256 _amount) internal returns (uint256 _newBalance) { _newBalance = getCryptantFragments(_cryptantOwner).add(_amount); cryptantCrabStorage.updateUint256(keccak256(abi.encodePacked(_cryptantOwner, "cryptant")), _newBalance); emit CryptantFragmentsAdded(_cryptantOwner, _amount, _newBalance); } function _removeCryptantFragments(address _cryptantOwner, uint256 _amount) internal returns (uint256 _newBalance) { _newBalance = getCryptantFragments(_cryptantOwner).sub(_amount); cryptantCrabStorage.updateUint256(keccak256(abi.encodePacked(_cryptantOwner, "cryptant")), _newBalance); emit CryptantFragmentsRemoved(_cryptantOwner, _amount, _newBalance); } function _createCrab(bool _isPresale, uint256 _tokenId, uint256 _crabPrice, uint256 _customGene, uint256 _customSkin, uint256 _customHeart, bool _hasLegendary) internal { uint256[] memory _values = new uint256[](4); bytes32[] memory _keys = new bytes32[](4); uint256 _gene; uint256 _specialSkin; uint256 _heartValue; uint256 _growthValue; if(_customGene == 0) { (_gene, _specialSkin, _heartValue, _growthValue) = genesisCrab.generateCrabGene(_isPresale, _hasLegendary); } else { _gene = _customGene; } if(_customSkin != 0) { _specialSkin = _customSkin; } if(_customHeart != 0) { _heartValue = _customHeart; } else if (_heartValue == 0) { (_heartValue, _growthValue) = genesisCrab.generateCrabHeart(); } cryptantCrabToken.mintToken(msg.sender, _tokenId, _specialSkin); // Gene pair _keys[0] = keccak256(abi.encodePacked(_tokenId, "gene")); _values[0] = _gene; // Level pair _keys[1] = keccak256(abi.encodePacked(_tokenId, "level")); _values[1] = 1; // Heart Value pair _keys[2] = keccak256(abi.encodePacked(_tokenId, "heartValue")); _values[2] = _heartValue; // Growth Value pair _keys[3] = keccak256(abi.encodePacked(_tokenId, "growthValue")); _values[3] = _growthValue; require(cryptantCrabStorage.createUint256s(_keys, _values)); emit CrabHatched(msg.sender, _tokenId, _gene, _specialSkin, _crabPrice, _growthValue); } function _refundExceededValue(uint256 _senderValue, uint256 _requiredValue) internal { uint256 _exceededValue = _senderValue.sub(_requiredValue); if(_exceededValue > 0) { msg.sender.transfer(_exceededValue); emit Refund(msg.sender, _requiredValue, _senderValue, _exceededValue); } } } contract Withdrawable is Ownable { address public withdrawer; /** * @dev Throws if called by any account other than the withdrawer. */ modifier onlyWithdrawer() { require(msg.sender == withdrawer); _; } function setWithdrawer(address _newWithdrawer) external onlyOwner { withdrawer = _newWithdrawer; } /** * @dev withdraw the specified amount of ether from contract. * @param _amount the amount of ether to withdraw. Units in wei. */ function withdraw(uint256 _amount) external onlyWithdrawer returns(bool) { require(_amount <= address(this).balance); withdrawer.transfer(_amount); return true; } } contract Randomable { // Generates a random number base on last block hash function _generateRandom(bytes32 seed) view internal returns (bytes32) { return keccak256(abi.encodePacked(blockhash(block.number-1), seed)); } function _generateRandomNumber(bytes32 seed, uint256 max) view internal returns (uint256) { return uint256(_generateRandom(seed)) % max; } } contract CryptantCrabPresale is CryptantCrabPurchasable, HasNoEther, Withdrawable, Randomable { event PresalePurchased(address indexed owner, uint256 amount, uint256 cryptant, uint256 refund); uint256 constant public PRESALE_LIMIT = 5000; /** * @dev Currently is set to 17/11/2018 00:00:00 */ uint256 public presaleEndTime = 1542412800; /** * @dev Initial presale price is 0.25 ether */ uint256 public currentPresalePrice = 250 finney; /** * @dev tracks the current token id, starts from 721 */ uint256 public currentTokenId = 721; /** * @dev tracks the current giveaway token id, starts from 5102 */ uint256 public giveawayTokenId = 5102; constructor ( address _genesisCrabAddress, address _cryptantCrabTokenAddress, address _cryptantCrabStorageAddress ) public CryptantCrabPurchasable ( _genesisCrabAddress, _cryptantCrabTokenAddress, _cryptantCrabStorageAddress ) { // constructor } function setCurrentTokenId(uint256 _newTokenId) external onlyOwner { currentTokenId = _newTokenId; } function setPresaleEndtime(uint256 _newEndTime) external onlyOwner { presaleEndTime = _newEndTime; } function getPresalePrice() public view returns (uint256) { return currentPresalePrice; } function purchase(uint256 _amount) external payable { require(genesisCrab != address(0)); require(cryptantCrabToken != address(0)); require(cryptantCrabStorage != address(0)); require(_amount > 0 && _amount <= 10); require(isPresale()); require(PRESALE_LIMIT >= currentTokenId + _amount); uint256 _value = msg.value; uint256 _currentPresalePrice = getPresalePrice(); uint256 _totalRequiredAmount = _currentPresalePrice * _amount; require(_value >= _totalRequiredAmount); // Purchase 10 crabs will have 1 crab with legendary part // Default value for _crabWithLegendaryPart is just a unreacable number uint256 _crabWithLegendaryPart = 100; if(_amount == 10) { // decide which crab will have the legendary part _crabWithLegendaryPart = _generateRandomNumber(bytes32(currentTokenId), 10); } for(uint256 i = 0 ; i < _amount ; i++) { currentTokenId++; _createCrab(true, currentTokenId, _currentPresalePrice, 0, 0, 0, _crabWithLegendaryPart == i); } // Presale crab will get free cryptant fragments _addCryptantFragments(msg.sender, (i * 3000)); // Refund exceeded value _refundExceededValue(_value, _totalRequiredAmount); emit PresalePurchased(msg.sender, _amount, i * 3000, _value - _totalRequiredAmount); } function createCrab(uint256 _customTokenId, uint256 _crabPrice, uint256 _customGene, uint256 _customSkin, uint256 _customHeart, bool _hasLegendary) external onlyOwner { return _createCrab(true, _customTokenId, _crabPrice, _customGene, _customSkin, _customHeart, _hasLegendary); } function generateGiveawayCrabs(uint256 _amount) external onlyOwner { for(uint256 i = 0 ; i < _amount ; i++) { _createCrab(false, giveawayTokenId++, 120 finney, 0, 0, 0, false); } } function isPresale() internal view returns (bool) { return now < presaleEndTime; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"currentTokenId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newWithdrawer","type":"address"}],"name":"setWithdrawer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"PRESALE_LIMIT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"presaleEndTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_genesisCrabAddress","type":"address"},{"name":"_cryptantCrabTokenAddress","type":"address"},{"name":"_cryptantCrabStorageAddress","type":"address"}],"name":"setAddresses","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newEndTime","type":"uint256"}],"name":"setPresaleEndtime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_customTokenId","type":"uint256"},{"name":"_crabPrice","type":"uint256"},{"name":"_customGene","type":"uint256"},{"name":"_customSkin","type":"uint256"},{"name":"_customHeart","type":"uint256"},{"name":"_hasLegendary","type":"bool"}],"name":"createCrab","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getPresalePrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"genesisCrab","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newTokenId","type":"uint256"}],"name":"setCurrentTokenId","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"reclaimEther","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"}],"name":"getCryptantFragments","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"giveawayTokenId","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"withdrawer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cryptantCrabStorage","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"cryptantCrabToken","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"generateGiveawayCrabs","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"currentPresalePrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"purchase","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_genesisCrabAddress","type":"address"},{"name":"_cryptantCrabTokenAddress","type":"address"},{"name":"_cryptantCrabStorageAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"cryptant","type":"uint256"},{"indexed":false,"name":"refund","type":"uint256"}],"name":"PresalePurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"tokenId","type":"uint256"},{"indexed":false,"name":"gene","type":"uint256"},{"indexed":false,"name":"specialSkin","type":"uint256"},{"indexed":false,"name":"crabPrice","type":"uint256"},{"indexed":false,"name":"growthValue","type":"uint256"}],"name":"CrabHatched","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"cryptantOwner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"newBalance","type":"uint256"}],"name":"CryptantFragmentsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"cryptantOwner","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"newBalance","type":"uint256"}],"name":"CryptantFragmentsRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"refundReceiver","type":"address"},{"indexed":false,"name":"reqAmt","type":"uint256"},{"indexed":false,"name":"paid","type":"uint256"},{"indexed":false,"name":"refundAmt","type":"uint256"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
Contract Creation Code
6080604052635bef5a006005556703782dace9d900006006556102d16007556113ee60085534801561003057600080fd5b5060405160608061161383398101604090815281516020830151919092015160008054600160a060020a0319163317905582828282828282828261007e83838364010000000061009c810204565b5050341596506100949550505050505057600080fd5b505050610131565b60008080600160a060020a038616156100ce5760018054600160a060020a031916600160a060020a0388161790558592505b600160a060020a038516156100fc5760028054600160a060020a031916600160a060020a0387161790558491505b600160a060020a03841615610129575060038054600160a060020a031916600160a060020a038516179055825b505050505050565b6114d3806101406000396000f3006080604052600436106101185763ffffffff60e060020a6000350416629a9b7b81146101275780630d174c241461014e5780631aee3f9114610171578063249b7c19146101865780632e1a7d4d1461019b578063363bf964146101c75780634ecf30e4146101f457806364c3dae61461020c578063715018a61461023557806377ee4b0f1461024a5780637d9527d61461025f5780638329de2f146102905780638da5cb5b146102a85780639f727c27146102bd578063cc89d596146102d2578063cd99754a146102f3578063cdc1842414610308578063dede553f1461031d578063e43e9de014610332578063ec24355514610347578063ef0300121461035f578063efef39a114610374578063f2fde38b1461037f575b34801561012457600080fd5b50005b34801561013357600080fd5b5061013c6103a0565b60408051918252519081900360200190f35b34801561015a57600080fd5b5061016f600160a060020a03600435166103a6565b005b34801561017d57600080fd5b5061013c6103ec565b34801561019257600080fd5b5061013c6103f2565b3480156101a757600080fd5b506101b36004356103f8565b604080519115158252519081900360200190f35b3480156101d357600080fd5b5061016f600160a060020a0360043581169060243581169060443516610463565b34801561020057600080fd5b5061016f60043561048a565b34801561021857600080fd5b5061016f60043560243560443560643560843560a43515156104a6565b34801561024157600080fd5b5061016f6104d5565b34801561025657600080fd5b5061013c610541565b34801561026b57600080fd5b50610274610547565b60408051600160a060020a039092168252519081900360200190f35b34801561029c57600080fd5b5061016f600435610556565b3480156102b457600080fd5b50610274610572565b3480156102c957600080fd5b5061016f610581565b3480156102de57600080fd5b5061013c600160a060020a03600435166105d6565b3480156102ff57600080fd5b5061013c610727565b34801561031457600080fd5b5061027461072d565b34801561032957600080fd5b5061027461073c565b34801561033e57600080fd5b5061027461074b565b34801561035357600080fd5b5061016f60043561075a565b34801561036b57600080fd5b5061013c6107ae565b61016f6004356107b4565b34801561038b57600080fd5b5061016f600160a060020a036004351661091d565b60075481565b600054600160a060020a031633146103bd57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b61138881565b60055481565b600454600090600160a060020a0316331461041257600080fd5b303182111561042057600080fd5b600454604051600160a060020a039091169083156108fc029084906000818181858888f1935050505015801561045a573d6000803e3d6000fd5b50600192915050565b600054600160a060020a0316331461047a57600080fd5b61048583838361093d565b505050565b600054600160a060020a031633146104a157600080fd5b600555565b600054600160a060020a031633146104bd57600080fd5b6104cd60018787878787876109f8565b505050505050565b600054600160a060020a031633146104ec57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60065490565b600154600160a060020a031681565b600054600160a060020a0316331461056d57600080fd5b600755565b600054600160a060020a031681565b600054600160a060020a0316331461059857600080fd5b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f193505050501580156105d3573d6000803e3d6000fd5b50565b6000600360009054906101000a9004600160a060020a0316600160a060020a03166389853691836040516020018082600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401807f6372797074616e740000000000000000000000000000000000000000000000008152506008019150506040516020818303038152906040526040518082805190602001908083835b602083106106945780518252601f199092019160209182019101610675565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156106f557600080fd5b505af1158015610709573d6000803e3d6000fd5b505050506040513d602081101561071f57600080fd5b505192915050565b60085481565b600454600160a060020a031681565b600354600160a060020a031681565b600254600160a060020a031681565b60008054600160a060020a0316331461077257600080fd5b5060005b818110156107aa5760088054600181019091556107a2906000906701aa535d3d0c0000828080806109f8565b600101610776565b5050565b60065481565b6001546000908190819081908190600160a060020a031615156107d657600080fd5b600254600160a060020a031615156107ed57600080fd5b600354600160a060020a0316151561080457600080fd5b6000861180156108155750600a8611155b151561082057600080fd5b61082861112c565b151561083357600080fd5b6007548601611388101561084657600080fd5b349450610851610541565b935085840292508285101561086557600080fd5b6064915085600a14156108835760075461088090600a611134565b91505b5060005b858110156108b557600780546001908101918290556108ad9186600080808888146109f8565b600101610887565b6108c33382610bb802611151565b506108ce85846112e6565b60408051878152610bb88302602082015284870381830152905133917f260ecffe36a912f3688d7fa915793137bbaf0980df289ffad7ae877d7ca0a23b919081900360600190a2505050505050565b600054600160a060020a0316331461093457600080fd5b6105d381611379565b60008080600160a060020a0386161561097c576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0388161790558592505b600160a060020a038516156109b7576002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387161790558491505b600160a060020a038416156104cd575060038054600160a060020a03851673ffffffffffffffffffffffffffffffffffffffff199091161790555050505050565b6060806000806000806004604051908082528060200260200182016040528015610a2c578160200160208202803883390190505b5060408051600480825260a0820190925291975060208201608080388339019050509450891515610b1357600154604080517f9d0c0c350000000000000000000000000000000000000000000000000000000081528f1515600482015289151560248201529051600160a060020a0390921691639d0c0c35916044808201926080929091908290030181600087803b158015610ac757600080fd5b505af1158015610adb573d6000803e3d6000fd5b505050506040513d6080811015610af157600080fd5b5080516020820151604083015160609093015191965094509092509050610b17565b8993505b8815610b21578892505b8715610b2f57879150610bcc565b811515610bcc57600154604080517f6f9fbd7c0000000000000000000000000000000000000000000000000000000081528151600160a060020a0390931692636f9fbd7c926004808401939192918290030181600087803b158015610b9357600080fd5b505af1158015610ba7573d6000803e3d6000fd5b505050506040513d6040811015610bbd57600080fd5b50805160209091015190925090505b600254604080517f23a36d2b000000000000000000000000000000000000000000000000000000008152336004820152602481018f9052604481018690529051600160a060020a03909216916323a36d2b9160648082019260009290919082900301818387803b158015610c3f57600080fd5b505af1158015610c53573d6000803e3d6000fd5b505050508b60405160200180828152602001807f67656e65000000000000000000000000000000000000000000000000000000008152506004019150506040516020818303038152906040526040518082805190602001908083835b60208310610cce5780518252601f199092019160209182019101610caf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856000815181101515610d0a57fe5b602090810290910101528551849087906000908110610d2557fe5b6020908102909101810191909152604080518083018f90527f6c6576656c0000000000000000000000000000000000000000000000000000008183015281516025818303018152604590910191829052805190928291908401908083835b60208310610da25780518252601f199092019160209182019101610d83565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856001815181101515610dde57fe5b602090810290910101528551600190879082908110610df957fe5b6020908102909101810191909152604080518083018f90527f686561727456616c756500000000000000000000000000000000000000000000818301528151602a818303018152604a90910191829052805190928291908401908083835b60208310610e765780518252601f199092019160209182019101610e57565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856002815181101515610eb257fe5b602090810290910101528551829087906002908110610ecd57fe5b6020908102909101810191909152604080518083018f90527f67726f77746856616c7565000000000000000000000000000000000000000000818301528151602b818303018152604b90910191829052805190928291908401908083835b60208310610f4a5780518252601f199092019160209182019101610f2b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856003815181101515610f8657fe5b602090810290910101528551819087906003908110610fa157fe5b6020908102909101810191909152600354604080517fedf87aff00000000000000000000000000000000000000000000000000000000815260048101918252885160448201528851600160a060020a039093169363edf87aff938a938c9390928392602483019260640191878101910280838360005b8381101561102f578181015183820152602001611017565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561106e578181015183820152602001611056565b50505050905001945050505050602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d60208110156110bf57600080fd5b505115156110cc57600080fd5b604080518d815260208101869052808201859052606081018d905260808101839052905133917f119326b1fd8ed92ff4f7d9da36e3caa7d39681c38d437053fe7e3965cf74aaf8919081900360a00190a250505050505050505050505050565b600554421090565b600081611140846113f6565b81151561114957fe5b069392505050565b600061116c82611160856105d6565b9063ffffffff61148216565b60035460408051600160a060020a038781166c01000000000000000000000000026020808401919091527f6372797074616e7400000000000000000000000000000000000000000000000060348401528351808403601c018152603c90930193849052825195965093169363adb44a32939192918291908401908083835b602083106112095780518252601f1990920191602091820191016111ea565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a028352600483015260248201899052925160448083019650939450929083900301905081600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506040513d602081101561129b57600080fd5b505060408051838152602081018390528151600160a060020a038616927fed28291c8ece55af2a3498316da394241d9026fd7256843843d9f4fa0a56f1e0928290030190a292915050565b60006112f8838363ffffffff61149516565b9050600081111561048557604051339082156108fc029083906000818181858888f19350505050158015611330573d6000803e3d6000fd5b506040805183815260208101859052808201839052905133917fb7048c2ad36aadee977bb16b4543a18866044d27a2ca753e1c7dbcfa7d7a6962919081900360600190a2505050565b600160a060020a038116151561138e57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b604080516000194301406020808301919091528183018490528251808303840181526060909201928390528151600093918291908401908083835b602083106114505780518252601f199092019160209182019101611431565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b8181018281101561148f57fe5b92915050565b6000828211156114a157fe5b509003905600a165627a7a723058209402982b42e1a1b857b05945b4e5a7dc5e8900789f969fbae7e799fb0748b33900290000000000000000000000003aeef44884383a170363d0053524712db80d4af00000000000000000000000002d00c17edbc2757ca33b76cc2465fa65b591a36700000000000000000000000030491d19a0a912a928c7e04cb8627e361d5cd434
Deployed Bytecode
0x6080604052600436106101185763ffffffff60e060020a6000350416629a9b7b81146101275780630d174c241461014e5780631aee3f9114610171578063249b7c19146101865780632e1a7d4d1461019b578063363bf964146101c75780634ecf30e4146101f457806364c3dae61461020c578063715018a61461023557806377ee4b0f1461024a5780637d9527d61461025f5780638329de2f146102905780638da5cb5b146102a85780639f727c27146102bd578063cc89d596146102d2578063cd99754a146102f3578063cdc1842414610308578063dede553f1461031d578063e43e9de014610332578063ec24355514610347578063ef0300121461035f578063efef39a114610374578063f2fde38b1461037f575b34801561012457600080fd5b50005b34801561013357600080fd5b5061013c6103a0565b60408051918252519081900360200190f35b34801561015a57600080fd5b5061016f600160a060020a03600435166103a6565b005b34801561017d57600080fd5b5061013c6103ec565b34801561019257600080fd5b5061013c6103f2565b3480156101a757600080fd5b506101b36004356103f8565b604080519115158252519081900360200190f35b3480156101d357600080fd5b5061016f600160a060020a0360043581169060243581169060443516610463565b34801561020057600080fd5b5061016f60043561048a565b34801561021857600080fd5b5061016f60043560243560443560643560843560a43515156104a6565b34801561024157600080fd5b5061016f6104d5565b34801561025657600080fd5b5061013c610541565b34801561026b57600080fd5b50610274610547565b60408051600160a060020a039092168252519081900360200190f35b34801561029c57600080fd5b5061016f600435610556565b3480156102b457600080fd5b50610274610572565b3480156102c957600080fd5b5061016f610581565b3480156102de57600080fd5b5061013c600160a060020a03600435166105d6565b3480156102ff57600080fd5b5061013c610727565b34801561031457600080fd5b5061027461072d565b34801561032957600080fd5b5061027461073c565b34801561033e57600080fd5b5061027461074b565b34801561035357600080fd5b5061016f60043561075a565b34801561036b57600080fd5b5061013c6107ae565b61016f6004356107b4565b34801561038b57600080fd5b5061016f600160a060020a036004351661091d565b60075481565b600054600160a060020a031633146103bd57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b61138881565b60055481565b600454600090600160a060020a0316331461041257600080fd5b303182111561042057600080fd5b600454604051600160a060020a039091169083156108fc029084906000818181858888f1935050505015801561045a573d6000803e3d6000fd5b50600192915050565b600054600160a060020a0316331461047a57600080fd5b61048583838361093d565b505050565b600054600160a060020a031633146104a157600080fd5b600555565b600054600160a060020a031633146104bd57600080fd5b6104cd60018787878787876109f8565b505050505050565b600054600160a060020a031633146104ec57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60065490565b600154600160a060020a031681565b600054600160a060020a0316331461056d57600080fd5b600755565b600054600160a060020a031681565b600054600160a060020a0316331461059857600080fd5b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f193505050501580156105d3573d6000803e3d6000fd5b50565b6000600360009054906101000a9004600160a060020a0316600160a060020a03166389853691836040516020018082600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401807f6372797074616e740000000000000000000000000000000000000000000000008152506008019150506040516020818303038152906040526040518082805190602001908083835b602083106106945780518252601f199092019160209182019101610675565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a0283526004830152925160248083019650939450929083900301905081600087803b1580156106f557600080fd5b505af1158015610709573d6000803e3d6000fd5b505050506040513d602081101561071f57600080fd5b505192915050565b60085481565b600454600160a060020a031681565b600354600160a060020a031681565b600254600160a060020a031681565b60008054600160a060020a0316331461077257600080fd5b5060005b818110156107aa5760088054600181019091556107a2906000906701aa535d3d0c0000828080806109f8565b600101610776565b5050565b60065481565b6001546000908190819081908190600160a060020a031615156107d657600080fd5b600254600160a060020a031615156107ed57600080fd5b600354600160a060020a0316151561080457600080fd5b6000861180156108155750600a8611155b151561082057600080fd5b61082861112c565b151561083357600080fd5b6007548601611388101561084657600080fd5b349450610851610541565b935085840292508285101561086557600080fd5b6064915085600a14156108835760075461088090600a611134565b91505b5060005b858110156108b557600780546001908101918290556108ad9186600080808888146109f8565b600101610887565b6108c33382610bb802611151565b506108ce85846112e6565b60408051878152610bb88302602082015284870381830152905133917f260ecffe36a912f3688d7fa915793137bbaf0980df289ffad7ae877d7ca0a23b919081900360600190a2505050505050565b600054600160a060020a0316331461093457600080fd5b6105d381611379565b60008080600160a060020a0386161561097c576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0388161790558592505b600160a060020a038516156109b7576002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387161790558491505b600160a060020a038416156104cd575060038054600160a060020a03851673ffffffffffffffffffffffffffffffffffffffff199091161790555050505050565b6060806000806000806004604051908082528060200260200182016040528015610a2c578160200160208202803883390190505b5060408051600480825260a0820190925291975060208201608080388339019050509450891515610b1357600154604080517f9d0c0c350000000000000000000000000000000000000000000000000000000081528f1515600482015289151560248201529051600160a060020a0390921691639d0c0c35916044808201926080929091908290030181600087803b158015610ac757600080fd5b505af1158015610adb573d6000803e3d6000fd5b505050506040513d6080811015610af157600080fd5b5080516020820151604083015160609093015191965094509092509050610b17565b8993505b8815610b21578892505b8715610b2f57879150610bcc565b811515610bcc57600154604080517f6f9fbd7c0000000000000000000000000000000000000000000000000000000081528151600160a060020a0390931692636f9fbd7c926004808401939192918290030181600087803b158015610b9357600080fd5b505af1158015610ba7573d6000803e3d6000fd5b505050506040513d6040811015610bbd57600080fd5b50805160209091015190925090505b600254604080517f23a36d2b000000000000000000000000000000000000000000000000000000008152336004820152602481018f9052604481018690529051600160a060020a03909216916323a36d2b9160648082019260009290919082900301818387803b158015610c3f57600080fd5b505af1158015610c53573d6000803e3d6000fd5b505050508b60405160200180828152602001807f67656e65000000000000000000000000000000000000000000000000000000008152506004019150506040516020818303038152906040526040518082805190602001908083835b60208310610cce5780518252601f199092019160209182019101610caf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856000815181101515610d0a57fe5b602090810290910101528551849087906000908110610d2557fe5b6020908102909101810191909152604080518083018f90527f6c6576656c0000000000000000000000000000000000000000000000000000008183015281516025818303018152604590910191829052805190928291908401908083835b60208310610da25780518252601f199092019160209182019101610d83565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856001815181101515610dde57fe5b602090810290910101528551600190879082908110610df957fe5b6020908102909101810191909152604080518083018f90527f686561727456616c756500000000000000000000000000000000000000000000818301528151602a818303018152604a90910191829052805190928291908401908083835b60208310610e765780518252601f199092019160209182019101610e57565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856002815181101515610eb257fe5b602090810290910101528551829087906002908110610ecd57fe5b6020908102909101810191909152604080518083018f90527f67726f77746856616c7565000000000000000000000000000000000000000000818301528151602b818303018152604b90910191829052805190928291908401908083835b60208310610f4a5780518252601f199092019160209182019101610f2b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020856003815181101515610f8657fe5b602090810290910101528551819087906003908110610fa157fe5b6020908102909101810191909152600354604080517fedf87aff00000000000000000000000000000000000000000000000000000000815260048101918252885160448201528851600160a060020a039093169363edf87aff938a938c9390928392602483019260640191878101910280838360005b8381101561102f578181015183820152602001611017565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561106e578181015183820152602001611056565b50505050905001945050505050602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d60208110156110bf57600080fd5b505115156110cc57600080fd5b604080518d815260208101869052808201859052606081018d905260808101839052905133917f119326b1fd8ed92ff4f7d9da36e3caa7d39681c38d437053fe7e3965cf74aaf8919081900360a00190a250505050505050505050505050565b600554421090565b600081611140846113f6565b81151561114957fe5b069392505050565b600061116c82611160856105d6565b9063ffffffff61148216565b60035460408051600160a060020a038781166c01000000000000000000000000026020808401919091527f6372797074616e7400000000000000000000000000000000000000000000000060348401528351808403601c018152603c90930193849052825195965093169363adb44a32939192918291908401908083835b602083106112095780518252601f1990920191602091820191016111ea565b51815160209384036101000a60001901801990921691161790526040805192909401829003822063ffffffff881660e060020a028352600483015260248201899052925160448083019650939450929083900301905081600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506040513d602081101561129b57600080fd5b505060408051838152602081018390528151600160a060020a038616927fed28291c8ece55af2a3498316da394241d9026fd7256843843d9f4fa0a56f1e0928290030190a292915050565b60006112f8838363ffffffff61149516565b9050600081111561048557604051339082156108fc029083906000818181858888f19350505050158015611330573d6000803e3d6000fd5b506040805183815260208101859052808201839052905133917fb7048c2ad36aadee977bb16b4543a18866044d27a2ca753e1c7dbcfa7d7a6962919081900360600190a2505050565b600160a060020a038116151561138e57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b604080516000194301406020808301919091528183018490528251808303840181526060909201928390528151600093918291908401908083835b602083106114505780518252601f199092019160209182019101611431565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b8181018281101561148f57fe5b92915050565b6000828211156114a157fe5b509003905600a165627a7a723058209402982b42e1a1b857b05945b4e5a7dc5e8900789f969fbae7e799fb0748b3390029
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003aeef44884383a170363d0053524712db80d4af00000000000000000000000002d00c17edbc2757ca33b76cc2465fa65b591a36700000000000000000000000030491d19a0a912a928c7e04cb8627e361d5cd434
-----Decoded View---------------
Arg [0] : _genesisCrabAddress (address): 0x3aEEf44884383A170363d0053524712dB80D4af0
Arg [1] : _cryptantCrabTokenAddress (address): 0x2d00c17EdBc2757Ca33b76cC2465Fa65B591A367
Arg [2] : _cryptantCrabStorageAddress (address): 0x30491d19a0A912a928c7E04CB8627E361d5Cd434
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000003aeef44884383a170363d0053524712db80d4af0
Arg [1] : 0000000000000000000000002d00c17edbc2757ca33b76cc2465fa65b591a367
Arg [2] : 00000000000000000000000030491d19a0a912a928c7e04cb8627e361d5cd434
Swarm Source
bzzr://9402982b42e1a1b857b05945b4e5a7dc5e8900789f969fbae7e799fb0748b339
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.