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

Feat/isolation mode #120

Merged
merged 8 commits into from
Sep 29, 2021
Merged

Feat/isolation mode #120

merged 8 commits into from
Sep 29, 2021

Conversation

The-3D
Copy link
Contributor

@The-3D The-3D commented Sep 28, 2021

No description provided.

@@ -111,11 +144,46 @@ library UserConfiguration {
}

/**
* @notice Validate a user has not been using any reserve
* @notice Checks if a user has not been using any reserve for borrowing or supply
* @param self The configuration object
* @return True if the user has been borrowing any reserve, false otherwise
Copy link
Contributor

Choose a reason for hiding this comment

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

has not been

@The-3D The-3D merged commit 50b0fdf into master Sep 29, 2021

/**
* @notice Sets the debt ceiling for an asset
* @param ceiling The new debt ceiling
Copy link
Contributor

Choose a reason for hiding this comment

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

doc for asset param is missing

uint256
)
{
if (!isUsingAsCollateralAny(self)) {
Copy link
Contributor

@miguelmtzinf miguelmtzinf Sep 30, 2021

Choose a reason for hiding this comment

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

think we can remove this case

@@ -114,6 +125,12 @@ library BorrowLogic {
userConfig.setBorrowing(reserve.id, true);
}

if (isolationModeActive) {
reserves[isolationModeCollateralAddress].isolationModeTotalDebt += Helpers.castUint128(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think its better to store the amount of coins, for better precision and to be aligned with reserve.unbacked

uint128 isolationModeTotalDebt = reserves[isolationModeCollateralAddress]
.isolationModeTotalDebt;
// since the debt ceiling does not take into account the interest accrued, it might happen that amount repaid > debt in isolation mode
if (isolationModeTotalDebt < paybackAmount) {
Copy link
Contributor

Choose a reason for hiding this comment

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

paybackAmount with incorrect decimals


require(
reservesData[params.isolationModeCollateralAddress].isolationModeTotalDebt +
params.amount <=
Copy link
Contributor

Choose a reason for hiding this comment

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

amount with incorrect decimals

@@ -53,6 +55,7 @@ library ReserveConfiguration {
uint256 constant MAX_VALID_LIQUIDATION_PROTOCOL_FEE = 10000;
uint256 constant MAX_VALID_EMODE_CATEGORY = 255;
uint256 constant MAX_VALID_UNBACKED_MINT_CAP = 68719476735;
uint256 constant MAX_VALID_DEBT_CEILING = 4294967296;
Copy link
Contributor

@stevenvaleri stevenvaleri Sep 30, 2021

Choose a reason for hiding this comment

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

Need to subtract one from this value I think.
4294967295

if (!isolationModeActive) {
userConfig.setUsingAsCollateral(reserve.id, true);
emit ReserveUsedAsCollateralEnabled(params.asset, params.onBehalfOf);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is the first supply of the isolation mode asset, I think it needs to be set as usingAsCollateral and emit an event (could be the same, or specific to IsolationModeCollateral)

@The-3D The-3D deleted the feat/isolation-mode branch October 5, 2021 11:51
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.

3 participants