Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 8 from a total of 8 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Beneficiary With... | 5675956 | 2479 days ago | IN | 0 ETH | 0.00036309 | ||||
Withdraw Token | 5613778 | 2490 days ago | IN | 0 ETH | 0.00140959 | ||||
End Auction | 5613774 | 2490 days ago | IN | 0 ETH | 0.00015444 | ||||
End Auction | 5613772 | 2490 days ago | IN | 0 ETH | 0.00021805 | ||||
End Auction | 5613748 | 2490 days ago | IN | 0 ETH | 0.000176 | ||||
Bid | 5464065 | 2516 days ago | IN | 0.0025 ETH | 0.00127082 | ||||
Bid | 5457872 | 2517 days ago | IN | 0.001 ETH | 0.00127082 | ||||
Set RC Contract ... | 5457556 | 2518 days ago | IN | 0 ETH | 0.00008785 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Method | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|---|
Transfer | 5675956 | 2479 days ago | 0.0035 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
RareCoinAuction
Compiler Version
v0.4.21+commit.dfe3193c
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-04-16 */ pragma solidity ^0.4.11; pragma solidity ^0.4.10; pragma solidity ^0.4.18; pragma solidity ^0.4.18; pragma solidity ^0.4.18; /** * @title ERC721 Non-Fungible Token Standard basic interface * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Basic { event Transfer(address indexed _from, address indexed _to, uint256 _tokenId); event Approval(address indexed _owner, address indexed _approved, uint256 _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 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() public view returns (string _name); function symbol() public 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 { } pragma solidity ^0.4.18; pragma solidity ^0.4.18; /** * @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,uint256,bytes)"))`, * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` */ bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; /** * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a `safetransfer`. This function MAY throw to revert and reject the * transfer. This function MUST use 50,000 gas or less. Return of other * than the magic value MUST result in the transaction being reverted. * Note: the contract address is always the message sender. * @param _from The sending address * @param _tokenId The NFT identifier which is being transfered * @param _data Additional data with no specified format * @return `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))` */ function onERC721Received(address _from, uint256 _tokenId, bytes _data) public returns(bytes4); } pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev 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) { uint256 c = a + b; assert(c >= a); return c; } } pragma solidity ^0.4.18; /** * Utility library of inline functions on addresses */ library AddressUtils { /** * Returns whether there is code in the target address * @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 address to check * @return whether there is code in the target address */ function isContract(address addr) internal view returns (bool) { uint256 size; assembly { size := extcodesize(addr) } return size > 0; } } /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721BasicToken is ERC721Basic { using SafeMath for uint256; using AddressUtils for address; // Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))` // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; // 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)); _; } /** * @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 existance 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 * @dev The zero address indicates there is no approved address. * @dev There can only be one approved address per token at a given time. * @dev 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)); if (getApproved(_tokenId) != address(0) || _to != address(0)) { tokenApprovals[_tokenId] = _to; 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 a 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 * @dev 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; 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 * @dev Usage of this method is discouraged, use `safeTransferFrom` whenever possible * @dev 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); Transfer(_from, _to, _tokenId); } /** * @dev Safely transfers the ownership of a given token ID to another address * @dev 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,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @dev 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) { safeTransferFrom(_from, _to, _tokenId, ""); } /** * @dev Safely transfers the ownership of a given token ID to another address * @dev 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,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @dev 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); 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); return _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender); } /** * @dev Internal function to mint a new token * @dev 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); Transfer(address(0), _to, _tokenId); } /** * @dev Internal function to burn a specific token * @dev 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); Transfer(_owner, address(0), _tokenId); } /** * @dev Internal function to clear current approval of a given token ID * @dev 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); Approval(_owner, address(0), _tokenId); } } /** * @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 * @dev 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(_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 ERC721, ERC721BasicToken { // 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 */ function ERC721Token(string _name, string _symbol) public { name_ = _name; symbol_ = _symbol; } /** * @dev Gets the token name * @return string representing the token name */ function name() public view returns (string) { return name_; } /** * @dev Gets the token symbol * @return string representing the token symbol */ function symbol() public view returns (string) { return symbol_; } /** * @dev Returns an URI for a given token ID * @dev 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 Internal function to set the token URI for a given token * @dev 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 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 * @dev 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 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 * @dev 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 * @dev 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 RareCoin is ERC721Token("RareCoin", "XRC") { bool[100] internal _initialized; address _auctionContract; function RareCoin(address auctionContract) public { _auctionContract = auctionContract; } /** * @notice Creates a RareCoin token. Only callable by the RareCoin auction contract * @dev This will fail if not called by the auction contract * @param i Coin number */ function CreateToken(address owner, uint i) public { require(msg.sender == _auctionContract); require(!_initialized[i - 1]); _initialized[i - 1] = true; _mint(owner, i); } } /** * @title Auction contract for RareCoin */ contract RareCoinAuction { using SafeMath for uint256; // Block number for the end of the auction uint internal _auctionEnd; // Toggles the auction from allowing bids to allowing withdrawals bool internal _ended; // Address of auction beneficiary address internal _beneficiary; // Used to only allow the beneficiary to withdraw once bool internal _beneficiaryWithdrawn; // Value of bid #100 uint internal _lowestBid; // Used for details of the top 100 bids struct Bidder { uint bid; address bidderAddress; } // Used for details of every bid struct BidDetails { uint value; uint lastTime; } // Contains details of every bid mapping(address => BidDetails) internal _bidders; // Static array recording highest 100 bidders in sorted order Bidder[100] internal _topBids; // Address of coin contract address internal _rcContract; bool[100] internal _coinWithdrawn; event NewBid(address bidder, uint amount); event TopThreeChanged( address first, uint firstBid, address second, uint secondBid, address third, uint thirdBid ); event AuctionEnded( address first, uint firstBid, address second, uint secondBid, address third, uint thirdBid ); /** * @notice Constructor * @param biddingTime Number of blocks auction should last for */ function RareCoinAuction(uint biddingTime) public { _auctionEnd = block.number + biddingTime; _beneficiary = msg.sender; } /** * @notice Connect the auction contract to the RareCoin contract * @param rcContractAddress Address of RareCoin contract */ function setRCContractAddress(address rcContractAddress) public { require(msg.sender == _beneficiary); require(_rcContract == address(0)); _rcContract = rcContractAddress; } /** * @notice Bid `(msg.value)` ether for a chance of winning a RareCoin * @dev This will be rejected if the bid will not end up in the top 100 */ function bid() external payable { require(block.number < _auctionEnd); uint proposedBid = _bidders[msg.sender].value.add(msg.value); // No point in accepting a bid if it isn't going to result in a chance of a RareCoin require(proposedBid > _lowestBid); // Check whether the bidder is already in the top 100. Note, not enough to check currentBid > _lowestBid // since there can be multiple bids of the same value uint startPos = 99; if (_bidders[msg.sender].value >= _lowestBid) { // Note: loop condition relies on overflow for (uint i = 99; i < 100; --i) { if (_topBids[i].bidderAddress == msg.sender) { startPos = i; break; } } } // Do one pass of an insertion sort to maintain _topBids in order uint endPos; for (uint j = startPos; j < 100; --j) { if (j != 0 && proposedBid > _topBids[j - 1].bid) { _topBids[j] = _topBids[j - 1]; } else { _topBids[j].bid = proposedBid; _topBids[j].bidderAddress = msg.sender; endPos = j; break; } } // Update _bidders with new information _bidders[msg.sender].value = proposedBid; _bidders[msg.sender].lastTime = now; // Record bid of 100th place bidder for next time _lowestBid = _topBids[99].bid; // If top 3 bidders changes, log event to blockchain if (endPos < 3) { TopThreeChanged( _topBids[0].bidderAddress, _topBids[0].bid, _topBids[1].bidderAddress, _topBids[1].bid, _topBids[2].bidderAddress, _topBids[2].bid ); } NewBid(msg.sender, _bidders[msg.sender].value); } /** * @notice Withdraw the total of the top 100 bids into the beneficiary account */ function beneficiaryWithdraw() external { require(msg.sender == _beneficiary); require(_ended); require(!_beneficiaryWithdrawn); uint total = 0; for (uint i = 0; i < 100; ++i) { total = total.add(_topBids[i].bid); } _beneficiaryWithdrawn = true; _beneficiary.transfer(total); } /** * @notice Withdraw your deposit at the end of the auction * @return Whether the withdrawal succeeded */ function withdraw() external returns (bool) { require(_ended); // The user should not be able to withdraw if they are in the top 100 bids // Cannot simply require(proposedBid > _lowestBid) since bid #100 can be // the same value as bid #101 for (uint i = 0; i < 100; ++i) { require(_topBids[i].bidderAddress != msg.sender); } uint amount = _bidders[msg.sender].value; if (amount > 0) { _bidders[msg.sender].value = 0; msg.sender.transfer(amount); } return true; } /** * @notice Withdraw your RareCoin if you are in the top 100 bidders at the end of the auction * @dev This function creates the RareCoin token in the corresponding address. Can be called * by anyone. Note that it is the coin number (1 based) not array index that is supplied * @param tokenNumber The number of the RareCoin to withdraw. * @return Whether The auction succeeded */ function withdrawToken(uint tokenNumber) external returns (bool) { require(_ended); require(!_coinWithdrawn[tokenNumber - 1]); _coinWithdrawn[tokenNumber - 1] = true; RareCoin(_rcContract).CreateToken(_topBids[tokenNumber - 1].bidderAddress, tokenNumber); return true; } /** * @notice End the auction, allowing the withdrawal of ether and tokens */ function endAuction() external { require(block.number >= _auctionEnd); require(!_ended); _ended = true; AuctionEnded( _topBids[0].bidderAddress, _topBids[0].bid, _topBids[1].bidderAddress, _topBids[1].bid, _topBids[2].bidderAddress, _topBids[2].bid ); } /** * @notice Returns the value of `(_addr)`'s bid and the time it occurred * @param _addr Address to query for balance * @return Tuple (value, bidTime) */ function getBidDetails(address _addr) external view returns (uint, uint) { return (_bidders[_addr].value, _bidders[_addr].lastTime); } /** * @notice Returns a sorted array of the top 100 bidders * @return The top 100 bidders, sorted by bid */ function getTopBidders() external view returns (address[100]) { address[100] memory tempArray; for (uint i = 0; i < 100; ++i) { tempArray[i] = _topBids[i].bidderAddress; } return tempArray; } /** * @notice Get the block the auction ends on * @return The block the auction ends on */ function getAuctionEnd() external view returns (uint) { return _auctionEnd; } /** * @notice Get whether the auction has ended * @return Whether the auction has ended */ function getEnded() external view returns (bool) { return _ended; } /** * @notice Get the address of the RareCoin contract * @return The address of the RareCoin contract */ function getRareCoinAddress() external view returns (address) { return _rcContract; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":true,"inputs":[],"name":"getEnded","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"bid","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"getTopBidders","outputs":[{"name":"","type":"address[100]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"tokenNumber","type":"uint256"}],"name":"withdrawToken","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"rcContractAddress","type":"address"}],"name":"setRCContractAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getAuctionEnd","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"getBidDetails","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"beneficiaryWithdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getRareCoinAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"endAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"biddingTime","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"bidder","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"NewBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"first","type":"address"},{"indexed":false,"name":"firstBid","type":"uint256"},{"indexed":false,"name":"second","type":"address"},{"indexed":false,"name":"secondBid","type":"uint256"},{"indexed":false,"name":"third","type":"address"},{"indexed":false,"name":"thirdBid","type":"uint256"}],"name":"TopThreeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"first","type":"address"},{"indexed":false,"name":"firstBid","type":"uint256"},{"indexed":false,"name":"second","type":"address"},{"indexed":false,"name":"secondBid","type":"uint256"},{"indexed":false,"name":"third","type":"address"},{"indexed":false,"name":"thirdBid","type":"uint256"}],"name":"AuctionEnded","type":"event"}]
Contract Creation Code
6060604052341561000f57600080fd5b604051602080610a98833981016040528080514301600055505060018054600160a060020a0333166101000261010060a860020a0319909116179055610a3e8061005a6000396000f3006060604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630cc79a8581146100b35780631998aeef146100da5780633026aedf146100e45780633ccfd60b1461013057806350baa622146101435780637f4764711461015957806387dc0c55146101785780638d07ae9f1461019d5780639af6549a146101d4578063e098161b146101e7578063fe67a54b14610216575b600080fd5b34156100be57600080fd5b6100c6610229565b604051901515815260200160405180910390f35b6100e2610232565b005b34156100ef57600080fd5b6100f7610513565b6040518082610c8080838360005b8381101561011d578082015183820152602001610105565b5050505090500191505060405180910390f35b341561013b57600080fd5b6100c661057a565b341561014e57600080fd5b6100c660043561064d565b341561016457600080fd5b6100e2600160a060020a0360043516610771565b341561018357600080fd5b61018b6107d6565b60405190815260200160405180910390f35b34156101a857600080fd5b6101bc600160a060020a03600435166107dc565b60405191825260208201526040908101905180910390f35b34156101df57600080fd5b6100e26107ff565b34156101f257600080fd5b6101fa61090d565b604051600160a060020a03909116815260200160405180910390f35b341561022157600080fd5b6100e261091c565b60015460ff1690565b600080600080600080544310151561024957600080fd5b600160a060020a033316600090815260036020526040902054610272903463ffffffff6109d316565b600254909550851161028357600080fd5b600254600160a060020a03331660009081526003602052604090205460639550106102f857606392505b60648310156102f857600160a060020a033316600484606481106102cd57fe5b6002020160010154600160a060020a031614156102ec578293506102f8565b600019909201916102ad565b50825b60648110156103f15780158015906103275750600460001982016064811061031f57fe5b600202015485115b1561039457600460001982016064811061033d57fe5b600202016004826064811061034e57fe5b8254600291909102919091019081556001918201549101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790556103e8565b84600482606481106103a257fe5b600202015533600482606481106103b557fe5b6002020160010160006101000a815481600160a060020a030219169083600160a060020a031602179055508091506103f1565b600019016102fb565b33600160a060020a031660009081526003602081905260409091208681554260019091015560ca546002558210156104ae576005546004546007546006546009546008547f06f522a2ffcf2f6b62f6c4455221d015bb2da8e2fdb2394acb5c3ef40129e45e95600160a060020a039081169594811693921690604051600160a060020a03968716815260208101959095529285166040808601919091526060850192909252909316608083015260a082015260c001905180910390a15b33600160a060020a03811660009081526003602052604090819020547fdd0b6c6a77960e2066c96171b4d7ac9e8b4c184011f38544afa36a5bb63ec59f929151600160a060020a03909216825260208201526040908101905180910390a15050505050565b61051b6109e9565b6105236109e9565b60005b6064811015610574576004816064811061053c57fe5b6002020160010154600160a060020a031682826064811061055957fe5b600160a060020a039092166020929092020152600101610526565b50919050565b6001546000908190819060ff16151561059257600080fd5b600091505b60648210156105de57600160a060020a033316600483606481106105b757fe5b6002020160010154600160a060020a031614156105d357600080fd5b816001019150610597565b50600160a060020a0333166000908152600360205260408120549081111561064457600160a060020a0333166000818152600360205260408082209190915582156108fc0290839051600060405180830381858888f19350505050151561064457600080fd5b60019250505090565b60015460009060ff16151561066157600080fd5b60cd60001983016064811061067257fe5b602081049091015460ff601f9092166101000a9004161561069257600080fd5b600160cd6000198401606481106106a557fe5b602081049091018054921515601f9092166101000a91820260ff9092021990921617905560cc54600160a060020a031663b378e89b60046000198501606481106106eb57fe5b6002020160010154600160a060020a0316846040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561075957600080fd5b5af1151561076657600080fd5b506001949350505050565b60015433600160a060020a03908116610100909204161461079157600080fd5b60cc54600160a060020a0316156107a757600080fd5b60cc805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005490565b600160a060020a0316600090815260036020526040902080546001909101549091565b600154600090819033600160a060020a03908116610100909204161461082457600080fd5b60015460ff16151561083557600080fd5b6001547501000000000000000000000000000000000000000000900460ff161561085e57600080fd5b5060009050805b606481101561089a576108906004826064811061087e57fe5b6002020154839063ffffffff6109d316565b9150600101610865565b6001805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790819055600160a060020a036101009091041682156108fc0283604051600060405180830381858888f19350505050151561090957600080fd5b5050565b60cc54600160a060020a031690565b60005443101561092b57600080fd5b60015460ff161561093b57600080fd5b6001805460ff1916811790556005546004546007546006546009546008547fb082c8a76501a2c5727aabf9127046a5a8be4c4da6e8dd60a33b7cbddd14b15695600160a060020a039081169594811693921690604051600160a060020a03968716815260208101959095529285166040808601919091526060850192909252909316608083015260a082015260c001905180910390a1565b6000828201838110156109e257fe5b9392505050565b610c806040519081016040526064815b6000815260001990910190602001816109f957905050905600a165627a7a72305820219a1c4f885e1d0605fcff99768ecd76a5a2b0aec58956025e2cfba8aa7689d000290000000000000000000000000000000000000000000000000000000000024518
Deployed Bytecode
0x6060604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630cc79a8581146100b35780631998aeef146100da5780633026aedf146100e45780633ccfd60b1461013057806350baa622146101435780637f4764711461015957806387dc0c55146101785780638d07ae9f1461019d5780639af6549a146101d4578063e098161b146101e7578063fe67a54b14610216575b600080fd5b34156100be57600080fd5b6100c6610229565b604051901515815260200160405180910390f35b6100e2610232565b005b34156100ef57600080fd5b6100f7610513565b6040518082610c8080838360005b8381101561011d578082015183820152602001610105565b5050505090500191505060405180910390f35b341561013b57600080fd5b6100c661057a565b341561014e57600080fd5b6100c660043561064d565b341561016457600080fd5b6100e2600160a060020a0360043516610771565b341561018357600080fd5b61018b6107d6565b60405190815260200160405180910390f35b34156101a857600080fd5b6101bc600160a060020a03600435166107dc565b60405191825260208201526040908101905180910390f35b34156101df57600080fd5b6100e26107ff565b34156101f257600080fd5b6101fa61090d565b604051600160a060020a03909116815260200160405180910390f35b341561022157600080fd5b6100e261091c565b60015460ff1690565b600080600080600080544310151561024957600080fd5b600160a060020a033316600090815260036020526040902054610272903463ffffffff6109d316565b600254909550851161028357600080fd5b600254600160a060020a03331660009081526003602052604090205460639550106102f857606392505b60648310156102f857600160a060020a033316600484606481106102cd57fe5b6002020160010154600160a060020a031614156102ec578293506102f8565b600019909201916102ad565b50825b60648110156103f15780158015906103275750600460001982016064811061031f57fe5b600202015485115b1561039457600460001982016064811061033d57fe5b600202016004826064811061034e57fe5b8254600291909102919091019081556001918201549101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790556103e8565b84600482606481106103a257fe5b600202015533600482606481106103b557fe5b6002020160010160006101000a815481600160a060020a030219169083600160a060020a031602179055508091506103f1565b600019016102fb565b33600160a060020a031660009081526003602081905260409091208681554260019091015560ca546002558210156104ae576005546004546007546006546009546008547f06f522a2ffcf2f6b62f6c4455221d015bb2da8e2fdb2394acb5c3ef40129e45e95600160a060020a039081169594811693921690604051600160a060020a03968716815260208101959095529285166040808601919091526060850192909252909316608083015260a082015260c001905180910390a15b33600160a060020a03811660009081526003602052604090819020547fdd0b6c6a77960e2066c96171b4d7ac9e8b4c184011f38544afa36a5bb63ec59f929151600160a060020a03909216825260208201526040908101905180910390a15050505050565b61051b6109e9565b6105236109e9565b60005b6064811015610574576004816064811061053c57fe5b6002020160010154600160a060020a031682826064811061055957fe5b600160a060020a039092166020929092020152600101610526565b50919050565b6001546000908190819060ff16151561059257600080fd5b600091505b60648210156105de57600160a060020a033316600483606481106105b757fe5b6002020160010154600160a060020a031614156105d357600080fd5b816001019150610597565b50600160a060020a0333166000908152600360205260408120549081111561064457600160a060020a0333166000818152600360205260408082209190915582156108fc0290839051600060405180830381858888f19350505050151561064457600080fd5b60019250505090565b60015460009060ff16151561066157600080fd5b60cd60001983016064811061067257fe5b602081049091015460ff601f9092166101000a9004161561069257600080fd5b600160cd6000198401606481106106a557fe5b602081049091018054921515601f9092166101000a91820260ff9092021990921617905560cc54600160a060020a031663b378e89b60046000198501606481106106eb57fe5b6002020160010154600160a060020a0316846040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561075957600080fd5b5af1151561076657600080fd5b506001949350505050565b60015433600160a060020a03908116610100909204161461079157600080fd5b60cc54600160a060020a0316156107a757600080fd5b60cc805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005490565b600160a060020a0316600090815260036020526040902080546001909101549091565b600154600090819033600160a060020a03908116610100909204161461082457600080fd5b60015460ff16151561083557600080fd5b6001547501000000000000000000000000000000000000000000900460ff161561085e57600080fd5b5060009050805b606481101561089a576108906004826064811061087e57fe5b6002020154839063ffffffff6109d316565b9150600101610865565b6001805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790819055600160a060020a036101009091041682156108fc0283604051600060405180830381858888f19350505050151561090957600080fd5b5050565b60cc54600160a060020a031690565b60005443101561092b57600080fd5b60015460ff161561093b57600080fd5b6001805460ff1916811790556005546004546007546006546009546008547fb082c8a76501a2c5727aabf9127046a5a8be4c4da6e8dd60a33b7cbddd14b15695600160a060020a039081169594811693921690604051600160a060020a03968716815260208101959095529285166040808601919091526060850192909252909316608083015260a082015260c001905180910390a1565b6000828201838110156109e257fe5b9392505050565b610c806040519081016040526064815b6000815260001990910190602001816109f957905050905600a165627a7a72305820219a1c4f885e1d0605fcff99768ecd76a5a2b0aec58956025e2cfba8aa7689d00029
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000024518
-----Decoded View---------------
Arg [0] : biddingTime (uint256): 148760
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000024518
Swarm Source
bzzr://219a1c4f885e1d0605fcff99768ecd76a5a2b0aec58956025e2cfba8aa7689d0
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 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.