Skip to content

Commit

Permalink
fix script error
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Jan 19, 2024
1 parent 68d5036 commit 40d001d
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions contracts/cli/vote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
*/

import { JSONFile } from '../utils/JSONFile'
import { PrivKey, Keypair, createMessage } from '@clrfund/common'
import {
PrivKey,
Keypair,
createMessage,
Message,
PubKey,
} from '@clrfund/common'
import { ethers } from 'hardhat'
import { program } from 'commander'
import dotenv from 'dotenv'
Expand Down Expand Up @@ -47,8 +53,8 @@ async function main(args: any) {
PrivKey.deserialize(contributorData.privKey)
)

const messages: { msgType: any; data: string[] }[] = []
const encPubKeys: any[] = []
const messages: Message[] = []
const encPubKeys: PubKey[] = []
let nonce = 1
// Change key
const newContributorKeypair = new Keypair()
Expand All @@ -62,8 +68,8 @@ async function main(args: any) {
nonce,
pollId
)
messages.push(message.asContractParam())
encPubKeys.push(encPubKey.asContractParam())
messages.push(message)
encPubKeys.push(encPubKey)
nonce += 1
// Vote
for (const recipientIndex of [1, 2]) {
Expand All @@ -78,8 +84,8 @@ async function main(args: any) {
nonce,
pollId
)
messages.push(message.asContractParam())
encPubKeys.push(encPubKey.asContractParam())
messages.push(message)
encPubKeys.push(encPubKey)
nonce += 1
}

Expand All @@ -89,8 +95,8 @@ async function main(args: any) {
contributor
)
await fundingRoundAsContributor.submitMessageBatch(
messages.reverse(),
encPubKeys.reverse()
messages.reverse().map((msg) => msg.asContractParam()),
encPubKeys.reverse().map((key) => key.asContractParam())
)
console.log(`Contributor ${contributorAddress} voted.`)
}
Expand Down

0 comments on commit 40d001d

Please sign in to comment.