Skip to content

Lay3rLabs/example-telegram-bot

Repository files navigation

Layer AVS Telegram Bot

  • Clone with --recursive or remember to pull the submodules for solidity dependencies

One-time setup

  1. Copy .env.example to .env and set the right vars

  2. Join the your Telegram Group associated with the chat ID in .env to get notifications

  3. Install WAVS natively

TODO: use the docker images and adjust the commands here accordingly

git clone https://github.com/Lay3rLabs/WAVS.git ~/WAVS

cd ~/WAVS && just install-native ~/wavs-config ~/wavs-data
  1. Build all the contracts and components
just build
  1. Install any other generic tooling that pops up... e.g. just, foundry, docker etc.

That's it!

Up and running

  1. Start the backend
just start-backend

This may take some time if you've never started the backend before, but subsequent start-ups should be quick.

  1. Deploy contracts and services
just deploy

This may take some time if you've never deployed before, but subsequent deployments should be quick.

  1. Execute a token transfer
just transfer

You should get a Telegram notification in the group

  1. Stop the backend
just stop-backend

Implementation notes

Almost everyting is in the justfiles (using wavs-cli and forge to do the heavy lifting).

The way this works is it watches for ERC20 events. When an event is picked up it runs in two workflows in one service:

  1. "prepare" - writes a random uuid into filestorage (let's call this "operator id"), and sends a WAVS message through the pipeline
  2. "commit" - checks that the saved operator id matches the message, and sends out the telegram notification

This isn't bulletproof, but it more-or-less ensures that only one operator sends the message, and that it was verified

The only thing copy/pasted from WAVS are solidity interfaces.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published