> ## 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.

# IP Royalty Vault

> Learn about IP Royalty Vaults and how they manage revenue for IP Assets

An IP Royalty Vault is where all monetary inflows related to an IP Asset are stored. This revenue is then claimed with **Royalty Tokens**.

<Frame>
  <img src="https://mintcdn.com/story/KwuxPVrS3UIa7CU1/images/concepts/royalty-module/royalty-vaults.png?fit=max&auto=format&n=KwuxPVrS3UIa7CU1&q=85&s=2470c39509178a39b7524278ea15976c" alt="IP Royalty Vault" width="988" height="1008" data-path="images/concepts/royalty-module/royalty-vaults.png" />
</Frame>

<CardGroup cols={1}>
  <Card title="IPRoyaltyVault.sol" href="https://github.com/storyprotocol/protocol-core-v1/blob/main/contracts/modules/royalty/policies/IpRoyaltyVault.sol" icon="scroll" color="#ccb092">
    View the smart contract for the IP Royalty Vault.
  </Card>
</CardGroup>

## Royalty Tokens

When an IP Asset receives revenue, it is deposited into its IP Royalty Vault. In order to claim revenue from this vault, you must have the associated **Royalty Tokens**. Every vault has 100 Royalty Tokens associated with it. If an address owns these tokens, it is entitled to that % (% of the total supply of Royalty Tokens owned) of any future revenue in the IP Royalty Vault.

The IP Royalty Vault contract is also the ERC-20 contract for the **Royalty Tokens** of each IP Asset. This means the address of the IP Royalty Vault for an IP Asset is also the ERC-20 token address of the Royalty Tokens.

## Whitelisted Payment Tokens

An ERC-20 token must be whitelisted by our protocol in the [RoyaltyModule.sol contract](https://github.com/storyprotocol/protocol-core-v1/blob/e339f0671c9172a6699537285e32aa45d4c1b57b/contracts/modules/royalty/RoyaltyModule.sol#L50) to be used for making payments. Here are the whitelisted tokens:

<Tabs>
  <Tab title="Aeneid Testnet">
    | Token  | Contract Address                             | Explorer                                                                                       | Mint                                                                                                                    |
    | :----- | :------------------------------------------- | :--------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------- |
    | WIP    | `0x1514000000000000000000000000000000000000` | [View here ↗️](https://aeneid.storyscan.io/address/0x1514000000000000000000000000000000000000) | N/A                                                                                                                     |
    | MERC20 | `0xF2104833d386a2734a4eB3B8ad6FC6812F29E38E` | [View here ↗️](https://aeneid.storyscan.io/address/0xF2104833d386a2734a4eB3B8ad6FC6812F29E38E) | [Mint ↗️](https://aeneid.storyscan.io/address/0xF2104833d386a2734a4eB3B8ad6FC6812F29E38E?tab=write_contract#0x40c10f19) |
  </Tab>

  <Tab title="Mainnet">
    | Token | Contract Address                             | Explorer                                                                                       | Mint |
    | :---- | :------------------------------------------- | :--------------------------------------------------------------------------------------------- | :--- |
    | WIP   | `0x1514000000000000000000000000000000000000` | [View here ↗️](https://aeneid.storyscan.io/address/0x1514000000000000000000000000000000000000) | N/A  |
  </Tab>
</Tabs>

## How to obtain Royalty Tokens?

There are two ways that trigger the IP Royalty Vault deployment and make the initial Royalty Token distribution - whichever comes first:

1. A License Token is minted from an IP for the first time.
2. A derivative is registered under the IP.

In each case, the associated [IP Account](/concepts/ip-asset/ip-account), which is the IP itself, receives 100% of the Royalty Tokens.

Because Royalty Tokens are ERC-20, they can be transferred like any other token. Thus, the IP Account could send them to someone else, or even put them up for sale on the secondary market. Once they are transferred, the new owner now has the right to claim x% of the revenue from the royalty vault.

## Examples

Let's look at some examples of royalty flow from the IP Royalty Vault to Royalty Token holders.

### Default Case

By default, [when the royalty vault is deployed](/concepts/royalty-module/ip-royalty-vault#how-to-obtain-royalty-tokens%3F), the IP Account (which is the IP itself) receives 100% of the Royalty Tokens.

Let's look at an example where the IP Account is the full owner of the Royalty Tokens, and a payment is received into the IP Royalty Vault.

<Frame>
  <img src="https://mintcdn.com/story/Ci-RgMKFKns3XzFq/images/concepts/royalty-module/default-ip-royalty-vault.png?fit=max&auto=format&n=Ci-RgMKFKns3XzFq&q=85&s=a95d8c7567348170d28ae9f6d874c65b" alt="Royalty Tokens Default" width="1940" height="874" data-path="images/concepts/royalty-module/default-ip-royalty-vault.png" />
</Frame>

As you can see, each IP claims the full amount from its royalty vault because it has 100% of the royalty tokens.

### Multiple Royalty Token Destinations

Now let's look at a case where the IP Asset 2 has distributed 5% of its Royalty Tokens to another address. Maybe this is because they sold them on the secondary market, or maybe it's because they gave them to a friend.

<Frame>
  <img src="https://mintcdn.com/story/Ci-RgMKFKns3XzFq/images/concepts/royalty-module/cool-person.png?fit=max&auto=format&n=Ci-RgMKFKns3XzFq&q=85&s=b130fafa127ad183071c99529867340b" alt="Multiple Royalty Token Destinations" width="2020" height="1240" data-path="images/concepts/royalty-module/cool-person.png" />
</Frame>

As you can see, IP Asset 1 claims its full 10 \$WIP. But IP Asset 2 only claims 9.5 \$WIP. The other 0.5 \$WIP is claimed by the address that owns the 5% of the Royalty Tokens.

## Distributing Royalty Tokens

One of the most common questions is: *"Why does royalty end up in the IP Account? Shouldn't it end up in the IP owner's wallet?"*

While the IP Account is the initial owner of 100% of the Royalty Tokens, remember that as the IP owner, you can transfer them to whoever. An easy solution is to transfer 100% of the Royalty Tokens to the IP owner's wallet, so that when revenue is received to the IP Royalty Vault, revenue can be claimed directly to the wallet.

<Card title="Working Code Example" icon="code" href="https://github.com/storyprotocol/typescript-tutorial/blob/main/scripts/royalty/transferRoyaltyTokens.ts">
  View a working code example of transferring Royalty Tokens to an external
  wallet (like the IP owner's wallet). Remember, Royalty Tokens are simple
  ERC-20s!
</Card>

<Frame>
  <img src="https://mintcdn.com/story/Ci-RgMKFKns3XzFq/images/concepts/royalty-module/ip-owner-rts.png?fit=max&auto=format&n=Ci-RgMKFKns3XzFq&q=85&s=16cbea33f9b0bbcabc12ca3f5d87fedb" alt="Royalty Tokens Transferred" width="2104" height="1182" data-path="images/concepts/royalty-module/ip-owner-rts.png" />
</Frame>
