OpenViSTAI · Agents · Blockchain · Crypto
Menu
Smart Contracts

OpenZeppelin Contracts for Cairo

OpenZeppelin Contracts for Cairo is an MIT-licensed library of reusable Cairo smart-contract components for Starknet. It includes an ERC-20 component and is added to a Scarb project as a dependency for use in contract code.

Independent OpenViST project profile, based on linked sources.

OpenZeppelin Contracts for Cairo — OpenViST project profile in Smart Contracts.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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.

Source-based practical guide

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

  1. Create a project with scarb new my_project and enter its directory.

  2. Add openzeppelin = "4.0.1" to the [dependencies] section of Scarb.toml, or use openzeppelin_token = "4.0.1" for the token package.

  3. Run scarb build to 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.
Source-based practical guide

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

  1. In src/lib.cairo, create a Starknet contract module and import ERC20Component and the related types shown in the README example.

  2. Add the component declaration, embedded mixin implementation, storage and event definitions as in the example.

  3. 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.
Evidence and transparency

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