yearn / yearn/yearn-devdocs

Add Automatic Contract Checks to V2 Vaults

Open
#555 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
90
Forks
92
Avg merge
1h 6m
Merged PRs (30d)
2

Description

We already have automatic checks for V3 vaults that confirm the registries and other key contracts. We also have checks for the veYFI gauges. It would be beneficial to extend these checks to also confirm V2 contract addresses are correct.

Flow for the existing checks:

  • In the /scripts folder there is a script called runAddressChecks that checks contracts pulled from RPC calls against a constants file with contract addresses. This script is run on every dev run (yarn start). https://github.com/yearn/yearn-devdocs/tree/master/scripts
  • The constants.ts file is located in /src/ethereum and contains important addresses and info. This is where V2 vault registry contracts would live. See the addresses here: https://docs.yearn.fi/developers/addresses/v2-contracts and here: https://docs.yearn.fi/developers/wallet-integration#getting-v2-yvaults-manually
    • Vault Registry
    • Release registry
    • Health Check
    • Factory Contract
      Unlike V3, these are not the same for all chains, so they need to be added per chain. Ignore Fantom, as it is dead.
  • There are v3Calls.ts and v3Checks.ts files in /src/ethereum which can be used as a reference for the flow for the V2 calls and checks. The calls file makes RPC calls to get the addresses from registry contracts and ENS names. The checks file then compares those against the constants file.
  • The scripts file will then need to be updated to accept the V2 checks.

To be considered:

  • There isn't much to check since most v2 registries don't have ENS names and don't come from other contracts. So maybe this isn't super useful? or maybe It would be good to give all these registries ENS names that can be resolved, and if the registries change then we also change the ENS.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with /scripts/runAddressChecks and trace the existing flow through src/ethereum/v3Calls.ts and v3Checks.ts. Add the V2 registry calls and checks, per-chain addresses in src/ethereum/constants.ts, and update the script to run them while excluding Fantom. Verify the checks run through yarn start.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, testing-qa, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.