Skip to content

Latest commit

 

History

History
97 lines (65 loc) · 1.81 KB

README.md

File metadata and controls

97 lines (65 loc) · 1.81 KB

State Transfer Bot Polygon → Ethereum

Stateless bot monitors GraphQL endpoint for new events MessageSent that occurs on Polygon network. And then transfers proof to Ethereum root contract.

Installation

We use Ape as the testing and deployment framework of this project.

Configuring Pre-commit

To install pre-commit locally:

pre-commit install

Example of usage

export WEB3_INFURA_PROJECT_ID=<Infura project ID>
export APE_ACCOUNTS_BOT_PASSPHRASE=<Passphrase for account with alias BOT>
export ETHERSCAN_API_KEY=<API Key for Etherscan>

ape run proof_bot --fx-root-tunnel 0x51825d6e893c51836dC9C0EdF3867c57CD0cACB3--graphql-endpoint https://subgraph.satsuma-prod.com/735cd3ac7b23/nucypher-ops/PolygonChild/api --proof-generator https://proof-generator.polygon.technology/api/v1/matic/exit-payload/ --network ethereum:mainnet:infura --account BOT

Docker

Build
docker build -f deploy/Dockerfile -t nucypher/train45:latest .
Run

First, create the log file:

touch /var/log/cron.log

Then run the bot:

docker run             \
--name train45         \
--detach               \
--env-file .env        \
-f deploy/Dockerfile   \
-v /var/log/cron.log:/var/log/cron.log \
-v /var/log/:/var/log/ \
-v ~/.ape/:/root/.ape  \
nucypher/train45:latest

Enjoy the logs:

tail -f /var/log/cron.log
Stop
docker stop train45 && docker rm train45

Docker-compose

Build
docker-compose build
Start (all services)

First, create the log file:

touch /var/log/cron.log

Then run the bot with docker-compose (including log server and autoupdate service):

docker-compose up -d
Stop (all services)
docker-compose down