Guest User

Untitled

a guest
Dec 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. pragma solidity >=0.4.22 <0.6.0;
  2. import "./ClockAuctionBase.sol";
  3.  
  4. contract ClockAuction is ClockAuctionBase{
  5.  
  6. //bytes4 constant InterfaceSignature_ERC721 = bytes4(0x9a20483d);
  7. /*
  8. constructor(address _nftAddress) public {
  9. ERC721 candidateContract = ERC721(_nftAddress);
  10. nonFungibleContract = candidateContract;
  11. }
  12. */
  13. function createAuction(
  14. uint256 _tokenId,
  15. uint256 _price,
  16. uint256 _duration,
  17. address _seller
  18. )
  19. public
  20. {
  21.  
  22. require(_price == uint256(uint128(_price)));
  23. require(_duration == uint256(uint64(_duration)));
  24.  
  25. //require(msg.sender == address(nonFungibleContract));
  26.  
  27. Auction memory auction = Auction(
  28. _seller,
  29. uint128(_price),
  30. uint64(_duration),
  31. uint64(now)
  32. );
  33. _addAuction(_tokenId, auction);
  34. }
  35.  
  36. /// @dev Updates lastSalePrice if seller is the nft contract
  37. /// Otherwise, works the same as default bid method.
  38.  
  39. function bid(uint256 _tokenId)
  40. external
  41. payable
  42. {
  43. // _bid verifies token ID size
  44. _bid(_tokenId, msg.value);
  45. }
  46.  
  47. function cancelAuction(uint256 _tokenId)
  48. external
  49. {
  50. Auction storage auction = tokenIdToAuction[_tokenId];
  51. require(_isOnAuction(auction));
  52. address seller = auction.seller;
  53. require(msg.sender == seller);
  54. _cancelAuction(_tokenId);
  55. }
  56.  
  57. function getAuction(uint256 _tokenId)
  58. external
  59. view
  60. returns
  61. (
  62. address seller,
  63. uint256 price,
  64. uint256 duration,
  65. uint256 startedAt
  66. ) {
  67. Auction storage auction = tokenIdToAuction[_tokenId];
  68. require(_isOnAuction(auction));
  69. return (
  70. auction.seller,
  71. auction.price,
  72. auction.duration,
  73. auction.startedAt
  74. );
  75. }
  76.  
  77. }
Add Comment
Please, Sign In to add comment