From 09faec91d749f703f2e8ad9f0123cdac74eff69b Mon Sep 17 00:00:00 2001 From: Ozgun Ozerk Date: Wed, 25 Oct 2023 14:54:03 +0300 Subject: [PATCH] initial commit --- .github/ISSUE_TEMPLATE/bug_report.yml | 43 ++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 28 +++++++ .gitignore | 17 ++++ CONTRIBUTING.md | 97 ++++++++++++++++++++++ README.md | 48 +++++++++++ SECURITY.md | 6 ++ clippy.toml | 1 + rustfmt.toml | 11 +++ 8 files changed, 251 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 SECURITY.md create mode 100644 clippy.toml create mode 100644 rustfmt.toml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..8251362 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,43 @@ +name: 🐞 Bug report +description: Create a report to help us improve +title: '🐞 [Bug]: ' +labels: ["bug"] +assignees: + - ozgunozerk +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! Briefly describe the issue you're experiencing. Tell us what you were trying to do and what happened instead. Remember, this is not a place to ask for help debugging code. For that, we welcome you in the OpenZeppelin Community Forum: https://forum.openzeppelin.com/. + - type: textarea + id: what-happened + attributes: + label: What happened? + description: if you want, you can include screenshots as well :) + validations: + required: true + - type: checkboxes + id: platform + attributes: + label: platform + description: On which operating system did this bug emerged? + options: + - label: linux + required: false + - label: windows + required: false + - label: macos + required: false + - type: textarea + id: expected + attributes: + label: Expected behavior + description: What should have happened instead? + - type: checkboxes + id: terms + attributes: + label: Contribution Guidelines + description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/OpenZeppelin/substrate-generic-vanilla/blob/main/CONTRIBUTING.md) + options: + - label: I agree to follow this project's Contribution Guidelines + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..7d54e26 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,28 @@ +name: 🎁 Feature Request +description: Suggest an idea for this project ⚡️ +title: "🎁 [Feature Request]: " +labels: ["enhancement"] +assignees: + - ozgunozerk +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill this feature request! + - type: textarea + id: feature + attributes: + label: What is the feature you would like to see? + description: Is your feature request related to a specific problem? Is it just a crazy idea? Tell us about it! + validations: + required: true + - type: checkboxes + id: terms + attributes: + label: Contribution Guidelines + description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/OpenZeppelin/substrate-generic-vanilla/blob/main/CONTRIBUTING.md) + options: + - label: I agree to follow this project's Contribution Guidelines + required: true + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f82f8d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +/target/ +/.idea +.DS_Store +.thumbs.db +.vscode + +# These are backup files generated by rustfmt +**/*.rs.bk + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8adb5ee --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,97 @@ +# Contributing to OpenZeppelin Contracts for Cairo + +We really appreciate and value contributions to OpenZeppelin Contracts for Cairo. Please take 5' to review the items listed below to make sure that your contributions are merged as soon as possible. + +## Contribution guidelines + +Before starting development, please [create an issue](https://github.com/OpenZeppelin/cairo-contracts/issues/new/choose) to open the discussion, validate that the PR is wanted, and coordinate overall implementation details. + +### Coding style + +After a few radical changes in the Cairo language (mainly the transition to Cairo 1), our coding style guidelines became automatically deprecated. +That's why [we're working on setting new ones](https://github.com/OpenZeppelin/cairo-contracts/issues/696). +Feel free to read, contribute, discuss, and ask questions in the issue. + +## Creating Pull Requests (PRs) + +As a contributor, you are expected to fork this repository, work on your own fork and then submit pull requests. The pull requests will be reviewed and eventually merged into the main repo. See ["Fork-a-Repo"](https://help.github.com/articles/fork-a-repo/) for how this works. + +## A typical workflow + +1. Make sure your fork is up to date with the main repository: + + ```sh + cd cairo-contracts + git remote add upstream https://github.com/OpenZeppelin/cairo-contracts.git + git fetch upstream + git pull --rebase upstream main + ``` + + > NOTE: The directory `cairo-contracts` represents your fork's local copy. + +2. Branch out from `main` into `fix/some-bug-short-description-#123` (ex: `fix/typos-in-docs-#123`): + + (Postfixing #123 will associate your PR with the issue #123 and make everyone's life easier =D) + + ```sh + git checkout -b fix/some-bug-short-description-#123 + ``` + +3. Make your changes, add your files, update documentation ([see Documentation section](#documentation)), commit, and push to your fork. + + ```sh + git add src/file.cairo + git commit "Fix some bug short description #123" + git push origin fix/some-bug-short-description-#123 + ``` + +4. Run tests and linter. This can be done by running local continuous integration and make sure it passes. + + ```bash + # run tests + scarb test + + # run linter + scarb fmt --check + ``` + +5. Go to [OpenZeppelin/cairo-contracts](https://github.com/OpenZeppelin/cairo-contracts) in your web browser and issue a new pull request. + Begin the body of the PR with "Fixes #123" or "Resolves #123" to link the PR to the issue that it is resolving. + *IMPORTANT* Read the PR template very carefully and make sure to follow all the instructions. These instructions + refer to some very important conditions that your PR must meet in order to be accepted, such as making sure that all PR checks pass. + +6. Maintainers will review your code and possibly ask for changes before your code is pulled in to the main repository. We'll check that all tests pass, review the coding style, and check for general code correctness. If everything is OK, we'll merge your pull request and your code will be part of OpenZeppelin Contracts for Cairo. + + *IMPORTANT* Please pay attention to the maintainer's feedback, since it's a necessary step to keep up with the standards OpenZeppelin Contracts attains to. + +## Documentation + +Before submitting the PR, you must update the corresponding documentation entries in the docs folder. In the future we may use something similar to solidity-docgen to automatically generate docs, but for now we are updating .adoc entries manually. + +If you want to run the documentation UI locally: + +1. Change directory into docs inside the project and run npm install. + + ```bash + cd docs && npm i + ``` + +2. Build the docs and run the local server (default to localhost:8080). This will watch for changes in the docs/module folder, and update the UI accordingly. + + ```bash + npm run docs:watch + ``` + +## Integration tests + +Currently, Starknet's test suite has important differences with public networks. We strongly suggest testing new features against a testnet before submitting the PR, to make sure that everything works as expected in a real environment. + +We are looking into defining a better process for these integration tests, but for now the PR author/contributor must suggest an approach to test the feature when applicable, which has to be agreed and reproduced by the reviewer. + +## All set + +If you have any questions, feel free to post them as an [issue](https://github.com/OpenZeppelin/cairo-contracts/issues). + +Finally, if you're looking to collaborate and want to find easy tasks to start, look at the issues we marked as ["Good first issue"](https://github.com/OpenZeppelin/cairo-contracts/labels/good%20first%20issue). + +Thanks for your time and code! diff --git a/README.md b/README.md new file mode 100644 index 0000000..30e6402 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +# OpenZeppelin Vanilla Template for Substrate + +Substrate has a steep learning curve. In order to make it easier for newcomers to get started, OpenZeppelin provides 2 templates that can be used to quickly bootstrap a Substrate project: +- vanilla template (has the minimal pallet set) +- feature-rich template (has all the pallets that are commonly used in Substrate projects) +- + +Along with these two templates, OpenZeppelin also provides a documentation website that explains how to add or deduct all the common pallets to your Substrate project (and these templates). + +So, you can select the template that fits your needs and start building your Substrate project. On the road, if you feel like you need to make some changes, our documentation on how to add or deduct pallets will be helpful. + +## Vanilla Template + +This template aims to provide the minimal pallet set for a Substrate project. + +*Pallets used in Vanilla Template:* +- to be filled + +## Feature-rich Template + +You can find the feature-rich template here: link to feature-rich template to be filled + + +### Usage +to be fileld + + +## Security + +> ⚠️ Warning! ⚠️ +> This project is still in a very early and experimental phase. It has never been audited nor thoroughly reviewed for security vulnerabilities. Do not use in production. + +Refer to [SECURITY.md](SECURITY.md) for more details. + + +## License + +OpenZeppelin Vanilla Template for Substrate is released under the [MIT License](LICENSE). + + + + + + + + + + diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8bd1901 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,6 @@ +# Security + +> ⚠️ Warning! ⚠️ +> This project is still in a very early and experimental phase. It has never been audited nor thoroughly reviewed for security vulnerabilities. Do not use in production. + +Please report any security issues you find to security@openzeppelin.com. diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..154626e --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +allow-unwrap-in-tests = true diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..8c87ec0 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,11 @@ +format_code_in_doc_comments = true +format_macro_bodies = true +format_macro_matchers = true +format_strings = true +imports_granularity = "Crate" +match_arm_blocks = false +reorder_impl_items = true +group_imports = "StdExternalCrate" +use_field_init_shorthand = true +use_small_heuristics = "Max" +wrap_comments = true