Skip to content

Commit

Permalink
fix: Add percentage range check of liquidationFee in Configurator
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Jan 4, 2022
1 parent 1358948 commit 2d5330b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions contracts/mocks/helpers/MockReserveConfiguration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ contract MockReserveConfiguration {
return configuration.getSupplyCap();
}

function setLiquidationProtocolFee(uint256 liquidationProtocolFee) external {
DataTypes.ReserveConfigurationMap memory config = configuration;
config.setLiquidationProtocolFee(liquidationProtocolFee);
configuration = config;
}

function getLiquidationProtocolFee() external view returns (uint256) {
return configuration.getLiquidationProtocolFee();
}

function setUnbackedMintCap(uint256 unbackedMintCap) external {
DataTypes.ReserveConfigurationMap memory config = configuration;
config.setUnbackedMintCap(unbackedMintCap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ library ReserveConfiguration {
uint256 internal constant MAX_VALID_RESERVE_FACTOR = 65535;
uint256 internal constant MAX_VALID_BORROW_CAP = 68719476735;
uint256 internal constant MAX_VALID_SUPPLY_CAP = 68719476735;
uint256 internal constant MAX_VALID_LIQUIDATION_PROTOCOL_FEE = 10000;
uint256 internal constant MAX_VALID_LIQUIDATION_PROTOCOL_FEE = 65535;
uint256 internal constant MAX_VALID_EMODE_CATEGORY = 255;
uint256 internal constant MAX_VALID_UNBACKED_MINT_CAP = 68719476735;
uint256 internal constant MAX_VALID_DEBT_CEILING = 1099511627775;
Expand Down
4 changes: 1 addition & 3 deletions contracts/protocol/pool/PoolConfigurator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,10 @@ contract PoolConfigurator is VersionedInitializable, IPoolConfigurator {
override
onlyRiskOrPoolAdmins
{
require(fee <= PercentageMath.PERCENTAGE_FACTOR, Errors.INVALID_LIQUIDATION_PROTOCOL_FEE);
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);

currentConfig.setLiquidationProtocolFee(fee);

_pool.setConfiguration(asset, currentConfig);

emit LiquidationProtocolFeeChanged(asset, fee);
}

Expand Down

0 comments on commit 2d5330b

Please sign in to comment.