EIP-2535 Diamonds encapsulates some good ideas and a pattern for developing flexible smart contract-based applications.
The EIP explains the pattern and how it works. And it standardizes certain things. But why?
I think the reasons why diamonds need standardization deserves more attention. And it is an area that people and developers can help with.
Standardization is needed to make the diamond pattern more useful and fulfill its design.
Specifically standardization is needed for these two things:
A key feature of the Diamond Standard is transparent upgrades on blockchains. The Diamond Standard used to be the Transparent Contract Standard. There is an interesting article about it that covers transparency.
A diamond provides at least two kinds of transparency:
- Realtime transparency, using the diamond loupe.
- Historical transparency using the DiamondCut event.
The diamond loupe enables people to see what functions and facets a diamond currently has. This is standardized so that tools can be made to show people what functions and facets a diamond has. There is a many to many relationship here. There can be many diamonds. There can be many (or multiple) client software programs that show diamonds. Standardizing the loupe functions makes this many to many relationship possible. Standarizing the loup functions encourages software to be developed that makes diamonds more transparent.
DiamondCut event is emitted any time any function is added/replaced/removed on a diamond. This is standardized so that multiple software programs can be developed that can show all upgrades to all diamonds on a network, thus making diamond upgrades transparent.
Etherscan has expressed some interest in supporting diamonds and I think there will be more interest in creating diamond transparency tools and user interfaces as more projects use the Diamond Standard. More projects are using the Diamond Standard. I know of several projects in development that are using diamonds, including DerivaDex.
Check out https://louper.dev/ which is a user interface that can work for all diamonds.
diamondCut function adds/replaces/removes any number of functions on a diamond in a single transaction. This function is standardized so that multiple tools can be made to create diamonds and upgrade upgradeable diamonds. This enables someone with diamonds to migrate or use different tools, or have more choice of tools, for upgrading or creating diamonds.
A couple tools have been made or added support for creating, deploying and upgrading diamonds:
I expect more tools to be created.