Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ deployed/local
deployments
gasReporterOutput.json
.vscode/
docs
package-lock.json

package-lock.json
59 changes: 59 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## [1.0.1](https://github.com/razor-network/contracts/compare/v1.0.0...v1.0.1) (2022-04-04)


### Bug Fixes

* **release:** explicitly export abis before publish ([1931444](https://github.com/razor-network/contracts/commit/1931444e8ea05491c38685a81e826330748105db))

# [1.0.0](https://github.com/razor-network/contracts/compare/v0.3.0...v1.0.0) (2022-04-04)


### Bug Fixes

* increase footer max line length ([26d09e7](https://github.com/razor-network/contracts/commit/26d09e79170515e5efe51282e5c4bf6ad273c1e7))


### chore

* **release:** dummy commit to trigger release ([2ecb956](https://github.com/razor-network/contracts/commit/2ecb95696b99ff09dbda7f4fbf9832dd6ea06a8a))


* Merge pull request #783 from razor-network/next ([b789199](https://github.com/razor-network/contracts/commit/b789199b162f3a763b04329a593bd2b109f81ea5)), closes [#783](https://github.com/razor-network/contracts/issues/783)


### BREAKING CHANGES

* Release
* **release:** Release

# [0.3.0](https://github.com/razor-network/contracts/compare/v0.2.1...v0.3.0) (2022-04-04)


### Bug Fixes

* clean up docgen ([#743](https://github.com/razor-network/contracts/issues/743)) ([2bba861](https://github.com/razor-network/contracts/commit/2bba86197e01a1f8873b8cc9cffdc93829fce359))
* dispute 'disputeCollectionIdShouldBePresent()' is successful if empty array is passed ([#763](https://github.com/razor-network/contracts/issues/763)) ([d029654](https://github.com/razor-network/contracts/commit/d02965414e5931a28fa4b6aa56404d33f9b84f59))
* fixed delegator migration ([#775](https://github.com/razor-network/contracts/issues/775)) ([ca349e4](https://github.com/razor-network/contracts/commit/ca349e4ce6be76d63e644414d4f13e58ee46c815))
* fixed scenarios ([#761](https://github.com/razor-network/contracts/issues/761)) ([2ec3d73](https://github.com/razor-network/contracts/commit/2ec3d73bf4792e5af1744e63cca390cdb59fb2f1))
* only propose revealed assets of epoch ([#726](https://github.com/razor-network/contracts/issues/726)) ([2c14622](https://github.com/razor-network/contracts/commit/2c1462220fcb1d9cbf9143da6e82f4ef4d242b27))
* optmized for calls in loop : slither warning ([#745](https://github.com/razor-network/contracts/issues/745)) ([b1f4236](https://github.com/razor-network/contracts/commit/b1f423648b7e3366cdb3377bcfee30f752e555f9))
* removed require statement from BlockManager ([#740](https://github.com/razor-network/contracts/issues/740)) ([af10f62](https://github.com/razor-network/contracts/commit/af10f6219662c03440d353b22106c13c19e13bec))
* stakerReward being updated properly ([#770](https://github.com/razor-network/contracts/issues/770)) ([1e19b51](https://github.com/razor-network/contracts/commit/1e19b51fe13ff9642d2970ff3e4b3ef9283209ea))


### Features

* add docgen to the project from natspec ([#731](https://github.com/razor-network/contracts/issues/731)) ([4fd81ca](https://github.com/razor-network/contracts/commit/4fd81ca7233de0f231177e42c046d5b47b7bee9c))
* added require length check in propose ([#765](https://github.com/razor-network/contracts/issues/765)) ([2535e59](https://github.com/razor-network/contracts/commit/2535e5961d34f4cbd98c9b831f0fd9d6e2de2d97))
* removed redundant roles ([#754](https://github.com/razor-network/contracts/issues/754)) ([cb79103](https://github.com/razor-network/contracts/commit/cb79103b8df851f4958b9aa467b9252f31a73f19))
* removed uncessary slither warnigns for timestamp ([#755](https://github.com/razor-network/contracts/issues/755)) ([c43731d](https://github.com/razor-network/contracts/commit/c43731d60a252a47393af070ae7687a2f4cfe5d4))
* staker can now claim commission ([#758](https://github.com/razor-network/contracts/issues/758)) ([6469129](https://github.com/razor-network/contracts/commit/64691296e5f3420cd6309e26fa17c26c31300647))

## [0.2.1](https://github.com/razor-network/contracts/compare/v0.2.0...v0.2.1) (2022-02-23)


### Bug Fixes

* disable body check on commits ([b351303](https://github.com/razor-network/contracts/commit/b35130307a7a5a6b90518d0a8ced0171ade58c1a))
* disable commit body length ([78ca858](https://github.com/razor-network/contracts/commit/78ca85807514ca904102adff743b394609c0979f))
* Fix readme ([69c008d](https://github.com/razor-network/contracts/commit/69c008de5dac294135942f5fe11352e59d14fc99))
260 changes: 260 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
# Contributing to Oracle Contracts

This guide explains how to contribute to the Oracle Contracts project, covering everything from setting up your development environment to submitting pull requests.

## Development Setup

### Prerequisites
- Node.js >= 16
- Git
- npm or yarn
- Hardhat development environment

### Initial Setup

1. Fork the repository on GitHub:
- Visit [razor-network/contracts](https://github.com/razor-network/contracts)
- Click the 'Fork' button
- Clone your fork locally:
```bash
git clone git@github.com:YourLogin/contracts.git
cd contracts
```

2. Install dependencies:
```bash
npm install
# or
yarn install
```

3. Add upstream remote:
```bash
git remote add upstream git@github.com:razor-network/contracts.git
```

## Development Workflow

### 1. Branch Management

Always create a feature branch for your work:
```bash
# Sync with upstream
git checkout master
git pull upstream master

# Create feature branch
git checkout -b feature/your-feature-name
```

### 2. Development Process

1. Make your changes in the feature branch
2. Follow the code style guidelines
3. Add tests for new functionality
4. Ensure all tests pass
5. Update documentation as needed

### 3. Testing Requirements

Run the full test suite before submitting:
```bash
# Run all tests
npm test

# Run specific test scenarios
npm run scenarios

# Check test coverage
npm run coverage
```

Coverage requirements:
- Statements: 90%
- Branches: 60%
- Functions: 85%
- Lines: 86%

### 4. Code Quality

Maintain code quality by running:
```bash
# Run all linters
npm run lint

# Fix linting issues
npm run lint:fix

# Run specific linters
npm run lint:sol # Solidity files
npm run lint:js # JavaScript files
```

## Code Style Guidelines

### Solidity Style Guide

1. **Contract Structure**
```solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

contract MyContract {
// State variables
// Events
// Modifiers
// Constructor
// External functions
// Public functions
// Internal functions
// Private functions
}
```

2. **Naming Conventions**
- Contracts: PascalCase
- Functions: camelCase
- Variables: camelCase
- Events: PascalCase
- Modifiers: camelCase

3. **Documentation**
- Use NatSpec format for all public interfaces
- Document parameters and return values
- Explain complex logic
```solidity
/// @notice Brief description
/// @dev Detailed description
/// @param name Description of parameter
/// @return Description of return value
```

### JavaScript Style Guide

1. **File Structure**
- Use ES modules (import/export)
- One class/component per file
- Clear file naming

2. **Code Formatting**
- Use prettier for consistent formatting
- 2 space indentation
- Semicolons required
- Single quotes for strings

## Pull Request Process

1. **Before Submitting**
- Sync with upstream master
- Run all tests
- Check code coverage
- Run linters
- Update documentation

2. **Creating the PR**
```bash
git add .
git commit -m "feat: description of your changes"
git push origin feature/your-feature-name
```

3. **PR Guidelines**
- Use conventional commit messages
- Include tests for new features
- Update relevant documentation
- Link related issues
- Provide clear description of changes

4. **PR Template**
```markdown
## Description
Brief description of changes

## Type of change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] Code follows style guidelines
- [ ] All tests passing
```

## Smart Contract Development

### 1. Contract Modifications

When modifying contracts:
1. Update interfaces if needed
2. Add new tests
3. Update deployment scripts
4. Document changes in NatSpec

### 2. Testing Guidelines

1. **Test Structure**
```javascript
describe("Contract", () => {
before(() => {
// Setup
});

it("should do something", async () => {
// Test
});
});
```

2. **Test Coverage**
- Happy path scenarios
- Edge cases
- Error conditions
- Access control
- State transitions

### 3. Gas Optimization

1. Run gas analysis:
```bash
npm run gas
```

2. Compare gas usage:
```bash
npm run gasCompare
```

## Documentation

### 1. Code Documentation
- Use NatSpec comments for all public interfaces
- Document complex algorithms
- Explain security considerations
- Update API documentation

### 2. Technical Documentation
- Update relevant .md files
- Keep diagrams current
- Document breaking changes
- Update examples

## Getting Help

1. **Resources**
- [Project Documentation](docs/README.md)
- [Core Concepts](docs/core-concepts.md)
- [API Reference](docs/api-reference.md)

2. **Community**
- GitHub Issues
- Development chat
- Technical discussions

## Related Documentation
- [Architecture Overview](architecture.md)
- [Setup Guide](setup-and-installation.md)
- [API Reference](api-reference.md)
- [Core Concepts](core-concepts.md)
Loading
Loading