Skip to content

Commit 653ae58

Browse files
authored
docs: added docs (#1017)
1 parent 15a5167 commit 653ae58

15 files changed

+2563
-2
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ deployed/local
1818
deployments
1919
gasReporterOutput.json
2020
.vscode/
21-
docs
22-
package-lock.json
21+
22+
package-lock.json

docs/CHANGELOG.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## [1.0.1](https://github.com/razor-network/contracts/compare/v1.0.0...v1.0.1) (2022-04-04)
2+
3+
4+
### Bug Fixes
5+
6+
* **release:** explicitly export abis before publish ([1931444](https://github.com/razor-network/contracts/commit/1931444e8ea05491c38685a81e826330748105db))
7+
8+
# [1.0.0](https://github.com/razor-network/contracts/compare/v0.3.0...v1.0.0) (2022-04-04)
9+
10+
11+
### Bug Fixes
12+
13+
* increase footer max line length ([26d09e7](https://github.com/razor-network/contracts/commit/26d09e79170515e5efe51282e5c4bf6ad273c1e7))
14+
15+
16+
### chore
17+
18+
* **release:** dummy commit to trigger release ([2ecb956](https://github.com/razor-network/contracts/commit/2ecb95696b99ff09dbda7f4fbf9832dd6ea06a8a))
19+
20+
21+
* 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)
22+
23+
24+
### BREAKING CHANGES
25+
26+
* Release
27+
* **release:** Release
28+
29+
# [0.3.0](https://github.com/razor-network/contracts/compare/v0.2.1...v0.3.0) (2022-04-04)
30+
31+
32+
### Bug Fixes
33+
34+
* clean up docgen ([#743](https://github.com/razor-network/contracts/issues/743)) ([2bba861](https://github.com/razor-network/contracts/commit/2bba86197e01a1f8873b8cc9cffdc93829fce359))
35+
* 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))
36+
* fixed delegator migration ([#775](https://github.com/razor-network/contracts/issues/775)) ([ca349e4](https://github.com/razor-network/contracts/commit/ca349e4ce6be76d63e644414d4f13e58ee46c815))
37+
* fixed scenarios ([#761](https://github.com/razor-network/contracts/issues/761)) ([2ec3d73](https://github.com/razor-network/contracts/commit/2ec3d73bf4792e5af1744e63cca390cdb59fb2f1))
38+
* only propose revealed assets of epoch ([#726](https://github.com/razor-network/contracts/issues/726)) ([2c14622](https://github.com/razor-network/contracts/commit/2c1462220fcb1d9cbf9143da6e82f4ef4d242b27))
39+
* 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))
40+
* removed require statement from BlockManager ([#740](https://github.com/razor-network/contracts/issues/740)) ([af10f62](https://github.com/razor-network/contracts/commit/af10f6219662c03440d353b22106c13c19e13bec))
41+
* stakerReward being updated properly ([#770](https://github.com/razor-network/contracts/issues/770)) ([1e19b51](https://github.com/razor-network/contracts/commit/1e19b51fe13ff9642d2970ff3e4b3ef9283209ea))
42+
43+
44+
### Features
45+
46+
* 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))
47+
* added require length check in propose ([#765](https://github.com/razor-network/contracts/issues/765)) ([2535e59](https://github.com/razor-network/contracts/commit/2535e5961d34f4cbd98c9b831f0fd9d6e2de2d97))
48+
* removed redundant roles ([#754](https://github.com/razor-network/contracts/issues/754)) ([cb79103](https://github.com/razor-network/contracts/commit/cb79103b8df851f4958b9aa467b9252f31a73f19))
49+
* removed uncessary slither warnigns for timestamp ([#755](https://github.com/razor-network/contracts/issues/755)) ([c43731d](https://github.com/razor-network/contracts/commit/c43731d60a252a47393af070ae7687a2f4cfe5d4))
50+
* staker can now claim commission ([#758](https://github.com/razor-network/contracts/issues/758)) ([6469129](https://github.com/razor-network/contracts/commit/64691296e5f3420cd6309e26fa17c26c31300647))
51+
52+
## [0.2.1](https://github.com/razor-network/contracts/compare/v0.2.0...v0.2.1) (2022-02-23)
53+
54+
55+
### Bug Fixes
56+
57+
* disable body check on commits ([b351303](https://github.com/razor-network/contracts/commit/b35130307a7a5a6b90518d0a8ced0171ade58c1a))
58+
* disable commit body length ([78ca858](https://github.com/razor-network/contracts/commit/78ca85807514ca904102adff743b394609c0979f))
59+
* Fix readme ([69c008d](https://github.com/razor-network/contracts/commit/69c008de5dac294135942f5fe11352e59d14fc99))

docs/CONTRIBUTING.md

+260
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
# Contributing to Oracle Contracts
2+
3+
This guide explains how to contribute to the Oracle Contracts project, covering everything from setting up your development environment to submitting pull requests.
4+
5+
## Development Setup
6+
7+
### Prerequisites
8+
- Node.js >= 16
9+
- Git
10+
- npm or yarn
11+
- Hardhat development environment
12+
13+
### Initial Setup
14+
15+
1. Fork the repository on GitHub:
16+
- Visit [razor-network/contracts](https://github.com/razor-network/contracts)
17+
- Click the 'Fork' button
18+
- Clone your fork locally:
19+
```bash
20+
git clone [email protected]:YourLogin/contracts.git
21+
cd contracts
22+
```
23+
24+
2. Install dependencies:
25+
```bash
26+
npm install
27+
# or
28+
yarn install
29+
```
30+
31+
3. Add upstream remote:
32+
```bash
33+
git remote add upstream [email protected]:razor-network/contracts.git
34+
```
35+
36+
## Development Workflow
37+
38+
### 1. Branch Management
39+
40+
Always create a feature branch for your work:
41+
```bash
42+
# Sync with upstream
43+
git checkout master
44+
git pull upstream master
45+
46+
# Create feature branch
47+
git checkout -b feature/your-feature-name
48+
```
49+
50+
### 2. Development Process
51+
52+
1. Make your changes in the feature branch
53+
2. Follow the code style guidelines
54+
3. Add tests for new functionality
55+
4. Ensure all tests pass
56+
5. Update documentation as needed
57+
58+
### 3. Testing Requirements
59+
60+
Run the full test suite before submitting:
61+
```bash
62+
# Run all tests
63+
npm test
64+
65+
# Run specific test scenarios
66+
npm run scenarios
67+
68+
# Check test coverage
69+
npm run coverage
70+
```
71+
72+
Coverage requirements:
73+
- Statements: 90%
74+
- Branches: 60%
75+
- Functions: 85%
76+
- Lines: 86%
77+
78+
### 4. Code Quality
79+
80+
Maintain code quality by running:
81+
```bash
82+
# Run all linters
83+
npm run lint
84+
85+
# Fix linting issues
86+
npm run lint:fix
87+
88+
# Run specific linters
89+
npm run lint:sol # Solidity files
90+
npm run lint:js # JavaScript files
91+
```
92+
93+
## Code Style Guidelines
94+
95+
### Solidity Style Guide
96+
97+
1. **Contract Structure**
98+
```solidity
99+
// SPDX-License-Identifier: UNLICENSED
100+
pragma solidity ^0.8.0;
101+
102+
contract MyContract {
103+
// State variables
104+
// Events
105+
// Modifiers
106+
// Constructor
107+
// External functions
108+
// Public functions
109+
// Internal functions
110+
// Private functions
111+
}
112+
```
113+
114+
2. **Naming Conventions**
115+
- Contracts: PascalCase
116+
- Functions: camelCase
117+
- Variables: camelCase
118+
- Events: PascalCase
119+
- Modifiers: camelCase
120+
121+
3. **Documentation**
122+
- Use NatSpec format for all public interfaces
123+
- Document parameters and return values
124+
- Explain complex logic
125+
```solidity
126+
/// @notice Brief description
127+
/// @dev Detailed description
128+
/// @param name Description of parameter
129+
/// @return Description of return value
130+
```
131+
132+
### JavaScript Style Guide
133+
134+
1. **File Structure**
135+
- Use ES modules (import/export)
136+
- One class/component per file
137+
- Clear file naming
138+
139+
2. **Code Formatting**
140+
- Use prettier for consistent formatting
141+
- 2 space indentation
142+
- Semicolons required
143+
- Single quotes for strings
144+
145+
## Pull Request Process
146+
147+
1. **Before Submitting**
148+
- Sync with upstream master
149+
- Run all tests
150+
- Check code coverage
151+
- Run linters
152+
- Update documentation
153+
154+
2. **Creating the PR**
155+
```bash
156+
git add .
157+
git commit -m "feat: description of your changes"
158+
git push origin feature/your-feature-name
159+
```
160+
161+
3. **PR Guidelines**
162+
- Use conventional commit messages
163+
- Include tests for new features
164+
- Update relevant documentation
165+
- Link related issues
166+
- Provide clear description of changes
167+
168+
4. **PR Template**
169+
```markdown
170+
## Description
171+
Brief description of changes
172+
173+
## Type of change
174+
- [ ] Bug fix
175+
- [ ] New feature
176+
- [ ] Breaking change
177+
- [ ] Documentation update
178+
179+
## Checklist
180+
- [ ] Tests added/updated
181+
- [ ] Documentation updated
182+
- [ ] Code follows style guidelines
183+
- [ ] All tests passing
184+
```
185+
186+
## Smart Contract Development
187+
188+
### 1. Contract Modifications
189+
190+
When modifying contracts:
191+
1. Update interfaces if needed
192+
2. Add new tests
193+
3. Update deployment scripts
194+
4. Document changes in NatSpec
195+
196+
### 2. Testing Guidelines
197+
198+
1. **Test Structure**
199+
```javascript
200+
describe("Contract", () => {
201+
before(() => {
202+
// Setup
203+
});
204+
205+
it("should do something", async () => {
206+
// Test
207+
});
208+
});
209+
```
210+
211+
2. **Test Coverage**
212+
- Happy path scenarios
213+
- Edge cases
214+
- Error conditions
215+
- Access control
216+
- State transitions
217+
218+
### 3. Gas Optimization
219+
220+
1. Run gas analysis:
221+
```bash
222+
npm run gas
223+
```
224+
225+
2. Compare gas usage:
226+
```bash
227+
npm run gasCompare
228+
```
229+
230+
## Documentation
231+
232+
### 1. Code Documentation
233+
- Use NatSpec comments for all public interfaces
234+
- Document complex algorithms
235+
- Explain security considerations
236+
- Update API documentation
237+
238+
### 2. Technical Documentation
239+
- Update relevant .md files
240+
- Keep diagrams current
241+
- Document breaking changes
242+
- Update examples
243+
244+
## Getting Help
245+
246+
1. **Resources**
247+
- [Project Documentation](docs/README.md)
248+
- [Core Concepts](docs/core-concepts.md)
249+
- [API Reference](docs/api-reference.md)
250+
251+
2. **Community**
252+
- GitHub Issues
253+
- Development chat
254+
- Technical discussions
255+
256+
## Related Documentation
257+
- [Architecture Overview](architecture.md)
258+
- [Setup Guide](setup-and-installation.md)
259+
- [API Reference](api-reference.md)
260+
- [Core Concepts](core-concepts.md)

0 commit comments

Comments
 (0)