Stoppable/haltable smart contract pattern
The next pattern we will discuss is used heavily with smart contracts related to ICOs. We all know that smart contracts deployed on public Ethereum can be accessed by anyone. Thus, these contracts can be subjected to multiple types of hacking attacks. There have been several occasions, either because of the shortcomings of a smart contract or the hacker being able to find vulnerabilities, where smart contracts have been hacked, their balances siphoned off, and even the ownership being changed to some other externally owned account. We also know that smart contracts are immutable and there is no way they can be deactivated or activated at will. At such times, it is important that the smart contract execution can be stopped to minimize losses. The pattern we will discuss next is known as the haltable, stoppable, or pausable pattern.
This pattern stops the execution of functions within a smart contract and can resume the execution after the...