feat: add Aerodrome Finance action provider#1038
Open
vijaygopalbalasa wants to merge 1 commit intocoinbase:mainfrom
Open
feat: add Aerodrome Finance action provider#1038vijaygopalbalasa wants to merge 1 commit intocoinbase:mainfrom
vijaygopalbalasa wants to merge 1 commit intocoinbase:mainfrom
Conversation
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.
🟡 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.
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
aerodrome_get_quoteaerodrome_swapLiquidity
aerodrome_add_liquidityquoteAddLiquidityfor slippage)aerodrome_remove_liquidityquoteRemoveLiquidityfor slippage)Governance (veAERO)
aerodrome_create_lockaerodrome_voteaerodrome_increase_amountaerodrome_increase_unlock_timeaerodrome_withdrawRewards
aerodrome_claim_rewardsFiles
Also modified:
typescript/agentkit/src/action-providers/index.ts— added aerodrome exporttypescript/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 rawamountOutMin. The provider callsgetAmountsOut,quoteAddLiquidity, orquoteRemoveLiquidityon-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
getTokenDetailsfromerc20/utils.tsfor efficient batched token info + balance fetching, as suggested in #672 review.veAERO tokenId extraction: Parses the
Depositevent log fromcreateLocktransactions, filtered bylog.address === VOTING_ESCROW_ADDRESS, to return the minted NFT's token ID for use in subsequentvotecalls.Pre-flight safety checks: Every veAERO-mutating action verifies NFT ownership via
ownerOfbefore sending transactions.voteadditionally checks voting power > 0 and epoch status vialastVoted.increaseUnlockTimechecks for expired locks, permanent locks, and the 4-year ceiling.withdrawchecks lock expiry and permanent status.Separate fee/bribe token arrays:
claimRewardstakesfeeTokens(pool underlying tokens) andbribeTokens(protocol incentives) as separate parameters, since fee contracts and bribe contracts hold different tokens.Lock duration math:
increaseUnlockTimecorrectly computestotalDurationFromNow = remainingSeconds + additionalSecondsbecause the VotingEscrow contract interprets_lockDurationas duration fromblock.timestamp, not a delta from the current lock end.Testing
62 tests covering all actions and code paths:
Test plan
pnpm --filter @coinbase/agentkit build— compiles cleanjest --testPathPattern="src/action-providers/aerodrome"— 62/62 passconsole.login source filestypescript/agentkit/README.md(alphabetical order)