Skip to main content

LSP10 - Received Vaults

Standard Document

Introduction​

To keep track of all the vaults that an address owns, we should avoid the same problem mentioned in LSP5-ReceivedAssets, which is not informing recipients and senders about the ownership transfer of LSP9-Vaults.

One way to avoid this problem is to create generic metadata keys that developers should register in the smart contract storage, representing how many different vaults you own, their type, and the address of the transferred vault contract.

What does this standard represent ?​

Recommendation

Make sure to understand the ERC725Y Generic Key/Value Store and LSP2 - ERC725YJSONSchema Standards before going through the ERC725Y Data Keys.

This Metadata standard describes two data keys that can be added to an ERC725Y smart contract to keep track of received and owned LSP9-Vaults.

LSP10Vaults[]​

This data key represents a list of all the vaults owned by the contract.

{
"name": "LSP10Vaults[]",
"key": "0x55482936e01da86729a45d2b87a6b1d3bc582bea0ec00e38bdb340e3af6f9f06",
"keyType": "Array",
"valueType": "address",
"valueContent": "Address"
}
Recommendation

It is recommended to query the LSP10Vaults[] data key to check if a smart contract supports the LSP10 - ReceivedVaults standard.

LSP10VaultsMap​

This data key represents a map key holding both:

  • an ERC165 interface ID to quickly identify the standard used by each vault's smart contract (without the need to query the assets contracts directly).
  • the index in the LSP10Vaults[] array where the received vaults addresses are stored.

The LSP10VaultsMap data key also helps prevent adding duplications to the array when automatically added via smart contract (e.g., an LSP1-UniversalReceiverDelegate).

{
"name": "LSP10VaultsMap:<address>",
"key": "0x192448c3c0f88c7f238c0000<address>",
"keyType": "Mapping",
"valueType": "(bytes4,bytes8)",
"valueContent": "(Bytes4,Number)"
}

Flow​

Note

The data keys are also set on the sender's Universal Profile to remove the vault contract address when sent to the recipient.

If set when transferring vaults, these data keys are automatically updated in the UniversalProfile storage via the LSP1UniversalReceiverDelegateUP contract.

Vault transfer detailed flow

LSP10 Received Vaults Flow