generated from StabilityNexus/Template-Repo
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Fixes issue 16 #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aniket866
wants to merge
7
commits into
StabilityNexus:main
Choose a base branch
from
aniket866:patch-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fixes issue 16 #23
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7ea8958
Added all installation steps
aniket866 6bba180
Code rabbit follow-up
aniket866 6096f32
Create Contrubuting.md
aniket866 c023c01
Update Contrubuting.md
aniket866 87dc862
Rename Contrubuting.md to Contributing.md
aniket866 204ceaf
fixing-pre-commits
aniket866 a940b6e
fixing-pre-commits
aniket866 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,330 @@ | ||
| # 🤝 Contributing to IdentityTokens-EVM-Contracts | ||
|
|
||
| Welcome to **IdentityTokens-EVM-Contracts** under Stability Nexus. | ||
|
|
||
| This repository contains Solidity smart contracts powering a decentralized identity protocol on EVM chains. Because this involves on-chain logic, security and discipline are mandatory. | ||
|
|
||
| Please follow this complete step-by-step guide from beginner level to final PR merge. | ||
|
|
||
| --- | ||
|
|
||
| # 📜 1. Core Contribution Rules (Read First) | ||
|
|
||
| - You MUST get the issue assigned before starting. | ||
| - You MUST discuss major changes on Discord before coding. | ||
| - You MUST write or update tests for contract changes. | ||
| - You MUST run formatting and checks before committing. | ||
| - You MUST NOT open PRs without linking an issue. | ||
|
|
||
| Security > Speed. | ||
|
|
||
| --- | ||
|
|
||
| # 🧭 2. Complete Contribution Workflow (Step-by-Step) | ||
|
|
||
| ## 🔎 Step 1: Find or Create an Issue | ||
|
|
||
| - Browse existing issues. | ||
| - If none exists, create one with: | ||
|
|
||
| - Clear title | ||
| - Problem description | ||
| - Expected behavior | ||
| - Technical reasoning | ||
|
|
||
| Do NOT start coding yet. | ||
|
|
||
| --- | ||
|
|
||
| ## 🙋 Step 2: Get Assigned | ||
|
|
||
| - Comment: "I would like to work on this issue." | ||
| - Wait for maintainer/knight approval. | ||
| - Start only after assignment. | ||
|
|
||
| Unassigned PRs may be closed. | ||
|
|
||
| --- | ||
|
|
||
| ## 💬 Step 3: Discuss on Discord: | ||
|
|
||
| - Join here :[discord](https://discord.com/channels/995968619034984528/1461697098767532269) | ||
|
|
||
| Before writing code: | ||
|
|
||
| - Share your technical plan. | ||
| - Explain storage changes (if any). | ||
| - Mention security considerations. | ||
| - Confirm architecture consistency. | ||
|
|
||
| This avoids wasted review cycles. | ||
|
|
||
| --- | ||
|
|
||
| ## 🍴 Step 4: Fork the Repository | ||
|
|
||
| Click **Fork** on GitHub. | ||
|
|
||
| This creates your own copy under your account. | ||
|
|
||
| --- | ||
|
|
||
| ## 💻 Step 5: Clone Your Fork | ||
|
|
||
| ``` | ||
| git clone https://github.com/YOUR-USERNAME/IdentityTokens-EVM-Contracts.git | ||
| cd IdentityTokens-EVM-Contracts | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🔗 Step 6: Add Upstream Remote | ||
|
|
||
| ``` | ||
| git remote add upstream https://github.com/StabilityNexus/IdentityTokens-EVM-Contracts.git | ||
| ``` | ||
|
|
||
| Verify: | ||
|
|
||
| ``` | ||
| git remote -v | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🌿 Step 7: Create a Branch | ||
|
|
||
| Never work on main. | ||
|
|
||
| ``` | ||
| git checkout -b feature/short-description | ||
| ``` | ||
|
|
||
| Examples: | ||
|
|
||
| - feature/add-endorsement-logic | ||
| - fix/token-mapping-bug | ||
| - refactor/storage-optimization | ||
| - docs/update-natspec | ||
|
|
||
| --- | ||
|
|
||
| # 🛠 3. Project Setup | ||
|
|
||
| ## 📦 Install Node Dependencies | ||
|
|
||
| ``` | ||
| npm install | ||
| ``` | ||
|
|
||
| This installs: | ||
|
|
||
| - Prettier | ||
| - Prettier Solidity plugin | ||
| - OpenZeppelin dependency | ||
|
|
||
| --- | ||
|
|
||
| ## 🧱 Install Foundry (If Not Installed) | ||
|
|
||
| ``` | ||
| curl -L https://foundry.paradigm.xyz | bash | ||
| foundryup | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 📚 Install Solidity Libraries (if required) | ||
|
|
||
| ``` | ||
| forge install OpenZeppelin/openzeppelin-contracts | ||
| forge install foundry-rs/forge-std | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| # 🏗 4. Build & Test Commands | ||
|
|
||
| ## 🔨 Build Contracts | ||
|
|
||
| You can use either: | ||
|
|
||
| ``` | ||
| forge build | ||
| ``` | ||
|
|
||
| Or npm script: | ||
|
|
||
| ``` | ||
| npm run build | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Deploy Script (Advanced Users) | ||
|
|
||
| ``` | ||
| npm run deploy | ||
| ``` | ||
|
|
||
| This runs: | ||
|
|
||
| ``` | ||
| forge script script/Deploy.s.sol:Deploy --broadcast | ||
| ``` | ||
|
|
||
| Ensure correct RPC and private key configuration before broadcasting. | ||
|
|
||
| --- | ||
|
|
||
| # 🧪 5. Testing Requirements | ||
|
|
||
| If your change modifies contracts: | ||
|
|
||
| - Add or update Forge tests. | ||
| - Test access control. | ||
| - Test endorsement logic. | ||
| - Test edge cases. | ||
| - Validate gas usage impact. | ||
|
|
||
| Run: | ||
|
|
||
| ``` | ||
| forge test | ||
| ``` | ||
|
|
||
| Gas report: | ||
|
|
||
| ``` | ||
| forge test --gas-report | ||
| ``` | ||
|
|
||
| Verbose: | ||
|
|
||
| ``` | ||
| forge test -vvvv | ||
| ``` | ||
|
|
||
| All tests must pass before pushing. | ||
|
|
||
| --- | ||
|
|
||
| # 🎨 6. Solidity Formatting & Checks (MANDATORY) | ||
|
|
||
| Before committing, run: | ||
|
|
||
| ### ✨ Format All Solidity Files | ||
|
|
||
| ``` | ||
| npm run sol-fmt-all | ||
| ``` | ||
|
|
||
| ### 🔍 Check Formatting | ||
|
|
||
| ``` | ||
| npm run sol-check-all | ||
| ``` | ||
|
|
||
| You can also format a single file: | ||
|
|
||
| ``` | ||
| npm run sol-fmt | ||
| ``` | ||
|
|
||
| Or check formatting: | ||
|
|
||
| ``` | ||
| npm run sol-check | ||
| ``` | ||
|
|
||
| PRs failing formatting checks may be rejected. | ||
|
|
||
| --- | ||
|
|
||
| # 🛡 7. Security & Code Standards | ||
|
|
||
| Because this is an EVM contract repository: | ||
|
|
||
| - Use Solidity ^0.8.24 conventions. | ||
| - Use OpenZeppelin correctly. | ||
| - Add NatSpec documentation. | ||
| - Avoid unbounded loops. | ||
| - Avoid unnecessary storage writes. | ||
| - Use require for validation. | ||
| - Protect against reentrancy where needed. | ||
| - Consider multiple identity tokens per user. | ||
| - Validate endorsement mappings carefully. | ||
|
|
||
| If possible, run Slither locally: | ||
|
|
||
| ``` | ||
| slither . | ||
| ``` | ||
|
|
||
| Security is non-negotiable. | ||
|
|
||
| --- | ||
|
|
||
| # 📝 8. Commit Properly | ||
|
|
||
| ``` | ||
| git add . | ||
| git commit -m "feat: short clear description" | ||
| ``` | ||
|
|
||
| Good examples: | ||
|
|
||
| - feat: add endorsement validation check | ||
| - fix: resolve identity mapping overwrite bug | ||
| - refactor: optimize storage packing | ||
| - docs: update natspec comments | ||
|
|
||
| Avoid vague messages like "update". | ||
|
|
||
| --- | ||
|
|
||
| # 🔄 9. Sync With Upstream Before Pushing | ||
|
|
||
| ``` | ||
| git fetch upstream | ||
| git merge upstream/main | ||
| ``` | ||
|
|
||
| Resolve conflicts locally. | ||
|
|
||
| --- | ||
|
|
||
| # 🚀 10. Push to Your Fork | ||
|
|
||
| ``` | ||
| git push origin feature/short-description | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| # 📬 11. Open a Pull Request | ||
|
|
||
| When opening PR: | ||
|
|
||
| - Link issue (Closes #number) | ||
| - Explain what changed | ||
| - Explain why | ||
| - Mention gas impact | ||
| - Mention security considerations | ||
|
|
||
| PR must pass CI before review. | ||
|
|
||
| --- | ||
|
|
||
| # ❌ What Causes Rejection | ||
|
|
||
| - No assignment | ||
| - No Discord discussion for major change | ||
| - Missing tests | ||
| - Formatting not applied | ||
| - Failing CI | ||
| - Breaking protocol logic | ||
|
|
||
| --- | ||
|
|
||
| # 🤝 Code of Conduct | ||
aniket866 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.