Skip to content

Commit

Permalink
Made merkle proof memory & bumped version (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
dovgopoly authored Jun 11, 2024
1 parent d5a01b8 commit 676a5c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions contracts/access/MerkleWhitelisted.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ abstract contract MerkleWhitelisted {

bytes32 private _merkleRoot;

modifier onlyWhitelisted(bytes memory data_, bytes32[] calldata merkleProof_) {
modifier onlyWhitelisted(bytes memory data_, bytes32[] memory merkleProof_) {
require(
isWhitelisted(keccak256(data_), merkleProof_),
"MerkleWhitelisted: not whitelisted"
);
_;
}

modifier onlyWhitelistedUser(address user_, bytes32[] calldata merkleProof_) {
modifier onlyWhitelistedUser(address user_, bytes32[] memory merkleProof_) {
require(isWhitelistedUser(user_, merkleProof_), "MerkleWhitelisted: not whitelisted");
_;
}
Expand All @@ -43,9 +43,9 @@ abstract contract MerkleWhitelisted {
*/
function isWhitelisted(
bytes32 leaf_,
bytes32[] calldata merkleProof_
bytes32[] memory merkleProof_
) public view returns (bool) {
return merkleProof_.verifyCalldata(_merkleRoot, leaf_);
return merkleProof_.verify(_merkleRoot, leaf_);
}

/**
Expand All @@ -56,7 +56,7 @@ abstract contract MerkleWhitelisted {
*/
function isWhitelistedUser(
address user_,
bytes32[] calldata merkleProof_
bytes32[] memory merkleProof_
) public view returns (bool) {
return isWhitelisted(keccak256(abi.encodePacked(user_)), merkleProof_);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solarity/solidity-lib",
"version": "2.7.7",
"version": "2.7.8",
"license": "MIT",
"author": "Distributed Lab",
"readme": "README.md",
Expand Down

0 comments on commit 676a5c7

Please sign in to comment.