From ad0f46cbf9c02cfbb8cbac8eb01aaf627e3a69ff Mon Sep 17 00:00:00 2001 From: Paul Geeser Date: Sat, 16 Nov 2024 12:03:49 +0700 Subject: [PATCH 1/3] changes --- packages/foundry/scripts-js/generateTsAbis.js | 2 +- packages/nextjs-app/src/app/page.tsx | 24 ++++++++++++------- .../src/contracts/deployedContracts.ts | 3 ++- packages/nextjs-app/todo.txt | 2 ++ 4 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 packages/nextjs-app/todo.txt diff --git a/packages/foundry/scripts-js/generateTsAbis.js b/packages/foundry/scripts-js/generateTsAbis.js index a1a198b..56f12eb 100644 --- a/packages/foundry/scripts-js/generateTsAbis.js +++ b/packages/foundry/scripts-js/generateTsAbis.js @@ -153,7 +153,7 @@ function main() { writeFileSync( `../nextjs-app/src/contracts/deployedContracts.ts`, format( - `${generatedContractComment} \n\nconst deployedContracts = {${fileContent}} as const;\n`, + `${generatedContractComment} \n\nconst deployedContracts = {${fileContent}};\nexport default deployedContracts;\n`, { parser: "typescript", } diff --git a/packages/nextjs-app/src/app/page.tsx b/packages/nextjs-app/src/app/page.tsx index 7ceedc0..df89c8b 100644 --- a/packages/nextjs-app/src/app/page.tsx +++ b/packages/nextjs-app/src/app/page.tsx @@ -6,7 +6,7 @@ import { Button } from "@nextui-org/button"; import { MiniKit, ResponseEvent } from "@worldcoin/minikit-js"; import { createPublicClient, http, getContract } from "viem"; import { worldchain } from "viem/chains"; -import deployedContracts from "../../../nextjs/contracts/deployedContracts"; +import deployedContracts from "@/contracts/deployedContracts"; const subscribeToWalletAuth = async (nonce: string) => { return new Promise((resolve, reject) => { @@ -43,6 +43,7 @@ const subscribeToWalletAuth = async (nonce: string) => { export default function LoginPage() { const [loading, setLoading] = useState(false); const router = useRouter(); + const onLoginSignup = async () => { setLoading(true); @@ -50,9 +51,11 @@ export default function LoginPage() { chain: worldchain, transport: http("https://worldchain-mainnet.g.alchemy.com/public"), }); - // const contract = getContract({ - // address: deployedContracts[worldchain].HumanOracle.address, - // }) + const HumanOrcale = getContract({ + address: deployedContracts[worldchain].MockHumanOracle.address, + abi: deployedContracts[worldchain].MockHumanOracle.abi, + client + }); // get wallet auth try { @@ -73,10 +76,15 @@ export default function LoginPage() { return; } - // // check if registered? - // try { - - // } + // check if registered? + try { + const result = HumanOrcale.read.isUserRegistered(MiniKit.walletAddress); + console.log(result); + } catch (error) { + console.error(error); + setLoading(false); + return; + } // // if not registered, register // try { diff --git a/packages/nextjs-app/src/contracts/deployedContracts.ts b/packages/nextjs-app/src/contracts/deployedContracts.ts index cddfca7..c0e753d 100644 --- a/packages/nextjs-app/src/contracts/deployedContracts.ts +++ b/packages/nextjs-app/src/contracts/deployedContracts.ts @@ -282,4 +282,5 @@ const deployedContracts = { inheritedFunctions: {}, }, }, -} as const; +}; +export default deployedContracts; diff --git a/packages/nextjs-app/todo.txt b/packages/nextjs-app/todo.txt new file mode 100644 index 0000000..ae32f6e --- /dev/null +++ b/packages/nextjs-app/todo.txt @@ -0,0 +1,2 @@ +- login screen logo in middle with name, signin button at bottom? +- add toasts for errors (from top?) From 7d079efb8ae46839b863e4f2c7998b95b6838718 Mon Sep 17 00:00:00 2001 From: Paul Geeser Date: Sat, 16 Nov 2024 12:52:22 +0700 Subject: [PATCH 2/3] changes --- .../{.eslintrcrrr.json => .eslintrc.json} | 2 +- packages/nextjs-app/src/app/layout.tsx | 2 +- packages/nextjs-app/src/app/page.tsx | 126 +++- .../src/contracts/deployedContracts.ts | 552 +++++++++--------- .../eruda/eruda-provider.tsx | 0 .../{components => providers}/eruda/index.tsx | 0 .../src/providers/erudaProvider.tsx | 0 7 files changed, 377 insertions(+), 305 deletions(-) rename packages/nextjs-app/{.eslintrcrrr.json => .eslintrc.json} (98%) rename packages/nextjs-app/src/{components => providers}/eruda/eruda-provider.tsx (100%) rename packages/nextjs-app/src/{components => providers}/eruda/index.tsx (100%) delete mode 100644 packages/nextjs-app/src/providers/erudaProvider.tsx diff --git a/packages/nextjs-app/.eslintrcrrr.json b/packages/nextjs-app/.eslintrc.json similarity index 98% rename from packages/nextjs-app/.eslintrcrrr.json rename to packages/nextjs-app/.eslintrc.json index e0a84df..38b303b 100644 --- a/packages/nextjs-app/.eslintrcrrr.json +++ b/packages/nextjs-app/.eslintrc.json @@ -26,7 +26,7 @@ } }, "rules": { - "no-console": "warn", + // "no-console": "warn", "react/prop-types": "off", "react/jsx-uses-react": "off", "react/react-in-jsx-scope": "off", diff --git a/packages/nextjs-app/src/app/layout.tsx b/packages/nextjs-app/src/app/layout.tsx index 04e7a94..a03ed44 100644 --- a/packages/nextjs-app/src/app/layout.tsx +++ b/packages/nextjs-app/src/app/layout.tsx @@ -1,7 +1,7 @@ import { Inter } from "next/font/google"; import { NextProviders } from "../providers/nextUiProvider"; import { appConfig } from "@/appConfig"; -import { ErudaProvider } from "@/components/eruda"; +import { ErudaProvider } from "@/providers/eruda"; import { MiniKitProvider } from "@/providers/miniKitProvider"; import "@/styles/globals.css"; import clsx from "clsx"; diff --git a/packages/nextjs-app/src/app/page.tsx b/packages/nextjs-app/src/app/page.tsx index df89c8b..ba41bd3 100644 --- a/packages/nextjs-app/src/app/page.tsx +++ b/packages/nextjs-app/src/app/page.tsx @@ -2,11 +2,18 @@ import { useState } from "react"; import { useRouter } from "next/navigation"; +import deployedContracts from "@/contracts/deployedContracts"; import { Button } from "@nextui-org/button"; -import { MiniKit, ResponseEvent } from "@worldcoin/minikit-js"; -import { createPublicClient, http, getContract } from "viem"; +import { + MiniAppSendTransactionPayload, + MiniAppVerifyActionPayload, + MiniKit, + ResponseEvent, + VerificationLevel, +} from "@worldcoin/minikit-js"; +// import { useWaitForTransactionReceipt } from "@worldcoin/minikit-js/hooks"; +import { createPublicClient, decodeAbiParameters, getContract, hexToBigInt, http, stringToHex } from "viem"; import { worldchain } from "viem/chains"; -import deployedContracts from "@/contracts/deployedContracts"; const subscribeToWalletAuth = async (nonce: string) => { return new Promise((resolve, reject) => { @@ -40,6 +47,33 @@ const subscribeToWalletAuth = async (nonce: string) => { }); }; +const subscribeToTransaction = async (): Promise => { + return new Promise((resolve, reject) => { + MiniKit.subscribe(ResponseEvent.MiniAppSendTransaction, async (payload: MiniAppSendTransactionPayload) => { + if (payload.status === "error") { + console.error("Error sending transaction", payload); + + reject(new Error("Error sending transaction: " + payload.details)); + } else { + resolve(payload.transaction_id); + } + }); + }); +}; + +const subscribeToVerifyAction = async (): Promise => { + return new Promise((resolve, reject) => { + MiniKit.subscribe(ResponseEvent.MiniAppVerifyAction, async (response: MiniAppVerifyActionPayload) => { + if (response.status === "error") { + console.log("Error payload", response); + + return reject(new Error("Error in MiniAppVerifyAction payload")); + } + resolve(response); + }); + }); +}; + export default function LoginPage() { const [loading, setLoading] = useState(false); const router = useRouter(); @@ -47,17 +81,17 @@ export default function LoginPage() { const onLoginSignup = async () => { setLoading(true); - const client = createPublicClient({ - chain: worldchain, - transport: http("https://worldchain-mainnet.g.alchemy.com/public"), - }); - const HumanOrcale = getContract({ - address: deployedContracts[worldchain].MockHumanOracle.address, - abi: deployedContracts[worldchain].MockHumanOracle.abi, - client - }); - - // get wallet auth + const client = createPublicClient({ + chain: worldchain, + transport: http("https://worldchain-mainnet.g.alchemy.com/public"), + }); + const HumanOrcale = getContract({ + address: deployedContracts[worldchain.id].MockHumanOracle.address, + abi: deployedContracts[worldchain.id].MockHumanOracle.abi, + client, + }); + + // get wallet auth try { const res = await fetch(`/api/nonce`); const { nonce } = await res.json(); @@ -68,28 +102,66 @@ export default function LoginPage() { notBefore: new Date(new Date().getTime() - 24 * 60 * 60 * 1000), statement: "Login or create an account", }); + console.log(generateMessageResult); const result = await subscribeToWalletAuth(nonce); + + console.log(result); } catch (error) { console.error(error); setLoading(false); - return; + + return; } - // check if registered? - try { - const result = HumanOrcale.read.isUserRegistered(MiniKit.walletAddress); - console.log(result); - } catch (error) { - console.error(error); - setLoading(false); - return; - } + // check if registered and register if not + try { + const result = await HumanOrcale.read.isUserRegistered(MiniKit.walletAddress); - // // if not registered, register - // try { + console.log(result); + if (result == false) { + const verify = MiniKit.commands.verify({ + action: "registration", + signal: MiniKit.walletAddress!, + verification_level: VerificationLevel.Orb, + }); + const verifyResult = await subscribeToVerifyAction(); - // } + console.log(verify); + const transactionPayload = MiniKit.commands.sendTransaction({ + transaction: [ + { + address: deployedContracts[worldchain.id].MockHumanOracle.address, + abi: deployedContracts[worldchain.id].MockHumanOracle.abi, + functionName: "signUpWithWorldId", + args: [ + hexToBigInt(stringToHex(verifyResult.merkle_root, { size: 32 })), + hexToBigInt(stringToHex(verifyResult.nullifier_hash, { size: 32 })), + decodeAbiParameters([{ type: "uint256[8]" }], verifyResult.proof)[0], + ], + }, + ], + }); + + console.log(transactionPayload); + const transactionId = await subscribeToTransaction(); + + console.log(transactionId); + // useWaitForTransactionReceipt({ + // client: client, + // appConfig: { + // app_id: process.env.NEXT_PUBLIC_APP_ID, + // }, + // transactionId: transactionId, + // }) + } else { + router.replace("/statements"); + } + } catch (error) { + console.error(error); + setLoading(false); + return; + } }; return ( diff --git a/packages/nextjs-app/src/contracts/deployedContracts.ts b/packages/nextjs-app/src/contracts/deployedContracts.ts index c0e753d..421329d 100644 --- a/packages/nextjs-app/src/contracts/deployedContracts.ts +++ b/packages/nextjs-app/src/contracts/deployedContracts.ts @@ -4,283 +4,283 @@ */ const deployedContracts = { - 31337: { - MockHumanOracle: { - address: "0xb19b36b1456e65e3a6d514d3f715f204bd59f431", - abi: [ - { - type: "function", - name: "claimRewardForVote", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", + 31337: { + MockHumanOracle: { + address: "0xb19b36b1456e65e3a6d514d3f715f204bd59f431", + abi: [ + { + type: "function", + name: "claimRewardForVote", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createVote", + inputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "startBlock", + type: "uint256", + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getVotingList", + inputs: [], + outputs: [ + { + name: "ids", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "questions", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStakes", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getVotingPage", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStake", + type: "uint256", + internalType: "uint256", + }, + { + name: "stakePerAnswer", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "isUserRegistered", + inputs: [ + { + name: "userAddr", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "signUpWithWorldId", + inputs: [ + { + name: "nullifierHash", + type: "uint256", + internalType: "uint256", + }, + { + name: "proof", + type: "uint256[8]", + internalType: "uint256[8]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "submitVotingDecisionWithStake", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + internalType: "uint256", + }, + { + name: "stake", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "RewardClaimed", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "rewardAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "UserRegistered", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "nullifierHash", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "createdAtBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteCreated", + inputs: [ + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "question", + type: "string", + indexed: false, + internalType: "string", + }, + { + name: "startBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteSubmitted", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "stakeAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + ], + inheritedFunctions: {}, }, - { - type: "function", - name: "createVote", - inputs: [ - { - name: "question", - type: "string", - internalType: "string", - }, - { - name: "answers", - type: "string[]", - internalType: "string[]", - }, - { - name: "startBlock", - type: "uint256", - internalType: "uint256", - }, - { - name: "durationInBlocks", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "getVotingList", - inputs: [], - outputs: [ - { - name: "ids", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "questions", - type: "string[]", - internalType: "string[]", - }, - { - name: "totalStakes", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "getVotingPage", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "question", - type: "string", - internalType: "string", - }, - { - name: "answers", - type: "string[]", - internalType: "string[]", - }, - { - name: "totalStake", - type: "uint256", - internalType: "uint256", - }, - { - name: "stakePerAnswer", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "isUserRegistered", - inputs: [ - { - name: "userAddr", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "signUpWithWorldId", - inputs: [ - { - name: "nullifierHash", - type: "uint256", - internalType: "uint256", - }, - { - name: "proof", - type: "uint256[8]", - internalType: "uint256[8]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "submitVotingDecisionWithStake", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - { - name: "answerIndex", - type: "uint256", - internalType: "uint256", - }, - { - name: "stake", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "RewardClaimed", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "rewardAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "UserRegistered", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "nullifierHash", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "createdAtBlock", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "VoteCreated", - inputs: [ - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "question", - type: "string", - indexed: false, - internalType: "string", - }, - { - name: "startBlock", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "durationInBlocks", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "VoteSubmitted", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "answerIndex", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "stakeAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - ], - inheritedFunctions: {}, }, - }, }; export default deployedContracts; diff --git a/packages/nextjs-app/src/components/eruda/eruda-provider.tsx b/packages/nextjs-app/src/providers/eruda/eruda-provider.tsx similarity index 100% rename from packages/nextjs-app/src/components/eruda/eruda-provider.tsx rename to packages/nextjs-app/src/providers/eruda/eruda-provider.tsx diff --git a/packages/nextjs-app/src/components/eruda/index.tsx b/packages/nextjs-app/src/providers/eruda/index.tsx similarity index 100% rename from packages/nextjs-app/src/components/eruda/index.tsx rename to packages/nextjs-app/src/providers/eruda/index.tsx diff --git a/packages/nextjs-app/src/providers/erudaProvider.tsx b/packages/nextjs-app/src/providers/erudaProvider.tsx deleted file mode 100644 index e69de29..0000000 From 6561cc853c837f7cd24b6bacccf6a0b46fb77b0b Mon Sep 17 00:00:00 2001 From: Paul Geeser Date: Sat, 16 Nov 2024 12:54:18 +0700 Subject: [PATCH 3/3] fixed merge --- .../src/contracts/deployedContracts.ts | 1397 ++++++++++------- 1 file changed, 829 insertions(+), 568 deletions(-) diff --git a/packages/nextjs-app/src/contracts/deployedContracts.ts b/packages/nextjs-app/src/contracts/deployedContracts.ts index 5764dbe..97e9f0b 100644 --- a/packages/nextjs-app/src/contracts/deployedContracts.ts +++ b/packages/nextjs-app/src/contracts/deployedContracts.ts @@ -4,579 +4,840 @@ */ const deployedContracts = { - 480: { - MockHumanOracle: { - address: "0xae75340eafce2b8b7740b3f731743f35b3c541e5", - abi: [ - { - type: "function", - name: "claimRewardForVote", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", + 480: { + MockHumanOracle: { + address: "0xae75340eafce2b8b7740b3f731743f35b3c541e5", + abi: [ + { + type: "function", + name: "claimRewardForVote", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createVote", + inputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "startBlock", + type: "uint256", + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getVotingList", + inputs: [], + outputs: [ + { + name: "ids", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "questions", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStakes", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getVotingPage", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStake", + type: "uint256", + internalType: "uint256", + }, + { + name: "stakePerAnswer", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "isUserRegistered", + inputs: [ + { + name: "userAddr", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "signUpWithWorldId", + inputs: [ + { + name: "nullifierHash", + type: "uint256", + internalType: "uint256", + }, + { + name: "proof", + type: "uint256[8]", + internalType: "uint256[8]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "submitVotingDecisionWithStake", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + internalType: "uint256", + }, + { + name: "stake", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "RewardClaimed", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "rewardAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "UserRegistered", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "nullifierHash", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "createdAtBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteCreated", + inputs: [ + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "question", + type: "string", + indexed: false, + internalType: "string", + }, + { + name: "startBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteSubmitted", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "stakeAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + ], + inheritedFunctions: {}, }, - { - type: "function", - name: "createVote", - inputs: [ - { - name: "question", - type: "string", - internalType: "string", - }, - { - name: "answers", - type: "string[]", - internalType: "string[]", - }, - { - name: "startBlock", - type: "uint256", - internalType: "uint256", - }, - { - name: "durationInBlocks", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "getVotingList", - inputs: [], - outputs: [ - { - name: "ids", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "questions", - type: "string[]", - internalType: "string[]", - }, - { - name: "totalStakes", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "getVotingPage", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "question", - type: "string", - internalType: "string", - }, - { - name: "answers", - type: "string[]", - internalType: "string[]", - }, - { - name: "totalStake", - type: "uint256", - internalType: "uint256", - }, - { - name: "stakePerAnswer", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "isUserRegistered", - inputs: [ - { - name: "userAddr", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "signUpWithWorldId", - inputs: [ - { - name: "nullifierHash", - type: "uint256", - internalType: "uint256", - }, - { - name: "proof", - type: "uint256[8]", - internalType: "uint256[8]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "submitVotingDecisionWithStake", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - { - name: "answerIndex", - type: "uint256", - internalType: "uint256", - }, - { - name: "stake", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "RewardClaimed", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "rewardAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "UserRegistered", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "nullifierHash", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "createdAtBlock", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "VoteCreated", - inputs: [ - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "question", - type: "string", - indexed: false, - internalType: "string", - }, - { - name: "startBlock", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "durationInBlocks", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "VoteSubmitted", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "answerIndex", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "stakeAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - ], - inheritedFunctions: {}, }, - }, - 4801: { - MockHumanOracle: { - address: "0xae75340eafce2b8b7740b3f731743f35b3c541e5", - abi: [ - { - type: "function", - name: "claimRewardForVote", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "createVote", - inputs: [ - { - name: "question", - type: "string", - internalType: "string", - }, - { - name: "answers", - type: "string[]", - internalType: "string[]", - }, - { - name: "startBlock", - type: "uint256", - internalType: "uint256", - }, - { - name: "durationInBlocks", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", + 4801: { + MockHumanOracle: { + address: "0xae75340eafce2b8b7740b3f731743f35b3c541e5", + abi: [ + { + type: "function", + name: "claimRewardForVote", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createVote", + inputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "startBlock", + type: "uint256", + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getVotingList", + inputs: [], + outputs: [ + { + name: "ids", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "questions", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStakes", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getVotingPage", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStake", + type: "uint256", + internalType: "uint256", + }, + { + name: "stakePerAnswer", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "isUserRegistered", + inputs: [ + { + name: "userAddr", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "signUpWithWorldId", + inputs: [ + { + name: "nullifierHash", + type: "uint256", + internalType: "uint256", + }, + { + name: "proof", + type: "uint256[8]", + internalType: "uint256[8]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "submitVotingDecisionWithStake", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + internalType: "uint256", + }, + { + name: "stake", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "RewardClaimed", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "rewardAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "UserRegistered", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "nullifierHash", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "createdAtBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteCreated", + inputs: [ + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "question", + type: "string", + indexed: false, + internalType: "string", + }, + { + name: "startBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteSubmitted", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "stakeAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + ], + inheritedFunctions: {}, }, - { - type: "function", - name: "getVotingList", - inputs: [], - outputs: [ - { - name: "ids", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "questions", - type: "string[]", - internalType: "string[]", - }, - { - name: "totalStakes", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "getVotingPage", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "question", - type: "string", - internalType: "string", - }, - { - name: "answers", - type: "string[]", - internalType: "string[]", - }, - { - name: "totalStake", - type: "uint256", - internalType: "uint256", - }, - { - name: "stakePerAnswer", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "isUserRegistered", - inputs: [ - { - name: "userAddr", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "pure", - }, - { - type: "function", - name: "signUpWithWorldId", - inputs: [ - { - name: "nullifierHash", - type: "uint256", - internalType: "uint256", - }, - { - name: "proof", - type: "uint256[8]", - internalType: "uint256[8]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "submitVotingDecisionWithStake", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - { - name: "answerIndex", - type: "uint256", - internalType: "uint256", - }, - { - name: "stake", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "event", - name: "RewardClaimed", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "rewardAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "UserRegistered", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "nullifierHash", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "createdAtBlock", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "VoteCreated", - inputs: [ - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "question", - type: "string", - indexed: false, - internalType: "string", - }, - { - name: "startBlock", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "durationInBlocks", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "VoteSubmitted", - inputs: [ - { - name: "user", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "voteId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "answerIndex", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "stakeAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - ], - inheritedFunctions: {}, }, - }, - 31337: { - MockHumanOracle: { - address: "0xb19b36b1456e65e3a6d514d3f715f204bd59f431", - abi: [ - { - type: "function", - name: "claimRewardForVote", - inputs: [ - { - name: "voteId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", + 31337: { + MockHumanOracle: { + address: "0xae75340eafce2b8b7740b3f731743f35b3c541e5", + abi: [ + { + type: "function", + name: "claimRewardForVote", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createVote", + inputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "startBlock", + type: "uint256", + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getVotingList", + inputs: [], + outputs: [ + { + name: "ids", + type: "uint256[]", + internalType: "uint256[]", + }, + { + name: "questions", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStakes", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "getVotingPage", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "question", + type: "string", + internalType: "string", + }, + { + name: "answers", + type: "string[]", + internalType: "string[]", + }, + { + name: "totalStake", + type: "uint256", + internalType: "uint256", + }, + { + name: "stakePerAnswer", + type: "uint256[]", + internalType: "uint256[]", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "isUserRegistered", + inputs: [ + { + name: "userAddr", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "pure", + }, + { + type: "function", + name: "signUpWithWorldId", + inputs: [ + { + name: "nullifierHash", + type: "uint256", + internalType: "uint256", + }, + { + name: "proof", + type: "uint256[8]", + internalType: "uint256[8]", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "submitVotingDecisionWithStake", + inputs: [ + { + name: "voteId", + type: "uint256", + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + internalType: "uint256", + }, + { + name: "stake", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "RewardClaimed", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "rewardAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "UserRegistered", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "nullifierHash", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "createdAtBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteCreated", + inputs: [ + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "question", + type: "string", + indexed: false, + internalType: "string", + }, + { + name: "startBlock", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "durationInBlocks", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "VoteSubmitted", + inputs: [ + { + name: "user", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "voteId", + type: "uint256", + indexed: true, + internalType: "uint256", + }, + { + name: "answerIndex", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "stakeAmount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + ], + inheritedFunctions: {}, }, }, }; + export default deployedContracts;