Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

topos-protocol/local-erc20-messaging-infra

Repository files navigation


Logo Logo

Run the local ERC20 messaging infrastructure with docker compose 🐳


Getting Started

Install Docker

https://docs.docker.com/get-docker/

Stop

docker compose down -v

Note: The -v flag is important here to ensure that we clean up storage in between runs.

Run

If you have a partial or complete existing run, it's recommended to shut down the whole stack (see Stop) before re-running it.

For convenience we have included a .env.secrets file with example keys and other info. When starting the stack locally, make sure you source ./.env.secrets.

To run the whole stack:

docker compose up -d

Run with the Executor Service

To additionally run an instance of the Executor Service (and a Redis server as dependency), you can use the executor-service profile:

docker compose --profile executor-service up -d

Notes

  • You need to add the --profile flag to all commands, e.g. docker compose --profile ... down
  • Important: The Executor Service must run on the host network. As detailed in docker's documentation, the host networking driver only works on Linux. This means Mac/Windows users cannot use this flag and must run the Executor Service natively on the host.

Local integration tests

The integration tests are located in the ./tests directory (see README.md).

Env

A few environment variables are editable from the .env file found on the root of this repository.

  • TOPOS_EDGE_VERSION: topos-protocol/polygon-edge's version
  • TOPOS_VERSION: topos-protocol/topos's version
  • TOPOS_MESSAGING_PROTOCOL_CONTRACTS_VERSION: toposware/topos-smart-contracts's version
  • EXECUTOR_SERVICE_VERSION: topos-protocol/executor-service's version
  • TOPOS_CORE_CONTRACT_ADDRESS: ToposCore contract's address

Other (private) environment variables need be set in the environment (e.g., ~/.zshrc, ~/.bashrc):

  • PRIVATE_KEY: ToposDeployer's private key (see here)—ToposDeployer is a account with funds on every subnet
  • TOKEN_DEPLOYER_SALT: salt for TokenDeployer's deployment (see here)
  • TOPOS_CORE_SALT: salt for ToposCore's deployment (see here)
  • TOPOS_CORE_PROXY_SALT: salt for ToposCoreProxy's deployment (see here)
  • SUBNET_REGISTRATOR_SALT: salt for SubnetRegistrator's deployment (see here)
  • ERC20_MESSAGING_SALT: salt for ERC20Messaging's deployment (see here)

Important!

To find the right ToposCore contract address (to be passed as TOPOS_CORE_CONTRACT_ADDRESS), you can:

  1. Run the whole stack once (see Run) with any or no address
  2. Run docker logs -f contracts and wait for ToposCoreProxy to be deployed
  3. Set ToposCoreProxy's address found in the logs above as TOPOS_CORE_CONTRACT_ADDRESS
  4. Stop and Run the whole stack again!

Resources

License

This project is released under the terms of the MIT license.