You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains a collection of design and programming patterns for the smart contract programming language Solidity in version 0.4.20. Note that newer versions might have changed some of the functionalities.
Each pattern consists of a code sample and a detailed explanation, including background, implications and additional information about the patterns.
Pull over Push: Shift the risk associated with transferring ether to the user.
Emergency Stop: Add an option to disable critical contract functionality in case of an emergency.
Upgradeability Patterns
Proxy Delegate: Introduce the possibility to upgrade smart contracts without breaking any dependencies.
Eternal Storage: Keep contract storage after a smart contract upgrade.
Economic Patterns
String Equality Comparison: Check for the equality of two provided strings in a way that minimizes average gas consumption for a large number of different inputs.
Tight Variable Packing: Optimize gas consumption when storing or loading statically-sized variables.
Memory Array Building: Aggregate and retrieve data from contract storage in a gas efficient way.
Disclaimer
This repository is not under active development anymore and some (if not most) sections might be outdated. There is no liability for any damages caused by the use of one of these patterns.
About
A compilation of patterns and best practices for the smart contract programming language Solidity