MerkleProofWrapper.sol 1.8 KB

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