Closed github-actions[bot] closed 1 year ago
Jeiwan
medium
Pool deployment reverts if the interest rate is the minimal or the maximal one.
PoolDeployer defines the minimal and maximal interest rates as follows:
uint256 public constant MIN_RATE = 0.01 * 1e18; uint256 public constant MAX_RATE = 0.1 * 1e18;
However, trying to deploy a pool with MIN_RATE or MAX_RATE will always revert due to this check in the checkDeploy modifier:
MIN_RATE
MAX_RATE
if (MIN_RATE >= interestRate_ || interestRate_ >= MAX_RATE) revert IPoolFactory.PoolInterestRateInvalid();
Users cannot deploy pools with the minimal or the maximal interest rate.
PoolDeployer.sol#L13-L14 PoolDeployer.sol#L41
Manual Review
Consider this change:
diff --git a/contracts/src/base/PoolDeployer.sol b/contracts/src/base/PoolDeployer.sol index ffb433a..948c60a 100644 --- a/contracts/src/base/PoolDeployer.sol +++ b/contracts/src/base/PoolDeployer.sol @@ -38,7 +38,7 @@ abstract contract PoolDeployer { modifier canDeploy(bytes32 subsetHash_, address collateral_, address quote_, uint256 interestRate_) { if (collateral_ == address(0) || quote_ == address(0)) revert IPoolFactory.DeployWithZeroAddress(); if (deployedPools[subsetHash_][collateral_][quote_] != address(0)) revert IPoolFactory.PoolAlreadyExists(); - if (MIN_RATE >= interestRate_ || interestRate_ >= MAX_RATE) revert IPoolFactory.PoolInterestRateInvalid(); + if (MIN_RATE > interestRate_ || interestRate_ > MAX_RATE) revert IPoolFactory.PoolInterestRateInvalid(); _; }
Jeiwan
medium
Pools cannot be deployed with the interest rate set to the minimal or the maximal value
Summary
Pool deployment reverts if the interest rate is the minimal or the maximal one.
Vulnerability Detail
PoolDeployer defines the minimal and maximal interest rates as follows:
However, trying to deploy a pool with
MIN_RATE
orMAX_RATE
will always revert due to this check in the checkDeploy modifier:Impact
Users cannot deploy pools with the minimal or the maximal interest rate.
Code Snippet
PoolDeployer.sol#L13-L14 PoolDeployer.sol#L41
Tool used
Manual Review
Recommendation
Consider this change: