Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arc 41 - NFT's vault of NFT, Algo & Fungible Token #213

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
144 changes: 144 additions & 0 deletions ARCs/arc-0041.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
---
arc: 41
title: NFT's vault of NFTs & FTs
description: Application subsidiaries of an NFT storing NFTs & FTs
author: Stéphane BARROSO (@SudoWeezy)
discussions-to: https://github.com/algorandfoundation/ARCs/issues/213
status: Draft
type: Standards Track
category: Interface
created: 2023-06-16
---

## Abstract
This standard is inspired by <a href="https://eips.ethereum.org/EIPS/eip-6551">EIP-6551</a>
The goal is to create a smart contract that will give its owner a way to bundle multiple Algo/Fungible Token/NFTs at once.


## Specification
The key words "**MUST**", "**MUST NOT**", "**REQUIRED**", "**SHALL**", "**SHALL NOT**", "**SHOULD**", "**SHOULD NOT**", "**RECOMMENDED**", "**MAY**", and "**OPTIONAL**" in this document are to be interpreted as described in <a href="https://www.ietf.org/rfc/rfc2119.txt">RFC-2119</a>.

### Glossary
In the document, we will use the following syntax:
- Authority NFT -> NFT that detain & manage others NFTs & FTs
- Vault -> Application ID holding NFTs & FTs of the Authority NFT

### Events
To allow wallet & dApps to identify the vault of the Authority NFT, an [ARC-28](./arc-0028.md) event MUST be emitted when creating the vault.
```json
{
"events": [
{
"name": "arc41_AccountCreated",
"desc": "Creation of a Vault",
"args": [
{
"type": "address",
"name": "account",
"desc": "The current owner of the authority NFT"
},
{
"type": "uint64",
"name": "asaId",
"desc": "The asaId owner of the authority NFT, (0 if application NFT)"
},
{
"type": "uint256",
"name": "tokenId",
"desc": "The ID of the authority NFT, (0 if ASA)"
},
{
"type": "uint64",
"name": "appId",
"desc": "The Application ID of the authority NFT, (0 if ASA)"
}
]
}
]
}
```

An `arc41_AccountCreated` event MUST be emitted when a vault is created.


### Interface
```json
{
"name": "ARC-41",
"desc": "Authority NFT's Vault Base Interface",
"methods": [
{
"name": "arc41_isOwner",
"desc": "Indicate if the caller detains the Authority NFT of this vault",
"readonly": true,
"returns": { "type": "bool", "desc": "True if the caller detains the Authority NFT of this vault, False otherwise" }
},
{
"name": "arc41_setOwner",
"desc": "If the caller detains the Authority NFT of this vault, this method MUST set him as Owner of the vault",
"readonly": true,
"returns": { "type": "bool", "desc": "True if the caller detains the Authority NFT of this vault, False otherwise" }
},
{
"name": "arc41_optIn",
"desc": "Opt-in ASA in the vault",
"readonly": false,
"args": [
{ "type": "uint64", "name": "asaId" }
],
"returns": { "type": "void" }
},
{
"name": "arc41_transferAlgoTo",
"desc": "Transfers Algos outside of the Vault",
"readonly": false,
"args": [
{ "type": "address", "name": "to" }
],
"returns": { "type": "void" }
},
{
"name": "arc41_transferTo",
"desc": "Transfers ownership of an NFT/fungible Token",
"readonly": false,
"args": [
{ "type": "address", "name": "to" },
{ "type": "uint64", "name": "amount" },
{
"type": "uint64",
"name": "asaId",
"desc": "The asaId of the NFT to transfer (0 if application NFT)"
},
{
"type": "uint256",
"name": "tokenId",
"desc": "The ID of the Smart Contract/Application NFT to transfer (0 if ASA)"
},
{
"type": "uint64",
"name": "appId",
"desc": "The Application ID of the Smart Contract/Application NFT to transfer (0 if ASA)"
}
],
"returns": { "type": "void" }
}
]
}
```

The `arc41_isOwner` method MUST be called internally by every other method.
The `arc41_setOwner` method MUST error when the caller is not the owner of authority NFT.
The `arc41_transferAlgoTo` method MUST error when `arc41_isOwner` returns false.
The `arc41_transferTo` method MUST error when `arc41_isOwner` returns false.

## Rationale
ASAs NFT following [ARC-3](./arc-0003.md), [ARC-19](./arc-0019.md) or [ARC-69](./arc-0069.md) and Application NFT ([ARC-72](./arc-0072.md)) are compatible with this standard.

## Backwards Compatibility
This standard is compatible with every NFT standard.

## Security Considerations
The method `isOwner` **MUST** be called internally by the logic of every other application method (except `arc41_setOwner`) to ensure that the caller detains the Authority NFT.

## Copyright
Copyright and related rights waived via <a href="https://creativecommons.org/publicdomain/zero/1.0/">CCO</a>.