# IVaultAssetRegistryAdmin

Interface for the IP asset registry admin functions

## Functions

### registerIPAndFractionalize

Admin registers the IP and fractionalizes it, only when the vault is Closed

\*Aria must deploy an SPG NFT before calling this function + grant MINTER\_ROLE to the AriaIPRWAVault contract on the SPG NFT contract. The registration is made through `REGISTRATION_WORKFLOWS.createCollection(...)`, see <https://docs.story.foundation/developers/smart-contracts-guide/register-ip-asset#scenario-%232%3A-you-want-to-create-an-spg-nft-contract-to-do-minting-for-you> There are different sorts of IP on Aria:

* financialized IP: partial copyright and income streams
* remixable IP: programmable assets Either two SPG NFT will be created to handle these differents cases OR an SPG NFT will be created per tokenised IP\*

```solidity
function registerIPAndFractionalize(
    address spgNftContract,
    WorkflowStructs.IPMetadata memory ipMetadata,
    WorkflowStructs.LicenseTermsData[] memory licenseTermsData,
    address fractionalTokenTemplate,
    address fractionalTokenReceiver
) external returns (uint256 tokenId, address ipId, uint256[] memory licenseTermsIds, address fractionalToken);
```

**Parameters**

| Name                      | Type                                 | Description                                                                                                                                          |
| ------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `spgNftContract`          | `address`                            | The address of the SPG NFT contract The spgNFTContract used here has to have 0 mint fee and have MINTER\_ROLE granted to the AriaIPRWAVault contract |
| `ipMetadata`              | `WorkflowStructs.IPMetadata`         | The metadata of the IP                                                                                                                               |
| `licenseTermsData`        | `WorkflowStructs.LicenseTermsData[]` | The license terms data to be attached to the IP                                                                                                      |
| `fractionalTokenTemplate` | `address`                            | The template of the fractional token                                                                                                                 |
| `fractionalTokenReceiver` | `address`                            | The receiver of the fractional token - usually staking contract, to collect royalties and distributed to stakers.                                    |

**Returns**

| Name              | Type        | Description                              |
| ----------------- | ----------- | ---------------------------------------- |
| `tokenId`         | `uint256`   | The token ID of the IP                   |
| `ipId`            | `address`   | The IP ID                                |
| `licenseTermsIds` | `uint256[]` | The license terms IDs attached to the IP |
| `fractionalToken` | `address`   | The address of the fractional token      |

### updateFractionalTokenTotalSupply

Admin updates the total supply of the fractional token

```solidity
function updateFractionalTokenTotalSupply(uint104 newTotalSupply) external;
```

**Parameters**

| Name             | Type      | Description                                                                                                                                                                                           |
| ---------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `newTotalSupply` | `uint104` | The new total supply of the fractional token - capped to uint104 to avoid overflow in `_fundraiseCalculateClaim(...)`. A fractional token with 18 decimals can have a max supply of \~20T (trillion). |

## Events

### FractionalTokenTotalSupplyUpdated

Emitted when the fractional token total supply is updated

```solidity
event FractionalTokenTotalSupplyUpdated(uint256 previousTotalSupply, uint256 newTotalSupply);
```

**Parameters**

| Name                  | Type      | Description                                       |
| --------------------- | --------- | ------------------------------------------------- |
| `previousTotalSupply` | `uint256` | The previous total supply of the fractional token |
| `newTotalSupply`      | `uint256` | The new total supply of the fractional token      |

### IPRegisteredAndFractionalized

Emitted when the fractional token is minted

```solidity
event IPRegisteredAndFractionalized(
    address indexed ipId,
    address spgNftContract,
    uint256 tokenId,
    uint256[] licenseTermsIds,
    address indexed fractionalToken,
    address indexed fractionalTokenReceiver
);
```

**Parameters**

| Name                      | Type        | Description                                                                                                       |
| ------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------- |
| `ipId`                    | `address`   | The address of the newly registered IP                                                                            |
| `spgNftContract`          | `address`   | The address of the SPG NFT contract that was used to register the IP                                              |
| `tokenId`                 | `uint256`   | The token id in the SPG NFT contract that was used to register the IP                                             |
| `licenseTermsIds`         | `uint256[]` | The license terms IDs attached to the IP                                                                          |
| `fractionalToken`         | `address`   | The address of the fractional token                                                                               |
| `fractionalTokenReceiver` | `address`   | The receiver of the fractional token - usually staking contract, to collect royalties and distributed to stakers. |
