MerkleProofWrapper.sol 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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[] memory proofs,
  27. bool[] memory proofFlag,
  28. bytes32 root,
  29. bytes32[] memory leaves
  30. ) public pure returns (bool) {
  31. return MerkleProof.multiProofVerify(proofs, proofFlag, root, leaves);
  32. }
  33. function multiProofVerifyCalldata(
  34. bytes32[] calldata proofs,
  35. bool[] calldata proofFlag,
  36. bytes32 root,
  37. bytes32[] memory leaves
  38. ) public pure returns (bool) {
  39. return MerkleProof.multiProofVerifyCalldata(proofs, proofFlag, root, leaves);
  40. }
  41. function processMultiProof(
  42. bytes32[] memory proofs,
  43. bool[] memory proofFlag,
  44. bytes32[] memory leaves
  45. ) public pure returns (bytes32) {
  46. return MerkleProof.processMultiProof(proofs, proofFlag, leaves);
  47. }
  48. function processMultiProofCalldata(
  49. bytes32[] calldata proofs,
  50. bool[] calldata proofFlag,
  51. bytes32[] memory leaves
  52. ) public pure returns (bytes32) {
  53. return MerkleProof.processMultiProofCalldata(proofs, proofFlag, leaves);
  54. }
  55. }