Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aave v3.2 Updates #131

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
16 changes: 15 additions & 1 deletion contracts/protocols/mainnet/aave_v3/helpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,21 @@ contract AaveV3Helper is DSMath {
address poolAddressProvider
) external view returns (EmodeData memory eModeData) {
PoolSpecificInfo memory poolInfo = getPoolSpecificInfo(poolAddressProvider);
EModeCategory memory data_ = poolInfo.pool.getEModeCategoryData(id);

EModeCollateralConfig memory config_ = poolInfo.pool.getEModeCategoryCollateralConfig(id);
string memory label = poolInfo.pool.getEModeCategoryLabel(id);
uint128 isCollateralBitmap = poolInfo.pool.getEModeCategoryCollateralBitmap(id);
uint128 isBorrowableBitmap = poolInfo.pool.getEModeCategoryBorrowableBitmap(id);

EModeCategory memory data_ = EModeCategory(
config_.ltv,
config_.liquidationThreshold,
config_.liquidationBonus,
label,
isCollateralBitmap,
isBorrowableBitmap
);

{
eModeData.data = data_;
}
Expand Down
18 changes: 15 additions & 3 deletions contracts/protocols/mainnet/aave_v3/interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ struct EModeCategory {
uint16 liquidationThreshold;
uint16 liquidationBonus;
// each eMode category may or may not have a custom oracle to override the individual assets price oracles
address priceSource;
string label;
uint128 isCollateralBitmap;
uint128 isBorrowableBitmap;
}

struct EModeCollateralConfig {
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
}

struct ReserveConfigurationMap {
Expand Down Expand Up @@ -153,7 +160,8 @@ struct AggregatedReserveData {
uint16 eModeLtv;
uint16 eModeLiquidationThreshold;
uint16 eModeLiquidationBonus;
address eModePriceSource;
uint128 isCollateralBitmap;
uint128 isBorrowableBitmap;
string eModeLabel;
bool borrowableInIsolation;
}
Expand All @@ -173,7 +181,11 @@ interface IPool {
uint256 healthFactor
);

function getEModeCategoryData(uint8 id) external view returns (EModeCategory memory);
// 3.2 Updated Interface for eMode
function getEModeCategoryCollateralConfig(uint8 id) external view returns (EModeCollateralConfig memory);
function getEModeCategoryLabel(uint8 id) external view returns (string memory);
function getEModeCategoryCollateralBitmap(uint8 id) external view returns (uint128);
function getEModeCategoryBorrowableBitmap(uint8 id) external view returns (uint128);

//@return emode id of the user
function getUserEMode(address user) external view returns (uint256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,8 @@ interface IPoolConfigurator {
*/
event UnbackedMintCapChanged(address indexed asset, uint256 oldUnbackedMintCap, uint256 newUnbackedMintCap);

/**
* @dev Emitted when the category of an asset in eMode is changed.
* @param asset The address of the underlying asset of the reserve
* @param oldCategoryId The old eMode asset category
* @param newCategoryId The new eMode asset category
*/
event EModeAssetCategoryChanged(address indexed asset, uint8 oldCategoryId, uint8 newCategoryId);
event AssetCollateralInEModeChanged(address indexed asset, uint8 categoryId, bool collateral);
event AssetBorrowableInEModeChanged(address indexed asset, uint8 categoryId, bool borrowable);

/**
* @dev Emitted when a new eMode category is added.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ interface IReserveInterestRateStrategy {
* @notice Calculates the interest rates depending on the reserve's state and configurations
* @param params The parameters needed to calculate interest rates
* @return liquidityRate The liquidity rate expressed in rays
* @return stableBorrowRate The stable borrow rate expressed in rays
* @return variableBorrowRate The variable borrow rate expressed in rays
*/
function calculateInterestRates(DataTypes.CalculateInterestRatesParams memory params)
external
view
returns (
uint256,
uint256,
uint256
);
Expand Down