Skip to content

[MigrationBundles] Aave v3 migration bundles#30

Open
QGarchery wants to merge 8 commits into
feat-ikrfrom
migration
Open

[MigrationBundles] Aave v3 migration bundles#30
QGarchery wants to merge 8 commits into
feat-ikrfrom
migration

Conversation

@QGarchery

Copy link
Copy Markdown
Collaborator

On top of feat-ikr to not have to duplicate the vault v2 import

contract AaveMigrationBundlesV1 is IAaveMigrationBundlesV1 {
/// EXTERNAL ///
/// @dev Pulls amount of aToken from msg.sender (optionally via ERC-2612 or Permit2), withdraws the whole pulled balance from aaveV3Pool into this contract, then deposits the underlying into vaultV2 for onBehalf.
function aaveMigrationBundlesV1WithdrawAndDepositInVaultV2(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No referral fee on purpose: it seems like it doesn't really make sense to charge a fee for a migration

address onBehalf,
TokenPermit memory aTokenPermit,
uint256 deadline
) external {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't add a prior repay step (which is an action that exists in bundler3), which would allow to repay and withdraw the collateral to deposit on a vault v2. It doesn't seem to make a lot of sense to add it:

  • it would be most useful if we integrate a swap mechanism, but it's not planned atm
  • it would enable to deposit a collateral into a vault v2, which doesn't seem like a big use case

@QGarchery QGarchery changed the title Migration [Migration] Aave v3 migration bundles Jun 29, 2026
@QGarchery QGarchery changed the title [Migration] Aave v3 migration bundles [MigrationBundles] Aave v3 migration bundles Jun 29, 2026
Comment thread src/aave-migration/AaveMigrationBundlesV1.sol
@QGarchery QGarchery marked this pull request as ready for review June 30, 2026 08:15
@QGarchery QGarchery self-assigned this Jun 30, 2026
@QGarchery QGarchery requested a review from MathisGD June 30, 2026 08:15

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth a fork integration test?

require(asset == IAToken(aToken).UNDERLYING_ASSET_ADDRESS(), InconsistentTokens());

TokenLib.pullToken(aToken, msg.sender, amount, aTokenPermit);
uint256 withdrawn = IAaveV3(aaveV3Pool).withdraw(asset, type(uint256).max, address(this));

@QGarchery QGarchery Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not doing slippage check for this withdraw, because withdrawing 1 aTokens give out about 1 underlying:

  • token is rebalancing to account for interest
  • bad debt can be realized, but it's under Umbrella system which only burns it own aToken (so no "price" repercussion to users)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants