[go: up one dir, main page]

Skip to content

Monitor your DeFi Anchor Protocol "Earn" gains. Only working with UST deposit for now.

License

Notifications You must be signed in to change notification settings

azerpas/anchor-protocol-monitor

Repository files navigation

Anchor Protocol Monitor

Using anchor.js and terra.js to fetch the total deposit amount of UST in the Anchor Protocol, avoiding the constant check of the web app and get a daily update on your savings.
webapp webhook

How it works

You can use the functions inside terra.ts to run the script locally through index.ts or a custom script.
I personnally run the whole process through a Lambda microservice.

Flow

  • handler.ts is used to run the function inside AWS.
  • A CRON trigger the function each day.
  • The functions saves some values in the environnemental variables to reuse next time, thus avoiding the use of a database.
  • The function is using Discord Webhooks to alert the user.

How to use

1. Set-up the AWS Lambda func

A. Compress the files and upload the zip to AWS Lambda

  • git clone https://github.com/azerpas/anchor-protocol-monitor.git
  • npm i && npm run lambda
  • Drag and drop dist.zip to a AWS Lambda NodeJS 14.x function
  • Define the environnemental variables like the ones inside .env.template
  • Change the "Handler" inside the Runtime Settings to handler.handler instead of the default index.handler

B. Use Github actions

  • Create a AWS Lambda NodeJS 14.x function
  • Define the environnemental variables like the ones inside .env.template
  • Fork the repository
  • Go into your repository secrets inside settings
  • Add these values
    • AWS_ACCESS_KEY_ID: the AWS access key obtained through IAM
    • AWS_SECRET_ACCESS_KEY: the AWS secret key obtained through IAM
    • AWS_REGION: the AWS region of your Lambda func
    • FUNCTION_NAME: the AWS Lambda func name

2. CRON the function

  • Use CloudWatch Event to CRON the function
  • cron(0 12 * * ? *) to execute the function everyday at 12:00pm
    AWS_Screenshot

TODO

  • Add a initial base deposit in Discord
  • Return current APY

About

Monitor your DeFi Anchor Protocol "Earn" gains. Only working with UST deposit for now.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published