The collections of smart contracts that power the Ronin Delegated Proof of Stake (DPoS) network.
- Node@>=14 + Solc@^0.8.0
-
Add Github NPM token to install packages, and then replace
{YOUR_TOKEN}
in.npmrc
file by any arbitrary Github token withread:packages
permission.Note: To create a new token, please refer to this article. The token must have
read:packages
permission.cp .npmrc.example .npmrc && vim .npmrc
-
Install packages
$ yarn --frozen-lockfile
-
Compile contracts
$ yarn compile
-
Run test
$ yarn test
This repo contains source code of contracts that will be either deployed on the mainchains, or on Ronin chain.
- On mainchains:
- Governance contract:
MainchainGovernanceAdmin
- Bridge contract:
MainchainGatewayV2
- Trusted orgs contract:
RoninTrustedOrganization
- Governance contract:
- On Ronin chain:
- Governance contract:
RoninGovernanceAdmin
- Bridge operation:
RoninGatewayV2
- Trusted orgs contract:
RoninTrustedOrganization
- DPoS contracts
- Governance contract:
Except for the governance contracts and vault forwarder contracts, all other contracts are deployed following the proxy pattern for upgradeability. The TransparentUpgradeableProxyV2
, an extended version of OpenZeppelin's, is used for deploying the proxies.
To comply with the governance process, in which requires all modifications to a contract must be approved by a set of governors, the admin role of all proxies must be granted for the governance contract address.
-
Init the environment variables
$ cp .env.example .env && vim .env
-
Update the contract configuration in
config.ts
file -
Deploy the contracts
$ yarn hardhat deploy --network <local|ronin-devnet|ronin-mainnet|ronin-testnet>
See docs/README.md for the documentation of the contracts.
See docs/HACK.md for the structure of the repo.
For the contract interaction flow, please refer to DPoS Contract: Interaction Flow.
For the whitepaper, please refer to Ronin Whitepaper.