Open Zeppelin is one of the most well known EVM-based exemplar smart contract libraries. Smart contract libraries such as Open Zeppelin help you to develop quicker and more efficiently by pulling in pieces of code that have been well tested in a large number of projects.
Since Caduceus is EVM compatible, developers can benefit greatly from utilizing these libraries in their projects.
Open Zeppelin libraries allow you to:
- Deploy tokens quickly - use standards such as ERC 20 (fungible), ERC 721(non-fungible) within quickly implementable examples to get you deployed quickly and safely. While Solidity interfaces and example implementations are typically not readily deployable, Open Zeppelin offers built in functions such as constructors that enable you to deploy quickly.
- Upgrade smart contracts. Fix bugs and security vulnerabilities, and introduce new features to your projects without migrating all your data.
- Reuse on-chain code. Reuse on-chain Solidity code that has been vetted by the community. Link to on-chain smart contract packages (Ethereum Packages) as building blocks for your project, and publish your packages for others to use. OpenZeppelin is included in the example.
- Compile and test smart contracts. The Starter Kit includes the Truffle suite with a development environment, a testing framework, and an asset pipeline for blockchains using the Ethereum Virtual Machine (EVM).
- Create adaptable and responsive UI components. The Starter Kit includes React and Rimble to give you all the components and flexibility you need to build responsive user interfaces.
- Use standard EVM compatible development tools and processes for minimal development overhead. If you have been developing on Ethereum for years or are a complete newbie, you will feel at home developing with these pre-made resources.
Even though the concept of a token is simple, they have a variety of complexities in the implementation. Because everything in Ethereum is just a smart contract, and there are no rules about what smart contracts have to do, the community has developed a variety of standards (called EIPs or ERCs) for documenting how a contract can interoperate with other contracts.
Open Zeppelin resources provide in-depth reading on how tokens are built. Head to these specialized guides to learn more about token types:
- ERC20: the most widespread token standard for fungible assets, albeit somewhat limited by its simplicity.
- ERC721: the de-facto solution for non-fungible tokens, often used for collectibles and games.
- ERC777: a richer standard for fungible tokens, enabling new use cases and building on past learnings. Backwards compatible with ERC20.
- ERC1155: a novel standard for multi-tokens, allowing for a single contract to represent multiple fungible and non-fungible tokens, along with batched operations for increased gas efficiency.
Token contracts are available on Github at https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token
Use Node Package Manager (NPM) to download and install Open Zeppelin into your local folder.
After installation, reference the Open Zeppelin library in a smart contract in your favourite IDE such as Remix, Truffle or Hardhat.
The following is a simple example of an NFT contract that uses the ERC-721 standard.
Common Open Zeppellin libraries include
ERC-721 - Non Fungible Token Standard
Open Zeppelin can be used directly in the Caduceus IDE and also in Hardhat, Remix and Brownie.
Import statements in Solidity can pull in the code directly from Github upon compilation.
Open Zeppelin sample contracts include constructors that allow you to define initial parameters such as token name, and maximum token count.
Full set of Open Zeppelin Contracts on Github
Advanced Concepts and Tools
Upgradable contracts allow once immutable contracts to be partially modified or upgraded by through proxy-led upgrades.
Test Helpers allow you to test your contracts with variable-based assertions. This is useful for unit testing before deploying to a live network.