MerkleProofWrapper.sol 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/cryptography/MerkleProof.sol";
  4. contract MerkleProofWrapper {
  5. function verify(
  6. bytes32[] memory proof,
  7. bytes32 root,
  8. bytes32 leaf
  9. ) public pure returns (bool) {
  10. return MerkleProof.verify(proof, root, leaf);
  11. }
  12. function verifyCalldata(
  13. bytes32[] calldata proof,
  14. bytes32 root,
  15. bytes32 leaf
  16. ) public pure returns (bool) {
  17. return MerkleProof.verifyCalldata(proof, root, leaf);
  18. }
  19. function processProof(bytes32[] memory proof, bytes32 leaf) public pure returns (bytes32) {
  20. return MerkleProof.processProof(proof, leaf);
  21. }
  22. function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) public pure returns (bytes32) {
  23. return MerkleProof.processProofCalldata(proof, leaf);
  24. }
  25. function multiProofVerify(
  26. bytes32[] calldata proofs,
  27. bool[] calldata proofFlag,
  28. bytes32 root,
  29. bytes32[] calldata leaves
  30. ) public pure returns (bool) {
  31. return MerkleProof.multiProofVerify(proofs, proofFlag, root, leaves);
  32. }
  33. function processMultiProof(
  34. bytes32[] calldata proofs,
  35. bool[] calldata proofFlag,
  36. bytes32[] calldata leaves
  37. ) public pure returns (bytes32) {
  38. return MerkleProof.processMultiProof(proofs, proofFlag, leaves);
  39. }
  40. }