Deposit into pTokens
Depositing AeroSTETH_ETHPToken
When depositing into the AeroSTETH_ETHPToken, you're providing Aerodrome stETH-ETH LP tokens that will automatically earn yields through Aerodrome. Here's how to do it:
First, check the user's balance and ensure they have enough LP tokens:
const lpToken = new ethers.Contract(ADDRESSES.STETH_ETH_LP, ERC20_ABI, provider);
const balance = await lpToken.balanceOf(userAddress);
const depositAmount = ethers.utils.parseEther("10"); // 10 LP tokens
if (balance.lt(depositAmount)) {
throw new Error("Insufficient LP token balance");
}
Then approve and make the deposit by calling deposit()
in the pToken contract, or depositAsCollateral()
to both deposit and post as collateral all in one transaction.
Function arguments when:
calling deposit():
uint256
assets
The amount of underlying assets to deposit.
address
receiver
The account that should receive the pToken shares.
calling depositAsCollateral():
uint256
assets
The amount of underlying assets to deposit.
uint256
receiver
The account that should receive the pToken shares.
// Approve the pToken to spend LP tokens
await lpToken.approve(ADDRESSES.AERO_STETH_ETH_PTOKEN, depositAmount);
// Get the pToken contract
const pToken = new ethers.Contract(
ADDRESSES.AERO_STETH_ETH_PTOKEN,
PTOKEN_ABI,
signer
);
// Deposit as collateral or regular deposit
if (asCollateral) {
await pToken.depositAsCollateral(depositAmount);
} else {
await pToken.deposit(depositAmount, userAddress);
}
Alternatively, if your app requires users depositing for another address, you can use depositAsCollateralFor()
.
What Happens Behind the Scenes
When you deposit LP tokens into this yield-optimized pToken:
Your Aerodrome stETH-ETH LP tokens are transferred to the pToken contract.
The pToken automatically stakes these LP tokens in Aerodrome.
The staked position begins earning AERO rewards.
When harvested, these rewards are swapped to ETH and STETH and then deposited into to the Aerodrome pool to mint new LP tokens, which are then staked back in Aerodrome gauge.
This increases the total assets of the pToken, vesting until the next harvest, benefiting all depositors proportionally.
Last updated