https://github.com/0xpolygon/pos-contracts
https://github.com/0xpolygon/pos-contracts
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/0xpolygon/pos-contracts
- Owner: 0xPolygon
- License: gpl-3.0
- Created: 2024-02-14T14:38:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-27T13:31:14.000Z (about 1 year ago)
- Last Synced: 2025-03-27T14:32:25.126Z (about 1 year ago)
- Language: JavaScript
- Size: 20.3 MB
- Stars: 35
- Watchers: 4
- Forks: 22
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Audit: audit/ChainSecurity_Polygon_Staking_Contracts_audit.pdf
- Security: SECURITY.md
Awesome Lists containing this project
README
# Matic contracts

Ethereum smart contracts that power the [Matic Network](https://polygon.technology/polygon-pos).
## Development
### Install dependencies with
```
npm install
```
### Setup git hooks
```
pre-commit install
```
### Prepare templates
```
npm run template:process -- --bor-chain-id 15001
```
bor-chain-id should be:
**local: 15001**
Mainnet = 137
TestnetV4 (Mumbai) = 80001
### Generate interfaces
```
npm run generate:interfaces
```
### Build
```
forge build
```
## Testing
### Run forge upgrade forktest
```
forge test
```
### Run unit tests
#### Main chain and side chain
- Main chain
All tests are run against a fork of mainnet using Hardhat's forking functionality. No need to run any local chain!
- Start Matic side chain. Requires docker.
```
npm run bor:simulate
```
- Stop with
```
npm run bor:stop
```
- If you want a clean chain, this also deletes your /data folder containing the chain state.
```
npm run bor:clean
```
#### Run tests
Run Hardhat test
```
npm test:hardhat
```
### Coverage
Run coverage with
```
npm run coverage
```
## Contact
For more discussions, please head to the [R&D Discord](https://discord.gg/0xPolygonRnD)