{"id":13632307,"url":"https://github.com/OpenZeppelin/cairo-contracts","last_synced_at":"2025-04-18T02:32:34.718Z","repository":{"id":37103771,"uuid":"397755303","full_name":"OpenZeppelin/cairo-contracts","owner":"OpenZeppelin","description":"OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup","archived":false,"fork":false,"pushed_at":"2025-04-09T08:27:11.000Z","size":5430,"stargazers_count":860,"open_issues_count":60,"forks_count":380,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-04-10T03:45:51.172Z","etag":null,"topics":["cairo","ethereum","security","smart-contracts","starknet"],"latest_commit_sha":null,"homepage":"https://docs.openzeppelin.com/contracts-cairo","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenZeppelin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audits/2025-01-v1.0.0.pdf","citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-18T23:00:24.000Z","updated_at":"2025-04-09T08:27:16.000Z","dependencies_parsed_at":"2023-09-26T22:44:39.791Z","dependency_job_id":"425bd108-32ac-4e97-b666-ef0518b83b80","html_url":"https://github.com/OpenZeppelin/cairo-contracts","commit_stats":{"total_commits":454,"total_committers":42,"mean_commits":10.80952380952381,"dds":0.5859030837004405,"last_synced_commit":"331844dcf278ccdf96ce3b63fb3e5f2c78970561"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fcairo-contracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fcairo-contracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fcairo-contracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fcairo-contracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenZeppelin","download_url":"https://codeload.github.com/OpenZeppelin/cairo-contracts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249414252,"owners_count":21267724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cairo","ethereum","security","smart-contracts","starknet"],"created_at":"2024-08-01T22:02:59.476Z","updated_at":"2025-04-18T02:32:34.712Z","avatar_url":"https://github.com/OpenZeppelin.png","language":"Rust","readme":"# OpenZeppelin Contracts for Cairo\n\n[![Lint and test](https://github.com/OpenZeppelin/cairo-contracts/actions/workflows/test.yml/badge.svg)](https://github.com/OpenZeppelin/cairo-contracts/actions/workflows/test.yml)\n\n**A library for secure smart contract development** written in Cairo for [Starknet](https://starkware.co/product/starknet/), a decentralized ZK Rollup.\n\n\u003e [!TIP]\n\u003e :mage: **Not sure how to get started?** Check out [Contracts Wizard for Cairo](https://wizard.openzeppelin.com/cairo) — an interactive smart contract generator.\n\n## Usage\n\n### Prepare the environment\n\nSimply [install Cairo and scarb](https://docs.swmansion.com/scarb/download).\n\n### Set up your project\n\nCreate a new project and `cd` into it.\n\n```bash\nscarb new my_project \u0026\u0026 cd my_project\n```\n\nThe contents of `my_project` should look like this:\n\n```bash\n$ ls\n\nScarb.toml src\n```\n\n### Install the library\n\nEdit `scarb.toml` and add:\n\n```toml\n[dependencies]\nopenzeppelin = \"2.0.0-alpha.0\"\n```\n\nThe previous example would import the entire library. We can also add each package as a separate dependency to improve the building time by not including modules that won't be used:\n\n```toml\n[dependencies]\nopenzeppelin_token = \"2.0.0-alpha.0\"\n```\n\nBuild the project to download it:\n\n```bash\n$ scarb build\n\nUpdating git repository https://github.com/OpenZeppelin/cairo-contracts\nCompiling my_project v0.1.0 (~/my_project/Scarb.toml)\nFinished release target(s) in 6 seconds\n```\n\n### Using the library\n\nOpen `src/lib.cairo` and write your contract.\n\nFor example, this is how to write an ERC20-compliant contract:\n\n```cairo\n#[starknet::contract]\nmod MyToken {\n    use openzeppelin_token::erc20::{ERC20Component, ERC20HooksEmptyImpl, DefaultConfig};\n    use starknet::ContractAddress;\n\n    component!(path: ERC20Component, storage: erc20, event: ERC20Event);\n\n    // ERC20 Mixin\n    #[abi(embed_v0)]\n    impl ERC20MixinImpl = ERC20Component::ERC20MixinImpl\u003cContractState\u003e;\n    impl ERC20InternalImpl = ERC20Component::InternalImpl\u003cContractState\u003e;\n\n    #[storage]\n    struct Storage {\n        #[substorage(v0)]\n        erc20: ERC20Component::Storage\n    }\n\n    #[event]\n    #[derive(Drop, starknet::Event)]\n    enum Event {\n        #[flat]\n        ERC20Event: ERC20Component::Event\n    }\n\n    #[constructor]\n    fn constructor(\n        ref self: ContractState,\n        initial_supply: u256,\n        recipient: ContractAddress\n    ) {\n        let name = \"MyToken\";\n        let symbol = \"MTK\";\n\n        self.erc20.initializer(name, symbol);\n        self.erc20.mint(recipient, initial_supply);\n    }\n}\n```\n\n## Learn\n\n### Documentation\n\nCheck out the [full documentation site](https://docs.openzeppelin.com/contracts-cairo)!\n\n### Cairo\n\n- [Cairo book](https://book.cairo-lang.org/)\n- [Cairo language documentation](https://docs.cairo-lang.org/)\n- [Starknet documentation](https://docs.starknet.io/)\n- [Cairopractice](https://cairopractice.com/)\n\n### Tooling\n\n- [Scarb](https://docs.swmansion.com/scarb)\n\n## Development\n\n\u003e [!NOTE]\n\u003e You can track our roadmap and future milestones in our [Github Project](https://github.com/orgs/OpenZeppelin/projects/29/).\n\nOpenZeppelin Contracts for Cairo exists thanks to its contributors. There are many ways you can participate and help build high quality software, make sure to check out the [contribution](CONTRIBUTING.md) guide in advance.\n\n### Set up the project\n\nClone the repository:\n\n```bash\ngit clone git@github.com:OpenZeppelin/cairo-contracts.git\n```\n\n`cd` into it and build:\n\n```bash\ncd cairo-contracts\nscarb build -w\n```\n\n### Run tests\n\n```bash\nsnforge test -w\n```\n\n## Security\n\nThis project is maintained by OpenZeppelin with the goal of providing a secure and reliable library of smart contract components\nfor the Starknet ecosystem. We address security through risk management in various areas such as engineering and open source best\npractices, scoping and API design, multi-layered review processes, and incident response preparedness.\n\nRefer to [SECURITY.md](SECURITY.md) for more details.\n\nPast audits can be found in [`audits/`](./audits).\n\nSmart contracts are an evolving technology and carry a high level of technical risk and uncertainty. Although OpenZeppelin is well known for its security audits, using OpenZeppelin Contracts for Cairo is not a substitute for a security audit.\n\n## License\n\nOpenZeppelin Contracts for Cairo is released under the [MIT License](LICENSE).\n","funding_links":[],"categories":["Rust","Smart Contracts","Smart Contract Platforms"],"sub_categories":["Cairo"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenZeppelin%2Fcairo-contracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOpenZeppelin%2Fcairo-contracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenZeppelin%2Fcairo-contracts/lists"}