{"id":29089608,"url":"https://github.com/openzeppelin/rust-contracts-stylus","last_synced_at":"2025-06-28T04:04:13.657Z","repository":{"id":242595688,"uuid":"755091517","full_name":"OpenZeppelin/rust-contracts-stylus","owner":"OpenZeppelin","description":"A library for secure smart contract development written in Rust","archived":false,"fork":false,"pushed_at":"2025-06-24T12:04:44.000Z","size":3899,"stargazers_count":121,"open_issues_count":78,"forks_count":59,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-26T16:23:57.059Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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":"CODE_OF_CONDUCT.md","threat_model":null,"audit":"audits/2024-10-v0.1.0.pdf","citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-09T12:33:18.000Z","updated_at":"2025-06-25T18:32:35.000Z","dependencies_parsed_at":"2024-06-16T17:56:55.465Z","dependency_job_id":"d348dfdf-719c-44fe-a041-6f2c628933be","html_url":"https://github.com/OpenZeppelin/rust-contracts-stylus","commit_stats":null,"previous_names":["openzeppelin/rust-contracts-stylus"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/OpenZeppelin/rust-contracts-stylus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Frust-contracts-stylus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Frust-contracts-stylus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Frust-contracts-stylus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Frust-contracts-stylus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenZeppelin","download_url":"https://codeload.github.com/OpenZeppelin/rust-contracts-stylus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Frust-contracts-stylus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262371684,"owners_count":23300595,"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":[],"created_at":"2025-06-28T04:04:12.518Z","updated_at":"2025-06-28T04:04:13.651Z","avatar_url":"https://github.com/OpenZeppelin.png","language":"Rust","readme":"# OpenZeppelin Contracts for Stylus\n\n**A library for secure smart contract development** written in Rust for\n[Arbitrum Stylus](https://docs.arbitrum.io/stylus/gentle-introduction).\n\n## Features\n\n- Security-first smart contracts, ported from the [`openzeppelin-contracts`]\n  library.\n- First-class `no_std` support.\n- [Unit] and [integration] test affordances, used in our own tests.\n\n[`openzeppelin-contracts`]: https://github.com/OpenZeppelin/openzeppelin-contracts\n[Unit]: https://github.com/OpenZeppelin/stylus-test-helpers\n[integration]: ./lib/e2e/README.md\n\n## Usage\n\nYou can import OpenZeppelin Contracts from crates.io by adding the following\nline to your `Cargo.toml` (We recommend pinning to a specific version):\n\n```toml\n[dependencies]\nopenzeppelin-stylus = \"=0.2.0\"\n```\n\nIf you want to use some of our newest features before they are fully stable or audited, you can try the latest alpha version of the library. We release a new alpha version every ~3 weeks.\n\n```toml\n[dependencies]\nopenzeppelin-stylus = \"=0.2.0-rc.0\"\n```\n\nWe put great effort in testing the contracts before releasing an alpha, but these are not yet audited and we don't guarantee any backwards compatibility between alpha version.\n\n\u003e [!NOTE]\n\u003e This library is designed to be `no_std`, which helps reduce wasm size. If you want your project to be `no_std` as well, ensure that your dependencies are not importing the standard library.\n\u003e You can achieve this by setting `default-features = false` for relevant dependencies in your `Cargo.toml`. For example:\n\u003e\n\u003e ```toml\n\u003e [dependencies]\n\u003e alloy-primitives = { version = \"=0.8.20\", default-features = false }\n\u003e stylus-sdk = \"=0.9.0\"\n\u003e ```\n\nOnce defined as a dependency, use one of our pre-defined implementations by\nimporting them:\n\n```rust\nuse openzeppelin_stylus::token::erc20::{self, Erc20, IErc20};\nuse stylus_sdk::{\n    alloy_primitives::{Address, U256},\n    prelude::*,\n};\n\n#[entrypoint]\n#[storage]\nstruct Erc20Example {\n    erc20: Erc20,\n}\n\n#[public]\n#[implements(IErc20\u003cError = erc20::Error\u003e)]\nimpl Erc20Example {}\n\n#[public]\nimpl IErc20 for Erc20Example {\n    type Error = erc20::Error;\n\n    fn total_supply(\u0026self) -\u003e U256 {\n        self.erc20.total_supply()\n    }\n\n    fn balance_of(\u0026self, account: Address) -\u003e U256 {\n        self.erc20.balance_of(account)\n    }\n\n    fn transfer(\n        \u0026mut self,\n        to: Address,\n        value: U256,\n    ) -\u003e Result\u003cbool, Self::Error\u003e {\n        self.erc20.transfer(to, value)\n    }\n\n    fn allowance(\u0026self, owner: Address, spender: Address) -\u003e U256 {\n        self.erc20.allowance(owner, spender)\n    }\n\n    fn approve(\n        \u0026mut self,\n        spender: Address,\n        value: U256,\n    ) -\u003e Result\u003cbool, Self::Error\u003e {\n        self.erc20.approve(spender, value)\n    }\n\n    fn transfer_from(\n        \u0026mut self,\n        from: Address,\n        to: Address,\n        value: U256,\n    ) -\u003e Result\u003cbool, Self::Error\u003e {\n        self.erc20.transfer_from(from, to, value)\n    }\n}\n```\n\nFor a more complex display of what this library offers, refer to our\n[examples](./examples).\n\nFor a full example that includes deploying and querying a contract, see the\n[basic] example.\n\nFor more information on what this library will include in the future, see our\n[roadmap].\n\n[basic]: ./examples/basic\n[roadmap]: https://github.com/orgs/OpenZeppelin/projects/35/views/8\n\n## Contribute\n\nOpenZeppelin Contracts for Stylus exists thanks to its contributors. There are\nmany ways you can participate and help build high-quality software. Check out\nthe [contribution guide](CONTRIBUTING.md)!\n\n## Security\n\nPast audits can be found in [`audits/`](./audits).\n\nRefer to our [Security Policy](SECURITY.md) for more details.\n\n## License\n\nOpenZeppelin Contracts for Stylus is released under\nthe [MIT License](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenzeppelin%2Frust-contracts-stylus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenzeppelin%2Frust-contracts-stylus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenzeppelin%2Frust-contracts-stylus/lists"}