Changes from v1 to v2
Aave v2 improves many aspects over v1, opening up a vast new design space for developers to build products and services.
If you previously built on Aave v1, the following changes should be noted.
In Aave v2, all positions are tokenised. Therefore to calculate the debt that a user has, you just need to call
balanceOf()for the associated debt token of that user.
In Aave v2, there is no more
LendingPoolCorecontract that holds all the protocol's assets. Asset's are held directly in the associated aToken contracts, with the
LendingPoolbeing the 'core' contract of the protocol.
In Aave v2, to ensure consistency throughout the protocol we now use WETH (instead of ETH and a placeholder
reservevalue as was done in v1). Therefore to call a function using the ETH as an asset, use the WETH address.
There is also a WETH helper contract that will help with wrapping/unwrapping ETH, when used within the protocol.
In Aave v2, nearly all actions should be performed via the
LendingPoolcontract. This is different from v1, where a redeem/withdraw of an aTokens needed to be called on the aToken contract.
In the initial release of Aave v2, interest redirection is not supported. However it is possible that the feature is added back later, via the governance process.
When a user has deposited collateral in the protocol, they can easily delegate credit to any address by calling
approveDelegation()on the relevant debt token.
In Aave v2, flash loans are possible within the protocol itself. In fact, they are used extensively within the protocol for position swapping and other 'trading' like features.
Flash loans can now be performed in batches, i.e. multiple flash loans with different parameters in the same call. This will allow powerful new use cases, such as paying back multiple assets and positions with one flash loan transaction.
You can now perform a mix of 'traditional' flash loans, which are paid back immediately, along with flash loans where a debt is incurred (i.e. the flash loan isn't paid back immediately).
With multiple markets, there will be multiple
AddressesProviderRegistrywill maintain a registry of all the Aave market addresses providers.
LendingPoolCoreis no longer used. Only
LendingPoolis used, which simplifies integrations and building on Aave v2.