https://github.com/maticnetwork/genesis-contracts
Bor genesis contracts
https://github.com/maticnetwork/genesis-contracts
Last synced: about 1 year ago
JSON representation
Bor genesis contracts
- Host: GitHub
- URL: https://github.com/maticnetwork/genesis-contracts
- Owner: maticnetwork
- Created: 2019-09-19T16:50:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-13T09:39:06.000Z (about 1 year ago)
- Last Synced: 2025-04-02T10:36:05.049Z (about 1 year ago)
- Language: Solidity
- Homepage:
- Size: 918 KB
- Stars: 49
- Watchers: 33
- Forks: 37
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# genesis-contracts
> NOTE (IMPORTANT!)
> If you modify contracts, run `forge build` before testing/deploying/etc, or Foundry may not recompile them!
#### Setup genesis
Setup genesis whenever contracts get changed
### 1. Install dependencies and submodules
```bash
npm install
git submodule init
git submodule update
```
### 2. Compile Matic contracts
```bash
cd matic-contracts
npm install
node scripts/process-templates.js --bor-chain-id
npm run truffle:compile
cd ..
```
### 3. Generate Bor validator set sol file
Following command will generate `BorValidatorSet.sol` file from `BorValidatorSet.template` file.
```bash
# Generate bor validator set using stake and balance
# Modify validators.json before as per your need
$ node generate-borvalidatorset.js --bor-chain-id --heimdall-chain-id
```
### 4. Compile contracts
```bash
$ npm run truffle:compile
```
### 5. Configure Block times
To add custom block time and associated block no.s in genesis, edit the `blocks.js` file
### 6. Generate genesis file
Following command will generate `genesis.json` file from `genesis-template.json` file.
```bash
# Generate genesis file
node generate-genesis.js --bor-chain-id --heimdall-chain-id
```
### 7. Run Tests
```bash
$ npm run testrpc
$ npm test
```