Sources:
- https://github.com/fravoll/solidity-patterns
- https://github.com/maxwoe/solidity_patterns
- https://github.com/fodisi/solidity-design-patterns
- https://github.com/OpenZeppelin/
The smart contract approach e.g., of Ethereum distinguish types of design pattern. Use them at your own risk!
- Behavior pattern: As interaction flow between accounts
- Auction [1] [2]: Multiple accounts bid, the highest or a random bid rules, to a provider
- Guarantee [1] [2] : One or many account(s) give a deposit which can be released or taken by holder
- Mutex [1] [2] [3]: An election or lock of one or many accounts on a (contract) concern (aka Access Control)
- Data Segregation [1] [2]: Also known as Interplanetary Filesystem (short IPFS) or Eternal; each data portion has its unique location-address
- Credit [1]: Pull something from a provider.
- State machine [1]: Go through a defined sequence of states
- Security pattern: Contract as subject of concern
- Ownership [1] [2]: The contract is a concern, hold by an account. Also compare Mutex.
- Deprecation [1] [2]: Use ledger block number, date, etc. as time-to-live
- Upgradeability [1] [2] [3]: The contract has multiple versions; may only one is valid. Also compare Ownership.
- Delegation [1] [2]: The contract delegates operation to other contracts aka cause-effect chain. Also compare Ownership.
- Personalization [1]: Keep account specific information
- Oracle [1]: Access external data.
- Proxy [1]: Encapsulate access to multiple resource through one entry point. Also compare Delegation.
- Self Sovereign Identity [1]: aka ERC725. Also compare https://erc725alliance.org (https://github.com/erc725alliance)
- Economic pattern: Everything in relation to its gas (consumption)