Skip to content

Commit

Permalink
refactor: use uint256 for reentrancyStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
skimaharvey committed Oct 2, 2023
1 parent 91fcc47 commit b597a32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export const ERC1271_VALUES = {
*/
export const LSP20_MAGIC_VALUES = {
VERIFY_CALL: {
// bytes3(keccak256("lsp20VerifyCall(address,uint256,bytes)")) + "0x01"
WITH_POST_VERIFICATION: '0x1a238001',
// bytes3(keccak256("lsp20VerifyCall(address,uint256,bytes)")) + "0x00"
// bytes3(keccak256("lsp20VerifyCall(address,address,uint256,bytes)")) + "0x00"
NO_POST_VERIFICATION: '0x1a238000',
// bytes3(keccak256("lsp20VerifyCall(address,address,uint256,bytes)")) + "0x01"
WITH_POST_VERIFICATION: '0x1a238001',
},
// bytes4(keccak256("lsp20VerifyCallResult(bytes32,bytes)"))
VERIFY_CALL_RESULT: '0xd3fc45d3',
Expand Down
20 changes: 10 additions & 10 deletions contracts/LSP6KeyManager/LSP6KeyManagerCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ abstract contract LSP6KeyManagerCore is

// Variables, methods and modifier used for ReentrancyGuard are taken from the link below and modified accordingly.
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.8/contracts/security/ReentrancyGuard.sol
mapping(address => uint8) internal _reentrancyStatus;
uint8 internal constant _NOT_ENTERED = 1;
uint8 internal constant _ENTERED = 2;
mapping(address => uint256) internal _reentrancyStatus;
uint256 internal constant _NOT_ENTERED = 1;
uint256 internal constant _ENTERED = 2;

/**
* @inheritdoc ILSP6
Expand Down Expand Up @@ -536,6 +536,13 @@ abstract contract LSP6KeyManagerCore is
bytes32 permissions = ERC725Y(targetContract).getPermissionsFor(from);
if (permissions == bytes32(0)) revert NoPermissionsSet(from);

if (isRelayedCall) {
LSP6ExecuteRelayCallModule._verifyExecuteRelayCallPermission(
from,
permissions
);
}

bytes4 erc725Function = bytes4(payload);

// ERC725Y.setData(bytes32,bytes)
Expand Down Expand Up @@ -595,13 +602,6 @@ abstract contract LSP6KeyManagerCore is
} else {
revert InvalidERC725Function(erc725Function);
}

if (isRelayedCall) {
LSP6ExecuteRelayCallModule._verifyExecuteRelayCallPermission(
from,
permissions
);
}
}

/**
Expand Down

0 comments on commit b597a32

Please sign in to comment.