Thank you for your interest in contributing to OIF Contracts! This document outlines our guidelines, processes, and expectations for contributors.
We are committed to providing a welcoming and inclusive environment for all contributors. By participating in this project, you agree to abide by the following principles:
- Be respectful: Treat all community members with respect and kindness
- Be inclusive: Welcome newcomers and encourage diverse perspectives
- Be constructive: Provide helpful feedback and engage in productive discussions
- Be professional: Maintain a professional tone in all communications
- Be collaborative: Work together towards common goals and share knowledge
- Harassment, discrimination, or personal attacks of any kind
- Trolling, insulting comments, or derogatory language
- Publishing private information without permission
- Any conduct that would be inappropriate in a professional setting
- Search existing issues to ensure your contribution isn't already being worked on
- Open an issue to discuss significant changes before implementing them
- Fork the repository and create a feature branch from
main
- Fill out the PR template completely
- Provide a clear description of what your PR does and why
- Reference related issues using
Fixes #123orCloses #123 - Keep PRs focused - one feature or fix per PR
- Update documentation if your changes affect public APIs
- Ensure all tests pass and maintain or improve code coverage
- Request review from appropriate maintainers
- Automated checks must pass (tests, linting, security scans)
- Code review by at least one maintainer
- Security review for contracts handling funds or critical logic
- Final approval and merge by a maintainer
CRITICAL REQUIREMENT: All integrations with third-party protocols must follow these strict guidelines:
- No external library imports: Do not add third-party contracts as forge dependencies
- Copy interfaces locally: All required interfaces must be copied into an
externalfolder of the integration. Example:src/oracles/[oracle-type]/external/ - Minimal dependencies: Only include the specific interfaces and types needed for integration
- Self-contained: Each integration must be fully functional with only the code present in this repository
Oracle implementations have additional strict requirements:
- No proxy patterns: Oracles must be immutable once deployed
- No admin functions: That could change core logic or parameters
- Final deployment: Consider the contract final upon deployment
- Minimal ownership: Only include ownership if absolutely necessary for functionality
- Justify ownership: Clearly document why ownership is required
- Ownership functions: Must be limited to non-critical operations (e.g., fee collection, not price updates)
- Zero external dependencies: Follow the third-party integration guidelines above
- Self-contained oracles: Must function independently if possible
- Included interfaces: Copy all required external interfaces to the repository
- Price validation: Include reasonable bounds checking and staleness protection
- Fallback mechanisms: Consider graceful degradation when external data is unavailable
- Gas optimization: Optimize for gas efficiency as oracles are called frequently
- Documentation: Provide clear documentation on:
- Data sources and update mechanisms
- Precision and units used
- Expected update frequency
- Failure modes and handling
- Follow the Solidity Style Guide
- Use meaningful variable and function names
- Include comprehensive NatSpec documentation
- Prefer explicit over implicit (e.g., explicit visibility modifiers)
- Reentrancy protection: Use appropriate guards where needed
- Input validation: Validate all external inputs
- Integer overflow: Use safe math practices
- Access control: Implement proper permission systems
- External calls: Handle external call failures gracefully
Thank you for contributing to OIF Contracts! Your efforts help make decentralized infrastructure more robust and accessible.