amb-mediators/README.md

3.3 KiB

Join the chat at https://gitter.im/poanetwork/poa-bridge Build Status Coverage Status

AMB Mediators Smart Contracts

These contracts provide the functionality for mediators intended to work on top of the AMB bridge.

Usage

There are two ways to deploy contracts:

  • install and use NodeJS
  • use Docker to deploy

Deployment with NodeJS

Install Dependencies

npm install

Deploy

Please read the README.md in the deploy folder for instructions and .env file configuration

Test

npm test

Run coverage tests

npm run coverage

The results can be found in the coverage directory.

Flatten

Fattened contracts can be used to verify the contract code in a block explorer like BlockScout or Etherscan. The following command will prepare flattened version of the contracts:

npm run flatten

The flattened contracts can be found in the flats directory.

Deployment in the Docker environment

Docker and Docker Compose can be used to deploy contracts without NodeJS installed on the system. If you are on Linux, we recommend you create a docker group and add your user to it, so that you can use the CLI without sudo.

Prepare the docker container

docker-compose up --build

Note: The container must be rebuilt every time the code in a contract or deployment script is changed.

Deploy the contracts

  1. Create the .env file in the deploy directory as described in the deployment README.md.
  2. Run deployment process:
    docker-compose run amb-mediators deploy.sh
    
    or with Linux:
    ./deploy.sh
    

Copy flatten sources (if needed)

  1. Discover the container name:
    docker-compose images amb-mediators
    
  2. In the following command, use the container name to copy the flattened contracts code to the current working directory. The contracts will be located in the flats directory.
    docker cp name-of-your-container:/contracts/flats ./
    

Test contract and run coverage (if needed)

$ docker-compose run dev bash
$ npm test
$ npm run coverage

Shutdown the container

If the container is no longer needed, it can be shutdown:

docker-compose down

Contributing

See the CONTRIBUTING document for contribution, testing and pull request protocol.

License

License: GPL v3.0

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.