-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
42 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
pragma circom 2.0.0; | ||
|
||
include "../node_modules/circomlib/circuits/poseidon.circom"; | ||
include "../node_modules/circomlib/circuits/comparators.circom"; | ||
|
||
template VerifiableCommitment() { | ||
signal output credentialId; | ||
|
||
// Public signals | ||
signal input contractId; | ||
signal input nftId; | ||
signal input nftOwner; | ||
signal input deadline; | ||
|
||
// Private signals | ||
signal input babyJubJubPK; | ||
signal input timestamp; | ||
|
||
component computedCredId = Poseidon(5); | ||
computedCredId.inputs[0] <== contractId; | ||
computedCredId.inputs[1] <== nftId; | ||
computedCredId.inputs[2] <== nftOwner; | ||
computedCredId.inputs[3] <== babyJubJubPK; | ||
computedCredId.inputs[4] <== timestamp; | ||
|
||
credentialId <== computedCredId.out; | ||
|
||
component greaterEqThanLowerTime = GreaterEqThan(64); // compare up to 2**64 | ||
greaterEqThanLowerTime.in[0] <== timestamp; | ||
greaterEqThanLowerTime.in[1] <== deadline; | ||
} | ||
|
||
component main { public [contractId, nftId, nftOwner, deadline] } = VerifiableCommitment(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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