mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 07:08:10 -05:00
Chore/get custom error (#173)
This commit is contained in:
@@ -11,18 +11,18 @@ import {CircuitConstants} from "../constants/CircuitConstants.sol";
|
||||
/// @dev This contract interacts with IdentityVerificationHub and IdentityRegistry
|
||||
contract VerifyAll is Ownable {
|
||||
|
||||
IIdentityVerificationHubV1 public _hub;
|
||||
IIdentityRegistryV1 public _registry;
|
||||
IIdentityVerificationHubV1 public hub;
|
||||
IIdentityRegistryV1 public registry;
|
||||
|
||||
/// @notice Initializes the contract with hub and registry addresses
|
||||
/// @param hub The address of the IdentityVerificationHub contract
|
||||
/// @param registry The address of the IdentityRegistry contract
|
||||
/// @param hubAddress The address of the IdentityVerificationHub contract
|
||||
/// @param registryAddress The address of the IdentityRegistry contract
|
||||
constructor(
|
||||
address hub,
|
||||
address registry
|
||||
address hubAddress,
|
||||
address registryAddress
|
||||
) Ownable(msg.sender) {
|
||||
_hub = IIdentityVerificationHubV1(hub);
|
||||
_registry = IIdentityRegistryV1(registry);
|
||||
hub = IIdentityVerificationHubV1(hubAddress);
|
||||
registry = IIdentityRegistryV1(registryAddress);
|
||||
}
|
||||
|
||||
/// @notice Verifies identity proof and reveals selected data
|
||||
@@ -46,7 +46,7 @@ contract VerifyAll is Ownable {
|
||||
{
|
||||
|
||||
IIdentityVerificationHubV1.VcAndDiscloseVerificationResult memory result;
|
||||
try _hub.verifyVcAndDisclose(proof) returns (IIdentityVerificationHubV1.VcAndDiscloseVerificationResult memory _result) {
|
||||
try hub.verifyVcAndDisclose(proof) returns (IIdentityVerificationHubV1.VcAndDiscloseVerificationResult memory _result) {
|
||||
result = _result;
|
||||
} catch (bytes memory lowLevelData) {
|
||||
string memory errorCode;
|
||||
@@ -55,10 +55,8 @@ contract VerifyAll is Ownable {
|
||||
assembly {
|
||||
errorSelector := mload(add(lowLevelData, 32))
|
||||
}
|
||||
if (errorSelector == bytes4(keccak256("LENGTH_MISMATCH()"))) {
|
||||
errorCode = "LENGTH_MISMATCH";
|
||||
} else if (errorSelector == bytes4(keccak256("NO_VERIFIER_SET()"))) {
|
||||
errorCode = "NO_VERIFIER_SET";
|
||||
if (errorSelector == bytes4(keccak256("INVALID_COMMITMENT_ROOT()"))) {
|
||||
errorCode = "INVALID_COMMITMENT_ROOT";
|
||||
} else if (errorSelector == bytes4(keccak256("CURRENT_DATE_NOT_IN_VALID_RANGE()"))) {
|
||||
errorCode = "CURRENT_DATE_NOT_IN_VALID_RANGE";
|
||||
} else if (errorSelector == bytes4(keccak256("INVALID_OLDER_THAN()"))) {
|
||||
@@ -90,7 +88,7 @@ contract VerifyAll is Ownable {
|
||||
}
|
||||
|
||||
if (targetRootTimestamp != 0) {
|
||||
if (_registry.rootTimestamps(result.identityCommitmentRoot) != targetRootTimestamp) {
|
||||
if (registry.rootTimestamps(result.identityCommitmentRoot) != targetRootTimestamp) {
|
||||
IIdentityVerificationHubV1.ReadableRevealedData memory emptyData = IIdentityVerificationHubV1.ReadableRevealedData({
|
||||
issuingState: "",
|
||||
name: new string[](0),
|
||||
@@ -109,23 +107,23 @@ contract VerifyAll is Ownable {
|
||||
}
|
||||
|
||||
uint256[3] memory revealedDataPacked = result.revealedDataPacked;
|
||||
IIdentityVerificationHubV1.ReadableRevealedData memory readableData = _hub.getReadableRevealedData(revealedDataPacked, types);
|
||||
IIdentityVerificationHubV1.ReadableRevealedData memory readableData = hub.getReadableRevealedData(revealedDataPacked, types);
|
||||
|
||||
return (readableData, true, "");
|
||||
}
|
||||
|
||||
/// @notice Updates the hub contract address
|
||||
/// @param hub The new hub contract address
|
||||
/// @param hubAddress The new hub contract address
|
||||
/// @dev Only callable by the contract owner
|
||||
function setHub(address hub) external onlyOwner {
|
||||
_hub = IIdentityVerificationHubV1(hub);
|
||||
function setHub(address hubAddress) external onlyOwner {
|
||||
hub = IIdentityVerificationHubV1(hubAddress);
|
||||
}
|
||||
|
||||
/// @notice Updates the registry contract address
|
||||
/// @param registry The new registry contract address
|
||||
/// @param registryAddress The new registry contract address
|
||||
/// @dev Only callable by the contract owner
|
||||
function setRegistry(address registry) external onlyOwner {
|
||||
_registry = IIdentityRegistryV1(registry);
|
||||
function setRegistry(address registryAddress) external onlyOwner {
|
||||
registry = IIdentityRegistryV1(registryAddress);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
"deploy:hub:celo": "npx hardhat ignition deploy ignition/modules/deployHub.ts --network celo",
|
||||
"deploy:registry:celo": "npx hardhat ignition deploy ignition/modules/deployRegistry.ts --network celo",
|
||||
"deploy:verifiers:celo": "npx hardhat ignition deploy ignition/modules/deployVerifiers.ts --network celo",
|
||||
"deploy:verifyall:celo": "npx hardhat ignition deploy ignition/modules/deployVerifyAll.ts --network celo",
|
||||
"deploy:verifyall:celo": "npx hardhat ignition deploy ignition/modules/deployVerifyAll.ts --network celo --verify",
|
||||
"deploy_all": "npx hardhat ignition deploy ignition/modules/Deploy_All.ts --network optimism --verify",
|
||||
"publish": "npm publish --access public",
|
||||
"test": "npx hardhat test",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openpassport/core",
|
||||
"version": "0.0.18",
|
||||
"version": "0.0.20",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zk-passport/openpassport"
|
||||
|
||||
@@ -1,289 +1,294 @@
|
||||
export const verifyAllAbi = [
|
||||
{
|
||||
inputs: [
|
||||
"inputs": [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'hub',
|
||||
type: 'address',
|
||||
"internalType": "address",
|
||||
"name": "hubAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'registry',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "address",
|
||||
"name": "registryAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'constructor',
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
"inputs": [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'owner',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
name: 'OwnableInvalidOwner',
|
||||
type: 'error',
|
||||
"name": "OwnableInvalidOwner",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
"inputs": [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'account',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "address",
|
||||
"name": "account",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
name: 'OwnableUnauthorizedAccount',
|
||||
type: 'error',
|
||||
"name": "OwnableUnauthorizedAccount",
|
||||
"type": "error"
|
||||
},
|
||||
{
|
||||
anonymous: false,
|
||||
inputs: [
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'previousOwner',
|
||||
type: 'address',
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "previousOwner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
indexed: true,
|
||||
internalType: 'address',
|
||||
name: 'newOwner',
|
||||
type: 'address',
|
||||
},
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
name: 'OwnershipTransferred',
|
||||
type: 'event',
|
||||
"name": "OwnershipTransferred",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: '_hub',
|
||||
outputs: [
|
||||
"inputs": [],
|
||||
"name": "hub",
|
||||
"outputs": [
|
||||
{
|
||||
internalType: 'contract IIdentityVerificationHubV1',
|
||||
name: '',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "contract IIdentityVerificationHubV1",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: '_registry',
|
||||
outputs: [
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
internalType: 'contract IIdentityRegistryV1',
|
||||
name: '',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'owner',
|
||||
outputs: [
|
||||
"inputs": [],
|
||||
"name": "registry",
|
||||
"outputs": [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: '',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "contract IIdentityRegistryV1",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
inputs: [],
|
||||
name: 'renounceOwnership',
|
||||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
"inputs": [],
|
||||
"name": "renounceOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
"inputs": [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'hub',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "address",
|
||||
"name": "hubAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
name: 'setHub',
|
||||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
"name": "setHub",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
"inputs": [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'registry',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "address",
|
||||
"name": "registryAddress",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
name: 'setRegistry',
|
||||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
"name": "setRegistry",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
"inputs": [
|
||||
{
|
||||
internalType: 'address',
|
||||
name: 'newOwner',
|
||||
type: 'address',
|
||||
},
|
||||
"internalType": "address",
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
name: 'transferOwnership',
|
||||
outputs: [],
|
||||
stateMutability: 'nonpayable',
|
||||
type: 'function',
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
"inputs": [
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'targetRootTimestamp',
|
||||
type: 'uint256',
|
||||
"internalType": "uint256",
|
||||
"name": "targetRootTimestamp",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
components: [
|
||||
"components": [
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: 'olderThanEnabled',
|
||||
type: 'bool',
|
||||
"internalType": "bool",
|
||||
"name": "olderThanEnabled",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'olderThan',
|
||||
type: 'uint256',
|
||||
"internalType": "uint256",
|
||||
"name": "olderThan",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: 'forbiddenCountriesEnabled',
|
||||
type: 'bool',
|
||||
"internalType": "bool",
|
||||
"name": "forbiddenCountriesEnabled",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'forbiddenCountriesListPacked',
|
||||
type: 'uint256',
|
||||
"internalType": "uint256",
|
||||
"name": "forbiddenCountriesListPacked",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
internalType: 'bool[3]',
|
||||
name: 'ofacEnabled',
|
||||
type: 'bool[3]',
|
||||
"internalType": "bool[3]",
|
||||
"name": "ofacEnabled",
|
||||
"type": "bool[3]"
|
||||
},
|
||||
{
|
||||
components: [
|
||||
"components": [
|
||||
{
|
||||
internalType: 'uint256[2]',
|
||||
name: 'a',
|
||||
type: 'uint256[2]',
|
||||
"internalType": "uint256[2]",
|
||||
"name": "a",
|
||||
"type": "uint256[2]"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256[2][2]',
|
||||
name: 'b',
|
||||
type: 'uint256[2][2]',
|
||||
"internalType": "uint256[2][2]",
|
||||
"name": "b",
|
||||
"type": "uint256[2][2]"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256[2]',
|
||||
name: 'c',
|
||||
type: 'uint256[2]',
|
||||
"internalType": "uint256[2]",
|
||||
"name": "c",
|
||||
"type": "uint256[2]"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256[18]',
|
||||
name: 'pubSignals',
|
||||
type: 'uint256[18]',
|
||||
},
|
||||
"internalType": "uint256[18]",
|
||||
"name": "pubSignals",
|
||||
"type": "uint256[18]"
|
||||
}
|
||||
],
|
||||
internalType: 'struct IVcAndDiscloseCircuitVerifier.VcAndDiscloseProof',
|
||||
name: 'vcAndDiscloseProof',
|
||||
type: 'tuple',
|
||||
},
|
||||
"internalType": "struct IVcAndDiscloseCircuitVerifier.VcAndDiscloseProof",
|
||||
"name": "vcAndDiscloseProof",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
internalType: 'struct IIdentityVerificationHubV1.VcAndDiscloseHubProof',
|
||||
name: 'proof',
|
||||
type: 'tuple',
|
||||
"internalType": "struct IIdentityVerificationHubV1.VcAndDiscloseHubProof",
|
||||
"name": "proof",
|
||||
"type": "tuple"
|
||||
},
|
||||
{
|
||||
internalType: 'enum IIdentityVerificationHubV1.RevealedDataType[]',
|
||||
name: 'types',
|
||||
type: 'uint8[]',
|
||||
},
|
||||
"internalType": "enum IIdentityVerificationHubV1.RevealedDataType[]",
|
||||
"name": "types",
|
||||
"type": "uint8[]"
|
||||
}
|
||||
],
|
||||
name: 'verifyAll',
|
||||
outputs: [
|
||||
"name": "verifyAll",
|
||||
"outputs": [
|
||||
{
|
||||
components: [
|
||||
"components": [
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'issuingState',
|
||||
type: 'string',
|
||||
"internalType": "string",
|
||||
"name": "issuingState",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
internalType: 'string[]',
|
||||
name: 'name',
|
||||
type: 'string[]',
|
||||
"internalType": "string[]",
|
||||
"name": "name",
|
||||
"type": "string[]"
|
||||
},
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'passportNumber',
|
||||
type: 'string',
|
||||
"internalType": "string",
|
||||
"name": "passportNumber",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'nationality',
|
||||
type: 'string',
|
||||
"internalType": "string",
|
||||
"name": "nationality",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'dateOfBirth',
|
||||
type: 'string',
|
||||
"internalType": "string",
|
||||
"name": "dateOfBirth",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'gender',
|
||||
type: 'string',
|
||||
"internalType": "string",
|
||||
"name": "gender",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
internalType: 'string',
|
||||
name: 'expiryDate',
|
||||
type: 'string',
|
||||
"internalType": "string",
|
||||
"name": "expiryDate",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'olderThan',
|
||||
type: 'uint256',
|
||||
"internalType": "uint256",
|
||||
"name": "olderThan",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'passportNoOfac',
|
||||
type: 'uint256',
|
||||
"internalType": "uint256",
|
||||
"name": "passportNoOfac",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'nameAndDobOfac',
|
||||
type: 'uint256',
|
||||
"internalType": "uint256",
|
||||
"name": "nameAndDobOfac",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
internalType: 'uint256',
|
||||
name: 'nameAndYobOfac',
|
||||
type: 'uint256',
|
||||
},
|
||||
"internalType": "uint256",
|
||||
"name": "nameAndYobOfac",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
internalType: 'struct IIdentityVerificationHubV1.ReadableRevealedData',
|
||||
name: '',
|
||||
type: 'tuple',
|
||||
"internalType": "struct IIdentityVerificationHubV1.ReadableRevealedData",
|
||||
"name": "",
|
||||
"type": "tuple"
|
||||
},
|
||||
{
|
||||
internalType: 'bool',
|
||||
name: '',
|
||||
type: 'bool',
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
];
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
];
|
||||
@@ -1,2 +1,2 @@
|
||||
export const REGISTRY_ADDRESS = '0x537F2fd23A0432887F32414001Cc7572260544B1';
|
||||
export const VERIFYALL_ADDRESS = '0x3a2944Ab6C76ff8770924637b5da6EC22ab77Ab9';
|
||||
export const VERIFYALL_ADDRESS = '0x71852D9BfeE2423c9Cd0FA53f8466455DAD31689';
|
||||
|
||||
Reference in New Issue
Block a user