chore: rename ZkGroups to Bandada in code and filenames

This commit is contained in:
Saleel
2023-03-24 08:36:22 +05:30
parent 13b08e728e
commit f1fb022643
38 changed files with 277 additions and 277 deletions

View File

@@ -193,8 +193,8 @@ It will also automatically check that the modified files comply with ESLint and
### Database
ZKGroups require a SQL database to work, which is used by the `api` application.
ZKGroups can work with Postgres and SQLite. Other SQL flavors should work but are not tested.
Bandada require a SQL database to work, which is used by the `api` application.
Bandada can work with Postgres and SQLite. Other SQL flavors should work but are not tested.
You can pass the connection URL to the database using environment variable (see below).
### Testing
@@ -233,7 +233,7 @@ This is the same first account generated by hardhat network as well.
Deploy the contracts to the local network using the below command:
```sh
yarn workspace contracts deploy:zkgroups-semaphore --network local
yarn workspace contracts deploy:bandada-semaphore --network local
```
The addresses of contracts deployed in a fresh local network would be:
@@ -241,8 +241,8 @@ The addresses of contracts deployed in a fresh local network would be:
```sh
Pairing library has been deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
SemaphoreVerifier contract has been deployed to: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
ZKGroups contract has been deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
ZKGroupsSemaphore contract has been deployed to: 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
Bandada contract has been deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
BandadaSemaphore contract has been deployed to: 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
```
These values are set as defaults in `libs/utils/src/contract-addresses.ts`. If you change the contract and deploy again, new address need to be set here.

View File

@@ -9,7 +9,7 @@ import { GroupsService } from "./groups.service"
jest.mock("@zk-groups/utils", () => ({
__esModule: true,
getZKGroupsContract: () => ({
getBandadaContract: () => ({
updateGroups: jest.fn(() => ({
status: true,
logs: ["1"]
@@ -159,7 +159,7 @@ describe("GroupsService", () => {
expect(
// @ts-ignore
groupsService.zkGroupsContract.updateGroups
groupsService.bandadaContract.updateGroups
).toHaveBeenCalled()
})

View File

@@ -11,9 +11,9 @@ import {
import { InjectRepository } from "@nestjs/typeorm"
import { Group as CachedGroup } from "@semaphore-protocol/group"
import {
getZKGroupsContract,
getBandadaContract,
Network,
ZKGroupsContract
BandadaContract
} from "@zk-groups/utils"
import { Repository } from "typeorm"
import { InvitesService } from "../invites/invites.service"
@@ -27,7 +27,7 @@ import { MerkleProof } from "./types"
@Injectable()
export class GroupsService {
private cachedGroups: Map<string, CachedGroup>
private zkGroupsContract: ZKGroupsContract
private bandadaContract: BandadaContract
constructor(
@InjectRepository(Group)
@@ -36,7 +36,7 @@ export class GroupsService {
private readonly invitesService: InvitesService
) {
this.cachedGroups = new Map()
this.zkGroupsContract = getZKGroupsContract(
this.bandadaContract = getBandadaContract(
process.env.ETHEREUM_NETWORK as Network,
process.env.BACKEND_PRIVATE_KEY as string,
process.env.INFURA_API_KEY as string
@@ -294,7 +294,7 @@ export class GroupsService {
private async updateContractGroups(
updatedGroup: CachedGroup
): Promise<void> {
const tx = await this.zkGroupsContract.updateGroups([
const tx = await this.bandadaContract.updateGroups([
{
id: BigInt(updatedGroup.id),
fingerprint: BigInt(updatedGroup.root)

View File

@@ -9,7 +9,7 @@ import { InvitesService } from "./invites.service"
jest.mock("@zk-groups/utils", () => ({
__esModule: true,
getZKGroupsContract: () => ({
getBandadaContract: () => ({
updateGroups: jest.fn(() => ({
status: true,
logs: ["1"]

View File

@@ -1,16 +1,16 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {IZKGroups} from "./IZKGroups.sol";
import {IBandada} from "./IBandada.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/// @title ZKGroups
/// @title Bandada
/// @dev This contract is used to save the groups fingerprints.
contract ZKGroups is IZKGroups, Ownable {
/// @dev See {IZKGroups-groups}.
contract Bandada is IBandada, Ownable {
/// @dev See {IBandada-groups}.
mapping(uint256 => uint256) public override groups;
/// @dev See {IZKGroups-updateGroups}.
/// @dev See {IBandada-updateGroups}.
function updateGroups(
Group[] calldata _groups
) external override onlyOwner {

View File

@@ -1,8 +1,8 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @title ZKGroups contract interface.
interface IZKGroups {
/// @title Bandada contract interface.
interface IBandada {
struct Group {
uint256 id;
uint256 fingerprint;

View File

@@ -93,9 +93,9 @@ yarn test:report-gas
Deploy a zk-groups contract:
```bash
yarn deploy:zkgroups
yarn deploy:bandada
# or
yarn deploy:zkgroups-semaphore
yarn deploy:bandada-semaphore
```
If you want to deploy contracts on Goerli or Arbitrum, remember to provide a valid private key and an Infura API in your `.env` file.

View File

@@ -1,28 +1,28 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {IZKGroupsSemaphore} from "./IZKGroupsSemaphore.sol";
import {IZKGroups} from "../IZKGroups.sol";
import {IBandadaSemaphore} from "./IBandadaSemaphore.sol";
import {IBandada} from "../IBandada.sol";
import {ISemaphoreVerifier} from "@semaphore-protocol/contracts/interfaces/ISemaphoreVerifier.sol";
/// @title ZKGroupsSemaphore
/// @title BandadaSemaphore
/// @dev This contract is used to verify Semaphore proofs.
contract ZKGroupsSemaphore is IZKGroupsSemaphore {
contract BandadaSemaphore is IBandadaSemaphore {
ISemaphoreVerifier public verifier;
IZKGroups public zkGroups;
IBandada public bandada;
/// @dev Gets a group id and a nullifier hash and returns true if it has already been used.
mapping(uint256 => mapping(uint256 => bool)) internal nullifierHashes;
/// @dev Initializes the Semaphore verifier used to verify the user's ZK proofs.
/// @param _verifier: Semaphore verifier address.
/// @param _zkGroups: ZKGroups address.
constructor(ISemaphoreVerifier _verifier, IZKGroups _zkGroups) {
/// @param _bandada: Bandada address.
constructor(ISemaphoreVerifier _verifier, IBandada _bandada) {
verifier = _verifier;
zkGroups = _zkGroups;
bandada = _bandada;
}
/// @dev See {IZKGroupsSemaphore-verifyProof}.
/// @dev See {IBandadaSemaphore-verifyProof}.
function verifyProof(
uint256 groupId,
uint256 merkleTreeDepth,
@@ -31,10 +31,10 @@ contract ZKGroupsSemaphore is IZKGroupsSemaphore {
uint256 externalNullifier,
uint256[8] calldata proof
) external override {
uint256 merkleTreeRoot = zkGroups.groups(groupId);
uint256 merkleTreeRoot = bandada.groups(groupId);
if (nullifierHashes[groupId][nullifierHash]) {
revert ZKGroupsSemaphore__YouAreUsingTheSameNullifierTwice();
revert BandadaSemaphore__YouAreUsingTheSameNullifierTwice();
}
verifier.verifyProof(

View File

@@ -1,9 +1,9 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @title IZKGroupsSemaphore contract interface.
interface IZKGroupsSemaphore {
error ZKGroupsSemaphore__YouAreUsingTheSameNullifierTwice();
/// @title IBandadaSemaphore contract interface.
interface IBandadaSemaphore {
error BandadaSemaphore__YouAreUsingTheSameNullifierTwice();
/// @dev Emitted when a Semaphore proof is correctly verified.
/// @param groupId: Id of the group.

View File

@@ -5,8 +5,8 @@ import "hardhat-dependency-compiler"
import { HardhatUserConfig } from "hardhat/config"
import { NetworksUserConfig } from "hardhat/types"
import "solidity-coverage"
import "./tasks/deploy-zkgroups"
import "./tasks/deploy-zkgroups-semaphore"
import "./tasks/deploy-bandada"
import "./tasks/deploy-bandada-semaphore"
dotenvConfig()

View File

@@ -3,9 +3,9 @@
"private": true,
"scripts": {
"compile": "hardhat compile",
"local-node": "yarn compile && hardhat node & yarn deploy:zkgroups --network localhost",
"deploy:zkgroups": "hardhat deploy:zkgroups",
"deploy:zkgroups-semaphore": "hardhat deploy:zkgroups-semaphore",
"local-node": "yarn compile && hardhat node & yarn deploy:bandada --network localhost",
"deploy:bandada": "hardhat deploy:bandada",
"deploy:bandada-semaphore": "hardhat deploy:bandada-semaphore",
"test": "hardhat test",
"test:report-gas": "REPORT_GAS=true hardhat test",
"test:coverage": "hardhat coverage",

View File

@@ -1,11 +1,11 @@
import { Contract } from "ethers"
import { task, types } from "hardhat/config"
task("deploy:zkgroups-semaphore", "Deploy a ZKGroupsSemaphore contract")
task("deploy:bandada-semaphore", "Deploy a BandadaSemaphore contract")
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
.addOptionalParam(
"zkGroups",
"ZKGroups contract address",
"bandada",
"Bandada contract address",
undefined,
types.string
)
@@ -19,7 +19,7 @@ task("deploy:zkgroups-semaphore", "Deploy a ZKGroupsSemaphore contract")
async (
{
logs,
zkGroups: zkGroupsAddress,
bandada: bandadaAddress,
semaphoreVerifier: semaphoreVerifierAddress
},
{ ethers, run }
@@ -59,28 +59,28 @@ task("deploy:zkgroups-semaphore", "Deploy a ZKGroupsSemaphore contract")
semaphoreVerifierAddress = semaphoreVerifier.address
}
if (!zkGroupsAddress) {
const zkGroups = await run("deploy:zkgroups", {
if (!bandadaAddress) {
const bandada = await run("deploy:bandada", {
logs
})
zkGroupsAddress = zkGroups.address
bandadaAddress = bandada.address
}
const ContractFactory = await ethers.getContractFactory(
"ZKGroupsSemaphore"
"BandadaSemaphore"
)
const contract = await ContractFactory.deploy(
semaphoreVerifierAddress,
zkGroupsAddress
bandadaAddress
)
await contract.deployed()
if (logs) {
console.info(
`ZKGroupsSemaphore contract has been deployed to: ${contract.address}`
`BandadaSemaphore contract has been deployed to: ${contract.address}`
)
}

View File

@@ -1,11 +1,11 @@
import { Contract } from "ethers"
import { task, types } from "hardhat/config"
task("deploy:zkgroups", "Deploy a ZKGroups contract")
task("deploy:bandada", "Deploy a Bandada contract")
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
.setAction(async ({ logs }, { ethers }): Promise<Contract> => {
const ContractFactory = await ethers.getContractFactory("ZKGroups")
const ContractFactory = await ethers.getContractFactory("Bandada")
const contract = await ContractFactory.deploy()
@@ -13,7 +13,7 @@ task("deploy:zkgroups", "Deploy a ZKGroups contract")
if (logs) {
console.info(
`ZKGroups contract has been deployed to: ${contract.address}`
`Bandada contract has been deployed to: ${contract.address}`
)
}

View File

@@ -5,10 +5,10 @@ import { BigNumber, utils } from "ethers"
import { run } from "hardhat"
// @ts-ignore: typechain folder will be generated after contracts compilation.
// eslint-disable-next-line import/extensions
import { ZKGroups } from "../typechain-types"
import { Bandada } from "../typechain-types"
describe("ZKGroups", () => {
let zkGroups: ZKGroups
describe("Bandada", () => {
let bandada: Bandada
const groupId = utils.formatBytes32String("Name")
const identities = [0, 1].map((i) => new Identity(i.toString()))
@@ -17,14 +17,14 @@ describe("ZKGroups", () => {
group.addMembers(identities.map(({ commitment }) => commitment))
before(async () => {
zkGroups = await run("deploy:zkgroups", {
bandada = await run("deploy:bandada", {
logs: false
})
})
describe("# updateGroup", () => {
it("Should update groups", async () => {
const transaction = zkGroups.updateGroups([
const transaction = bandada.updateGroups([
{
id: groupId,
fingerprint: group.root
@@ -32,14 +32,14 @@ describe("ZKGroups", () => {
])
await expect(transaction)
.to.emit(zkGroups, "GroupUpdated")
.to.emit(bandada, "GroupUpdated")
.withArgs(groupId, group.root)
})
})
describe("# groups", () => {
it("Should get the current fingerprint of an off-chain group", async () => {
const fingerprint = await zkGroups.groups(groupId)
const fingerprint = await bandada.groups(groupId)
expect(fingerprint).to.equal(group.root)
})

View File

@@ -6,11 +6,11 @@ import { BigNumber, utils } from "ethers"
import { run } from "hardhat"
// @ts-ignore: typechain folder will be generated after contracts compilation.
// eslint-disable-next-line import/extensions
import { ZKGroups, ZKGroupsSemaphore } from "../typechain-types"
import { Bandada, BandadaSemaphore } from "../typechain-types"
describe("ZKGroupsSemaphore", () => {
let zkGroups: ZKGroups
let zkGroupsSemaphore: ZKGroupsSemaphore
describe("BandadaSemaphore", () => {
let bandada: Bandada
let bandadaSemaphore: BandadaSemaphore
const groupId = utils.formatBytes32String("Name")
const identities = [0, 1].map((i) => new Identity(i.toString()))
@@ -19,16 +19,16 @@ describe("ZKGroupsSemaphore", () => {
group.addMembers(identities.map(({ commitment }) => commitment))
before(async () => {
zkGroups = await run("deploy:zkgroups", {
bandada = await run("deploy:bandada", {
logs: false
})
zkGroupsSemaphore = await run("deploy:zkgroups-semaphore", {
bandadaSemaphore = await run("deploy:bandada-semaphore", {
logs: false,
zkGroups: zkGroups.address
bandada: bandada.address
})
await zkGroups.updateGroups([
await bandada.updateGroups([
{
id: groupId,
fingerprint: group.root
@@ -55,7 +55,7 @@ describe("ZKGroupsSemaphore", () => {
})
it("Should throw an exception if the proof is not valid", async () => {
const transaction = zkGroupsSemaphore.verifyProof(
const transaction = bandadaSemaphore.verifyProof(
groupId,
group.depth,
signal,
@@ -68,7 +68,7 @@ describe("ZKGroupsSemaphore", () => {
})
it("Should verify a proof for an off-chain group correctly", async () => {
const transaction = zkGroupsSemaphore.verifyProof(
const transaction = bandadaSemaphore.verifyProof(
groupId,
group.depth,
signal,
@@ -78,7 +78,7 @@ describe("ZKGroupsSemaphore", () => {
)
await expect(transaction)
.to.emit(zkGroupsSemaphore, "ProofVerified")
.to.emit(bandadaSemaphore, "ProofVerified")
.withArgs(
groupId,
group.root,
@@ -89,7 +89,7 @@ describe("ZKGroupsSemaphore", () => {
})
it("Should not verify the same proof for an off-chain group twice", async () => {
const transaction = zkGroupsSemaphore.verifyProof(
const transaction = bandadaSemaphore.verifyProof(
groupId,
group.depth,
signal,
@@ -99,8 +99,8 @@ describe("ZKGroupsSemaphore", () => {
)
await expect(transaction).to.be.revertedWithCustomError(
zkGroupsSemaphore,
"ZKGroupsSemaphore__YouAreUsingTheSameNullifierTwice"
bandadaSemaphore,
"BandadaSemaphore__YouAreUsingTheSameNullifierTwice"
)
})
})

View File

@@ -21,7 +21,7 @@ import { useCallback, useEffect, useState } from "react"
import { useSearchParams } from "react-router-dom"
import { useSigner } from "wagmi"
import { groupSizeInfo } from "../types/groups"
import { createGroup as createOffchainGroup } from "../api/zkGroupsAPI"
import { createGroup as createOffchainGroup } from "../api/bandadaAPI"
export default function CreateGroupModal({
isOpen,

View File

@@ -17,7 +17,7 @@ import {
} from "@chakra-ui/react"
import { useCallback, useState } from "react"
import { FaRegCopy } from "react-icons/fa"
import { generateMagicLink } from "../api/zkGroupsAPI"
import { generateMagicLink } from "../api/bandadaAPI"
export default function InviteModal({
isOpen,

View File

@@ -14,7 +14,7 @@ import { shortenAddress } from "@zk-groups/utils"
import { useCallback } from "react"
import { useLocation, useNavigate } from "react-router-dom"
import { useAccount, useDisconnect } from "wagmi"
import { logOut as _logOut } from "../api/zkGroupsAPI"
import { logOut as _logOut } from "../api/bandadaAPI"
export default function NavBar(): JSX.Element {
const navigate = useNavigate()

View File

@@ -16,13 +16,13 @@ import { createBrowserRouter, redirect, RouterProvider } from "react-router-dom"
import { configureChains, createClient, WagmiConfig } from "wagmi"
import { goerli } from "wagmi/chains"
import { publicProvider } from "wagmi/providers/public"
import { isLoggedIn } from "./api/zkGroupsAPI"
import NotFoundPage from "./pages/404"
import Home from "./pages/home"
import Manage from "./pages/manage"
import MyGroups from "./pages/my-groups"
import SSO from "./pages/sso"
import theme from "./styles"
import { isLoggedIn } from "./api/bandadaAPI"
const { chains, provider, webSocketProvider } = configureChains(
[goerli],

View File

@@ -14,7 +14,7 @@ import AddMemberModal from "../components/add-member-modal"
import InviteModal from "../components/invite-modal"
import { Group } from "../types/groups"
import { getGroup as getOnchainGroup } from "../api/semaphoreAPI"
import { getGroup as getOffchainGroup, removeMember } from "../api/zkGroupsAPI"
import { getGroup as getOffchainGroup, removeMember } from "../api/bandadaAPI"
export default function Manage(): JSX.Element {
const navigate = useNavigate()

View File

@@ -19,7 +19,7 @@ import GroupBox from "../components/group-box"
import GroupFolder from "../components/group-folder"
import { Group } from "../types/groups"
import { getGroups as getOnchainGroups } from "../api/semaphoreAPI"
import { getGroups as getOffchainGroups } from "../api/zkGroupsAPI"
import { getGroups as getOffchainGroups } from "../api/bandadaAPI"
export default function MyGroups(): JSX.Element {
const [searchParams] = useSearchParams()

View File

@@ -45,7 +45,7 @@ export default function SSO(): JSX.Element {
) : (
<span>
Create your first
<br /> ZK group
<br /> Bandada group
</span>
)}
</Heading>

View File

@@ -1,8 +1,8 @@
<p align="center">
<h1 align="center">
ZKGroups Hardhat plugin
Bandada Hardhat plugin
</h1>
<p align="center">A Hardhat plugin which provide tasks to deploy ZKGroups contracts.</p>
<p align="center">A Hardhat plugin which provide tasks to deploy Bandada contracts.</p>
</p>
<p align="center">
@@ -46,7 +46,7 @@
</h4>
</div>
| This Hardhat plugin provides simple tasks that can be used to deploy the ZKGroups contracts without any additional configuration. |
| This Hardhat plugin provides simple tasks that can be used to deploy the Bandada contracts without any additional configuration. |
| --------------------------------------------------------------------------------------------------------------------------------- |
## 🛠 Install
@@ -80,7 +80,7 @@ const hardhatConfig: HardhatUserConfig = {
export default hardhatConfig
```
And use its tasks to create your own `deploy` task and deploy your contract with a ZKGroups address.
And use its tasks to create your own `deploy` task and deploy your contract with a Bandada address.
```typescript
import { task, types } from "hardhat/config"
@@ -88,13 +88,13 @@ import { task, types } from "hardhat/config"
task("deploy", "Deploy a Greeter contract")
.addOptionalParam("logs", "Print the logs", true, types.boolean)
.setAction(async ({ logs }, { ethers, run }) => {
const { zkGroups } = await run("deploy:zk-groups", {
const { bandada } = await run("deploy:zk-groups", {
logs
})
const Greeter = await ethers.getContractFactory("Greeter")
const greeter = await Greeter.deploy(zkGroups.address)
const greeter = await Greeter.deploy(bandada.address)
await greeter.deployed()

View File

@@ -1,7 +1,7 @@
{
"name": "@zk-groups/hardhat",
"version": "0.4.0",
"description": "A Hardhat plugin which provides tasks to deploy ZKGroups contracts.",
"description": "A Hardhat plugin which provides tasks to deploy Bandada contracts.",
"license": "MIT",
"main": "dist/index.node.js",
"exports": {

View File

@@ -3,14 +3,14 @@ import { HardhatConfig, HardhatUserConfig } from "hardhat/types"
import "hardhat-dependency-compiler"
import "@nomiclabs/hardhat-ethers"
import "./tasks/deploy-zk-groups"
import "./tasks/deploy-zk-groups-semaphore"
import "./tasks/deploy-bandada"
import "./tasks/deploy-bandada-semaphore"
extendConfig(
(config: HardhatConfig, userConfig: Readonly<HardhatUserConfig>) => {
config.dependencyCompiler.paths = [
"@zk-groups/contracts/ZKGroups.sol",
"@zk-groups/contracts/protocols/ZKGroupsSemaphore.sol",
"@zk-groups/contracts/Bandada.sol",
"@zk-groups/contracts/protocols/BandadaSemaphore.sol",
"@semaphore-protocol/contracts/base/Pairing.sol",
"@semaphore-protocol/contracts/base/SemaphoreVerifier.sol"
]

View File

@@ -1,6 +1,6 @@
import { task, types } from "hardhat/config"
task("deploy:zk-groups-semaphore", "Deploy a ZKGroupsSemaphore contract")
task("deploy:zk-groups-semaphore", "Deploy a BandadaSemaphore contract")
.addOptionalParam<boolean>(
"pairing",
"Pairing library address",
@@ -14,8 +14,8 @@ task("deploy:zk-groups-semaphore", "Deploy a ZKGroupsSemaphore contract")
types.string
)
.addOptionalParam<boolean>(
"zkGroups",
"ZKGroups contract address",
"bandada",
"Bandada contract address",
undefined,
types.string
)
@@ -26,7 +26,7 @@ task("deploy:zk-groups-semaphore", "Deploy a ZKGroupsSemaphore contract")
logs,
pairing: pairingAddress,
semaphoreVerifier: semaphoreVerifierAddress,
zkGroups: zkGroupsAddress
bandada: bandadaAddress
},
{ ethers, run }
): Promise<any> => {
@@ -69,29 +69,29 @@ task("deploy:zk-groups-semaphore", "Deploy a ZKGroupsSemaphore contract")
semaphoreVerifierAddress = semaphoreVerifier.address
}
if (!zkGroupsAddress) {
const zkGroups = await run("deploy:zk-groups", { logs })
if (!bandadaAddress) {
const bandada = await run("deploy:zk-groups", { logs })
zkGroupsAddress = zkGroups.address
bandadaAddress = bandada.address
}
const ZKGroupsSemaphoreFactory = await ethers.getContractFactory(
"ZKGroupsSemaphore"
const BandadaSemaphoreFactory = await ethers.getContractFactory(
"BandadaSemaphore"
)
const zkGroupsSemaphore = await ZKGroupsSemaphoreFactory.deploy(
const bandadaSemaphore = await BandadaSemaphoreFactory.deploy(
semaphoreVerifierAddress,
zkGroupsAddress
bandadaAddress
)
await zkGroupsSemaphore.deployed()
await bandadaSemaphore.deployed()
if (logs) {
console.info(
`ZKGroupsSemaphore contract has been deployed to: ${zkGroupsSemaphore.address}`
`BandadaSemaphore contract has been deployed to: ${bandadaSemaphore.address}`
)
}
return zkGroupsSemaphore
return bandadaSemaphore
}
)

View File

@@ -0,0 +1,19 @@
import { task, types } from "hardhat/config"
task("deploy:zk-groups", "Deploy a Bandada contract")
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
.setAction(async ({ logs }, { ethers }): Promise<any> => {
const BandadaFactory = await ethers.getContractFactory("Bandada")
const bandada = await BandadaFactory.deploy()
await bandada.deployed()
if (logs) {
console.info(
`Bandada contract has been deployed to: ${bandada.address}`
)
}
return bandada
})

View File

@@ -1,19 +0,0 @@
import { task, types } from "hardhat/config"
task("deploy:zk-groups", "Deploy a ZKGroups contract")
.addOptionalParam<boolean>("logs", "Print the logs", true, types.boolean)
.setAction(async ({ logs }, { ethers }): Promise<any> => {
const ZKGroupsFactory = await ethers.getContractFactory("ZKGroups")
const zkGroups = await ZKGroupsFactory.deploy()
await zkGroups.deployed()
if (logs) {
console.info(
`ZKGroups contract has been deployed to: ${zkGroups.address}`
)
}
return zkGroups
})

View File

@@ -1,8 +1,8 @@
<p align="center">
<h1 align="center">
ZKGroups utils
Bandada utils
</h1>
<p align="center">General ZKGroups utility functions.</p>
<p align="center">General Bandada utility functions.</p>
</p>
<p align="center">
@@ -46,7 +46,7 @@
</h4>
</div>
| This package provides simple utility functions that can be used by ZKGroups itself or externals. |
| This package provides simple utility functions that can be used by Bandada itself or externals. |
| ------------------------------------------------------------------------------------------------ |
## 🛠 Install

View File

@@ -1,7 +1,7 @@
{
"name": "@zk-groups/utils",
"version": "0.4.0",
"description": "General ZKGroups utility functions.",
"description": "General Bandada utility functions.",
"license": "MIT",
"main": "dist/index.node.js",
"exports": {

View File

@@ -6,13 +6,13 @@ const CONTRACT_ADDRESSES: { [K in Network]: { [Y in ContractName]: string } } =
{
localhost: {
Semaphore: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
ZKGroups: "0x5fbdb2315678afecb367f032d93f642f64180aa3",
ZKGroupsSemaphore: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
Bandada: "0x5fbdb2315678afecb367f032d93f642f64180aa3",
BandadaSemaphore: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
},
goerli: {
Semaphore: "0x89490c95eD199D980Cdb4FF8Bac9977EDb41A7E7",
ZKGroups: "0x461C2f74F5adB6F3CE559A7f86F2872568DAB9B3",
ZKGroupsSemaphore: "0xd81B417Ca0F6A74fBa86Ea17105d1863beE90bf4"
Bandada: "0x461C2f74F5adB6F3CE559A7f86F2872568DAB9B3",
BandadaSemaphore: "0xd81B417Ca0F6A74fBa86Ea17105d1863beE90bf4"
}
}

View File

@@ -0,0 +1,126 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "Bandada",
"sourceName": "contracts/Bandada.sol",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "fingerprint",
"type": "uint256"
}
],
"name": "GroupUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "groups",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "fingerprint",
"type": "uint256"
}
],
"internalType": "struct IBandada.Group[]",
"name": "_groups",
"type": "tuple[]"
}
],
"name": "updateGroups",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5061002d61002261003260201b60201c565b61003a60201b60201c565b6100fe565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b61079b8061010d6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063125863cb1461005c578063715018a6146100785780638da5cb5b1461008257806396324bd4146100a0578063f2fde38b146100d0575b600080fd5b6100766004803603810190610071919061052a565b6100ec565b005b61008061026a565b005b61008a61027e565b60405161009791906105fc565b60405180910390f35b6100ba60048036038101906100b5919061056f565b6102a7565b6040516100c79190610657565b60405180910390f35b6100ea60048036038101906100e59190610501565b6102bf565b005b6100f4610343565b60005b828290508110156102655782828281811061013b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050604002016020013560016000858585818110610182577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001358152602001908152602001600020819055508282828181106101d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001357f65659fbf3bab178ce96dcb4ea95ba3900cae36f9426e9920b7940995f62b06bf84848481811061023b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201602001356040516102529190610657565b60405180910390a28060010190506100f7565b505050565b610272610343565b61027c60006103c1565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528060005260406000206000915090505481565b6102c7610343565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610337576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032e90610617565b60405180910390fd5b610340816103c1565b50565b61034b610485565b73ffffffffffffffffffffffffffffffffffffffff1661036961027e565b73ffffffffffffffffffffffffffffffffffffffff16146103bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b690610637565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60008135905061049c81610737565b92915050565b60008083601f8401126104b457600080fd5b8235905067ffffffffffffffff8111156104cd57600080fd5b6020830191508360408202830111156104e557600080fd5b9250929050565b6000813590506104fb8161074e565b92915050565b60006020828403121561051357600080fd5b60006105218482850161048d565b91505092915050565b6000806020838503121561053d57600080fd5b600083013567ffffffffffffffff81111561055757600080fd5b610563858286016104a2565b92509250509250929050565b60006020828403121561058157600080fd5b600061058f848285016104ec565b91505092915050565b6105a181610683565b82525050565b60006105b4602683610672565b91506105bf826106bf565b604082019050919050565b60006105d7602083610672565b91506105e28261070e565b602082019050919050565b6105f6816106b5565b82525050565b60006020820190506106116000830184610598565b92915050565b60006020820190508181036000830152610630816105a7565b9050919050565b60006020820190508181036000830152610650816105ca565b9050919050565b600060208201905061066c60008301846105ed565b92915050565b600082825260208201905092915050565b600061068e82610695565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b61074081610683565b811461074b57600080fd5b50565b610757816106b5565b811461076257600080fd5b5056fea26469706673582212200e5c3dcf5770ee544741fbdd4134902b2e427d740185f3d0c72289cf2d2a3a0964736f6c63430008040033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063125863cb1461005c578063715018a6146100785780638da5cb5b1461008257806396324bd4146100a0578063f2fde38b146100d0575b600080fd5b6100766004803603810190610071919061052a565b6100ec565b005b61008061026a565b005b61008a61027e565b60405161009791906105fc565b60405180910390f35b6100ba60048036038101906100b5919061056f565b6102a7565b6040516100c79190610657565b60405180910390f35b6100ea60048036038101906100e59190610501565b6102bf565b005b6100f4610343565b60005b828290508110156102655782828281811061013b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050604002016020013560016000858585818110610182577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001358152602001908152602001600020819055508282828181106101d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001357f65659fbf3bab178ce96dcb4ea95ba3900cae36f9426e9920b7940995f62b06bf84848481811061023b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201602001356040516102529190610657565b60405180910390a28060010190506100f7565b505050565b610272610343565b61027c60006103c1565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528060005260406000206000915090505481565b6102c7610343565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610337576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032e90610617565b60405180910390fd5b610340816103c1565b50565b61034b610485565b73ffffffffffffffffffffffffffffffffffffffff1661036961027e565b73ffffffffffffffffffffffffffffffffffffffff16146103bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b690610637565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60008135905061049c81610737565b92915050565b60008083601f8401126104b457600080fd5b8235905067ffffffffffffffff8111156104cd57600080fd5b6020830191508360408202830111156104e557600080fd5b9250929050565b6000813590506104fb8161074e565b92915050565b60006020828403121561051357600080fd5b60006105218482850161048d565b91505092915050565b6000806020838503121561053d57600080fd5b600083013567ffffffffffffffff81111561055757600080fd5b610563858286016104a2565b92509250509250929050565b60006020828403121561058157600080fd5b600061058f848285016104ec565b91505092915050565b6105a181610683565b82525050565b60006105b4602683610672565b91506105bf826106bf565b604082019050919050565b60006105d7602083610672565b91506105e28261070e565b602082019050919050565b6105f6816106b5565b82525050565b60006020820190506106116000830184610598565b92915050565b60006020820190508181036000830152610630816105a7565b9050919050565b60006020820190508181036000830152610650816105ca565b9050919050565b600060208201905061066c60008301846105ed565b92915050565b600082825260208201905092915050565b600061068e82610695565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b61074081610683565b811461074b57600080fd5b50565b610757816106b5565b811461076257600080fd5b5056fea26469706673582212200e5c3dcf5770ee544741fbdd4134902b2e427d740185f3d0c72289cf2d2a3a0964736f6c63430008040033",
"linkReferences": {},
"deployedLinkReferences": {}
}

View File

@@ -1,126 +0,0 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "ZKGroups",
"sourceName": "contracts/ZKGroups.sol",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "fingerprint",
"type": "uint256"
}
],
"name": "GroupUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "groups",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "fingerprint",
"type": "uint256"
}
],
"internalType": "struct IZKGroups.Group[]",
"name": "_groups",
"type": "tuple[]"
}
],
"name": "updateGroups",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5061002d61002261003260201b60201c565b61003a60201b60201c565b6100fe565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b61079b8061010d6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063125863cb1461005c578063715018a6146100785780638da5cb5b1461008257806396324bd4146100a0578063f2fde38b146100d0575b600080fd5b6100766004803603810190610071919061052a565b6100ec565b005b61008061026a565b005b61008a61027e565b60405161009791906105fc565b60405180910390f35b6100ba60048036038101906100b5919061056f565b6102a7565b6040516100c79190610657565b60405180910390f35b6100ea60048036038101906100e59190610501565b6102bf565b005b6100f4610343565b60005b828290508110156102655782828281811061013b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050604002016020013560016000858585818110610182577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001358152602001908152602001600020819055508282828181106101d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001357f65659fbf3bab178ce96dcb4ea95ba3900cae36f9426e9920b7940995f62b06bf84848481811061023b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201602001356040516102529190610657565b60405180910390a28060010190506100f7565b505050565b610272610343565b61027c60006103c1565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528060005260406000206000915090505481565b6102c7610343565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610337576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032e90610617565b60405180910390fd5b610340816103c1565b50565b61034b610485565b73ffffffffffffffffffffffffffffffffffffffff1661036961027e565b73ffffffffffffffffffffffffffffffffffffffff16146103bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b690610637565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60008135905061049c81610737565b92915050565b60008083601f8401126104b457600080fd5b8235905067ffffffffffffffff8111156104cd57600080fd5b6020830191508360408202830111156104e557600080fd5b9250929050565b6000813590506104fb8161074e565b92915050565b60006020828403121561051357600080fd5b60006105218482850161048d565b91505092915050565b6000806020838503121561053d57600080fd5b600083013567ffffffffffffffff81111561055757600080fd5b610563858286016104a2565b92509250509250929050565b60006020828403121561058157600080fd5b600061058f848285016104ec565b91505092915050565b6105a181610683565b82525050565b60006105b4602683610672565b91506105bf826106bf565b604082019050919050565b60006105d7602083610672565b91506105e28261070e565b602082019050919050565b6105f6816106b5565b82525050565b60006020820190506106116000830184610598565b92915050565b60006020820190508181036000830152610630816105a7565b9050919050565b60006020820190508181036000830152610650816105ca565b9050919050565b600060208201905061066c60008301846105ed565b92915050565b600082825260208201905092915050565b600061068e82610695565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b61074081610683565b811461074b57600080fd5b50565b610757816106b5565b811461076257600080fd5b5056fea26469706673582212204dacc59ea61a2c7803e12361bef06b7bb0b0c4fbd45f3852b9ad9d44b6bd618764736f6c63430008040033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063125863cb1461005c578063715018a6146100785780638da5cb5b1461008257806396324bd4146100a0578063f2fde38b146100d0575b600080fd5b6100766004803603810190610071919061052a565b6100ec565b005b61008061026a565b005b61008a61027e565b60405161009791906105fc565b60405180910390f35b6100ba60048036038101906100b5919061056f565b6102a7565b6040516100c79190610657565b60405180910390f35b6100ea60048036038101906100e59190610501565b6102bf565b005b6100f4610343565b60005b828290508110156102655782828281811061013b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050604002016020013560016000858585818110610182577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001358152602001908152602001600020819055508282828181106101d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201600001357f65659fbf3bab178ce96dcb4ea95ba3900cae36f9426e9920b7940995f62b06bf84848481811061023b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060400201602001356040516102529190610657565b60405180910390a28060010190506100f7565b505050565b610272610343565b61027c60006103c1565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528060005260406000206000915090505481565b6102c7610343565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610337576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032e90610617565b60405180910390fd5b610340816103c1565b50565b61034b610485565b73ffffffffffffffffffffffffffffffffffffffff1661036961027e565b73ffffffffffffffffffffffffffffffffffffffff16146103bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b690610637565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b60008135905061049c81610737565b92915050565b60008083601f8401126104b457600080fd5b8235905067ffffffffffffffff8111156104cd57600080fd5b6020830191508360408202830111156104e557600080fd5b9250929050565b6000813590506104fb8161074e565b92915050565b60006020828403121561051357600080fd5b60006105218482850161048d565b91505092915050565b6000806020838503121561053d57600080fd5b600083013567ffffffffffffffff81111561055757600080fd5b610563858286016104a2565b92509250509250929050565b60006020828403121561058157600080fd5b600061058f848285016104ec565b91505092915050565b6105a181610683565b82525050565b60006105b4602683610672565b91506105bf826106bf565b604082019050919050565b60006105d7602083610672565b91506105e28261070e565b602082019050919050565b6105f6816106b5565b82525050565b60006020820190506106116000830184610598565b92915050565b60006020820190508181036000830152610630816105a7565b9050919050565b60006020820190508181036000830152610650816105ca565b9050919050565b600060208201905061066c60008301846105ed565b92915050565b600082825260208201905092915050565b600061068e82610695565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b61074081610683565b811461074b57600080fd5b50565b610757816106b5565b811461076257600080fd5b5056fea26469706673582212204dacc59ea61a2c7803e12361bef06b7bb0b0c4fbd45f3852b9ad9d44b6bd618764736f6c63430008040033",
"linkReferences": {},
"deployedLinkReferences": {}
}

View File

@@ -3,33 +3,33 @@
import { Signer } from "@ethersproject/abstract-signer"
import { Contract, ContractReceipt } from "@ethersproject/contracts"
import getContract from "./getContract"
import { Network, OnchainZKGroup } from "./types"
import { Network, OnchainBandadaGroup } from "./types"
export class ZKGroupsContract {
export class BandadaContract {
private contract: Contract
constructor(contract: Contract) {
this.contract = contract
}
async updateGroups(groups: OnchainZKGroup[]): Promise<ContractReceipt> {
async updateGroups(groups: OnchainBandadaGroup[]): Promise<ContractReceipt> {
const transaction = await this.contract.updateGroups(groups)
return transaction.wait(1)
}
}
export default function getZKGroupsContract(
export default function getBandadaContract(
network: Network,
privateKeyOrSigner?: string | Signer,
apiKey?: string
): ZKGroupsContract {
): BandadaContract {
const contract = getContract(
"ZKGroups",
"Bandada",
network,
privateKeyOrSigner,
apiKey
)
return new ZKGroupsContract(contract)
return new BandadaContract(contract)
}

View File

@@ -5,7 +5,7 @@ import { Contract } from "@ethersproject/contracts"
import { Provider } from "@ethersproject/providers"
import { getContractAddresses } from "./contractAddresses"
import { abi as SemaphoreABI } from "./contractArtifacts/Semaphore.json"
import { abi as ZKGroupsABI } from "./contractArtifacts/ZKGroups.json"
import { abi as BandadaABI } from "./contractArtifacts/Bandada.json"
import getProvider from "./getProvider"
import getWallet from "./getWallet"
import { ContractName, Network } from "./types"
@@ -31,8 +31,8 @@ export default function getContract(
const contractAddress = getContractAddresses(network)[contractName]
switch (contractName) {
case "ZKGroups":
return new Contract(contractAddress, ZKGroupsABI, providerOrWallet)
case "Bandada":
return new Contract(contractAddress, BandadaABI, providerOrWallet)
case "Semaphore":
return new Contract(contractAddress, SemaphoreABI, providerOrWallet)
default:

View File

@@ -1,11 +1,11 @@
import CONTRACT_ADDRESSES, { getContractAddresses } from "./contractAddresses"
import { abi as SemaphoreABI } from "./contractArtifacts/Semaphore.json"
import { abi as ZKGroupsABI } from "./contractArtifacts/ZKGroups.json"
import { abi as BandadaABI } from "./contractArtifacts/Bandada.json"
import getContract from "./getContract"
import getProvider from "./getProvider"
import getSemaphoreContract, { SemaphoreContract } from "./getSemaphoreContract"
import getWallet from "./getWallet"
import getZKGroupsContract, { ZKGroupsContract } from "./getZKGroupsContract"
import getBandadaContract, { BandadaContract } from "./getBandadaContract"
import request from "./request"
import shortenAddress from "./shortenAddress"
@@ -17,11 +17,11 @@ export {
getContract,
getSemaphoreContract,
SemaphoreContract,
getZKGroupsContract,
ZKGroupsContract,
getBandadaContract,
BandadaContract,
getWallet,
CONTRACT_ADDRESSES,
getContractAddresses,
SemaphoreABI,
ZKGroupsABI
BandadaABI
}

View File

@@ -11,9 +11,9 @@ export type Network =
// | "optimism"
// | "optimism-goerli"
export type ContractName = "ZKGroups" | "Semaphore" | "ZKGroupsSemaphore"
export type ContractName = "Bandada" | "Semaphore" | "BandadaSemaphore"
export type OnchainZKGroup = {
export type OnchainBandadaGroup = {
id: BigInt
fingerprint: BigInt
}