Coder Social home page Coder Social logo

polymoonfarm / pos-portal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maticnetwork/pos-portal

0.0 0.0 0.0 39.12 MB

Smart contracts that powers the PoS (proof-of-stake) based bridge mechanism for Matic Network

License: GNU General Public License v3.0

JavaScript 22.20% Solidity 77.71% Shell 0.08%

pos-portal's Introduction

Matic PoS (Proof-of-Stake) portal contracts

Build Status

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-portal

Setup

git clone https://github.com/maticnetwork/pos-portal
cd pos-portal

npm install

Compile all contracts

npm run template:process
npm run build

Start main chain and child chain

Start Main chain

npm run testrpc

Start Matic child chain (Requires docker)

npm run bor

If you ran a bor instance before, a dead docker container might still be lying around, clean it using following command:

npm run bor:clean

Run testcases

npm run test

Deploy contracts locally

npm run migrate

Deploy contracts on mainnet

  1. Moonwalker needs rabbitmq and local geth running
docker run -d -p 5672:5672 -p 15672:15672 rabbitmq:3-management
npm run testrpc
  1. 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=
  1. Compile contracts
npm run template:process -- --root-chain-id $ROOT_CHAIN_ID --child-chain-id $CHILD_CHAIN_ID
npm run build
  1. Add root chain contract deployments to queue
npm run truffle exec moonwalker-migrations/queue-root-deployment.js
  1. Process queue (rerun if interrupted)
node moonwalker-migrations/process-queue.js
  1. Extract contract addresses from moonwalker output
node moonwalker-migrations/extract-addresses.js
  1. Deploy child chain contracts
npm run truffle -- migrate --network mainnetChild --f 3 --to 3
  1. Add root chain initializations to queue
node moonwalker-migrations/queue-root-initializations.js
  1. Process queue (rerun if interrupted)
node moonwalker-migrations/process-queue.js
  1. Initialize child chain contracts
npm run truffle -- migrate --network mainnetChild --f 5 --to 5
  1. 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>

pos-portal's People

Contributors

arthcp avatar itzmeanjan avatar jdkanani avatar ayushkaul avatar sanchaymittal avatar nachomazzara avatar onigiri-x avatar atvanguard avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.