GithubHelp home page GithubHelp logo

epete-epete / beefy-cowllector-v2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beefyfinance/beefy-cowllector-v2

0.0 0.0 0.0 597 KB

Shell 0.42% JavaScript 0.25% TypeScript 95.30% Dockerfile 0.15% Solidity 3.86% Procfile 0.02%

beefy-cowllector-v2's Introduction

๐Ÿฎ ๐Ÿง‘โ€๐ŸŒพ Cowllector v2 ๐ŸŒพ

This is the bot that harvest all strategies from all Beefy's chains:

Cowllectors does NOT focus in to be profitable, so don't expect it to win some profit when it harvests. Cowllector harvest script was create it to bring resilience and consistency in all active vaults strategies, giving at least ONE harvest every 24 hour to every strat in every chain

After every run of harvests in every chain, you can find the harvest report in our discord channel #Harvester

๐Ÿ“– Prerequisites

In order to run the project you need node>=20.5, yarn>=1.22, docker with the docker compose v2 and foundry installed on our development machines

๐Ÿ–ฅ๏ธ Local development

To install the application:

yarn

# configure the app
cp .env.example .env

To start the report database:

yarn infra:start
yarn db:migrate

Work on a local fork

# start the fork, copy the generated private key to the .env file
anvil -f 'https://rpc.ankr.com/arbitrum' --accounts 3 --balance 300 --no-cors --block-time 5 --auto-impersonate
# harvest
LOG_LEVEL=debug yarn ts-node ./src/script/harvest.ts -c arbitrum

# Run harvest with pretty log parser (pino-pretty also has many formatting and filtering options)
LOG_LEVEL=trace yarn ts-node ./src/script/harvest.ts -c base | yarn pino-pretty > debug-pretty.log

# see harvest script options
yarn ts-node ./src/script/harvest.ts --help
# unwrap wnative to native
LOG_LEVEL=debug yarn ts-node ./src/script/unwrap.ts -c arbitrum

# see unwrap script options
yarn ts-node ./src/script/unwrap.ts --help

Use our inspect commands

# get the result of our lens contract 
LOG_LEVEL=debug yarn ts-node ./src/script/inspect/lens.ts -c zkevm -a 0x000000...
LOG_LEVEL=debug yarn ts-node ./src/script/inspect/lens.ts --help

# see a contract balance
LOG_LEVEL=debug yarn ts-node ./src/script/inspect/balance.ts -c zkevm -a 0x000000...
LOG_LEVEL=debug yarn ts-node ./src/script/inspect/balance.ts -help

Update the addressbook

yarn run ncu --upgrade blockchain-addressbook
yarn

Run all tests

yarn test

Deploy the lens contract

# get a seed
LOG_LEVEL=fatal node -r ts-node/register ./src/script/deploy/seed.ts -c bsc
LOG_LEVEL=fatal node -r ts-node/register ./src/script/deploy/seed.ts --help

# deploy and verify the lens contract
LOG_LEVEL=trace node -r ts-node/register ./src/script/deploy/deploy-lens.ts -s 0x000000000... -c bsc
LOG_LEVEL=trace node -r ts-node/register ./src/script/deploy/deploy-lens.ts -help

๐Ÿค Contributing

We encourage you to contribute to Cowllector!

We recommend to use this commit convention that helps you write your commits in a way that is easy to understand and process by others.

In case you want to contribute, please follow next steps:

  • fork this repo
  • create a new branch and named using conventional commit reference
  • commit your changes using conventional commit
  • push your change in your forked repo
  • createa a PR from your new branch directly to our master branch

Adding a new chain

  • update the addressbook version: npx ncu --upgrade blockchain-addressbook
  • install the new addressbook: yarn
  • apply migrations (only needed locally, migrations are applied on deploy): yarn db:migrate
  • create an explorer api key (important to verify the lens contract later on)
  • add the rpc url, explorer url and api key in .env
  • Fix TS errors yarn test:ts
  • inspect the final chain config: LOG_LEVEL=error yarn --silent ts-node ./src/script/inspect/config.ts -c <chain>
  • test the api is working: LOG_LEVEL=trace yarn --silent ts-node ./src/script/inspect/api.ts -c <chain> -h 0 > api.log
  • test we can get a contract balance: LOG_LEVEL=trace yarn ts-node ./src/script/inspect/balance.ts -c <chain> -a <some address> > balance.log
  • test any on chain action with a fork: anvil -f <rpc url> --accounts 3 --balance 300 --no-cors --block-time 5 --auto-impersonate
  • Deploy the lens contract: LOG_LEVEL=trace node -r ts-node/register ./src/script/deploy/deploy-lens.ts -s <seed> -c <chain> > deploy-lens.log
    • if the contract verification failed, retry the forge verify-contract command found in deploy-lens.log
    • if that doesn't work, wait for the explorer to detect that this address is a contract, then retry
    • if that doesn't work, go to the explorer and verify manually
      • Grab the standard-json-input content of any other verified lens: FOUNDRY_PROFILE=gas-optimize forge verify-contract --chain-id 2222 --num-of-optimizations 1000000 --verifier blockscout --verifier-url https://explorer.kava.io/api --etherscan-api-key a --watch --show-standard-json-input 0x2fD8E72e488d6D2Bc770Cf6F74A5d60E44516aaD BeefyHarvestLens > compile.json
      • compiler type: standard json input
      • compiler version: see in contracts/out/BeefyHarvestLens.sol/BeefyHarvestLens.json
      • license: MIT
    • if that doesn't work, idk
  • test we can lens a strategy: LOG_LEVEL=trace yarn ts-node ./src/script/inspect/lens.ts -c <chain> -a <strat_address> > lens.log
  • test the harvest script: LOG_LEVEL=trace yarn ts-node ./src/script/revenue-bridge-harvest.ts -c gnosis > revenue.log
  • test the harvest script: LOG_LEVEL=trace yarn ts-node ./src/script/harvest.ts -c <chain> -a <strat_address> > harvest.log
  • test the unwrap script: LOG_LEVEL=trace yarn ts-node ./src/script/unwrap.ts -c gnosis > unwrap.log
  • add a custom rpc url to our heroku deployment _RPC_URL
  • deploy the updated cowllector: yarn deploy

๐Ÿ• Community

  • Got Questions? Join the conversation in our Discord.
  • Want to up to date with Beefy? Follow us in Twitter.

beefy-cowllector-v2's People

Contributors

prevostc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.