@@ -24,27 +24,35 @@ abstract contract MerkleWhitelisted {
2424
2525 modifier onlyWhitelisted (bytes memory data_ , bytes32 [] memory merkleProof_ ) {
2626 require (
27- isWhitelisted (keccak256 (data_), merkleProof_),
27+ _isWhitelisted (keccak256 (data_), merkleProof_),
2828 "MerkleWhitelisted: not whitelisted "
2929 );
3030 _;
3131 }
3232
3333 modifier onlyWhitelistedUser (address user_ , bytes32 [] memory merkleProof_ ) {
34- require (isWhitelistedUser (user_, merkleProof_), "MerkleWhitelisted: not whitelisted " );
34+ require (_isWhitelistedUser (user_, merkleProof_), "MerkleWhitelisted: not whitelisted " );
3535 _;
3636 }
3737
38+ /**
39+ * @notice The function to get the current Merkle root
40+ * @return the current Merkle root or zero bytes if it has not been set
41+ */
42+ function getMerkleRoot () public view returns (bytes32 ) {
43+ return _merkleRoot;
44+ }
45+
3846 /**
3947 * @notice The function to check if the leaf belongs to the Merkle tree
4048 * @param leaf_ the leaf to be checked
4149 * @param merkleProof_ the path from the leaf to the Merkle tree root
4250 * @return true if the leaf belongs to the Merkle tree, false otherwise
4351 */
44- function isWhitelisted (
52+ function _isWhitelisted (
4553 bytes32 leaf_ ,
4654 bytes32 [] memory merkleProof_
47- ) public view returns (bool ) {
55+ ) internal view returns (bool ) {
4856 return merkleProof_.verify (_merkleRoot, leaf_);
4957 }
5058
@@ -54,19 +62,11 @@ abstract contract MerkleWhitelisted {
5462 * @param merkleProof_ the path from the user to the Merkle tree root
5563 * @return true if the user belongs to the Merkle tree, false otherwise
5664 */
57- function isWhitelistedUser (
65+ function _isWhitelistedUser (
5866 address user_ ,
5967 bytes32 [] memory merkleProof_
60- ) public view returns (bool ) {
61- return isWhitelisted (keccak256 (abi.encodePacked (user_)), merkleProof_);
62- }
63-
64- /**
65- * @notice The function to get the current Merkle root
66- * @return the current Merkle root or zero bytes if it has not been set
67- */
68- function getMerkleRoot () public view returns (bytes32 ) {
69- return _merkleRoot;
68+ ) internal view returns (bool ) {
69+ return _isWhitelisted (keccak256 (abi.encodePacked (user_)), merkleProof_);
7070 }
7171
7272 /**
0 commit comments