-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84a085a
commit 234d05d
Showing
5 changed files
with
202 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
/* | ||
A contract for wrapping prover. | ||
Contributors: | ||
- sonicskye | ||
*/ | ||
|
||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.13; | ||
|
||
import {MerkleProof} from '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol'; | ||
|
||
contract Prover { | ||
pragma solidity ^0.8.0; | ||
|
||
function prove(bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] calldata leaves) public pure returns(bool) { | ||
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; | ||
|
||
return MerkleProof.multiProofVerifyCalldata(proof, proofFlags, root, leaves); | ||
/** | ||
* @notice Wrapper library for proving Merkle MultiProofs. | ||
* @author sonicskye. | ||
*/ | ||
library Prover { | ||
/** | ||
* @notice Verifies the validity of a Merkle MultiProof. | ||
* @dev Uses OpenZeppelin's `multiProofVerifyCalldata` to validate a multiproof. | ||
* @param proof The array of sibling hashes that help prove the inclusion of the leaves. | ||
* @param flag A boolean array that indicates whether each node is from the proof or hashes. | ||
* @param root Root hash of the Merkle tree. | ||
* @param leaves Leaf nodes that are being proved to be part of the Merkle tree. | ||
* @return A boolean value indicating whether the proof is valid or not. | ||
*/ | ||
function prove(bytes32[] calldata proof, bool[] calldata flag, bytes32 root, bytes32[] calldata leaves) | ||
public | ||
pure | ||
returns (bool) | ||
{ | ||
return MerkleProof.multiProofVerifyCalldata(proof, flag, root, leaves); | ||
} | ||
} | ||
} |
Oops, something went wrong.