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

SRC-6 improvement: View function to retrieve underlying asset AssetId #59

Open
mattiaslightstone opened this issue Feb 15, 2024 · 3 comments

Comments

@mattiaslightstone
Copy link

Motivation

Description

Add underlying_asset to the SRC-6 specification. This would return the AssetId of the underlying asset for a vault or sub-vault.

Motivation

A standard way to get the underlying token address from a vault. Asset ID is used to retrieve information in the existing read functions and is critical for the context of a vault.

This standard used ERC4626 as a reference, which has the asset function.

Specification

fn underlying_asset(vault_sub_id: SubId) -> Option<AssetId>
The function returns the AssetId of the underlying asset for a vault. The function takes vault_sub_id as an argument and returns the ID of the asset deposited in the vault.

  • The function MUST return Some if the vault_sub_id exists
  • The function MUST return None if the vault_sub_id does not exist
@bitzoic
Copy link
Member

bitzoic commented Feb 23, 2024

@SwayStar123

@mattiaslightstone
Copy link
Author

mattiaslightstone commented Feb 24, 2024

After messaging with @dmihal, I realize now that this does limit implementations that this standard currently supports.

Only implementations that store underlying assets indexed by vault_share_asset_id would be possible.

Without including it, however, I don't see how applications like wallets can show the following without relying on an indexer:

  • <Share_asset> <Amount> : <underlying_asset> <equivalent value>

If this isn't a concern, I will close this and implement it in my contracts when needed.

@SwayStar123
Copy link
Member

I dont expect wallets to show the live underlying amount, or even the asset, and if they do they will likely use the indexer. To reduce storage costs as much as possible we have not made the mentioned method mandatory. However ofcourse if your usecase needs it you are free to implement it for your contract

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants