Skip to content

Commit

Permalink
refactor: rename ilk list size constraints vars
Browse files Browse the repository at this point in the history
  • Loading branch information
amusingaxl committed Nov 25, 2024
1 parent 728ab24 commit 1e417cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/DssBatchedEmergencySpell.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ interface DssBatchedEmergencySpellLike is DssEmergencySpellLike {
/// @custom:auditors []
/// @custom:bounties []
abstract contract DssBatchedEmergencySpell is DssEmergencySpell, DssBatchedEmergencySpellLike {
/// @dev The min size for the list of ilks
uint256 public constant MIN_ILKS = 2;
/// @dev The max size for the list of ilks
uint256 public constant MAX_ILKS = 3;

/// @dev The total number of ilks in the spell.
uint256 internal immutable _totalIlks;
/// @dev The 0th ilk to which the spell should be applicable.
Expand All @@ -36,10 +41,6 @@ abstract contract DssBatchedEmergencySpell is DssEmergencySpell, DssBatchedEmerg
bytes32 internal immutable _ilk1;
/// @dev The 2nd ilk to which the spell should be applicable.
bytes32 internal immutable _ilk2;
/// @dev The min size for the list of ilks
uint256 internal constant MIN_LIST_SIZE = 2;
/// @dev The max size for the list of ilks
uint256 internal constant MAX_LIST_SIZE = 3;

/// @param _ilks The list of ilks for which the spell should be applicable
/// @dev The list size is be at least 2 and less than or equal to 3.
Expand All @@ -51,8 +52,8 @@ abstract contract DssBatchedEmergencySpell is DssEmergencySpell, DssBatchedEmerg
// This is a workaround to Solidity's lack of support for immutable arrays, as described in
// https://github.com/ethereum/solidity/issues/12587
uint256 len = _ilks.length;
require(len >= MIN_LIST_SIZE, "DssBatchedEmergencySpell/too-few-ilks");
require(len <= MAX_LIST_SIZE, "DssBatchedEmergencySpell/too-many-ilks");
require(len >= MIN_ILKS, "DssBatchedEmergencySpell/too-few-ilks");
require(len <= MAX_ILKS, "DssBatchedEmergencySpell/too-many-ilks");
_totalIlks = len;

_ilk0 = _ilks[0];
Expand Down Expand Up @@ -101,8 +102,7 @@ abstract contract DssBatchedEmergencySpell is DssEmergencySpell, DssBatchedEmerg
}

/// @dev Returns the description prefix to compose the final description.
function _descriptionPrefix() internal virtual view returns (string memory);

function _descriptionPrefix() internal view virtual returns (string memory);

/// @inheritdoc DssEmergencySpell
function _emergencyActions() internal override {
Expand Down Expand Up @@ -133,5 +133,5 @@ abstract contract DssBatchedEmergencySpell is DssEmergencySpell, DssBatchedEmerg
}

/// @notice Returns whether the spell is done or not for the specified ilk.
function _done(bytes32 _ilk) internal virtual view returns (bool);
function _done(bytes32 _ilk) internal view virtual returns (bool);
}
1 change: 1 addition & 0 deletions src/DssBatchedEmergencySpell.t.integration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ contract DssBatchedEmergencySpellImpl is DssBatchedEmergencySpell {
return _isDone[ilk];
}
}

contract DssBatchedEmergencySpellTest is DssTest {
address constant CHAINLOG = 0xdA0Ab1e0017DEbCd72Be8599041a2aa3bA7e740F;
DssInstance dss;
Expand Down
1 change: 0 additions & 1 deletion src/line-wipe/BatchedLineWipeSpell.t.integration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ interface VatLike {
function file(bytes32 ilk, bytes32 what, uint256 data) external;
}


abstract contract BatchedLineWipeSpellTest is DssTest {
using stdStorage for StdStorage;

Expand Down

0 comments on commit 1e417cd

Please sign in to comment.