https://github.com/nucypher/train45
Polygon state transfer bot 🚂
https://github.com/nucypher/train45
Last synced: about 1 month ago
JSON representation
Polygon state transfer bot 🚂
- Host: GitHub
- URL: https://github.com/nucypher/train45
- Owner: nucypher
- License: agpl-3.0
- Created: 2024-02-02T17:43:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-21T19:49:34.000Z (over 2 years ago)
- Last Synced: 2025-01-07T09:43:13.797Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 8
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://docs.apeworx.io/ape/stable/index.html) as the testing and deployment framework of this project.
### Configuring Pre-commit
To install pre-commit locally:
```bash
pre-commit install
```
## Example of usage
```bash
export WEB3_INFURA_PROJECT_ID=
export APE_ACCOUNTS_BOT_PASSPHRASE=
export ETHERSCAN_API_KEY=
ape run proof_bot --fx-root-tunnel 0x51825d6e893c51836dC9C0EdF3867c57CD0cACB3 --graphql-endpoint https://api.goldsky.com/api/public/project_cmgzo6cgq00lc5np2dwaycfdl/subgraphs/taco-mainnet-polygon/v2.1.14/gn --proof-generator https://proof-generator.polygon.technology/api/v1/matic/ --network ethereum:mainnet:infura --account BOT
```
## Docker
##### Build
```bash
docker build -f deploy/Dockerfile -t nucypher/train45:latest .
```
##### Run
First, create the log file:
```bash
touch /var/log/cron.log
```
Then run the bot:
```bash
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:
```bash
tail -f /var/log/cron.log
```
##### Stop
```bash
docker stop train45 && docker rm train45
```
## Docker-compose
##### Build
```bash
docker-compose build
```
##### Start (all services)
First, create the log file:
```bash
touch /var/log/cron.log
```
Then run the bot with docker-compose
(including log server and autoupdate service):
```bash
docker-compose up -d
```
##### Stop (all services)
```bash
docker-compose down
```