Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

Check Aave V3 upgrade 3.0.1 #260

Open pedrovalido opened 1 year ago

pedrovalido commented 1 year ago

Aave has updated to 3.0.1. Link to Aave's PR is here https://github.com/aave/aave-v3-core/pull/701 This PR has to be checked to see if the changes will have impact in Fuji's integration

pedrovalido commented 1 year ago

Interfaces we are using :

On IV3Pool, the function getReserveData(address asset) we are using has an added comment (WARNING) regarding this function's utility

    * @dev WARNING: This function is intended to be used primarily by the protocol itself to get a
    * "dynamic" variable index based on time, current stored index and virtual rate at the current
    * moment (approx. a borrower would get if opening a position). This means that is always used in
    * combination with variable debt supply/balances.
    * If using this function externally, consider that is possible to have an increasing normalized
    * variable debt that is not equivalent to how the variable debt index would be updated in storage
    * (e.g. only updates with non-zero variable debt supply)

They've also added a new function

   /**
    * @notice Returns the user data in a reserve
    * @param asset The address of the underlying asset of the reserve
    * @param user The address of the user
    * @return currentATokenBalance The current AToken balance of the user
    * @return currentStableDebt The current stable debt of the user
    * @return currentVariableDebt The current variable debt of the user
    * @return principalStableDebt The principal stable debt of the user
    * @return scaledVariableDebt The scaled variable debt of the user
    * @return stableBorrowRate The stable borrow rate of the user
    * @return liquidityRate The liquidity rate of the reserve
    * @return stableRateLastUpdated The timestamp of the last update of the user stable rate
    * @return usageAsCollateralEnabled True if the user is using the asset as collateral, false
    *         otherwise
    */
   function getUserReserveData(address asset, address user)
     external
     view
     returns (
       uint256 currentATokenBalance,
       uint256 currentStableDebt,
       uint256 currentVariableDebt,
       uint256 principalStableDebt,
       uint256 scaledVariableDebt,
       uint256 stableBorrowRate,
       uint256 liquidityRate,
       uint40 stableRateLastUpdated,
       bool usageAsCollateralEnabled
     );

which will probably be beneficial for us to use of the user specific deposit and borrow balance (instead of using the getReserveData that is how it is being done currently)

Image

On another topic, some changes on the IV3Pool may also apply to the flasherAaveV3

/**
    * @notice Returns whether the reserve has FlashLoans enabled or disabled
    * @param asset The address of the underlying asset of the reserve
    * @return True if FlashLoans are enabled, false otherwise
    */
   function getFlashLoanEnabled(address asset) external view returns (bool);

This is a function that returns true/false wether the flashloan for a given asset is currently enabled or not which might be useful to check when choosing the flasher who will rebalance a position

pedrovalido commented 1 year ago

Also asked on Aave telegram if they have a defined date on the upgrade to 3.0.1 and it was a bit unclear when they're going to do so

Image

pedrovalido commented 1 year ago

While running some tests noticed the tests that were passing before, are now failing due to reason 51 Note to self: check the docs on whats new - https://docs.aave.com/developers/whats-new/