Guide to using Open Zeppelin smart contracts
A guide and links to the common and useful Open Zeppelin smart contracts
OpenZeppelin is a company that offer free and open source framework for creating smart contracts.
(They also offer other services, such as smart contract audits).
Their smart contracts cover many ERC standard interfaces. As of the type of writing the current version of their contracts is v4.
You can find them on https://docs.openzeppelin.com/contracts/4.x/
Some of the most common OpenZeppelin smart contracts are:
- ERC20 https://docs.openzeppelin.com/contracts/4.x/erc20
- ERC721 https://docs.openzeppelin.com/contracts/4.x/erc721
- Permission/access control https://docs.openzeppelin.com/contracts/4.x/access-control
You can install them with:
npm install @openzeppelin/contracts
and then use them in your smart contracts like this:
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract YourNFT is ERC721 {
constructor() ERC721("YourNFT", "YNFT") {
}
}
There are lots of Solidity utilities you can import in such as:
- Base64 https://docs.openzeppelin.com/contracts/4.x/api/utils#Base64
- Counters https://docs.openzeppelin.com/contracts/4.x/api/utils#Counters
Spotted a typo or have a suggestion to make this crypto dev article better? Please let me know!
Next post
Previous post
π Solidity Auditing online quiz
Learn how to audit smart contracts by looking at some example code and trying to find the bugs
β½ Solidity Gas Optimizations Guide
How to optimize and reduce gas usage in your smart contracts in Solidity
π§ͺ Guide to testing with Foundry
Guide to adding testing for your Solidity contracts, using the Foundry and Forge tools
π Guide to UTXO
UTXO and the UTXO set (used by blockchains such as Bitcoin) explained
π Solidity Assembly Guide
Introduction guide to using assembly in your Solidity smart contracts
π¦ Ethereum EOF format explained
Information explaining what the upcoming Ethereum EOF format is all about