Skip to content

Commit

Permalink
Merge pull request #32 from violetprotocol/fix/HAL-04
Browse files Browse the repository at this point in the history
[HAL-04] Some indexes are not using an adequate data type
  • Loading branch information
0xpApaSmURf authored Jan 9, 2024
2 parents b460b11 + 56dacbb commit c0f6ee4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions contracts/StatusMap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract StatusMap {
/**
* @dev Sets the bit at `index` to the boolean `value` for the account `account`.
*/
function _overwriteStatusTo(address account, uint256 index, bool value) internal {
function _overwriteStatusTo(address account, uint8 index, bool value) internal {
if (value) {
_assignStatus(account, index);
} else {
Expand All @@ -52,7 +52,7 @@ contract StatusMap {
/**
* @dev Sets the bit at `index` to 1 for the account `account`.
*/
function _assignStatus(address account, uint256 index) internal {
function _assignStatus(address account, uint8 index) internal {
uint256 mask = 1 << (index);
statusesByAccount[account] |= mask;
}
Expand All @@ -67,7 +67,7 @@ contract StatusMap {
/**
* @dev Sets the bit at `index` to 0 for the account `account`.
*/
function _unassignStatus(address account, uint256 index) internal {
function _unassignStatus(address account, uint8 index) internal {
uint256 mask = 1 << index;
statusesByAccount[account] &= ~mask;
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/mock/MockStatusMap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ contract MockStatusMap is StatusMap {
return _areStatusesSet(account, mask);
}

function overwriteStatusTo(address account, uint256 index, bool value) public {
function overwriteStatusTo(address account, uint8 index, bool value) public {
_overwriteStatusTo(account, index, value);
}

function assignMultipleStatuses(address account, uint256 indicesMask) public {
_assignMultipleStatuses(account, indicesMask);
}

function assignStatus(address account, uint256 index) public {
function assignStatus(address account, uint8 index) public {
_assignStatus(account, index);
}

function unassignStatus(address account, uint256 index) public {
function unassignStatus(address account, uint8 index) public {
_unassignStatus(account, index);
}
}

0 comments on commit c0f6ee4

Please sign in to comment.