November 2018
Intermediate to advanced
528 pages
13h 21m
English
At this final step, let's have some fun.
What about introducing a nuclear launch button in our contract that, once pushed by the auction owner, will make the contract disappear from the blockchain? The contract destruction will be ensured by the destruct_auction() method, which can be invoked if all participants have withdrawn their bids, as follows:
function destruct_auction() external only_owner returns (bool) { require(now > auction_end, "You can't destruct the contract,The auction is still open"); for (uint i = 0; i < bidders.length; i++) { assert(bids[bidders[i]] == 0); } selfdestruct(auction_owner); return true;}
The first thing that we can see here is that Solidity defines for-loops like standard languages, and ...
Read now
Unlock full access