Thank you for your interest in contributing to Lira Protocol! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Workflow
- Coding Standards
- Testing
- Pull Request Process
- Security
We are committed to providing a welcoming and inclusive environment for all contributors.
- Be respectful and inclusive
- Accept constructive criticism gracefully
- Focus on what is best for the community
- Show empathy towards others
- Node.js >= 18.0.0
- Basic knowledge of React, TypeScript, and Solidity
- Familiarity with Git
- Fork the repository
# Click "Fork" on GitHub- Clone your fork
git clone https://github.com/YOUR_USERNAME/lira.git
cd lira- Add upstream remote
git remote add upstream https://github.com/SMSDAO/lira.git- Install dependencies
npm install
cd backend/php && composer install
cd ../go && go mod download- Set up environment
cp .env.example .env
# Configure your .env file- Run the development server
npm run dev- Feature:
feature/description-of-feature - Bug fix:
fix/description-of-fix - Documentation:
docs/description - Performance:
perf/description
Follow conventional commits:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting)refactor: Code refactoringtest: Adding testschore: Maintenance tasks
Example:
feat(contracts): add quantum oracle integration
- Implement Q# quantum predictor
- Add parallel agent execution
- Update AgentExecutor contract
Closes #123
- Create a branch
git checkout -b feature/my-feature- Make your changes
# Write code
# Add tests
# Update documentation- Run tests
npm run test
npx hardhat test- Commit your changes
git add .
git commit -m "feat: add new feature"- Keep your fork updated
git fetch upstream
git rebase upstream/main- Push to your fork
git push origin feature/my-feature- Use TypeScript for all new code
- Follow ESLint configuration
- Use functional components with hooks
- Prefer const over let
- Use meaningful variable names
// Good
const userTokenBalance = await getUserBalance(address);
// Avoid
const x = await getBalance(addr);- Use Solidity 0.8.20
- Follow OpenZeppelin patterns
- Document with NatSpec
- Include require statements with clear error messages
/// @notice Creates a new agent with model configuration
/// @param name Agent name
/// @param modelType Type of AI model
/// @return agentId The ID of created agent
function createAgent(
string memory name,
string memory modelType
) external returns (uint256 agentId) {
require(bytes(name).length > 0, "Name required");
// Implementation
}- Follow Go conventions
- Use gofmt
- Write idiomatic Go
- Handle errors explicitly
// Good
if err != nil {
return fmt.Errorf("failed to create agent: %w", err)
}
// Avoid
if err != nil {
panic(err)
}- Follow PSR-12 coding standards
- Use namespaces
- Type hint parameters and return types
- Document with PHPDoc
/**
* Get all tokens
*
* @return array<Token>
*/
public function getAllTokens(): array {
// Implementation
}# Run all tests
npx hardhat test
# Run specific test
npx hardhat test test/Lira.test.js
# Check coverage
npx hardhat coverageAll new contracts must have:
- Unit tests (>90% coverage)
- Integration tests
- Gas usage tests
# Run tests
npm run test
# Watch mode
npm run test:watchAll new components should have:
- Component tests
- Integration tests
- Accessibility tests
# PHP tests
cd backend/php && composer test
# Go tests
cd backend/go && go test ./...- Code follows style guidelines
- Tests pass locally
- New tests added for new features
- Documentation updated
- Commit messages follow conventions
- Branch is up to date with main
Follow conventional commits format:
feat(contracts): add quantum oracle integration
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
Describe the tests you ran
## Checklist
- [ ] Tests pass
- [ ] Documentation updated
- [ ] No console errors
- [ ] Follows code style
## Screenshots (if applicable)
Add screenshots here- Automated checks must pass (CI/CD)
- At least one maintainer approval required
- Address all review comments
- Squash commits if requested
- Maintainer will merge
- Smart contract optimizations
- Frontend UI/UX improvements
- Documentation improvements
- Test coverage increase
- Security enhancements
Look for issues labeled:
good first issuehelp wanteddocumentation
- Open an issue first to discuss
- Wait for maintainer feedback
- Then implement if approved
DO NOT create public issues for security vulnerabilities.
Instead:
- Email: security@lira.ai
- Provide detailed description
- Include steps to reproduce
- Wait for response before disclosure
- Never commit private keys
- Use environment variables
- Validate all inputs
- Follow security best practices
- Run security audits on contracts
Contributors will be:
- Listed in CONTRIBUTORS.md
- Mentioned in release notes
- Credited in documentation
- GitHub Discussions: https://github.com/SMSDAO/lira/discussions
- Discord: [Coming soon]
- Email: dev@lira.ai
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.
Thank you for contributing to Lira Protocol! 🚀