1.5.2 • Published 4 years ago
@maticnetwork/pos-portal v1.5.2
Matic PoS (Proof-of-Stake) portal contracts
Smart contracts that powers the PoS (proof-of-stake) based bridge mechanism for Matic Network.
Audit - Matic Audit CertiK Report.pdf
Usage
Install package from NPM using
npm i @maticnetwork/pos-portalSetup
git clone https://github.com/maticnetwork/pos-portal
cd pos-portal
npm installCompile all contracts
npm run template:process
npm run buildStart main chain and child chain
Start Main chain
npm run testrpcStart Matic child chain (Requires docker)
npm run borIf you ran a bor instance before, a dead docker container might still be lying around, clean it using following command:
npm run bor:cleanRun testcases
npm run testDeploy contracts locally
npm run migrateDeploy contracts on mainnet
- Moonwalker needs rabbitmq and local geth running
docker run -d -p 5672:5672 -p 15672:15672 rabbitmq:3-management
npm run testrpc- Export env vars
export MNEMONIC=
export FROM=
export PROVIDER_URL=
export ROOT_CHAIN_ID=
export CHILD_CHAIN_ID=
export PLASMA_ROOT_CHAIN=
export GAS_PRICE=- Compile contracts
npm run template:process -- --root-chain-id $ROOT_CHAIN_ID --child-chain-id $CHILD_CHAIN_ID
npm run build- Add root chain contract deployments to queue
npm run truffle exec moonwalker-migrations/queue-root-deployment.js- Process queue (rerun if interrupted)
node moonwalker-migrations/process-queue.js- Extract contract addresses from moonwalker output
node moonwalker-migrations/extract-addresses.js- Deploy child chain contracts
npm run truffle -- migrate --network mainnetChild --f 3 --to 3- Add root chain initializations to queue
node moonwalker-migrations/queue-root-initializations.js- Process queue (rerun if interrupted)
node moonwalker-migrations/process-queue.js- Initialize child chain contracts
npm run truffle -- migrate --network mainnetChild --f 5 --to 5- Register State Sync
- Register RootChainManager and ChildChainManager on StateSender
- Set stateSenderAddress on RootChainManager
- Grant STATE_SYNCER_ROLE on ChildChainManager
Command scripts (Management scripts)
npm run truffle exec scripts/update-implementation.js -- --network <network-name> <new-address>Transfer proxy ownership and admin role
Set list of contract addresses and new owner address in 6_change_owners.js migration script
Set MNEMONIC and API_KEY as env variables
npm run change-owners -- --network <network-name>