Giter Club home page Giter Club logo

aave-helpers's Introduction

BGD <> AAVE helpers

This package contains various contracts which allow you to streamline testing within the aave protocol in foundry.

Development

This project uses Foundry. See the book for detailed instructions on how to install and use Foundry.

Some of the tooling relies on external calls via ffi to aave-cli. Therefore you need to install aave-cli locally.

Setup

cp .env.example .env
forge install
yarn

Usage

GovHelpers (deprecated)

These helpers allow you to create and execute proposals on L1 so you don't have to care about having enough proposition power, timings, etc.

GovV3Helpers

These helpers allow the creation of proposal for aave governance v3.

The GovernanceV3Helpers also contain scripts to cast a vote directly via foundry. To do so just run make vote proposalId=n support=true/false.

ProxyHelpers

These helpers allow you to fetch the current implementation & admin for a specified proxy.

BridgeExecutorHelpers

These helpers allow you to simulate execution of proposals on governance controlled Aave V2/V3 pools.

ProtocolV3TestBase

The ProtocolV3TestBase is intended to be used with proposals that alter a V3 pool. While the helpers are libraries, you can use from where ever you want ProtocolV3TestBase is intended to be inherited from in your test via is ProtocolV3TestBase.

When inheriting from ProtocolV3TestBase you have access to methods to create readable configuration snapshots of a pool and e2e tests of a pool.

ProtocolV2TestBase

Analog to ProtocolV3TestBase but for v2 pools.

aave-helpers's People

Contributors

brotherlymite avatar defijesus avatar dependabot[bot] avatar eboadom avatar efecarranza avatar github-actions[bot] avatar kartojal avatar kyzia551 avatar reem avatar rex4539 avatar rozengarden avatar rustboyar avatar sakulstra avatar sendra avatar zer0dot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aave-helpers's Issues

governance helper code check

it has happened multiple times in the past that ppl accidentally create wrong deploy scripts e.g. bgd-labs/aave-proposals#81 (comment) - we usually catch the errors, but a few times it was close.

Wondering if we could improve the helper to check if the referenced address hasCode on the specific chain.
Not sure if so easy, as this would mean the deploy script would factually need to be multichain.

configurationSnapshots v2

solidity is not the best tool for formatting strings and manipulating complex structures
The current form of the reports is not easy to digest as numbers are rays etc. also sometimes you might not be interested in some fields for your specific report.

In the one case where we used the snapshot on an aip we manually formatted it a lot and eventually even let an error slip in: https://github.com/aave/aip/pull/267/files

Therefore i'm wondering if it wouldn't be more rational to not generate the markdown in solidity, but just generate a json and have a seperate more sophisticated cli tool for formatting.

The solidity script would just write a:

{
 reserves: [{symbol: 'DAI', aToken: ...}]
 interestRateStrategies: []
 eModes: []
}

json file and the user/tool could decide on how to represent the values.

Database error when running test suite

Hello! I am trying to run the test suite and I think I did everything in the README but I'm still getting 15 tests failing with the same error.
[FAIL. Reason: backend: failed while inspecting: Database error: failed to get account for 0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326: (code: -32603, message: failed to forward request, data: None)] testListingsCustom() (gas: 0)

I did install aave-cli and copy the .env and also forge and yarn is installed correctly. Is there anything I am missing?

Thank you!

governance executor

createProposal currently assumes to target SHORT_EXECUTOR - which is correct in 99% of cases.
We should add an overload which allows specifying the executor so it covers 100%

Rates strategy factory for Aave v2

Even if no new listings will happen in instances of v2, it is useful to have an equivalent contract to this one https://github.com/bgd-labs/aave-helpers/blob/feat/draft-engine-0.2/src/v3-config-engine/V3RateStrategyFactory.sol, but for Aave v2.

Things to take into account:

Validate that no storage variable added on payload

Using ffi we can run forge inspect contractPath:contractName storageLayout and validate on the defaultTest(), that no storage variable has been added on the payload contract, this is critically dangerous as it would mess with the Executor state otherwise - as the payload is called via delegatecall.

ir verification scripts

forge verify-contract
0x27efe5db315b71753b2a38ed3d5dd7e9362ba93f
--chain-id 137
DefaultReserveInterestRateStrategy
--constructor-args $(cast abi-encode "constructor(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256)"
"0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb"
"00000000000000000000000000000000000000000295be96e640669720000000"
"000000000000000000000000000000000000000000084595161401484a000000"
"0000000000000000000000000000000000000000001f6ed020b26b45e6000000"
"00000000000000000000000000000000000000000295be96e640669720000000"
"0000000000000000000000000000000000000000002116545850052128000000"
"00000000000000000000000000000000000000000295be96e640669720000000"
"00000000000000000000000000000000000000000018d0bf423c03d8de000000"
"000000000000000000000000000000000000000000295be96e64066972000000"
"000000000000000000000000000000000000000000a56fa5b99019a5c8000000")
--watch
--etherscan-api-key

E2E Test Improvements

We've been working on some improvements to the e2e testing to ensure more code is covered and things are tested beyond just execution with sanity checks on various values. We will continue to improve this, but wondering if there is any interest in including this upstream.

Here are 3 PRs we've merged and can open a PR here if desired:

https://github.com/marsfoundation/aave-helpers/pull/10/files
https://github.com/marsfoundation/aave-helpers/pull/11/files
https://github.com/marsfoundation/aave-helpers/pull/12/files

Avoid unnecessary call to `configureReserveAsCollateral`

When all parameters are KEEP_CURRENT, there is no need to 1) get the current collateral values and 2) call configureReserveAsCollateral.
Currently and even if it doesn't hurt, it only creates useless updates with exactly the same values, extra read gas, and overhead of events.

[RFC] Reasonable v3 e2e test suite

While there is a end-to-end test suite included in the helpers, it's not quite reasonable.
Essentially we ported what we had on various v2 tests to v3, not considering how v3 changed.

The current test suite tries to:

  1. supply all assets, 100 each
  2. try to deposit 1M whatever and hope it's enough to variable borrow 10 of everything
  3. same as 2) but with stable borrows

At this time the tests are barely working on any networks, as supply/borrow caps and and even ceilings can prevent these tasks from being performed.

In addition to that there are currently various issues that might make sense for us to look into on foundry side:

I think it makes sense to think about how a reasonable e2e flow could look like and which properties we actually want to test & how to test them.

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.