diff --git a/.github/workflows/common-ci.yml b/.github/workflows/common-ci.yml index 031c9d692..1080c2cf6 100644 --- a/.github/workflows/common-ci.yml +++ b/.github/workflows/common-ci.yml @@ -23,10 +23,12 @@ jobs: uses: ./.github/actions/yarn-install - name: Build dependencies shell: bash - run: yarn workspace @selfxyz/common build + run: | + set -euo pipefail + yarn workspace @selfxyz/common build - name: Yarn types shell: bash - run: yarn types + run: CI=true yarn types test-common: runs-on: ubuntu-latest diff --git a/.github/workflows/sdk-core-ci.yml b/.github/workflows/sdk-core-ci.yml new file mode 100644 index 000000000..fa6324e56 --- /dev/null +++ b/.github/workflows/sdk-core-ci.yml @@ -0,0 +1,102 @@ +name: SDK Core CI + +on: + push: + paths: + - "sdk/core/**" + - ".github/workflows/sdk-core-ci.yml" + pull_request: + paths: + - "sdk/core/**" + - ".github/workflows/sdk-core-ci.yml" + +jobs: + # Build dependencies once and cache for other jobs + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Dependencies + uses: ./.github/actions/yarn-install + + - name: Build dependencies + shell: bash + run: | + yarn workspace @selfxyz/common build + yarn workspace @selfxyz/contracts build + cd sdk/core && yarn generate-typechain + yarn workspace @selfxyz/core build + + - name: Cache build artifacts + uses: actions/cache/save@v4 + with: + path: | + common/dist + contracts/artifacts + contracts/cache + sdk/core/dist + sdk/core/.tsbuildinfo + sdk/core/node_modules/.cache + common/node_modules/.cache + sdk/core/src/typechain-types + key: sdk-core-build-${{ github.sha }} + + # Quality checks job + quality-checks: + runs-on: ubuntu-latest + needs: build + defaults: + run: + working-directory: ./sdk/core + steps: + - uses: actions/checkout@v4 + + - name: Install Dependencies + uses: ./.github/actions/yarn-install + + - name: Restore build artifacts + uses: actions/cache/restore@v4 + with: + path: | + common/dist + contracts/artifacts + contracts/cache + sdk/core/dist + sdk/core/.tsbuildinfo + sdk/core/node_modules/.cache + common/node_modules/.cache + sdk/core/src/typechain-types + key: sdk-core-build-${{ github.sha }} + fail-on-cache-miss: true + + - name: Generate typechain types (if needed) + run: yarn generate-typechain + + - name: Copy ABI files + run: yarn copy-abi + + - name: Lint + run: yarn lint + + - name: Type check + run: yarn types + + - name: Test build output + run: | + echo "Testing ESM import..." + node -e "import('@selfxyz/core').then(m => console.log('✅ ESM import successful')).catch(e => console.error('❌ ESM import failed:', e.message))" + + echo "Testing CJS require..." + node -e "try { const m = require('@selfxyz/core'); console.log('✅ CJS require successful'); } catch(e) { console.error('❌ CJS require failed:', e.message); }" + + - name: Verify exports + run: | + echo "Verifying package exports..." + node -e " + const pkg = require('./package.json'); + console.log('Package exports:', JSON.stringify(pkg.exports, null, 2)); + console.log('Main:', pkg.main); + console.log('Module:', pkg.module); + console.log('Types:', pkg.types); + " diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index 55f753f88..6ec3957ff 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -9,6 +9,12 @@ import "solidity-coverage"; import "hardhat-gas-reporter"; import "hardhat-contract-sizer"; +// Support PRIVATE_KEYS (comma-separated) or fallback to PRIVATE_KEY, trim & filter out empty strings +const accountsEnv = process.env.PRIVATE_KEYS + ? process.env.PRIVATE_KEYS.split(',').map(k => k.trim()).filter(Boolean) + : (process.env.PRIVATE_KEY?.trim() ? [process.env.PRIVATE_KEY.trim()] : []); +const accounts = accountsEnv.length ? accountsEnv : undefined; + const config: HardhatUserConfig = { solidity: { version: "0.8.28", @@ -44,22 +50,22 @@ const config: HardhatUserConfig = { mainnet: { chainId: 1, url: process.env.MAINNET_RPC_URL || "https://eth.llamarpc.com", - accounts: [process.env.PRIVATE_KEY as string], + ...(accounts && { accounts }), }, sepolia: { chainId: 11155111, url: process.env.SEPOLIA_RPC_URL || "https://eth-sepolia.public.blastapi.io", - accounts: [process.env.PRIVATE_KEY as string], + ...(accounts && { accounts }), }, celo: { chainId: 42220, url: process.env.CELO_RPC_URL || "https://forno.celo.org", - accounts: [process.env.PRIVATE_KEY as string], + ...(accounts && { accounts }), }, alfajores: { chainId: 44787, url: process.env.CELO_ALFAJORES_RPC_URL || "https://alfajores-forno.celo-testnet.org", - accounts: [process.env.PRIVATE_KEY as string], + ...(accounts && { accounts }), }, }, etherscan: { diff --git a/sdk/core/.eslintrc.cjs b/sdk/core/.eslintrc.cjs new file mode 100644 index 000000000..dd339c51d --- /dev/null +++ b/sdk/core/.eslintrc.cjs @@ -0,0 +1,88 @@ +module.exports = { + root: true, + env: { + node: true, + es6: true, + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2021, + sourceType: 'module', + ecmaFeatures: { jsx: false }, + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + ], + plugins: ['simple-import-sort', 'import', 'sort-exports'], + ignorePatterns: [ + 'node_modules/', + 'dist/', + '*.js.map', + '*.d.ts', + 'typechain-types/', + 'src/abi/', + 'scripts/', + ], + settings: { + 'import/resolver': { + typescript: { + alwaysTryTypes: true, + project: './tsconfig.json', + }, + }, + }, + rules: { + 'import/order': 'off', + 'no-duplicate-imports': 'off', + 'simple-import-sort/imports': [ + 'error', + { + groups: [['^node:'], ['^node:.*/'], ['^[a-zA-Z]'], ['^@selfxyz/'], ['^[./]']], + }, + ], + 'sort-exports/sort-exports': [ + 'error', + { sortDir: 'asc', ignoreCase: false, sortExportKindFirst: 'type' }, + ], + '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }], + 'import/first': 'error', + 'import/newline-after-import': 'error', + 'import/no-duplicates': 'error', + 'no-restricted-syntax': [ + 'error', + { + selector: 'ExportAllDeclaration', + message: 'export * is forbidden. Use selective exports for better tree shaking.', + }, + ], + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, + ], + '@typescript-eslint/ban-types': 'warn', + '@typescript-eslint/no-namespace': 'warn', + '@typescript-eslint/ban-ts-comment': 'warn', + }, + overrides: [ + { + files: ['*.cjs'], + env: { + node: true, + commonjs: true, + es6: true, + }, + parserOptions: { + ecmaVersion: 2020, + sourceType: 'script', + }, + rules: { + '@typescript-eslint/no-var-requires': 'off', + 'no-undef': 'off', + }, + }, + ], +}; diff --git a/sdk/core/.prettierrc b/sdk/core/.prettierrc index ea575fbe9..0f3774b1b 100644 --- a/sdk/core/.prettierrc +++ b/sdk/core/.prettierrc @@ -2,7 +2,6 @@ "printWidth": 100, "tabWidth": 2, "useTabs": false, - "semi": true, "singleQuote": true, "quoteProps": "as-needed", "jsxSingleQuote": false, diff --git a/sdk/core/MIGRATION_GUIDE.md b/sdk/core/MIGRATION_GUIDE.md new file mode 100644 index 000000000..1e47c4f73 --- /dev/null +++ b/sdk/core/MIGRATION_GUIDE.md @@ -0,0 +1,312 @@ +# Identity Verification Hub Migration Guide: V1 to V2 + +This guide helps you migrate from Identity Verification Hub V1 to V2 using the migration-focused adapter. + +## 🎯 Overview + +The migration adapter provides a smooth transition path from V1 to V2 with: + +- **Automatic version detection** +- **Migration guidance and validation** +- **Backward compatibility during transition** +- **Step-by-step migration utilities** + +## 📋 Migration Checklist + +### Pre-Migration + +- [ ] Review breaking changes +- [ ] Check V2 availability on your network +- [ ] Test migration in staging environment +- [ ] Update error handling for V2 error types +- [ ] Plan attestation ID strategy + +### During Migration + +- [ ] Deploy V2 implementation +- [ ] Update contract references +- [ ] Migrate verification calls +- [ ] Update registration calls +- [ ] Configure V2 verification settings + +### Post-Migration + +- [ ] Test all verification flows +- [ ] Update documentation +- [ ] Monitor for issues +- [ ] Remove V1 fallbacks + +## 🚀 Quick Start + +### 1. Check Current Version + +```typescript +import { getMigrationReport } from '@selfxyz/core'; + +const report = await getMigrationReport(contractAddress, publicClient); +console.log('Current version:', report.currentVersion); +console.log('Can migrate:', report.canMigrate); +console.log('Migration steps:', report.migrationInfo.migrationSteps); +``` + +### 2. Use Migration-Focused Adapter + +```typescript +import { createHubAdapterWithValidation } from '@selfxyz/core'; + +const hub = await createHubAdapterWithValidation(contractAddress, publicClient, { + validateMigration: true, + showWarnings: true, +}); + +// Get migration guidance +const migrationInfo = hub.getMigrationInfo(); +console.log('Migration steps:', migrationInfo.migrationSteps); +``` + +### 3. Validate Migration Readiness + +```typescript +import { HubMigrationUtils } from '@selfxyz/core'; + +const readiness = HubMigrationUtils.validateMigrationReadiness(hub, 'v2'); +if (!readiness.ready) { + console.warn('Migration issues:', readiness.issues); +} +``` + +## 🔄 Migration Examples + +### Before (V1) + +```typescript +// V1 verification +const result = await hub.verifyVcAndDisclose(proof); + +// V1 registration +await hub.registerPassportCommitment(registerCircuitVerifierId, registerCircuitProof); +``` + +### After (V2) + +```typescript +// V2 verification +await hub.verify(baseVerificationInput, userContextData); + +// V2 registration +await hub.registerPassportCommitment( + attestationId, // New parameter + registerCircuitVerifierId, + registerCircuitProof +); +``` + +### During Migration (Adapter) + +```typescript +// Works with both V1 and V2 automatically +const hub = await createHubAdapter(contractAddress, publicClient); + +// Automatically uses correct method based on version +if (hub.version === 'v1') { + const result = await hub.verifyVcAndDisclose(proof); +} else { + await hub.verify(baseVerificationInput, userContextData); +} +``` + +## ⚠️ Breaking Changes + +### Method Signature Changes + +| V1 Method | V2 Method | Changes | +| --------------------------------------- | ---------------------------------------------------- | ------------------------ | +| `verifyVcAndDisclose(proof)` | `verify(input, context)` | Completely new interface | +| `registerPassportCommitment(id, proof)` | `registerCommitment(attestationId, id, proof)` | Added attestationId | +| `registerDscKeyCommitment(id, proof)` | `registerDscKeyCommitment(attestationId, id, proof)` | Added attestationId | + +### Configuration Changes + +| V1 | V2 | +| ------------------------ | ------------------------------------ | +| Hardcoded parameters | Configurable verification configs | +| Single registry/verifier | Per-attestation registries/verifiers | +| Simple error handling | Enhanced error types | + +## 🛠️ Migration Utilities + +### Version Detection + +```typescript +import { supportsV2 } from '@selfxyz/core'; + +const isV2 = await supportsV2(contractAddress, publicClient); +``` + +### Migration Report + +```typescript +import { getMigrationReport } from '@selfxyz/core'; + +const report = await getMigrationReport(contractAddress, publicClient); +console.log('Current version:', report.currentVersion); +console.log('Breaking changes:', report.migrationInfo.breakingChanges); +console.log('New features:', report.migrationInfo.newFeatures); +``` + +### Validation + +```typescript +import { HubMigrationUtils } from '@selfxyz/core'; + +const readiness = HubMigrationUtils.validateMigrationReadiness(hub, 'v2'); +if (readiness.ready) { + console.log('Ready to migrate!'); +} else { + console.warn('Issues found:', readiness.issues); +} +``` + +## 🔧 Configuration Migration + +### V1 Configuration + +```typescript +// V1 had hardcoded parameters in the contract +const hub = new HubV1Adapter(contract, publicClient); +``` + +### V2 Configuration + +```typescript +// V2 uses configurable verification configs +const config = { + // Your verification configuration +}; + +const configId = await hub.setVerificationConfigV2(config); +``` + +## 🚨 Error Handling Migration + +### V1 Error Handling + +```typescript +try { + await hub.verifyVcAndDisclose(proof); +} catch (error) { + // Simple error handling + console.error('Verification failed:', error.message); +} +``` + +### V2 Error Handling + +```typescript +import { HubVersionError, HubMigrationError } from '@selfxyz/core'; + +try { + await hub.verify(baseVerificationInput, userContextData); +} catch (error) { + if (error instanceof HubVersionError) { + console.error('Version-specific error:', error.operation); + } else if (error instanceof HubMigrationError) { + console.error('Migration required:', error.migrationSteps); + } else { + console.error('Verification failed:', error.message); + } +} +``` + +## 📊 Migration Progress Tracking + +### Check Migration Status + +```typescript +const hub = await createHubAdapter(contractAddress, publicClient); + +console.log('Version:', hub.version); +console.log('Is legacy:', hub.isLegacy); +console.log('Can migrate to V2:', hub.canMigrateToV2()); + +if (hub.version === 'v1') { + const migrationPath = hub.getV2MigrationPath(); + console.log('Migration steps:', migrationPath); +} +``` + +### Monitor Migration Warnings + +```typescript +// The adapter automatically logs migration warnings +const hub = await createHubAdapterWithValidation(contractAddress, publicClient, { + showWarnings: true, +}); + +// Warnings will appear in console: +// [Migration Notice] Using V1 hub at 0x... Consider migrating to V2 for new features. +``` + +## 🎯 Best Practices + +### 1. Gradual Migration + +- Start with non-critical flows +- Test thoroughly in staging +- Monitor for issues +- Migrate critical flows last + +### 2. Error Handling + +- Update error handling for V2 error types +- Add migration-specific error handling +- Log migration warnings appropriately + +### 3. Testing + +- Test all verification flows with V2 +- Verify attestation ID handling +- Test error scenarios +- Validate configuration migration + +### 4. Documentation + +- Update API documentation +- Document breaking changes +- Provide migration examples +- Update error handling guides + +## 🆘 Troubleshooting + +### Common Issues + +#### "V1 does not support the new verify method" + +**Solution**: Use `verifyVcAndDisclose()` for V1 or migrate to V2. + +#### "V2 requires attestationId" + +**Solution**: Add attestationId parameter to registration calls. + +#### "Migration validation failed" + +**Solution**: Review the validation issues and address them before migrating. + +#### "V2 not available on current network" + +**Solution**: Deploy V2 implementation first or use V1 until V2 is available. + +### Getting Help + +1. Check the migration report for specific guidance +2. Review breaking changes in the migration info +3. Use validation utilities to identify issues +4. Test in staging environment first +5. Monitor console warnings for migration guidance + +## 📚 Additional Resources + +- [V2 API Documentation](./API.md) +- [Breaking Changes Guide](./BREAKING_CHANGES.md) +- [Configuration Guide](./CONFIGURATION.md) +- [Error Handling Guide](./ERROR_HANDLING.md) diff --git a/sdk/core/index.ts b/sdk/core/index.ts index 13579e3a1..915197fcb 100644 --- a/sdk/core/index.ts +++ b/sdk/core/index.ts @@ -1,23 +1,21 @@ -import { SelfBackendVerifier } from './src/SelfBackendVerifier.js'; -import { countryCodes } from '@selfxyz/common/constants'; +import { countries, countryCodes } from '@selfxyz/common/constants'; import { getUniversalLink } from '@selfxyz/common/utils/appType'; -import { countries } from '@selfxyz/common/constants'; -import type { AttestationId, VerificationResult, VerificationConfig } from 'src/types/types.js'; -import type { IConfigStorage } from 'src/store/interface.js'; -import { DefaultConfigStore } from 'src/store/DefaultConfigStore.js'; -import { AllIds } from 'src/utils/constants.js'; -import { InMemoryConfigStore } from 'src/store/InMemoryConfigStore.js'; + +import { SelfBackendVerifier } from './src/SelfBackendVerifier.js'; +import { DefaultConfigStore } from './src/store/DefaultConfigStore.js'; +import { InMemoryConfigStore } from './src/store/InMemoryConfigStore.js'; +import type { IConfigStorage } from './src/store/interface.js'; +import type { AttestationId, VerificationConfig, VerificationResult } from './src/types/types.js'; +import { AllIds } from './src/utils/constants.js'; + +export type { AttestationId, IConfigStorage, VerificationConfig, VerificationResult }; export { + AllIds, + DefaultConfigStore, + InMemoryConfigStore, SelfBackendVerifier, + countries, countryCodes, getUniversalLink, - countries, - AttestationId, - IConfigStorage, - DefaultConfigStore, - InMemoryConfigStore, - AllIds, - VerificationResult, - VerificationConfig, }; diff --git a/sdk/core/package.json b/sdk/core/package.json index 786008434..891f1df6a 100644 --- a/sdk/core/package.json +++ b/sdk/core/package.json @@ -17,31 +17,119 @@ "type": "module", "exports": { ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - } + "types": "./dist/esm/index.d.ts", + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.cjs" + }, + "./SelfBackendVerifier": { + "types": "./dist/esm/src/SelfBackendVerifier.d.ts", + "import": "./dist/esm/src/SelfBackendVerifier.js", + "require": "./dist/cjs/src/SelfBackendVerifier.cjs" + }, + "./errors": { + "types": "./dist/esm/src/errors.d.ts", + "import": "./dist/esm/src/errors.js", + "require": "./dist/cjs/src/errors.cjs" + }, + "./store/DefaultConfigStore": { + "types": "./dist/esm/src/store/DefaultConfigStore.d.ts", + "import": "./dist/esm/src/store/DefaultConfigStore.js", + "require": "./dist/cjs/src/store/DefaultConfigStore.cjs" + }, + "./store/InMemoryConfigStore": { + "types": "./dist/esm/src/store/InMemoryConfigStore.d.ts", + "import": "./dist/esm/src/store/InMemoryConfigStore.js", + "require": "./dist/cjs/src/store/InMemoryConfigStore.cjs" + }, + "./store/interface": { + "types": "./dist/esm/src/store/interface.d.ts", + "import": "./dist/esm/src/store/interface.js", + "require": "./dist/cjs/src/store/interface.cjs" + }, + "./types": { + "types": "./dist/esm/src/types/types.d.ts", + "import": "./dist/esm/src/types/types.js", + "require": "./dist/cjs/src/types/types.cjs" + }, + "./utils": { + "types": "./dist/esm/src/utils/utils.d.ts", + "import": "./dist/esm/src/utils/utils.js", + "require": "./dist/cjs/src/utils/utils.cjs" + }, + "./utils/constants": { + "types": "./dist/esm/src/utils/constants.d.ts", + "import": "./dist/esm/src/utils/constants.js", + "require": "./dist/cjs/src/utils/constants.cjs" + }, + "./utils/hash": { + "types": "./dist/esm/src/utils/hash.d.ts", + "import": "./dist/esm/src/utils/hash.js", + "require": "./dist/cjs/src/utils/hash.cjs" + }, + "./utils/id": { + "types": "./dist/esm/src/utils/id.d.ts", + "import": "./dist/esm/src/utils/id.js", + "require": "./dist/cjs/src/utils/id.cjs" + }, + "./utils/proof": { + "types": "./dist/esm/src/utils/proof.d.ts", + "import": "./dist/esm/src/utils/proof.js", + "require": "./dist/cjs/src/utils/proof.cjs" + }, + "./typechain-types": { + "types": "./dist/esm/src/typechain-types/index.d.ts", + "import": "./dist/esm/src/typechain-types/index.js", + "require": "./dist/cjs/src/typechain-types/index.cjs" + }, + "./typechain-types/*": { + "types": "./dist/esm/src/typechain-types/*.d.ts", + "import": "./dist/esm/src/typechain-types/*.js", + "require": "./dist/cjs/src/typechain-types/*.cjs" + }, + "./abi/VerifyAll": { + "types": "./dist/esm/src/abi/VerifyAll.d.ts", + "import": "./dist/esm/src/abi/VerifyAll.js", + "require": "./dist/cjs/src/abi/VerifyAll.cjs" + }, + "./abi/IdentityVerificationHubImplV2": { + "types": "./dist/esm/src/abi/IdentityVerificationHubImplV2.d.ts", + "import": "./dist/esm/src/abi/IdentityVerificationHubImplV2.js", + "require": "./dist/cjs/src/abi/IdentityVerificationHubImplV2.cjs" + }, + "./abi/IdentityVerificationHubImplV1": { + "types": "./dist/esm/src/abi/IdentityVerificationHubImplV1.d.ts", + "import": "./dist/esm/src/abi/IdentityVerificationHubImplV1.js", + "require": "./dist/cjs/src/abi/IdentityVerificationHubImplV1.cjs" + }, + "./abi/IdentityRegistryImplV1": { + "types": "./dist/esm/src/abi/IdentityRegistryImplV1.d.ts", + "import": "./dist/esm/src/abi/IdentityRegistryImplV1.js", + "require": "./dist/cjs/src/abi/IdentityRegistryImplV1.cjs" + }, + "./abi/*": "./src/abi/*" }, - "main": "dist/index.cjs", - "module": "dist/index.js", - "types": "dist/index.d.cts", + "main": "dist/cjs/index.cjs", + "module": "dist/esm/index.js", + "types": "dist/esm/index.d.ts", "files": [ "dist" ], "scripts": { - "build": "typechain --target ethers-v6 --node16-modules --out-dir src/typechain-types src/abi/**.json && tsup index.ts --format cjs,esm --dts --clean --sourcemap", + "build": "tsup && yarn build:types && yarn postbuild", + "postbuild": "node ./scripts/postBuild.mjs", "build:deps": "yarn workspaces foreach --from @selfxyz/core --topological-dev --recursive run build", + "build:types": "tsc -p tsconfig.json --emitDeclarationOnly", + "build:watch": "tsup --watch", "copy-abi": "bash scripts/copyAbi.sh", "format": "prettier --write .", + "generate-typechain": "typechain --target ethers-v6 --out-dir src/typechain-types ../../contracts/artifacts/contracts/**/*.json", "install-sdk": "yarn workspaces focus @selfxyz/core", - "lint": "prettier --check .", + "lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs", + "lint:fix": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs --fix", + "nice": "yarn format && yarn lint:fix", "prepublishOnly": "npm run build", "publish": "yarn npm publish --access public", + "test:build": "yarn build && yarn lint && yarn types", "types": "yarn build" }, "dependencies": { @@ -67,7 +155,14 @@ "@types/node-forge": "^1.3.5", "@types/pako": "^2.0.3", "@types/snarkjs": "^0.7.8", + "@typescript-eslint/eslint-plugin": "^7.0.0", + "@typescript-eslint/parser": "^7.0.0", "axios": "^1.7.2", + "eslint": "^8.57.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-sort-exports": "^0.8.0", "prettier": "^3.3.3", "ts-loader": "^9.5.1", "ts-node": "^10.9.2", diff --git a/sdk/core/scripts/copyAbi.sh b/sdk/core/scripts/copyAbi.sh index f18500c88..ba0e855f7 100644 --- a/sdk/core/scripts/copyAbi.sh +++ b/sdk/core/scripts/copyAbi.sh @@ -7,8 +7,8 @@ DEST_DIR="$SCRIPT_DIR/../src/abi" mkdir -p "$DEST_DIR" SOURCE_REGISTRY="$SCRIPT_DIR/../../../contracts/artifacts/contracts/registry/IdentityRegistryImplV1.sol/IdentityRegistryImplV1.json" - SOURCE_VERIFYALL="$SCRIPT_DIR/../../../contracts/artifacts/contracts/sdk/VerifyAll.sol/VerifyAll.json" +SOURCE_HUB_V2="$SCRIPT_DIR/../../../contracts/artifacts/contracts/IdentityVerificationHubImplV2.sol/IdentityVerificationHubImplV2.json" if [ ! -f "$SOURCE_REGISTRY" ]; then echo "Source JSON file does not exist: $SOURCE_REGISTRY" @@ -20,14 +20,22 @@ if [ ! -f "$SOURCE_VERIFYALL" ]; then exit 1 fi +if [ ! -f "$SOURCE_HUB_V2" ]; then + echo "Source JSON file does not exist: $SOURCE_HUB_V2" + exit 1 +fi + ABI_JSON_REGISTRY=$(jq '.abi' "$SOURCE_REGISTRY") ABI_JSON_VERIFYALL=$(jq '.abi' "$SOURCE_VERIFYALL") +ABI_JSON_HUB_V2=$(jq '.abi' "$SOURCE_HUB_V2") OUTPUT_REGISTRY="export const registryAbi = ${ABI_JSON_REGISTRY};" OUTPUT_VERIFYALL="export const verifyAllAbi = ${ABI_JSON_VERIFYALL};" +OUTPUT_HUB_V2="export const hubV2Abi = ${ABI_JSON_HUB_V2};" DEST_REGISTRY_TS="$DEST_DIR/IdentityRegistryImplV1.ts" DEST_VERIFYALL_TS="$DEST_DIR/VerifyAll.ts" +DEST_HUB_V2_TS="$DEST_DIR/IdentityVerificationHubImplV2.ts" echo "$OUTPUT_REGISTRY" > "$DEST_REGISTRY_TS" echo "Written ABI for IdentityRegistryImplV1 to: $DEST_REGISTRY_TS" @@ -35,4 +43,7 @@ echo "Written ABI for IdentityRegistryImplV1 to: $DEST_REGISTRY_TS" echo "$OUTPUT_VERIFYALL" > "$DEST_VERIFYALL_TS" echo "Written ABI for VerifyAll to: $DEST_VERIFYALL_TS" +echo "$OUTPUT_HUB_V2" > "$DEST_HUB_V2_TS" +echo "Written ABI for IdentityVerificationHubImplV2 to: $DEST_HUB_V2_TS" + echo "ABI files copied and written successfully." diff --git a/sdk/core/scripts/migrate.mjs b/sdk/core/scripts/migrate.mjs new file mode 100755 index 000000000..b84ec786d --- /dev/null +++ b/sdk/core/scripts/migrate.mjs @@ -0,0 +1,43 @@ +#!/usr/bin/env node + +import { execSync } from 'child_process'; + +async function migrateSDKCore() { + console.log('🚀 Starting migration for @selfxyz/core...'); + + console.log('📦 Installing new dependencies...'); + execSync( + 'yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-simple-import-sort eslint-plugin-sort-exports sort-exports', + { stdio: 'inherit' } + ); + + console.log('🔧 Adding .js extensions to imports...'); + try { + execSync( + "find . -name '*.ts' -not -path './node_modules/*' -not -path './dist/*' -not -path './typechain-types/*' -exec sed -i \"\" \"s/from '\\\.\\.\\/\([^']*\)'/from '..\/\\1.js'/g\" {} +", + { stdio: 'inherit' } + ); + execSync( + "find . -name '*.ts' -not -path './node_modules/*' -not -path './dist/*' -not -path './typechain-types/*' -exec sed -i \"\" \"s/from '\\.\/\([^']*\)'/from './\\1.js'/g\" {} +", + { stdio: 'inherit' } + ); + } catch (error) { + console.log('⚠️ Some files may already have .js extensions or no relative imports found'); + } + + console.log('✨ Running formatting and linting...'); + try { + execSync('yarn nice', { stdio: 'inherit' }); + } catch (error) { + console.log('⚠️ Some linting issues may need manual fixing'); + } + + console.log('✅ Migration completed for @selfxyz/core!'); + console.log('📋 Next steps:'); + console.log(' 1. Review and fix any remaining linting issues'); + console.log(' 2. Test the build: yarn build'); + console.log(' 3. Test the types: yarn types'); + console.log(' 4. Run tests if available'); +} + +migrateSDKCore().catch(console.error); diff --git a/sdk/core/scripts/postBuild.mjs b/sdk/core/scripts/postBuild.mjs new file mode 100644 index 000000000..2ecf75e20 --- /dev/null +++ b/sdk/core/scripts/postBuild.mjs @@ -0,0 +1,71 @@ +import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { shimConfigs } from './shimConfigs.mjs'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const DIST = path.resolve(__dirname, '..', 'dist'); + +// Read the version from the main package.json +const packageJsonPath = path.resolve(__dirname, '..', 'package.json'); +const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); + +writeFileSync(path.join(DIST, 'esm', 'package.json'), JSON.stringify({ type: 'module' }, null, 4)); +writeFileSync( + path.join(DIST, 'cjs', 'package.json'), + JSON.stringify({ type: 'commonjs' }, null, 4) +); + +// Create a package.json in the dist root for Metro compatibility +const distPackageJson = { + name: '@selfxyz/core', + version: packageJson.version, + type: 'module', + exports: { + '.': './esm/index.js', + './SelfBackendVerifier': './esm/src/SelfBackendVerifier.js', + './errors': './esm/src/errors.js', + './store/DefaultConfigStore': './esm/src/store/DefaultConfigStore.js', + './store/InMemoryConfigStore': './esm/src/store/InMemoryConfigStore.js', + './store/interface': './esm/src/store/interface.js', + './types': './esm/src/types/types.js', + './utils': './esm/src/utils/utils.js', + './utils/constants': './esm/src/utils/constants.js', + './utils/hash': './esm/src/utils/hash.js', + './utils/id': './esm/src/utils/id.js', + './utils/proof': './esm/src/utils/proof.js', + './typechain-types': './esm/src/typechain-types/index.js', + './abi/VerifyAll': './esm/src/abi/VerifyAll.js', + './abi/IdentityVerificationHubImplV2': './esm/src/abi/IdentityVerificationHubImplV2.js', + './abi/IdentityVerificationHubImplV1': './esm/src/abi/IdentityVerificationHubImplV1.js', + './abi/IdentityRegistryImplV1': './esm/src/abi/IdentityRegistryImplV1.js', + }, +}; +writeFileSync(path.join(DIST, 'package.json'), JSON.stringify(distPackageJson, null, 4)); + +// Helper function to create shim files +function createShim(shimPath, targetPath, name) { + const shimDir = path.join(DIST, shimPath); + mkdirSync(shimDir, { recursive: true }); + + // Ensure Node treats this folder as CommonJS + writeFileSync(path.join(shimDir, 'package.json'), JSON.stringify({ type: 'commonjs' }, null, 2)); + + // Tsup emits .js files by default, so just swap the directory + const cjsTargetPath = targetPath.replace('/esm/', '/cjs/'); + + writeFileSync( + path.join(shimDir, 'index.js'), + `// Shim file to help Metro resolve @selfxyz/core/${name}\nmodule.exports = require('${cjsTargetPath}');` + ); + writeFileSync( + path.join(shimDir, 'index.d.ts'), + `// Shim file to help Metro resolve @selfxyz/core/${name} types\nexport * from '${targetPath.replace('.js', '')}';` + ); +} + +// Create all shims from configuration +shimConfigs.forEach((config) => { + createShim(config.shimPath, config.targetPath, config.name); +}); diff --git a/sdk/core/scripts/shimConfigs.mjs b/sdk/core/scripts/shimConfigs.mjs new file mode 100644 index 000000000..6ad4aa0b0 --- /dev/null +++ b/sdk/core/scripts/shimConfigs.mjs @@ -0,0 +1,60 @@ +// Shim configurations for @selfxyz/core +export const shimConfigs = [ + { + shimPath: 'SelfBackendVerifier', + targetPath: '../esm/src/SelfBackendVerifier.js', + name: 'SelfBackendVerifier', + }, + { shimPath: 'errors', targetPath: '../esm/src/errors.js', name: 'errors' }, + { + shimPath: 'store/DefaultConfigStore', + targetPath: '../../esm/src/store/DefaultConfigStore.js', + name: 'store/DefaultConfigStore', + }, + { + shimPath: 'store/InMemoryConfigStore', + targetPath: '../../esm/src/store/InMemoryConfigStore.js', + name: 'store/InMemoryConfigStore', + }, + { + shimPath: 'store/interface', + targetPath: '../../esm/src/store/interface.js', + name: 'store/interface', + }, + { shimPath: 'types', targetPath: '../esm/src/types/types.js', name: 'types' }, + { shimPath: 'utils', targetPath: '../esm/src/utils/utils.js', name: 'utils' }, + { + shimPath: 'utils/constants', + targetPath: '../../esm/src/utils/constants.js', + name: 'utils/constants', + }, + { shimPath: 'utils/hash', targetPath: '../../esm/src/utils/hash.js', name: 'utils/hash' }, + { shimPath: 'utils/id', targetPath: '../../esm/src/utils/id.js', name: 'utils/id' }, + { shimPath: 'utils/proof', targetPath: '../../esm/src/utils/proof.js', name: 'utils/proof' }, + { + shimPath: 'typechain-types', + targetPath: '../esm/src/typechain-types/index.js', + name: 'typechain-types', + }, + // ABIs + { + shimPath: 'abi/VerifyAll', + targetPath: '../../esm/src/abi/VerifyAll.js', + name: 'abi/VerifyAll', + }, + { + shimPath: 'abi/IdentityVerificationHubImplV2', + targetPath: '../../esm/src/abi/IdentityVerificationHubImplV2.js', + name: 'abi/IdentityVerificationHubImplV2', + }, + { + shimPath: 'abi/IdentityVerificationHubImplV1', + targetPath: '../../esm/src/abi/IdentityVerificationHubImplV1.js', + name: 'abi/IdentityVerificationHubImplV1', + }, + { + shimPath: 'abi/IdentityRegistryImplV1', + targetPath: '../../esm/src/abi/IdentityRegistryImplV1.js', + name: 'abi/IdentityRegistryImplV1', + }, +]; diff --git a/sdk/core/src/SelfBackendVerifier.ts b/sdk/core/src/SelfBackendVerifier.ts index e86dbdc92..05d685cd5 100644 --- a/sdk/core/src/SelfBackendVerifier.ts +++ b/sdk/core/src/SelfBackendVerifier.ts @@ -1,22 +1,24 @@ +import type { BigNumberish } from 'ethers'; import { ethers } from 'ethers'; + +import type { Country3LetterCode } from '@selfxyz/common/constants'; +import type { UserIdType } from '@selfxyz/common/utils/circuits/uuid'; +import { castToUserIdentifier } from '@selfxyz/common/utils/circuits/uuid'; import { hashEndpointWithScope } from '@selfxyz/common/utils/scope'; + +import { ConfigMismatch, ConfigMismatchError } from './errors.js'; +import type { IConfigStorage } from './store/interface.js'; +import type { IdentityVerificationHubImplV2, Verifier } from './typechain-types/index.js'; import { - IdentityVerificationHubImpl, - IdentityVerificationHubImpl__factory, + IdentityVerificationHubImplV2__factory, Registry__factory, - Verifier, Verifier__factory, } from './typechain-types/index.js'; +import type { AttestationId, VcAndDiscloseProof, VerificationConfig } from './types/types.js'; import { discloseIndices } from './utils/constants.js'; -import { formatRevealedDataPacked } from './utils/id.js'; -import { AttestationId, VcAndDiscloseProof, VerificationConfig } from './types/types.js'; -import { Country3LetterCode } from '@selfxyz/common/constants'; import { calculateUserIdentifierHash } from './utils/hash.js'; -import { castToUserIdentifier, UserIdType } from '@selfxyz/common/utils/circuits/uuid'; -import { ConfigMismatch, ConfigMismatchError } from './errors.js'; -import { IConfigStorage } from './store/interface.js'; +import { formatRevealedDataPacked } from './utils/id.js'; import { unpackForbiddenCountriesList } from './utils/utils.js'; -import { BigNumberish } from 'ethers'; const CELO_MAINNET_RPC_URL = 'https://forno.celo.org'; const CELO_TESTNET_RPC_URL = 'https://alfajores-forno.celo-testnet.org'; @@ -26,7 +28,7 @@ const IDENTITY_VERIFICATION_HUB_ADDRESS_STAGING = '0x68c931C9a534D37aa78094877F4 export class SelfBackendVerifier { protected scope: string; - protected identityVerificationHubContract: IdentityVerificationHubImpl; + protected identityVerificationHubContract: IdentityVerificationHubImplV2; protected configStorage: IConfigStorage; protected provider: ethers.JsonRpcProvider; protected allowedIds: Map; @@ -45,7 +47,7 @@ export class SelfBackendVerifier { const identityVerificationHubAddress = mockPassport ? IDENTITY_VERIFICATION_HUB_ADDRESS_STAGING : IDENTITY_VERIFICATION_HUB_ADDRESS; - this.identityVerificationHubContract = IdentityVerificationHubImpl__factory.connect( + this.identityVerificationHubContract = IdentityVerificationHubImplV2__factory.connect( identityVerificationHubAddress, provider ); @@ -64,7 +66,7 @@ export class SelfBackendVerifier { ) { //check if attestation id is allowed const allowedId = this.allowedIds.get(attestationId); - let issues: Array<{ type: ConfigMismatch; message: string }> = []; + const issues: Array<{ type: ConfigMismatch; message: string }> = []; if (!allowedId) { issues.push({ type: ConfigMismatch.InvalidId, @@ -154,22 +156,18 @@ export class SelfBackendVerifier { }); } - let verificationConfig: VerificationConfig | null; + let verificationConfig: VerificationConfig | null = null; try { verificationConfig = await this.configStorage.getConfig(configId); - } catch (error) { + } catch { + /* ignore */ + } + if (!verificationConfig) { issues.push({ type: ConfigMismatch.ConfigNotFound, message: `Config not found for ${configId}`, }); - } finally { - if (!verificationConfig) { - issues.push({ - type: ConfigMismatch.ConfigNotFound, - message: `Config not found for ${configId}`, - }); - throw new ConfigMismatchError(issues); - } + throw new ConfigMismatchError(issues); } //check if forbidden countries list matches diff --git a/sdk/core/src/abi/IdentityRegistryImplV1.ts b/sdk/core/src/abi/IdentityRegistryImplV1.ts new file mode 100644 index 000000000..9f7b7f9ff --- /dev/null +++ b/sdk/core/src/abi/IdentityRegistryImplV1.ts @@ -0,0 +1,1228 @@ +export const registryAbi = [ + { + inputs: [], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + ], + name: 'AddressEmptyCode', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'implementation', + type: 'address', + }, + ], + name: 'ERC1967InvalidImplementation', + type: 'error', + }, + { + inputs: [], + name: 'ERC1967NonPayable', + type: 'error', + }, + { + inputs: [], + name: 'FailedCall', + type: 'error', + }, + { + inputs: [], + name: 'HUB_NOT_SET', + type: 'error', + }, + { + inputs: [], + name: 'InvalidInitialization', + type: 'error', + }, + { + inputs: [], + name: 'LeafAlreadyExists', + type: 'error', + }, + { + inputs: [], + name: 'LeafCannotBeZero', + type: 'error', + }, + { + inputs: [], + name: 'LeafDoesNotExist', + type: 'error', + }, + { + inputs: [], + name: 'LeafGreaterThanSnarkScalarField', + type: 'error', + }, + { + inputs: [], + name: 'NotInitializing', + type: 'error', + }, + { + inputs: [], + name: 'ONLY_HUB_CAN_ACCESS', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'OwnableInvalidOwner', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'OwnableUnauthorizedAccount', + type: 'error', + }, + { + inputs: [], + name: 'REGISTERED_COMMITMENT', + type: 'error', + }, + { + inputs: [], + name: 'UUPSUnauthorizedCallContext', + type: 'error', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'slot', + type: 'bytes32', + }, + ], + name: 'UUPSUnsupportedProxiableUUID', + type: 'error', + }, + { + inputs: [], + name: 'WrongSiblingNodes', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + { + indexed: true, + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtIndex', + type: 'uint256', + }, + ], + name: 'CommitmentRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'cscaRoot', + type: 'uint256', + }, + ], + name: 'CscaRootUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + { + indexed: true, + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtIndex', + type: 'uint256', + }, + ], + name: 'DevCommitmentRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + ], + name: 'DevCommitmentRemoved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + indexed: true, + internalType: 'uint256', + name: 'newLeaf', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + ], + name: 'DevCommitmentUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtIndex', + type: 'uint256', + }, + ], + name: 'DevDscKeyCommitmentRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + ], + name: 'DevDscKeyCommitmentRemoved', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + { + indexed: false, + internalType: 'bool', + name: 'state', + type: 'bool', + }, + ], + name: 'DevDscKeyCommitmentStateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + indexed: true, + internalType: 'uint256', + name: 'newLeaf', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + ], + name: 'DevDscKeyCommitmentUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + { + indexed: false, + internalType: 'bool', + name: 'state', + type: 'bool', + }, + ], + name: 'DevNullifierStateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtRoot', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'imtIndex', + type: 'uint256', + }, + ], + name: 'DscKeyCommitmentRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'hub', + type: 'address', + }, + ], + name: 'HubUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint64', + name: 'version', + type: 'uint64', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'nameAndDobOfacRoot', + type: 'uint256', + }, + ], + name: 'NameAndDobOfacRootUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'nameAndYobOfacRoot', + type: 'uint256', + }, + ], + name: 'NameAndYobOfacRootUpdated', + 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: false, + internalType: 'uint256', + name: 'passportNoOfacRoot', + type: 'uint256', + }, + ], + name: 'PassportNoOfacRootUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'hub', + type: 'address', + }, + ], + name: 'RegistryInitialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'implementation', + type: 'address', + }, + ], + name: 'Upgraded', + type: 'event', + }, + { + inputs: [], + name: 'UPGRADE_INTERFACE_VERSION', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'acceptOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'root', + type: 'uint256', + }, + ], + name: 'checkCscaRoot', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'root', + type: 'uint256', + }, + ], + name: 'checkDscKeyCommitmentMerkleRoot', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'root', + type: 'uint256', + }, + ], + name: 'checkIdentityCommitmentRoot', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'passportNoRoot', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'nameAndDobRoot', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'nameAndYobRoot', + type: 'uint256', + }, + ], + name: 'checkOfacRoots', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'dscCommitment', + type: 'uint256', + }, + ], + name: 'devAddDscKeyCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + ], + name: 'devAddIdentityCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'dscCommitment', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'state', + type: 'bool', + }, + ], + name: 'devChangeDscKeyCommitmentState', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'state', + type: 'bool', + }, + ], + name: 'devChangeNullifierState', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'siblingNodes', + type: 'uint256[]', + }, + ], + name: 'devRemoveCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'siblingNodes', + type: 'uint256[]', + }, + ], + name: 'devRemoveDscKeyCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'newLeaf', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'siblingNodes', + type: 'uint256[]', + }, + ], + name: 'devUpdateCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'oldLeaf', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'newLeaf', + type: 'uint256', + }, + { + internalType: 'uint256[]', + name: 'siblingNodes', + type: 'uint256[]', + }, + ], + name: 'devUpdateDscKeyCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'getCscaRoot', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + ], + name: 'getDscKeyCommitmentIndex', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getDscKeyCommitmentMerkleRoot', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getDscKeyCommitmentTreeSize', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + ], + name: 'getIdentityCommitmentIndex', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getIdentityCommitmentMerkleRoot', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getIdentityCommitmentMerkleTreeSize', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getNameAndDobOfacRoot', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getNameAndYobOfacRoot', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'getPassportNoOfacRoot', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'hub', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'hubAddress', + type: 'address', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + ], + name: 'isRegisteredDscKeyCommitment', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + ], + name: 'nullifiers', + 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: [], + name: 'proxiableUUID', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'commitment', + type: 'uint256', + }, + ], + name: 'registerCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'dscCommitment', + type: 'uint256', + }, + ], + name: 'registerDscKeyCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'root', + type: 'uint256', + }, + ], + name: 'rootTimestamps', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'newCscaRoot', + type: 'uint256', + }, + ], + name: 'updateCscaRoot', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newHubAddress', + type: 'address', + }, + ], + name: 'updateHub', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'newNameAndDobOfacRoot', + type: 'uint256', + }, + ], + name: 'updateNameAndDobOfacRoot', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'newNameAndYobOfacRoot', + type: 'uint256', + }, + ], + name: 'updateNameAndYobOfacRoot', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'newPassportNoOfacRoot', + type: 'uint256', + }, + ], + name: 'updatePassportNoOfacRoot', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newImplementation', + type: 'address', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'upgradeToAndCall', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, +] as const; diff --git a/sdk/core/src/abi/IdentityVerificationHubImpl.json b/sdk/core/src/abi/IdentityVerificationHubImpl.json index 398e6fba1..e4912cc88 100644 --- a/sdk/core/src/abi/IdentityVerificationHubImpl.json +++ b/sdk/core/src/abi/IdentityVerificationHubImpl.json @@ -3,6 +3,459 @@ "contractName": "IdentityVerificationHubImplV2", "sourceName": "contracts/IdentityVerificationHubImplV2.sol", "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [], + "name": "ConfigNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "CrossChainIsNotSupportedYet", + "type": "error" + }, + { + "inputs": [], + "name": "CurrentDateNotInValidRange", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "ERC1967InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "ERC1967NonPayable", + "type": "error" + }, + { + "inputs": [], + "name": "FailedCall", + "type": "error" + }, + { + "inputs": [], + "name": "InputTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAttestationId", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidCscaRoot", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDateDigit", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDateLength", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDayRange", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDscCommitmentRoot", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDscProof", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidFieldElement", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidIdentityCommitmentRoot", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidMonthRange", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidRegisterProof", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidUserIdentifierInProof", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVcAndDiscloseProof", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidYearRange", + "type": "error" + }, + { + "inputs": [], + "name": "LengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "NoVerifierSet", + "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" + }, + { + "inputs": [], + "name": "ScopeMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "inputs": [], + "name": "UserContextDataTooShort", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "typeId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "DscCircuitVerifierUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "HubInitializedV2", + "type": "event" + }, + { + "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": false, + "internalType": "uint256", + "name": "typeId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "RegisterCircuitVerifierUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "registry", + "type": "address" + } + ], + "name": "RegistryUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "vcAndDiscloseCircuitVerifier", + "type": "address" + } + ], + "name": "VcAndDiscloseCircuitUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "configId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bool", + "name": "olderThanEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "olderThan", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "forbiddenCountriesEnabled", + "type": "bool" + }, + { + "internalType": "uint256[4]", + "name": "forbiddenCountriesListPacked", + "type": "uint256[4]" + }, + { + "internalType": "bool[3]", + "name": "ofacEnabled", + "type": "bool[3]" + } + ], + "indexed": false, + "internalType": "struct SelfStructs.VerificationConfigV2", + "name": "config", + "type": "tuple" + } + ], + "name": "VerificationConfigV2Set", + "type": "event" + }, + { + "inputs": [], + "name": "UPGRADE_INTERFACE_VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "attestationIds", + "type": "bytes32[]" + }, + { + "internalType": "uint256[]", + "name": "typeIds", + "type": "uint256[]" + }, + { + "internalType": "address[]", + "name": "verifierAddresses", + "type": "address[]" + } + ], + "name": "batchUpdateDscCircuitVerifiers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "attestationIds", + "type": "bytes32[]" + }, + { + "internalType": "uint256[]", + "name": "typeIds", + "type": "uint256[]" + }, + { + "internalType": "address[]", + "name": "verifierAddresses", + "type": "address[]" + } + ], + "name": "batchUpdateRegisterCircuitVerifiers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -22,6 +475,301 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "typeId", + "type": "uint256" + } + ], + "name": "dscCircuitVerifiers", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "olderThanEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "olderThan", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "forbiddenCountriesEnabled", + "type": "bool" + }, + { + "internalType": "uint256[4]", + "name": "forbiddenCountriesListPacked", + "type": "uint256[4]" + }, + { + "internalType": "bool[3]", + "name": "ofacEnabled", + "type": "bool[3]" + } + ], + "internalType": "struct SelfStructs.VerificationConfigV2", + "name": "config", + "type": "tuple" + } + ], + "name": "generateConfigId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + } + ], + "name": "getIdentityCommitmentMerkleRoot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "configId", + "type": "bytes32" + } + ], + "name": "getVerificationConfigV2", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "olderThanEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "olderThan", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "forbiddenCountriesEnabled", + "type": "bool" + }, + { + "internalType": "uint256[4]", + "name": "forbiddenCountriesListPacked", + "type": "uint256[4]" + }, + { + "internalType": "bool[3]", + "name": "ofacEnabled", + "type": "bool[3]" + } + ], + "internalType": "struct SelfStructs.VerificationConfigV2", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "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": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "typeId", + "type": "uint256" + } + ], + "name": "registerCircuitVerifiers", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "registerCircuitVerifierId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256[2]", + "name": "a", + "type": "uint256[2]" + }, + { + "internalType": "uint256[2][2]", + "name": "b", + "type": "uint256[2][2]" + }, + { + "internalType": "uint256[2]", + "name": "c", + "type": "uint256[2]" + }, + { + "internalType": "uint256[3]", + "name": "pubSignals", + "type": "uint256[3]" + } + ], + "internalType": "struct IRegisterCircuitVerifier.RegisterCircuitProof", + "name": "registerCircuitProof", + "type": "tuple" + } + ], + "name": "registerCommitment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "dscCircuitVerifierId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256[2]", + "name": "a", + "type": "uint256[2]" + }, + { + "internalType": "uint256[2][2]", + "name": "b", + "type": "uint256[2][2]" + }, + { + "internalType": "uint256[2]", + "name": "c", + "type": "uint256[2]" + }, + { + "internalType": "uint256[2]", + "name": "pubSignals", + "type": "uint256[2]" + } + ], + "internalType": "struct IDscCircuitVerifier.DscCircuitProof", + "name": "dscCircuitProof", + "type": "tuple" + } + ], + "name": "registerDscKeyCommitment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -40,6 +788,255 @@ ], "stateMutability": "view", "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "root", + "type": "uint256" + } + ], + "name": "rootTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "olderThanEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "olderThan", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "forbiddenCountriesEnabled", + "type": "bool" + }, + { + "internalType": "uint256[4]", + "name": "forbiddenCountriesListPacked", + "type": "uint256[4]" + }, + { + "internalType": "bool[3]", + "name": "ofacEnabled", + "type": "bool[3]" + } + ], + "internalType": "struct SelfStructs.VerificationConfigV2", + "name": "config", + "type": "tuple" + } + ], + "name": "setVerificationConfigV2", + "outputs": [ + { + "internalType": "bytes32", + "name": "configId", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "typeId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifierAddress", + "type": "address" + } + ], + "name": "updateDscVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "typeId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifierAddress", + "type": "address" + } + ], + "name": "updateRegisterCircuitVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "registryAddress", + "type": "address" + } + ], + "name": "updateRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "vcAndDiscloseCircuitVerifierAddress", + "type": "address" + } + ], + "name": "updateVcAndDiscloseCircuit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "configId", + "type": "bytes32" + } + ], + "name": "verificationConfigV2Exists", + "outputs": [ + { + "internalType": "bool", + "name": "exists", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "baseVerificationInput", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userContextData", + "type": "bytes" + } + ], + "name": "verify", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60a06040523060805234801561001457600080fd5b5061001d610022565b6100d4565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100725760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d15780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516149316100fd600039600081816114d1015281816114fa015261169e01526149316000f3fe6080604052600436106101b75760003560e01c80638829b090116100ec578063ab9ddbfc1161008a578063d88e6a1511610064578063d88e6a15146104e0578063e30c397814610500578063f2fde38b14610515578063f7e83aee1461053557600080fd5b8063ab9ddbfc14610462578063ad3cb1cc14610482578063ca56259e146104c057600080fd5b80639ffc9aea116100c65780639ffc9aea146103d5578063a1192e98146103f5578063a1cbb9fd14610422578063ab15be081461044257600080fd5b80638829b090146103805780638846ec42146103a05780638da5cb5b146103c057600080fd5b806354ff23711161015957806379ba50971161013357806379ba5097146102fe5780637ef50298146103135780638129fc1c1461034b5780638322963f1461036057600080fd5b806354ff2371146102a9578063678c09dd146102c9578063715018a6146102e957600080fd5b80632e9c365e116101955780632e9c365e1461023157806334c14589146102615780634f1ef2861461028157806352d1902d1461029457600080fd5b806309ddb091146101bc5780631f299c1a146101ef5780632d05332814610211575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004613863565b610555565b6040519081526020015b60405180910390f35b3480156101fb57600080fd5b5061020f61020a366004613947565b61063c565b005b34801561021d57600080fd5b5061020f61022c3660046139be565b6106c3565b34801561023d57600080fd5b5061025161024c366004613a61565b61084e565b60405190151581526020016101e6565b34801561026d57600080fd5b5061020f61027c366004613a7a565b610879565b61020f61028f366004613ad6565b610909565b3480156102a057600080fd5b506101dc610928565b3480156102b557600080fd5b5061020f6102c43660046139be565b610945565b3480156102d557600080fd5b506101dc6102e4366004613b66565b610ac6565b3480156102f557600080fd5b5061020f610bc8565b34801561030a57600080fd5b5061020f610bdc565b34801561031f57600080fd5b5061033361032e366004613a61565b610c29565b6040516001600160a01b0390911681526020016101e6565b34801561035757600080fd5b5061020f610c5b565b34801561036c57600080fd5b5061020f61037b366004613c3b565b610d8e565b34801561038c57600080fd5b506101dc61039b366004613a61565b610e77565b3480156103ac57600080fd5b5061020f6103bb366004613ccb565b610f69565b3480156103cc57600080fd5b50610333611036565b3480156103e157600080fd5b5061020f6103f0366004613947565b61106b565b34801561040157600080fd5b50610415610410366004613a61565b6110e9565b6040516101e69190613da3565b34801561042e57600080fd5b506101dc61043d366004613863565b6111f4565b34801561044e57600080fd5b5061033361045d366004613a61565b611263565b34801561046e57600080fd5b5061033361047d366004613b66565b611295565b34801561048e57600080fd5b506104b3604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516101e69190613e3d565b3480156104cc57600080fd5b506103336104db366004613b66565b6112d2565b3480156104ec57600080fd5b5061020f6104fb366004613a7a565b61130f565b34801561050c57600080fd5b50610333611395565b34801561052157600080fd5b5061020f610530366004613e50565b6113be565b34801561054157600080fd5b5061020f610550366004613eac565b611443565b600061055f6114c6565b610568826111f4565b905060007ff9b5980dcec1a8b0609576a1f453bb2cad4732a0ea02bb89154d44b14a306c00600083815260208281526040918290208651815490151560ff199182161782559187015160018201559186015160028301805491151591909216179055606085015191925084916105e490600383019060046134d5565b5060808201516105fa9060078301906003613513565b50905050817f563cb841d273dd1aede464718d4f7e75319a56698703e51b406f87deee39fea48460405161062e9190613da3565b60405180910390a250919050565b6106446114c6565b61064c61156b565b600061065661159d565b600084815260018201602090815260409182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507f60d79b067258ea9c14eca8a23caf9de667903176279e5ad0d951cc02ef750a3c91015b60405180910390a1505050565b6106cb6114c6565b6106d361156b565b84831415806106e25750848114155b15610703576040516001621398b960e31b0319815260040160405180910390fd5b600061070d61159d565b905060005b868110156108445783838281811061072c5761072c613f1b565b90506020020160208101906107419190613e50565b8260030160008a8a8581811061075957610759613f1b565b905060200201358152602001908152602001600020600088888581811061078257610782613f1b565b90506020020135815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f02c7aeb52f414fb9b4dfa6100f38185b5e12b184349218c18700bc39423bedc98686838181106107ee576107ee613f1b565b9050602002013585858481811061080757610807613f1b565b905060200201602081019061081c9190613e50565b604080519283526001600160a01b0390911660208301520160405180910390a1600101610712565b5050505050505050565b60006108586114c6565b6000610863836110e9565b90508261086f826111f4565b149150505b919050565b6108816114c6565b61088961156b565b600061089361159d565b6000858152600282016020908152604080832087845282529182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507f2bdbcbf49383457c270bf05734cc8d74acb8a5788f0dc6384a715680f6a4dbcf91015b60405180910390a150505050565b6109116114c6565b61091a826115c1565b61092482826115d1565b5050565b6000610932611693565b506000805160206148e583398151915290565b61094d6114c6565b61095561156b565b84831415806109645750848114155b15610985576040516001621398b960e31b0319815260040160405180910390fd5b600061098f61159d565b905060005b86811015610844578383828181106109ae576109ae613f1b565b90506020020160208101906109c39190613e50565b8260020160008a8a858181106109db576109db613f1b565b9050602002013581526020019081526020016000206000888885818110610a0457610a04613f1b565b90506020020135815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f2bdbcbf49383457c270bf05734cc8d74acb8a5788f0dc6384a715680f6a4dbcf868683818110610a7057610a70613f1b565b90506020020135858584818110610a8957610a89613f1b565b9050602002016020810190610a9e9190613e50565b604080519283526001600160a01b0390911660208301520160405180910390a1600101610994565b6000610ad06114c6565b6000610ada61159d565b60008581526001820160205260409020549091506001600160a01b03166000198501610b735760405163ede12d9f60e01b8152600481018590526001600160a01b0382169063ede12d9f906024015b602060405180830381865afa158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613f31565b92505050610bc2565b6001198501610ba95760405163ede12d9f60e01b8152600481018590526001600160a01b0382169063ede12d9f90602401610b29565b6040516309763aff60e11b815260040160405180910390fd5b92915050565b610bd061156b565b610bda60006116dc565b565b3380610be6611395565b6001600160a01b031614610c1d5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610c26816116dc565b50565b6000610c336114c6565b6000610c3d61159d565b6000938452600101602052505060409020546001600160a01b031690565b6000610c65611714565b805490915060ff600160401b82041615906001600160401b0316600081158015610c8c5750825b90506000826001600160401b03166001148015610ca85750303b155b905081158015610cb6575080155b15610cd45760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cfe57845460ff60401b1916600160401b1785555b610d0661173d565b6000610d1061159d565b600281556040519091507f684ecf5f88ef6c4e3ff17a5bebcb19a50cf34164ba2a535a5d2cb2ef893776d490600090a1508315610d8757845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b610d966114c6565b610da1838383611756565b6000610dab61159d565b90506000198401610e3a57600084815260018201602052604081205460608401516001600160a01b039091169163445257da91905b60200201516040518263ffffffff1660e01b8152600401610e0391815260200190565b600060405180830381600087803b158015610e1d57600080fd5b505af1158015610e31573d6000803e3d6000fd5b50505050610e71565b6001198401610ba957600084815260018201602052604081205460608401516001600160a01b039091169163445257da9190610de0565b50505050565b6000610e816114c6565b6000610e8b61159d565b60008481526001820160205260409020549091506001600160a01b03166000198401610f1b57806001600160a01b0316634bf4dc7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190613f31565b949350505050565b6001198401610ba957806001600160a01b0316634bf4dc7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eef573d6000803e3d6000fd5b5050919050565b610f716114c6565b610f7c83838361193a565b6000610f8661159d565b90506000198401610ffe57600084815260018201602052604081205460608401516001600160a01b0390911691639a85d40a9187915b60200201516060860151600160200201516040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606401610e03565b6001198401610ba957600084815260018201602052604081205460608401516001600160a01b0390911691639a85d40a918791610fbc565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b6110736114c6565b61107b61156b565b600061108561159d565b600084815260048201602090815260409182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507fd2582d06c97998782647bb092ad269393ddfad65c8db96a923b9a6add6a0bdb191016106b6565b6110f16135a0565b6110f96114c6565b60008281527ff9b5980dcec1a8b0609576a1f453bb2cad4732a0ea02bb89154d44b14a306c006020818152604092839020835160a081018552815460ff90811615158252600183015493820193909352600282015490921615158285015283516080810194859052929391929091606084019190600384019060049082845b815481526020019060010190808311611178575050509183525050604080516060810191829052602090920191906007840190600390826000855b825461010083900a900460ff1615158152602060019283018181049485019490930390920291018084116111b3579050505050505081525050915050919050565b60006002826040516020016112099190613da3565b60408051601f198184030181529082905261122391613f4a565b602060405180830381855afa158015611240573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610bc29190613f31565b600061126d6114c6565b600061127761159d565b6000938452600401602052505060409020546001600160a01b031690565b600061129f6114c6565b60006112a961159d565b60009485526002016020908152604080862094865293905250509020546001600160a01b031690565b60006112dc6114c6565b60006112e661159d565b60009485526003016020908152604080862094865293905250509020546001600160a01b031690565b6113176114c6565b61131f61156b565b600061132961159d565b6000858152600382016020908152604080832087845282529182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507f02c7aeb52f414fb9b4dfa6100f38185b5e12b184349218c18700bc39423bedc991016108fb565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0061105b565b6113c661156b565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561140a611036565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b61144b6114c6565b600036600061145a8787611b1c565b92509250925060008060006114a98686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c9150611bcc9050565b9250925092506114ba828483611cff565b50505050505050505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061154d57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166115416000805160206148e5833981519152546001600160a01b031690565b6001600160a01b031614155b15610bda5760405163703e46dd60e11b815260040160405180910390fd5b33611574611036565b6001600160a01b031614610bda5760405163118cdaa760e01b8152336004820152602401610c14565b7f2ade7eace21710c689ddef374add52ace9783e33bac626e58e73a9d190173d0090565b6115c96114c6565b610c2661156b565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561162b575060408051601f3d908101601f1916820190925261162891810190613f31565b60015b61165357604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610c14565b6000805160206148e5833981519152811461168457604051632a87526960e21b815260048101829052602401610c14565b61168e8383611d7b565b505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bda5760405163703e46dd60e11b815260040160405180910390fd5b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b031916815561092482611dd1565b6000807ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00610bc2565b611745611e42565b61174e33611e67565b610bda611e78565b600061176061159d565b600085815260038201602090815260408083208784529091529020549091506001600160a01b0316806117a6576040516301dcf1ab60e31b815260040160405180910390fd5b6000198501611861576000858152600180840160205260409091205460608501516001600160a01b0390911691631465ff7f91905b60200201516040518263ffffffff1660e01b81526004016117fe91815260200190565b602060405180830381865afa15801561181b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183f9190613f66565b61185c57604051638f1b44c760e01b815260040160405180910390fd5b61189a565b6001198501610ba9576000858152600180840160205260409091205460608501516001600160a01b0390911691631465ff7f91906117db565b806001600160a01b031663f5c9d69e84600001518560200151866040015187606001516040518563ffffffff1660e01b81526004016118dc9493929190613fd4565b602060405180830381865afa1580156118f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191d9190613f66565b610d8757604051631644e04960e01b815260040160405180910390fd5b600061194461159d565b600085815260028201602090815260408083208784529091529020549091506001600160a01b03168061198a576040516301dcf1ab60e31b815260040160405180910390fd5b6000198501611a4457600085815260018301602052604090205460608401516001600160a01b0390911690639fc1e4239060025b60200201516040518263ffffffff1660e01b81526004016119e191815260200190565b602060405180830381865afa1580156119fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a229190613f66565b611a3f57604051634cb305bb60e01b815260040160405180910390fd5b611a7c565b6001198501610ba957600085815260018301602052604090205460608401516001600160a01b0390911690639fc1e4239060026119be565b806001600160a01b03166311479fea84600001518560200151866040015187606001516040518563ffffffff1660e01b8152600401611abe949392919061400b565b602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff9190613f66565b610d87576040516367b61dc760e01b815260040160405180910390fd5b60408051606081018252600080825260208201819052918101919091523660006061841015611b5e576040516365ec0cf160e01b815260040160405180910390fd5b84846000818110611b7157611b71613f1b565b919091013560f81c845250611b8a604060208688614068565b611b9391614092565b6020840152611ba6606060408688614068565b611baf91614092565b6040840152611bc18460608188614068565b915091509250925092565b60606000606060008036600080611be38a8a611e80565b929a509297509550909350915060009050611bfd85611f0e565b90506000611c168d611c0e8e612033565b8d8d8961204f565b9050600073__$a424b2de8fd0a19b90144e316fcd5f0bec$__6319d4c2268f6040015185856040518463ffffffff1660e01b8152600401611c59939291906140b0565b600060405180830381865af4158015611c76573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c9e9190810190614262565b9050611cb18e6000015160ff16826120ea565b995050505081818080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250999e989d50919b50969950505050505050505050565b468303611d6257604051634696c6b560e11b81523390638d2d8d6a90611d2b908590859060040161442d565b600060405180830381600087803b158015611d4557600080fd5b505af1158015611d59573d6000803e3d6000fd5b50505050505050565b6040516361296fbb60e01b815260040160405180910390fd5b611d8482612104565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115611dc95761168e8282612169565b6109246121d6565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b611e4a6121f5565b610bda57604051631afcd79f60e31b815260040160405180910390fd5b611e6f611e42565b610c268161220f565b610bda611e42565b6000808036816060861015611ea8576040516394ec350360e01b815260040160405180910390fd5b611eb660206000888a614068565b611ebf91614092565b9450611ecf60406020888a614068565b611ed891614092565b9350611ee860606040888a614068565b611ef191614092565b9250611f00866060818a614068565b915091509295509295909350565b60008181527ff9b5980dcec1a8b0609576a1f453bb2cad4732a0ea02bb89154d44b14a306c0060208181526040808420815160a081018352815460ff9081161515825260018301549482019490945260028201549093161515838301528151608081019283905260609593928387019190600384019060049082845b815481526020019060010190808311611f8a575050509183525050604080516060810191829052602090920191906007840190600390826000855b825461010083900a900460ff161515815260206001928301818104948501949093039092029101808411611fc5579050505050505081525050905061200981612241565b925083612015826111f4565b14610f6257604051632b38492f60e21b815260040160405180910390fd5b61203b6135de565b81806020019051810190610bc291906144ce565b60606000612060876040015161226a565b9050612071876020015187836123d6565b6120828585888a604001518561241a565b506000612092876040015161226a565b90506120a387604001518783612563565b6120ad8682612705565b506120bc8660400151866127d6565b60006120cb876040015161226a565b90506120dd8760400151878386612893565b9150505b95945050505050565b606082600203610bc2576120fd826128c6565b9392505050565b806001600160a01b03163b60000361213a57604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610c14565b6000805160206148e583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516121869190613f4a565b600060405180830381855af49150503d80600081146121c1576040519150601f19603f3d011682016040523d82523d6000602084013e6121c6565b606091505b50915091506120e18583836128d9565b3415610bda5760405163b398979f60e01b815260040160405180910390fd5b60006121ff611714565b54600160401b900460ff16919050565b612217611e42565b6001600160a01b038116610c1d57604051631e4fbdf760e01b815260006004820152602401610c14565b6060816040516020016122549190613da3565b6040516020818303038152906040529050919050565b6122c760405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b600019820161232e576040518061016001604052806000815260200160038152602001600781526020016008815260200160098152602001600a81526020016011815260200160128152602001601381526020016014815260200160108152509050919050565b60011982016123955760405180610160016040528060008152602001600481526020016008815260200160098152602001600a8152602001600b81526020016011815260200160128152602001601381526020016014815260200160638152509050919050565b60405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a5908185d1d195cdd185d1a5bdb88125160521b6044820152606401610c14565b60008260600151826101000151601581106123f3576123f3613f1b565b60200201519050808414610e71576040516301cf7dc760e71b815260040160405180910390fd5b600083606001518261012001516015811061243757612437613f1b565b6020020151905060008686602090809261245393929190614068565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250604051949550936002935061249b9250859150613f4a565b602060405180830381855afa1580156124b8573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906124db9190613f31565b905060006003826040516020016124f491815260200190565b60408051601f198184030181529082905261250e91613f4a565b602060405180830381855afa15801561252b573d6000803e3d6000fd5b505060405151606081901b92506001600160a01b031690508481146114ba57604051631d77982f60e31b815260040160405180910390fd5b600061256d61159d565b90506000836060015183608001516015811061258b5761258b613f1b565b602090810291909101516000878152600185019092526040909120549091506001600160a01b03168061260c5760405162461bcd60e51b815260206004820152602360248201527f5265676973747279206e6f742073657420666f72206174746573746174696f6e60448201526208125160ea1b6064820152608401610c14565b60001986016126b457600086815260018401602052604090819020549051631fa0bd9b60e31b8152600481018490526001600160a01b039091169063fd05ecd8906024015b602060405180830381865afa15801561266e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126929190613f66565b6126af5760405163f53393a760e01b815260040160405180910390fd5b6126fd565b6001198601610ba957600086815260018401602052604090819020549051631fa0bd9b60e31b8152600481018490526001600160a01b039091169063fd05ecd890602401612651565b505050505050565b61270d613618565b60005b6006811015612762578360600151818460a0015161272e9190614597565b6015811061273e5761273e613f1b565b602002015182826006811061275557612755613f1b565b6020020152600101612710565b50600061276e82612935565b9050600061277a612a06565b905061278962015180826145aa565b612794906001614597565b8210806127b8575060016127ab8262015180614597565b6127b591906145aa565b82115b15610d87576040516333d1954760e21b815260040160405180910390fd5b60006127e061159d565b600084815260048083016020908152604092839020548651918701518785015160608901519551632ef5e03f60e11b81529697506001600160a01b0390921695635debc07e95612835959293929091016145bd565b602060405180830381865afa158015612852573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128769190613f66565b61168e57604051636d3de9d360e11b815260040160405180910390fd5b606060001985016128b1576128aa84848785612a24565b9050610f13565b6001198501610ba9576128aa84848785612b4b565b606081604051602001612254919061465e565b6060826128ee576128e982612c45565b6120fd565b815115801561290557506001600160a01b0384163b155b1561292e57604051639996b31560e01b81526001600160a01b0385166004820152602401610c14565b5092915050565b6000805b600681101561298257600983826006811061295657612956613f1b565b6020020151111561297a576040516305ebe05560e21b815260040160405180910390fd5b600101612939565b50604080516020810190915260008082525b60068110156129fa5781600a8583600681106129b2576129b2613f1b565b60200201516129c19190614795565b6129cc906030614597565b60f81b6040516020016129e09291906147b7565b60408051601f198184030181529190529150600101612994565b506000610f1382612c6e565b6000612a156201518042614795565b612a1f90426145aa565b905090565b6060612a2e613636565b838152604080820184905260608701519086015160158110612a5257612a52613f1b565b60200201516060820152612a64613665565b60005b6003811015612ab65760608801518751612a82908390614597565b60158110612a9257612a92613f1b565b6020020151828260038110612aa957612aa9613f1b565b6020020152600101612a67565b50612ac081612e41565b602083015260005b6004811015612b1e578760600151818860200151612ae69190614597565b60158110612af657612af6613f1b565b602002015183608001518260048110612b1157612b11613f1b565b6020020152600101612ac8565b5081604051602001612b30919061482f565b60405160208183030381529060405292505050949350505050565b6060612b55613636565b838152604080820184905260608701519086015160158110612b7957612b79613f1b565b60200201516060820152612b8b613683565b60005b6004811015612bdd5760608801518751612ba9908390614597565b60158110612bb957612bb9613f1b565b6020020151828260048110612bd057612bd0613f1b565b6020020152600101612b8e565b50612be781612f9a565b602083015260005b6004811015612b1e578760600151818860200151612c0d9190614597565b60158110612c1d57612c1d613f1b565b602002015183608001518260048110612c3857612c38613f1b565b6020020152600101612bef565b805115612c555780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80516000908290600614612c955760405163b337595360e01b815260040160405180910390fd5b603160f81b81600281518110612cad57612cad613f1b565b01602001516001600160f81b0319161180612d1c575080600281518110612cd657612cd6613f1b565b6020910101516001600160f81b031916603160f81b148015612d1c5750601960f91b81600381518110612d0b57612d0b613f1b565b01602001516001600160f81b031916115b15612d3a576040516304bcc4f160e31b815260040160405180910390fd5b603360f81b81600481518110612d5257612d52613f1b565b01602001516001600160f81b0319161180612dc1575080600481518110612d7b57612d7b613f1b565b6020910101516001600160f81b031916603360f81b148015612dc15750603160f81b81600581518110612db057612db0613f1b565b01602001516001600160f81b031916115b15612ddf57604051638930acef60e01b815260040160405180910390fd5b6000612df6612df1856000600261310c565b6131ce565b612e02906107d0614597565b90506000612e16612df1866002600461310c565b90506000612e2a612df1876004600661310c565b9050612e37838383613247565b9695505050505050565b8051606090600080516020614905833981519152111580612e745750602082015160008051602061490583398151915211155b80612e915750604082015160008051602061490583398151915211155b15612eaf57604051633ae4ed6b60e01b815260040160405180910390fd5b60408051606081018252601f80825260208201819052818301528151605d808252608082019093529091600091906020820181803683370190505090506000805b6003811015612f90576000868260038110612f0d57612f0d613f1b565b6020020151905060005b858360038110612f2957612f29613f1b565b602002015160ff168160ff161015612f86578160ff1660f81b858580612f4e90614842565b965081518110612f6057612f60613f1b565b60200101906001600160f81b031916908160001a90535060089190911c90600101612f17565b5050600101612ef0565b5090949350505050565b8051606090600080516020614905833981519152111580612fcd5750602082015160008051602061490583398151915211155b80612fea5750604082015160008051602061490583398151915211155b806130075750606082015160008051602061490583398151915211155b1561302557604051633ae4ed6b60e01b815260040160405180910390fd5b6040805160808082018352601f8083526020830181905282840152600160608301528251605e80825291810190935290916000916020820181803683370190505090506000805b6004811015612f9057600086826004811061308957613089613f1b565b6020020151905060005b8583600481106130a5576130a5613f1b565b602002015160ff168160ff161015613102578160ff1660f81b8585806130ca90614842565b9650815181106130dc576130dc613f1b565b60200101906001600160f81b031916908160001a90535060089190911c90600101613093565b505060010161306c565b606083600061311b85856145aa565b6001600160401b038111156131325761313261373f565b6040519080825280601f01601f19166020018201604052801561315c576020820181803683370190505b509050845b848110156131c45782818151811061317b5761317b613f1b565b01602001516001600160f81b0319168261319588846145aa565b815181106131a5576131a5613f1b565b60200101906001600160f81b031916908160001a905350600101613161565b5095945050505050565b8051600090829082036131e45750600092915050565b60008060005b835181101561323e57603084828151811061320757613207613f1b565b0160200151613219919060f81c61485b565b60ff1692508261322a83600a614874565b6132349190614597565b91506001016131ea565b50949350505050565b6000806107b285108061325b575061083485115b15613279576040516305bd032560e21b815260040160405180910390fd5b60018410806132885750600c84115b156132a6576040516304bcc4f160e31b815260040160405180910390fd5b506107b25b848161ffff161015613301576132c48161ffff16613453565b156132de576132d76301e2850083614597565b91506132ef565b6132ec6301e1338083614597565b91505b806132f98161488b565b9150506132ab565b6133096136a1565b601f815261331686613453565b1561332757601d602082015261332f565b601c60208201525b601f60408201819052601e606083018190526080830182905260a0830181905260c0830182905260e083018290526101008301819052610120830182905261014083015261016082015260018410806133aa57508061338f6001876145aa565b600c811061339f5761339f613f1b565b602002015160ff1684115b156133c857604051638930acef60e01b815260040160405180910390fd5b600191505b848261ffff16101561343157806133e56001846148ac565b61ffff16600c81106133f9576133f9613f1b565b602002015161340e9060ff16620151806148c6565b61341d9062ffffff1684614597565b9250816134298161488b565b9250506133cd565b61343c6001856145aa565b6134499062015180614874565b612e379084614597565b60006107b2821080613466575061083482115b15613484576040516305bd032560e21b815260040160405180910390fd5b61348f600483614795565b1561349c57506000919050565b6134a7606483614795565b156134b457506001919050565b6134c061019083614795565b156134cd57506000919050565b506001919050565b8260048101928215613503579160200282015b828111156135035782518255916020019190600101906134e8565b5061350f9291506136c0565b5090565b6001830191839082156135035791602002820160005b8382111561356657835183826101000a81548160ff0219169083151502179055509260200192600101602081600001049283019260010302613529565b80156135935782816101000a81549060ff0219169055600101602081600001049283019260010302613566565b505061350f9291506136c0565b6040518060a00160405280600015158152602001600081526020016000151581526020016135cc613683565b81526020016135d9613665565b905290565b60405180608001604052806135f16136d5565b81526020016135fe6136f3565b815260200161360b6136d5565b81526020016135d9613720565b6040518060c001604052806006906020820280368337509192915050565b6040518060a00160405280600081526020016060815260200160008152602001600081526020016135d9613683565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b604051806101800160405280600c906020820280368337509192915050565b5b8082111561350f57600081556001016136c1565b60405180604001604052806002906020820280368337509192915050565b60405180604001604052806002905b61370a6136d5565b8152602001906001900390816137025790505090565b604051806102a001604052806015906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b03811182821017156137775761377761373f565b60405290565b604051608081016001600160401b03811182821017156137775761377761373f565b6040516101a081016001600160401b03811182821017156137775761377761373f565b604051601f8201601f191681016001600160401b03811182821017156137ea576137ea61373f565b604052919050565b8015158114610c2657600080fd5b600061380c60806137c2565b905080608083018481111561382057600080fd5b835b8181101561383a578035835260209283019201613822565b50505092915050565b600061384f60606137c2565b905080606083018481111561382057600080fd5b600061014082840312801561387757600080fd5b506000613882613755565b833561388d816137f2565b81526020848101359082015260408401356138a7816137f2565b6040820152607f840185136138ba578182fd5b6138c78560608601613800565b60608201528460ff8501126138da578182fd5b6138e460606137c2565b806101408601878111156138f6578485fd5b60e0870194505b80851015613921578435613910816137f2565b8352602094850194909201916138fd565b50608083015250949350505050565b80356001600160a01b038116811461087457600080fd5b6000806040838503121561395a57600080fd5b8235915061396a60208401613930565b90509250929050565b60008083601f84011261398557600080fd5b5081356001600160401b0381111561399c57600080fd5b6020830191508360208260051b85010111156139b757600080fd5b9250929050565b600080600080600080606087890312156139d757600080fd5b86356001600160401b038111156139ed57600080fd5b6139f989828a01613973565b90975095505060208701356001600160401b03811115613a1857600080fd5b613a2489828a01613973565b90955093505060408701356001600160401b03811115613a4357600080fd5b613a4f89828a01613973565b979a9699509497509295939492505050565b600060208284031215613a7357600080fd5b5035919050565b600080600060608486031215613a8f57600080fd5b8335925060208401359150613aa660408501613930565b90509250925092565b60006001600160401b03821115613ac857613ac861373f565b50601f01601f191660200190565b60008060408385031215613ae957600080fd5b613af283613930565b915060208301356001600160401b03811115613b0d57600080fd5b8301601f81018513613b1e57600080fd5b8035613b31613b2c82613aaf565b6137c2565b818152866020838501011115613b4657600080fd5b816020840160208301376000602083830101528093505050509250929050565b60008060408385031215613b7957600080fd5b50508035926020909101359150565b600082601f830112613b9957600080fd5b6000613ba560406137c2565b9050806040840185811115613bb957600080fd5b845b81811015613bd3578035835260209283019201613bbb565b509195945050505050565b600082601f830112613bef57600080fd5b6040613bfa816137c2565b806080850186811115613c0c57600080fd5b855b81811015613c2f57613c208882613b88565b84526020909301928401613c0e565b50909695505050505050565b6000806000838503610180811215613c5257600080fd5b8435935060208501359250610140603f1982011215613c7057600080fd5b50613c7961377d565b613c868660408701613b88565b8152613c958660808701613bde565b6020820152613ca8866101008701613b88565b6040820152613cbb866101408701613b88565b6060820152809150509250925092565b60008060008385036101a0811215613ce257600080fd5b8435935060208501359250610160603f1982011215613d0057600080fd5b50613d0961377d565b613d168660408701613b88565b8152613d258660808701613bde565b6020820152613d38866101008701613b88565b60408201528561015f860112613d4d57600080fd5b613cbb866101408701613843565b8060005b6004811015610e71578151845260209384019390910190600101613d5f565b8060005b6003811015610e715781511515845260209384019390910190600101613d82565b600061014082019050825115158252602083015160208301526040830151151560408301526060830151613dda6060840182613d5b565b50608083015161292e60e0840182613d7e565b60005b83811015613e08578181015183820152602001613df0565b50506000910152565b60008151808452613e29816020860160208601613ded565b601f01601f19169290920160200192915050565b6020815260006120fd6020830184613e11565b600060208284031215613e6257600080fd5b6120fd82613930565b60008083601f840112613e7d57600080fd5b5081356001600160401b03811115613e9457600080fd5b6020830191508360208285010111156139b757600080fd5b60008060008060408587031215613ec257600080fd5b84356001600160401b03811115613ed857600080fd5b613ee487828801613e6b565b90955093505060208501356001600160401b03811115613f0357600080fd5b613f0f87828801613e6b565b95989497509550505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613f4357600080fd5b5051919050565b60008251613f5c818460208701613ded565b9190910192915050565b600060208284031215613f7857600080fd5b81516120fd816137f2565b8060005b6002811015610e71578151845260209384019390910190600101613f87565b8060005b6002811015610e7157613fbe848351613f83565b6040939093019260209190910190600101613faa565b6101408101613fe38287613f83565b613ff06040830186613fa6565b613ffd60c0830185613f83565b6120e1610100830184613f83565b610160810161401a8287613f83565b6140276040830186613fa6565b61403460c0830185613f83565b61010082018360005b600381101561405c57815183526020928301929091019060010161403d565b50505095945050505050565b6000808585111561407857600080fd5b8386111561408557600080fd5b5050820193919092039150565b80356020831015610bc257600019602084900360031b1b1692915050565b8381526060602082015260006140c96060830185613e11565b8281036040840152612e378185613e11565b600082601f8301126140ec57600080fd5b60006140f860806137c2565b905080608084018581111561410c57600080fd5b845b81811015613bd357805183526020928301920161410e565b600082601f83011261413757600080fd5b8151614145613b2c82613aaf565b81815284602083860101111561415a57600080fd5b610f13826020830160208701613ded565b600082601f83011261417c57600080fd5b81516001600160401b038111156141955761419561373f565b8060051b6141a5602082016137c2565b918252602081850181019290810190868411156141c157600080fd5b6020860192505b83831015612e375782516001600160401b038111156141e657600080fd5b6141f5886020838a0101614126565b835250602092830192909101906141c8565b600082601f83011261421857600080fd5b61422260606137c2565b80606084018581111561423457600080fd5b845b81811015614257578051614249816137f2565b845260209384019301614236565b509095945050505050565b60006020828403121561427457600080fd5b81516001600160401b0381111561428a57600080fd5b8201610240818503121561429d57600080fd5b6142a561379f565b8151815260208083015190820152604080830151908201526142ca85606084016140db565b606082015260e08201516001600160401b038111156142e857600080fd5b6142f486828501614126565b6080830152506101008201516001600160401b0381111561431457600080fd5b6143208682850161416b565b60a0830152506101208201516001600160401b0381111561434057600080fd5b61434c86828501614126565b60c0830152506101408201516001600160401b0381111561436c57600080fd5b61437886828501614126565b60e0830152506101608201516001600160401b0381111561439857600080fd5b6143a486828501614126565b610100830152506101808201516001600160401b038111156143c557600080fd5b6143d186828501614126565b610120830152506101a08201516001600160401b038111156143f257600080fd5b6143fe86828501614126565b610140830152506101c082015161016082015261441f856101e08401614207565b610180820152949350505050565b6040815260006144406040830185613e11565b82810360208401526120e18185613e11565b600082601f83011261446357600080fd5b600061446f60406137c2565b905080604084018581111561410c57600080fd5b600082601f83011261449457600080fd5b60006102a06144a2816137c2565b9150830181858211156144b457600080fd5b845b82811015613bd35780518252602091820191016144b6565b60006103a08284031280156144e257600080fd5b5060006144ed61377d565b6144f78585614452565b815284605f850112614507578182fd5b6040614512816137c2565b8060c0870188811115614523578586fd5b6040880195505b8086101561454d5761453c8987614452565b83529483019460209092019161452a565b81602086015261455d8982614452565b604086015250505050614574856101008601614483565b6060820152949350505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610bc257610bc2614581565b81810381811115610bc257610bc2614581565b6103a081016145cc8287613f83565b6145d96040830186613fa6565b6145e660c0830185613f83565b61010082018360005b601581101561405c5781518352602092830192909101906001016145ef565b600082825180855260208501945060208160051b8301016020850160005b83811015613c2f57601f19858403018852614648838351613e11565b602098890198909350919091019060010161462c565b60208152815160208201526020820151604082015260408201516060820152600060608301516146916080840182613d5b565b5060808301516102406101008401526146ae610260840182613e11565b905060a0840151601f19848303016101208501526146cc828261460e565b91505060c0840151601f19848303016101408501526146eb8282613e11565b91505060e0840151601f198483030161016085015261470a8282613e11565b915050610100840151601f198483030161018085015261472a8282613e11565b915050610120840151601f19848303016101a085015261474a8282613e11565b915050610140840151601f19848303016101c085015261476a8282613e11565b9150506101608401516101e084015261018084015161478d610200850182613d7e565b509392505050565b6000826147b257634e487b7160e01b600052601260045260246000fd5b500690565b600083516147c9818460208801613ded565b6001600160f81b0319939093169190920190815260010192915050565b80518252600060208201516101006020850152614807610100850182613e11565b90506040830151604085015260608301516060850152608083015161478d6080860182613d5b565b6020815260006120fd60208301846147e6565b60006001820161485457614854614581565b5060010190565b60ff8281168282160390811115610bc257610bc2614581565b8082028115828204841417610bc257610bc2614581565b600061ffff821661ffff81036148a3576148a3614581565b60010192915050565b61ffff8281168282160390811115610bc257610bc2614581565b62ffffff818116838216029081169081811461292e5761292e61458156fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a164736f6c634300081c000a", + "deployedBytecode": "0x6080604052600436106101b75760003560e01c80638829b090116100ec578063ab9ddbfc1161008a578063d88e6a1511610064578063d88e6a15146104e0578063e30c397814610500578063f2fde38b14610515578063f7e83aee1461053557600080fd5b8063ab9ddbfc14610462578063ad3cb1cc14610482578063ca56259e146104c057600080fd5b80639ffc9aea116100c65780639ffc9aea146103d5578063a1192e98146103f5578063a1cbb9fd14610422578063ab15be081461044257600080fd5b80638829b090146103805780638846ec42146103a05780638da5cb5b146103c057600080fd5b806354ff23711161015957806379ba50971161013357806379ba5097146102fe5780637ef50298146103135780638129fc1c1461034b5780638322963f1461036057600080fd5b806354ff2371146102a9578063678c09dd146102c9578063715018a6146102e957600080fd5b80632e9c365e116101955780632e9c365e1461023157806334c14589146102615780634f1ef2861461028157806352d1902d1461029457600080fd5b806309ddb091146101bc5780631f299c1a146101ef5780632d05332814610211575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004613863565b610555565b6040519081526020015b60405180910390f35b3480156101fb57600080fd5b5061020f61020a366004613947565b61063c565b005b34801561021d57600080fd5b5061020f61022c3660046139be565b6106c3565b34801561023d57600080fd5b5061025161024c366004613a61565b61084e565b60405190151581526020016101e6565b34801561026d57600080fd5b5061020f61027c366004613a7a565b610879565b61020f61028f366004613ad6565b610909565b3480156102a057600080fd5b506101dc610928565b3480156102b557600080fd5b5061020f6102c43660046139be565b610945565b3480156102d557600080fd5b506101dc6102e4366004613b66565b610ac6565b3480156102f557600080fd5b5061020f610bc8565b34801561030a57600080fd5b5061020f610bdc565b34801561031f57600080fd5b5061033361032e366004613a61565b610c29565b6040516001600160a01b0390911681526020016101e6565b34801561035757600080fd5b5061020f610c5b565b34801561036c57600080fd5b5061020f61037b366004613c3b565b610d8e565b34801561038c57600080fd5b506101dc61039b366004613a61565b610e77565b3480156103ac57600080fd5b5061020f6103bb366004613ccb565b610f69565b3480156103cc57600080fd5b50610333611036565b3480156103e157600080fd5b5061020f6103f0366004613947565b61106b565b34801561040157600080fd5b50610415610410366004613a61565b6110e9565b6040516101e69190613da3565b34801561042e57600080fd5b506101dc61043d366004613863565b6111f4565b34801561044e57600080fd5b5061033361045d366004613a61565b611263565b34801561046e57600080fd5b5061033361047d366004613b66565b611295565b34801561048e57600080fd5b506104b3604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516101e69190613e3d565b3480156104cc57600080fd5b506103336104db366004613b66565b6112d2565b3480156104ec57600080fd5b5061020f6104fb366004613a7a565b61130f565b34801561050c57600080fd5b50610333611395565b34801561052157600080fd5b5061020f610530366004613e50565b6113be565b34801561054157600080fd5b5061020f610550366004613eac565b611443565b600061055f6114c6565b610568826111f4565b905060007ff9b5980dcec1a8b0609576a1f453bb2cad4732a0ea02bb89154d44b14a306c00600083815260208281526040918290208651815490151560ff199182161782559187015160018201559186015160028301805491151591909216179055606085015191925084916105e490600383019060046134d5565b5060808201516105fa9060078301906003613513565b50905050817f563cb841d273dd1aede464718d4f7e75319a56698703e51b406f87deee39fea48460405161062e9190613da3565b60405180910390a250919050565b6106446114c6565b61064c61156b565b600061065661159d565b600084815260018201602090815260409182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507f60d79b067258ea9c14eca8a23caf9de667903176279e5ad0d951cc02ef750a3c91015b60405180910390a1505050565b6106cb6114c6565b6106d361156b565b84831415806106e25750848114155b15610703576040516001621398b960e31b0319815260040160405180910390fd5b600061070d61159d565b905060005b868110156108445783838281811061072c5761072c613f1b565b90506020020160208101906107419190613e50565b8260030160008a8a8581811061075957610759613f1b565b905060200201358152602001908152602001600020600088888581811061078257610782613f1b565b90506020020135815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f02c7aeb52f414fb9b4dfa6100f38185b5e12b184349218c18700bc39423bedc98686838181106107ee576107ee613f1b565b9050602002013585858481811061080757610807613f1b565b905060200201602081019061081c9190613e50565b604080519283526001600160a01b0390911660208301520160405180910390a1600101610712565b5050505050505050565b60006108586114c6565b6000610863836110e9565b90508261086f826111f4565b149150505b919050565b6108816114c6565b61088961156b565b600061089361159d565b6000858152600282016020908152604080832087845282529182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507f2bdbcbf49383457c270bf05734cc8d74acb8a5788f0dc6384a715680f6a4dbcf91015b60405180910390a150505050565b6109116114c6565b61091a826115c1565b61092482826115d1565b5050565b6000610932611693565b506000805160206148e583398151915290565b61094d6114c6565b61095561156b565b84831415806109645750848114155b15610985576040516001621398b960e31b0319815260040160405180910390fd5b600061098f61159d565b905060005b86811015610844578383828181106109ae576109ae613f1b565b90506020020160208101906109c39190613e50565b8260020160008a8a858181106109db576109db613f1b565b9050602002013581526020019081526020016000206000888885818110610a0457610a04613f1b565b90506020020135815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f2bdbcbf49383457c270bf05734cc8d74acb8a5788f0dc6384a715680f6a4dbcf868683818110610a7057610a70613f1b565b90506020020135858584818110610a8957610a89613f1b565b9050602002016020810190610a9e9190613e50565b604080519283526001600160a01b0390911660208301520160405180910390a1600101610994565b6000610ad06114c6565b6000610ada61159d565b60008581526001820160205260409020549091506001600160a01b03166000198501610b735760405163ede12d9f60e01b8152600481018590526001600160a01b0382169063ede12d9f906024015b602060405180830381865afa158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613f31565b92505050610bc2565b6001198501610ba95760405163ede12d9f60e01b8152600481018590526001600160a01b0382169063ede12d9f90602401610b29565b6040516309763aff60e11b815260040160405180910390fd5b92915050565b610bd061156b565b610bda60006116dc565b565b3380610be6611395565b6001600160a01b031614610c1d5760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610c26816116dc565b50565b6000610c336114c6565b6000610c3d61159d565b6000938452600101602052505060409020546001600160a01b031690565b6000610c65611714565b805490915060ff600160401b82041615906001600160401b0316600081158015610c8c5750825b90506000826001600160401b03166001148015610ca85750303b155b905081158015610cb6575080155b15610cd45760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cfe57845460ff60401b1916600160401b1785555b610d0661173d565b6000610d1061159d565b600281556040519091507f684ecf5f88ef6c4e3ff17a5bebcb19a50cf34164ba2a535a5d2cb2ef893776d490600090a1508315610d8757845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b610d966114c6565b610da1838383611756565b6000610dab61159d565b90506000198401610e3a57600084815260018201602052604081205460608401516001600160a01b039091169163445257da91905b60200201516040518263ffffffff1660e01b8152600401610e0391815260200190565b600060405180830381600087803b158015610e1d57600080fd5b505af1158015610e31573d6000803e3d6000fd5b50505050610e71565b6001198401610ba957600084815260018201602052604081205460608401516001600160a01b039091169163445257da9190610de0565b50505050565b6000610e816114c6565b6000610e8b61159d565b60008481526001820160205260409020549091506001600160a01b03166000198401610f1b57806001600160a01b0316634bf4dc7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190613f31565b949350505050565b6001198401610ba957806001600160a01b0316634bf4dc7a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eef573d6000803e3d6000fd5b5050919050565b610f716114c6565b610f7c83838361193a565b6000610f8661159d565b90506000198401610ffe57600084815260018201602052604081205460608401516001600160a01b0390911691639a85d40a9187915b60200201516060860151600160200201516040516001600160e01b031960e086901b168152600481019390935260248301919091526044820152606401610e03565b6001198401610ba957600084815260018201602052604081205460608401516001600160a01b0390911691639a85d40a918791610fbc565b6000807f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005b546001600160a01b031692915050565b6110736114c6565b61107b61156b565b600061108561159d565b600084815260048201602090815260409182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507fd2582d06c97998782647bb092ad269393ddfad65c8db96a923b9a6add6a0bdb191016106b6565b6110f16135a0565b6110f96114c6565b60008281527ff9b5980dcec1a8b0609576a1f453bb2cad4732a0ea02bb89154d44b14a306c006020818152604092839020835160a081018552815460ff90811615158252600183015493820193909352600282015490921615158285015283516080810194859052929391929091606084019190600384019060049082845b815481526020019060010190808311611178575050509183525050604080516060810191829052602090920191906007840190600390826000855b825461010083900a900460ff1615158152602060019283018181049485019490930390920291018084116111b3579050505050505081525050915050919050565b60006002826040516020016112099190613da3565b60408051601f198184030181529082905261122391613f4a565b602060405180830381855afa158015611240573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610bc29190613f31565b600061126d6114c6565b600061127761159d565b6000938452600401602052505060409020546001600160a01b031690565b600061129f6114c6565b60006112a961159d565b60009485526002016020908152604080862094865293905250509020546001600160a01b031690565b60006112dc6114c6565b60006112e661159d565b60009485526003016020908152604080862094865293905250509020546001600160a01b031690565b6113176114c6565b61131f61156b565b600061132961159d565b6000858152600382016020908152604080832087845282529182902080546001600160a01b0319166001600160a01b0387169081179091558251878152918201529192507f02c7aeb52f414fb9b4dfa6100f38185b5e12b184349218c18700bc39423bedc991016108fb565b6000807f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0061105b565b6113c661156b565b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b0319166001600160a01b038316908117825561140a611036565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a35050565b61144b6114c6565b600036600061145a8787611b1c565b92509250925060008060006114a98686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508d92508c9150611bcc9050565b9250925092506114ba828483611cff565b50505050505050505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061154d57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166115416000805160206148e5833981519152546001600160a01b031690565b6001600160a01b031614155b15610bda5760405163703e46dd60e11b815260040160405180910390fd5b33611574611036565b6001600160a01b031614610bda5760405163118cdaa760e01b8152336004820152602401610c14565b7f2ade7eace21710c689ddef374add52ace9783e33bac626e58e73a9d190173d0090565b6115c96114c6565b610c2661156b565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561162b575060408051601f3d908101601f1916820190925261162891810190613f31565b60015b61165357604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610c14565b6000805160206148e5833981519152811461168457604051632a87526960e21b815260048101829052602401610c14565b61168e8383611d7b565b505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bda5760405163703e46dd60e11b815260040160405180910390fd5b7f237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c0080546001600160a01b031916815561092482611dd1565b6000807ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00610bc2565b611745611e42565b61174e33611e67565b610bda611e78565b600061176061159d565b600085815260038201602090815260408083208784529091529020549091506001600160a01b0316806117a6576040516301dcf1ab60e31b815260040160405180910390fd5b6000198501611861576000858152600180840160205260409091205460608501516001600160a01b0390911691631465ff7f91905b60200201516040518263ffffffff1660e01b81526004016117fe91815260200190565b602060405180830381865afa15801561181b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183f9190613f66565b61185c57604051638f1b44c760e01b815260040160405180910390fd5b61189a565b6001198501610ba9576000858152600180840160205260409091205460608501516001600160a01b0390911691631465ff7f91906117db565b806001600160a01b031663f5c9d69e84600001518560200151866040015187606001516040518563ffffffff1660e01b81526004016118dc9493929190613fd4565b602060405180830381865afa1580156118f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191d9190613f66565b610d8757604051631644e04960e01b815260040160405180910390fd5b600061194461159d565b600085815260028201602090815260408083208784529091529020549091506001600160a01b03168061198a576040516301dcf1ab60e31b815260040160405180910390fd5b6000198501611a4457600085815260018301602052604090205460608401516001600160a01b0390911690639fc1e4239060025b60200201516040518263ffffffff1660e01b81526004016119e191815260200190565b602060405180830381865afa1580156119fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a229190613f66565b611a3f57604051634cb305bb60e01b815260040160405180910390fd5b611a7c565b6001198501610ba957600085815260018301602052604090205460608401516001600160a01b0390911690639fc1e4239060026119be565b806001600160a01b03166311479fea84600001518560200151866040015187606001516040518563ffffffff1660e01b8152600401611abe949392919061400b565b602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff9190613f66565b610d87576040516367b61dc760e01b815260040160405180910390fd5b60408051606081018252600080825260208201819052918101919091523660006061841015611b5e576040516365ec0cf160e01b815260040160405180910390fd5b84846000818110611b7157611b71613f1b565b919091013560f81c845250611b8a604060208688614068565b611b9391614092565b6020840152611ba6606060408688614068565b611baf91614092565b6040840152611bc18460608188614068565b915091509250925092565b60606000606060008036600080611be38a8a611e80565b929a509297509550909350915060009050611bfd85611f0e565b90506000611c168d611c0e8e612033565b8d8d8961204f565b9050600073__$a424b2de8fd0a19b90144e316fcd5f0bec$__6319d4c2268f6040015185856040518463ffffffff1660e01b8152600401611c59939291906140b0565b600060405180830381865af4158015611c76573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c9e9190810190614262565b9050611cb18e6000015160ff16826120ea565b995050505081818080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250999e989d50919b50969950505050505050505050565b468303611d6257604051634696c6b560e11b81523390638d2d8d6a90611d2b908590859060040161442d565b600060405180830381600087803b158015611d4557600080fd5b505af1158015611d59573d6000803e3d6000fd5b50505050505050565b6040516361296fbb60e01b815260040160405180910390fd5b611d8482612104565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115611dc95761168e8282612169565b6109246121d6565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b611e4a6121f5565b610bda57604051631afcd79f60e31b815260040160405180910390fd5b611e6f611e42565b610c268161220f565b610bda611e42565b6000808036816060861015611ea8576040516394ec350360e01b815260040160405180910390fd5b611eb660206000888a614068565b611ebf91614092565b9450611ecf60406020888a614068565b611ed891614092565b9350611ee860606040888a614068565b611ef191614092565b9250611f00866060818a614068565b915091509295509295909350565b60008181527ff9b5980dcec1a8b0609576a1f453bb2cad4732a0ea02bb89154d44b14a306c0060208181526040808420815160a081018352815460ff9081161515825260018301549482019490945260028201549093161515838301528151608081019283905260609593928387019190600384019060049082845b815481526020019060010190808311611f8a575050509183525050604080516060810191829052602090920191906007840190600390826000855b825461010083900a900460ff161515815260206001928301818104948501949093039092029101808411611fc5579050505050505081525050905061200981612241565b925083612015826111f4565b14610f6257604051632b38492f60e21b815260040160405180910390fd5b61203b6135de565b81806020019051810190610bc291906144ce565b60606000612060876040015161226a565b9050612071876020015187836123d6565b6120828585888a604001518561241a565b506000612092876040015161226a565b90506120a387604001518783612563565b6120ad8682612705565b506120bc8660400151866127d6565b60006120cb876040015161226a565b90506120dd8760400151878386612893565b9150505b95945050505050565b606082600203610bc2576120fd826128c6565b9392505050565b806001600160a01b03163b60000361213a57604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610c14565b6000805160206148e583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b0316846040516121869190613f4a565b600060405180830381855af49150503d80600081146121c1576040519150601f19603f3d011682016040523d82523d6000602084013e6121c6565b606091505b50915091506120e18583836128d9565b3415610bda5760405163b398979f60e01b815260040160405180910390fd5b60006121ff611714565b54600160401b900460ff16919050565b612217611e42565b6001600160a01b038116610c1d57604051631e4fbdf760e01b815260006004820152602401610c14565b6060816040516020016122549190613da3565b6040516020818303038152906040529050919050565b6122c760405180610160016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b600019820161232e576040518061016001604052806000815260200160038152602001600781526020016008815260200160098152602001600a81526020016011815260200160128152602001601381526020016014815260200160108152509050919050565b60011982016123955760405180610160016040528060008152602001600481526020016008815260200160098152602001600a8152602001600b81526020016011815260200160128152602001601381526020016014815260200160638152509050919050565b60405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a5908185d1d195cdd185d1a5bdb88125160521b6044820152606401610c14565b60008260600151826101000151601581106123f3576123f3613f1b565b60200201519050808414610e71576040516301cf7dc760e71b815260040160405180910390fd5b600083606001518261012001516015811061243757612437613f1b565b6020020151905060008686602090809261245393929190614068565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250604051949550936002935061249b9250859150613f4a565b602060405180830381855afa1580156124b8573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906124db9190613f31565b905060006003826040516020016124f491815260200190565b60408051601f198184030181529082905261250e91613f4a565b602060405180830381855afa15801561252b573d6000803e3d6000fd5b505060405151606081901b92506001600160a01b031690508481146114ba57604051631d77982f60e31b815260040160405180910390fd5b600061256d61159d565b90506000836060015183608001516015811061258b5761258b613f1b565b602090810291909101516000878152600185019092526040909120549091506001600160a01b03168061260c5760405162461bcd60e51b815260206004820152602360248201527f5265676973747279206e6f742073657420666f72206174746573746174696f6e60448201526208125160ea1b6064820152608401610c14565b60001986016126b457600086815260018401602052604090819020549051631fa0bd9b60e31b8152600481018490526001600160a01b039091169063fd05ecd8906024015b602060405180830381865afa15801561266e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126929190613f66565b6126af5760405163f53393a760e01b815260040160405180910390fd5b6126fd565b6001198601610ba957600086815260018401602052604090819020549051631fa0bd9b60e31b8152600481018490526001600160a01b039091169063fd05ecd890602401612651565b505050505050565b61270d613618565b60005b6006811015612762578360600151818460a0015161272e9190614597565b6015811061273e5761273e613f1b565b602002015182826006811061275557612755613f1b565b6020020152600101612710565b50600061276e82612935565b9050600061277a612a06565b905061278962015180826145aa565b612794906001614597565b8210806127b8575060016127ab8262015180614597565b6127b591906145aa565b82115b15610d87576040516333d1954760e21b815260040160405180910390fd5b60006127e061159d565b600084815260048083016020908152604092839020548651918701518785015160608901519551632ef5e03f60e11b81529697506001600160a01b0390921695635debc07e95612835959293929091016145bd565b602060405180830381865afa158015612852573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128769190613f66565b61168e57604051636d3de9d360e11b815260040160405180910390fd5b606060001985016128b1576128aa84848785612a24565b9050610f13565b6001198501610ba9576128aa84848785612b4b565b606081604051602001612254919061465e565b6060826128ee576128e982612c45565b6120fd565b815115801561290557506001600160a01b0384163b155b1561292e57604051639996b31560e01b81526001600160a01b0385166004820152602401610c14565b5092915050565b6000805b600681101561298257600983826006811061295657612956613f1b565b6020020151111561297a576040516305ebe05560e21b815260040160405180910390fd5b600101612939565b50604080516020810190915260008082525b60068110156129fa5781600a8583600681106129b2576129b2613f1b565b60200201516129c19190614795565b6129cc906030614597565b60f81b6040516020016129e09291906147b7565b60408051601f198184030181529190529150600101612994565b506000610f1382612c6e565b6000612a156201518042614795565b612a1f90426145aa565b905090565b6060612a2e613636565b838152604080820184905260608701519086015160158110612a5257612a52613f1b565b60200201516060820152612a64613665565b60005b6003811015612ab65760608801518751612a82908390614597565b60158110612a9257612a92613f1b565b6020020151828260038110612aa957612aa9613f1b565b6020020152600101612a67565b50612ac081612e41565b602083015260005b6004811015612b1e578760600151818860200151612ae69190614597565b60158110612af657612af6613f1b565b602002015183608001518260048110612b1157612b11613f1b565b6020020152600101612ac8565b5081604051602001612b30919061482f565b60405160208183030381529060405292505050949350505050565b6060612b55613636565b838152604080820184905260608701519086015160158110612b7957612b79613f1b565b60200201516060820152612b8b613683565b60005b6004811015612bdd5760608801518751612ba9908390614597565b60158110612bb957612bb9613f1b565b6020020151828260048110612bd057612bd0613f1b565b6020020152600101612b8e565b50612be781612f9a565b602083015260005b6004811015612b1e578760600151818860200151612c0d9190614597565b60158110612c1d57612c1d613f1b565b602002015183608001518260048110612c3857612c38613f1b565b6020020152600101612bef565b805115612c555780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b80516000908290600614612c955760405163b337595360e01b815260040160405180910390fd5b603160f81b81600281518110612cad57612cad613f1b565b01602001516001600160f81b0319161180612d1c575080600281518110612cd657612cd6613f1b565b6020910101516001600160f81b031916603160f81b148015612d1c5750601960f91b81600381518110612d0b57612d0b613f1b565b01602001516001600160f81b031916115b15612d3a576040516304bcc4f160e31b815260040160405180910390fd5b603360f81b81600481518110612d5257612d52613f1b565b01602001516001600160f81b0319161180612dc1575080600481518110612d7b57612d7b613f1b565b6020910101516001600160f81b031916603360f81b148015612dc15750603160f81b81600581518110612db057612db0613f1b565b01602001516001600160f81b031916115b15612ddf57604051638930acef60e01b815260040160405180910390fd5b6000612df6612df1856000600261310c565b6131ce565b612e02906107d0614597565b90506000612e16612df1866002600461310c565b90506000612e2a612df1876004600661310c565b9050612e37838383613247565b9695505050505050565b8051606090600080516020614905833981519152111580612e745750602082015160008051602061490583398151915211155b80612e915750604082015160008051602061490583398151915211155b15612eaf57604051633ae4ed6b60e01b815260040160405180910390fd5b60408051606081018252601f80825260208201819052818301528151605d808252608082019093529091600091906020820181803683370190505090506000805b6003811015612f90576000868260038110612f0d57612f0d613f1b565b6020020151905060005b858360038110612f2957612f29613f1b565b602002015160ff168160ff161015612f86578160ff1660f81b858580612f4e90614842565b965081518110612f6057612f60613f1b565b60200101906001600160f81b031916908160001a90535060089190911c90600101612f17565b5050600101612ef0565b5090949350505050565b8051606090600080516020614905833981519152111580612fcd5750602082015160008051602061490583398151915211155b80612fea5750604082015160008051602061490583398151915211155b806130075750606082015160008051602061490583398151915211155b1561302557604051633ae4ed6b60e01b815260040160405180910390fd5b6040805160808082018352601f8083526020830181905282840152600160608301528251605e80825291810190935290916000916020820181803683370190505090506000805b6004811015612f9057600086826004811061308957613089613f1b565b6020020151905060005b8583600481106130a5576130a5613f1b565b602002015160ff168160ff161015613102578160ff1660f81b8585806130ca90614842565b9650815181106130dc576130dc613f1b565b60200101906001600160f81b031916908160001a90535060089190911c90600101613093565b505060010161306c565b606083600061311b85856145aa565b6001600160401b038111156131325761313261373f565b6040519080825280601f01601f19166020018201604052801561315c576020820181803683370190505b509050845b848110156131c45782818151811061317b5761317b613f1b565b01602001516001600160f81b0319168261319588846145aa565b815181106131a5576131a5613f1b565b60200101906001600160f81b031916908160001a905350600101613161565b5095945050505050565b8051600090829082036131e45750600092915050565b60008060005b835181101561323e57603084828151811061320757613207613f1b565b0160200151613219919060f81c61485b565b60ff1692508261322a83600a614874565b6132349190614597565b91506001016131ea565b50949350505050565b6000806107b285108061325b575061083485115b15613279576040516305bd032560e21b815260040160405180910390fd5b60018410806132885750600c84115b156132a6576040516304bcc4f160e31b815260040160405180910390fd5b506107b25b848161ffff161015613301576132c48161ffff16613453565b156132de576132d76301e2850083614597565b91506132ef565b6132ec6301e1338083614597565b91505b806132f98161488b565b9150506132ab565b6133096136a1565b601f815261331686613453565b1561332757601d602082015261332f565b601c60208201525b601f60408201819052601e606083018190526080830182905260a0830181905260c0830182905260e083018290526101008301819052610120830182905261014083015261016082015260018410806133aa57508061338f6001876145aa565b600c811061339f5761339f613f1b565b602002015160ff1684115b156133c857604051638930acef60e01b815260040160405180910390fd5b600191505b848261ffff16101561343157806133e56001846148ac565b61ffff16600c81106133f9576133f9613f1b565b602002015161340e9060ff16620151806148c6565b61341d9062ffffff1684614597565b9250816134298161488b565b9250506133cd565b61343c6001856145aa565b6134499062015180614874565b612e379084614597565b60006107b2821080613466575061083482115b15613484576040516305bd032560e21b815260040160405180910390fd5b61348f600483614795565b1561349c57506000919050565b6134a7606483614795565b156134b457506001919050565b6134c061019083614795565b156134cd57506000919050565b506001919050565b8260048101928215613503579160200282015b828111156135035782518255916020019190600101906134e8565b5061350f9291506136c0565b5090565b6001830191839082156135035791602002820160005b8382111561356657835183826101000a81548160ff0219169083151502179055509260200192600101602081600001049283019260010302613529565b80156135935782816101000a81549060ff0219169055600101602081600001049283019260010302613566565b505061350f9291506136c0565b6040518060a00160405280600015158152602001600081526020016000151581526020016135cc613683565b81526020016135d9613665565b905290565b60405180608001604052806135f16136d5565b81526020016135fe6136f3565b815260200161360b6136d5565b81526020016135d9613720565b6040518060c001604052806006906020820280368337509192915050565b6040518060a00160405280600081526020016060815260200160008152602001600081526020016135d9613683565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b604051806101800160405280600c906020820280368337509192915050565b5b8082111561350f57600081556001016136c1565b60405180604001604052806002906020820280368337509192915050565b60405180604001604052806002905b61370a6136d5565b8152602001906001900390816137025790505090565b604051806102a001604052806015906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b03811182821017156137775761377761373f565b60405290565b604051608081016001600160401b03811182821017156137775761377761373f565b6040516101a081016001600160401b03811182821017156137775761377761373f565b604051601f8201601f191681016001600160401b03811182821017156137ea576137ea61373f565b604052919050565b8015158114610c2657600080fd5b600061380c60806137c2565b905080608083018481111561382057600080fd5b835b8181101561383a578035835260209283019201613822565b50505092915050565b600061384f60606137c2565b905080606083018481111561382057600080fd5b600061014082840312801561387757600080fd5b506000613882613755565b833561388d816137f2565b81526020848101359082015260408401356138a7816137f2565b6040820152607f840185136138ba578182fd5b6138c78560608601613800565b60608201528460ff8501126138da578182fd5b6138e460606137c2565b806101408601878111156138f6578485fd5b60e0870194505b80851015613921578435613910816137f2565b8352602094850194909201916138fd565b50608083015250949350505050565b80356001600160a01b038116811461087457600080fd5b6000806040838503121561395a57600080fd5b8235915061396a60208401613930565b90509250929050565b60008083601f84011261398557600080fd5b5081356001600160401b0381111561399c57600080fd5b6020830191508360208260051b85010111156139b757600080fd5b9250929050565b600080600080600080606087890312156139d757600080fd5b86356001600160401b038111156139ed57600080fd5b6139f989828a01613973565b90975095505060208701356001600160401b03811115613a1857600080fd5b613a2489828a01613973565b90955093505060408701356001600160401b03811115613a4357600080fd5b613a4f89828a01613973565b979a9699509497509295939492505050565b600060208284031215613a7357600080fd5b5035919050565b600080600060608486031215613a8f57600080fd5b8335925060208401359150613aa660408501613930565b90509250925092565b60006001600160401b03821115613ac857613ac861373f565b50601f01601f191660200190565b60008060408385031215613ae957600080fd5b613af283613930565b915060208301356001600160401b03811115613b0d57600080fd5b8301601f81018513613b1e57600080fd5b8035613b31613b2c82613aaf565b6137c2565b818152866020838501011115613b4657600080fd5b816020840160208301376000602083830101528093505050509250929050565b60008060408385031215613b7957600080fd5b50508035926020909101359150565b600082601f830112613b9957600080fd5b6000613ba560406137c2565b9050806040840185811115613bb957600080fd5b845b81811015613bd3578035835260209283019201613bbb565b509195945050505050565b600082601f830112613bef57600080fd5b6040613bfa816137c2565b806080850186811115613c0c57600080fd5b855b81811015613c2f57613c208882613b88565b84526020909301928401613c0e565b50909695505050505050565b6000806000838503610180811215613c5257600080fd5b8435935060208501359250610140603f1982011215613c7057600080fd5b50613c7961377d565b613c868660408701613b88565b8152613c958660808701613bde565b6020820152613ca8866101008701613b88565b6040820152613cbb866101408701613b88565b6060820152809150509250925092565b60008060008385036101a0811215613ce257600080fd5b8435935060208501359250610160603f1982011215613d0057600080fd5b50613d0961377d565b613d168660408701613b88565b8152613d258660808701613bde565b6020820152613d38866101008701613b88565b60408201528561015f860112613d4d57600080fd5b613cbb866101408701613843565b8060005b6004811015610e71578151845260209384019390910190600101613d5f565b8060005b6003811015610e715781511515845260209384019390910190600101613d82565b600061014082019050825115158252602083015160208301526040830151151560408301526060830151613dda6060840182613d5b565b50608083015161292e60e0840182613d7e565b60005b83811015613e08578181015183820152602001613df0565b50506000910152565b60008151808452613e29816020860160208601613ded565b601f01601f19169290920160200192915050565b6020815260006120fd6020830184613e11565b600060208284031215613e6257600080fd5b6120fd82613930565b60008083601f840112613e7d57600080fd5b5081356001600160401b03811115613e9457600080fd5b6020830191508360208285010111156139b757600080fd5b60008060008060408587031215613ec257600080fd5b84356001600160401b03811115613ed857600080fd5b613ee487828801613e6b565b90955093505060208501356001600160401b03811115613f0357600080fd5b613f0f87828801613e6b565b95989497509550505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215613f4357600080fd5b5051919050565b60008251613f5c818460208701613ded565b9190910192915050565b600060208284031215613f7857600080fd5b81516120fd816137f2565b8060005b6002811015610e71578151845260209384019390910190600101613f87565b8060005b6002811015610e7157613fbe848351613f83565b6040939093019260209190910190600101613faa565b6101408101613fe38287613f83565b613ff06040830186613fa6565b613ffd60c0830185613f83565b6120e1610100830184613f83565b610160810161401a8287613f83565b6140276040830186613fa6565b61403460c0830185613f83565b61010082018360005b600381101561405c57815183526020928301929091019060010161403d565b50505095945050505050565b6000808585111561407857600080fd5b8386111561408557600080fd5b5050820193919092039150565b80356020831015610bc257600019602084900360031b1b1692915050565b8381526060602082015260006140c96060830185613e11565b8281036040840152612e378185613e11565b600082601f8301126140ec57600080fd5b60006140f860806137c2565b905080608084018581111561410c57600080fd5b845b81811015613bd357805183526020928301920161410e565b600082601f83011261413757600080fd5b8151614145613b2c82613aaf565b81815284602083860101111561415a57600080fd5b610f13826020830160208701613ded565b600082601f83011261417c57600080fd5b81516001600160401b038111156141955761419561373f565b8060051b6141a5602082016137c2565b918252602081850181019290810190868411156141c157600080fd5b6020860192505b83831015612e375782516001600160401b038111156141e657600080fd5b6141f5886020838a0101614126565b835250602092830192909101906141c8565b600082601f83011261421857600080fd5b61422260606137c2565b80606084018581111561423457600080fd5b845b81811015614257578051614249816137f2565b845260209384019301614236565b509095945050505050565b60006020828403121561427457600080fd5b81516001600160401b0381111561428a57600080fd5b8201610240818503121561429d57600080fd5b6142a561379f565b8151815260208083015190820152604080830151908201526142ca85606084016140db565b606082015260e08201516001600160401b038111156142e857600080fd5b6142f486828501614126565b6080830152506101008201516001600160401b0381111561431457600080fd5b6143208682850161416b565b60a0830152506101208201516001600160401b0381111561434057600080fd5b61434c86828501614126565b60c0830152506101408201516001600160401b0381111561436c57600080fd5b61437886828501614126565b60e0830152506101608201516001600160401b0381111561439857600080fd5b6143a486828501614126565b610100830152506101808201516001600160401b038111156143c557600080fd5b6143d186828501614126565b610120830152506101a08201516001600160401b038111156143f257600080fd5b6143fe86828501614126565b610140830152506101c082015161016082015261441f856101e08401614207565b610180820152949350505050565b6040815260006144406040830185613e11565b82810360208401526120e18185613e11565b600082601f83011261446357600080fd5b600061446f60406137c2565b905080604084018581111561410c57600080fd5b600082601f83011261449457600080fd5b60006102a06144a2816137c2565b9150830181858211156144b457600080fd5b845b82811015613bd35780518252602091820191016144b6565b60006103a08284031280156144e257600080fd5b5060006144ed61377d565b6144f78585614452565b815284605f850112614507578182fd5b6040614512816137c2565b8060c0870188811115614523578586fd5b6040880195505b8086101561454d5761453c8987614452565b83529483019460209092019161452a565b81602086015261455d8982614452565b604086015250505050614574856101008601614483565b6060820152949350505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610bc257610bc2614581565b81810381811115610bc257610bc2614581565b6103a081016145cc8287613f83565b6145d96040830186613fa6565b6145e660c0830185613f83565b61010082018360005b601581101561405c5781518352602092830192909101906001016145ef565b600082825180855260208501945060208160051b8301016020850160005b83811015613c2f57601f19858403018852614648838351613e11565b602098890198909350919091019060010161462c565b60208152815160208201526020820151604082015260408201516060820152600060608301516146916080840182613d5b565b5060808301516102406101008401526146ae610260840182613e11565b905060a0840151601f19848303016101208501526146cc828261460e565b91505060c0840151601f19848303016101408501526146eb8282613e11565b91505060e0840151601f198483030161016085015261470a8282613e11565b915050610100840151601f198483030161018085015261472a8282613e11565b915050610120840151601f19848303016101a085015261474a8282613e11565b915050610140840151601f19848303016101c085015261476a8282613e11565b9150506101608401516101e084015261018084015161478d610200850182613d7e565b509392505050565b6000826147b257634e487b7160e01b600052601260045260246000fd5b500690565b600083516147c9818460208801613ded565b6001600160f81b0319939093169190920190815260010192915050565b80518252600060208201516101006020850152614807610100850182613e11565b90506040830151604085015260608301516060850152608083015161478d6080860182613d5b565b6020815260006120fd60208301846147e6565b60006001820161485457614854614581565b5060010190565b60ff8281168282160390811115610bc257610bc2614581565b8082028115828204841417610bc257610bc2614581565b600061ffff821661ffff81036148a3576148a3614581565b60010192915050565b61ffff8281168282160390811115610bc257610bc2614581565b62ffffff818116838216029081169081811461292e5761292e61458156fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001a164736f6c634300081c000a", + "linkReferences": { + "contracts/libraries/CustomVerifier.sol": { + "CustomVerifier": [ + { + "length": 20, + "start": 7449 + } + ] + } + }, + "deployedLinkReferences": { + "contracts/libraries/CustomVerifier.sol": { + "CustomVerifier": [ + { + "length": 20, + "start": 7196 + } + ] } - ] + } } diff --git a/sdk/core/src/abi/IdentityVerificationHubImplV1.ts b/sdk/core/src/abi/IdentityVerificationHubImplV1.ts new file mode 100644 index 000000000..9a9921b8c --- /dev/null +++ b/sdk/core/src/abi/IdentityVerificationHubImplV1.ts @@ -0,0 +1,500 @@ +export const hubV1Abi = [ + { + inputs: [], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + ], + name: 'AddressEmptyCode', + type: 'error', + }, + { + inputs: [], + name: 'ConfigNotSet', + type: 'error', + }, + { + inputs: [], + name: 'CrossChainIsNotSupportedYet', + type: 'error', + }, + { + inputs: [], + name: 'CurrentDateNotInValidRange', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'implementation', + type: 'address', + }, + ], + name: 'ERC1967InvalidImplementation', + type: 'error', + }, + { + inputs: [], + name: 'ERC1967NonPayable', + type: 'error', + }, + { + inputs: [], + name: 'FailedCall', + type: 'error', + }, + { + inputs: [], + name: 'InputTooShort', + type: 'error', + }, + { + inputs: [], + name: 'InvalidAttestationId', + type: 'error', + }, + { + inputs: [], + name: 'InvalidCscaRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDateDigit', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDateLength', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDayRange', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDscCommitmentRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDscProof', + type: 'error', + }, + { + inputs: [], + name: 'InvalidFieldElement', + type: 'error', + }, + { + inputs: [], + name: 'InvalidMonthRange', + type: 'error', + }, + { + inputs: [], + name: 'InvalidNameAndDobOfacRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidNameAndYobOfacRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidPassportNoOfacRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidProof', + type: 'error', + }, + { + inputs: [], + name: 'InvalidScope', + type: 'error', + }, + { + inputs: [], + name: 'InvalidUserIdentifier', + type: 'error', + }, + { + inputs: [], + name: 'InvalidYearRange', + type: 'error', + }, + { + inputs: [], + name: 'LENGTH_MISMATCH', + type: 'error', + }, + { + inputs: [], + name: 'NullifierAlreadyUsed', + type: 'error', + }, + { + inputs: [], + name: 'OlderThanCheckFailed', + type: 'error', + }, + { + inputs: [], + name: 'PassportCommitmentAlreadyRegistered', + type: 'error', + }, + { + inputs: [], + name: 'PassportCommitmentNotRegistered', + type: 'error', + }, + { + inputs: [], + name: 'PassportNumberOfacCheckFailed', + type: 'error', + }, + { + inputs: [], + name: 'RootNotInTree', + type: 'error', + }, + { + inputs: [], + name: 'ScopeCheckFailed', + type: 'error', + }, + { + inputs: [], + name: 'UserIdentifierCheckFailed', + type: 'error', + }, + { + inputs: [], + name: 'UserIdentifierMismatch', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + inputs: [ + { + internalType: 'address', + name: 'registryAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'vcAndDiscloseCircuitVerifierAddress', + type: 'address', + }, + { + internalType: 'uint256[]', + name: 'registerCircuitVerifierIds', + type: 'uint256[]', + }, + { + internalType: 'address[]', + name: 'registerCircuitVerifierAddresses', + type: 'address[]', + }, + { + internalType: 'uint256[]', + name: 'dscCircuitVerifierIds', + type: 'uint256[]', + }, + { + internalType: 'address[]', + name: 'dscCircuitVerifierAddresses', + type: 'address[]', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'dscCircuitVerifierId', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256[2]', + name: 'a', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2][2]', + name: 'b', + type: 'uint256[2][2]', + }, + { + internalType: 'uint256[2]', + name: 'c', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2]', + name: 'pubSignals', + type: 'uint256[2]', + }, + ], + internalType: 'struct IDscCircuitVerifier.DscCircuitProof', + name: 'dscCircuitProof', + type: 'tuple', + }, + ], + name: 'registerDscKeyCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'registerCircuitVerifierId', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256[2]', + name: 'a', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2][2]', + name: 'b', + type: 'uint256[2][2]', + }, + { + internalType: 'uint256[2]', + name: 'c', + type: 'uint256[2]', + }, + { + internalType: 'uint256[3]', + name: 'pubSignals', + type: 'uint256[3]', + }, + ], + internalType: 'struct IRegisterCircuitVerifier.RegisterCircuitProof', + name: 'registerCircuitProof', + type: 'tuple', + }, + ], + name: 'registerPassportCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'registry', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + ], + name: 'sigTypeToDscCircuitVerifiers', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + ], + name: 'sigTypeToRegisterCircuitVerifiers', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'vcAndDiscloseCircuitVerifier', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'bool', + name: 'olderThanEnabled', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'olderThan', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'forbiddenCountriesEnabled', + type: 'bool', + }, + { + internalType: 'uint256[4]', + name: 'forbiddenCountriesListPacked', + type: 'uint256[4]', + }, + { + internalType: 'bool[3]', + name: 'ofacEnabled', + type: 'bool[3]', + }, + { + components: [ + { + internalType: 'uint256[2]', + name: 'a', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2][2]', + name: 'b', + type: 'uint256[2][2]', + }, + { + internalType: 'uint256[2]', + name: 'c', + type: 'uint256[2]', + }, + { + internalType: 'uint256[21]', + name: 'pubSignals', + type: 'uint256[21]', + }, + ], + internalType: 'struct IVcAndDiscloseCircuitVerifier.VcAndDiscloseProof', + name: 'vcAndDiscloseProof', + type: 'tuple', + }, + ], + internalType: 'struct IIdentityVerificationHubV1.VcAndDiscloseHubProof', + name: 'proof', + type: 'tuple', + }, + ], + name: 'verifyVcAndDisclose', + outputs: [ + { + components: [ + { + internalType: 'uint256', + name: 'attestationId', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'scope', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'userIdentifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'nullifier', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'identityCommitmentRoot', + type: 'uint256', + }, + { + internalType: 'uint256[3]', + name: 'revealedDataPacked', + type: 'uint256[3]', + }, + { + internalType: 'uint256[4]', + name: 'forbiddenCountriesListPacked', + type: 'uint256[4]', + }, + ], + internalType: 'struct IIdentityVerificationHubV1.VcAndDiscloseVerificationResult', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] as const; diff --git a/sdk/core/src/abi/IdentityVerificationHubImplV2.ts b/sdk/core/src/abi/IdentityVerificationHubImplV2.ts new file mode 100644 index 000000000..e6bc30b1c --- /dev/null +++ b/sdk/core/src/abi/IdentityVerificationHubImplV2.ts @@ -0,0 +1,1015 @@ +export const hubV2Abi = [ + { + inputs: [], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + inputs: [ + { + internalType: 'address', + name: 'target', + type: 'address', + }, + ], + name: 'AddressEmptyCode', + type: 'error', + }, + { + inputs: [], + name: 'ConfigNotSet', + type: 'error', + }, + { + inputs: [], + name: 'CrossChainIsNotSupportedYet', + type: 'error', + }, + { + inputs: [], + name: 'CurrentDateNotInValidRange', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'implementation', + type: 'address', + }, + ], + name: 'ERC1967InvalidImplementation', + type: 'error', + }, + { + inputs: [], + name: 'ERC1967NonPayable', + type: 'error', + }, + { + inputs: [], + name: 'FailedCall', + type: 'error', + }, + { + inputs: [], + name: 'InputTooShort', + type: 'error', + }, + { + inputs: [], + name: 'InvalidAttestationId', + type: 'error', + }, + { + inputs: [], + name: 'InvalidCscaRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDateDigit', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDateLength', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDayRange', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDscCommitmentRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidDscProof', + type: 'error', + }, + { + inputs: [], + name: 'InvalidFieldElement', + type: 'error', + }, + { + inputs: [], + name: 'InvalidIdentityCommitmentRoot', + type: 'error', + }, + { + inputs: [], + name: 'InvalidInitialization', + type: 'error', + }, + { + inputs: [], + name: 'InvalidMonthRange', + type: 'error', + }, + { + inputs: [], + name: 'InvalidRegisterProof', + type: 'error', + }, + { + inputs: [], + name: 'InvalidUserIdentifierInProof', + type: 'error', + }, + { + inputs: [], + name: 'InvalidVcAndDiscloseProof', + type: 'error', + }, + { + inputs: [], + name: 'InvalidYearRange', + type: 'error', + }, + { + inputs: [], + name: 'LengthMismatch', + type: 'error', + }, + { + inputs: [], + name: 'NoVerifierSet', + 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', + }, + { + inputs: [], + name: 'ScopeMismatch', + type: 'error', + }, + { + inputs: [], + name: 'UUPSUnauthorizedCallContext', + type: 'error', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'slot', + type: 'bytes32', + }, + ], + name: 'UUPSUnsupportedProxiableUUID', + type: 'error', + }, + { + inputs: [], + name: 'UserContextDataTooShort', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'address', + name: 'verifier', + type: 'address', + }, + ], + name: 'DscCircuitVerifierUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [], + name: 'HubInitializedV2', + type: 'event', + }, + { + 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: false, + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'address', + name: 'verifier', + type: 'address', + }, + ], + name: 'RegisterCircuitVerifierUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'registry', + type: 'address', + }, + ], + name: 'RegistryUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'implementation', + type: 'address', + }, + ], + name: 'Upgraded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + indexed: false, + internalType: 'address', + name: 'vcAndDiscloseCircuitVerifier', + type: 'address', + }, + ], + name: 'VcAndDiscloseCircuitUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'configId', + type: 'bytes32', + }, + { + components: [ + { + internalType: 'bool', + name: 'olderThanEnabled', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'olderThan', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'forbiddenCountriesEnabled', + type: 'bool', + }, + { + internalType: 'uint256[4]', + name: 'forbiddenCountriesListPacked', + type: 'uint256[4]', + }, + { + internalType: 'bool[3]', + name: 'ofacEnabled', + type: 'bool[3]', + }, + ], + indexed: false, + internalType: 'struct SelfStructs.VerificationConfigV2', + name: 'config', + type: 'tuple', + }, + ], + name: 'VerificationConfigV2Set', + type: 'event', + }, + { + inputs: [], + name: 'UPGRADE_INTERFACE_VERSION', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'acceptOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32[]', + name: 'attestationIds', + type: 'bytes32[]', + }, + { + internalType: 'uint256[]', + name: 'typeIds', + type: 'uint256[]', + }, + { + internalType: 'address[]', + name: 'verifierAddresses', + type: 'address[]', + }, + ], + name: 'batchUpdateDscCircuitVerifiers', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32[]', + name: 'attestationIds', + type: 'bytes32[]', + }, + { + internalType: 'uint256[]', + name: 'typeIds', + type: 'uint256[]', + }, + { + internalType: 'address[]', + name: 'verifierAddresses', + type: 'address[]', + }, + ], + name: 'batchUpdateRegisterCircuitVerifiers', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + ], + name: 'discloseVerifier', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + ], + name: 'dscCircuitVerifiers', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'bool', + name: 'olderThanEnabled', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'olderThan', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'forbiddenCountriesEnabled', + type: 'bool', + }, + { + internalType: 'uint256[4]', + name: 'forbiddenCountriesListPacked', + type: 'uint256[4]', + }, + { + internalType: 'bool[3]', + name: 'ofacEnabled', + type: 'bool[3]', + }, + ], + internalType: 'struct SelfStructs.VerificationConfigV2', + name: 'config', + type: 'tuple', + }, + ], + name: 'generateConfigId', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + ], + name: 'getIdentityCommitmentMerkleRoot', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'configId', + type: 'bytes32', + }, + ], + name: 'getVerificationConfigV2', + outputs: [ + { + components: [ + { + internalType: 'bool', + name: 'olderThanEnabled', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'olderThan', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'forbiddenCountriesEnabled', + type: 'bool', + }, + { + internalType: 'uint256[4]', + name: 'forbiddenCountriesListPacked', + type: 'uint256[4]', + }, + { + internalType: 'bool[3]', + name: 'ofacEnabled', + type: 'bool[3]', + }, + ], + internalType: 'struct SelfStructs.VerificationConfigV2', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + 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: [], + name: 'proxiableUUID', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + ], + name: 'registerCircuitVerifiers', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'registerCircuitVerifierId', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256[2]', + name: 'a', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2][2]', + name: 'b', + type: 'uint256[2][2]', + }, + { + internalType: 'uint256[2]', + name: 'c', + type: 'uint256[2]', + }, + { + internalType: 'uint256[3]', + name: 'pubSignals', + type: 'uint256[3]', + }, + ], + internalType: 'struct IRegisterCircuitVerifier.RegisterCircuitProof', + name: 'registerCircuitProof', + type: 'tuple', + }, + ], + name: 'registerCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'dscCircuitVerifierId', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint256[2]', + name: 'a', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2][2]', + name: 'b', + type: 'uint256[2][2]', + }, + { + internalType: 'uint256[2]', + name: 'c', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2]', + name: 'pubSignals', + type: 'uint256[2]', + }, + ], + internalType: 'struct IDscCircuitVerifier.DscCircuitProof', + name: 'dscCircuitProof', + type: 'tuple', + }, + ], + name: 'registerDscKeyCommitment', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + ], + name: 'registry', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'root', + type: 'uint256', + }, + ], + name: 'rootTimestamp', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'bool', + name: 'olderThanEnabled', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'olderThan', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'forbiddenCountriesEnabled', + type: 'bool', + }, + { + internalType: 'uint256[4]', + name: 'forbiddenCountriesListPacked', + type: 'uint256[4]', + }, + { + internalType: 'bool[3]', + name: 'ofacEnabled', + type: 'bool[3]', + }, + ], + internalType: 'struct SelfStructs.VerificationConfigV2', + name: 'config', + type: 'tuple', + }, + ], + name: 'setVerificationConfigV2', + outputs: [ + { + internalType: 'bytes32', + name: 'configId', + type: 'bytes32', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + { + internalType: 'address', + name: 'verifierAddress', + type: 'address', + }, + ], + name: 'updateDscVerifier', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'uint256', + name: 'typeId', + type: 'uint256', + }, + { + internalType: 'address', + name: 'verifierAddress', + type: 'address', + }, + ], + name: 'updateRegisterCircuitVerifier', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'registryAddress', + type: 'address', + }, + ], + name: 'updateRegistry', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'attestationId', + type: 'bytes32', + }, + { + internalType: 'address', + name: 'vcAndDiscloseCircuitVerifierAddress', + type: 'address', + }, + ], + name: 'updateVcAndDiscloseCircuit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newImplementation', + type: 'address', + }, + { + internalType: 'bytes', + name: 'data', + type: 'bytes', + }, + ], + name: 'upgradeToAndCall', + outputs: [], + stateMutability: 'payable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 'configId', + type: 'bytes32', + }, + ], + name: 'verificationConfigV2Exists', + outputs: [ + { + internalType: 'bool', + name: 'exists', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: 'baseVerificationInput', + type: 'bytes', + }, + { + internalType: 'bytes', + name: 'userContextData', + type: 'bytes', + }, + ], + name: 'verify', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/sdk/core/src/abi/VerifyAll.ts b/sdk/core/src/abi/VerifyAll.ts new file mode 100644 index 000000000..02b75839f --- /dev/null +++ b/sdk/core/src/abi/VerifyAll.ts @@ -0,0 +1,294 @@ +export const verifyAllAbi = [ + { + inputs: [ + { + internalType: 'address', + name: 'hubAddress', + type: 'address', + }, + { + internalType: 'address', + name: 'registryAddress', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + 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: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + inputs: [], + name: 'hub', + outputs: [ + { + internalType: 'contract IIdentityVerificationHubV1', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'registry', + outputs: [ + { + internalType: 'contract IIdentityRegistryV1', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'hubAddress', + type: 'address', + }, + ], + name: 'setHub', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'registryAddress', + type: 'address', + }, + ], + name: 'setRegistry', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'targetRootTimestamp', + type: 'uint256', + }, + { + components: [ + { + internalType: 'bool', + name: 'olderThanEnabled', + type: 'bool', + }, + { + internalType: 'uint256', + name: 'olderThan', + type: 'uint256', + }, + { + internalType: 'bool', + name: 'forbiddenCountriesEnabled', + type: 'bool', + }, + { + internalType: 'uint256[4]', + name: 'forbiddenCountriesListPacked', + type: 'uint256[4]', + }, + { + internalType: 'bool[3]', + name: 'ofacEnabled', + type: 'bool[3]', + }, + { + components: [ + { + internalType: 'uint256[2]', + name: 'a', + type: 'uint256[2]', + }, + { + internalType: 'uint256[2][2]', + name: 'b', + type: 'uint256[2][2]', + }, + { + internalType: 'uint256[2]', + name: 'c', + type: 'uint256[2]', + }, + { + internalType: 'uint256[21]', + name: 'pubSignals', + type: 'uint256[21]', + }, + ], + internalType: 'struct IVcAndDiscloseCircuitVerifier.VcAndDiscloseProof', + name: 'vcAndDiscloseProof', + type: 'tuple', + }, + ], + internalType: 'struct IIdentityVerificationHubV1.VcAndDiscloseHubProof', + name: 'proof', + type: 'tuple', + }, + { + internalType: 'enum IIdentityVerificationHubV1.RevealedDataType[]', + name: 'types', + type: 'uint8[]', + }, + ], + name: 'verifyAll', + outputs: [ + { + components: [ + { + internalType: 'string', + name: 'issuingState', + type: 'string', + }, + { + internalType: 'string[]', + name: 'name', + type: 'string[]', + }, + { + internalType: 'string', + name: 'passportNumber', + type: 'string', + }, + { + internalType: 'string', + name: 'nationality', + type: 'string', + }, + { + internalType: 'string', + name: 'dateOfBirth', + type: 'string', + }, + { + internalType: 'string', + name: 'gender', + type: 'string', + }, + { + internalType: 'string', + name: 'expiryDate', + type: 'string', + }, + { + internalType: 'uint256', + name: 'olderThan', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'passportNoOfac', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'nameAndDobOfac', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'nameAndYobOfac', + type: 'uint256', + }, + ], + internalType: 'struct IIdentityVerificationHubV1.ReadableRevealedData', + name: '', + type: 'tuple', + }, + { + internalType: 'bool', + name: '', + type: 'bool', + }, + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, +] as const; diff --git a/sdk/core/src/adapters/HubAdapter.ts b/sdk/core/src/adapters/HubAdapter.ts new file mode 100644 index 000000000..b107ca69d --- /dev/null +++ b/sdk/core/src/adapters/HubAdapter.ts @@ -0,0 +1,511 @@ +import { hubV1Abi } from '../abi/IdentityVerificationHubImplV1.js'; +import { hubV2Abi } from '../abi/IdentityVerificationHubImplV2.js'; + +// Unified Interface with migration support +export interface IdentityVerificationHubAdapter { + // Version information + readonly version: 'v1' | 'v2'; + readonly isLegacy: boolean; + + // Migration utilities + getMigrationInfo(): MigrationInfo; + canMigrateToV2(): boolean; + getV2MigrationPath(): string[]; + + // Verification methods + verifyVcAndDisclose(proof: V1VcAndDiscloseHubProof): Promise; + verify(baseVerificationInput: Uint8Array, userContextData: Uint8Array): Promise; + + // Registration methods + registerPassportCommitment( + attestationId: bigint, + registerCircuitVerifierId: bigint, + registerCircuitProof: V1RegisterCircuitProof + ): Promise; + + registerDscKeyCommitment( + attestationId: bigint, + dscCircuitVerifierId: bigint, + dscCircuitProof: V1DscCircuitProof + ): Promise; + + // Configuration methods + setVerificationConfigV2?(config: V2VerificationConfig): Promise; + + // Getter methods + getRegistry(): Promise; + getVcAndDiscloseCircuitVerifier(): Promise; +} + +// Migration-specific types +export interface MigrationInfo { + currentVersion: 'v1' | 'v2'; + recommendedAction: 'upgrade' | 'migrate' | 'continue'; + migrationSteps: string[]; + breakingChanges: string[]; + newFeatures: string[]; +} + +export interface V1DscCircuitProof { + a: readonly [bigint, bigint]; + b: readonly [[bigint, bigint], [bigint, bigint]]; + c: readonly [bigint, bigint]; + pubSignals: readonly [bigint, bigint]; +} + +export interface V1RegisterCircuitProof { + a: readonly [bigint, bigint]; + b: readonly [[bigint, bigint], [bigint, bigint]]; + c: readonly [bigint, bigint]; + pubSignals: readonly [bigint, bigint, bigint]; +} + +// V1 Types +export interface V1VcAndDiscloseHubProof { + olderThanEnabled: boolean; + olderThan: bigint; + forbiddenCountriesEnabled: boolean; + forbiddenCountriesListPacked: readonly [bigint, bigint, bigint, bigint]; + ofacEnabled: readonly [boolean, boolean, boolean]; + vcAndDiscloseProof: { + a: readonly [bigint, bigint]; + b: readonly [[bigint, bigint], [bigint, bigint]]; + c: readonly [bigint, bigint]; + pubSignals: readonly bigint[]; + }; +} + +export interface V1VcAndDiscloseVerificationResult { + attestationId: bigint; + scope: bigint; + userIdentifier: bigint; + nullifier: bigint; + identityCommitmentRoot: bigint; + revealedDataPacked: readonly [bigint, bigint, bigint]; + forbiddenCountriesListPacked: readonly [bigint, bigint, bigint, bigint]; +} + +// V2 Types +export interface V2VerificationConfig { + // Add V2 config structure as needed +} + +// Migration-focused error classes +export class HubMigrationError extends Error { + constructor( + message: string, + public readonly currentVersion: 'v1' | 'v2', + public readonly requiredVersion: 'v1' | 'v2', + public readonly migrationSteps?: string[] + ) { + super(message); + this.name = 'HubMigrationError'; + } +} + +// Migration utilities +export class HubMigrationUtils { + /** + * Check if a contract supports V2 features + */ + static async supportsV2(contractAddress: string, publicClient: unknown): Promise { + try { + const contract = { address: contractAddress, abi: hubV2Abi }; + await publicClient.readContract({ + ...contract, + functionName: 'verificationConfigV2Exists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000000'], + }); + return true; + } catch { + return false; + } + } + + /** + * Get detailed migration report for a contract + */ + static async getMigrationReport( + contractAddress: string, + publicClient: unknown + ): Promise<{ + currentVersion: 'v1' | 'v2'; + canMigrate: boolean; + migrationInfo: MigrationInfo; + recommendations: string[]; + }> { + const isV2 = await this.supportsV2(contractAddress, publicClient); + const currentVersion = isV2 ? 'v2' : 'v1'; + + // Create temporary adapter to get migration info + const tempContract = { address: contractAddress, abi: isV2 ? hubV2Abi : hubV1Abi }; + const adapter = isV2 + ? new HubV2Adapter(tempContract, publicClient, contractAddress) + : new HubV1Adapter(tempContract, publicClient, contractAddress); + + const migrationInfo = adapter.getMigrationInfo(); + const canMigrate = adapter.canMigrateToV2(); + + const recommendations = [ + currentVersion === 'v1' + ? 'Consider migrating to V2 for new features and better performance' + : 'You are using V2 - consider using HubClient for better type safety', + 'Review breaking changes before migration', + 'Test thoroughly in staging environment', + 'Update documentation and error handling', + ]; + + return { + currentVersion, + canMigrate, + migrationInfo, + recommendations, + }; + } + + /** + * Validate migration readiness + */ + static validateMigrationReadiness( + currentAdapter: IdentityVerificationHubAdapter, + targetVersion: 'v1' | 'v2' + ): { ready: boolean; issues: string[] } { + const issues: string[] = []; + + if (currentAdapter.version === targetVersion) { + issues.push('Already on target version'); + return { ready: false, issues }; + } + + if (targetVersion === 'v2' && !currentAdapter.canMigrateToV2()) { + issues.push('V2 not available on current network'); + } + + if (currentAdapter.version === 'v1') { + issues.push('Review breaking changes in migration guide'); + issues.push('Update error handling for V2 error types'); + issues.push('Test all verification flows with V2'); + } + + return { + ready: issues.length === 0, + issues, + }; + } +} + +// V1 Implementation with migration guidance +export class HubV1Adapter implements IdentityVerificationHubAdapter { + readonly version = 'v1' as const; + readonly isLegacy = true; + + constructor( + private contract: unknown, // Replace with proper contract type + private publicClient: unknown, // Replace with proper client type + private contractAddress: string + ) {} + + getMigrationInfo(): MigrationInfo { + return { + currentVersion: 'v1', + recommendedAction: 'upgrade', + migrationSteps: [ + 'Deploy V2 implementation using deployHubV2.ts', + 'Update contract references to use V2 addresses', + 'Migrate from verifyVcAndDisclose() to verify() method', + 'Update registration calls to include attestationId parameter', + 'Configure V2 verification configs using setVerificationConfigV2()', + 'Update error handling for new V2 error types', + ], + breakingChanges: [ + 'verifyVcAndDisclose() method removed in V2', + 'Registration methods now require attestationId parameter', + 'Registry and verifier addresses are now per-attestation', + 'New verification config system replaces hardcoded parameters', + ], + newFeatures: [ + 'Multi-attestation support (passport, ID cards)', + 'Configurable verification parameters', + 'Cross-chain verification support (future)', + 'Improved error handling and validation', + 'Better gas optimization', + ], + }; + } + + canMigrateToV2(): boolean { + // Check if V2 is available on the same network + return true; // Simplified - in practice, check if V2 contract exists + } + + getV2MigrationPath(): string[] { + return [ + '1. Deploy V2 implementation: yarn deploy:hub:v2', + '2. Update contract address references', + '3. Replace verifyVcAndDisclose() calls with verify()', + '4. Add attestationId to registration calls', + '5. Configure V2 verification settings', + '6. Update error handling', + '7. Test thoroughly before switching', + ]; + } + + async verifyVcAndDisclose( + proof: V1VcAndDiscloseHubProof + ): Promise { + return await this.contract.read.verifyVcAndDisclose([proof]); + } + + async verify(_baseVerificationInput: Uint8Array, _userContextData: Uint8Array): Promise { + throw new HubVersionError( + 'V1 does not support the new verify method. Use verifyVcAndDisclose instead, or migrate to V2.', + 'v1', + 'verify' + ); + } + + async registerPassportCommitment( + attestationId: bigint, + registerCircuitVerifierId: bigint, + registerCircuitProof: V1RegisterCircuitProof + ): Promise { + // V1 doesn't have attestationId parameter - log migration guidance + console.warn( + `[Migration Notice] V1 registerPassportCommitment() doesn't use attestationId. ` + + `Consider migrating to V2 for multi-attestation support. ` + + `Contract: ${this.contractAddress}` + ); + + await this.contract.write.registerPassportCommitment([ + registerCircuitVerifierId, + registerCircuitProof, + ]); + } + + async registerDscKeyCommitment( + attestationId: bigint, + dscCircuitVerifierId: bigint, + dscCircuitProof: V1DscCircuitProof + ): Promise { + // V1 doesn't have attestationId parameter - log migration guidance + console.warn( + `[Migration Notice] V1 registerDscKeyCommitment() doesn't use attestationId. ` + + `Consider migrating to V2 for multi-attestation support. ` + + `Contract: ${this.contractAddress}` + ); + + await this.contract.write.registerDscKeyCommitment([dscCircuitVerifierId, dscCircuitProof]); + } + + async getRegistry(): Promise { + return await this.contract.read.registry(); + } + + async getVcAndDiscloseCircuitVerifier(): Promise { + return await this.contract.read.vcAndDiscloseCircuitVerifier(); + } +} + +// V2 Implementation with migration support +export class HubV2Adapter implements IdentityVerificationHubAdapter { + readonly version = 'v2' as const; + readonly isLegacy = false; + + constructor( + private contract: unknown, // Replace with proper contract type + private publicClient: unknown, // Replace with proper client type + private contractAddress: string + ) {} + + getMigrationInfo(): MigrationInfo { + return { + currentVersion: 'v2', + recommendedAction: 'continue', + migrationSteps: [ + 'You are already using V2 - no migration needed', + 'Consider using the dedicated HubClient for better type safety', + 'Explore new V2 features like multi-attestation support', + ], + breakingChanges: [], + newFeatures: [ + 'Multi-attestation support (passport, ID cards)', + 'Configurable verification parameters', + 'Cross-chain verification support (future)', + 'Improved error handling and validation', + 'Better gas optimization', + ], + }; + } + + canMigrateToV2(): boolean { + return false; // Already on V2 + } + + getV2MigrationPath(): string[] { + return ['Already on V2 - no migration needed']; + } + + async verifyVcAndDisclose( + _proof: V1VcAndDiscloseHubProof + ): Promise { + throw new HubVersionError( + 'V2 does not support verifyVcAndDisclose. Use verify method instead.', + 'v2', + 'verifyVcAndDisclose' + ); + } + + async verify(baseVerificationInput: Uint8Array, userContextData: Uint8Array): Promise { + await this.contract.write.verify([baseVerificationInput, userContextData]); + } + + async registerPassportCommitment( + attestationId: bigint, + registerCircuitVerifierId: bigint, + registerCircuitProof: V1RegisterCircuitProof + ): Promise { + await this.contract.write.registerCommitment([ + attestationId, + registerCircuitVerifierId, + registerCircuitProof, + ]); + } + + async registerDscKeyCommitment( + attestationId: bigint, + dscCircuitVerifierId: bigint, + dscCircuitProof: V1DscCircuitProof + ): Promise { + await this.contract.write.registerDscKeyCommitment([ + attestationId, + dscCircuitVerifierId, + dscCircuitProof, + ]); + } + + async setVerificationConfigV2(config: V2VerificationConfig): Promise { + return await this.contract.write.setVerificationConfigV2([config]); + } + + async getRegistry(): Promise { + // V2 has multiple registries, need to specify attestationId + throw new HubVersionError( + 'V2 requires attestationId to get registry. Use getRegistry(attestationId) instead.', + 'v2', + 'getRegistry' + ); + } + + async getVcAndDiscloseCircuitVerifier(): Promise { + // V2 has multiple verifiers, need to specify attestationId + throw new HubVersionError( + 'V2 requires attestationId to get verifier. Use getVcAndDiscloseCircuitVerifier(attestationId) instead.', + 'v2', + 'getVcAndDiscloseCircuitVerifier' + ); + } +} + +export class HubVersionError extends Error { + constructor( + message: string, + public readonly currentVersion: 'v1' | 'v2', + public readonly operation: string + ) { + super(message); + this.name = 'HubVersionError'; + } +} + +// Factory function to create the appropriate adapter +export function createHubAdapter( + contractAddress: string, + version: 'v1' | 'v2', + publicClient: unknown // Replace with proper client type +): IdentityVerificationHubAdapter { + const abi = version === 'v1' ? hubV1Abi : hubV2Abi; + + // Create contract instance (replace with proper contract creation) + const contract = { + read: {}, + write: {}, + abi, + }; + + return version === 'v1' + ? new HubV1Adapter(contract, publicClient, contractAddress) + : new HubV2Adapter(contract, publicClient, contractAddress); +} + +// Auto-detecting factory with migration support +export async function createHubAdapterAuto( + contractAddress: string, + publicClient: unknown // Replace with proper client type +): Promise { + const version = await detectHubVersion(contractAddress, publicClient); + const adapter = createHubAdapter(contractAddress, version, publicClient); + + // Log migration guidance for V1 users + if (adapter.version === 'v1') { + console.warn( + `[Migration Notice] Using V1 hub at ${contractAddress}. ` + + `Consider migrating to V2 for new features. ` + + `Run getMigrationInfo() for details.` + ); + } + + return adapter; +} + +// Migration-focused factory with validation +export async function createHubAdapterWithMigration( + contractAddress: string, + publicClient: unknown, // Replace with proper client type + options?: { + forceVersion?: 'v1' | 'v2'; + validateMigration?: boolean; + showWarnings?: boolean; + } +): Promise { + const { forceVersion, validateMigration = true, showWarnings = true } = options || {}; + + const version = forceVersion || (await detectHubVersion(contractAddress, publicClient)); + const adapter = createHubAdapter(contractAddress, version, publicClient); + + if (showWarnings && adapter.version === 'v1') { + console.warn( + `[Migration Notice] Using V1 hub at ${contractAddress}. ` + + `Consider migrating to V2 for new features. ` + + `Run getMigrationInfo() for details.` + ); + } + + if (validateMigration && adapter.version === 'v1') { + const readiness = HubMigrationUtils.validateMigrationReadiness(adapter, 'v2'); + if (!readiness.ready) { + console.warn('[Migration Validation] Issues found:', readiness.issues); + } + } + + return adapter; +} + +// Helper to detect version from contract +export async function detectHubVersion( + contractAddress: string, + publicClient: unknown // Replace with proper client type +): Promise<'v1' | 'v2'> { + try { + // Try to call a V2-specific method + const contract = { address: contractAddress, abi: hubV2Abi }; + await publicClient.readContract({ + ...contract, + functionName: 'verificationConfigV2Exists', + args: ['0x0000000000000000000000000000000000000000000000000000000000000000'], + }); + return 'v2'; + } catch { + // If V2 method fails, assume V1 + return 'v1'; + } +} diff --git a/sdk/core/src/clients/HubClient.ts b/sdk/core/src/clients/HubClient.ts new file mode 100644 index 000000000..b1e02b8c5 --- /dev/null +++ b/sdk/core/src/clients/HubClient.ts @@ -0,0 +1,249 @@ +import { hubV2Abi } from '../abi/IdentityVerificationHubImplV2.js'; +import type { IdentityVerificationHubAdapter, MigrationInfo } from '../adapters/HubAdapter.js'; +import { + createHubAdapterAuto, + createHubAdapterWithMigration, + HubMigrationUtils, +} from '../adapters/HubAdapter.js'; + +/** + * Simple V2-focused client for Identity Verification Hub + * + * This is the preferred way to interact with the hub in new code. + * For migration scenarios or V1 compatibility, use the IdentityVerificationHubAdapter instead. + */ +export class IdentityVerificationHubClient { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + private contract: any; // Will be properly typed when ethers integration is added + + constructor( + contractAddress: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + _provider: any, // Replace with proper provider type + // eslint-disable-next-line @typescript-eslint/no-explicit-any + _signer?: any // Replace with proper signer type + ) { + // TODO: Implement proper ethers contract creation + this.contract = { + address: contractAddress, + abi: hubV2Abi, + // Placeholder for ethers contract methods + read: {}, + write: {}, + }; + } + + /** + * Main verification function for V2 + * @param baseVerificationInput The base verification input data + * @param userContextData The user context data + */ + async verify(baseVerificationInput: Uint8Array, userContextData: Uint8Array): Promise { + return await this.contract.write.verify([baseVerificationInput, userContextData]); + } + + /** + * Register a commitment using a register circuit proof + */ + async registerCommitment( + attestationId: bigint, + registerCircuitVerifierId: bigint, + registerCircuitProof: { + a: readonly [bigint, bigint]; + b: readonly [[bigint, bigint], [bigint, bigint]]; + c: readonly [bigint, bigint]; + pubSignals: readonly [bigint, bigint, bigint]; + } + ): Promise { + return await this.contract.write.registerCommitment([ + attestationId, + registerCircuitVerifierId, + registerCircuitProof, + ]); + } + + /** + * Register a DSC key commitment using a DSC circuit proof + */ + async registerDscKeyCommitment( + attestationId: bigint, + dscCircuitVerifierId: bigint, + dscCircuitProof: { + a: readonly [bigint, bigint]; + b: readonly [[bigint, bigint], [bigint, bigint]]; + c: readonly [bigint, bigint]; + pubSignals: readonly [bigint, bigint]; + } + ): Promise { + return await this.contract.write.registerDscKeyCommitment([ + attestationId, + dscCircuitVerifierId, + dscCircuitProof, + ]); + } + + /** + * Set verification config for V2 + */ + async setVerificationConfigV2(config: unknown): Promise { + return await this.contract.write.setVerificationConfigV2([config]); + } + + /** + * Get verification config for V2 + */ + async getVerificationConfigV2(configId: bigint): Promise { + return await this.contract.read.getVerificationConfigV2([configId]); + } + + /** + * Check if verification config exists + */ + async verificationConfigV2Exists(configId: bigint): Promise { + return await this.contract.read.verificationConfigV2Exists([configId]); + } + + /** + * Update registry address for a specific attestation + */ + async updateRegistry(attestationId: bigint, registryAddress: string): Promise { + return await this.contract.write.updateRegistry([attestationId, registryAddress]); + } + + /** + * Update VC and Disclose circuit verifier for a specific attestation + */ + async updateVcAndDiscloseCircuit(attestationId: bigint, verifierAddress: string): Promise { + return await this.contract.write.updateVcAndDiscloseCircuit([attestationId, verifierAddress]); + } + + /** + * Update register circuit verifier for a specific attestation and type + */ + async updateRegisterCircuitVerifier( + attestationId: bigint, + typeId: bigint, + verifierAddress: string + ): Promise { + return await this.contract.write.updateRegisterCircuitVerifier([ + attestationId, + typeId, + verifierAddress, + ]); + } + + /** + * Update DSC circuit verifier for a specific attestation and type + */ + async updateDscVerifier( + attestationId: bigint, + typeId: bigint, + verifierAddress: string + ): Promise { + return await this.contract.write.updateDscVerifier([attestationId, typeId, verifierAddress]); + } + + /** + * Get registry address for a specific attestation + */ + async getRegistry(attestationId: bigint): Promise { + return await this.contract.read.registries([attestationId]); + } + + /** + * Get VC and Disclose circuit verifier for a specific attestation + */ + async getVcAndDiscloseCircuitVerifier(attestationId: bigint): Promise { + return await this.contract.read.discloseVerifiers([attestationId]); + } + + /** + * Get register circuit verifier for a specific attestation and type + */ + async getRegisterCircuitVerifier(attestationId: bigint, typeId: bigint): Promise { + return await this.contract.read.registerCircuitVerifiers([attestationId, typeId]); + } + + /** + * Get DSC circuit verifier for a specific attestation and type + */ + async getDscCircuitVerifier(attestationId: bigint, typeId: bigint): Promise { + return await this.contract.read.dscCircuitVerifiers([attestationId, typeId]); + } +} + +/** + * Factory function to create an auto-detecting adapter + * Use this for migration scenarios or when you need to support both V1 and V2. + */ +export function createHubAdapter( + contractAddress: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + provider: any, // Replace with proper provider type + // eslint-disable-next-line @typescript-eslint/no-explicit-any + _signer?: any // Replace with proper signer type +): Promise { + return createHubAdapterAuto(contractAddress, provider); +} + +/** + * Factory function to create an adapter with migration validation + * Use this when you want detailed migration guidance and validation. + */ +export function createHubAdapterWithValidation( + contractAddress: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + provider: any, // Replace with proper provider type + // eslint-disable-next-line @typescript-eslint/no-explicit-any + _signer?: any, // Replace with proper signer type + options?: { + forceVersion?: 'v1' | 'v2'; + validateMigration?: boolean; + showWarnings?: boolean; + } +): Promise { + return createHubAdapterWithMigration(contractAddress, provider, options); +} + +/** + * Factory function to create a IdentityVerificationHubClient for V2 + * This is the preferred way to create a hub client for new code. + */ +export function createHubClient( + contractAddress: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + provider: any, // Replace with proper provider type + // eslint-disable-next-line @typescript-eslint/no-explicit-any + _signer?: any // Replace with proper signer type +): IdentityVerificationHubClient { + return new IdentityVerificationHubClient(contractAddress, provider, _signer); +} + +/** + * Get detailed migration report for a contract + * Use this to understand migration requirements and get step-by-step guidance. + */ +export async function getMigrationReport( + contractAddress: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + provider: any // Replace with proper provider type +): Promise<{ + currentVersion: 'v1' | 'v2'; + canMigrate: boolean; + migrationInfo: MigrationInfo; + recommendations: string[]; +}> { + return await HubMigrationUtils.getMigrationReport(contractAddress, provider); +} + +/** + * Check if a contract supports V2 features + * Use this to determine if V2 is available before attempting migration. + */ +export async function supportsV2( + contractAddress: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + provider: any // Replace with proper provider type +): Promise { + return await HubMigrationUtils.supportsV2(contractAddress, provider); +} diff --git a/sdk/core/src/index.ts b/sdk/core/src/index.ts index 3a5241a45..e56d8c120 100644 --- a/sdk/core/src/index.ts +++ b/sdk/core/src/index.ts @@ -1 +1,13 @@ +// Hub clients and adapters +export type { IdentityVerificationHubAdapter, MigrationInfo } from './adapters/HubAdapter.js'; +export { HubMigrationError, HubMigrationUtils, HubVersionError } from './adapters/HubAdapter.js'; + +export { + IdentityVerificationHubClient, + createHubAdapter, + createHubAdapterWithValidation, + createHubClient, + getMigrationReport, + supportsV2, +} from './clients/HubClient.js'; export { SelfBackendVerifier } from './SelfBackendVerifier.js'; diff --git a/sdk/core/src/store/DefaultConfigStore.ts b/sdk/core/src/store/DefaultConfigStore.ts index 70150df69..834d1c0d7 100644 --- a/sdk/core/src/store/DefaultConfigStore.ts +++ b/sdk/core/src/store/DefaultConfigStore.ts @@ -1,5 +1,5 @@ -import { VerificationConfig } from 'src/types/types.js'; -import { IConfigStorage } from './interface.js'; +import type { VerificationConfig } from '../types/types.js'; +import type { IConfigStorage } from './interface.js'; export class DefaultConfigStore implements IConfigStorage { constructor(private config: VerificationConfig) {} diff --git a/sdk/core/src/store/InMemoryConfigStore.ts b/sdk/core/src/store/InMemoryConfigStore.ts index 6fbe0f4bd..c650871ba 100644 --- a/sdk/core/src/store/InMemoryConfigStore.ts +++ b/sdk/core/src/store/InMemoryConfigStore.ts @@ -1,5 +1,5 @@ -import { VerificationConfig } from 'src/types/types.js'; -import { IConfigStorage } from './interface.js'; +import type { VerificationConfig } from '../types/types.js'; +import type { IConfigStorage } from './interface.js'; export class InMemoryConfigStore implements IConfigStorage { private configs: Map = new Map(); diff --git a/sdk/core/src/store/interface.ts b/sdk/core/src/store/interface.ts index 76fe5a0b0..d672fe9e5 100644 --- a/sdk/core/src/store/interface.ts +++ b/sdk/core/src/store/interface.ts @@ -1,4 +1,4 @@ -import { VerificationConfig } from '../types/types.js'; +import type { VerificationConfig } from '../types/types.js'; export interface IConfigStorage { /** diff --git a/sdk/core/src/types/types.ts b/sdk/core/src/types/types.ts index 9b5e28a30..37c53b463 100644 --- a/sdk/core/src/types/types.ts +++ b/sdk/core/src/types/types.ts @@ -1,6 +1,24 @@ -import { Country3LetterCode } from '@selfxyz/common/constants'; import type { BigNumberish } from 'ethers'; -import { discloseIndices } from 'src/utils/constants.js'; + +import type { Country3LetterCode } from '@selfxyz/common/constants'; + +import type { discloseIndices } from '../utils/constants.js'; + +export type AttestationId = keyof typeof discloseIndices; + +export type GenericDiscloseOutput = { + nullifier: string; + forbiddenCountriesListPacked: string[]; + issuingState: string; + name: string; + idNumber: string; + nationality: string; + dateOfBirth: string; + gender: string; + expiryDate: string; + minimumAge: string; + ofac: boolean[]; +}; export type VcAndDiscloseProof = { a: [BigNumberish, BigNumberish]; @@ -28,19 +46,3 @@ export type VerificationResult = { userDefinedData: string; }; }; - -export type GenericDiscloseOutput = { - nullifier: string; - forbiddenCountriesListPacked: string[]; - issuingState: string; - name: string; - idNumber: string; - nationality: string; - dateOfBirth: string; - gender: string; - expiryDate: string; - minimumAge: string; - ofac: boolean[]; -}; - -export type AttestationId = keyof typeof discloseIndices; diff --git a/sdk/core/src/utils/constants.ts b/sdk/core/src/utils/constants.ts index 81992b070..266fb9018 100644 --- a/sdk/core/src/utils/constants.ts +++ b/sdk/core/src/utils/constants.ts @@ -1,4 +1,9 @@ -import { AttestationId } from 'src/types/types.js'; +import type { AttestationId } from '../types/types.js'; + +export const AllIds = new Map([ + [1, true], + [2, true], +]); export const discloseIndices = { 1: { @@ -85,8 +90,3 @@ export const revealedDataIndices: Record< ofacEnd: 93, }, } as const; - -const allIdEntries = Object.keys(discloseIndices).map( - (id) => [Number(id) as AttestationId, true] as [AttestationId, boolean] -); -export const AllIds = new Map(allIdEntries); diff --git a/sdk/core/src/utils/id.ts b/sdk/core/src/utils/id.ts index 3097dfb37..1784f1018 100644 --- a/sdk/core/src/utils/id.ts +++ b/sdk/core/src/utils/id.ts @@ -1,5 +1,5 @@ +import type { AttestationId, GenericDiscloseOutput } from '../types/types.js'; import { discloseIndices, revealedDataIndices } from './constants.js'; -import { AttestationId, GenericDiscloseOutput } from 'src/types/types.js'; import { getRevealedDataBytes } from './proof.js'; export const formatRevealedDataPacked = ( diff --git a/sdk/core/src/utils/proof.ts b/sdk/core/src/utils/proof.ts index a436857af..ac14c09e1 100644 --- a/sdk/core/src/utils/proof.ts +++ b/sdk/core/src/utils/proof.ts @@ -1,25 +1,7 @@ -import { PublicSignals } from 'snarkjs'; -import { discloseIndices } from './constants.js'; -import { AttestationId } from 'src/types/types.js'; +import type { PublicSignals } from 'snarkjs'; -/** - * Returns the number of public signals containing revealed data for the specified attestation ID. - * - * Throws an error if the attestation ID is not supported. - * - * @param attestationId - The attestation ID for which to determine the number of revealed data public signals - * @returns The number of public signals corresponding to revealed data - */ -export function getRevealedDataPublicSignalsLength(attestationId: AttestationId): number { - switch (attestationId) { - case 1: - return 93 / 31; - case 2: - return Math.ceil(94 / 31); - default: - throw new Error(`Invalid attestation ID: ${attestationId}`); - } -} +import type { AttestationId } from '../types/types.js'; +import { discloseIndices } from './constants.js'; export const bytesCount: Record = { 1: [31, 31, 31], @@ -39,7 +21,7 @@ export function getRevealedDataBytes( attestationId: AttestationId, publicSignals: PublicSignals ): number[] { - let bytes: number[] = []; + const bytes: number[] = []; for (let i = 0; i < getRevealedDataPublicSignalsLength(attestationId); i++) { let publicSignal = BigInt( publicSignals[discloseIndices[attestationId].revealedDataPackedIndex + i] @@ -52,3 +34,22 @@ export function getRevealedDataBytes( return bytes; } + +/** + * Returns the number of public signals containing revealed data for the specified attestation ID. + * + * Throws an error if the attestation ID is not supported. + * + * @param attestationId - The attestation ID for which to determine the number of revealed data public signals + * @returns The number of public signals corresponding to revealed data + */ +export function getRevealedDataPublicSignalsLength(attestationId: AttestationId): number { + switch (attestationId) { + case 1: + return 93 / 31; + case 2: + return Math.ceil(94 / 31); + default: + throw new Error(`Invalid attestation ID: ${attestationId}`); + } +} diff --git a/sdk/core/tsconfig.cjs.json b/sdk/core/tsconfig.cjs.json new file mode 100644 index 000000000..619b709d1 --- /dev/null +++ b/sdk/core/tsconfig.cjs.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "moduleResolution": "Node", + "outDir": "./dist/cjs", + "declarationDir": "./dist/cjs", + "esModuleInterop": true + } +} diff --git a/sdk/core/tsup.config.ts b/sdk/core/tsup.config.ts new file mode 100644 index 000000000..d1b291461 --- /dev/null +++ b/sdk/core/tsup.config.ts @@ -0,0 +1,28 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig([ + { + entry: ['index.ts', 'src/**/*'], + format: ['esm'], + dts: false, + splitting: true, + sourcemap: true, + clean: true, + outDir: 'dist/esm', + target: 'es2020', + tsconfig: './tsconfig.json', + skipNodeModulesBundle: true, + }, + { + entry: ['index.ts', 'src/**/*'], + format: ['cjs'], + dts: false, + splitting: true, + sourcemap: true, + clean: false, + outDir: 'dist/cjs', + target: 'es2020', + tsconfig: './tsconfig.cjs.json', + skipNodeModulesBundle: true, + }, +]); diff --git a/yarn.lock b/yarn.lock index 5e9c162bb..34ea88e3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4897,7 +4897,14 @@ __metadata: "@types/pako": "npm:^2.0.3" "@types/snarkjs": "npm:^0.7.8" "@types/uuid": "npm:^10.0.0" + "@typescript-eslint/eslint-plugin": "npm:^7.0.0" + "@typescript-eslint/parser": "npm:^7.0.0" axios: "npm:^1.7.2" + eslint: "npm:^8.57.0" + eslint-import-resolver-typescript: "npm:^3.6.1" + eslint-plugin-import: "npm:^2.29.1" + eslint-plugin-simple-import-sort: "npm:^12.0.0" + eslint-plugin-sort-exports: "npm:^0.8.0" ethers: "npm:^6.13.5" js-sha1: "npm:^0.7.0" js-sha256: "npm:^0.11.0" @@ -14665,7 +14672,7 @@ __metadata: languageName: node linkType: hard -"eslint-import-resolver-typescript@npm:^3.7.0": +"eslint-import-resolver-typescript@npm:^3.6.1, eslint-import-resolver-typescript@npm:^3.7.0": version: 3.10.1 resolution: "eslint-import-resolver-typescript@npm:3.10.1" dependencies: @@ -14939,7 +14946,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-simple-import-sort@npm:^12.1.1": +"eslint-plugin-simple-import-sort@npm:^12.0.0, eslint-plugin-simple-import-sort@npm:^12.1.1": version: 12.1.1 resolution: "eslint-plugin-simple-import-sort@npm:12.1.1" peerDependencies: