> ## Documentation Index
> Fetch the complete documentation index at: https://docs.story.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# IPAccountRegistry

The IPAccountRegistry is responsible for managing the registration and tracking of IP Accounts. It leverages a public ERC6551 registry to deploy IPAccount contracts, which represent tokenized intellectual property assets within the Story ecosystem.

## State Variables

### IP\_ACCOUNT\_IMPL

```solidity theme={null}
address public immutable IP_ACCOUNT_IMPL
```

Returns the IPAccount implementation address.

### IP\_ACCOUNT\_SALT

```solidity theme={null}
bytes32 public immutable IP_ACCOUNT_SALT
```

Returns the IPAccount salt.

### ERC6551\_PUBLIC\_REGISTRY

```solidity theme={null}
address public immutable ERC6551_PUBLIC_REGISTRY
```

Returns the public ERC6551 registry address.

### IP\_ACCOUNT\_IMPL\_UPGRADEABLE\_BEACON

```solidity theme={null}
address public immutable IP_ACCOUNT_IMPL_UPGRADEABLE_BEACON
```

The IPAccount implementation upgradeable beacon address.

## Functions

### ipAccount

```solidity theme={null}
function ipAccount(uint256 chainId, address tokenContract, uint256 tokenId) public view returns (address)
```

Returns the IPAccount address for the given NFT token.

**Parameters:**

* `chainId`: The chain ID where the IP Account is located.
* `tokenContract`: The address of the token contract associated with the IP Account.
* `tokenId`: The ID of the token associated with the IP Account.

**Returns:**

* `ipAccountAddress`: The address of the IP Account associated with the given NFT token.

### getIPAccountImpl

```solidity theme={null}
function getIPAccountImpl() external view override returns (address)
```

Returns the IPAccount implementation address.

**Returns:**

* `address`: The address of the IPAccount implementation.

### \_registerIpAccount (internal)

```solidity theme={null}
function _registerIpAccount(
    uint256 chainId,
    address tokenContract,
    uint256 tokenId
) internal returns (address ipAccountAddress)
```

Deploys an IPAccount contract with the IPAccount implementation and returns the address of the new IP. The IPAccount deployment delegates to public ERC6551 Registry.

**Parameters:**

* `chainId`: The chain ID where the IP Account will be created.
* `tokenContract`: The address of the token contract to be associated with the IP Account.
* `tokenId`: The ID of the token to be associated with the IP Account.

**Returns:**

* `ipAccountAddress`: The address of the newly created IP Account.

### \_get6551AccountAddress (internal)

```solidity theme={null}
function _get6551AccountAddress(
    uint256 chainId,
    address tokenContract,
    uint256 tokenId
) internal view returns (address)
```

Helper function to get the IPAccount address from the ERC6551 registry.

**Parameters:**

* `chainId`: The chain ID where the IP Account is located.
* `tokenContract`: The address of the token contract associated with the IP Account.
* `tokenId`: The ID of the token associated with the IP Account.

**Returns:**

* `address`: The address of the IP Account.

### \_upgradeIPAccountImpl (internal)

```solidity theme={null}
function _upgradeIPAccountImpl(address newIpAccountImpl) internal
```

Helper function to upgrade the IPAccount implementation.

**Parameters:**

* `newIpAccountImpl`: The address of the new IPAccount implementation.
