@@ -13,62 +13,76 @@ import {
13
13
verifyContractInstanceDeployment ,
14
14
} from "./utils/index.js" ;
15
15
16
+ const contractId = "VotingContract" ;
17
+
16
18
export async function run ( ) {
17
- logger . info ( " ===== VOTING CONTRACT =====" ) ;
19
+ logger . info ( ` ===== ${ contractId } =====` ) ;
18
20
const pxe = getPxe ( ) ;
19
21
await waitForPXE ( pxe ) ;
20
22
const namedWallets = getWallets ( ) ;
21
23
22
24
const deployerWallet = namedWallets . alice ;
23
25
const votingAdmin = namedWallets . alice . getAddress ( ) ;
24
26
25
- const contractLoggingName = "Voting Contract" ;
27
+ const contractLoggingName = contractId ;
26
28
const contract = await deployContract ( {
27
29
contractLoggingName,
28
30
deployFn : ( ) : DeploySentTx < EasyPrivateVotingContract > =>
29
31
EasyPrivateVotingContract . deploy ( deployerWallet , votingAdmin ) . send ( ) ,
30
- broadcastWithWallet : deployerWallet , // NOTE: comment this out to not broadcast
32
+ // broadcastWithWallet: deployerWallet, // NOTE: comment this out to not broadcast
31
33
node : getAztecNodeClient ( ) ,
32
34
} ) ;
33
35
registerContractClassArtifact (
34
36
contractLoggingName ,
35
37
contractArtifactJson ,
36
38
contract . instance . contractClassId . toString ( ) ,
37
- contract . instance . version
39
+ contract . instance . version ,
38
40
) . catch ( ( err ) => {
39
41
logger . error (
40
- `Failed to register contract class artifact: ${ ( err as Error ) . stack } `
42
+ `Failed to register contract class artifact: ${ ( err as Error ) . stack } ` ,
41
43
) ;
42
44
} ) ;
43
45
44
46
verifyContractInstanceDeployment ( {
45
47
contractLoggingName,
46
- artifactObj : contractArtifactJson ,
47
48
contractInstanceAddress : contract . address . toString ( ) ,
48
- publicKeysString : contract . instance . publicKeys . toString ( ) ,
49
- deployer : contract . instance . deployer . toString ( ) ,
50
- salt : contract . instance . salt . toString ( ) ,
51
- args : [ votingAdmin . toString ( ) ]
49
+ verifyArgs : {
50
+ artifactObj : contractArtifactJson ,
51
+ publicKeysString : contract . instance . publicKeys . toString ( ) ,
52
+ deployer : contract . instance . deployer . toString ( ) ,
53
+ salt : contract . instance . salt . toString ( ) ,
54
+ constructorArgs : [ votingAdmin . toString ( ) ] ,
55
+ } ,
56
+ deployerMetadata : {
57
+ contractIdentifier : contractId ,
58
+ details : "Easy private voting contract" ,
59
+ creatorName : "Event Cannon" ,
60
+ creatorContact :
61
+ "email: [email protected] , discord: test#1234, telegram: @test" ,
62
+ appUrl : "https://aztec.network" ,
63
+ repoUrl : "https://github.com/AztecProtocol/aztec-packages" ,
64
+ reviewedAt : new Date ( ) ,
65
+ } ,
52
66
} ) . catch ( ( err ) => {
53
67
logger . error (
54
- `Failed to verify contract instance deployment: ${ ( err as Error ) . stack } `
68
+ `Failed to verify contract instance deployment: ${ ( err as Error ) . stack } ` ,
55
69
) ;
56
70
} ) ;
57
71
58
72
const votingContractAlice = await Contract . at (
59
73
contract . address ,
60
74
EasyPrivateVotingContractArtifact ,
61
- namedWallets . alice
75
+ namedWallets . alice ,
62
76
) ;
63
77
const votingContractBob = await Contract . at (
64
78
contract . address ,
65
79
EasyPrivateVotingContractArtifact ,
66
- namedWallets . bob
80
+ namedWallets . bob ,
67
81
) ;
68
82
const votingContractCharlie = await Contract . at (
69
83
contract . address ,
70
84
EasyPrivateVotingContractArtifact ,
71
- namedWallets . charlie
85
+ namedWallets . charlie ,
72
86
) ;
73
87
74
88
const candidateA = new Fr ( 1 ) ;
@@ -77,15 +91,15 @@ export async function run() {
77
91
await Promise . all ( [
78
92
logAndWaitForTx (
79
93
votingContractAlice . methods . cast_vote ( candidateA ) . send ( ) ,
80
- "Cast vote 1 - candidate A"
94
+ "Cast vote 1 - candidate A" ,
81
95
) ,
82
96
logAndWaitForTx (
83
97
votingContractBob . methods . cast_vote ( candidateA ) . send ( ) ,
84
- "Cast vote 2 - candidate A"
98
+ "Cast vote 2 - candidate A" ,
85
99
) ,
86
100
await logAndWaitForTx (
87
101
votingContractCharlie . methods . cast_vote ( candidateB ) . send ( ) ,
88
- "Cast vote 3 - candidate B"
102
+ "Cast vote 3 - candidate B" ,
89
103
) ,
90
104
] ) ;
91
105
0 commit comments