test: added requirements in update premium functions of configurator

This commit is contained in:
Hadrien Charlanes 2021-06-22 12:25:13 +02:00
parent 7e6565fed4
commit 22bbb96261
2 changed files with 18 additions and 0 deletions
contracts/protocol
lendingpool
libraries/helpers

View File

@ -514,6 +514,14 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
override
onlyPoolAdmin
{
require(
flashloanPremiumTotal < PercentageMath.PERCENTAGE_FACTOR,
Errors.LPC_FLASHLOAN_PREMIUM_INVALID
);
require(
flashloanPremiumTotal >= _pool.FLASHLOAN_PREMIUM_TO_PROTOCOL(),
Errors.LPC_FLASHLOAN_PREMIUMS_MISMATCH
);
_pool.updateFlashloanPremiums(flashloanPremiumTotal, _pool.FLASHLOAN_PREMIUM_TO_PROTOCOL());
emit FlashloanPremiumTotalUpdated(flashloanPremiumTotal);
}
@ -524,6 +532,14 @@ contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigur
override
onlyPoolAdmin
{
require(
flashloanPremiumToProtocol < PercentageMath.PERCENTAGE_FACTOR,
Errors.LPC_FLASHLOAN_PREMIUM_INVALID
);
require(
flashloanPremiumToProtocol <= _pool.FLASHLOAN_PREMIUM_TOTAL(),
Errors.LPC_FLASHLOAN_PREMIUMS_MISMATCH
);
_pool.updateFlashloanPremiums(_pool.FLASHLOAN_PREMIUM_TOTAL(), flashloanPremiumToProtocol);
emit FlashloanPremiumToProcolUpdated(flashloanPremiumToProtocol);
}

View File

@ -113,6 +113,8 @@ library Errors {
string public constant RL_STABLE_DEBT_NOT_ZERO = '89';
string public constant RL_VARIABLE_DEBT_SUPPLY_NOT_ZERO = '90';
string public constant LP_CALLER_NOT_EOA = '91';
string public constant LPC_FLASHLOAN_PREMIUMS_MISMATCH = '95';
string public constant LPC_FLASHLOAN_PREMIUM_INVALID = '96';
enum CollateralManagerErrors {
NO_ERROR,