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
107 changes: 107 additions & 0 deletions ARCs/arc-0041.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
arc: 41
title: ASA's vault of ASAs
description: Application ID storing ASAs for another ASA
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
requires: 3, 16
---

## Abstract
This standard is inspired by <a href="https://eips.ethereum.org/EIPS/eip-6551">EIP-6551</a>
The goal is to allow an ASA to detain & manage ASAs or Algo through a ”vault”.

## 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 following syntax:
- Main ASA -> ASA that detain & manage others ASAs
SudoWeezy marked this conversation as resolved.
Show resolved Hide resolved
- Vault -> Application ID holding ASAs of the Main ASA

### Metadata field
In order to allow wallet to identify the vault of the Main ASA must be specified in the metadata.
Using [ARC-16](./arc-0016.md):
```json
{
"title": "Main ASA",
"type": "object",
"properties": {
"vault_id": {
"type": "integer",
"description": "Application ID holding ASAs of the main ASA"
}
}
}
```

```json
{
"name": "Main ASA",
"description": "I have control over other ASAs through my vault",
"properties": {
"vault_id": 123456789
}
}
```
### Interface
```json
{
"name": "ARC-41",
"desc": "Main ASA's Vault Base Interface",
"methods": [
{
"name": "isOwner",
"desc": "Indicate if the caller detain the Main ASA of this vault, this method MUST be called before calling every other method of the application",
SudoWeezy marked this conversation as resolved.
Show resolved Hide resolved
"readonly": true,
"returns": { "type": "bool", "desc": "True if the caller detain the Main ASA of this vault, False otherwise" }
},
{
"name": "optInAsa",
"desc": "Opt-in ASA in the vault",
"readonly": false,
"args": [
{ "type": "uint64", "name": "assetId" }
],
"returns": { "type": "void" }
},
{
"name": "transferAlgoFrom",
"desc": "Transfers Algos outside of the Vault",
"readonly": false,
"args": [
{ "type": "address", "name": "from" },
{ "type": "address", "name": "to" }
],
"returns": { "type": "void" }
},
{
"name": "transferAsaFrom",
"desc": "Transfers ownership of an ASA",
"readonly": false,
"args": [
{ "type": "address", "name": "from" },
{ "type": "address", "name": "to" },
{ "type": "uint64", "name": "assetId" }
],
"returns": { "type": "void" }
}
]
}
```
## Rationale
Linking the vault ID to the Main ASA using the Metadata allows to have backwards compatibility with current implementations.
The design using an application has vault rather than a logic sig is more flexible and secure.

## Backwards Compatibility
This stantard is compatible with ASAs that can be updated [ARC-3](./arc-0003.md) + [ARC-19](./arc-0019.md) or [ARC-69](./arc-0069.md).

## Security Considerations
The method `isOwner` **MUST** be called by every other method of the application to ensure that the caller detain the main ASA.

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