mirror of
https://github.com/social-tw/social-tw-website.git
synced 2026-01-08 23:18:05 -05:00
Sample Unirep Project
This project demonstrates a basic Unirep application. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
Try running some of the following tasks:
Compile
yarn build
Test
Running All Tests
yarn test
Running Single Test File
SignupAndPost
yarn contracts test ./test/SignupAndPost.test.ts
Comment
yarn contracts test ./test/Comment.test.ts
Deploy to local hardhat network
yarn hardhat node
and
yarn deploy
Contract Explanation
variables
- latestPostId: A global variable to record the latest post ID.
mappings
- postCommentIndex:
- postId
uint256=> commentIduint256 - To maintain & record the comment id for each post
- postId
- epochKeyCommentMap a 2-layer mapping:
- epochKey
uint256=> ( postIduint256=> commentIduint256) - To store the epoch key for each post-comment pair
- epochKey
- proofNullifier
- proof
bytes32=>bool - To check if the same proof is used before.
- proof
- userRegistry
- userId
uint256=>bool - To check if same user id is used before.
- userId