|
1 |
| -/** |
2 |
| - * TODO: |
3 |
| - * The goal is to automatically decrypt each encrypted voteID previously cast as encrypted commitments, and cast them as votes. |
4 |
| - * - modify shutter.ts encrypt() to return {encryptedCommitment, identity} |
5 |
| - * - implement shutterAutoVote.ts that: |
6 |
| - * - provides a castCommit() function which |
7 |
| - * - calls shutter.ts encrypt() with the message "disputeId␟voteId␟choice␟justification" with `U+241F` as separator |
8 |
| - * - calls the DisputeKitShutterPoC.castCommit() function with the encryptedCommitment, voteId, choice and justification |
9 |
| - * - retrieve the DisputeKitShutterPoC.CommitCast event and log its parameters |
10 |
| - * - provides an autoVote() function which |
11 |
| - * - runs continuously as a loop, waking up every 30 seconds |
12 |
| - * - upon wake up, retrieve the details of the previously encrypted messages (and corresponding identities) which have not yet been decrypted and have been encrypted for more than shutter.ts `DECRYPTION_DELAY`. |
13 |
| - * - for each of these messages, call shutter.ts decrypt() with the identity and the encryptedCommitment |
14 |
| - * - if the decryption is successful, call the DisputeKitShutterPoC.castVote() function with the voteId, choice and justification |
15 |
| - * - if the decryption is not successful, log an error |
16 |
| - * - if the castVote() function was called, retrieve the DisputeKitShutterPoC.VoteCast event and log its parameters |
17 |
| - * - shutterAutoVote.ts needs to know: |
18 |
| - * - the _voteIDs: they start from 0 and go up to DisputeKitShutterPoC.maxVoteIDs() |
19 |
| - * - the _coreDisputeID: just use 0 for now. |
20 |
| - **/ |
21 |
| - |
22 |
| -import { createPublicClient, createWalletClient, http, Hex, decodeEventLog, getContract } from "viem"; |
| 1 | +import { createPublicClient, createWalletClient, http, Hex, getContract } from "viem"; |
23 | 2 | import { privateKeyToAccount } from "viem/accounts";
|
24 | 3 | import { hardhat } from "viem/chains";
|
25 | 4 | import { encrypt, decrypt, DECRYPTION_DELAY } from "./shutter";
|
|
0 commit comments