# Identity Registry Interface

The Identity Registry interface defines the set of functions and events used to manage and verify identities within the T-REX protocol. Below is a detailed breakdown of each function and event, explaining its purpose, source, and functionality.

**`ClaimTopicsRegistrySet`**

**Event**

**Description**: Emitted when the Claim Topics Registry has been set for the Identity Registry.

```solidity
event ClaimTopicsRegistrySet(address indexed claimTopicsRegistry);
```

***

**`IdentityStorageSet`**

**Event**

**Description**: Emitted when the Identity Registry Storage has been set for the Identity Registry.

```solidity
event IdentityStorageSet(address indexed identityStorage);
```

***

**`TrustedIssuersRegistrySet`**

**Event**

**Description**: Emitted when the Trusted Issuers Registry has been set for the Identity Registry.

```solidity
event TrustedIssuersRegistrySet(address indexed trustedIssuersRegistry);
```

***

**`IdentityRegistered`**

**Event**

**Description**: Emitted when an identity is registered in the Identity Registry.

```solidity
event IdentityRegistered(address indexed investorAddress, IIdentity indexed identity);
```

***

**`IdentityRemoved`**

**Event**

**Description**: Emitted when an identity is removed from the Identity Registry.

```solidity
event IdentityRemoved(address indexed investorAddress, IIdentity indexed identity);
```

***

**`IdentityUpdated`**

**Event**

**Description**: Emitted when an identity has been updated in the Identity Registry.

```solidity
event IdentityUpdated(IIdentity indexed oldIdentity, IIdentity indexed newIdentity);
```

***

**`CountryUpdated`**

**Event**

**Description**: Emitted when an investor's country information is updated in the Identity Registry.

```solidity
event CountryUpdated(address indexed investorAddress, uint16 indexed country);
```

***

**`registerIdentity`**

**Source**: `IIdentityRegistry`

**Description**: Registers an identity contract corresponding to a user address. Only callable by an agent of the contract.

```solidity
function registerIdentity(
    address _userAddress,
    IIdentity _identity,
    uint16 _country
) external;
```

***

**`deleteIdentity`**

**Source**: `IIdentityRegistry`

**Description**: Removes a user from the Identity Registry. Only callable by an agent of the contract.

```solidity
function deleteIdentity(address _userAddress) external;
```

***

**`setIdentityRegistryStorage`**

**Source**: `IIdentityRegistry`

**Description**: Replaces the current Identity Registry Storage contract with a new one. Only callable by the owner of the contract.

```solidity
function setIdentityRegistryStorage(address _identityRegistryStorage) external;
```

***

**`setClaimTopicsRegistry`**

**Source**: `IIdentityRegistry`

**Description**: Replaces the current Claim Topics Registry contract with a new one. Only callable by the owner of the contract.

```solidity
function setClaimTopicsRegistry(address _claimTopicsRegistry) external;
```

***

**`setTrustedIssuersRegistry`**

**Source**: `IIdentityRegistry`

**Description**: Replaces the current Trusted Issuers Registry contract with a new one. Only callable by the owner of the contract.

```solidity
function setTrustedIssuersRegistry(address _trustedIssuersRegistry) external;
```

***

**`updateCountry`**

**Source**: `IIdentityRegistry`

**Description**: Updates the country corresponding to a user address. Only callable by an agent of the contract.

```solidity
function updateCountry(address _userAddress, uint16 _country) external;
```

***

**`updateIdentity`**

**Source**: `IIdentityRegistry`

**Description**: Updates an identity contract corresponding to a user address. Only callable by an agent of the contract.

```solidity
function updateIdentity(address _userAddress, IIdentity _identity) external;
```

***

**`batchRegisterIdentity`**

**Source**: `IIdentityRegistry`

**Description**: Registers multiple identities in batch. Only callable by an agent of the contract.

```solidity
function batchRegisterIdentity(
    address[] calldata _userAddresses,
    IIdentity[] calldata _identities,
    uint16[] calldata _countries
) external;
```

***

**`contains`**

**Source**: `IIdentityRegistry`

**Description**: Checks whether a wallet address is registered in the Identity Registry.

```solidity
function contains(address _userAddress) external view returns (bool);
```

***

**`isVerified`**

**Source**: `IIdentityRegistry`

**Description**: Checks whether an identity contract corresponding to a user address has the required claims for verification.

```solidity
function isVerified(address _userAddress) external view returns (bool);
```

***

**`identity`**

**Source**: `IIdentityRegistry`

**Description**: Returns the ONCHAINID of an investor based on their wallet address.

```solidity
function identity(address _userAddress) external view returns (IIdentity);
```

***

**`investorCountry`**

**Source**: `IIdentityRegistry`

**Description**: Returns the country code of an investor based on their wallet address.

```solidity
function investorCountry(address _userAddress) external view returns (uint16);
```

***

**`identityStorage`**

**Source**: `IIdentityRegistry`

**Description**: Returns the Identity Registry Storage linked to the current Identity Registry.

```solidity
function identityStorage() external view returns (IIdentityRegistryStorage);
```

***

**`issuersRegistry`**

**Source**: `IIdentityRegistry`

**Description**: Returns the Trusted Issuers Registry linked to the current Identity Registry.

```solidity
function issuersRegistry() external view returns (ITrustedIssuersRegistry);
```

***

**`topicsRegistry`**

**Source**: `IIdentityRegistry`

**Description**: Returns the Claim Topics Registry linked to the current Identity Registry.

```solidity
function topicsRegistry() external view returns (IClaimTopicsRegistry);
```
