Practical overview
When it fits
Use it when developing a Cairo smart contract for Starknet and you want to incorporate reusable OpenZeppelin components, such as the documented ERC-20 implementation.
Who it is for
- Cairo developers building Starknet smart contracts.
- Developers implementing an ERC-20 token using reusable contract components.
- Teams assembling Cairo projects with Scarb dependencies.
Documented uses
- Add OpenZeppelin Cairo components to a Scarb project and compile the dependency.
- Integrate the ERC-20 component into a Starknet contract.
- Configure a token's name, symbol, initial supply and recipient in the documented example.
Requirements & limits
The repository identifies the library as open source under the MIT License.
- The documented setup requires Cairo and Scarb.
- The README shows both a full-library dependency and a token-package dependency; it says selecting separate packages can avoid unused modules and improve build time.
- The ERC-20 example mints a configurable initial supply to a specified contract address.
- The project cautions that its library is not a substitute for an independent security audit.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Add the library to a Scarb project
Declare an OpenZeppelin Contracts for Cairo dependency and build the project.
Before you start
- Cairo and Scarb installed.
- A terminal and a Scarb project.
Steps
Create a project with
scarb new my_projectand enter its directory.Add
openzeppelin = "4.0.1"to the[dependencies]section ofScarb.toml, or useopenzeppelin_token = "4.0.1"for the token package.Run
scarb buildto download and compile the dependency.
Expected outcome
The dependency is included in the Scarb project and the build command compiles the project.
Guide limitations
- The README's example uses version 4.0.1; it does not establish which version is appropriate for other projects.
- Adding the dependency and building does not itself write, deploy or audit a contract.
Integrate the ERC-20 component in Cairo
Use the documented ERC20Component pattern in a Starknet contract with a chosen initial supply and recipient.
Before you start
- Cairo and Scarb installed.
- A Scarb project with the OpenZeppelin token package declared as a dependency.
Steps
In
src/lib.cairo, create a Starknet contract module and importERC20Componentand the related types shown in the README example.Add the component declaration, embedded mixin implementation, storage and event definitions as in the example.
In the constructor, initialize the token name and symbol, then mint the configured initial supply to the configured recipient.
Expected outcome
The contract code follows the README's ERC-20 integration pattern, with initial token supply assigned to a specified recipient.
Guide limitations
- The example is an integration pattern, not evidence of a deployed or production-ready token.
- The project states that using the library does not replace an independent security audit.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 2 October 2026
- Original website title
- OpenZeppelin/cairo-contracts · Official homepage title · retained in its source language

