Gelato Network Contracts
Intro to Gelato's use of the Diamond Proxy pattern
Gelato Network is designed to handle the rapidly evolving multi-chain landscape with its diversity of L1, L2 and sidechain designs. Significant differences can be found across aspects such as consensus mechanisms, block times, likelihood of block re-orgs and transaction fee models.
A Diamond contains:
- Proxy contract that holds all state variables.
- Facets which are smart contracts that implement any desired functionality and can be replaced at any time.
- Libraries, which can be used to share state variables and utility functions across all Facets.
- Having a single smart contract holding all the state, while not running into issues of exceeding bytecode size.
- Ability to share state variables and functions between multiple Facets.
- Fine-grained control in terms of which components of the protocol to upgrade. This means that protocol upgrades are gas-efficient.
- Optionality of changing GelatoV2 from upgradeable to immutable at any time, simply by revoking rights to upgrade Facets.
Implementing GelatoV2 as a Diamond means that we can easily accommodate new use cases by eliminating integration friction with users and developers, adapt to lower level changes such as a chain changing from the legacy transaction fee model to EIP-1559, and simply adding or removing features as needed without enforcing strong opinions at the application interface level.
Brief guide to the facets that make up GelatoV2 on Ethereum mainnet: