New aLEND to aAAVE migrator with active debt.
Working on allowing migration when aLEND > available AAVE liquidity on Uniswap. (1 address)
The above is now fixed through the use of multiple transactions.
- Have any amount of aAAVE deposited to enable collateralization. (Make sure it's enabled!)
- Make sure you have enough AAVE to cover the Uniswap flash swap fee (call the "CalculateNeededAave" function, it returns both the AAVE to be flash swapped AND the fee amount you must have in your wallet. When aLEND > available AAVE liquidity (This should not be the case, as the only address to which this applies has migrated.), the fee is the amount for only the next tx.)
- Approve the contract for aLEND and AAVE spending.
- Finally, just call the "MigrateALend" function and the migration will proceed automatically. For aLEND > AAVE liquidity on Uniswap, you will need to call it multiple times.
The code is unaudited. It is recommended to use a tool like this or your favorite token allowance checker to revoke allowances after a successful migration. This is also good practice in general!