Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 27 additions & 29 deletions contracts/deployed-contracts/ethereum.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
{
"localAddresses": {
"local": {
"Verifier": "0x8464135c8F25Da09e49BC8782676a84730C318bC",
"ZKFirmaDigital": "0x71C95911E9a5D330f4D621842EC243EE1343292e",
"ZKFirmaDigitalVote": "0x948B3c65b89DF0B4894ABE91E6D02FE579834F8F",
"ZKPassportVote": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
},
"amoyAddresses": {
"amoy": {
"MedicalCertificateIssuer": "0x8eFCBF90C23BEBb0bBbbA6C3F1Cec565b936b83b",
"ZKFirmaDigitalCredentialIssuer": "0xF8684d3c4fCdD2e7F4ee0C7ED4670862B5369a24",
"ZKFirmaDigitalCredentialIssuer": "0x9108c8b0bD70F0279d979005e0a751FE9e44F099",
"Verifier": "0xe09caad31FFFBE9e8F406E77bb5546b9B6bb41a7",
"ZKFirmaDigital": "0x4Da5A6D555446317e6719AAa23C6182f3f8ae3B2",
"ZKFirmaDigitalVote": "0x27194dEd07F97fC186b16dEd9Bb54577378725A3",
"state": "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124",
"poseidon2Elements": "0x6AC3821a2cA519F23a7f9503Aa438c1498218F5d",
"poseidon3Elements": "0xfcAe9cAA466A70b924648172557f8db7ADfc14D8",
"poseidon4Elements": "0x772BeCAC5562A2d64e2CFAaD9f25F9a81226B996",
"smtLib": "0xfDe776DcA2B4603A4248770867D1e071DEa42DD3",
"poseidon2Elements": "0xb21632C29F5F3885F20d1bE68D265331B43f3680",
"poseidon3Elements": "0xb770eb12EeE4cD32B748e0cCA490B293194d91D6",
"poseidon4Elements": "0x77D5A12146A82bF9BAf0E61284c212fE904AD28A",
"smtLib": "0x313A7Bc601C3315929F0735f0a105361E454f7eD",
"claimBuilder": "0x360e3FD6C963D9E055FCE3840a1dA06d04B4aE01",
"identityLib": "0x36A8ec6dA5D0684265f3ecfa87F8193BFd2D1077"
"identityLib": "0x36A8ec6dA5D0684265f3ecfa87F8193BFd2D1077",
"TD3QueryProofVerifier": "0xb9A4f17a51Bc69f5bd093169bcA1F104C275D828",
"RegistrationSMTReplicator": "0x184d66845158bba146894E7C8B3BceF3c9bBa4b0",
"ZikuaniVote": "0x11eE0dD78F07B550D32759A380C3E4215c0b63c8"
},
"blockdagTestnetAddresses": {
"polygon": {
"MedicalCertificateIssuer": "",
"ZKFirmaDigitalCredentialIssuer": "0x51105993F8f07cd002c0CAbcd8F312b01E1A776E",
"Verifier": "0x03d6ec1E280973dd034d00E3cefdd1F433434B6d",
"ZKFirmaDigital": "0xa6814Af35Acd10244fea8A9f07cC23625d93aD23",
"ZKFirmaDigitalVote": "0xEBa2A3f6c6652C9C5822023BF4d2F6076b2ca804",
"state": "0x769671b481BA59414733BA95fe8aD2731d6652E6",
"poseidon2Elements": "0x6d2994997201227c0120B0ee29155ec53f140254",
"poseidon3Elements": "0x101670B36685997624496FF17432F2e69913307e",
"poseidon4Elements": "0x1B95c292a8bD3F095A30B53850F2C2f4f540A252",
"smtLib": "0x0eD7ADB5073510b33A4Ea8A46246A4C5E387cE28",
"claimBuilder": "0x497002D0180D631A262630A8406051EFFFEF40Fb",
"identityLib": "0x206b2C6Cb964aE11894984AEE68116a2645d82dC",
"RegistrationSMTReplicator": "0x85e46721ED2eC04cc9Dfd02C385307cDa0133c32",
"TD3QueryProofVerifier": "0x5E49605FDC07F853b3f03b51e687A04e89B29cdF",
"ZKPassportVote": "0xbfCB68a5eAae2E3bbe54cC78cfB76Bc5a63BeE32",
"ZikuaniVote": "0xbfCB68a5eAae2E3bbe54cC78cfB76Bc5a63BeE32"
},
"productionAddresses": {
"Verifier": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
"ZKFirmaDigital": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
"ZKFirmaDigitalVote": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707"
"ZKFirmaDigitalCredentialIssuer": "",
"Verifier": "",
"ZKFirmaDigital": "",
"ZKFirmaDigitalVote": "",
"state": "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D",
"poseidon2Elements": "",
"poseidon3Elements": "",
"poseidon4Elements": "",
"smtLib": "",
"claimBuilder": "",
"identityLib": "",
"RegistrationSMTReplicator": "",
"TD3QueryProofVerifier": "",
"ZKPassportVote": "",
"ZikuaniVote": "0x11eE0dD78F07B550D32759A380C3E4215c0b63c8"
}
}
19 changes: 8 additions & 11 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import "@openzeppelin/hardhat-upgrades";
import '@nomicfoundation/hardhat-verify';

const privateKey = process.env.ETHEREUM_ADDRESS_PRIVATE_KEY || '1';
const amoyRpcUrl = process.env.POLYGON_AMOY_RPC_URL || "https://rpc-amoy.polygon.technology/";
const polygonRpcUrl = process.env.POLYGON_MAINNET_RPC_URL || "https://polygon-rpc.com";

const config: HardhatUserConfig = {
solidity: {
Expand All @@ -31,19 +33,14 @@ const config: HardhatUserConfig = {
},
amoy: {
// This is just a hardhat testing address, do not reuse in productionq
url: "https://rpc-amoy.polygon.technology/",
chainId: 80002,
url: amoyRpcUrl,
accounts: [privateKey]
},
"blockdag-testnet": {
chainId: 1043,
// A custom rpc node was used to deploy the contracts on blockdag testnet
// This is not the official rpc node for blockdag testnet
// You may use this one: https://test-rpc.primordial.bdagscan.com/
// url: "http://65.21.121.242:18545",
url: "https://rpc.primordial.bdagscan.com/",
accounts: [privateKey],
// ledgerAccounts: [`${process.env.LEDGER_ACCOUNT}`],
gasPrice: 1_000_000_000, // 1 gwei in wei,
polygon: {
chainId: 137,
url: polygonRpcUrl,
accounts: [privateKey]
},
}
};
Expand Down
10 changes: 9 additions & 1 deletion contracts/scripts/CreateVotePassport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ async function main() {
`../deployed-contracts/ethereum.json`,
)

const addresses = addressesJson.blockdagTestnetAddresses;
const networkName = process.env.HARDHAT_NETWORK || 'amoy';
const addressesByNetwork: Record<string, Record<string, string>> = {
amoy: addressesJson.amoyAddresses,
polygon: addressesJson.polygonMainnetAddresses,
};
const addresses = addressesByNetwork[networkName];
if (!addresses) {
throw new Error(`Unsupported network "${networkName}". Use "amoy" or "polygon".`);
}

const owner = (await ethers.getSigners())[0];
const ownerAddress = await owner.getAddress();
Expand Down
13 changes: 9 additions & 4 deletions contracts/scripts/deployCredentialIssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ import { ZKFirmaDigitalCredentialIssuerDeployHelper } from './utils/ZKFirmaDigit
const pathOutputJson = path.join(__dirname, './deploy_output_test.json');

async function main() {
// const stateAddress = '0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D'; // current iden3 state smart contract on main
// const stateAddress = '0x134b1be34911e39a8397ec6289782989729807a4'; // current iden3 state smart contract on mumbai
// const stateAddress = '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124'; // current iden3 state smart contract on amoy
const stateAddress = '0x769671b481BA59414733BA95fe8aD2731d6652E6'; // current iden3 state smart contract on blockdag-testnet
const networkName = process.env.HARDHAT_NETWORK || 'amoy';
const stateAddressByNetwork: Record<string, string> = {
amoy: '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124',
polygon: '0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D',
};
const stateAddress = stateAddressByNetwork[networkName];
if (!stateAddress) {
throw new Error(`Unsupported network "${networkName}". Use "amoy" or "polygon".`);
}

const owner = (await ethers.getSigners())[0];
const [poseidon2Elements, poseidon3Elements, poseidon4Elements] = await deployPoseidons(
Expand Down
16 changes: 12 additions & 4 deletions contracts/scripts/deployZikuaniVotingContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ async function main() {
`../deployed-contracts/ethereum.json`,
);

// const addresses = addressesJson.amoyAddresses;
const addresses = addressesJson.blockdagTestnetAddresses;
const networkName = process.env.HARDHAT_NETWORK || 'amoy';
const addressesByNetwork: Record<string, Record<string, string>> = {
amoy: addressesJson.amoy,
polygon: addressesJson.polygon,
};
const addresses = addressesByNetwork[networkName];
console.log(addresses);
if (!addresses) {
throw new Error(`Unsupported network "${networkName}". Use "amoy" or "polygon".`);
}

const ZKFirmaDigitalCredentialIssuer = addresses.ZKFirmaDigitalCredentialIssuer;
const verifierAddress = addresses.TD3QueryProofVerifier;
Expand All @@ -24,8 +32,8 @@ async function main() {
// Example birth date lower bound (e.g., 18 years ago)
const birthDateLowerbound = Math.floor(Date.now() / 1000) - 18 * 365 * 24 * 60 * 60;

// Example expiration date lower bound (e.g., must expire after 2026)
const expirationDateLowerBound = Math.floor(new Date("2026-01-01").getTime() / 1000);
// Example expiration date lower bound (e.g., must expire after 2027)
const expirationDateLowerBound = Math.floor(new Date("2027-01-01").getTime() / 1000);

const identityCounterUpperBound = 1;

Expand Down
14 changes: 7 additions & 7 deletions contracts/scripts/deploy_output_test.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"state": "0x769671b481BA59414733BA95fe8aD2731d6652E6",
"smtLib": "0x0eD7ADB5073510b33A4Ea8A46246A4C5E387cE28",
"credentialIssuer": "0x51105993F8f07cd002c0CAbcd8F312b01E1A776E",
"poseidon2": "0x6d2994997201227c0120B0ee29155ec53f140254",
"poseidon3": "0x101670B36685997624496FF17432F2e69913307e",
"poseidon4": "0x1B95c292a8bD3F095A30B53850F2C2f4f540A252",
"network": "blockdag-testnet"
"state": "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124",
"smtLib": "0x313A7Bc601C3315929F0735f0a105361E454f7eD",
"credentialIssuer": "0x9108c8b0bD70F0279d979005e0a751FE9e44F099",
"poseidon2": "0xb21632C29F5F3885F20d1bE68D265331B43f3680",
"poseidon3": "0xb770eb12EeE4cD32B748e0cCA490B293194d91D6",
"poseidon4": "0x77D5A12146A82bF9BAf0E61284c212fE904AD28A",
"network": "amoy"
}
11 changes: 9 additions & 2 deletions contracts/scripts/getVC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,15 @@ async function main() {
`../deployed-contracts/ethereum.json`,
)

// const addresses = addressesJson.amoyAddresses;
const addresses = addressesJson.blockdagTestnetAddresses;
const networkName = process.env.HARDHAT_NETWORK || 'amoy';
const addressesByNetwork: Record<string, Record<string, string>> = {
amoy: addressesJson.amoy,
polygon: addressesJson.polygon,
};
const addresses = addressesByNetwork[networkName];
if (!addresses) {
throw new Error(`Unsupported network "${networkName}". Use "amoy" or "polygon".`);
}

const owner = (await ethers.getSigners())[0];
const ownerAddress = await owner.getAddress();
Expand Down