Smart contract pattern

Sources:

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)
    • Quoter [1] [2] [3] [4]: Restricts the contract consumption.
    • Fungible Token [1] [2]: aka ERC20 and new ERC777
    • Non Fungible Token [1]: aka ERC721
    • Multi Token [1]: aka ERC1155
    • PaymentSplitter [1]: Share money across multiple participants
    • Money pool [1]: Collect money/ token from multiple spender

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *