mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Merge branch 'fix/135' into 'master'
Resolve "Add a validation that liq threshold <= 100%-liq bonus on configureReserveAsCollateral()" Closes #135 See merge request aave-tech/protocol-v2!155
This commit is contained in:
commit
1be6b5fbc9
|
@ -388,11 +388,14 @@ contract LendingPoolConfigurator is VersionedInitializable {
|
||||||
|
|
||||||
if (liquidationThreshold != 0) {
|
if (liquidationThreshold != 0) {
|
||||||
//liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
|
//liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
|
||||||
//collateral than needed to cover the debt
|
//collateral than needed to cover the debt.
|
||||||
require(
|
uint256 absoluteBonus = liquidationBonus.sub(PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION);
|
||||||
liquidationBonus > PercentageMath.PERCENTAGE_FACTOR,
|
require(absoluteBonus > 0, Errors.LPC_INVALID_CONFIGURATION);
|
||||||
Errors.LPC_INVALID_CONFIGURATION
|
|
||||||
);
|
//we also need to require that the liq threshold is lower or equal than the liquidation bonus, to ensure that
|
||||||
|
//there is always enough margin for liquidators to receive the bonus.
|
||||||
|
require(liquidationThreshold.add(absoluteBonus) <= PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION);
|
require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION);
|
||||||
//if the liquidation threshold is being set to 0,
|
//if the liquidation threshold is being set to 0,
|
||||||
|
|
|
@ -1285,4 +1285,4 @@
|
||||||
"address": "0xaDF23b1cAa6a7B3b077c432794FfF80A4b935cdF"
|
"address": "0xaDF23b1cAa6a7B3b077c432794FfF80A4b935cdF"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user