A secure and modular library of smart contract components written in Cairo for developing on Starknet, a decentralized ZK Rollup.
OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup
This tool is used by blockchain developers to build secure, reusable smart contracts on Starknet using the Cairo programming language. It simplifies the development process by providing audited, standard contract implementations like ERC20 tokens, enabling faster and safer deployment of decentralized applications.
Users should have Cairo and Scarb installed and be familiar with Starknet development. The library is modular, so including only needed packages can optimize build times. The project is actively maintained by OpenZeppelin, ensuring security and reliability. Refer to the official documentation and Contracts Wizard for guided contract generation.
Install Cairo and Scarb following https://docs.swmansion.com/scarb/download
Create a new project with `scarb new my_project && cd my_project`
Edit `Scarb.toml` and add the dependency, e.g., `openzeppelin = "3.0.0-alpha.0"` or `openzeppelin_token = "3.0.0-alpha.0"`
Build the project with `scarb build` to download and compile dependencies
scarb new my_project && cd my_project
Creates a new Cairo project and navigates into it
scarb build
Builds the project and downloads the OpenZeppelin Cairo contracts dependencies
git clone git@github.com:OpenZeppelin/cairo-contracts.git
Clones the cairo-contracts repository locally for development or contribution
scarb build -w
Builds the cloned project in watch mode for development
snforge test -w
Runs the test suite in watch mode
Use example ERC20 contract code in `src/lib.cairo`
Demonstrates how to implement an ERC20 token contract using the OpenZeppelin Cairo library