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

Vault standard; SRC-6 #24

Merged
merged 79 commits into from
Dec 15, 2023
Merged

Vault standard; SRC-6 #24

merged 79 commits into from
Dec 15, 2023

Conversation

SwayStar123
Copy link
Member

Type of change

  • New feature

Changes

The following changes have been made:

  • Add vault standard

@SwayStar123 SwayStar123 self-assigned this Sep 19, 2023
@SwayStar123 SwayStar123 changed the title initial commit Vault standard; SRC-6 Sep 19, 2023
@bitzoic bitzoic added SRC-6 Label used to filter for the standard issue New Standard Label used to filter for the introduction of a new standard labels Sep 20, 2023
@SwayStar123 SwayStar123 marked this pull request as ready for review September 25, 2023 15:25
@SwayStar123 SwayStar123 requested a review from a team as a code owner September 25, 2023 15:25
standards/src_6/README.md Show resolved Hide resolved
Copy link
Contributor

@Braqzen Braqzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard uses the images for SRC-5 instead of newly created images for SRC-6

standards/src_6/src/src_6.sw Outdated Show resolved Hide resolved
standards/src_6/src/src_6.sw Show resolved Hide resolved
standards/src_6/src/src_6.sw Outdated Show resolved Hide resolved
standards/src_6/src/src_6.sw Outdated Show resolved Hide resolved
standards/src_6/src/src_6.sw Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@dmihal dmihal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include methods like fn underlying_asset(asset: AssetId) -> Option<AssetId> and fn vault_asset(underlying: AssetId) -> Option<AssetId> to allow converting between vaults & underlying?

Alternatively, we could just delegate this task to the indexer, having it index Deposit events.

The following standard allows for the implementation of a standard API for token vaults such as yield bearing token vaults. This standard is an optional add-on to the SRC-20 standard.

# Motivation
Token vaults allow users to own shares of variable amount of assets, such as lending protocols which may have growing assets due to profits from interest. This pattern is highly useful and would greatly benefit from standardisation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention how a standardized vault increases composability, such as an AMM that allows trading assets based on the underlying assets... wallets that are aware of assets held in a vault, etc.

standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
This standard is fully compatible with the SRC-20 standard

# Security Considerations
Incorrect implementation of token vaults could allow attackers to steal underlying assets. It is recommended to properly audit any code using this standard to ensure exploits are not possible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should include something about how a vault can "lie" about the underlying?

Ex, if a vault says some asset represents USDC, there's no guarantee that the vault actually represents USDC (may be a consideration for wallets)

standards/src_6/src/src_6.sw Outdated Show resolved Hide resolved
standards/src_6/src/src_6.sw Show resolved Hide resolved
standards/src_6/src/src_6.sw Show resolved Hide resolved
@SwayStar123 SwayStar123 requested review from dmihal and bitzoic October 31, 2023 13:48
SwayStar123 and others added 5 commits December 12, 2023 14:24
Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com>
Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com>
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
standards/src_6/README.md Outdated Show resolved Hide resolved
@Braqzen
Copy link
Contributor

Braqzen commented Dec 12, 2023

Tag me when ready for a final review

SwayStar123 and others added 8 commits December 13, 2023 20:56
Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com>
Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com>
Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com>
@SwayStar123 SwayStar123 requested a review from bitzoic December 15, 2023 10:22
Copy link
Member

@bitzoic bitzoic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@SwayStar123
Copy link
Member Author

@Braqzen

@SwayStar123 SwayStar123 merged commit 63a7e5f into master Dec 15, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Standard Label used to filter for the introduction of a new standard SRC-6 Label used to filter for the standard issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants