Skip to content

Commit

Permalink
Merge pull request #11 from hollow-leaf/feat/addEvmVoteContract
Browse files Browse the repository at this point in the history
Feat/add evm vote contract
  • Loading branch information
yeeetai authored Aug 22, 2023
2 parents d7a6973 + ac2d7be commit 38dd97d
Show file tree
Hide file tree
Showing 15 changed files with 785 additions and 24 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ yarn-error.log*
dist/
artifacts/
.env
temp
temp

#zk-circuits
typechain/
26 changes: 26 additions & 0 deletions packages/evm-contracts-api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "evm-contracts-api",
"version": "0.0.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"export": {
".": "./dist"
},
"scripts": {
"build": "tsup src/index.ts --format cjs --dts",
"dev": "npm run build -- --watch"
},
"dependencies": {
"tsconfig": "workspace:*"
},
"devDependencies": {
"tsconfig": "workspace:*",
"ethers": "^5.7.0",
"typescript": "^5.0.4",
"tsup": "^6.1.3"
},
"publishConfig": {
"access": "public"
}
}

Empty file.
347 changes: 347 additions & 0 deletions packages/evm-contracts-api/src/kamui/ABI.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,347 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_verifierAddress",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "proposal",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bool",
"name": "accept",
"type": "bool"
}
],
"name": "Voted",
"type": "event"
},
{
"inputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "uint256",
"name": "continueSec",
"type": "uint256"
}
],
"name": "createProposals",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getBlockTime",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "proposal",
"type": "uint256"
}
],
"name": "getResult",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "proposals",
"outputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "address",
"name": "creater",
"type": "address"
},
{
"internalType": "uint256",
"name": "acceptCount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "denyCount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "endTime",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "uint256",
"name": "proof",
"type": "uint256"
}
],
"name": "registerUser",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "totalProposals",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "users",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "verifier",
"outputs": [
{
"internalType": "contract ICircuitsVerifier",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint256[2]",
"name": "a",
"type": "uint256[2]"
},
{
"internalType": "uint256[2][2]",
"name": "b",
"type": "uint256[2][2]"
},
{
"internalType": "uint256[2]",
"name": "c",
"type": "uint256[2]"
}
],
"internalType": "struct KamuiField.ProofData",
"name": "proofData",
"type": "tuple"
}
],
"name": "verifyProof",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "proposal",
"type": "uint256"
},
{
"internalType": "bool",
"name": "accept",
"type": "bool"
},
{
"components": [
{
"internalType": "uint256[2]",
"name": "a",
"type": "uint256[2]"
},
{
"internalType": "uint256[2][2]",
"name": "b",
"type": "uint256[2][2]"
},
{
"internalType": "uint256[2]",
"name": "c",
"type": "uint256[2]"
}
],
"internalType": "struct KamuiField.ProofData",
"name": "proofData",
"type": "tuple"
}
],
"name": "vote",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "voters",
"outputs": [
{
"internalType": "bool",
"name": "voted",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
]
8 changes: 8 additions & 0 deletions packages/evm-contracts-api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "tsconfig/base.json",
"compilerOptions": {
"target": "ESNext",
},
"include": [ "**/*.ts"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit 38dd97d

Please sign in to comment.