TheAlgorithms / Solidity

Algorithms and data structures implemented in Solidity
GNU Lesser General Public License v2.1
326 stars 88 forks source link

[pattern]: add emergencyStop solidity pattern + readme #16

Closed mkubdev closed 2 years ago

mkubdev commented 2 years ago

Adding EmergencyStop Solidity pattern.

EmergencyStop pattern

This model incorporates the possibility of suspending the execution of all the functions in the contract in the event of a problem. Since contracts are immutable once deployed; if there are bugs in the contract, the pause feature can be activated to prevent further damage.

The emergency pause functionality must be under the control of the owner or an authorized address. The emergency stop pattern should be avoided at all costs as it goes against the spirit of decentralization, but in cases where centralized control is required, it could be a valid model to include in your contract.