feat: add Aave V3 action provider (supply/withdraw)#1378
Open
Stakemate369 wants to merge 1 commit into
Open
Conversation
Adds AaveActionProvider for supplying/withdrawing ERC-20 reserves on the Aave V3 Pool contract (Base mainnet + Base Sepolia). Closes coinbase#323. A previous attempt at this (coinbase#326) stalled and was closed because it pulled in @aave/contract-helpers, which depends on ethers-v5 — inconsistent with AgentKit's viem-based wallet providers. This version talks to the Pool contract directly via a minimal ABI (supply/withdraw only), the same pattern already used by the built-in Morpho and Compound action providers, so it adds zero new dependencies. - constants.ts: Pool proxy addresses (sourced from bgd-labs/aave-address-book, cross-checked against BaseScan) + minimal IPool ABI - schemas.ts: Zod schemas for supply/withdraw - aaveActionProvider.ts: supply/withdraw actions, decimals read dynamically via the standard ERC-20 abi (viem's erc20Abi), matching the Morpho provider - 13 unit tests covering success paths, zero-amount rejection, unsupported network, approval failure, and transaction errors Verified: pnpm build, pnpm lint (scoped), and pnpm test all pass clean for this package.
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
AaveActionProviderfor supplying/withdrawing ERC-20 reserves on the Aave V3Poolcontract, on Base mainnet and Base Sepolia. Closes #323.A previous attempt at this (#326) got closed without merging — the reviewer's main concern was that it pulled in
@aave/contract-helpers, which depends onethers-v5, inconsistent with the rest of AgentKit'sviem-based wallet providers (see the PR review and the follow-up discussion on #323).This version talks to the
Poolcontract directly via a minimal ABI (onlysupply/withdraw) usingviem— the same pattern the built-inMorphoActionProviderandCompoundActionProvideralready use — so it adds zero new dependencies.What's included
constants.ts— Aave V3 Pool proxy addresses per network (sourced frombgd-labs/aave-address-book, cross-checked against BaseScan's verified "Aave: Pool Proxy Base" contract) + a minimalIPoolABIschemas.ts— Zod schemas forsupply/withdrawaaveActionProvider.ts—supplyandwithdrawactions; decimals are read dynamically from the asset's own ERC-20 contract (viaviem'serc20Abi) rather than hardcoded, so any Aave V3 reserve is supported, not just USDCaaveActionProvider.test.ts— 13 unit tests: successful supply/withdraw, zero-amount rejection, unsupported network, approval failure, transaction errorsREADME.mdfor the new provider folderaction-providers/index.tsScope
This initial version covers ERC-20 reserves only (no native ETH via
WETHGateway) — keeping the surface area minimal and directly verifiable against the standardIPoolinterface. Happy to extend it in a follow-up if there's interest.Test plan
pnpm build— cleanpnpm lint(scoped tosrc/action-providers/aave) — cleanpnpm test(scoped tosrc/action-providers/aave) — 13/13 passingIPool.supply/IPool.withdrawABI) has been exercised against Base mainnet with real funds in a separate project, so the contract interaction itself is field-tested, not just unit-tested against a mock.