@t-rex-network/onchainid 0.0.0-stage → 3.0.0-beta0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +674 -0
- package/NOTICE.md +66 -0
- package/README.md +177 -2
- package/contracts/Identity.sol +235 -0
- package/contracts/IdentityUtilities.sol +269 -0
- package/contracts/KeyManager.sol +193 -0
- package/contracts/SmartAccount.sol +222 -0
- package/contracts/factory/IIdentityFactory.sol +325 -0
- package/contracts/factory/IdentityFactory.sol +818 -0
- package/contracts/interface/IClaimIssuer.sol +105 -0
- package/contracts/interface/IERC734.sol +69 -0
- package/contracts/interface/IERC735.sol +149 -0
- package/contracts/interface/IIdentity.sol +63 -0
- package/contracts/interface/IIdentityUtilities.sol +135 -0
- package/contracts/interface/IKeyExecutor.sol +84 -0
- package/contracts/libraries/Errors.sol +407 -0
- package/contracts/libraries/FormatResolver.sol +74 -0
- package/contracts/libraries/Hashing.sol +35 -0
- package/contracts/libraries/IdentityTypes.sol +53 -0
- package/contracts/libraries/KeyPurposes.sol +49 -0
- package/contracts/libraries/KeyTypes.sol +46 -0
- package/contracts/modules/claims/EASClaimIssuer.sol +348 -0
- package/contracts/modules/executors/KeyApprovalModule.sol +313 -0
- package/contracts/modules/executors/RecoveryModule.sol +88 -0
- package/contracts/modules/validators/ERC734Validator.sol +1000 -0
- package/contracts/modules/validators/ERC7579Validator.sol +74 -0
- package/contracts/proxy/IdentityUtilitiesProxy.sol +36 -0
- package/contracts/reputation/IReputationRegistry.sol +117 -0
- package/contracts/reputation/ReputationRegistry.sol +155 -0
- package/contracts/storage/Structs.sol +176 -0
- package/contracts/vendor/eas/IEAS.sol +36 -0
- package/contracts/vendor/utils/SafeCalldataBatch.sol +61 -0
- package/out/AbstractSigner.sol/AbstractSigner.json +1 -0
- package/out/AccessControlUpgradeable.sol/AccessControlUpgradeable.json +1 -0
- package/out/AccessManaged.sol/AccessManaged.json +1 -0
- package/out/AccessManager.sol/AccessManager.json +1 -0
- package/out/Account.sol/Account.json +1 -0
- package/out/AddClaimByTrustedIssuer.t.sol/AddClaimAsTrustedIssuerTest.json +1 -0
- package/out/Address.sol/Address.json +1 -0
- package/out/Arrays.sol/Arrays.json +1 -0
- package/out/AuthorityUtils.sol/AuthorityUtils.json +1 -0
- package/out/Base.sol/CommonBase.json +1 -0
- package/out/Base.sol/ScriptBase.json +1 -0
- package/out/Base.sol/TestBase.json +1 -0
- package/out/Base64.sol/Base64.json +1 -0
- package/out/BatchDecodeParity.t.sol/BatchDecodeParityTest.json +1 -0
- package/out/BeaconProxy.sol/BeaconProxy.json +1 -0
- package/out/Bytes.sol/Bytes.json +1 -0
- package/out/Calldata.sol/Calldata.json +1 -0
- package/out/ClaimSignatureDefinition.t.sol/ClaimSignatureDefinitionTest.json +1 -0
- package/out/ClaimSignatureDefinition.t.sol/NoERC1271Delegate.json +1 -0
- package/out/ClaimSignatureDefinition.t.sol/PickyERC1271Delegate.json +1 -0
- package/out/ClaimSignerHelper.sol/ClaimSignerHelper.json +1 -0
- package/out/ClaimTo.t.sol/ClaimToTest.json +1 -0
- package/out/Claims.t.sol/ClaimsTest.json +1 -0
- package/out/Claims.t.sol/ExternalIssuer.json +1 -0
- package/out/Comparators.sol/Comparators.json +1 -0
- package/out/Constants.sol/Constants.json +1 -0
- package/out/Context.sol/Context.json +1 -0
- package/out/ContextUpgradeable.sol/ContextUpgradeable.json +1 -0
- package/out/Create2.sol/Create2.json +1 -0
- package/out/Create3.sol/Create3.json +1 -0
- package/out/DeployOnchainID.s.sol/DeployOnchainID.json +1 -0
- package/out/EASClaimIssuer.sol/EASClaimIssuer.json +1 -0
- package/out/EASClaimIssuer.t.sol/EASClaimIssuerTest.json +1 -0
- package/out/EASTypes.sol/IEASTest.json +1 -0
- package/out/EASTypes.sol/ISchemaRegistryTest.json +1 -0
- package/out/ECDSA.sol/ECDSA.json +1 -0
- package/out/EIP712.sol/EIP712.json +1 -0
- package/out/ERC165.sol/ERC165.json +1 -0
- package/out/ERC165Upgradeable.sol/ERC165Upgradeable.json +1 -0
- package/out/ERC1967Proxy.sol/ERC1967Proxy.json +1 -0
- package/out/ERC1967Utils.sol/ERC1967Utils.json +1 -0
- package/out/ERC4337Utils.sol/ERC4337Utils.json +1 -0
- package/out/ERC4337Utils.sol/IEntryPointExtra.json +1 -0
- package/out/ERC734Validator.sol/ERC734Validator.json +1 -0
- package/out/ERC734Validator.t.sol/ERC734ValidatorTest.json +1 -0
- package/out/ERC734Validator.t.sol/PocCounter.json +1 -0
- package/out/ERC7579DelayedExecutor.sol/ERC7579DelayedExecutor.json +1 -0
- package/out/ERC7579Executor.sol/ERC7579Executor.json +1 -0
- package/out/ERC7579Multisig.sol/ERC7579Multisig.json +1 -0
- package/out/ERC7579MultisigWeighted.sol/ERC7579MultisigWeighted.json +1 -0
- package/out/ERC7579SocialRecoveryExecutor.sol/ERC7579SocialRecoveryExecutor.json +1 -0
- package/out/ERC7579Validator.sol/ERC7579Validator.json +1 -0
- package/out/ERC7786Recipient.sol/ERC7786Recipient.json +1 -0
- package/out/ERC7913WebAuthnVerifier.sol/ERC7913WebAuthnVerifier.json +1 -0
- package/out/EnumerableSet.sol/EnumerableSet.json +1 -0
- package/out/Errors.sol/Errors.json +1 -0
- package/out/Executions.t.sol/ETHReceiver.json +1 -0
- package/out/Executions.t.sol/ExecutionsTest.json +1 -0
- package/out/Executions.t.sol/RevertingReceiver.json +1 -0
- package/out/FormatResolver.sol/FormatResolver.json +1 -0
- package/out/Hashes.sol/Hashes.json +1 -0
- package/out/IAccessControl.sol/IAccessControl.json +1 -0
- package/out/IAccessManaged.sol/IAccessManaged.json +1 -0
- package/out/IAccessManager.sol/IAccessManager.json +1 -0
- package/out/IAuthority.sol/IAuthority.json +1 -0
- package/out/IBeacon.sol/IBeacon.json +1 -0
- package/out/IClaimIssuer.sol/IClaimIssuer.json +1 -0
- package/out/IEAS.sol/IEAS.json +1 -0
- package/out/IERC1271.sol/IERC1271.json +1 -0
- package/out/IERC165.sol/IERC165.json +1 -0
- package/out/IERC1967.sol/IERC1967.json +1 -0
- package/out/IERC4337.sol/IAccount.json +1 -0
- package/out/IERC4337.sol/IAccountExecute.json +1 -0
- package/out/IERC4337.sol/IAggregator.json +1 -0
- package/out/IERC4337.sol/IEntryPoint.json +1 -0
- package/out/IERC4337.sol/IEntryPointNonces.json +1 -0
- package/out/IERC4337.sol/IEntryPointStake.json +1 -0
- package/out/IERC4337.sol/IPaymaster.json +1 -0
- package/out/IERC5267.sol/IERC5267.json +1 -0
- package/out/IERC734.sol/IERC734.json +1 -0
- package/out/IERC734Surface.t.sol/IERC734SurfaceTest.json +1 -0
- package/out/IERC735.sol/IERC735.json +1 -0
- package/out/IERC7913.sol/IERC7913SignatureVerifier.json +1 -0
- package/out/IIdentity.sol/IIdentity.json +1 -0
- package/out/IIdentityFactory.sol/IIdentityFactory.json +1 -0
- package/out/IIdentityUtilities.sol/IIdentityUtilities.json +1 -0
- package/out/IKeyExecutor.sol/IKeyExecutor.json +1 -0
- package/out/IMulticall3.sol/IMulticall3.json +1 -0
- package/out/IReputationRegistry.sol/IReputationRegistry.json +1 -0
- package/out/Identity.sol/Identity.json +1 -0
- package/out/IdentityFactory.sol/IdentityFactory.json +1 -0
- package/out/IdentityFactory.t.sol/IdentityFactoryTest.json +1 -0
- package/out/IdentityHelper.sol/IdentityHelper.json +1 -0
- package/out/IdentityTypes.sol/IdentityTypes.json +1 -0
- package/out/IdentityUtilities.sol/IdentityUtilities.json +1 -0
- package/out/IdentityUtilities.t.sol/IdentityUtilitiesTest.json +1 -0
- package/out/IdentityUtilitiesProxy.sol/IdentityUtilitiesProxy.json +1 -0
- package/out/Init.t.sol/InitTest.json +1 -0
- package/out/Initializable.sol/Initializable.json +1 -0
- package/out/InteroperableAddressEncoding.t.sol/InteroperableAddressEncodingTest.json +1 -0
- package/out/KeyApprovalModule.sol/IIdentityAccount.json +1 -0
- package/out/KeyApprovalModule.sol/KeyApprovalModule.json +1 -0
- package/out/KeyApprovalModuleFactoryGuard.t.sol/KeyApprovalModuleFactoryGuardTest.json +1 -0
- package/out/KeyManager.sol/KeyManager.json +1 -0
- package/out/KeyPurposes.sol/KeyPurposes.json +1 -0
- package/out/KeyTypes.sol/KeyTypes.json +1 -0
- package/out/Keys.t.sol/KeysTest.json +1 -0
- package/out/LowLevelCall.sol/LowLevelCall.json +1 -0
- package/out/Math.sol/Math.json +1 -0
- package/out/MessageHashUtils.sol/MessageHashUtils.json +1 -0
- package/out/MockERC1271Signer.sol/MockERC1271Signer.json +1 -0
- package/out/MockERC1271Wallet.sol/MockERC1271Wallet.json +1 -0
- package/out/MockERC7786Gateway.sol/MockERC7786Gateway.json +1 -0
- package/out/MockERC7913PermissiveVerifier.sol/MockERC7913PermissiveVerifier.json +1 -0
- package/out/MockLyingERC734Getter.sol/MockLyingERC734Getter.json +1 -0
- package/out/MockStockECDSAValidator.sol/MockStockECDSAValidator.json +1 -0
- package/out/Multicall.sol/Multicall.json +1 -0
- package/out/Multisig.sol/Multisig.json +1 -0
- package/out/Nonces.sol/Nonces.json +1 -0
- package/out/OnchainIDSetup.sol/OnchainIDSetup.json +1 -0
- package/out/Ownable.sol/Ownable.json +1 -0
- package/out/P256.sol/P256.json +1 -0
- package/out/Packing.sol/Packing.json +1 -0
- package/out/Panic.sol/Panic.json +1 -0
- package/out/PrivilegedReentryGuard.t.sol/PocCounter.json +1 -0
- package/out/PrivilegedReentryGuard.t.sol/PrivilegedReentryGuardTest.json +1 -0
- package/out/Proxy.sol/Proxy.json +1 -0
- package/out/Proxy.t.sol/ProxyTest.json +1 -0
- package/out/ProxyPattern.t.sol/ProxyPatternTest.json +1 -0
- package/out/RecoveryModule.sol/RecoveryModule.json +1 -0
- package/out/RecoveryModule.t.sol/RecoveryModuleTest.json +1 -0
- package/out/ReputationRegistry.sol/ReputationRegistry.json +1 -0
- package/out/ReputationRegistry.t.sol/FakeIdentity.json +1 -0
- package/out/ReputationRegistry.t.sol/ReputationRegistryTest.json +1 -0
- package/out/RevertingIdentity.sol/RevertingIdentity.json +1 -0
- package/out/SafeCalldataBatch.sol/SafeCalldataBatch.json +1 -0
- package/out/SafeCast.sol/SafeCast.json +1 -0
- package/out/Script.sol/Script.json +1 -0
- package/out/ShortStrings.sol/ShortStrings.json +1 -0
- package/out/SignatureChecker.sol/SignatureChecker.json +1 -0
- package/out/SignedMath.sol/SignedMath.json +1 -0
- package/out/SlotDerivation.sol/SlotDerivation.json +1 -0
- package/out/SmartAccount.sol/SmartAccount.json +1 -0
- package/out/SmartAccount.t.sol/AlwaysApprovePolicy.json +1 -0
- package/out/SmartAccount.t.sol/Counter.json +1 -0
- package/out/SmartAccount.t.sol/IAddKeyWithData.json +1 -0
- package/out/SmartAccount.t.sol/ReentrantUninstaller.json +1 -0
- package/out/SmartAccount.t.sol/SmartAccountTest.json +1 -0
- package/out/SmartAccount.t.sol/TestExecutor.json +1 -0
- package/out/StdAssertions.sol/StdAssertions.json +1 -0
- package/out/StdChains.sol/StdChains.json +1 -0
- package/out/StdCheats.sol/StdCheats.json +1 -0
- package/out/StdCheats.sol/StdCheatsSafe.json +1 -0
- package/out/StdConstants.sol/StdConstants.json +1 -0
- package/out/StdError.sol/stdError.json +1 -0
- package/out/StdInvariant.sol/StdInvariant.json +1 -0
- package/out/StdJson.sol/stdJson.json +1 -0
- package/out/StdMath.sol/stdMath.json +1 -0
- package/out/StdStorage.sol/stdStorage.json +1 -0
- package/out/StdStorage.sol/stdStorageSafe.json +1 -0
- package/out/StdStyle.sol/StdStyle.json +1 -0
- package/out/StdToml.sol/stdToml.json +1 -0
- package/out/StdUtils.sol/StdUtils.json +1 -0
- package/out/StorageSlot.sol/StorageSlot.json +1 -0
- package/out/Strings.sol/Strings.json +1 -0
- package/out/Structs.sol/Structs.json +1 -0
- package/out/Test.sol/Test.json +1 -0
- package/out/TestIdentityUtilities.sol/TestIdentityUtilities.json +1 -0
- package/out/Time.sol/Time.json +1 -0
- package/out/TokenOid.t.sol/TokenOidTest.json +1 -0
- package/out/UUPSUpgradeable.sol/UUPSUpgradeable.json +1 -0
- package/out/UnlockedIdentity.sol/UnlockedIdentity.json +1 -0
- package/out/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -0
- package/out/VersionUpgrade.t.sol/VersionUpgradeTest.json +1 -0
- package/out/Vm.sol/Vm.json +1 -0
- package/out/Vm.sol/VmSafe.json +1 -0
- package/out/WebAuthn.sol/WebAuthn.json +1 -0
- package/out/WebAuthn.t.sol/WebAuthnTest.json +1 -0
- package/out/build-info/6d7390a9a3d29c7420710a69f614fbce.json +1 -0
- package/out/console.sol/console.json +1 -0
- package/out/draft-AccountERC7579Upgradeable.sol/AccountERC7579Upgradeable.json +1 -0
- package/out/draft-ERC7579Utils.sol/ERC7579Utils.json +1 -0
- package/out/draft-IERC1822.sol/IERC1822Proxiable.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579AccountConfig.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Execution.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Hook.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Module.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579ModuleConfig.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Validator.json +1 -0
- package/out/draft-IERC7786.sol/IERC7786GatewaySource.json +1 -0
- package/out/draft-IERC7786.sol/IERC7786Recipient.json +1 -0
- package/out/draft-InteroperableAddress.sol/InteroperableAddress.json +1 -0
- package/out/safeconsole.sol/safeconsole.json +1 -0
- package/out/src/Test.sol/Test.json +1 -0
- package/out/utils/Errors.sol/Errors.json +1 -0
- package/package.json +75 -4
package/NOTICE.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
## ONCHAINID Smart Contracts
|
|
4
|
+
|
|
5
|
+
Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
|
|
6
|
+
|
|
7
|
+
ONCHAINID is the open-source digital identity infrastructure of the T-REX
|
|
8
|
+
ecosystem for compliant tokenized assets. It implements the ERC-734 (key
|
|
9
|
+
holder) and ERC-735 (claim holder) standards on a modular ERC-7579 smart
|
|
10
|
+
account with ERC-4337 account abstraction support.
|
|
11
|
+
|
|
12
|
+
Website: https://www.trex.network
|
|
13
|
+
Contact: legal@trex.network
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
18
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
19
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
20
|
+
version.
|
|
21
|
+
|
|
22
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
23
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
24
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License in
|
|
25
|
+
[LICENSE.md](./LICENSE.md) for more details.
|
|
26
|
+
|
|
27
|
+
You should have received a copy of the GNU General Public License along with
|
|
28
|
+
this program. If not, see <https://www.gnu.org/licenses/>.
|
|
29
|
+
|
|
30
|
+
## Provenance and modifications
|
|
31
|
+
|
|
32
|
+
This repository originated as a fork of the ONCHAINID reference implementation
|
|
33
|
+
published by the onchain-id project (https://github.com/onchain-id/solidity),
|
|
34
|
+
released under the GNU General Public License v3.0.
|
|
35
|
+
|
|
36
|
+
The codebase has since been substantially rewritten and re-architected by and
|
|
37
|
+
for Digital Asset Operational Services ISAC Ltd., in collaboration with
|
|
38
|
+
OpenZeppelin. The current implementation
|
|
39
|
+
rebuilds ONCHAINID as a modular ERC-7579 smart account with ERC-4337 account
|
|
40
|
+
abstraction, and differs materially from the original implementation in
|
|
41
|
+
architecture, storage layout, module design, and deployment model. These
|
|
42
|
+
modifications were made in 2026. This statement constitutes the notice
|
|
43
|
+
of modification required by Section 5(a) of the GNU General Public License v3.
|
|
44
|
+
|
|
45
|
+
Copyright in any code originating from the upstream repository remains with
|
|
46
|
+
its respective authors and continues to be licensed under the GPL-3.0.
|
|
47
|
+
Copyright in all new and modified code in this repository is held by Digital
|
|
48
|
+
Asset Operational Services ISAC Ltd.
|
|
49
|
+
|
|
50
|
+
## Trademarks
|
|
51
|
+
|
|
52
|
+
"T-REX Network" is the trade name of Digital Asset Operational Services
|
|
53
|
+
ISAC Ltd. The GNU General Public License grants rights in the software only.
|
|
54
|
+
It does not grant permission to use any trade names, trademarks, service
|
|
55
|
+
marks, or logos appearing in this repository or associated with the T-REX
|
|
56
|
+
ecosystem, including "T-REX", "T-REX Network" and "ONCHAINID", except for
|
|
57
|
+
reasonable and customary use in describing the origin of the work. All
|
|
58
|
+
trademarks are the property of their respective owners. Use of the software
|
|
59
|
+
under the GPL-3.0 does not imply any endorsement by, or affiliation with,
|
|
60
|
+
Digital Asset Operational Services ISAC Ltd. or any other rights holder.
|
|
61
|
+
|
|
62
|
+
## Third-party components
|
|
63
|
+
|
|
64
|
+
This software depends on third-party components, including OpenZeppelin
|
|
65
|
+
Contracts (MIT License). Third-party components remain subject to their own
|
|
66
|
+
license terms, which are unaffected by this NOTICE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,178 @@
|
|
|
1
|
-
|
|
1
|
+
## 
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# ONCHAINID Smart Contracts
|
|
12
|
+
|
|
13
|
+
Digital identities for the T-REX ecosystem. ONCHAINID implements the ERC-734 (key holder) and ERC-735 (claim holder) standards, rebuilt on top of a modular ERC-7579 account with ERC-4337 support.
|
|
14
|
+
|
|
15
|
+
ONCHAINID v3 was designed and built by [T-REX Network](https://www.trex.network) in collaboration with [OpenZeppelin](https://www.openzeppelin.com).
|
|
16
|
+
|
|
17
|
+
Learn more about ONCHAINID and the T-REX Network on the official website: [https://www.trex.network](https://www.trex.network).
|
|
18
|
+
|
|
19
|
+
## What is an ONCHAINID identity?
|
|
20
|
+
|
|
21
|
+
An identity is a smart contract that belongs to a person, a company, an asset, or any other subject. It does two things:
|
|
22
|
+
|
|
23
|
+
- **Holds keys (ERC-734).** Keys are addresses granted specific purposes, such as managing the identity or signing claims.
|
|
24
|
+
- **Holds claims (ERC-735).** Claims are signed statements about the identity, for example "this identity passed KYC", issued by trusted parties.
|
|
25
|
+
|
|
26
|
+
Each identity is a modular account. Extra behaviour — claims, execution rules, signature checks, social recovery — is added through installable modules, so the core stays small and each feature can be reviewed on its own.
|
|
27
|
+
|
|
28
|
+
## Architecture
|
|
29
|
+
|
|
30
|
+
The identity is built in layers. Each layer has one job:
|
|
31
|
+
|
|
32
|
+
- **`Identity`** — the concrete contract that gets deployed. It wires the pieces below together and runs a single, one-shot setup step when the proxy is created.
|
|
33
|
+
- **`SmartAccount`** — the ERC-7579 modular account. It gates module install and removal on the key registry's `MANAGEMENT` purpose and purpose-checks calls coming from installed executors; user operations are authorized by the installed validator, which the account trusts to scope its own signers.
|
|
34
|
+
- **`KeyManager`** — the ERC-734 key registry. It is the single source of truth for which key holds which purpose. Every other part of the system reads keys from here.
|
|
35
|
+
|
|
36
|
+
Claims (ERC-735) are **not** built into `Identity`. They are served by an installed module (`ERC734Validator`) and reached through the account's fallback handler. If no module is installed to answer them, calling a claim function reverts.
|
|
37
|
+
|
|
38
|
+
### Key purposes
|
|
39
|
+
|
|
40
|
+
Each key can hold one or more purposes:
|
|
41
|
+
|
|
42
|
+
| Purpose | Value | What it can do |
|
|
43
|
+
| --------------- | ----- | ---------------------------------------------------------- |
|
|
44
|
+
| `MANAGEMENT` | 1 | Manage the identity: keys, modules, and top-level settings |
|
|
45
|
+
| `ACTION` | 2 | Execute approved actions on behalf of the identity |
|
|
46
|
+
| `CLAIM_SIGNER` | 3 | Sign claims for the identity |
|
|
47
|
+
| `ENCRYPTION` | 4 | Hold encryption material |
|
|
48
|
+
| `CLAIM_ADDER` | 5 | Add claims to the identity |
|
|
49
|
+
| `PROPOSER` | 6 | Queue an execution, but not run or approve it on its own |
|
|
50
|
+
|
|
51
|
+
### Identity types
|
|
52
|
+
|
|
53
|
+
The factory tags every identity with a type: `ASSET` (1), `INDIVIDUAL` (2), `CORPORATE` (3), `IOT` (4), `CLAIM_ISSUER` (5), `SMART_CONTRACT` (6), `PUBLIC_AUTHORITY` (7), `AI_AGENT` (8).
|
|
54
|
+
|
|
55
|
+
## Modules
|
|
56
|
+
|
|
57
|
+
Modules follow the ERC-7579 standard and are installed per identity:
|
|
58
|
+
|
|
59
|
+
- **`ERC734Validator`** — validates user-operation signatures against the key registry, and serves the ERC-735 claim calls reached through the account fallback.
|
|
60
|
+
- **`ERC7579Validator`** — signature validator used to verify user operations.
|
|
61
|
+
- **`KeyApprovalModule`** — an executor that owns the execution queue, auto-approval rules, and execution nonce. Queueing requires the `PROPOSER` purpose.
|
|
62
|
+
- **`RecoveryModule`** — social recovery for an identity (see notes below).
|
|
63
|
+
- **`EASClaimIssuer`** — a stateless claim issuer that reads [EAS](https://attest.org) attestations live (see notes below).
|
|
64
|
+
|
|
65
|
+
## Factory and cross-chain addresses
|
|
66
|
+
|
|
67
|
+
`IdentityFactory` deploys each identity as a beacon proxy using `CREATE3`. Because of `CREATE3`, a given `(salt, wallet)` resolves to the **same identity address on every chain** — as long as the factory itself sits at the same address on each chain.
|
|
68
|
+
|
|
69
|
+
This relies on the standard EVM `CREATE2` derivation `keccak256(0xff, sender, salt, keccak256(initCode))`. Chains that deviate from this derivation produce different addresses. The most common case is **zkSync Era** (and other non-EVM-equivalent zkEVMs), which uses a different prefix byte and hashes bytecode and constructor inputs differently. Since `CREATE3` is built on `CREATE2`, this difference cascades: identities on zkSync will not match addresses on standard EVM chains, no matter which `CREATE3` implementation is used.
|
|
70
|
+
|
|
71
|
+
**Supported chains:** the stack targets chains that follow the canonical `CREATE2` derivation. The factory enforces this at setup: `initializeBeacon` compares the address `CREATE3` actually deployed the beacon to against the address committed in the factory's constructor, and reverts with `BeaconAddressMismatch` if they differ. On a divergent chain (zkSync Era and similar) initialization therefore fails atomically instead of leaving a factory whose beacon lives at an address it can never reach.
|
|
72
|
+
|
|
73
|
+
The factory offers two entry points:
|
|
74
|
+
|
|
75
|
+
- **`createIdentity`** — the caller deploys an identity for themselves and is linked as the first wallet.
|
|
76
|
+
- **`createIdentityFor`** — the caller deploys an identity for another account (a token, a vault, and so on). This requires the right role for that identity type.
|
|
77
|
+
|
|
78
|
+
Each identity type must be registered by an admin before it can be used, and access is controlled with OpenZeppelin's `AccessManager`.
|
|
79
|
+
|
|
80
|
+
## Recovery module integration notes
|
|
81
|
+
|
|
82
|
+
`RecoveryModule` adds social recovery to an identity. It is a thin wrapper around OpenZeppelin's `ERC7579SocialRecoveryExecutor`, pulled in from the private `openzeppelin-accounts` repository via soldeer. All recovery logic lives upstream; the wrapper only turns the upstream `abstract` contract into a deployable one.
|
|
83
|
+
|
|
84
|
+
- **Guardians recover the identity, not a password.** A set of guardians can, together, restore access by meeting a threshold. Recovery is weighted and quorum-based.
|
|
85
|
+
- **Recovery is delayed and can be cancelled.** A scheduled recovery only executes after a delay window, and it can be cancelled either by the account itself or by a guardian quorum before it runs.
|
|
86
|
+
- **Signatures are scoped to one identity.** Each recovery request is signed against that identity's EIP-712 domain, so signatures cannot be replayed against a different identity that uses the same module.
|
|
87
|
+
|
|
88
|
+
> Because it depends on the private `openzeppelin-accounts` repository, building this repo requires read access to that repository (see below).
|
|
89
|
+
|
|
90
|
+
## EAS adapter integration notes
|
|
91
|
+
|
|
92
|
+
`EASClaimIssuer` is a stateless `IClaimIssuer` that resolves claims by reading [EAS](https://attest.org) attestations live. Integrators — token issuers, compliance officers, and front-end developers — should be aware of three behaviors that are intentional design decisions, not bugs:
|
|
93
|
+
|
|
94
|
+
- **A factory-revoked wallet does not invalidate identity-level claims.** The adapter accepts an attestation whose recipient is the identity itself or any wallet *ever* linked to it, regardless of the wallet's current factory status. Rationale: if a holder revokes a compromised wallet, their identity-level KYC must not freeze with it — otherwise wallet recovery would deadlock the identity (`isVerified` would fail during the recovery itself). Audit trails will therefore legitimately show "identity KYC valid" alongside a revoked wallet link.
|
|
95
|
+
- **The enforcement boundary for a compromised wallet is the token-transfer layer, not the claim layer.** The revoked wallet is blocked where it acts (token transfers, factory operations); the identity's eligibility is a fact about the identity, not about any single wallet. Attestation-level kills happen on EAS (attester revokes) or on the identity (`removeClaim`).
|
|
96
|
+
- **`getAttestationData` is a raw read.** It returns the attestation payload even if the attestation is revoked, expired, or from an untrusted attester. Any eligibility or display decision (KYC badges, investment gating) must go through `isClaimValid` / `getClaimStatus` — decoding the payload alone can show stale data for attestations revoked on EAS.
|
|
97
|
+
|
|
98
|
+
## Getting started
|
|
99
|
+
|
|
100
|
+
This is a [Foundry](https://book.getfoundry.sh) project. Solidity `0.8.30`, EVM version `cancun`, optimizer on (200 runs). Dependencies are managed with [soldeer](https://soldeer.xyz), listed in `foundry.toml` and locked in `soldeer.lock`.
|
|
101
|
+
|
|
102
|
+
### Prerequisites
|
|
103
|
+
|
|
104
|
+
- [Foundry](https://book.getfoundry.sh/getting-started/installation) (`forge`)
|
|
105
|
+
- Node.js and npm (used only for git hooks and to run `forge soldeer install`)
|
|
106
|
+
- Read access to the private `openzeppelin-accounts` repository. `forge soldeer install` clones it, so git must be authenticated. In CI this is done with a repository secret; locally your normal GitHub git credentials are enough.
|
|
107
|
+
|
|
108
|
+
### Install
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm ci # installs git hooks and runs `forge soldeer install`
|
|
112
|
+
# or, without the hooks:
|
|
113
|
+
forge soldeer install # fetch dependencies only
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Build
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm run build # forge build
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Test
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm test # forge test
|
|
126
|
+
forge test -vvv # with stack traces on revert (matches CI)
|
|
127
|
+
forge test --match-test <name> # run a single test
|
|
128
|
+
forge test --match-contract <Contract> # run all tests in one file
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Lint and format
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npm run lint # forge fmt --check (this is what CI runs)
|
|
135
|
+
npm run lint:fix # forge fmt (auto-fix)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Coverage and docs
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm run coverage # forge coverage
|
|
142
|
+
npm run docs # forge doc --serve --open
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Using the published package
|
|
146
|
+
|
|
147
|
+
Install the package to use the contracts and interfaces in your own project:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm add @t-rex-network/onchainid
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
In Solidity, import the contracts or interfaces directly:
|
|
154
|
+
|
|
155
|
+
```solidity
|
|
156
|
+
import { IIdentity } from "@t-rex-network/onchainid/contracts/interface/IIdentity.sol";
|
|
157
|
+
import { IClaimIssuer } from "@t-rex-network/onchainid/contracts/interface/IClaimIssuer.sol";
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Compiled artifacts (ABI and bytecode) are shipped in the `out/` directory of the package, one JSON file per contract, for example `out/Identity.sol/Identity.json`.
|
|
161
|
+
|
|
162
|
+
## Versioning and provenance
|
|
163
|
+
|
|
164
|
+
This repository hosts ONCHAINID **v3**, a ground-up re-architecture of the identity stack. See [CHANGELOG.md](./CHANGELOG.md) for the full release notes.
|
|
165
|
+
|
|
166
|
+
v3 originated as a fork of the ONCHAINID reference implementation by the [onchain-id project](https://github.com/onchain-id/solidity) (GPL-3.0) and has been substantially rewritten and re-architected. It is not storage-compatible or interface-compatible with the 2.x line: moving from 2.x means a new deployment, not an upgrade of existing proxies. The 2.x implementation remains available in the upstream repository.
|
|
167
|
+
|
|
168
|
+
## Security and audits
|
|
169
|
+
|
|
170
|
+
ONCHAINID v3 has been audited by OpenZeppelin. Read the [audit report](https://www.openzeppelin.com/news/onchainid-audit).
|
|
171
|
+
|
|
172
|
+
Please report security vulnerabilities responsibly to security@trex.network rather than opening a public issue.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network").
|
|
177
|
+
|
|
178
|
+
This project is licensed under the GNU General Public License v3.0. See [LICENSE.md](./LICENSE.md) for the full license text and [NOTICE.md](./NOTICE.md) for copyright, provenance, and trademark information.
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
2
|
+
//
|
|
3
|
+
// ONCHAINID Smart Contracts
|
|
4
|
+
// Digital identities for the T-REX ecosystem.
|
|
5
|
+
//
|
|
6
|
+
// Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
|
|
7
|
+
//
|
|
8
|
+
// This file is part of the ONCHAINID smart contract suite.
|
|
9
|
+
//
|
|
10
|
+
// This program is free software: you can redistribute it and/or modify
|
|
11
|
+
// it under the terms of the GNU General Public License as published by
|
|
12
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
13
|
+
// (at your option) any later version.
|
|
14
|
+
//
|
|
15
|
+
// This program is distributed in the hope that it will be useful,
|
|
16
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
// GNU General Public License for more details.
|
|
19
|
+
//
|
|
20
|
+
// You should have received a copy of the GNU General Public License
|
|
21
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
|
|
23
|
+
pragma solidity ^0.8.27;
|
|
24
|
+
|
|
25
|
+
import { SmartAccount } from "./SmartAccount.sol";
|
|
26
|
+
import { IERC734 } from "./interface/IERC734.sol";
|
|
27
|
+
import { IERC735 } from "./interface/IERC735.sol";
|
|
28
|
+
import { IIdentity } from "./interface/IIdentity.sol";
|
|
29
|
+
import { Errors } from "./libraries/Errors.sol";
|
|
30
|
+
import { KeyTypes } from "./libraries/KeyTypes.sol";
|
|
31
|
+
import { ERC734Validator } from "./modules/validators/ERC734Validator.sol";
|
|
32
|
+
import { Structs } from "./storage/Structs.sol";
|
|
33
|
+
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
34
|
+
import { MODULE_TYPE_EXECUTOR, MODULE_TYPE_VALIDATOR } from "@openzeppelin/contracts/interfaces/draft-IERC7579.sol";
|
|
35
|
+
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
|
|
36
|
+
import { ERC165 } from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @title Identity
|
|
40
|
+
* @dev Smart-account identity. ERC-734 key registry lives here (inherited from {KeyManager} via
|
|
41
|
+
* {SmartAccount}); ERC-735 claim functionality is provided by the installed {ERC734Validator}
|
|
42
|
+
* module (which holds both the key and claim registries) reached through this account's
|
|
43
|
+
* ERC-7579 fallback handler.
|
|
44
|
+
*
|
|
45
|
+
* The key registry lives in the enshrined {ERC734Validator}, whose address is an immutable
|
|
46
|
+
* set at implementation deploy time — every identity behind the beacon shares it.
|
|
47
|
+
*
|
|
48
|
+
* Storage layout uses ERC-7201 namespaced slots:
|
|
49
|
+
* - `onchainid.identity.metadata` — `identityType`, queried by anyone via {getIdentityType}
|
|
50
|
+
* - `onchainid.accountERC7579.storage` — installed modules (from OZ)
|
|
51
|
+
*
|
|
52
|
+
* Key purposes supported by the registry:
|
|
53
|
+
* - MANAGEMENT — manage the identity
|
|
54
|
+
* - ACTION — perform actions on behalf of the identity
|
|
55
|
+
* - CLAIM_SIGNER — sign and remove claims
|
|
56
|
+
* - CLAIM_ADDER — add claims (cannot remove)
|
|
57
|
+
* - ENCRYPTION — out-of-band encryption usage
|
|
58
|
+
* - PROPOSER — queue executions via {KeyApprovalModule.execute} (cannot auto-run or approve)
|
|
59
|
+
*
|
|
60
|
+
* The {IIdentity} interface continues to declare the ERC-735 selectors; calls to those
|
|
61
|
+
* selectors land on the installed {ERC734Validator} via fallback dispatch.
|
|
62
|
+
*
|
|
63
|
+
* Initialization is single-shot. {initialize} takes the identity type plus the
|
|
64
|
+
* caller-supplied keys and modules and applies them inside the proxy constructor frame,
|
|
65
|
+
* with no cross-contract calls. No transient bootstrap MANAGEMENT key is ever written
|
|
66
|
+
* to any external contract.
|
|
67
|
+
*
|
|
68
|
+
* Two shape invariants are enforced at init time. The factory's post-deploy check
|
|
69
|
+
* asserts at least one MANAGEMENT key. This contract's pre-init check asserts the
|
|
70
|
+
* module list contains at least one validator or executor, so the account can either
|
|
71
|
+
* verify signatures or dispatch outbound calls.
|
|
72
|
+
*/
|
|
73
|
+
contract Identity is Initializable, SmartAccount, ERC165 {
|
|
74
|
+
|
|
75
|
+
/// @notice Emitted once, when an identity finishes initialization. Lets indexers
|
|
76
|
+
/// classify identities at deploy time without an extra `eth_call`.
|
|
77
|
+
event IdentityInitialized(uint256 indexed identityType);
|
|
78
|
+
|
|
79
|
+
/// @dev Account-level identity metadata.
|
|
80
|
+
/// @custom:storage-location erc7201:onchainid.identity.metadata
|
|
81
|
+
struct IdentityMetadata {
|
|
82
|
+
uint256 identityType;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// @dev Release version. {accountId} and {version} both read this so they cannot drift
|
|
86
|
+
/// apart. The EIP-712 domain version in the constructor is separate on purpose: it is
|
|
87
|
+
/// baked into every stored claim signature and must not follow releases.
|
|
88
|
+
string private constant _VERSION = "3.0.0";
|
|
89
|
+
|
|
90
|
+
/// @dev ERC-7201 storage slot for identity-level metadata.
|
|
91
|
+
bytes32 internal constant _IDENTITY_METADATA_SLOT =
|
|
92
|
+
keccak256(abi.encode(uint256(keccak256(bytes("onchainid.identity.metadata"))) - 1)) & ~bytes32(uint256(0xff));
|
|
93
|
+
|
|
94
|
+
/// @dev The enshrined ERC-734 registry module, fixed at implementation deploy time. Read
|
|
95
|
+
/// through the {registryModule} getter.
|
|
96
|
+
address private immutable _registryModule;
|
|
97
|
+
|
|
98
|
+
/// @dev The factory that deploys this identity, fixed at implementation deploy time. Read
|
|
99
|
+
/// through the {identityFactory} getter.
|
|
100
|
+
address private immutable _identityFactory;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @notice Constructor of the Identity contract.
|
|
104
|
+
* @param registryModule_ The {ERC734Validator} that holds the key and claim registries.
|
|
105
|
+
* @param identityFactory_ The {IdentityFactory} that deploys identities of this implementation.
|
|
106
|
+
* @dev The implementation is only ever used behind a BeaconProxy, so its own `Initializable`
|
|
107
|
+
* slot is locked here; proxies keep their storage untouched and can initialize.
|
|
108
|
+
*
|
|
109
|
+
* The EIP-712 domain version stays at "1" regardless of {_VERSION}. Claim digests
|
|
110
|
+
* are rebuilt from the live domain on every read, so bumping it would invalidate
|
|
111
|
+
* every stored claim signature at once. Only change it as a deliberate migration
|
|
112
|
+
* that breaks old signatures.
|
|
113
|
+
*/
|
|
114
|
+
constructor(address registryModule_, address identityFactory_) EIP712("OnchainID", "1") {
|
|
115
|
+
require(registryModule_ != address(0), Errors.ZeroAddress());
|
|
116
|
+
require(identityFactory_ != address(0), Errors.ZeroAddress());
|
|
117
|
+
_registryModule = registryModule_;
|
|
118
|
+
_identityFactory = identityFactory_;
|
|
119
|
+
_disableInitializers();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// @notice The enshrined ERC-734 registry module (the merged {ERC734Validator}). Fixed at
|
|
123
|
+
/// implementation deploy time; every identity behind the beacon shares it. Changing
|
|
124
|
+
/// the registry means deploying a new implementation and upgrading the beacon.
|
|
125
|
+
function registryModule() public view override returns (address) {
|
|
126
|
+
return _registryModule;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// @notice The factory that deploys this identity. Fixed at implementation deploy time like
|
|
130
|
+
/// {registryModule}. The account uses it to require MANAGEMENT for the factory's
|
|
131
|
+
/// wallet-binding calls (linkAccount, revokeAccount, settlePendingCrossChainLink).
|
|
132
|
+
function identityFactory() public view override returns (address) {
|
|
133
|
+
return _identityFactory;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @notice Single-shot initializer. Sets the identity type, registers the supplied keys,
|
|
138
|
+
* and installs the supplied modules. Runs in the same frame as the proxy
|
|
139
|
+
* constructor, with no external calls.
|
|
140
|
+
* @param _identityType The type of the identity (see {IdentityTypes}).
|
|
141
|
+
* @param _keys Initial keys to register on the new identity.
|
|
142
|
+
* @param _modules Initial modules to install on the new identity.
|
|
143
|
+
*/
|
|
144
|
+
function initialize(
|
|
145
|
+
uint256 _identityType,
|
|
146
|
+
Structs.KeyParam[] calldata _keys,
|
|
147
|
+
Structs.ModuleInstall[] calldata _modules
|
|
148
|
+
) external virtual initializer {
|
|
149
|
+
// The account needs at least a validator (to verify signatures) or an executor
|
|
150
|
+
// (to dispatch outbound calls). Without either it can't do anything useful.
|
|
151
|
+
require(_hasValidatorOrExecutor(_modules), Errors.IdentityNoValidatorOrExecutor());
|
|
152
|
+
|
|
153
|
+
_getIdentityMetadata().identityType = _identityType;
|
|
154
|
+
__AccountERC7579_init();
|
|
155
|
+
|
|
156
|
+
// Install the supplied modules. The enshrined registry module is an immutable, so keys
|
|
157
|
+
// can be written in any order relative to the installs. Module install entries with a
|
|
158
|
+
// non-zero purpose grant the module address a MODULE-type key with that purpose (e.g.
|
|
159
|
+
// the KeyApprovalModule executor gets MANAGEMENT so it can dispatch self-targeted calls).
|
|
160
|
+
for (uint256 i = 0; i < _modules.length; i++) {
|
|
161
|
+
_installModule(_modules[i].moduleType, _modules[i].module, _modules[i].initData);
|
|
162
|
+
|
|
163
|
+
if (_modules[i].purpose != 0) {
|
|
164
|
+
ERC734Validator(registryModule())
|
|
165
|
+
.addKey(abi.encodePacked(_modules[i].module), "", _modules[i].purpose, KeyTypes.MODULE);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Seed the caller-supplied keys through the keyHash check, so the deploy salt
|
|
170
|
+
// commits to the keys actually registered.
|
|
171
|
+
for (uint256 i = 0; i < _keys.length; i++) {
|
|
172
|
+
Structs.KeyParam calldata key = _keys[i];
|
|
173
|
+
_addKeyWithData(key.keyHash, key.purpose, key.keyType, key.signerData, key.clientData);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
emit IdentityInitialized(_identityType);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/// @dev True when `modules` contains at least one validator or executor entry.
|
|
180
|
+
function _hasValidatorOrExecutor(Structs.ModuleInstall[] calldata modules) private pure returns (bool) {
|
|
181
|
+
for (uint256 i = 0; i < modules.length; i++) {
|
|
182
|
+
if (modules[i].moduleType == MODULE_TYPE_VALIDATOR || modules[i].moduleType == MODULE_TYPE_EXECUTOR) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/// @notice Returns the identity type set at initialization.
|
|
190
|
+
/// @return The identity type as defined in {IdentityTypes}.
|
|
191
|
+
function getIdentityType() external view returns (uint256) {
|
|
192
|
+
return _getIdentityMetadata().identityType;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/// @notice The Initializable version stored on this contract. On an implementation whose
|
|
196
|
+
/// constructor ran `_disableInitializers` this is `type(uint64).max`. The factory
|
|
197
|
+
/// reads it before a beacon upgrade to reject an unlocked implementation.
|
|
198
|
+
function initializedVersion() external view returns (uint64) {
|
|
199
|
+
return _getInitializedVersion();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/// @notice ERC-7579 account identifier.
|
|
203
|
+
function accountId() public view virtual override returns (string memory) {
|
|
204
|
+
return string.concat("trex.onchainid.identity.v", _VERSION);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/// @notice Current contract version.
|
|
208
|
+
function version() external pure virtual returns (string memory) {
|
|
209
|
+
return _VERSION;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/// @notice ERC-165 surface. The claim interface is only advertised while the fallback
|
|
213
|
+
/// handler serving it is installed, probed via one representative selector. The
|
|
214
|
+
/// key registry reads are enshrined functions on the account itself, so that
|
|
215
|
+
/// surface cannot be uninstalled and is always advertised.
|
|
216
|
+
/// @dev The advertised ERC-734 id is this repo's registry-only {IERC734}. execute/approve
|
|
217
|
+
/// moved to {IKeyExecutor}, so the legacy monolithic id is intentionally not claimed.
|
|
218
|
+
function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
|
|
219
|
+
bool hasClaims = _fallbackHandler(IERC735.getClaim.selector) != address(0);
|
|
220
|
+
|
|
221
|
+
if (interfaceId == type(IERC734).interfaceId) return true;
|
|
222
|
+
if (interfaceId == type(IERC735).interfaceId) return hasClaims;
|
|
223
|
+
if (interfaceId == type(IIdentity).interfaceId) return hasClaims;
|
|
224
|
+
return super.supportsInterface(interfaceId);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/// @dev Returns the identity metadata storage at its ERC-7201 slot.
|
|
228
|
+
function _getIdentityMetadata() internal pure returns (IdentityMetadata storage s) {
|
|
229
|
+
bytes32 slot = _IDENTITY_METADATA_SLOT;
|
|
230
|
+
assembly ("memory-safe") {
|
|
231
|
+
s.slot := slot
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
}
|