Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity >=0.4.22 <0.6.0;
- import "./ClockAuctionBase.sol";
- contract ClockAuction is ClockAuctionBase{
- //bytes4 constant InterfaceSignature_ERC721 = bytes4(0x9a20483d);
- /*
- constructor(address _nftAddress) public {
- ERC721 candidateContract = ERC721(_nftAddress);
- nonFungibleContract = candidateContract;
- }
- */
- function createAuction(
- uint256 _tokenId,
- uint256 _price,
- uint256 _duration,
- address _seller
- )
- public
- {
- require(_price == uint256(uint128(_price)));
- require(_duration == uint256(uint64(_duration)));
- //require(msg.sender == address(nonFungibleContract));
- Auction memory auction = Auction(
- _seller,
- uint128(_price),
- uint64(_duration),
- uint64(now)
- );
- _addAuction(_tokenId, auction);
- }
- /// @dev Updates lastSalePrice if seller is the nft contract
- /// Otherwise, works the same as default bid method.
- function bid(uint256 _tokenId)
- external
- payable
- {
- // _bid verifies token ID size
- _bid(_tokenId, msg.value);
- }
- function cancelAuction(uint256 _tokenId)
- external
- {
- Auction storage auction = tokenIdToAuction[_tokenId];
- require(_isOnAuction(auction));
- address seller = auction.seller;
- require(msg.sender == seller);
- _cancelAuction(_tokenId);
- }
- function getAuction(uint256 _tokenId)
- external
- view
- returns
- (
- address seller,
- uint256 price,
- uint256 duration,
- uint256 startedAt
- ) {
- Auction storage auction = tokenIdToAuction[_tokenId];
- require(_isOnAuction(auction));
- return (
- auction.seller,
- auction.price,
- auction.duration,
- auction.startedAt
- );
- }
- }
Add Comment
Please, Sign In to add comment