Skip to content

JCollinsX/Diamond-Contract

Repository files navigation

EIP-2535 Diamonds Implementation

This is a simple example implementation for EIP-2535 Diamonds. To learn about other implementations go here: https://github.com/mudgen/diamond

The standard loupe functions have been gas-optimized in this implementation and can be called in on-chain transactions. However keep in mind that a diamond can have any number of functions and facets so it is still possible to get out-of-gas errors when calling loupe functions. Except for the facetAddress loupe function which has a fixed gas cost.

The contracts/facets/LaunchPadProjectFacet.sol file shows an launchpad contract with Diamond implementation.

The contracts/libraries/LibLaunchPadProjectStorage.sol file shows how to implement Diamond Storage.

Calling Diamond Functions

In order to call a function that exists in a diamond you need to use the ABI information of the facet that has the function.

Useful Links

  1. EIP-2535 Diamonds
  2. diamond-3-hardhat
  3. Introduction to EIP-2535 Diamonds
  4. Solidity Storage Layout For Proxy Contracts and Diamonds
  5. New Storage Layout For Proxy Contracts and Diamonds
  6. Diamond Setter
  7. Upgradeable smart contracts using the EIP-2535 Diamonds
  8. buidler-deploy supports diamonds

Author

This implementation was written by Jenson.

Contact:

License

MIT license. See the license file. Anyone can use or modify this software for their purposes.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published