This new release includes a modular system of contracts for on-chain governance, based on GovernorAlpha and GovernorBravo, covered more in depth in our Governor announcement. Additionally, it introduces a new directory with Solidity interfaces for common ERCs. Read on to learn more!
Use Contracts Wizard to leverage OpenZeppelin Contracts and bootstrap your code in minutes.
Install from npm for local development:
npm install @openzeppelin/contracts
npm install @openzeppelin/contracts-upgradeable
for upgradeable contractsFinally, if you’re looking for an easy way to manage and automate operations for the contracts you deploy, check out OpenZeppelin Defender and sign up for a free account.
On-chain governance is generally implemented in a special-purpose contract called “Governor”. The GovernorAlpha and GovernorBravo contracts designed by Compound have been very successful and popular so far, with the downside that projects with different requirements have had to fork the code to customize it for their needs, which can pose a high risk of introducing security issues. For OpenZeppelin Contracts, we set out to build a modular system of Governor contracts so that forking is not needed, and different requirements can be accommodated by writing small modules using Solidity inheritance. You will find the most common requirements out of the box in OpenZeppelin Contracts, but writing additional ones is simple, and we will be adding new features as requested by the community in future releases.
You will find the contracts in the governance directory. Learn more in our Governor announcement.
Some common ERCs may for one reason or another not have an implementation in OpenZeppelin Contracts. Still, the interfaces may be required to interact with these contracts using Solidity, or to obtain the ABIs in order to interact with them using JavaScript, Python, etc. This release introduces an “interfaces” directory that can house them, along with all other interfaces in OpenZeppelin Contracts located together for easy access. The directory will only contain Final ERCs, or those Drafts that we’ve considered are stable and proven enough to be implemented in the library.
SignatureChecker
is now more gas efficient for the more common case of EOA signatures. ECDSA now includes tryRecover
functions that do not throw in case of error.EnumerableSet
now has a lvalues()
function returning an array of all values, meant for use in view functions only.ERC2771Context
has been fixed for contracts that need access to msg.sender in the constructor.To create an OpenZeppelin governor contract with Contracts Wizard, our lightning-fast smart contract creation tool, click here.
Use Contracts Wizard to leverage OpenZeppelin Contracts and bootstrap your code in minutes.
Install from npm for local development:
npm install @openzeppelin/contracts
npm install @openzeppelin/contracts-upgradeable
for upgradeable contractsFinally, if you’re looking for an easy way to manage and automate operations for the contracts you deploy, you can learn more about OpenZeppelin Defender and sign up for a free account.