From f22a229ce66cfdbd9b9820ac5877996e9a266e0a Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Thu, 31 Oct 2024 14:25:41 +0100 Subject: [PATCH 01/11] Validator integration --- .vscode/settings.json | 22 + .../examples/BalanceCredentialIssuer.sol | 71 +- .../BalanceCredentialIssuerCringe.sol | 238 +++++ package-lock.json | 23 +- package.json | 4 +- scripts/deployBalanceCredentialIssuer.ts | 6 +- scripts/getUserIdFromStorage.ts | 21 + scripts/uniVerifier.abi.ts | 820 ++++++++++++++++++ .../BalanceCredentialIssuerDeployHelper.ts | 14 +- test/onchain-nonmerklized-identity/index.ts | 3 +- 10 files changed, 1182 insertions(+), 40 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 contracts/examples/BalanceCredentialIssuerCringe.sol create mode 100644 scripts/getUserIdFromStorage.ts create mode 100644 scripts/uniVerifier.abi.ts diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..958cbf0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,22 @@ +{ + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#7f40bf", + "activityBar.background": "#7f40bf", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#c78f58", + "activityBarBadge.foreground": "#15202b", + "commandCenter.border": "#e7e7e799", + "sash.hoverBorder": "#7f40bf", + "statusBar.background": "#663399", + "statusBar.foreground": "#e7e7e7", + "statusBarItem.hoverBackground": "#7f40bf", + "statusBarItem.remoteBackground": "#663399", + "statusBarItem.remoteForeground": "#e7e7e7", + "titleBar.activeBackground": "#663399", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveBackground": "#66339999", + "titleBar.inactiveForeground": "#e7e7e799" + }, + "peacock.color": "#639" +} diff --git a/contracts/examples/BalanceCredentialIssuer.sol b/contracts/examples/BalanceCredentialIssuer.sol index 8d63f35..e538cb8 100644 --- a/contracts/examples/BalanceCredentialIssuer.sol +++ b/contracts/examples/BalanceCredentialIssuer.sol @@ -9,6 +9,8 @@ import {NonMerklizedIssuerBase} from '@iden3/contracts/lib/NonMerklizedIssuerBas import {PrimitiveTypeUtils} from '@iden3/contracts/lib/PrimitiveTypeUtils.sol'; import {PoseidonUnit4L} from '@iden3/contracts/lib/Poseidon.sol'; import {IState} from '@iden3/contracts/interfaces/IState.sol'; +import {ICircuitValidator} from '@iden3/contracts/interfaces/ICircuitValidator.sol'; +import {IZKPVerifier} from '@iden3/contracts/interfaces/IZKPVerifier.sol'; /** * @dev Example of decentralized balance credential issuer. @@ -16,6 +18,10 @@ import {IState} from '@iden3/contracts/interfaces/IState.sol'; */ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradeable { using IdentityLib for IdentityLib.Data; + // IZKPVerifier internal _universalxVerifier; + ICircuitValidator internal _validator; + // IZKPVerifier internal _universalxVerifier; + IState internal _state; /// @custom:storage-location erc7201:polygonid.storage.BalanceCredentialIssuer struct BalanceCredentialIssuerStorage { @@ -51,11 +57,9 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradea // jsonldSchemaHash hash of jsonld schema. // More about schema: https://devs.polygonid.com/docs/issuer-node/issuer-node-api/claim/apis/#get-claims - uint256 private constant jsonldSchemaHash = 148834697620350657501993499321116864501; - string private constant jsonSchema = - 'https://gist.githubusercontent.com/ilya-korotya/e10cd79a8cc26ab6e40400a11838617e/raw/575edc33d485e2a4c806baad97e21117f3c90a9f/non-merklized-non-zero-balance.json'; - string private constant jsonldSchema = - 'https://gist.githubusercontent.com/ilya-korotya/660496c859f8d31a7d2a92ca5e970967/raw/6b5fc14fe630c17bfa52e05e08fdc8394c5ea0ce/non-merklized-non-zero-balance.jsonld'; + uint256 private constant jsonldSchemaHash = 102852920559964654297980198544873875695; + string private constant jsonSchema = 'ipfs://QmQinvQkq78TuxSqKxVqJjE36y6Zf3gFwfMC7PfxMDXsvW'; + string private constant jsonldSchema = 'ipfs://QmeoaM2GYroPzWK7kTnvNoer2QmmtESeT6EvnkVL8DJgyA'; struct ClaimItem { uint256 id; @@ -63,11 +67,39 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradea uint256[8] claim; } - function initialize(address _stateContractAddr) public initializer { + function initialize( + address _stateContractAddr, + // IZKPVerifier universalVerifier + ICircuitValidator validator + ) public initializer { super.initialize(_stateContractAddr, IState(_stateContractAddr).getDefaultIdType()); + // _universalVerifier = universalVerifier; + _state = IState(_stateContractAddr); + _validator = validator; __Ownable_init(_msgSender()); } + function submitZKPResponseV2( + IZKPVerifier.ZKPResponse[] memory responses, + bytes memory crossChainProofs + ) external { + require(responses.length == 1, 'Only one response is allowed'); + + // _universalVerifier.submitZKPResponseV2(responses, crossChainProofs); + ICircuitValidator.Signal[] memory signals = _validator.verifyV2( + responses[0].zkProof, + responses[0].data, + msg.sender, + _state + ); + + uint256 userId = signals[0].value; + + require(userId != 0, 'Invalid user id'); + + _issueCredential(userId); + } + /** * @dev Get user's id list of credentials * @param _userId - user id @@ -108,16 +140,17 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradea .CredentialData({ id: claimItem.id, context: jsonLDContextUrls, - _type: 'Balance', + _type: 'ETHAddress', issuanceDate: claimItem.issuanceDate, credentialSchema: INonMerklizedIssuer.CredentialSchema({ id: jsonSchema, _type: 'JsonSchema2023' }), - displayMethod: INonMerklizedIssuer.DisplayMethod({ - id: 'ipfs://QmS8eY8ZCiAAW8qgx3T6SQ3HDGeddwLZsjPXNAZExQwRY4', - _type: 'Iden3BasicDisplayMethodV1' - }) + displayMethod: INonMerklizedIssuer.DisplayMethod({id: '', _type: ''}) + // displayMethod: INonMerklizedIssuer.DisplayMethod({ + // id: 'ipfs://QmS8eY8ZCiAAW8qgx3T6SQ3HDGeddwLZsjPXNAZExQwRY4', + // _type: 'Iden3BasicDisplayMethodV1' + // }) }); return (credentialData, claimItem.claim, $.idToCredentialSubject[_credentialId]); } @@ -135,12 +168,12 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradea * @dev Issue credential with user's balance * @param _userId - user id for which the claim is issued */ - function issueCredential(uint256 _userId) public { + function _issueCredential(uint256 _userId) private { BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); uint64 expirationDate = convertTime(block.timestamp + 30 days); uint256 ownerAddress = PrimitiveTypeUtils.addressToUint256(msg.sender); - uint256 ownerBalance = msg.sender.balance; + // uint256 ownerBalance = msg.sender.balance; ClaimBuilder.ClaimData memory claimData = ClaimBuilder.ClaimData({ // metadata @@ -155,9 +188,9 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradea expirationDate: expirationDate, // data merklizedRoot: 0, - indexDataSlotA: ownerAddress, - indexDataSlotB: ownerBalance, - valueDataSlotA: 0, + indexDataSlotA: 0, + indexDataSlotB: 0, + valueDataSlotA: ownerAddress, valueDataSlotB: 0 }); uint256[8] memory claim = ClaimBuilder.build(claimData); @@ -171,9 +204,9 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradea claim: claim }); - $.idToCredentialSubject[$.countOfIssuedClaims].push( - INonMerklizedIssuer.SubjectField({key: 'balance', value: ownerBalance, rawValue: ''}) - ); + // $.idToCredentialSubject[$.countOfIssuedClaims].push( + // INonMerklizedIssuer.SubjectField({key: 'balance', value: ownerBalance, rawValue: ''}) + // ); $.idToCredentialSubject[$.countOfIssuedClaims].push( INonMerklizedIssuer.SubjectField({key: 'address', value: ownerAddress, rawValue: ''}) ); diff --git a/contracts/examples/BalanceCredentialIssuerCringe.sol b/contracts/examples/BalanceCredentialIssuerCringe.sol new file mode 100644 index 0000000..d3ba7c6 --- /dev/null +++ b/contracts/examples/BalanceCredentialIssuerCringe.sol @@ -0,0 +1,238 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity 0.8.27; + +import {Ownable2StepUpgradeable} from '@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol'; +import {ClaimBuilder} from '@iden3/contracts/lib/ClaimBuilder.sol'; +import {IdentityLib} from '@iden3/contracts/lib/IdentityLib.sol'; +import {INonMerklizedIssuer} from '@iden3/contracts/interfaces/INonMerklizedIssuer.sol'; +import {NonMerklizedIssuerBase} from '@iden3/contracts/lib/NonMerklizedIssuerBase.sol'; +import {PrimitiveTypeUtils} from '@iden3/contracts/lib/PrimitiveTypeUtils.sol'; +import {PoseidonUnit4L} from '@iden3/contracts/lib/Poseidon.sol'; +import {IState} from '@iden3/contracts/interfaces/IState.sol'; +import {ICircuitValidator} from '@iden3/contracts/interfaces/ICircuitValidator.sol'; +import {IZKPVerifier} from '@iden3/contracts/interfaces/IZKPVerifier.sol'; +// import {EmbeddedZKPVerifier} '@iden3/contracts/verifiers/EmbeddedZKPVerifier.sol'; + +/** + * @dev Example of decentralized balance credential issuer. + * This issuer issue non-merklized credentials decentralized. + */ +contract BalanceCredentialIssuerGringe is NonMerklizedIssuerBase, Ownable2StepUpgradeable { + using IdentityLib for IdentityLib.Data; + // IZKPVerifier internal _universalxVerifier; + ICircuitValidator internal _validator; + // IZKPVerifier internal _universalxVerifier; + IState internal _state; + + /// @custom:storage-location erc7201:polygonid.storage.BalanceCredentialIssuer + struct BalanceCredentialIssuerStorage { + // countOfIssuedClaims count of issued claims for incrementing id and revocation nonce for new claims + uint64 countOfIssuedClaims; + // claim store + mapping(uint256 => uint256[]) userClaims; + mapping(uint256 => ClaimItem) idToClaim; + // this mapping is used to store credential subject fields + // to escape additional copy in issueCredential function + // since "Copying of type struct OnchainNonMerklizedIdentityBase.SubjectField memory[] memory to storage not yet supported." + mapping(uint256 => INonMerklizedIssuer.SubjectField[]) idToCredentialSubject; + } + + // keccak256(abi.encode(uint256(keccak256("polygonid.storage.BalanceCredentialIssuer")) - 1)) & ~bytes32(uint256(0xff)) + bytes32 private constant BalanceCredentialIssuerStorageLocation = + 0xb775a0063b8bb6b7d39c4f74d1ce330eaeeb81ff68db2df91398ea2d7dc23900; + + function _getBalanceCredentialIssuerStorage() + private + pure + returns (BalanceCredentialIssuerStorage storage $) + { + assembly { + $.slot := BalanceCredentialIssuerStorageLocation + } + } + + /** + * @dev Version of contract + */ + string public constant VERSION = '1.0.0'; + + // jsonldSchemaHash hash of jsonld schema. + // More about schema: https://devs.polygonid.com/docs/issuer-node/issuer-node-api/claim/apis/#get-claims + uint256 private constant jsonldSchemaHash = 102852920559964654297980198544873875695; + string private constant jsonSchema = 'ipfs://QmQinvQkq78TuxSqKxVqJjE36y6Zf3gFwfMC7PfxMDXsvW'; + string private constant jsonldSchema = 'ipfs://QmeoaM2GYroPzWK7kTnvNoer2QmmtESeT6EvnkVL8DJgyA'; + + struct ClaimItem { + uint256 id; + uint64 issuanceDate; + uint256[8] claim; + } + + function initialize( + address _stateContractAddr, + // IZKPVerifier universalVerifier + ICircuitValidator validator + ) public initializer { + super.initialize(_stateContractAddr, IState(_stateContractAddr).getDefaultIdType()); + // _universalVerifier = universalVerifier; + _state = IState(_stateContractAddr); + _validator = validator; + __Ownable_init(_msgSender()); + } + + function submitZKPResponseV2( + IZKPVerifier.ZKPResponse[] memory responses, + bytes memory crossChainProofs + ) external { + require(responses.length == 1, 'Only one response is allowed'); + + // _universalVerifier.submitZKPResponseV2(responses, crossChainProofs); + ICircuitValidator.Signal[] memory signals = _validator.verifyV2( + responses[0].zkProof, + responses[0].data, + msg.sender, + _state + ); + + uint256 userId = signals[0].value; + + require(userId != 0, 'Invalid user id'); + + _issueCredential(userId); + } + + /** + * @dev Get user's id list of credentials + * @param _userId - user id + * @return array of credential ids + */ + function getUserCredentialIds(uint256 _userId) external view returns (uint256[] memory) { + BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); + return $.userClaims[_userId]; + } + + /** + * @dev Get credential by id + * @param _userId - user id + * @param _credentialId - credential id + * @return credential data + */ + function getCredential( + uint256 _userId, + uint256 _credentialId + ) + external + view + override + returns ( + INonMerklizedIssuer.CredentialData memory, + uint256[8] memory, + INonMerklizedIssuer.SubjectField[] memory + ) + { + BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); + + string[] memory jsonLDContextUrls = new string[](2); + jsonLDContextUrls[0] = jsonldSchema; + jsonLDContextUrls[1] = 'https://schema.iden3.io/core/jsonld/displayMethod.jsonld'; + + ClaimItem memory claimItem = $.idToClaim[_credentialId]; + INonMerklizedIssuer.CredentialData memory credentialData = INonMerklizedIssuer + .CredentialData({ + id: claimItem.id, + context: jsonLDContextUrls, + _type: 'ETHAddress', + issuanceDate: claimItem.issuanceDate, + credentialSchema: INonMerklizedIssuer.CredentialSchema({ + id: jsonSchema, + _type: 'JsonSchema2023' + }), + displayMethod: INonMerklizedIssuer.DisplayMethod({id: '', _type: ''}) + // displayMethod: INonMerklizedIssuer.DisplayMethod({ + // id: 'ipfs://QmS8eY8ZCiAAW8qgx3T6SQ3HDGeddwLZsjPXNAZExQwRY4', + // _type: 'Iden3BasicDisplayMethodV1' + // }) + }); + return (credentialData, claimItem.claim, $.idToCredentialSubject[_credentialId]); + } + + /** + * @dev Revoke claim using it's revocationNonce + * @param _revocationNonce - revocation nonce + */ + function revokeClaimAndTransit(uint64 _revocationNonce) public onlyOwner { + _getIdentityBaseStorage().identity.revokeClaim(_revocationNonce); + _getIdentityBaseStorage().identity.transitState(); + } + + /** + * @dev Issue credential with user's balance + * @param _userId - user id for which the claim is issued + */ + function _issueCredential(uint256 _userId) private { + BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); + + uint64 expirationDate = convertTime(block.timestamp + 30 days); + uint256 ownerAddress = PrimitiveTypeUtils.addressToUint256(msg.sender); + // uint256 ownerBalance = msg.sender.balance; + + ClaimBuilder.ClaimData memory claimData = ClaimBuilder.ClaimData({ + // metadata + schemaHash: jsonldSchemaHash, + idPosition: ClaimBuilder.ID_POSITION_INDEX, + expirable: true, + updatable: false, + merklizedRootPosition: 0, + version: 0, + id: _userId, + revocationNonce: $.countOfIssuedClaims, + expirationDate: expirationDate, + // data + merklizedRoot: 0, + indexDataSlotA: 0, + indexDataSlotB: 0, + valueDataSlotA: ownerAddress, + valueDataSlotB: 0 + }); + uint256[8] memory claim = ClaimBuilder.build(claimData); + + uint256 hashIndex = PoseidonUnit4L.poseidon([claim[0], claim[1], claim[2], claim[3]]); + uint256 hashValue = PoseidonUnit4L.poseidon([claim[4], claim[5], claim[6], claim[7]]); + + ClaimItem memory claimToSave = ClaimItem({ + id: $.countOfIssuedClaims, + issuanceDate: convertTime(block.timestamp), + claim: claim + }); + + // $.idToCredentialSubject[$.countOfIssuedClaims].push( + // INonMerklizedIssuer.SubjectField({key: 'balance', value: ownerBalance, rawValue: ''}) + // ); + $.idToCredentialSubject[$.countOfIssuedClaims].push( + INonMerklizedIssuer.SubjectField({key: 'address', value: ownerAddress, rawValue: ''}) + ); + + addClaimHashAndTransit(hashIndex, hashValue); + saveClaim(_userId, claimToSave); + } + + // saveClaim save a claim to storage + function saveClaim(uint256 _userId, ClaimItem memory _claim) private { + BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); + + $.userClaims[_userId].push($.countOfIssuedClaims); + $.idToClaim[$.countOfIssuedClaims] = _claim; + $.countOfIssuedClaims++; + } + + // addClaimHashAndTransit add a claim to the identity and transit state + function addClaimHashAndTransit(uint256 hashIndex, uint256 hashValue) private { + _getIdentityBaseStorage().identity.addClaimHash(hashIndex, hashValue); + _getIdentityBaseStorage().identity.transitState(); + } + + function convertTime(uint256 timestamp) private pure returns (uint64) { + require(timestamp <= type(uint64).max, 'Timestamp exceeds uint64 range'); + return uint64(timestamp); + } +} diff --git a/package-lock.json b/package-lock.json index 01a20ef..6513b17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "name": "contracts", "devDependencies": { "@0xpolygonid/js-sdk": "1.20.0", - "@iden3/contracts": "2.4.5", + "@iden3/contracts": "^2.4.5", "@iden3/js-crypto": "^1.1.0", "@iden3/js-iden3-core": "^1.4.1", "@iden3/js-jsonld-merklization": "1.4.1", @@ -39,16 +39,6 @@ "web3": "^4.7.0" } }, - "../../iden3/contracts/contracts": { - "name": "@iden3/contracts", - "version": "2.4.5", - "dev": true, - "license": "GPL-3.0", - "dependencies": { - "@openzeppelin/contracts": "^5.0.2", - "@openzeppelin/contracts-upgradeable": "^5.0.2" - } - }, "../../Iden3/contracts/contracts": { "name": "@iden3/contracts", "version": "2.3.1", @@ -1381,8 +1371,15 @@ } }, "node_modules/@iden3/contracts": { - "resolved": "../../iden3/contracts/contracts", - "link": true + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/@iden3/contracts/-/contracts-2.4.5.tgz", + "integrity": "sha512-9I+en+SC6DHaWKk3X1Ufc3La6ujJuE8QAY/TOU95oLFwKQO+7/Qp9i2a1FDc/IBW2MG3PRDrZ7hUozfUD/hqkw==", + "dev": true, + "license": "GPL-3.0", + "dependencies": { + "@openzeppelin/contracts": "^5.0.2", + "@openzeppelin/contracts-upgradeable": "^5.0.2" + } }, "node_modules/@iden3/js-crypto": { "version": "1.1.0", diff --git a/package.json b/package.json index 6007aad..1460994 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "name": "contracts", "devDependencies": { "@0xpolygonid/js-sdk": "1.20.0", - "@iden3/js-jsonld-merklization": "1.4.1", - "@iden3/contracts": "2.4.5", + "@iden3/contracts": "^2.4.5", "@iden3/js-crypto": "^1.1.0", "@iden3/js-iden3-core": "^1.4.1", + "@iden3/js-jsonld-merklization": "1.4.1", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "@nomicfoundation/hardhat-verify": "^2.0.5", "@openzeppelin/contracts": "^5.0.2", diff --git a/scripts/deployBalanceCredentialIssuer.ts b/scripts/deployBalanceCredentialIssuer.ts index ed97122..942f5f7 100644 --- a/scripts/deployBalanceCredentialIssuer.ts +++ b/scripts/deployBalanceCredentialIssuer.ts @@ -10,6 +10,8 @@ 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 universalVerifier = '0x1Df0B05F15b5ea9648B8a081aca8ad0dE065bD1F'; + const authV2Validator = '0x1a593E1aD3843b4363Dfa42585c4bBCA885553c0'; const owner = (await ethers.getSigners())[0]; const [poseidon2Elements, poseidon3Elements, poseidon4Elements] = await deployPoseidons( @@ -30,7 +32,8 @@ async function main() { smtLib, poseidon3Elements, poseidon4Elements, - stateAddress + stateAddress, + authV2Validator ); const balanceCredentialIssuer = contracts.balanceCredentialIssuer; @@ -42,6 +45,7 @@ async function main() { poseidon2: await poseidon2Elements.getAddress(), poseidon3: await poseidon3Elements.getAddress(), poseidon4: await poseidon4Elements.getAddress(), + authV2Validator, network: process.env.HARDHAT_NETWORK }; fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); diff --git a/scripts/getUserIdFromStorage.ts b/scripts/getUserIdFromStorage.ts new file mode 100644 index 0000000..9017362 --- /dev/null +++ b/scripts/getUserIdFromStorage.ts @@ -0,0 +1,21 @@ +import { ethers } from 'hardhat'; +import abi from './uniVerifier.abi'; + +async function main() { + const signer = (await ethers.getSigners())[0]; + const contract = await ethers.getContractAt(abi, '0x1Df0B05F15b5ea9648B8a081aca8ad0dE065bD1F'); + contract.connect(signer); + + const userId = await contract.getProofStorageField( + '0x2a75802212C3ba5E96afde9fD8e446aa6012a340', + 940499666, + 'userID' + ); + + console.log(userId); +} + +main().catch((error) => { + console.error(error); + process.exit(1); +}); diff --git a/scripts/uniVerifier.abi.ts b/scripts/uniVerifier.abi.ts new file mode 100644 index 0000000..c6d98c4 --- /dev/null +++ b/scripts/uniVerifier.abi.ts @@ -0,0 +1,820 @@ +export default [ + { + inputs: [], + name: 'InvalidInitialization', + type: 'error' + }, + { + inputs: [ + { + internalType: 'string', + name: 'message', + type: 'string' + }, + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + internalType: 'uint256', + name: 'linkID', + type: 'uint256' + }, + { + internalType: 'uint64', + name: 'requestIdToCompare', + type: 'uint64' + }, + { + internalType: 'uint256', + name: 'linkIdToCompare', + type: 'uint256' + } + ], + name: 'LinkedProofError', + type: 'error' + }, + { + inputs: [], + name: 'NotInitializing', + type: 'error' + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address' + } + ], + name: 'OwnableInvalidOwner', + type: 'error' + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address' + } + ], + name: 'OwnableUnauthorizedAccount', + type: 'error' + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint64', + name: 'version', + type: 'uint64' + } + ], + name: 'Initialized', + type: 'event' + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address' + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address' + } + ], + name: 'OwnershipTransferStarted', + 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' + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + indexed: true, + internalType: 'address', + name: 'requestOwner', + type: 'address' + }, + { + indexed: false, + internalType: 'string', + name: 'metadata', + type: 'string' + }, + { + indexed: false, + internalType: 'address', + name: 'validator', + type: 'address' + }, + { + indexed: false, + internalType: 'bytes', + name: 'data', + type: 'bytes' + } + ], + name: 'ZKPRequestSet', + type: 'event' + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + indexed: true, + internalType: 'address', + name: 'caller', + type: 'address' + } + ], + name: 'ZKPResponseSubmitted', + type: 'event' + }, + { + inputs: [], + name: 'REQUESTS_RETURN_LIMIT', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'VERSION', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'acceptOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'contract ICircuitValidator', + name: 'validator', + type: 'address' + } + ], + name: 'addValidatorToWhitelist', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'disableZKPRequest', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'enableZKPRequest', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address' + }, + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'getProofStatus', + outputs: [ + { + components: [ + { + internalType: 'bool', + name: 'isVerified', + type: 'bool' + }, + { + internalType: 'string', + name: 'validatorVersion', + type: 'string' + }, + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256' + }, + { + internalType: 'uint256', + name: 'blockTimestamp', + type: 'uint256' + } + ], + internalType: 'struct IZKPVerifier.ProofStatus', + name: '', + type: 'tuple' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'address', + name: 'user', + type: 'address' + }, + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + internalType: 'string', + name: 'key', + type: 'string' + } + ], + name: 'getProofStorageField', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'getRequestOwner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'getStateAddress', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'getZKPRequest', + outputs: [ + { + components: [ + { + internalType: 'string', + name: 'metadata', + type: 'string' + }, + { + internalType: 'contract ICircuitValidator', + name: 'validator', + type: 'address' + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes' + } + ], + internalType: 'struct IZKPVerifier.ZKPRequest', + name: 'zkpRequest', + type: 'tuple' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'startIndex', + type: 'uint256' + }, + { + internalType: 'uint256', + name: 'length', + type: 'uint256' + } + ], + name: 'getZKPRequests', + outputs: [ + { + components: [ + { + internalType: 'string', + name: 'metadata', + type: 'string' + }, + { + internalType: 'contract ICircuitValidator', + name: 'validator', + type: 'address' + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes' + } + ], + internalType: 'struct IZKPVerifier.ZKPRequest[]', + name: '', + type: 'tuple[]' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'getZKPRequestsCount', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'contract IState', + name: 'state', + type: 'address' + }, + { + internalType: 'address', + name: 'owner', + type: 'address' + } + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address' + }, + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'isProofVerified', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'contract ICircuitValidator', + name: 'validator', + type: 'address' + } + ], + name: 'isWhitelistedValidator', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'isZKPRequestEnabled', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [], + name: 'pendingOwner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'contract ICircuitValidator', + name: 'validator', + type: 'address' + } + ], + name: 'removeValidatorFromWhitelist', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + } + ], + name: 'requestIdExists', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool' + } + ], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + internalType: 'address', + name: 'requestOwner', + type: 'address' + } + ], + name: 'setRequestOwner', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'contract IState', + name: 'state', + type: 'address' + } + ], + name: 'setState', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + components: [ + { + internalType: 'string', + name: 'metadata', + type: 'string' + }, + { + internalType: 'contract ICircuitValidator', + name: 'validator', + type: 'address' + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes' + } + ], + internalType: 'struct IZKPVerifier.ZKPRequest', + name: 'request', + type: 'tuple' + } + ], + name: 'setZKPRequest', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + internalType: 'uint256[]', + name: 'inputs', + type: 'uint256[]' + }, + { + 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]' + } + ], + name: 'submitZKPResponse', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + components: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + internalType: 'bytes', + name: 'zkProof', + type: 'bytes' + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes' + } + ], + internalType: 'struct IZKPVerifier.ZKPResponse[]', + name: 'responses', + type: 'tuple[]' + }, + { + internalType: 'bytes', + name: 'crossChainProof', + type: 'bytes' + } + ], + name: 'submitZKPResponseV2', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address' + } + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address' + }, + { + internalType: 'uint64[]', + name: 'requestIds', + type: 'uint64[]' + } + ], + name: 'verifyLinkedProofs', + outputs: [], + stateMutability: 'view', + type: 'function' + }, + { + inputs: [ + { + internalType: 'uint64', + name: 'requestId', + type: 'uint64' + }, + { + internalType: 'uint256[]', + name: 'inputs', + type: 'uint256[]' + }, + { + 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: 'address', + name: 'sender', + type: 'address' + } + ], + name: 'verifyZKPResponse', + outputs: [ + { + components: [ + { + internalType: 'string', + name: 'key', + type: 'string' + }, + { + internalType: 'uint256', + name: 'inputIndex', + type: 'uint256' + } + ], + internalType: 'struct ICircuitValidator.KeyToInputIndex[]', + name: '', + type: 'tuple[]' + } + ], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [], + name: 'version', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string' + } + ], + stateMutability: 'pure', + type: 'function' + } +]; diff --git a/test/helpers/BalanceCredentialIssuerDeployHelper.ts b/test/helpers/BalanceCredentialIssuerDeployHelper.ts index 3936c55..a5e22d4 100644 --- a/test/helpers/BalanceCredentialIssuerDeployHelper.ts +++ b/test/helpers/BalanceCredentialIssuerDeployHelper.ts @@ -26,7 +26,8 @@ export class BalanceCredentialIssuerDeployHelper { smtLib: Contract, poseidon3: Contract, poseidon4: Contract, - stateContractAddress: string + stateContractAddress: string, + universalVerifierAddress: string ): Promise<{ balanceCredentialIssuer: Contract; }> { @@ -54,10 +55,15 @@ export class BalanceCredentialIssuerDeployHelper { ); const balanceCredentialIssuer = await upgrades.deployProxy( balanceCredentialIssuerFactory, - [stateContractAddress], + [stateContractAddress, universalVerifierAddress], { - initializer: 'initialize(address)', - unsafeAllow: ['external-library-linking', 'struct-definition', 'state-variable-assignment'] + initializer: 'initialize(address, address)', + unsafeAllow: [ + 'external-library-linking', + 'struct-definition', + 'state-variable-assignment', + 'delegatecall' + ] } ); await balanceCredentialIssuer.waitForDeployment(); diff --git a/test/onchain-nonmerklized-identity/index.ts b/test/onchain-nonmerklized-identity/index.ts index 0d693e9..d2677e9 100644 --- a/test/onchain-nonmerklized-identity/index.ts +++ b/test/onchain-nonmerklized-identity/index.ts @@ -17,7 +17,8 @@ describe('Reproduce identity life cycle', function () { stContracts.smtLib, stContracts.poseidon3, stContracts.poseidon4, - await stContracts.state.getAddress() + await stContracts.state.getAddress(), + '0x1Df0B05F15b5ea9648B8a081aca8ad0dE065bD1F' ); identity = contracts.balanceCredentialIssuer; }); From f5478d8c718d5438f2575562076845a7b99b100f Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Fri, 1 Nov 2024 10:52:19 +0100 Subject: [PATCH 02/11] Embedded verifier compile error --- .../examples/BalanceCredentialIssuer.sol | 40 ++- .../BalanceCredentialIssuerCringe.sol | 238 ------------------ scripts/deployBalanceCredentialIssuer.ts | 6 +- scripts/setRequest.ts | 52 ++++ .../BalanceCredentialIssuerDeployHelper.ts | 24 +- 5 files changed, 89 insertions(+), 271 deletions(-) delete mode 100644 contracts/examples/BalanceCredentialIssuerCringe.sol create mode 100644 scripts/setRequest.ts diff --git a/contracts/examples/BalanceCredentialIssuer.sol b/contracts/examples/BalanceCredentialIssuer.sol index e538cb8..6f22ca5 100644 --- a/contracts/examples/BalanceCredentialIssuer.sol +++ b/contracts/examples/BalanceCredentialIssuer.sol @@ -11,17 +11,18 @@ import {PoseidonUnit4L} from '@iden3/contracts/lib/Poseidon.sol'; import {IState} from '@iden3/contracts/interfaces/IState.sol'; import {ICircuitValidator} from '@iden3/contracts/interfaces/ICircuitValidator.sol'; import {IZKPVerifier} from '@iden3/contracts/interfaces/IZKPVerifier.sol'; +import {EmbeddedZKPVerifier} from '@iden3/contracts/verifiers/EmbeddedZKPVerifier.sol'; /** * @dev Example of decentralized balance credential issuer. * This issuer issue non-merklized credentials decentralized. */ -contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradeable { +contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier { using IdentityLib for IdentityLib.Data; // IZKPVerifier internal _universalxVerifier; - ICircuitValidator internal _validator; + // ICircuitValidator internal _validator; // IZKPVerifier internal _universalxVerifier; - IState internal _state; + // IState internal _state; /// @custom:storage-location erc7201:polygonid.storage.BalanceCredentialIssuer struct BalanceCredentialIssuerStorage { @@ -68,35 +69,24 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradea } function initialize( - address _stateContractAddr, + address _stateContractAddr + ) + public // IZKPVerifier universalVerifier - ICircuitValidator validator - ) public initializer { + // ICircuitValidator validator + initializer + { super.initialize(_stateContractAddr, IState(_stateContractAddr).getDefaultIdType()); // _universalVerifier = universalVerifier; - _state = IState(_stateContractAddr); - _validator = validator; - __Ownable_init(_msgSender()); + // _state = IState(_stateContractAddr); + // _validator = validator; + super.__EmbeddedZKPVerifier_init(_msgSender(), IState(_stateContractAddr)); } - function submitZKPResponseV2( - IZKPVerifier.ZKPResponse[] memory responses, - bytes memory crossChainProofs - ) external { + function _afterProofSubmitV2(IZKPVerifier.ZKPResponse[] memory responses) internal override { require(responses.length == 1, 'Only one response is allowed'); - - // _universalVerifier.submitZKPResponseV2(responses, crossChainProofs); - ICircuitValidator.Signal[] memory signals = _validator.verifyV2( - responses[0].zkProof, - responses[0].data, - msg.sender, - _state - ); - - uint256 userId = signals[0].value; - + uint256 userId = super.getProofStorageField(_msgSender(), responses[0].requestId, 'userID'); require(userId != 0, 'Invalid user id'); - _issueCredential(userId); } diff --git a/contracts/examples/BalanceCredentialIssuerCringe.sol b/contracts/examples/BalanceCredentialIssuerCringe.sol deleted file mode 100644 index d3ba7c6..0000000 --- a/contracts/examples/BalanceCredentialIssuerCringe.sol +++ /dev/null @@ -1,238 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity 0.8.27; - -import {Ownable2StepUpgradeable} from '@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol'; -import {ClaimBuilder} from '@iden3/contracts/lib/ClaimBuilder.sol'; -import {IdentityLib} from '@iden3/contracts/lib/IdentityLib.sol'; -import {INonMerklizedIssuer} from '@iden3/contracts/interfaces/INonMerklizedIssuer.sol'; -import {NonMerklizedIssuerBase} from '@iden3/contracts/lib/NonMerklizedIssuerBase.sol'; -import {PrimitiveTypeUtils} from '@iden3/contracts/lib/PrimitiveTypeUtils.sol'; -import {PoseidonUnit4L} from '@iden3/contracts/lib/Poseidon.sol'; -import {IState} from '@iden3/contracts/interfaces/IState.sol'; -import {ICircuitValidator} from '@iden3/contracts/interfaces/ICircuitValidator.sol'; -import {IZKPVerifier} from '@iden3/contracts/interfaces/IZKPVerifier.sol'; -// import {EmbeddedZKPVerifier} '@iden3/contracts/verifiers/EmbeddedZKPVerifier.sol'; - -/** - * @dev Example of decentralized balance credential issuer. - * This issuer issue non-merklized credentials decentralized. - */ -contract BalanceCredentialIssuerGringe is NonMerklizedIssuerBase, Ownable2StepUpgradeable { - using IdentityLib for IdentityLib.Data; - // IZKPVerifier internal _universalxVerifier; - ICircuitValidator internal _validator; - // IZKPVerifier internal _universalxVerifier; - IState internal _state; - - /// @custom:storage-location erc7201:polygonid.storage.BalanceCredentialIssuer - struct BalanceCredentialIssuerStorage { - // countOfIssuedClaims count of issued claims for incrementing id and revocation nonce for new claims - uint64 countOfIssuedClaims; - // claim store - mapping(uint256 => uint256[]) userClaims; - mapping(uint256 => ClaimItem) idToClaim; - // this mapping is used to store credential subject fields - // to escape additional copy in issueCredential function - // since "Copying of type struct OnchainNonMerklizedIdentityBase.SubjectField memory[] memory to storage not yet supported." - mapping(uint256 => INonMerklizedIssuer.SubjectField[]) idToCredentialSubject; - } - - // keccak256(abi.encode(uint256(keccak256("polygonid.storage.BalanceCredentialIssuer")) - 1)) & ~bytes32(uint256(0xff)) - bytes32 private constant BalanceCredentialIssuerStorageLocation = - 0xb775a0063b8bb6b7d39c4f74d1ce330eaeeb81ff68db2df91398ea2d7dc23900; - - function _getBalanceCredentialIssuerStorage() - private - pure - returns (BalanceCredentialIssuerStorage storage $) - { - assembly { - $.slot := BalanceCredentialIssuerStorageLocation - } - } - - /** - * @dev Version of contract - */ - string public constant VERSION = '1.0.0'; - - // jsonldSchemaHash hash of jsonld schema. - // More about schema: https://devs.polygonid.com/docs/issuer-node/issuer-node-api/claim/apis/#get-claims - uint256 private constant jsonldSchemaHash = 102852920559964654297980198544873875695; - string private constant jsonSchema = 'ipfs://QmQinvQkq78TuxSqKxVqJjE36y6Zf3gFwfMC7PfxMDXsvW'; - string private constant jsonldSchema = 'ipfs://QmeoaM2GYroPzWK7kTnvNoer2QmmtESeT6EvnkVL8DJgyA'; - - struct ClaimItem { - uint256 id; - uint64 issuanceDate; - uint256[8] claim; - } - - function initialize( - address _stateContractAddr, - // IZKPVerifier universalVerifier - ICircuitValidator validator - ) public initializer { - super.initialize(_stateContractAddr, IState(_stateContractAddr).getDefaultIdType()); - // _universalVerifier = universalVerifier; - _state = IState(_stateContractAddr); - _validator = validator; - __Ownable_init(_msgSender()); - } - - function submitZKPResponseV2( - IZKPVerifier.ZKPResponse[] memory responses, - bytes memory crossChainProofs - ) external { - require(responses.length == 1, 'Only one response is allowed'); - - // _universalVerifier.submitZKPResponseV2(responses, crossChainProofs); - ICircuitValidator.Signal[] memory signals = _validator.verifyV2( - responses[0].zkProof, - responses[0].data, - msg.sender, - _state - ); - - uint256 userId = signals[0].value; - - require(userId != 0, 'Invalid user id'); - - _issueCredential(userId); - } - - /** - * @dev Get user's id list of credentials - * @param _userId - user id - * @return array of credential ids - */ - function getUserCredentialIds(uint256 _userId) external view returns (uint256[] memory) { - BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); - return $.userClaims[_userId]; - } - - /** - * @dev Get credential by id - * @param _userId - user id - * @param _credentialId - credential id - * @return credential data - */ - function getCredential( - uint256 _userId, - uint256 _credentialId - ) - external - view - override - returns ( - INonMerklizedIssuer.CredentialData memory, - uint256[8] memory, - INonMerklizedIssuer.SubjectField[] memory - ) - { - BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); - - string[] memory jsonLDContextUrls = new string[](2); - jsonLDContextUrls[0] = jsonldSchema; - jsonLDContextUrls[1] = 'https://schema.iden3.io/core/jsonld/displayMethod.jsonld'; - - ClaimItem memory claimItem = $.idToClaim[_credentialId]; - INonMerklizedIssuer.CredentialData memory credentialData = INonMerklizedIssuer - .CredentialData({ - id: claimItem.id, - context: jsonLDContextUrls, - _type: 'ETHAddress', - issuanceDate: claimItem.issuanceDate, - credentialSchema: INonMerklizedIssuer.CredentialSchema({ - id: jsonSchema, - _type: 'JsonSchema2023' - }), - displayMethod: INonMerklizedIssuer.DisplayMethod({id: '', _type: ''}) - // displayMethod: INonMerklizedIssuer.DisplayMethod({ - // id: 'ipfs://QmS8eY8ZCiAAW8qgx3T6SQ3HDGeddwLZsjPXNAZExQwRY4', - // _type: 'Iden3BasicDisplayMethodV1' - // }) - }); - return (credentialData, claimItem.claim, $.idToCredentialSubject[_credentialId]); - } - - /** - * @dev Revoke claim using it's revocationNonce - * @param _revocationNonce - revocation nonce - */ - function revokeClaimAndTransit(uint64 _revocationNonce) public onlyOwner { - _getIdentityBaseStorage().identity.revokeClaim(_revocationNonce); - _getIdentityBaseStorage().identity.transitState(); - } - - /** - * @dev Issue credential with user's balance - * @param _userId - user id for which the claim is issued - */ - function _issueCredential(uint256 _userId) private { - BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); - - uint64 expirationDate = convertTime(block.timestamp + 30 days); - uint256 ownerAddress = PrimitiveTypeUtils.addressToUint256(msg.sender); - // uint256 ownerBalance = msg.sender.balance; - - ClaimBuilder.ClaimData memory claimData = ClaimBuilder.ClaimData({ - // metadata - schemaHash: jsonldSchemaHash, - idPosition: ClaimBuilder.ID_POSITION_INDEX, - expirable: true, - updatable: false, - merklizedRootPosition: 0, - version: 0, - id: _userId, - revocationNonce: $.countOfIssuedClaims, - expirationDate: expirationDate, - // data - merklizedRoot: 0, - indexDataSlotA: 0, - indexDataSlotB: 0, - valueDataSlotA: ownerAddress, - valueDataSlotB: 0 - }); - uint256[8] memory claim = ClaimBuilder.build(claimData); - - uint256 hashIndex = PoseidonUnit4L.poseidon([claim[0], claim[1], claim[2], claim[3]]); - uint256 hashValue = PoseidonUnit4L.poseidon([claim[4], claim[5], claim[6], claim[7]]); - - ClaimItem memory claimToSave = ClaimItem({ - id: $.countOfIssuedClaims, - issuanceDate: convertTime(block.timestamp), - claim: claim - }); - - // $.idToCredentialSubject[$.countOfIssuedClaims].push( - // INonMerklizedIssuer.SubjectField({key: 'balance', value: ownerBalance, rawValue: ''}) - // ); - $.idToCredentialSubject[$.countOfIssuedClaims].push( - INonMerklizedIssuer.SubjectField({key: 'address', value: ownerAddress, rawValue: ''}) - ); - - addClaimHashAndTransit(hashIndex, hashValue); - saveClaim(_userId, claimToSave); - } - - // saveClaim save a claim to storage - function saveClaim(uint256 _userId, ClaimItem memory _claim) private { - BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); - - $.userClaims[_userId].push($.countOfIssuedClaims); - $.idToClaim[$.countOfIssuedClaims] = _claim; - $.countOfIssuedClaims++; - } - - // addClaimHashAndTransit add a claim to the identity and transit state - function addClaimHashAndTransit(uint256 hashIndex, uint256 hashValue) private { - _getIdentityBaseStorage().identity.addClaimHash(hashIndex, hashValue); - _getIdentityBaseStorage().identity.transitState(); - } - - function convertTime(uint256 timestamp) private pure returns (uint64) { - require(timestamp <= type(uint64).max, 'Timestamp exceeds uint64 range'); - return uint64(timestamp); - } -} diff --git a/scripts/deployBalanceCredentialIssuer.ts b/scripts/deployBalanceCredentialIssuer.ts index 942f5f7..7e68c21 100644 --- a/scripts/deployBalanceCredentialIssuer.ts +++ b/scripts/deployBalanceCredentialIssuer.ts @@ -11,7 +11,7 @@ async function main() { // const stateAddress = '0x134b1be34911e39a8397ec6289782989729807a4'; // current iden3 state smart contract on mumbai const stateAddress = '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124'; // current iden3 state smart contract on amoy // const universalVerifier = '0x1Df0B05F15b5ea9648B8a081aca8ad0dE065bD1F'; - const authV2Validator = '0x1a593E1aD3843b4363Dfa42585c4bBCA885553c0'; + // const authV2Validator = '0x1a593E1aD3843b4363Dfa42585c4bBCA885553c0'; const owner = (await ethers.getSigners())[0]; const [poseidon2Elements, poseidon3Elements, poseidon4Elements] = await deployPoseidons( @@ -33,7 +33,7 @@ async function main() { poseidon3Elements, poseidon4Elements, stateAddress, - authV2Validator + // authV2Validator ); const balanceCredentialIssuer = contracts.balanceCredentialIssuer; @@ -45,7 +45,7 @@ async function main() { poseidon2: await poseidon2Elements.getAddress(), poseidon3: await poseidon3Elements.getAddress(), poseidon4: await poseidon4Elements.getAddress(), - authV2Validator, + // authV2Validator, network: process.env.HARDHAT_NETWORK }; fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); diff --git a/scripts/setRequest.ts b/scripts/setRequest.ts new file mode 100644 index 0000000..9594642 --- /dev/null +++ b/scripts/setRequest.ts @@ -0,0 +1,52 @@ +import { ethers } from 'hardhat'; +import { byteEncoder, CircuitId } from '@0xpolygonid/js-sdk'; +import { Hex } from '@iden3/js-crypto'; + +export function getAuthV2RequestId(): number { + const circuitHash = ethers.keccak256(byteEncoder.encode(CircuitId.AuthV2)); + const dataView = new DataView(Hex.decodeString(circuitHash.replace('0x', '')).buffer); + const id = dataView.getUint32(0); + return id; +} + +async function main() { + // const chainId = hre.network.config.chainId; + // const network = hre.network.name; + + // const methodId = "ade09fcd"; + + const verifier = await ethers.getContractAt( + 'BalanceCredentialIssuer', + '0x98F122a0CDa16d39F1Fb1D7589e846466ec9e630' + ); + + const requestId = getAuthV2RequestId(); + + const requestIdExists = await verifier.requestIdExists(requestId); + if (requestIdExists) { + throw new Error(`Request ID: ${requestId} already exists`); + } + + const tx = await verifier.setZKPRequest( + requestId, + { + metadata: '0x', + validator: '0x1a593E1aD3843b4363Dfa42585c4bBCA885553c0', + data: '0x' + } + // { + // gasPrice: 50000000000, + // initialBaseFeePerGas: 25000000000, + // gasLimit: 10000000, + // }, + ); + + console.log(`Request ID: ${requestId} is set in tx: ${tx.hash}`); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/test/helpers/BalanceCredentialIssuerDeployHelper.ts b/test/helpers/BalanceCredentialIssuerDeployHelper.ts index a5e22d4..d69caa2 100644 --- a/test/helpers/BalanceCredentialIssuerDeployHelper.ts +++ b/test/helpers/BalanceCredentialIssuerDeployHelper.ts @@ -22,12 +22,23 @@ export class BalanceCredentialIssuerDeployHelper { return new BalanceCredentialIssuerDeployHelper(sgrs, enableLogging); } + async deployVerifierLib(): Promise { + const contractName = 'VerifierLib'; + + const verifierLib = await ethers.deployContract(contractName); + await verifierLib.waitForDeployment(); + + console.log(`${contractName} deployed to: ${await verifierLib.getAddress()}`); + + return verifierLib; + } + async deployBalanceCredentialIssuer( smtLib: Contract, poseidon3: Contract, poseidon4: Contract, - stateContractAddress: string, - universalVerifierAddress: string + stateContractAddress: string + // universalVerifierAddress: string ): Promise<{ balanceCredentialIssuer: Contract; }> { @@ -43,21 +54,24 @@ export class BalanceCredentialIssuerDeployHelper { true ); + const verifierLib = await this.deployVerifierLib(); + const balanceCredentialIssuerFactory = await ethers.getContractFactory( 'BalanceCredentialIssuer', { libraries: { ClaimBuilder: await cb.getAddress(), IdentityLib: await il.getAddress(), - PoseidonUnit4L: await poseidon4.getAddress() + PoseidonUnit4L: await poseidon4.getAddress(), + VerifierLib: await verifierLib.getAddress() } } ); const balanceCredentialIssuer = await upgrades.deployProxy( balanceCredentialIssuerFactory, - [stateContractAddress, universalVerifierAddress], + [stateContractAddress], { - initializer: 'initialize(address, address)', + initializer: 'initialize(address)', unsafeAllow: [ 'external-library-linking', 'struct-definition', From 22be50ee705e1a09d3683e8858e2323f337ce40e Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Wed, 6 Nov 2024 06:52:18 +0100 Subject: [PATCH 03/11] Add examples --- .../AddressOwnershipCredentialIssuer.sol | 209 ++++++++++++++++++ .../examples/BalanceCredentialIssuer.sol | 65 ++---- .../deployAddressOwnershipCredentialIssuer.ts | 52 +++++ scripts/deployBalanceCredentialIssuer.ts | 9 +- ...uests-AddressOwnershipCredentialIssuer.ts} | 9 +- ...lIssuerDeployHelper.ts => DeployHelper.ts} | 67 +++++- test/onchain-nonmerklized-identity/index.ts | 4 +- 7 files changed, 346 insertions(+), 69 deletions(-) create mode 100644 contracts/examples/AddressOwnershipCredentialIssuer.sol create mode 100644 scripts/deployAddressOwnershipCredentialIssuer.ts rename scripts/{setRequest.ts => setRequests-AddressOwnershipCredentialIssuer.ts} (85%) rename test/helpers/{BalanceCredentialIssuerDeployHelper.ts => DeployHelper.ts} (56%) diff --git a/contracts/examples/AddressOwnershipCredentialIssuer.sol b/contracts/examples/AddressOwnershipCredentialIssuer.sol new file mode 100644 index 0000000..1128680 --- /dev/null +++ b/contracts/examples/AddressOwnershipCredentialIssuer.sol @@ -0,0 +1,209 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity 0.8.27; + +import {Ownable2StepUpgradeable} from '@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol'; +import {ClaimBuilder} from '@iden3/contracts/lib/ClaimBuilder.sol'; +import {IdentityLib} from '@iden3/contracts/lib/IdentityLib.sol'; +import {INonMerklizedIssuer} from '@iden3/contracts/interfaces/INonMerklizedIssuer.sol'; +import {NonMerklizedIssuerBase} from '@iden3/contracts/lib/NonMerklizedIssuerBase.sol'; +import {PrimitiveTypeUtils} from '@iden3/contracts/lib/PrimitiveTypeUtils.sol'; +import {PoseidonUnit4L} from '@iden3/contracts/lib/Poseidon.sol'; +import {IState} from '@iden3/contracts/interfaces/IState.sol'; +import {ICircuitValidator} from '@iden3/contracts/interfaces/ICircuitValidator.sol'; +import {IZKPVerifier} from '@iden3/contracts/interfaces/IZKPVerifier.sol'; +import {EmbeddedZKPVerifier} from '@iden3/contracts/verifiers/EmbeddedZKPVerifier.sol'; + +/** + * @dev Example of decentralized address ownership credential issuer. + * This issuer issue non-merklized credentials decentralized. + */ +contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier { + using IdentityLib for IdentityLib.Data; + + /// @custom:storage-location erc7201:polygonid.storage.AddressOwnershipCredentialIssuer + struct AddressOwnershipCredentialIssuerStorage { + // countOfIssuedClaims count of issued claims for incrementing id and revocation nonce for new claims + uint64 countOfIssuedClaims; + // claim store + mapping(uint256 => uint256[]) userClaims; + mapping(uint256 => ClaimItem) idToClaim; + // this mapping is used to store credential subject fields + // to escape additional copy in issueCredential function + // since "Copying of type struct OnchainNonMerklizedIdentityBase.SubjectField memory[] memory to storage not yet supported." + mapping(uint256 => INonMerklizedIssuer.SubjectField[]) idToCredentialSubject; + } + + // keccak256(abi.encode(uint256(keccak256("polygonid.storage.AddressOwnershipCredentialIssuer")) - 1)) & ~bytes32(uint256(0xff)) + bytes32 private constant AddressOwnershipCredentialIssuerStorageLocation = + 0x22f8eab823b6ffeb446a93f3407b8c82ce671dc5032c94405f1f3d062796c600; + + function _getAddressOwnershipCredentialIssuerStorage() + private + pure + returns (AddressOwnershipCredentialIssuerStorage storage $) + { + assembly { + $.slot := AddressOwnershipCredentialIssuerStorageLocation + } + } + + /** + * @dev Version of contract + */ + string public constant VERSION = '1.0.0'; + + // jsonldSchemaHash hash of jsonld schema. + // More about schema: https://devs.polygonid.com/docs/issuer-node/issuer-node-api/claim/apis/#get-claims + uint256 private constant jsonldSchemaHash = 102852920559964654297980198544873875695; + string private constant jsonSchema = 'ipfs://QmQinvQkq78TuxSqKxVqJjE36y6Zf3gFwfMC7PfxMDXsvW'; + string private constant jsonldSchema = 'ipfs://QmeoaM2GYroPzWK7kTnvNoer2QmmtESeT6EvnkVL8DJgyA'; + + struct ClaimItem { + uint256 id; + uint64 issuanceDate; + uint256[8] claim; + } + + function initialize(address _stateContractAddr) public initializer { + super.initialize(_stateContractAddr, IState(_stateContractAddr).getDefaultIdType()); + super.__EmbeddedZKPVerifier_init(_msgSender(), IState(_stateContractAddr)); + } + + function _afterProofSubmitV2(IZKPVerifier.ZKPResponse[] memory responses) internal override { + require(responses.length == 1, 'Only one response is allowed'); + uint256 userId = super.getProofStorageField(_msgSender(), responses[0].requestId, 'userID'); + require(userId != 0, 'Invalid user id'); + _issueCredential(userId); + } + + /** + * @dev Get user's id list of credentials + * @param _userId - user id + * @return array of credential ids + */ + function getUserCredentialIds(uint256 _userId) external view returns (uint256[] memory) { + AddressOwnershipCredentialIssuerStorage + storage $ = _getAddressOwnershipCredentialIssuerStorage(); + return $.userClaims[_userId]; + } + + /** + * @dev Get credential by id + * @param _userId - user id + * @param _credentialId - credential id + * @return credential data + */ + function getCredential( + uint256 _userId, + uint256 _credentialId + ) + external + view + override + returns ( + INonMerklizedIssuer.CredentialData memory, + uint256[8] memory, + INonMerklizedIssuer.SubjectField[] memory + ) + { + AddressOwnershipCredentialIssuerStorage + storage $ = _getAddressOwnershipCredentialIssuerStorage(); + + string[] memory jsonLDContextUrls = new string[](2); + jsonLDContextUrls[0] = jsonldSchema; + jsonLDContextUrls[1] = 'https://schema.iden3.io/core/jsonld/displayMethod.jsonld'; + + ClaimItem memory claimItem = $.idToClaim[_credentialId]; + INonMerklizedIssuer.CredentialData memory credentialData = INonMerklizedIssuer + .CredentialData({ + id: claimItem.id, + context: jsonLDContextUrls, + _type: 'ETHAddress', + issuanceDate: claimItem.issuanceDate, + credentialSchema: INonMerklizedIssuer.CredentialSchema({ + id: jsonSchema, + _type: 'JsonSchema2023' + }), + displayMethod: INonMerklizedIssuer.DisplayMethod({id: '', _type: ''}) + }); + return (credentialData, claimItem.claim, $.idToCredentialSubject[_credentialId]); + } + + /** + * @dev Revoke claim using it's revocationNonce + * @param _revocationNonce - revocation nonce + */ + function revokeClaimAndTransit(uint64 _revocationNonce) public onlyOwner { + _getIdentityBaseStorage().identity.revokeClaim(_revocationNonce); + _getIdentityBaseStorage().identity.transitState(); + } + + /** + * @dev Issue credential with user's balance + * @param _userId - user id for which the claim is issued + */ + function _issueCredential(uint256 _userId) private { + AddressOwnershipCredentialIssuerStorage + storage $ = _getAddressOwnershipCredentialIssuerStorage(); + + uint64 expirationDate = convertTime(block.timestamp + 30 days); + uint256 ownerAddress = PrimitiveTypeUtils.addressToUint256(msg.sender); + // uint256 ownerBalance = msg.sender.balance; + + ClaimBuilder.ClaimData memory claimData = ClaimBuilder.ClaimData({ + // metadata + schemaHash: jsonldSchemaHash, + idPosition: ClaimBuilder.ID_POSITION_INDEX, + expirable: true, + updatable: false, + merklizedRootPosition: 0, + version: 0, + id: _userId, + revocationNonce: $.countOfIssuedClaims, + expirationDate: expirationDate, + // data + merklizedRoot: 0, + indexDataSlotA: 0, + indexDataSlotB: 0, + valueDataSlotA: ownerAddress, + valueDataSlotB: 0 + }); + uint256[8] memory claim = ClaimBuilder.build(claimData); + + uint256 hashIndex = PoseidonUnit4L.poseidon([claim[0], claim[1], claim[2], claim[3]]); + uint256 hashValue = PoseidonUnit4L.poseidon([claim[4], claim[5], claim[6], claim[7]]); + + ClaimItem memory claimToSave = ClaimItem({ + id: $.countOfIssuedClaims, + issuanceDate: convertTime(block.timestamp), + claim: claim + }); + $.idToCredentialSubject[$.countOfIssuedClaims].push( + INonMerklizedIssuer.SubjectField({key: 'address', value: ownerAddress, rawValue: ''}) + ); + + addClaimHashAndTransit(hashIndex, hashValue); + saveClaim(_userId, claimToSave); + } + + // saveClaim save a claim to storage + function saveClaim(uint256 _userId, ClaimItem memory _claim) private { + AddressOwnershipCredentialIssuerStorage + storage $ = _getAddressOwnershipCredentialIssuerStorage(); + + $.userClaims[_userId].push($.countOfIssuedClaims); + $.idToClaim[$.countOfIssuedClaims] = _claim; + $.countOfIssuedClaims++; + } + + // addClaimHashAndTransit add a claim to the identity and transit state + function addClaimHashAndTransit(uint256 hashIndex, uint256 hashValue) private { + _getIdentityBaseStorage().identity.addClaimHash(hashIndex, hashValue); + _getIdentityBaseStorage().identity.transitState(); + } + + function convertTime(uint256 timestamp) private pure returns (uint64) { + require(timestamp <= type(uint64).max, 'Timestamp exceeds uint64 range'); + return uint64(timestamp); + } +} diff --git a/contracts/examples/BalanceCredentialIssuer.sol b/contracts/examples/BalanceCredentialIssuer.sol index 6f22ca5..8d63f35 100644 --- a/contracts/examples/BalanceCredentialIssuer.sol +++ b/contracts/examples/BalanceCredentialIssuer.sol @@ -9,20 +9,13 @@ import {NonMerklizedIssuerBase} from '@iden3/contracts/lib/NonMerklizedIssuerBas import {PrimitiveTypeUtils} from '@iden3/contracts/lib/PrimitiveTypeUtils.sol'; import {PoseidonUnit4L} from '@iden3/contracts/lib/Poseidon.sol'; import {IState} from '@iden3/contracts/interfaces/IState.sol'; -import {ICircuitValidator} from '@iden3/contracts/interfaces/ICircuitValidator.sol'; -import {IZKPVerifier} from '@iden3/contracts/interfaces/IZKPVerifier.sol'; -import {EmbeddedZKPVerifier} from '@iden3/contracts/verifiers/EmbeddedZKPVerifier.sol'; /** * @dev Example of decentralized balance credential issuer. * This issuer issue non-merklized credentials decentralized. */ -contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier { +contract BalanceCredentialIssuer is NonMerklizedIssuerBase, Ownable2StepUpgradeable { using IdentityLib for IdentityLib.Data; - // IZKPVerifier internal _universalxVerifier; - // ICircuitValidator internal _validator; - // IZKPVerifier internal _universalxVerifier; - // IState internal _state; /// @custom:storage-location erc7201:polygonid.storage.BalanceCredentialIssuer struct BalanceCredentialIssuerStorage { @@ -58,9 +51,11 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier // jsonldSchemaHash hash of jsonld schema. // More about schema: https://devs.polygonid.com/docs/issuer-node/issuer-node-api/claim/apis/#get-claims - uint256 private constant jsonldSchemaHash = 102852920559964654297980198544873875695; - string private constant jsonSchema = 'ipfs://QmQinvQkq78TuxSqKxVqJjE36y6Zf3gFwfMC7PfxMDXsvW'; - string private constant jsonldSchema = 'ipfs://QmeoaM2GYroPzWK7kTnvNoer2QmmtESeT6EvnkVL8DJgyA'; + uint256 private constant jsonldSchemaHash = 148834697620350657501993499321116864501; + string private constant jsonSchema = + 'https://gist.githubusercontent.com/ilya-korotya/e10cd79a8cc26ab6e40400a11838617e/raw/575edc33d485e2a4c806baad97e21117f3c90a9f/non-merklized-non-zero-balance.json'; + string private constant jsonldSchema = + 'https://gist.githubusercontent.com/ilya-korotya/660496c859f8d31a7d2a92ca5e970967/raw/6b5fc14fe630c17bfa52e05e08fdc8394c5ea0ce/non-merklized-non-zero-balance.jsonld'; struct ClaimItem { uint256 id; @@ -68,26 +63,9 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier uint256[8] claim; } - function initialize( - address _stateContractAddr - ) - public - // IZKPVerifier universalVerifier - // ICircuitValidator validator - initializer - { + function initialize(address _stateContractAddr) public initializer { super.initialize(_stateContractAddr, IState(_stateContractAddr).getDefaultIdType()); - // _universalVerifier = universalVerifier; - // _state = IState(_stateContractAddr); - // _validator = validator; - super.__EmbeddedZKPVerifier_init(_msgSender(), IState(_stateContractAddr)); - } - - function _afterProofSubmitV2(IZKPVerifier.ZKPResponse[] memory responses) internal override { - require(responses.length == 1, 'Only one response is allowed'); - uint256 userId = super.getProofStorageField(_msgSender(), responses[0].requestId, 'userID'); - require(userId != 0, 'Invalid user id'); - _issueCredential(userId); + __Ownable_init(_msgSender()); } /** @@ -130,17 +108,16 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier .CredentialData({ id: claimItem.id, context: jsonLDContextUrls, - _type: 'ETHAddress', + _type: 'Balance', issuanceDate: claimItem.issuanceDate, credentialSchema: INonMerklizedIssuer.CredentialSchema({ id: jsonSchema, _type: 'JsonSchema2023' }), - displayMethod: INonMerklizedIssuer.DisplayMethod({id: '', _type: ''}) - // displayMethod: INonMerklizedIssuer.DisplayMethod({ - // id: 'ipfs://QmS8eY8ZCiAAW8qgx3T6SQ3HDGeddwLZsjPXNAZExQwRY4', - // _type: 'Iden3BasicDisplayMethodV1' - // }) + displayMethod: INonMerklizedIssuer.DisplayMethod({ + id: 'ipfs://QmS8eY8ZCiAAW8qgx3T6SQ3HDGeddwLZsjPXNAZExQwRY4', + _type: 'Iden3BasicDisplayMethodV1' + }) }); return (credentialData, claimItem.claim, $.idToCredentialSubject[_credentialId]); } @@ -158,12 +135,12 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier * @dev Issue credential with user's balance * @param _userId - user id for which the claim is issued */ - function _issueCredential(uint256 _userId) private { + function issueCredential(uint256 _userId) public { BalanceCredentialIssuerStorage storage $ = _getBalanceCredentialIssuerStorage(); uint64 expirationDate = convertTime(block.timestamp + 30 days); uint256 ownerAddress = PrimitiveTypeUtils.addressToUint256(msg.sender); - // uint256 ownerBalance = msg.sender.balance; + uint256 ownerBalance = msg.sender.balance; ClaimBuilder.ClaimData memory claimData = ClaimBuilder.ClaimData({ // metadata @@ -178,9 +155,9 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier expirationDate: expirationDate, // data merklizedRoot: 0, - indexDataSlotA: 0, - indexDataSlotB: 0, - valueDataSlotA: ownerAddress, + indexDataSlotA: ownerAddress, + indexDataSlotB: ownerBalance, + valueDataSlotA: 0, valueDataSlotB: 0 }); uint256[8] memory claim = ClaimBuilder.build(claimData); @@ -194,9 +171,9 @@ contract BalanceCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier claim: claim }); - // $.idToCredentialSubject[$.countOfIssuedClaims].push( - // INonMerklizedIssuer.SubjectField({key: 'balance', value: ownerBalance, rawValue: ''}) - // ); + $.idToCredentialSubject[$.countOfIssuedClaims].push( + INonMerklizedIssuer.SubjectField({key: 'balance', value: ownerBalance, rawValue: ''}) + ); $.idToCredentialSubject[$.countOfIssuedClaims].push( INonMerklizedIssuer.SubjectField({key: 'address', value: ownerAddress, rawValue: ''}) ); diff --git a/scripts/deployAddressOwnershipCredentialIssuer.ts b/scripts/deployAddressOwnershipCredentialIssuer.ts new file mode 100644 index 0000000..b575169 --- /dev/null +++ b/scripts/deployAddressOwnershipCredentialIssuer.ts @@ -0,0 +1,52 @@ +import fs from 'fs'; +import path from 'path'; +import { DeployHelper } from '../test/helpers/DeployHelper'; +import { deployPoseidons } from '../test/utils/deploy-poseidons.util'; +import { StateDeployHelper } from '../test/helpers/StateDeployHelper'; +import { ethers } from 'hardhat'; +const pathOutputJson = path.join(__dirname, './deploy_output.json'); + +async function main() { + const stateAddress = '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124'; // current iden3 state smart contract on amoy + + const owner = (await ethers.getSigners())[0]; + const [poseidon2Elements, poseidon3Elements, poseidon4Elements] = await deployPoseidons( + owner, + [2, 3, 4] + ); + const stDeployHelper = await StateDeployHelper.initialize([owner], true); + const smtLib = await stDeployHelper.deploySmtLib( + await poseidon2Elements.getAddress(), + await poseidon3Elements.getAddress() + ); + + const balanceCredentialIssuerDeployer = await DeployHelper.initialize([owner], true); + const contracts = await balanceCredentialIssuerDeployer.deployBalanceCredentialIssuer( + smtLib, + poseidon3Elements, + poseidon4Elements, + stateAddress + // authV2Validator + ); + + const balanceCredentialIssuer = contracts.balanceCredentialIssuer; + + const outputJson = { + state: stateAddress, + smtLib: await smtLib.getAddress(), + balanceCredentialIssuer: await balanceCredentialIssuer.getAddress(), + poseidon2: await poseidon2Elements.getAddress(), + poseidon3: await poseidon3Elements.getAddress(), + poseidon4: await poseidon4Elements.getAddress(), + // authV2Validator, + network: process.env.HARDHAT_NETWORK + }; + fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/scripts/deployBalanceCredentialIssuer.ts b/scripts/deployBalanceCredentialIssuer.ts index 7e68c21..8a791f8 100644 --- a/scripts/deployBalanceCredentialIssuer.ts +++ b/scripts/deployBalanceCredentialIssuer.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import { BalanceCredentialIssuerDeployHelper } from '../test/helpers/BalanceCredentialIssuerDeployHelper'; +import { DeployHelper } from '../test/helpers/DeployHelper'; import { deployPoseidons } from '../test/utils/deploy-poseidons.util'; import { StateDeployHelper } from '../test/helpers/StateDeployHelper'; import { ethers } from 'hardhat'; @@ -24,15 +24,12 @@ async function main() { await poseidon3Elements.getAddress() ); - const balanceCredentialIssuerDeployer = await BalanceCredentialIssuerDeployHelper.initialize( - [owner], - true - ); + const balanceCredentialIssuerDeployer = await DeployHelper.initialize([owner], true); const contracts = await balanceCredentialIssuerDeployer.deployBalanceCredentialIssuer( smtLib, poseidon3Elements, poseidon4Elements, - stateAddress, + stateAddress // authV2Validator ); diff --git a/scripts/setRequest.ts b/scripts/setRequests-AddressOwnershipCredentialIssuer.ts similarity index 85% rename from scripts/setRequest.ts rename to scripts/setRequests-AddressOwnershipCredentialIssuer.ts index 9594642..731c1e0 100644 --- a/scripts/setRequest.ts +++ b/scripts/setRequests-AddressOwnershipCredentialIssuer.ts @@ -10,17 +10,12 @@ export function getAuthV2RequestId(): number { } async function main() { - // const chainId = hre.network.config.chainId; - // const network = hre.network.name; - - // const methodId = "ade09fcd"; - const verifier = await ethers.getContractAt( - 'BalanceCredentialIssuer', + 'AddressOwnershipCredentialIssuer', '0x98F122a0CDa16d39F1Fb1D7589e846466ec9e630' ); - const requestId = getAuthV2RequestId(); + const requestId = 940499666; // calculateRequestIdForCircuit(CircuitId.AuthV2); const requestIdExists = await verifier.requestIdExists(requestId); if (requestIdExists) { diff --git a/test/helpers/BalanceCredentialIssuerDeployHelper.ts b/test/helpers/DeployHelper.ts similarity index 56% rename from test/helpers/BalanceCredentialIssuerDeployHelper.ts rename to test/helpers/DeployHelper.ts index d69caa2..8af50fd 100644 --- a/test/helpers/BalanceCredentialIssuerDeployHelper.ts +++ b/test/helpers/DeployHelper.ts @@ -3,7 +3,7 @@ import { Contract } from 'ethers'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { deployClaimBuilder, deployIdentityLib } from '../utils/deploy-utils'; -export class BalanceCredentialIssuerDeployHelper { +export class DeployHelper { constructor( private signers: SignerWithAddress[], private readonly enableLogging: boolean = false @@ -12,14 +12,14 @@ export class BalanceCredentialIssuerDeployHelper { static async initialize( signers: SignerWithAddress[] | null = null, enableLogging = false - ): Promise { + ): Promise { let sgrs; if (signers === null) { sgrs = await ethers.getSigners(); } else { sgrs = signers; } - return new BalanceCredentialIssuerDeployHelper(sgrs, enableLogging); + return new DeployHelper(sgrs, enableLogging); } async deployVerifierLib(): Promise { @@ -38,7 +38,6 @@ export class BalanceCredentialIssuerDeployHelper { poseidon3: Contract, poseidon4: Contract, stateContractAddress: string - // universalVerifierAddress: string ): Promise<{ balanceCredentialIssuer: Contract; }> { @@ -72,12 +71,7 @@ export class BalanceCredentialIssuerDeployHelper { [stateContractAddress], { initializer: 'initialize(address)', - unsafeAllow: [ - 'external-library-linking', - 'struct-definition', - 'state-variable-assignment', - 'delegatecall' - ] + unsafeAllow: ['external-library-linking', 'struct-definition', 'state-variable-assignment'] } ); await balanceCredentialIssuer.waitForDeployment(); @@ -92,6 +86,59 @@ export class BalanceCredentialIssuerDeployHelper { }; } + async deployAddressOwnershipCredentialIssuer( + smtLib: Contract, + poseidon3: Contract, + poseidon4: Contract, + stateContractAddress: string + ): Promise<{ + addressOwnershipCredentialIssuer: Contract; + }> { + const owner = this.signers[0]; + + this.log('======== Address ownership credential issuer: deploy started ========'); + + const cb = await deployClaimBuilder(true); + const il = await deployIdentityLib( + await smtLib.getAddress(), + await poseidon3.getAddress(), + await poseidon4.getAddress(), + true + ); + + const verifierLib = await this.deployVerifierLib(); + + const AddressOwnershipCredentialIssuerFactory = await ethers.getContractFactory( + 'AddressOwnershipCredentialIssuer', + { + libraries: { + ClaimBuilder: await cb.getAddress(), + IdentityLib: await il.getAddress(), + PoseidonUnit4L: await poseidon4.getAddress(), + VerifierLib: await verifierLib.getAddress() + } + } + ); + const addressOwnershipCredentialIssuer = await upgrades.deployProxy( + AddressOwnershipCredentialIssuerFactory, + [stateContractAddress], + { + initializer: 'initialize(address)', + unsafeAllow: ['external-library-linking', 'struct-definition', 'state-variable-assignment'] + } + ); + await addressOwnershipCredentialIssuer.waitForDeployment(); + this.log( + `AddressOwnershipCredentialIssuer contract deployed to address ${await addressOwnershipCredentialIssuer.getAddress()} from ${await owner.getAddress()}` + ); + + this.log('======== Balance credential issuer: deploy completed ========'); + + return { + addressOwnershipCredentialIssuer + }; + } + private log(...args): void { this.enableLogging && console.log(args); } diff --git a/test/onchain-nonmerklized-identity/index.ts b/test/onchain-nonmerklized-identity/index.ts index d2677e9..e0b38ab 100644 --- a/test/onchain-nonmerklized-identity/index.ts +++ b/test/onchain-nonmerklized-identity/index.ts @@ -1,5 +1,5 @@ import { ethers } from 'hardhat'; -import { BalanceCredentialIssuerDeployHelper } from '../helpers/BalanceCredentialIssuerDeployHelper'; +import { DeployHelper } from '../helpers/DeployHelper'; import { StateDeployHelper } from '../helpers/StateDeployHelper'; import { expect } from 'chai'; import { Claim } from '@iden3/js-iden3-core'; @@ -11,7 +11,7 @@ describe('Reproduce identity life cycle', function () { const signer = await ethers.getImpersonatedSigner('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'); const stDeployHelper = await StateDeployHelper.initialize([signer]); - const deployHelper = await BalanceCredentialIssuerDeployHelper.initialize([signer], true); + const deployHelper = await DeployHelper.initialize([signer], true); const stContracts = await stDeployHelper.deployState(); const contracts = await deployHelper.deployBalanceCredentialIssuer( stContracts.smtLib, From 42c6033df2f19d59614ddf19b6475ff4a215290f Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Wed, 6 Nov 2024 07:00:17 +0100 Subject: [PATCH 04/11] Remove vscode folder --- .vscode/settings.json | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 958cbf0..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "workbench.colorCustomizations": { - "activityBar.activeBackground": "#7f40bf", - "activityBar.background": "#7f40bf", - "activityBar.foreground": "#e7e7e7", - "activityBar.inactiveForeground": "#e7e7e799", - "activityBarBadge.background": "#c78f58", - "activityBarBadge.foreground": "#15202b", - "commandCenter.border": "#e7e7e799", - "sash.hoverBorder": "#7f40bf", - "statusBar.background": "#663399", - "statusBar.foreground": "#e7e7e7", - "statusBarItem.hoverBackground": "#7f40bf", - "statusBarItem.remoteBackground": "#663399", - "statusBarItem.remoteForeground": "#e7e7e7", - "titleBar.activeBackground": "#663399", - "titleBar.activeForeground": "#e7e7e7", - "titleBar.inactiveBackground": "#66339999", - "titleBar.inactiveForeground": "#e7e7e799" - }, - "peacock.color": "#639" -} From 312322e15623ac816e2313c52301ef164e1530a5 Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Wed, 6 Nov 2024 07:05:11 +0100 Subject: [PATCH 05/11] PR prep --- .../deployAddressOwnershipCredentialIssuer.ts | 26 +- scripts/deployBalanceCredentialIssuer.ts | 4 - scripts/getUserIdFromStorage.ts | 21 - scripts/uniVerifier.abi.ts | 820 ------------------ 4 files changed, 13 insertions(+), 858 deletions(-) delete mode 100644 scripts/getUserIdFromStorage.ts delete mode 100644 scripts/uniVerifier.abi.ts diff --git a/scripts/deployAddressOwnershipCredentialIssuer.ts b/scripts/deployAddressOwnershipCredentialIssuer.ts index b575169..426babc 100644 --- a/scripts/deployAddressOwnershipCredentialIssuer.ts +++ b/scripts/deployAddressOwnershipCredentialIssuer.ts @@ -4,7 +4,10 @@ import { DeployHelper } from '../test/helpers/DeployHelper'; import { deployPoseidons } from '../test/utils/deploy-poseidons.util'; import { StateDeployHelper } from '../test/helpers/StateDeployHelper'; import { ethers } from 'hardhat'; -const pathOutputJson = path.join(__dirname, './deploy_output.json'); +const pathOutputJson = path.join( + __dirname, + './deploy_addressOwnershipCredentialIssuer_output.json' +); async function main() { const stateAddress = '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124'; // current iden3 state smart contract on amoy @@ -20,25 +23,22 @@ async function main() { await poseidon3Elements.getAddress() ); - const balanceCredentialIssuerDeployer = await DeployHelper.initialize([owner], true); - const contracts = await balanceCredentialIssuerDeployer.deployBalanceCredentialIssuer( - smtLib, - poseidon3Elements, - poseidon4Elements, - stateAddress - // authV2Validator - ); - - const balanceCredentialIssuer = contracts.balanceCredentialIssuer; + const deployer = await DeployHelper.initialize([owner], true); + const { addressOwnershipCredentialIssuer } = + await deployer.deployAddressOwnershipCredentialIssuer( + smtLib, + poseidon3Elements, + poseidon4Elements, + stateAddress + ); const outputJson = { state: stateAddress, smtLib: await smtLib.getAddress(), - balanceCredentialIssuer: await balanceCredentialIssuer.getAddress(), poseidon2: await poseidon2Elements.getAddress(), poseidon3: await poseidon3Elements.getAddress(), poseidon4: await poseidon4Elements.getAddress(), - // authV2Validator, + addressOwnershipCredentialIssuer: await addressOwnershipCredentialIssuer.getAddress(), network: process.env.HARDHAT_NETWORK }; fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); diff --git a/scripts/deployBalanceCredentialIssuer.ts b/scripts/deployBalanceCredentialIssuer.ts index 8a791f8..ca12195 100644 --- a/scripts/deployBalanceCredentialIssuer.ts +++ b/scripts/deployBalanceCredentialIssuer.ts @@ -10,8 +10,6 @@ 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 universalVerifier = '0x1Df0B05F15b5ea9648B8a081aca8ad0dE065bD1F'; - // const authV2Validator = '0x1a593E1aD3843b4363Dfa42585c4bBCA885553c0'; const owner = (await ethers.getSigners())[0]; const [poseidon2Elements, poseidon3Elements, poseidon4Elements] = await deployPoseidons( @@ -30,7 +28,6 @@ async function main() { poseidon3Elements, poseidon4Elements, stateAddress - // authV2Validator ); const balanceCredentialIssuer = contracts.balanceCredentialIssuer; @@ -42,7 +39,6 @@ async function main() { poseidon2: await poseidon2Elements.getAddress(), poseidon3: await poseidon3Elements.getAddress(), poseidon4: await poseidon4Elements.getAddress(), - // authV2Validator, network: process.env.HARDHAT_NETWORK }; fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); diff --git a/scripts/getUserIdFromStorage.ts b/scripts/getUserIdFromStorage.ts deleted file mode 100644 index 9017362..0000000 --- a/scripts/getUserIdFromStorage.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ethers } from 'hardhat'; -import abi from './uniVerifier.abi'; - -async function main() { - const signer = (await ethers.getSigners())[0]; - const contract = await ethers.getContractAt(abi, '0x1Df0B05F15b5ea9648B8a081aca8ad0dE065bD1F'); - contract.connect(signer); - - const userId = await contract.getProofStorageField( - '0x2a75802212C3ba5E96afde9fD8e446aa6012a340', - 940499666, - 'userID' - ); - - console.log(userId); -} - -main().catch((error) => { - console.error(error); - process.exit(1); -}); diff --git a/scripts/uniVerifier.abi.ts b/scripts/uniVerifier.abi.ts deleted file mode 100644 index c6d98c4..0000000 --- a/scripts/uniVerifier.abi.ts +++ /dev/null @@ -1,820 +0,0 @@ -export default [ - { - inputs: [], - name: 'InvalidInitialization', - type: 'error' - }, - { - inputs: [ - { - internalType: 'string', - name: 'message', - type: 'string' - }, - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - internalType: 'uint256', - name: 'linkID', - type: 'uint256' - }, - { - internalType: 'uint64', - name: 'requestIdToCompare', - type: 'uint64' - }, - { - internalType: 'uint256', - name: 'linkIdToCompare', - type: 'uint256' - } - ], - name: 'LinkedProofError', - type: 'error' - }, - { - inputs: [], - name: 'NotInitializing', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'owner', - type: 'address' - } - ], - name: 'OwnableInvalidOwner', - type: 'error' - }, - { - inputs: [ - { - internalType: 'address', - name: 'account', - type: 'address' - } - ], - name: 'OwnableUnauthorizedAccount', - type: 'error' - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint64', - name: 'version', - type: 'uint64' - } - ], - name: 'Initialized', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address' - }, - { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address' - } - ], - name: 'OwnershipTransferStarted', - 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' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - indexed: true, - internalType: 'address', - name: 'requestOwner', - type: 'address' - }, - { - indexed: false, - internalType: 'string', - name: 'metadata', - type: 'string' - }, - { - indexed: false, - internalType: 'address', - name: 'validator', - type: 'address' - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes' - } - ], - name: 'ZKPRequestSet', - type: 'event' - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - indexed: true, - internalType: 'address', - name: 'caller', - type: 'address' - } - ], - name: 'ZKPResponseSubmitted', - type: 'event' - }, - { - inputs: [], - name: 'REQUESTS_RETURN_LIMIT', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'VERSION', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'acceptOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'contract ICircuitValidator', - name: 'validator', - type: 'address' - } - ], - name: 'addValidatorToWhitelist', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'disableZKPRequest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'enableZKPRequest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address' - }, - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'getProofStatus', - outputs: [ - { - components: [ - { - internalType: 'bool', - name: 'isVerified', - type: 'bool' - }, - { - internalType: 'string', - name: 'validatorVersion', - type: 'string' - }, - { - internalType: 'uint256', - name: 'blockNumber', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'blockTimestamp', - type: 'uint256' - } - ], - internalType: 'struct IZKPVerifier.ProofStatus', - name: '', - type: 'tuple' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'user', - type: 'address' - }, - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - internalType: 'string', - name: 'key', - type: 'string' - } - ], - name: 'getProofStorageField', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'getRequestOwner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getStateAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'getZKPRequest', - outputs: [ - { - components: [ - { - internalType: 'string', - name: 'metadata', - type: 'string' - }, - { - internalType: 'contract ICircuitValidator', - name: 'validator', - type: 'address' - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes' - } - ], - internalType: 'struct IZKPVerifier.ZKPRequest', - name: 'zkpRequest', - type: 'tuple' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint256', - name: 'startIndex', - type: 'uint256' - }, - { - internalType: 'uint256', - name: 'length', - type: 'uint256' - } - ], - name: 'getZKPRequests', - outputs: [ - { - components: [ - { - internalType: 'string', - name: 'metadata', - type: 'string' - }, - { - internalType: 'contract ICircuitValidator', - name: 'validator', - type: 'address' - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes' - } - ], - internalType: 'struct IZKPVerifier.ZKPRequest[]', - name: '', - type: 'tuple[]' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'getZKPRequestsCount', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'contract IState', - name: 'state', - type: 'address' - }, - { - internalType: 'address', - name: 'owner', - type: 'address' - } - ], - name: 'initialize', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address' - }, - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'isProofVerified', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'contract ICircuitValidator', - name: 'validator', - type: 'address' - } - ], - name: 'isWhitelistedValidator', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'isZKPRequestEnabled', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'owner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [], - name: 'pendingOwner', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'contract ICircuitValidator', - name: 'validator', - type: 'address' - } - ], - name: 'removeValidatorFromWhitelist', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'renounceOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - } - ], - name: 'requestIdExists', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool' - } - ], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - internalType: 'address', - name: 'requestOwner', - type: 'address' - } - ], - name: 'setRequestOwner', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'contract IState', - name: 'state', - type: 'address' - } - ], - name: 'setState', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - components: [ - { - internalType: 'string', - name: 'metadata', - type: 'string' - }, - { - internalType: 'contract ICircuitValidator', - name: 'validator', - type: 'address' - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes' - } - ], - internalType: 'struct IZKPVerifier.ZKPRequest', - name: 'request', - type: 'tuple' - } - ], - name: 'setZKPRequest', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - internalType: 'uint256[]', - name: 'inputs', - type: 'uint256[]' - }, - { - 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]' - } - ], - name: 'submitZKPResponse', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - components: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - internalType: 'bytes', - name: 'zkProof', - type: 'bytes' - }, - { - internalType: 'bytes', - name: 'data', - type: 'bytes' - } - ], - internalType: 'struct IZKPVerifier.ZKPResponse[]', - name: 'responses', - type: 'tuple[]' - }, - { - internalType: 'bytes', - name: 'crossChainProof', - type: 'bytes' - } - ], - name: 'submitZKPResponseV2', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'newOwner', - type: 'address' - } - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [ - { - internalType: 'address', - name: 'sender', - type: 'address' - }, - { - internalType: 'uint64[]', - name: 'requestIds', - type: 'uint64[]' - } - ], - name: 'verifyLinkedProofs', - outputs: [], - stateMutability: 'view', - type: 'function' - }, - { - inputs: [ - { - internalType: 'uint64', - name: 'requestId', - type: 'uint64' - }, - { - internalType: 'uint256[]', - name: 'inputs', - type: 'uint256[]' - }, - { - 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: 'address', - name: 'sender', - type: 'address' - } - ], - name: 'verifyZKPResponse', - outputs: [ - { - components: [ - { - internalType: 'string', - name: 'key', - type: 'string' - }, - { - internalType: 'uint256', - name: 'inputIndex', - type: 'uint256' - } - ], - internalType: 'struct ICircuitValidator.KeyToInputIndex[]', - name: '', - type: 'tuple[]' - } - ], - stateMutability: 'nonpayable', - type: 'function' - }, - { - inputs: [], - name: 'version', - outputs: [ - { - internalType: 'string', - name: '', - type: 'string' - } - ], - stateMutability: 'pure', - type: 'function' - } -]; From 2bea2a744548530c9b13ffa829e944f98538f789 Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Wed, 6 Nov 2024 07:19:58 +0100 Subject: [PATCH 06/11] Fix deploy --- test/helpers/DeployHelper.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/helpers/DeployHelper.ts b/test/helpers/DeployHelper.ts index 8af50fd..f34d8de 100644 --- a/test/helpers/DeployHelper.ts +++ b/test/helpers/DeployHelper.ts @@ -53,16 +53,13 @@ export class DeployHelper { true ); - const verifierLib = await this.deployVerifierLib(); - const balanceCredentialIssuerFactory = await ethers.getContractFactory( 'BalanceCredentialIssuer', { libraries: { ClaimBuilder: await cb.getAddress(), IdentityLib: await il.getAddress(), - PoseidonUnit4L: await poseidon4.getAddress(), - VerifierLib: await verifierLib.getAddress() + PoseidonUnit4L: await poseidon4.getAddress() } } ); @@ -132,7 +129,7 @@ export class DeployHelper { `AddressOwnershipCredentialIssuer contract deployed to address ${await addressOwnershipCredentialIssuer.getAddress()} from ${await owner.getAddress()}` ); - this.log('======== Balance credential issuer: deploy completed ========'); + this.log('======== Address ownership credential issuer: deploy completed ========'); return { addressOwnershipCredentialIssuer From ca79bffc7f33900e879ede42c04dbc12a2e4e75b Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Wed, 6 Nov 2024 12:17:16 +0100 Subject: [PATCH 07/11] remove example word --- contracts/examples/AddressOwnershipCredentialIssuer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/examples/AddressOwnershipCredentialIssuer.sol b/contracts/examples/AddressOwnershipCredentialIssuer.sol index 1128680..ce788bd 100644 --- a/contracts/examples/AddressOwnershipCredentialIssuer.sol +++ b/contracts/examples/AddressOwnershipCredentialIssuer.sol @@ -14,7 +14,7 @@ import {IZKPVerifier} from '@iden3/contracts/interfaces/IZKPVerifier.sol'; import {EmbeddedZKPVerifier} from '@iden3/contracts/verifiers/EmbeddedZKPVerifier.sol'; /** - * @dev Example of decentralized address ownership credential issuer. + * @dev Address ownership credential issuer. * This issuer issue non-merklized credentials decentralized. */ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier { From be00245a089aea941f0036f61e442fcf07a6403c Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Wed, 6 Nov 2024 15:56:19 +0100 Subject: [PATCH 08/11] Update package json --- package-lock.json | 1383 +++++++++++++-------------------------------- package.json | 4 +- 2 files changed, 384 insertions(+), 1003 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6513b17..bee7cf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,8 +6,8 @@ "": { "name": "contracts", "devDependencies": { - "@0xpolygonid/js-sdk": "1.20.0", - "@iden3/contracts": "^2.4.5", + "@0xpolygonid/js-sdk": "1.20.3", + "@iden3/contracts": "^2.5.0", "@iden3/js-crypto": "^1.1.0", "@iden3/js-iden3-core": "^1.4.1", "@iden3/js-jsonld-merklization": "1.4.1", @@ -101,9 +101,9 @@ "extraneous": true }, "node_modules/@0xpolygonid/js-sdk": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/@0xpolygonid/js-sdk/-/js-sdk-1.20.0.tgz", - "integrity": "sha512-qLvUMTw9iHRDo7pPe9mgaScr5H16HC3RSoUz06OrKNzoIkYkm59Qq7LgmCh3fCXbqs9iFqPKMOn4KdjU2HIhTQ==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/@0xpolygonid/js-sdk/-/js-sdk-1.20.3.tgz", + "integrity": "sha512-VmonZAbfYdchTz7ZTplmmuu4tjTQQIEuFvWSEa2RYEZpNwXIsGUQdS//ld6QItvsNbTZ9kS3ytoq8yXNk1myNg==", "dev": true, "license": "MIT or Apache-2.0", "dependencies": { @@ -218,6 +218,7 @@ "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-1.2.2.tgz", "integrity": "sha512-Nr1QJIbW/afYYGzYvrF70LtaHrIRtd4TNAglX8BvlfxJLZ45SAmueIKYl5tWoNBPzp65ymXGFK0Bb1vZUpuc9g==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@aws-crypto/util": "^1.2.2", "@aws-sdk/types": "^3.1.0", @@ -229,6 +230,7 @@ "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-1.2.2.tgz", "integrity": "sha512-H8PjG5WJ4wz0UXAFXeJjWCW1vkvIJ3qUUD+rGRwJ2/hj+xT58Qle2MTql/2MGzkU+1JLAFuR6aJpLAjHwhmwwg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@aws-sdk/types": "^3.1.0", "@aws-sdk/util-utf8-browser": "^3.0.0", @@ -236,12 +238,13 @@ } }, "node_modules/@aws-sdk/types": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.577.0.tgz", - "integrity": "sha512-FT2JZES3wBKN/alfmhlo+3ZOq/XJ0C7QOZcDNrpKjB0kqYoKjhVKZ/Hx6ArR0czkKfHzBBEs6y40ebIHx2nSmA==", + "version": "3.679.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.679.0.tgz", + "integrity": "sha512-NwVq8YvInxQdJ47+zz4fH3BRRLC6lL+WLkvr242PVBbUOLRyK/lkwHlfiKUoeVIMyK5NF+up6TRg71t/8Bny6Q==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@smithy/types": "^3.0.0", + "@smithy/types": "^3.5.0", "tslib": "^2.6.2" }, "engines": { @@ -249,25 +252,28 @@ } }, "node_modules/@aws-sdk/types/node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" }, "node_modules/@aws-sdk/util-utf8-browser": { "version": "3.259.0", "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.1" } }, "node_modules/@aws-sdk/util-utf8-browser/node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" }, "node_modules/@babel/code-frame": { "version": "7.24.2", @@ -1371,9 +1377,9 @@ } }, "node_modules/@iden3/contracts": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/@iden3/contracts/-/contracts-2.4.5.tgz", - "integrity": "sha512-9I+en+SC6DHaWKk3X1Ufc3La6ujJuE8QAY/TOU95oLFwKQO+7/Qp9i2a1FDc/IBW2MG3PRDrZ7hUozfUD/hqkw==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@iden3/contracts/-/contracts-2.5.0.tgz", + "integrity": "sha512-AsD3W7nqLLGOAxOpR8dAwL3QOo0f+Sr3inBRswhAkXUFIs4cIdZXoBXwsllK8CV5PtnvpxUEB9XhVEj5NXyABA==", "dev": true, "license": "GPL-3.0", "dependencies": { @@ -1648,28 +1654,28 @@ } }, "node_modules/@nomicfoundation/edr": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.5.2.tgz", - "integrity": "sha512-hW/iLvUQZNTVjFyX/I40rtKvvDOqUEyIi96T28YaLfmPL+3LW2lxmYLUXEJ6MI14HzqxDqrLyhf6IbjAa2r3Dw==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.6.4.tgz", + "integrity": "sha512-YgrSuT3yo5ZQkbvBGqQ7hG+RDvz3YygSkddg4tb1Z0Y6pLXFzwrcEwWaJCFAVeeZxdxGfCgGMUYgRVneK+WXkw==", "dev": true, "license": "MIT", "dependencies": { - "@nomicfoundation/edr-darwin-arm64": "0.5.2", - "@nomicfoundation/edr-darwin-x64": "0.5.2", - "@nomicfoundation/edr-linux-arm64-gnu": "0.5.2", - "@nomicfoundation/edr-linux-arm64-musl": "0.5.2", - "@nomicfoundation/edr-linux-x64-gnu": "0.5.2", - "@nomicfoundation/edr-linux-x64-musl": "0.5.2", - "@nomicfoundation/edr-win32-x64-msvc": "0.5.2" + "@nomicfoundation/edr-darwin-arm64": "0.6.4", + "@nomicfoundation/edr-darwin-x64": "0.6.4", + "@nomicfoundation/edr-linux-arm64-gnu": "0.6.4", + "@nomicfoundation/edr-linux-arm64-musl": "0.6.4", + "@nomicfoundation/edr-linux-x64-gnu": "0.6.4", + "@nomicfoundation/edr-linux-x64-musl": "0.6.4", + "@nomicfoundation/edr-win32-x64-msvc": "0.6.4" }, "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-darwin-arm64": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.5.2.tgz", - "integrity": "sha512-Gm4wOPKhbDjGTIRyFA2QUAPfCXA1AHxYOKt3yLSGJkQkdy9a5WW+qtqKeEKHc/+4wpJSLtsGQfpzyIzggFfo/A==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.6.4.tgz", + "integrity": "sha512-QNQErISLgssV9+qia8sIjRANqtbW8snSDvjspixT/kSQ5ZSGxxctTg7x72wPSrcu8+EBEveIe5uqENIp5GH8HQ==", "dev": true, "license": "MIT", "engines": { @@ -1677,9 +1683,9 @@ } }, "node_modules/@nomicfoundation/edr-darwin-x64": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.5.2.tgz", - "integrity": "sha512-ClyABq2dFCsrYEED3/UIO0c7p4H1/4vvlswFlqUyBpOkJccr75qIYvahOSJRM62WgUFRhbSS0OJXFRwc/PwmVg==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.6.4.tgz", + "integrity": "sha512-cjVmREiwByyc9+oGfvAh49IAw+oVJHF9WWYRD+Tm/ZlSpnEVWxrGNBak2bd/JSYjn+mZE7gmWS4SMRi4nKaLUg==", "dev": true, "license": "MIT", "engines": { @@ -1687,9 +1693,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.5.2.tgz", - "integrity": "sha512-HWMTVk1iOabfvU2RvrKLDgtFjJZTC42CpHiw2h6rfpsgRqMahvIlx2jdjWYzFNy1jZKPTN1AStQ/91MRrg5KnA==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.6.4.tgz", + "integrity": "sha512-96o9kRIVD6W5VkgKvUOGpWyUGInVQ5BRlME2Fa36YoNsRQMaKtmYJEU0ACosYES6ZTpYC8U5sjMulvPtVoEfOA==", "dev": true, "license": "MIT", "engines": { @@ -1697,9 +1703,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-arm64-musl": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.5.2.tgz", - "integrity": "sha512-CwsQ10xFx/QAD5y3/g5alm9+jFVuhc7uYMhrZAu9UVF+KtVjeCvafj0PaVsZ8qyijjqVuVsJ8hD1x5ob7SMcGg==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.6.4.tgz", + "integrity": "sha512-+JVEW9e5plHrUfQlSgkEj/UONrIU6rADTEk+Yp9pbe+mzNkJdfJYhs5JYiLQRP4OjxH4QOrXI97bKU6FcEbt5Q==", "dev": true, "license": "MIT", "engines": { @@ -1707,9 +1713,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-x64-gnu": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.5.2.tgz", - "integrity": "sha512-CWVCEdhWJ3fmUpzWHCRnC0/VLBDbqtqTGTR6yyY1Ep3S3BOrHEAvt7h5gx85r2vLcztisu2vlDq51auie4IU1A==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.6.4.tgz", + "integrity": "sha512-nzYWW+fO3EZItOeP4CrdMgDXfaGBIBkKg0Y/7ySpUxLqzut40O4Mb0/+quqLAFkacUSWMlFp8nsmypJfOH5zoA==", "dev": true, "license": "MIT", "engines": { @@ -1717,9 +1723,9 @@ } }, "node_modules/@nomicfoundation/edr-linux-x64-musl": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.5.2.tgz", - "integrity": "sha512-+aJDfwhkddy2pP5u1ISg3IZVAm0dO836tRlDTFWtvvSMQ5hRGqPcWwlsbobhDQsIxhPJyT7phL0orCg5W3WMeA==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.6.4.tgz", + "integrity": "sha512-QFRoE9qSQ2boRrVeQ1HdzU+XN7NUgwZ1SIy5DQt4d7jCP+5qTNsq8LBNcqhRBOATgO63nsweNUhxX/Suj5r1Sw==", "dev": true, "license": "MIT", "engines": { @@ -1727,9 +1733,9 @@ } }, "node_modules/@nomicfoundation/edr-win32-x64-msvc": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.5.2.tgz", - "integrity": "sha512-CcvvuA3sAv7liFNPsIR/68YlH6rrybKzYttLlMr80d4GKJjwJ5OKb3YgE6FdZZnOfP19HEHhsLcE0DPLtY3r0w==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.6.4.tgz", + "integrity": "sha512-2yopjelNkkCvIjUgBGhrn153IBPLwnsDeNiq6oA0WkeM8tGmQi4td+PGi9jAriUDAkc59Yoi2q9hYA6efiY7Zw==", "dev": true, "license": "MIT", "engines": { @@ -1802,10 +1808,11 @@ } }, "node_modules/@nomicfoundation/hardhat-chai-matchers": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.6.tgz", - "integrity": "sha512-Te1Uyo9oJcTCF0Jy9dztaLpshmlpjLf2yPtWXlXuLjMt3RRSmJLm/+rKVTW6gfadAEs12U/it6D0ZRnnRGiICQ==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-2.0.8.tgz", + "integrity": "sha512-Z5PiCXH4xhNLASROlSUOADfhfpfhYO6D7Hn9xp8PddmHey0jq704cr6kfU8TRrQ4PUZbpfsZadPj+pCfZdjPIg==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { "@types/chai-as-promised": "^7.1.3", @@ -1821,10 +1828,11 @@ } }, "node_modules/@nomicfoundation/hardhat-ethers": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.6.tgz", - "integrity": "sha512-/xzkFQAaHQhmIAYOQmvHBPwL+NkwLzT9gRZBsgWUYeV+E6pzXsBQsHfRYbAZ3XEYare+T7S+5Tg/1KDJgepSkA==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.8.tgz", + "integrity": "sha512-zhOZ4hdRORls31DTOqg+GmEZM0ujly8GGIuRY7t7szEk2zW/arY1qDug/py8AEktT00v5K+b6RvbVog+va51IA==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { "debug": "^4.1.1", @@ -1836,17 +1844,19 @@ } }, "node_modules/@nomicfoundation/hardhat-ignition": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition/-/hardhat-ignition-0.15.4.tgz", - "integrity": "sha512-x1lhLN9ZRSJ9eiNY9AoinMdeQeU4LDQSQOIw90W9DiZIG/g9YUzcTEIY58QTi2TZOF8YFiF6vJqLSePCpi8R1Q==", + "version": "0.15.7", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition/-/hardhat-ignition-0.15.7.tgz", + "integrity": "sha512-RFhGazR0/JqHxuuIxjjMmM+nWFqEvA7wcVqcX7vUqqmAIGuok4HhnWQH8aOvBaVguiXvvlFDJL0PIlxmkFgIUg==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { - "@nomicfoundation/ignition-core": "^0.15.4", - "@nomicfoundation/ignition-ui": "^0.15.4", + "@nomicfoundation/ignition-core": "^0.15.7", + "@nomicfoundation/ignition-ui": "^0.15.7", "chalk": "^4.0.0", "debug": "^4.3.2", "fs-extra": "^10.0.0", + "json5": "^2.2.3", "prompts": "^2.4.2" }, "peerDependencies": { @@ -1855,24 +1865,26 @@ } }, "node_modules/@nomicfoundation/hardhat-ignition-ethers": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition-ethers/-/hardhat-ignition-ethers-0.15.4.tgz", - "integrity": "sha512-vY30V4b788GSziW/nOd0L/4IPw6mwpluahLs4+gPUUKWaHHGMA8OIeHaYpRRljM1i0M/Kg1yIozrDM/aeRebkg==", + "version": "0.15.7", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-ignition-ethers/-/hardhat-ignition-ethers-0.15.7.tgz", + "integrity": "sha512-pUZWQeFNMwDe6F/yKIJsCo+87elk/M/Edjp6AnWWIBplRyPa13Nh63+yOqMSSd9Mx9lLuBaEGnYXoI2Uz2wYZA==", "dev": true, + "license": "MIT", "peer": true, "peerDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.4", - "@nomicfoundation/hardhat-ignition": "^0.15.4", - "@nomicfoundation/ignition-core": "^0.15.4", + "@nomicfoundation/hardhat-ignition": "^0.15.7", + "@nomicfoundation/ignition-core": "^0.15.7", "ethers": "^6.7.0", "hardhat": "^2.18.0" } }, "node_modules/@nomicfoundation/hardhat-network-helpers": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.10.tgz", - "integrity": "sha512-R35/BMBlx7tWN5V6d/8/19QCwEmIdbnA4ZrsuXgvs8i2qFx5i7h6mH5pBS4Pwi4WigLH+upl6faYusrNPuzMrQ==", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-network-helpers/-/hardhat-network-helpers-1.0.12.tgz", + "integrity": "sha512-xTNQNI/9xkHvjmCJnJOTyqDSl8uq1rKb2WOVmixQxFtRd7Oa3ecO8zM0cyC2YmOK+jHB9WPZ+F/ijkHg1CoORA==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { "ethereumjs-util": "^7.1.4" @@ -1908,10 +1920,11 @@ } }, "node_modules/@nomicfoundation/hardhat-verify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.7.tgz", - "integrity": "sha512-jiYHBX+K6bBN0YhwFHQ5SWWc3dQZliM3pdgpH33C7tnsVACsX1ubZn6gZ9hfwlzG0tyjFM72XQhpaXQ56cE6Ew==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.11.tgz", + "integrity": "sha512-lGIo4dNjVQFdsiEgZp3KP6ntLiF7xJEJsbNHfSyIiFCyI0Yv0518ElsFtMC5uCuHEChiBBMrib9jWQvHHT+X3Q==", "dev": true, + "license": "MIT", "dependencies": { "@ethersproject/abi": "^5.1.2", "@ethersproject/address": "^5.0.2", @@ -1999,10 +2012,11 @@ } }, "node_modules/@nomicfoundation/ignition-core": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-core/-/ignition-core-0.15.4.tgz", - "integrity": "sha512-i379lH+xOLFdaDv0KiNma550ZXCHc5ZkmKYhM44xyLMKBlvX6skUVFkgUjjN1gvprgOIxc17GVQXlR1R5FhGZA==", + "version": "0.15.7", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-core/-/ignition-core-0.15.7.tgz", + "integrity": "sha512-C4/0V/q2gNxKDt88cMr+Oxlf4NINQ7QgmJyciQ1/6UdCRUg+/Pgdgpd3vgGXQVTotq50Q/BU4ofNUAD/8HRqtg==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { "@ethersproject/address": "5.6.1", @@ -2054,12 +2068,123 @@ } }, "node_modules/@nomicfoundation/ignition-ui": { - "version": "0.15.4", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-ui/-/ignition-ui-0.15.4.tgz", - "integrity": "sha512-cHbmuxmhso5n2zdIaaIW4p8NNzrFj0mrnv8ufhAZfM3s3IFrRoGc1zo8hI/n1CiOTPuqUbdZcB79d+2tCKtCNw==", + "version": "0.15.7", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ignition-ui/-/ignition-ui-0.15.7.tgz", + "integrity": "sha512-pj2LmXylgbHOTNrkFqFrre/FAOjcwYl4VKIKVH/QMMBH/DatbiT8aC5n9o2fbLD8uwlPEesD+uXZuKCE71KFBg==", "dev": true, "peer": true }, + "node_modules/@nomicfoundation/slang": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang/-/slang-0.17.0.tgz", + "integrity": "sha512-1GlkGRcGpVnjFw9Z1vvDKOKo2mzparFt7qrl2pDxWp+jrVtlvej98yCMX52pVyrYE7ZeOSZFnx/DtsSgoukStQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nomicfoundation/slang-darwin-arm64": "0.17.0", + "@nomicfoundation/slang-darwin-x64": "0.17.0", + "@nomicfoundation/slang-linux-arm64-gnu": "0.17.0", + "@nomicfoundation/slang-linux-arm64-musl": "0.17.0", + "@nomicfoundation/slang-linux-x64-gnu": "0.17.0", + "@nomicfoundation/slang-linux-x64-musl": "0.17.0", + "@nomicfoundation/slang-win32-arm64-msvc": "0.17.0", + "@nomicfoundation/slang-win32-ia32-msvc": "0.17.0", + "@nomicfoundation/slang-win32-x64-msvc": "0.17.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-darwin-arm64": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-arm64/-/slang-darwin-arm64-0.17.0.tgz", + "integrity": "sha512-O0q94EUtoWy9A5kOTOa9/khtxXDYnLqmuda9pQELurSiwbQEVCPQL8kb34VbOW+ifdre66JM/05Xw9JWhIZ9sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-darwin-x64": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-x64/-/slang-darwin-x64-0.17.0.tgz", + "integrity": "sha512-IaDbHzvT08sBK2HyGzonWhq1uu8IxdjmTqAWHr25Oh/PYnamdi8u4qchZXXYKz/DHLoYN3vIpBXoqLQIomhD/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-arm64-gnu": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-gnu/-/slang-linux-arm64-gnu-0.17.0.tgz", + "integrity": "sha512-Lj4anvOsQZxs1SycG8VyT2Rl2oqIhyLSUCgGepTt3CiJ/bM+8r8bLJIgh8vKkki4BWz49YsYIgaJB2IPv8FFTw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-arm64-musl": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-musl/-/slang-linux-arm64-musl-0.17.0.tgz", + "integrity": "sha512-/xkTCa9d5SIWUBQE3BmLqDFfJRr4yUBwbl4ynPiGUpRXrD69cs6pWKkwjwz/FdBpXqVo36I+zY95qzoTj/YhOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-x64-gnu": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-gnu/-/slang-linux-x64-gnu-0.17.0.tgz", + "integrity": "sha512-oe5IO5vntOqYvTd67deCHPIWuSuWm6aYtT2/0Kqz2/VLtGz4ClEulBSRwfnNzBVtw2nksWipE1w8BzhImI7Syg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-linux-x64-musl": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-musl/-/slang-linux-x64-musl-0.17.0.tgz", + "integrity": "sha512-PpYCI5K/kgLAMXaPY0V4VST5gCDprEOh7z/47tbI8kJQumI5odjsj/Cs8MpTo7/uRH6flKYbVNgUzcocWVYrAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-win32-arm64-msvc": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-arm64-msvc/-/slang-win32-arm64-msvc-0.17.0.tgz", + "integrity": "sha512-u/Mkf7OjokdBilP7QOJj6QYJU4/mjkbKnTX21wLyCIzeVWS7yafRPYpBycKIBj2pRRZ6ceAY5EqRpb0aiCq+0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-win32-ia32-msvc": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-ia32-msvc/-/slang-win32-ia32-msvc-0.17.0.tgz", + "integrity": "sha512-XJBVQfNnZQUv0tP2JSJ573S+pmgrLWgqSZOGaMllnB/TL1gRci4Z7dYRJUF2s82GlRJE+FHSI2Ro6JISKmlXCg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/slang-win32-x64-msvc": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-x64-msvc/-/slang-win32-x64-msvc-0.17.0.tgz", + "integrity": "sha512-zPGsAeiTfqfPNYHD8BfrahQmYzA78ZraoHKTGraq/1xwJwzBK4bu/NtvVA4pJjBV+B4L6DCxVhSbpn40q26JQA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, "node_modules/@nomicfoundation/solidity-analyzer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz", @@ -2256,124 +2381,52 @@ "@openzeppelin/contracts": "5.0.2" } }, - "node_modules/@openzeppelin/defender-admin-client": { - "version": "1.54.6", - "resolved": "https://registry.npmjs.org/@openzeppelin/defender-admin-client/-/defender-admin-client-1.54.6.tgz", - "integrity": "sha512-P4lxJDySrekWNuPa7FeyW/UmuxnuIXIAGYr5gZnmnMHRsYNaw+XfgkiCDfoGtjEyJbXYxXttYF6iAZhWQPdf1g==", - "dev": true, - "dependencies": { - "@openzeppelin/defender-base-client": "1.54.6", - "axios": "^1.4.0", - "ethers": "^5.7.2", - "lodash": "^4.17.19", - "node-fetch": "^2.6.0" - } - }, - "node_modules/@openzeppelin/defender-admin-client/node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - }, - "node_modules/@openzeppelin/defender-base-client": { - "version": "1.54.6", - "resolved": "https://registry.npmjs.org/@openzeppelin/defender-base-client/-/defender-base-client-1.54.6.tgz", - "integrity": "sha512-PTef+rMxkM5VQ7sLwLKSjp2DBakYQd661ZJiSRywx+q/nIpm3B/HYGcz5wPZCA5O/QcEP6TatXXDoeMwimbcnw==", - "dev": true, - "dependencies": { - "amazon-cognito-identity-js": "^6.0.1", - "async-retry": "^1.3.3", - "axios": "^1.4.0", - "lodash": "^4.17.19", - "node-fetch": "^2.6.0" - } - }, "node_modules/@openzeppelin/defender-sdk-base-client": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-base-client/-/defender-sdk-base-client-1.13.1.tgz", - "integrity": "sha512-FI7YdfgDf0px+cXbXyDkS0mpqzyySHeLkKj90ymzAy1/sGYKHNC03vyzMnMfIRuxa4bF15wdL4MCpA60PSWGpQ==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-base-client/-/defender-sdk-base-client-1.15.1.tgz", + "integrity": "sha512-z3ZoDDRgRAlkaOFrY1SoHK/hn6LWlnfuFvs7WAA+nahlltS9UN7ro4v6P2aUq4ZQH2kZg5JeNfHCkpkRFaGa5Q==", "dev": true, + "license": "MIT", "dependencies": { "amazon-cognito-identity-js": "^6.3.6", "async-retry": "^1.3.3" } }, "node_modules/@openzeppelin/defender-sdk-deploy-client": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-deploy-client/-/defender-sdk-deploy-client-1.13.1.tgz", - "integrity": "sha512-zQEoURBRMknrOXLDNzK3gXiHfQbDImLKtEVPBOybya/MYqququBdNkRmPpSkJ45LHVbuxWyqRkkGFQp8+l/UQg==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-deploy-client/-/defender-sdk-deploy-client-1.15.1.tgz", + "integrity": "sha512-seJajiWFCM+dbMIv3290TOEsygeWyGa9DQxPESpFwXvlLxfPcKN/o8g+4bs98BmC9v6d0q5ckoWA8iEuzEBLpA==", "dev": true, + "license": "MIT", "dependencies": { - "@openzeppelin/defender-sdk-base-client": "^1.13.1", - "axios": "^1.6.7", + "@openzeppelin/defender-sdk-base-client": "^1.15.1", + "axios": "^1.7.2", "lodash": "^4.17.21" } }, "node_modules/@openzeppelin/defender-sdk-network-client": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-network-client/-/defender-sdk-network-client-1.13.1.tgz", - "integrity": "sha512-QR9dTZ6MuJ5o+GwAKH4Hxy+xuElI0iCwpVqN/ntHG0Ar7neHoq/f7jPtk04/DgEmrwTUMLzTKpZWmUO1fxiEMA==", + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/defender-sdk-network-client/-/defender-sdk-network-client-1.15.1.tgz", + "integrity": "sha512-X09to21R7UjWMstDTmY+F8B6N+4c0B/hNio++fRsCs8kgO/ZcBLAQ3HDFgCBRVmhRI8+Qpa2uqc673aU6hW10A==", "dev": true, + "license": "MIT", "dependencies": { - "@openzeppelin/defender-sdk-base-client": "^1.13.1", - "axios": "^1.6.7", + "@openzeppelin/defender-sdk-base-client": "^1.15.1", + "axios": "^1.7.2", "lodash": "^4.17.21" } }, "node_modules/@openzeppelin/hardhat-upgrades": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-3.1.0.tgz", - "integrity": "sha512-CQ5Cg2kE8WeW6qajUTacBsmkntiAwJd7f6p+BUtd1fEvEv7si4H2lmAqvjOjkFc9ihIEQxMBy50IsBXSZGktmg==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/hardhat-upgrades/-/hardhat-upgrades-3.5.0.tgz", + "integrity": "sha512-Ju/JnT7NRiOMi5m5Y0dGiz37d8wnjVBep1v5Vr7+6+MFNuQa1yddUEVWhWhoEw4udI3/mYwyw4Sfz3sq7vhicQ==", "dev": true, + "license": "MIT", "dependencies": { - "@openzeppelin/defender-admin-client": "^1.52.0", - "@openzeppelin/defender-base-client": "^1.52.0", - "@openzeppelin/defender-sdk-base-client": "^1.10.0", - "@openzeppelin/defender-sdk-deploy-client": "^1.10.0", - "@openzeppelin/defender-sdk-network-client": "^1.10.0", - "@openzeppelin/upgrades-core": "^1.32.0", + "@openzeppelin/defender-sdk-base-client": "^1.14.4", + "@openzeppelin/defender-sdk-deploy-client": "^1.14.4", + "@openzeppelin/defender-sdk-network-client": "^1.14.4", + "@openzeppelin/upgrades-core": "^1.40.0", "chalk": "^4.1.0", "debug": "^4.1.1", "ethereumjs-util": "^7.1.5", @@ -2396,25 +2449,29 @@ } }, "node_modules/@openzeppelin/hardhat-upgrades/node_modules/undici": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.18.1.tgz", - "integrity": "sha512-/0BWqR8rJNRysS5lqVmfc7eeOErcOP4tZpATVjJOojjHZ71gSYVAtFhEmadcIjwMIUehh5NFyKGsXCnXIajtbA==", + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz", + "integrity": "sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==", "dev": true, + "license": "MIT", "engines": { "node": ">=18.17" } }, "node_modules/@openzeppelin/upgrades-core": { - "version": "1.33.1", - "resolved": "https://registry.npmjs.org/@openzeppelin/upgrades-core/-/upgrades-core-1.33.1.tgz", - "integrity": "sha512-YRxIRhTY1b+j7+NUUu8Uuem5ugxKexEMVd8dBRWNgWeoN1gS1OCrhgUg0ytL+54vzQ+SGWZDfNnzjVuI1Cj1Zw==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/upgrades-core/-/upgrades-core-1.40.0.tgz", + "integrity": "sha512-4bPSXdEqHsNRL5T1ybPLneWGYjzGl6XWGWkv7aUoFFgz8mOdarstRBX1Wi4XJFw6IeHPUI7mMSQr2jdz8Y2ypQ==", "dev": true, + "license": "MIT", "dependencies": { + "@nomicfoundation/slang": "^0.17.0", "cbor": "^9.0.0", "chalk": "^4.1.0", "compare-versions": "^6.0.0", "debug": "^4.1.1", "ethereumjs-util": "^7.0.3", + "minimatch": "^9.0.5", "minimist": "^1.2.7", "proper-lockfile": "^4.1.1", "solidity-ast": "^0.4.51" @@ -2428,6 +2485,7 @@ "resolved": "https://registry.npmjs.org/cbor/-/cbor-9.0.2.tgz", "integrity": "sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ==", "dev": true, + "license": "MIT", "dependencies": { "nofilter": "^3.1.0" }, @@ -2675,10 +2733,11 @@ } }, "node_modules/@smithy/types": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.0.0.tgz", - "integrity": "sha512-VvWuQk2RKFuOr98gFhjca7fkBS+xLLURT8bUjk5XQoV0ZLm7WPwWPPY3/AwzTLuUBDeoKDCthfe1AsTUWaSEhw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.6.0.tgz", + "integrity": "sha512-8VXK/KzOHefoC65yRgCn5vG1cysPJjHnOVt9d0ybFQSmJgQj152vMn4EkYhGuaOmnnZvCPav/KnYyE6/KsNZ2w==", "dev": true, + "license": "Apache-2.0", "dependencies": { "tslib": "^2.6.2" }, @@ -2687,10 +2746,11 @@ } }, "node_modules/@smithy/types/node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" }, "node_modules/@solidity-parser/parser": { "version": "0.14.5", @@ -3299,6 +3359,7 @@ "resolved": "https://registry.npmjs.org/amazon-cognito-identity-js/-/amazon-cognito-identity-js-6.3.12.tgz", "integrity": "sha512-s7NKDZgx336cp+oDeUtB2ZzT8jWJp/v2LWuYl+LQtMEODe22RF1IJ4nRiDATp+rp1pTffCZcm44Quw4jx2bqNg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@aws-crypto/sha256-js": "1.2.2", "buffer": "4.9.2", @@ -3438,22 +3499,6 @@ "node": ">=6" } }, - "node_modules/array-buffer-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", - "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "is-array-buffer": "^3.0.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -3473,48 +3518,6 @@ "node": ">=0.10.0" } }, - "node_modules/array.prototype.findlast": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", - "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "es-shim-unscopables": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", - "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.1", - "call-bind": "^1.0.5", - "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", - "es-errors": "^1.2.1", - "get-intrinsic": "^1.2.3", - "is-array-buffer": "^3.0.4", - "is-shared-array-buffer": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", @@ -3558,6 +3561,7 @@ "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", "dev": true, + "license": "MIT", "dependencies": { "retry": "0.13.1" } @@ -3593,10 +3597,11 @@ } }, "node_modules/axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", "dev": true, + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -3829,6 +3834,7 @@ "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", "dev": true, + "license": "MIT", "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4", @@ -4028,39 +4034,33 @@ "peer": true }, "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", + "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", "dev": true, + "license": "MIT", "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 8.10.0" + "node": ">= 14.16.0" }, "funding": { "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" } }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "node_modules/chokidar/node_modules/readdirp": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", + "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==", "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, + "license": "MIT", "engines": { - "node": ">= 6" + "node": ">= 14.16.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" } }, "node_modules/ci-info": { @@ -4448,10 +4448,11 @@ } }, "node_modules/compare-versions": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.0.tgz", - "integrity": "sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==", - "dev": true + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz", + "integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==", + "dev": true, + "license": "MIT" }, "node_modules/concat-map": { "version": "0.0.1", @@ -4649,61 +4650,10 @@ "node": ">= 12" } }, - "node_modules/data-view-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", - "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.6", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/data-view-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", - "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/data-view-byte-offset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", - "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.6", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/death": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/death/-/death-1.1.0.tgz", - "integrity": "sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w==", + "node_modules/death": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/death/-/death-1.1.0.tgz", + "integrity": "sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w==", "dev": true, "peer": true }, @@ -4818,23 +4768,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dev": true, - "dependencies": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -5016,66 +4949,6 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/es-abstract": { - "version": "1.23.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", - "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", - "dev": true, - "dependencies": { - "array-buffer-byte-length": "^1.0.1", - "arraybuffer.prototype.slice": "^1.0.3", - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", - "data-view-buffer": "^1.0.1", - "data-view-byte-length": "^1.0.1", - "data-view-byte-offset": "^1.0.0", - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "es-set-tostringtag": "^2.0.3", - "es-to-primitive": "^1.2.1", - "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.4", - "get-symbol-description": "^1.0.2", - "globalthis": "^1.0.3", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2", - "has-proto": "^1.0.3", - "has-symbols": "^1.0.3", - "hasown": "^2.0.2", - "internal-slot": "^1.0.7", - "is-array-buffer": "^3.0.4", - "is-callable": "^1.2.7", - "is-data-view": "^1.0.1", - "is-negative-zero": "^2.0.3", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.3", - "is-string": "^1.0.7", - "is-typed-array": "^1.1.13", - "is-weakref": "^1.0.2", - "object-inspect": "^1.13.1", - "object-keys": "^1.1.1", - "object.assign": "^4.1.5", - "regexp.prototype.flags": "^1.5.2", - "safe-array-concat": "^1.1.2", - "safe-regex-test": "^1.0.3", - "string.prototype.trim": "^1.2.9", - "string.prototype.trimend": "^1.0.8", - "string.prototype.trimstart": "^1.0.8", - "typed-array-buffer": "^1.0.2", - "typed-array-byte-length": "^1.0.1", - "typed-array-byte-offset": "^1.0.2", - "typed-array-length": "^1.0.6", - "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.15" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -5097,58 +4970,6 @@ "node": ">= 0.4" } }, - "node_modules/es-object-atoms": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", - "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", - "dev": true, - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-set-tostringtag": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", - "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.2.4", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.1" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-shim-unscopables": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", - "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", - "dev": true, - "dependencies": { - "hasown": "^2.0.0" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/escalade": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", @@ -5846,7 +5667,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz", "integrity": "sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-deep-equal": { "version": "3.1.3", @@ -6203,33 +6025,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/function.prototype.name": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", - "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "functions-have-names": "^1.2.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -6290,23 +6085,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-symbol-description": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", - "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/ghost-testrpc": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/ghost-testrpc/-/ghost-testrpc-0.0.2.tgz", @@ -6511,22 +6289,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globalthis": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", - "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", - "dev": true, - "dependencies": { - "define-properties": "^1.2.1", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -6629,15 +6391,15 @@ } }, "node_modules/hardhat": { - "version": "2.22.10", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.10.tgz", - "integrity": "sha512-JRUDdiystjniAvBGFmJRsiIZSOP2/6s++8xRDe3TzLeQXlWWHsXBrd9wd3JWFyKXvgMqMeLL5Sz/oNxXKYw9vg==", + "version": "2.22.15", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.15.tgz", + "integrity": "sha512-BpTGa9PE/sKAaHi4s/S1e9WGv63DR1m7Lzfd60C8gSEchDPfAJssVRSq0MZ2v2k76ig9m0kHAwVLf5teYwu/Mw==", "dev": true, "license": "MIT", "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/edr": "^0.5.2", + "@nomicfoundation/edr": "^0.6.4", "@nomicfoundation/ethereumjs-common": "4.0.4", "@nomicfoundation/ethereumjs-tx": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", @@ -6650,7 +6412,7 @@ "ansi-escapes": "^4.3.0", "boxen": "^5.1.2", "chalk": "^2.4.2", - "chokidar": "^3.4.0", + "chokidar": "^4.0.0", "ci-info": "^2.0.0", "debug": "^4.1.1", "enquirer": "^2.3.0", @@ -6663,6 +6425,7 @@ "glob": "7.2.0", "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", + "json-stream-stringify": "^3.1.4", "keccak": "^3.0.2", "lodash": "^4.17.11", "mnemonist": "^0.38.0", @@ -6929,10 +6692,11 @@ } }, "node_modules/hardhat/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.3.0" }, @@ -6949,15 +6713,6 @@ } } }, - "node_modules/has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -7297,20 +7052,6 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, - "node_modules/internal-slot": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", - "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", - "dev": true, - "dependencies": { - "es-errors": "^1.3.0", - "hasown": "^2.0.0", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/interpret": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", @@ -7346,40 +7087,12 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-array-buffer": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", - "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -7392,22 +7105,6 @@ "node": ">=8" } }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -7420,36 +7117,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-data-view": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", - "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", - "dev": true, - "dependencies": { - "is-typed-array": "^1.1.13" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-docker": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", @@ -7521,18 +7188,6 @@ "npm": ">=3" } }, - "node_modules/is-negative-zero": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", - "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -7542,21 +7197,6 @@ "node": ">=0.12.0" } }, - "node_modules/is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -7569,72 +7209,11 @@ }, "node_modules/is-plain-obj": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", - "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=8" } }, "node_modules/is-typed-array": { @@ -7664,18 +7243,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -7706,6 +7273,7 @@ "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz", "integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==", "dev": true, + "license": "MIT", "dependencies": { "node-fetch": "^2.6.1", "unfetch": "^4.2.0" @@ -7770,7 +7338,8 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz", "integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/js-sha3": { "version": "0.8.0", @@ -7854,6 +7423,16 @@ "dev": true, "license": "MIT" }, + "node_modules/json-stream-stringify": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/json-stream-stringify/-/json-stream-stringify-3.1.6.tgz", + "integrity": "sha512-x7fpwxOkbhFCaJDJ8vb1fBY3DdSa4AlITaz+HHILQJzdPMnHEFjxPwVUi1ALIbcIxDE0PNe/0i7frnY8QnBQog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=7.10.1" + } + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -7861,6 +7440,20 @@ "dev": true, "peer": true }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -8266,10 +7859,11 @@ "peer": true }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -8324,10 +7918,11 @@ "dev": true }, "node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -8772,6 +8367,7 @@ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, + "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -8785,24 +8381,6 @@ "node": ">= 0.4" } }, - "node_modules/object.assign": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", - "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "define-properties": "^1.2.1", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/obliterator": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz", @@ -9331,6 +8909,7 @@ "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", "dev": true, + "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", "retry": "^0.12.0", @@ -9342,6 +8921,7 @@ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -9591,24 +9171,6 @@ "node": ">=6" } }, - "node_modules/regexp.prototype.flags": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", - "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.6", - "define-properties": "^1.2.1", - "es-errors": "^1.3.0", - "set-function-name": "^2.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/registry-auth-token": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", @@ -9737,6 +9299,7 @@ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -9826,30 +9389,6 @@ "integrity": "sha512-eBNFLob4PMq8JA1dGyFn6G97q3/WzNtFK4RnzT1fnLq+9RyrGknzYiM/9B12MnKAxuj1IXr7UKYtTNtjyKMBog==", "dev": true }, - "node_modules/safe-array-concat": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", - "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4", - "has-symbols": "^1.0.3", - "isarray": "^2.0.5" - }, - "engines": { - "node": ">=0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/safe-array-concat/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -9870,23 +9409,6 @@ } ] }, - "node_modules/safe-regex-test": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", - "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.6", - "es-errors": "^1.3.0", - "is-regex": "^1.1.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -10055,25 +9577,50 @@ "dev": true }, "node_modules/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.4.tgz", + "integrity": "sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "dependencies": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", + "elliptic": "^6.5.7", + "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=18.0.0" + } + }, + "node_modules/secp256k1/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true, + "license": "MIT" + }, + "node_modules/secp256k1/node_modules/elliptic": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.0.tgz", + "integrity": "sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" } }, "node_modules/secp256k1/node_modules/node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", - "dev": true + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", + "dev": true, + "license": "MIT" }, "node_modules/semver": { "version": "6.3.1", @@ -10110,21 +9657,6 @@ "node": ">= 0.4" } }, - "node_modules/set-function-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", - "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", - "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -10208,6 +9740,7 @@ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, + "peer": true, "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -10225,7 +9758,8 @@ "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/sisteransi": { "version": "1.0.5", @@ -10440,13 +9974,11 @@ } }, "node_modules/solidity-ast": { - "version": "0.4.56", - "resolved": "https://registry.npmjs.org/solidity-ast/-/solidity-ast-0.4.56.tgz", - "integrity": "sha512-HgmsA/Gfklm/M8GFbCX/J1qkVH0spXHgALCNZ8fA8x5X+MFdn/8CP2gr5OVyXjXw6RZTPC/Sxl2RUDQOXyNMeA==", + "version": "0.4.59", + "resolved": "https://registry.npmjs.org/solidity-ast/-/solidity-ast-0.4.59.tgz", + "integrity": "sha512-I+CX0wrYUN9jDfYtcgWSe+OAowaXy8/1YQy7NS4ni5IBDmIYBq7ZzaP/7QqouLjzZapmQtvGLqCaYgoUWqBo5g==", "dev": true, - "dependencies": { - "array.prototype.findlast": "^1.2.2" - } + "license": "MIT" }, "node_modules/solidity-bytes-utils": { "version": "0.8.2", @@ -10465,10 +9997,11 @@ "dev": true }, "node_modules/solidity-coverage": { - "version": "0.8.12", - "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.8.12.tgz", - "integrity": "sha512-8cOB1PtjnjFRqOgwFiD8DaUsYJtVJ6+YdXQtSZDrLGf8cdhhh8xzTtGzVTGeBf15kTv0v7lYPJlV/az7zLEPJw==", + "version": "0.8.13", + "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.8.13.tgz", + "integrity": "sha512-RiBoI+kF94V3Rv0+iwOj3HQVSqNzA9qm/qDP1ZDXK5IX0Cvho1qiz8hAXTsAo6KOIUeP73jfscq0KlLqVxzGWA==", "dev": true, + "license": "ISC", "peer": true, "dependencies": { "@ethersproject/abi": "^5.0.9", @@ -10772,55 +10305,6 @@ "node": ">=8" } }, - "node_modules/string.prototype.trim": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", - "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.0", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimend": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", - "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", - "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -11383,79 +10867,6 @@ "node": ">= 4.0.0" } }, - "node_modules/typed-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", - "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "es-errors": "^1.3.0", - "is-typed-array": "^1.1.13" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/typed-array-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", - "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/typed-array-byte-offset": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", - "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/typed-array-length": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", - "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13", - "possible-typed-array-names": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -11509,21 +10920,6 @@ "multiformats": "^9.4.2" } }, - "node_modules/unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/underscore": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz", @@ -11554,7 +10950,8 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/universalify": { "version": "2.0.1", @@ -12780,22 +12177,6 @@ "node": ">= 8" } }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/which-typed-array": { "version": "1.1.15", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", diff --git a/package.json b/package.json index 1460994..ed3e1b8 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "contracts", "devDependencies": { - "@0xpolygonid/js-sdk": "1.20.0", - "@iden3/contracts": "^2.4.5", + "@0xpolygonid/js-sdk": "1.20.3", + "@iden3/contracts": "^2.5.0", "@iden3/js-crypto": "^1.1.0", "@iden3/js-iden3-core": "^1.4.1", "@iden3/js-jsonld-merklization": "1.4.1", From 9c301cef773dd79d94c833502a69e9ef5f7f9afd Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Wed, 6 Nov 2024 20:24:43 +0100 Subject: [PATCH 09/11] Add display method --- contracts/examples/AddressOwnershipCredentialIssuer.sol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/examples/AddressOwnershipCredentialIssuer.sol b/contracts/examples/AddressOwnershipCredentialIssuer.sol index ce788bd..d38a821 100644 --- a/contracts/examples/AddressOwnershipCredentialIssuer.sol +++ b/contracts/examples/AddressOwnershipCredentialIssuer.sol @@ -124,7 +124,10 @@ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKP id: jsonSchema, _type: 'JsonSchema2023' }), - displayMethod: INonMerklizedIssuer.DisplayMethod({id: '', _type: ''}) + displayMethod: INonMerklizedIssuer.DisplayMethod({ + id: 'ipfs://QmWePFHENF1S1uo7zma2CiikE7Jm563JZpU2PQXKAhiGR9', + _type: 'Iden3BasicDisplayMethodV1' + }) }); return (credentialData, claimItem.claim, $.idToCredentialSubject[_credentialId]); } From c7e67ee26e9f0a1290ff904a3e7afa1b5781b6d5 Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Fri, 8 Nov 2024 13:36:23 +0100 Subject: [PATCH 10/11] Update display method --- contracts/examples/AddressOwnershipCredentialIssuer.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/examples/AddressOwnershipCredentialIssuer.sol b/contracts/examples/AddressOwnershipCredentialIssuer.sol index d38a821..39aadbf 100644 --- a/contracts/examples/AddressOwnershipCredentialIssuer.sol +++ b/contracts/examples/AddressOwnershipCredentialIssuer.sol @@ -125,7 +125,7 @@ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKP _type: 'JsonSchema2023' }), displayMethod: INonMerklizedIssuer.DisplayMethod({ - id: 'ipfs://QmWePFHENF1S1uo7zma2CiikE7Jm563JZpU2PQXKAhiGR9', + id: 'ipfs://QmehEzsEcoqKSL6P549J7c7C4LvCWqNdXHwA7nMVCk1Ar9', _type: 'Iden3BasicDisplayMethodV1' }) }); From bd94e129b221a496d7d4a5413c2a8a81da1829c8 Mon Sep 17 00:00:00 2001 From: Kolezhniuk Date: Sat, 9 Nov 2024 09:05:07 +0100 Subject: [PATCH 11/11] Add erc20 verifier --- .../AddressOwnershipCredentialIssuer.sol | 14 +- contracts/examples/ERC20Verifier.sol | 73 +++----- demo.md | 37 ++++ .../deployAddressOwnershipCredentialIssuer.ts | 27 +++ scripts/deployERC20.ts | 161 ++---------------- test/helpers/DeployHelper.ts | 38 +++++ 6 files changed, 156 insertions(+), 194 deletions(-) create mode 100644 demo.md diff --git a/contracts/examples/AddressOwnershipCredentialIssuer.sol b/contracts/examples/AddressOwnershipCredentialIssuer.sol index 39aadbf..3f9d794 100644 --- a/contracts/examples/AddressOwnershipCredentialIssuer.sol +++ b/contracts/examples/AddressOwnershipCredentialIssuer.sol @@ -19,7 +19,7 @@ import {EmbeddedZKPVerifier} from '@iden3/contracts/verifiers/EmbeddedZKPVerifie */ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKPVerifier { using IdentityLib for IdentityLib.Data; - + /// @custom:storage-location erc7201:polygonid.storage.AddressOwnershipCredentialIssuer struct AddressOwnershipCredentialIssuerStorage { // countOfIssuedClaims count of issued claims for incrementing id and revocation nonce for new claims @@ -57,6 +57,7 @@ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKP uint256 private constant jsonldSchemaHash = 102852920559964654297980198544873875695; string private constant jsonSchema = 'ipfs://QmQinvQkq78TuxSqKxVqJjE36y6Zf3gFwfMC7PfxMDXsvW'; string private constant jsonldSchema = 'ipfs://QmeoaM2GYroPzWK7kTnvNoer2QmmtESeT6EvnkVL8DJgyA'; + string private displayMethodId = ''; struct ClaimItem { uint256 id; @@ -67,6 +68,7 @@ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKP function initialize(address _stateContractAddr) public initializer { super.initialize(_stateContractAddr, IState(_stateContractAddr).getDefaultIdType()); super.__EmbeddedZKPVerifier_init(_msgSender(), IState(_stateContractAddr)); + displayMethodId = 'ipfs://QmQCUxwKofjEK58HaQxmApTfaZ7w1JvKt3QW9DQgFn3Ubx'; } function _afterProofSubmitV2(IZKPVerifier.ZKPResponse[] memory responses) internal override { @@ -125,7 +127,7 @@ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKP _type: 'JsonSchema2023' }), displayMethod: INonMerklizedIssuer.DisplayMethod({ - id: 'ipfs://QmehEzsEcoqKSL6P549J7c7C4LvCWqNdXHwA7nMVCk1Ar9', + id: displayMethodId, _type: 'Iden3BasicDisplayMethodV1' }) }); @@ -209,4 +211,12 @@ contract AddressOwnershipCredentialIssuer is NonMerklizedIssuerBase, EmbeddedZKP require(timestamp <= type(uint64).max, 'Timestamp exceeds uint64 range'); return uint64(timestamp); } + + function getDisplayMethodId() external view returns (string memory) { + return displayMethodId; + } + + function setDisplayMethodId(string memory _displayMethodId) external onlyOwner { + displayMethodId = _displayMethodId; + } } diff --git a/contracts/examples/ERC20Verifier.sol b/contracts/examples/ERC20Verifier.sol index 409696c..86f0046 100644 --- a/contracts/examples/ERC20Verifier.sol +++ b/contracts/examples/ERC20Verifier.sol @@ -9,9 +9,6 @@ import {EmbeddedZKPVerifier} from '@iden3/contracts/verifiers/EmbeddedZKPVerifie import {IState} from '@iden3/contracts/interfaces/IState.sol'; contract ERC20Verifier is ERC20Upgradeable, EmbeddedZKPVerifier { - uint64 public constant TRANSFER_REQUEST_ID_SIG_VALIDATOR = 1; - uint64 public constant TRANSFER_REQUEST_ID_MTP_VALIDATOR = 2; - /// @custom:storage-location erc7201:polygonid.storage.ERC20Verifier struct ERC20VerifierStorage { mapping(uint256 => address) idToAddress; @@ -23,26 +20,23 @@ contract ERC20Verifier is ERC20Upgradeable, EmbeddedZKPVerifier { bytes32 private constant ERC20VerifierStorageLocation = 0x3b1c3bd751d9cd42a3739426a271cdc235017946663d56eeaf827d70f8b77000; + uint64 private currentRequestId = 0; + function _getERC20VerifierStorage() private pure returns (ERC20VerifierStorage storage $) { assembly { $.slot := ERC20VerifierStorageLocation } } - modifier beforeTransfer(address to) { - require( - isProofVerified(to, TRANSFER_REQUEST_ID_SIG_VALIDATOR) || - isProofVerified(to, TRANSFER_REQUEST_ID_MTP_VALIDATOR), - 'only identities who provided sig or mtp proof for transfer requests are allowed to receive tokens' - ); - _; + function setZKPRequest( + uint64 requestId, + IZKPVerifier.ZKPRequest calldata request + ) public override checkRequestExistence(requestId, false) { + super.setZKPRequest(requestId, request); + currentRequestId = requestId; } - function initialize( - string memory name, - string memory symbol, - IState state - ) public initializer { + function initialize(string memory name, string memory symbol, IState state) public initializer { ERC20VerifierStorage storage $ = _getERC20VerifierStorage(); super.__ERC20_init(name, symbol); super.__EmbeddedZKPVerifier_init(_msgSender(), state); @@ -68,17 +62,13 @@ contract ERC20Verifier is ERC20Upgradeable, EmbeddedZKPVerifier { ICircuitValidator validator ) internal override { ERC20VerifierStorage storage $ = _getERC20VerifierStorage(); - if ( - requestId == TRANSFER_REQUEST_ID_SIG_VALIDATOR || - requestId == TRANSFER_REQUEST_ID_MTP_VALIDATOR - ) { - // if proof is given for transfer request id ( mtp or sig ) and it's a first time we mint tokens to sender - uint256 id = inputs[1]; - if ($.idToAddress[id] == address(0) && $.addressToId[_msgSender()] == 0) { - super._mint(_msgSender(), $.TOKEN_AMOUNT_FOR_AIRDROP_PER_ID); - $.addressToId[_msgSender()] = id; - $.idToAddress[id] = _msgSender(); - } + + // if proof is given for transfer request id ( mtp or sig ) and it's a first time we mint tokens to sender + uint256 id = inputs[1]; + if ($.idToAddress[id] == address(0) && $.addressToId[_msgSender()] == 0) { + super._mint(_msgSender(), $.TOKEN_AMOUNT_FOR_AIRDROP_PER_ID); + $.addressToId[_msgSender()] = id; + $.idToAddress[id] = _msgSender(); } } @@ -95,7 +85,7 @@ contract ERC20Verifier is ERC20Upgradeable, EmbeddedZKPVerifier { uint256[2] memory c ) = abi.decode(response.zkProof, (uint256[], uint256[2], uint256[2][2], uint256[2])); - // check that challenge input is address of sender + // check that challenge input is address of sender address addr = PrimitiveTypeUtils.uint256LEToAddress( inputs[request.validator.inputIndexOf('challenge')] ); @@ -104,9 +94,7 @@ contract ERC20Verifier is ERC20Upgradeable, EmbeddedZKPVerifier { } } - function _afterProofSubmitV2( - IZKPVerifier.ZKPResponse[] memory responses - ) internal override { + function _afterProofSubmitV2(IZKPVerifier.ZKPResponse[] memory responses) internal override { ERC20VerifierStorage storage $ = _getERC20VerifierStorage(); for (uint256 i = 0; i < responses.length; i++) { @@ -118,28 +106,23 @@ contract ERC20Verifier is ERC20Upgradeable, EmbeddedZKPVerifier { uint256[2] memory c ) = abi.decode(response.zkProof, (uint256[], uint256[2], uint256[2][2], uint256[2])); - if ( - response.requestId == TRANSFER_REQUEST_ID_SIG_VALIDATOR || - response.requestId == TRANSFER_REQUEST_ID_MTP_VALIDATOR - ) { - // if proof is given for transfer request id ( mtp or sig ) and it's a first time we mint tokens to sender - uint256 id = inputs[1]; - if ($.idToAddress[id] == address(0) && $.addressToId[_msgSender()] == 0) { - super._mint(_msgSender(), $.TOKEN_AMOUNT_FOR_AIRDROP_PER_ID); - $.addressToId[_msgSender()] = id; - $.idToAddress[id] = _msgSender(); - } - } + uint256 userId = super.getProofStorageField(_msgSender(), response.requestId, 'userID'); + require(userId != 0, 'Invalid user id'); + super._mint(_msgSender(), $.TOKEN_AMOUNT_FOR_AIRDROP_PER_ID); + $.addressToId[_msgSender()] = userId; + $.idToAddress[userId] = _msgSender(); } - - } function _update( address from /* from */, address to, uint256 amount /* amount */ - ) internal override beforeTransfer(to) { + ) internal override { + require( + isProofVerified(to, currentRequestId), + 'only identities who provided sig or mtp proof for transfer requests are allowed to receive tokens' + ); super._update(from, to, amount); } diff --git a/demo.md b/demo.md new file mode 100644 index 0000000..080da8f --- /dev/null +++ b/demo.md @@ -0,0 +1,37 @@ +# Demo contracts deployments + +## Pre-requisites + +1.Install Node.js and npm +2. Clone the repository and install the dependencies + +```bash +git clone https://github.com/0xPolygonID/contracts.git +git checkout validator-integration-embeeded +cd contracts +npm install +``` + +3. provide RPC url and wallet key in hardhat.config.ts + +```bash +... + 'polygon-amoy': { + chainId: 80002, + url: ``, + accounts: process.env.PRIVATE_KEY ? [`0x${process.env.PRIVATE_KEY}`] : DEFAULT_ACCOUNTS, // [or your private key with 0x prefix] + }, +``` + +## Deploying AddressOwnershipCredentialRegistry + +`npx hardhat run scripts/deployAddressOwnershipCredentialIssuer.ts --network polygon-amoy` + +## Deploying ERC20Verifier + +`npx hardhat run scripts/deployERC20.ts --network polygon-amoy` + +## Deployed Contracts + +1. ERC20Verifier: `0x43DAB1FcD8C60dc5bFd8A1ecA47937a2A2ac929c` +2. AddressOwnershipCredentialRegistry: `0x73C29bD6F2C6358c32Dd69Dc704460D44c36c850` diff --git a/scripts/deployAddressOwnershipCredentialIssuer.ts b/scripts/deployAddressOwnershipCredentialIssuer.ts index 426babc..a8976ca 100644 --- a/scripts/deployAddressOwnershipCredentialIssuer.ts +++ b/scripts/deployAddressOwnershipCredentialIssuer.ts @@ -42,6 +42,33 @@ async function main() { network: process.env.HARDHAT_NETWORK }; fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); + + const requestId = 940499666; // calculateRequestIdForCircuit(CircuitId.AuthV2); + + const requestIdExists = await addressOwnershipCredentialIssuer.requestIdExists(requestId); + if (requestIdExists) { + throw new Error(`Request ID: ${requestId} already exists`); + } + + const tx = await addressOwnershipCredentialIssuer.setZKPRequest( + requestId, + { + metadata: '0x', + validator: '0x1a593E1aD3843b4363Dfa42585c4bBCA885553c0', + data: '0x' + } + // { + // gasPrice: 50000000000, + // initialBaseFeePerGas: 25000000000, + // gasLimit: 10000000, + // }, + ); + + console.log(`Request ID: ${requestId} is set in tx: ${tx.hash}`); + + const displayMethodId = await addressOwnershipCredentialIssuer.getDisplayMethodId(); + + console.log('displayMethodId', displayMethodId); } main() diff --git a/scripts/deployERC20.ts b/scripts/deployERC20.ts index 069fb9a..41ea363 100644 --- a/scripts/deployERC20.ts +++ b/scripts/deployERC20.ts @@ -1,155 +1,22 @@ -import { ethers, upgrades } from 'hardhat'; -import { packV2ValidatorParams } from '../test/utils/pack-utils'; -import { calculateQueryHashV2 } from '../test/utils/utils'; - -const Operators = { - NOOP: 0, // No operation, skip query verification in circuit - EQ: 1, // equal - LT: 2, // less than - GT: 3, // greater than - IN: 4, // in - NIN: 5, // not in - NE: 6 // not equal -}; +import fs from 'fs'; +import path from 'path'; +import { DeployHelper } from '../test/helpers/DeployHelper'; +import { ethers } from 'hardhat'; +const pathOutputJson = path.join(__dirname, './deploy_ERC20Verifier_output.json'); async function main() { - // you can run https://go.dev/play/p/3id7HAhf-Wi to get schema hash and claimPathKey using YOUR schema - const schema = '74977327600848231385663280181476307657'; - // merklized path to field in the W3C credential according to JSONLD schema e.g. birthday in the KYCAgeCredential under the url "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld" - const schemaUrl = - 'https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld'; - const type = 'KYCAgeCredential'; - const schemaClaimPathKey = - '20376033832371109177683048456014525905119173674985843915445634726167450989630'; - const value = [20020101, ...new Array(63).fill(0)]; - const slotIndex = 0; // because schema is merklized for merklized credential, otherwise you should actual put slot index https://docs.iden3.io/protocol/non-merklized/#motivation - - const contractName = 'ERC20Verifier'; - const name = 'ERC20ZKPVerifier'; - const symbol = 'ERCZKP'; - const ERC20ContractFactory = await ethers.getContractFactory(contractName); - const erc20instance = await upgrades.deployProxy(ERC20ContractFactory, [name, symbol]); - const claimPathDoesntExist = 0; // 0 for inclusion (merklized credentials) - 1 for non-merklized - - await erc20instance.waitForDeployment(); - console.log(contractName, ' deployed to:', await erc20instance.getAddress()); - - // set default query - const circuitIdSig = 'credentialAtomicQuerySigV2OnChain'; - const circuitIdMTP = 'credentialAtomicQueryMTPV2OnChain'; - - // // // current sig validator address on mumbai - // const validatorAddressSig = '0x59f2a6D94D0d02F3a2F527a8B6175dc511935624'; - // - // // current mtp validator address on mumbai - // const validatorAddressMTP = '0xb9b51F7E8C83C90FE48e0aBd815ef0418685CcF6'; - // - // const chainId = 80001; - - // const network = 'polygon-mumbai'; - - // current sig validator address on polygon main - // const validatorAddressSig = '0xEF8540a5e0F4f53B436e7C3A273dCAe1C05d764D'; - // - // // current mtp validator address on polygon main - // const validatorAddressMTP = '0x03Ee09635E9946165dd9538e9414f0ACE57e42e1'; - // - // const network = 'polygon-main'; - // - // const chainId = 137; - - // current sig validator address on polygon amoy - const validatorAddressSig = '0x8c99F13dc5083b1E4c16f269735EaD4cFbc4970d'; - const validatorAddressMTP = '0xEEd5068AD8Fecf0b9a91aF730195Fef9faB00356'; + const stateAddress = '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124'; // current iden3 state smart contract on amoy - const network = 'polygon-amoy'; + const owner = (await ethers.getSigners())[0]; + const deployer = await DeployHelper.initialize([owner], true); + const { erc20Verifier } = await deployer.deployERC20Verifier(stateAddress); - const chainId = 80002; - - const query = { - schema: schema, - claimPathKey: schemaClaimPathKey, - operator: Operators.LT, - slotIndex: slotIndex, - value: value, - queryHash: calculateQueryHashV2( - value, - schema, - slotIndex, - Operators.LT, - schemaClaimPathKey, - claimPathDoesntExist - ).toString(), - circuitIds: [circuitIdSig], - allowedIssuers: [], - skipClaimRevocationCheck: false, - claimPathNotExists: claimPathDoesntExist - }; - - const requestIdSig = await erc20instance.TRANSFER_REQUEST_ID_SIG_VALIDATOR(); - const requestIdMtp = await erc20instance.TRANSFER_REQUEST_ID_MTP_VALIDATOR(); - - const invokeRequestMetadata = { - id: '7f38a193-0918-4a48-9fac-36adfdb8b542', - typ: 'application/iden3comm-plain-json', - type: 'https://iden3-communication.io/proofs/1.0/contract-invoke-request', - thid: '7f38a193-0918-4a48-9fac-36adfdb8b542', - body: { - reason: 'for testing', - transaction_data: { - contract_address: await erc20instance.getAddress(), - method_id: 'b68967e2', - chain_id: chainId, - network: network - }, - scope: [ - { - id: requestIdSig, - circuitId: circuitIdSig, - query: { - allowedIssuers: ['*'], - context: schemaUrl, - credentialSubject: { - birthday: { - $lt: value[0] - } - }, - type: type - } - } - ] - } + const outputJson = { + state: stateAddress, + erc20Verifier: await erc20Verifier.getAddress(), + network: process.env.HARDHAT_NETWORK }; - - try { - // sig request set - const txSig = await erc20instance.setZKPRequest(requestIdSig, { - metadata: JSON.stringify(invokeRequestMetadata, (_, v) => - typeof v === 'bigint' ? v.toString() : v - ), - validator: validatorAddressSig, - data: packV2ValidatorParams(query) - }); - await txSig.wait(); - console.log(txSig.hash); - - // mtp request set - query.circuitIds = [circuitIdMTP]; - invokeRequestMetadata.body.scope[0].circuitId = circuitIdMTP; - invokeRequestMetadata.body.scope[0].id = requestIdMtp; - const txMtp = await erc20instance.setZKPRequest(requestIdMtp, { - metadata: JSON.stringify(invokeRequestMetadata, (_, v) => - typeof v === 'bigint' ? v.toString() : v - ), - validator: validatorAddressMTP, - data: packV2ValidatorParams(query) - }); - - console.log(txMtp.hash); - await txMtp.wait(); - } catch (e) { - console.log('error: ', e); - } + fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); } main() diff --git a/test/helpers/DeployHelper.ts b/test/helpers/DeployHelper.ts index f34d8de..fb58f58 100644 --- a/test/helpers/DeployHelper.ts +++ b/test/helpers/DeployHelper.ts @@ -136,6 +136,44 @@ export class DeployHelper { }; } + async deployERC20Verifier( + stateContractAddress: string, + name = 'ERC20ZKPVerifier', + symbol = 'ERCZKP' + ): Promise<{ + erc20Verifier: Contract; + }> { + const owner = this.signers[0]; + + this.log('======== ERC20 Verifier: deploy started ========'); + + const verifierLib = await this.deployVerifierLib(); + + const erc20VerifierFactory = await ethers.getContractFactory('ERC20Verifier', { + libraries: { + VerifierLib: await verifierLib.getAddress() + } + }); + const erc20Verifier = await upgrades.deployProxy( + erc20VerifierFactory, + [name, symbol, stateContractAddress], + { + initializer: 'initialize(string, string, address)', + unsafeAllow: ['external-library-linking', 'struct-definition', 'state-variable-assignment'] + } + ); + await erc20Verifier.waitForDeployment(); + this.log( + `erc20Verifier contract deployed to address ${await erc20Verifier.getAddress()} from ${await owner.getAddress()}` + ); + + this.log('======== erc20Verifier: deploy completed ========'); + + return { + erc20Verifier + }; + } + private log(...args): void { this.enableLogging && console.log(args); }