Files
onchain-id/test/helpers/IdentityHelper.sol
Mohamad HammoudandGitHub f290366435 Feature/bt 1496 identity setup single transaction (#142)
* 💥 identity added claim signers at setup

* 💥 adde claim_Adder purpose

* 💥 added identity types lib and rename variables

* 🚨 fix lint

* ♻️ renamed claim adder

* 💥 resolved claim adder just add claims in execute

* 🚨 fix add name selector

* 💥 added AI_AGENT type

* 🔧 updated the husky files

* Removed __ClaimIssuer_init
2026-04-08 15:52:08 +03:00

43 lines
2.0 KiB
Solidity

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.27;
import { Identity } from "contracts/Identity.sol";
import { IdFactory } from "contracts/factory/IdFactory.sol";
import { IdentityTypes } from "contracts/libraries/IdentityTypes.sol";
import { IdentityProxy } from "contracts/proxy/IdentityProxy.sol";
import { ImplementationAuthority } from "contracts/proxy/ImplementationAuthority.sol";
/// @notice Helper library for deploying OnchainID Identity Factory infrastructure
library IdentityHelper {
struct OnchainIDSetup {
Identity identityImplementation;
ImplementationAuthority implementationAuthority;
IdFactory idFactory;
}
/// @notice Deploys complete Identity Factory infrastructure
/// @param managementKey The initial management key address
/// @return setup Struct containing all deployed contracts
function deployFactory(address managementKey) internal returns (OnchainIDSetup memory setup) {
setup.identityImplementation = new Identity(managementKey, false);
setup.implementationAuthority = new ImplementationAuthority(address(setup.identityImplementation));
setup.idFactory = new IdFactory(address(setup.implementationAuthority));
}
/// @notice Deploys an Identity through the custom IdentityProxy pattern
/// @param initialManagementKey The management key for the identity
/// @return identity The Identity contract at the proxy address
function deployIdentityWithProxy(address initialManagementKey) internal returns (Identity) {
return deployIdentityWithProxy(initialManagementKey, IdentityTypes.INDIVIDUAL);
}
function deployIdentityWithProxy(address initialManagementKey, uint256 identityType) internal returns (Identity) {
Identity impl = new Identity(initialManagementKey, false);
ImplementationAuthority ia = new ImplementationAuthority(address(impl));
IdentityProxy proxy = new IdentityProxy(address(ia), initialManagementKey, identityType);
return Identity(address(proxy));
}
}