Skip to content

feat: add Aerodrome Finance action provider#1038

Open
vijaygopalbalasa wants to merge 1 commit intocoinbase:mainfrom
vijaygopalbalasa:feat/aerodrome-action-provider
Open

feat: add Aerodrome Finance action provider#1038
vijaygopalbalasa wants to merge 1 commit intocoinbase:mainfrom
vijaygopalbalasa:feat/aerodrome-action-provider

Conversation

@vijaygopalbalasa
Copy link

Overview

Adds an Aerodrome Finance action provider for Base mainnet — the #1 DEX on Base by TVL (~$400M+, ~56% of Base trading volume). Covers the full user flow: trading, liquidity provision, veAERO governance locking, voting, lock management, and reward claiming.

Actions (10)

Trading

Action Description
aerodrome_get_quote Get a swap quote for a token pair (read-only)
aerodrome_swap Swap tokens with slippage protection via on-chain quote

Liquidity

Action Description
aerodrome_add_liquidity Add liquidity to a pool (uses quoteAddLiquidity for slippage)
aerodrome_remove_liquidity Remove liquidity (uses quoteRemoveLiquidity for slippage)

Governance (veAERO)

Action Description
aerodrome_create_lock Lock AERO tokens to create a veAERO NFT
aerodrome_vote Vote with veAERO NFT to direct pool emissions
aerodrome_increase_amount Add more AERO to an existing lock
aerodrome_increase_unlock_time Extend lock duration
aerodrome_withdraw Withdraw AERO from an expired lock

Rewards

Action Description
aerodrome_claim_rewards Claim trading fees and bribes (separate token arrays)

Files

typescript/agentkit/src/action-providers/aerodrome/
├── aerodromeActionProvider.ts       # 10 actions, ~940 lines
├── aerodromeActionProvider.test.ts  # 62 tests, ~770 lines
├── constants.ts                     # ABIs (Router, VotingEscrow, Voter) + addresses
├── schemas.ts                       # Zod schemas with validation + descriptions
├── index.ts                         # Barrel export
└── README.md                        # Documentation

Also modified:

  • typescript/agentkit/src/action-providers/index.ts — added aerodrome export
  • typescript/agentkit/README.md — added Aerodrome to Action Providers list (alphabetical)

Key Design Decisions

Slippage protection: All swap and liquidity actions use slippageBps (default 1%, max 10%) instead of raw amountOutMin. The provider calls getAmountsOut, quoteAddLiquidity, or quoteRemoveLiquidity on-chain to get expected amounts, then applies the slippage tolerance. This is what @phdargen suggested in the review of #672.

Token details via multicall: Reuses getTokenDetails from erc20/utils.ts for efficient batched token info + balance fetching, as suggested in #672 review.

veAERO tokenId extraction: Parses the Deposit event log from createLock transactions, filtered by log.address === VOTING_ESCROW_ADDRESS, to return the minted NFT's token ID for use in subsequent vote calls.

Pre-flight safety checks: Every veAERO-mutating action verifies NFT ownership via ownerOf before sending transactions. vote additionally checks voting power > 0 and epoch status via lastVoted. increaseUnlockTime checks for expired locks, permanent locks, and the 4-year ceiling. withdraw checks lock expiry and permanent status.

Separate fee/bribe token arrays: claimRewards takes feeTokens (pool underlying tokens) and bribeTokens (protocol incentives) as separate parameters, since fee contracts and bribe contracts hold different tokens.

Lock duration math: increaseUnlockTime correctly computes totalDurationFromNow = remainingSeconds + additionalSeconds because the VotingEscrow contract interprets _lockDuration as duration from block.timestamp, not a delta from the current lock end.

Testing

62 tests covering all actions and code paths:

getQuote:            5 tests (success, stable pool, zero output, null tokens, RPC error)
swap:                6 tests (success, null tokens, insufficient balance, zero output, approval fail, tx error)
addLiquidity:        7 tests (success, null tokens, insufficient A, insufficient B, approval A fail, approval B fail, tx error)
removeLiquidity:     5 tests (success, null LP, insufficient LP, approval fail, tx error)
createLock:          7 tests (success with log parsing, empty logs, wrong address filter, null AERO, insufficient balance, approval fail, tx error)
vote:                8 tests (success, multi-pool weights, not owner, zero power, already voted, previous epoch allowed, second pool no gauge, tx error)
increaseAmount:      4 tests (success, not owner, insufficient balance, approval fail)
increaseUnlockTime:  5 tests (success, not owner, permanent lock, expired lock, exceeds 4yr max)
withdraw:            5 tests (success, not owner, not expired, permanent, tx error)
claimRewards:        6 tests (success, fees fail/bribes pass, fees pass/bribes fail, both fail, not owner, no gauge)
supportsNetwork:     4 tests (base-mainnet, base-sepolia, ethereum, non-EVM)

Test plan

  • pnpm --filter @coinbase/agentkit build — compiles clean
  • jest --testPathPattern="src/action-providers/aerodrome" — 62/62 pass
  • Zero console.log in source files
  • All 22 ABI entries verified against deployed Aerodrome contracts on BaseScan
  • All 5 contract addresses verified active on Base mainnet (March 2026)
  • README entry added to typescript/agentkit/README.md (alphabetical order)
  • CI pipeline validation

Adds a complete Aerodrome Finance integration for Base mainnet with
10 actions covering trading, liquidity, veAERO governance, and rewards.

Actions:
- aerodrome_get_quote: swap quote (read-only)
- aerodrome_swap: token swap with slippage protection
- aerodrome_add_liquidity: LP deposit with quoteAddLiquidity
- aerodrome_remove_liquidity: LP withdrawal with quoteRemoveLiquidity
- aerodrome_create_lock: lock AERO -> veAERO NFT (extracts tokenId from logs)
- aerodrome_vote: vote on pool emissions (ownership + epoch checks)
- aerodrome_increase_amount: add AERO to existing lock
- aerodrome_increase_unlock_time: extend lock duration
- aerodrome_withdraw: withdraw from expired lock
- aerodrome_claim_rewards: claim fees + bribes (separate token arrays)

Design:
- Slippage-based swap/LP (default 1%, max 10%) via on-chain quotes
- Reuses getTokenDetails from erc20/utils for multicall efficiency
- Pre-flight checks: NFT ownership, voting power, epoch status,
  lock expiry, permanent lock, 4-year ceiling
- Deposit event log parsing filtered by contract address
- 62 tests covering all code paths

Resolves WISHLIST.md items: Aerodrome veAERO lock, liquidity pool voting.
@cb-heimdall
Copy link

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@github-actions github-actions bot added documentation Improvements or additions to documentation action provider New action provider typescript labels Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider documentation Improvements or additions to documentation typescript

Development

Successfully merging this pull request may close these issues.

2 participants