Aerodrome LP Operations

Manage Aerodrome DEX liquidity positions directly from within your DegenPrime Smart Loan. Add liquidity, stake in gauges, and claim AERO rewards.

Overview

The AerodromeFacet allows Smart Loans to interact with Aerodrome, the leading DEX on Base chain. LP positions held within the loan count toward your collateral value, enabling leveraged yield farming.

Leveraged LP: Because you can borrow up to 8x your collateral, you can create leveraged Aerodrome LP positions. Be mindful of impermanent loss and health ratio impacts.

Adding Liquidity

Provide liquidity to an Aerodrome pool using assets held within your Smart Loan. The facet handles the token approvals internally.

typescript
import { WrapperBuilder } from "@redstone-finance/evm-connector";

const poolAddress = "0x..."; // Aerodrome pool address
const amount0 = parseEther("1");       // 1 WETH
const amount1 = 2000n * 10n ** 6n;     // 2000 USDC

// Wrap with RedStone (solvency check after LP)
const wrappedContract = WrapperBuilder
  .wrap(contract)
  .usingDataService({
    dataServiceId: "redstone-arbitrum-prod",
    uniqueSignersCount: 3,
  });

await wrappedContract.addLiquidityAerodrome(
  poolAddress,
  amount0,
  amount1,
);

Removing Liquidity

Remove liquidity to get the underlying tokens back in your Smart Loan. The returned tokens become available as collateral.

typescript
// Check current LP balance
const lpBalance = await contract.getOwnedAerodromeLpBalance(poolAddress);

// Remove all liquidity
await wrappedContract.removeLiquidityAerodrome(
  poolAddress,
  lpBalance,
);

// Or remove partial
const halfBalance = lpBalance / 2n;
await wrappedContract.removeLiquidityAerodrome(
  poolAddress,
  halfBalance,
);

Staking in Gauges

After adding liquidity, you can stake LP tokens in Aerodrome gauges to earn AERO emission rewards. Staked positions still count as collateral in your Smart Loan.

typescript
const gaugeAddress = "0x..."; // Aerodrome gauge address

// Get LP token balance
const lpBalance = await contract.getOwnedAerodromeLpBalance(poolAddress);

// Stake in gauge
await wrappedContract.stakeInAerodromeGauge(
  gaugeAddress,
  lpBalance,
);

// AERO rewards accrue automatically and can be claimed
// via the staked positions management functions

Rebalancing Strategy

  1. 1Monitor your LP position via getOwnedAerodromeLpBalance() and getStakedPositions()
  2. 2If the pool ratio has shifted significantly, remove liquidity
  3. 3Use paraSwap() to rebalance token ratios within the loan
  4. 4Re-add liquidity with the optimized token ratio