Thank you for your interest in contributing to Ectoplasm DEX! We welcome contributions from the community to help improve this decentralized exchange on the Casper Network.
- Code of Conduct
- Getting Started
- Development Workflow
- Coding Standards
- Commit Guidelines
- Pull Request Process
- Testing
- Security
- Community
We are committed to providing a welcoming and inclusive environment. Please be respectful and professional in all interactions.
- Be respectful: Treat everyone with respect and consideration
- Be collaborative: Work together to achieve common goals
- Be constructive: Provide helpful feedback and suggestions
- Be patient: Remember that everyone has different skill levels and backgrounds
Before you begin, ensure you have the following installed:
- Node.js 18 or higher
- npm or yarn
- Git
- A Casper wallet (CasperWallet extension or CSPR.click account) for testing
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/ectoplasm-react.git cd ectoplasm-react - Add the upstream remote:
git remote add upstream https://github.com/ORIGINAL_OWNER/ectoplasm-react.git
npm installCreate a .env file in the project root:
# Optional: CSPR.cloud API key for Odra contract balance queries
VITE_CSPR_CLOUD_API_KEY=your_api_key_herenpm run devThe application will be available at http://localhost:5173.
Always create a new branch for your work:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/issue-descriptionBranch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation updatesrefactor/- Code refactoringtest/- Adding or updating testschore/- Maintenance tasks
- Write clean, maintainable code
- Follow the coding standards
- Add comments for complex logic
- Update documentation as needed
# Run linter
npm run lint
# Build the project
npm run build
# Preview production build
npm run previewTest your changes thoroughly:
- Test on both Testnet and Mainnet (if applicable)
- Test with different wallet providers (CasperWallet, CSPR.click)
- Test both Native and Odra contract versions
- Verify responsive design on different screen sizes
Follow our commit guidelines:
git add .
git commit -m "feat: add new token swap feature"Regularly sync with the upstream repository:
git fetch upstream
git rebase upstream/maingit push origin feature/your-feature-name- Use TypeScript for all new code
- Define proper types and interfaces
- Avoid using
anytype unless absolutely necessary - Use meaningful variable and function names
Example:
// Good
interface TokenBalance {
symbol: string;
balance: string;
decimals: number;
}
// Avoid
let data: any;- Use functional components with hooks
- Keep components small and focused
- Extract reusable logic into custom hooks
- Use proper prop types
Example:
interface SwapFormProps {
fromToken: Token;
toToken: Token;
onSwap: (amount: string) => Promise<void>;
}
export const SwapForm: React.FC<SwapFormProps> = ({ fromToken, toToken, onSwap }) => {
// Component logic
};src/
├── components/ # Reusable UI components
│ ├── common/ # Shared components (Header, Footer, etc.)
│ └── [feature]/ # Feature-specific components
├── config/ # Configuration files
├── contexts/ # React contexts
├── hooks/ # Custom React hooks
├── pages/ # Page components
├── services/ # API and blockchain services
├── types/ # TypeScript type definitions
└── utils/ # Utility functions
- Use CSS modules or styled-components for component-specific styles
- Follow existing design patterns and theme
- Ensure responsive design (mobile, tablet, desktop)
- Support both light and dark themes
We use ESLint for code quality. Run the linter before committing:
npm run lintWe follow the Conventional Commits specification.
<type>(<scope>): <subject>
<body>
<footer>
feat: A new featurefix: A bug fixdocs: Documentation changesstyle: Code style changes (formatting, missing semicolons, etc.)refactor: Code refactoring without changing functionalityperf: Performance improvementstest: Adding or updating testschore: Maintenance tasks, dependency updates
# Feature
git commit -m "feat(swap): add slippage tolerance setting"
# Bug fix
git commit -m "fix(wallet): resolve balance refresh issue"
# Documentation
git commit -m "docs: update installation instructions"
# Breaking change
git commit -m "feat(api)!: change token balance response format
BREAKING CHANGE: Token balance API now returns BigInt instead of string"- ✅ Test your changes thoroughly
- ✅ Run the linter:
npm run lint - ✅ Build successfully:
npm run build - ✅ Update documentation if needed
- ✅ Rebase on latest main branch
- Push your branch to your fork
- Open a Pull Request on GitHub
- Fill out the PR template completely
- Link related issues (e.g., "Closes #123")
Use the same format as commit messages:
feat(swap): add multi-hop routing support
fix(liquidity): correct LP token calculation
## Description
Brief description of what this PR does.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Related Issues
Closes #123
## Testing
- [ ] Tested on Testnet
- [ ] Tested with CasperWallet
- [ ] Tested with CSPR.click
- [ ] Tested Native contracts
- [ ] Tested Odra contracts
- [ ] Tested responsive design
## Screenshots (if applicable)
Add screenshots or GIFs demonstrating the changes.
## Checklist
- [ ] My code follows the project's coding standards
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have updated the documentation accordingly
- [ ] My changes generate no new warnings or errors
- [ ] I have tested my changes thoroughly- At least one maintainer approval is required
- Address all review comments
- Keep the PR focused on a single concern
- Be responsive to feedback
When testing your changes, verify:
- Connect with CasperWallet extension
- Connect with CSPR.click
- Wallet disconnection works properly
- Balance updates correctly
- Swap executes successfully
- Slippage tolerance is respected
- Price impact is calculated correctly
- Transaction status updates properly
- Add liquidity works for both tokens
- Remove liquidity returns correct amounts
- LP token balance updates
- Stake CSPR for sCSPR
- Unstake sCSPR for CSPR
- Rewards calculation is accurate
- Responsive on mobile, tablet, and desktop
- Dark/light theme toggle works
- Loading states display correctly
- Error messages are clear and helpful
Test on both networks:
- Testnet: For development and testing
- Mainnet: For production-ready features (with caution)
Do not open public issues for security vulnerabilities.
Instead, please email security concerns to: [security@ectoplasm.example.com]
Include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
When contributing:
- Never commit private keys, mnemonics, or API keys
- Validate all user inputs
- Use proper error handling
- Follow secure coding practices for blockchain interactions
- Be cautious with external dependencies
We use npm's security features:
# Check for vulnerabilities
npm audit
# Fix vulnerabilities
npm audit fix- GitHub Issues: For bug reports and feature requests
- GitHub Discussions: For questions and general discussion
- Discord: [Join our Discord server] (if applicable)
Not all contributions are code! You can also help by:
- 📝 Improving documentation
- 🐛 Reporting bugs
- 💡 Suggesting features
- 🎨 Improving UI/UX
- 🧪 Testing new features
- 📢 Spreading the word
Contributors will be recognized in:
- The project's README
- Release notes
- Our community channels
If you have questions about contributing, feel free to:
- Open a GitHub Discussion
- Reach out on Discord
- Comment on relevant issues
Thank you for contributing to Ectoplasm DEX! 🚀
Your contributions help make decentralized finance more accessible on the Casper Network.