Hi I am working on the auction app in block chain using solidity as smart contract in Ethereum
. The requirements are
I want to add another functionality by self destructing
the auction after specified amount of time and no other auction will take place after that.
How can we do this in solidity?
Any help would be really appreciated.Thanks!
Certainly. I have similar task in my dApp. I solve it using block.timestamp
field. Timestamp field returns timestamp of latest block. You can solve your problem by using the following construct at the start of all methods related to auction bidding:
require(block.timestamp > auction.endTime, "Auction is closed.");
Essentially what it does is block any code if it happens after your auctions end time. Let me know if you need more help.