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

CAIP-19: add supports for assets on Solana #107

Closed
qbig opened this issue Apr 19, 2022 · 9 comments
Closed

CAIP-19: add supports for assets on Solana #107

qbig opened this issue Apr 19, 2022 · 9 comments

Comments

@qbig
Copy link

qbig commented Apr 19, 2022

On solana, all contracts are stateless and state is instead represented using "accounts". More specifically, all fungible and non-fungible tokens are using the same instance of token contracts and for each token:

  • 1 single global "mint" account instance is used for the global data like "total supply"
  • each token account represent an account balance belong to a certain address

And the difference between fungible token and non-fungible token is that non-fungible token mint has a total supply of 1 and zero decimal place.
So maybe we could use mint address and account address for solana here. Based on CAIP-19 and CAIP-30

note Solana support semi-fungible token where 1 mints have multiple token account
As a reference OpenSea beta is also using mint as "token ID" :
https://opensea.io/assets/solana/3Fif3sYuL7vfVifb3gDYQym8THCfaU3DQo1ctuXMu7dz

eg.

# CryptoKitties Collectible ID
eip155:1/erc721:0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/771769

# One Solana Mainnet NFT
solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-mint:{the-token-mint-address}/{the-token-account-address}
@bumblefudge
Copy link
Collaborator

Very interested! Could I ask you to check out namespaces/template and caip104 and open a PR to fit the model of:
namespaces/solana/caip19.md
?
Ping me if you have any questions!

@qbig
Copy link
Author

qbig commented Jun 1, 2022

ChainAgnostic/namespaces#25 @bumblefudge something like this? Or do I need to open a PR in /CAIPs repo?

@bumblefudge
Copy link
Collaborator

well-done, this is perfect!

@romeo4934
Copy link
Contributor

I think it should be the mint address only to specify the asset for fungible token

I would pick spl-token as it is the way Solana called tokens:

so
Solana USDC token example
solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

@qbig
Copy link
Author

qbig commented Jun 4, 2022

@antoineherzog agree that we could consider using "spl-token" as the namespace here. Just tht spl-token-mint might be more explicit.

But mint address can be used to identify the asset type for both fungible token and non-fungible token. Could you elaborate on why "only to specify fungible token" ?

@qbig
Copy link
Author

qbig commented Jun 4, 2022

@antoineherzog @bumblefudge actually spl-token is better since it's also shorter. let's go with

solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

@qbig
Copy link
Author

qbig commented Jun 10, 2022

@antoineherzog how about just token because in CAIP-19 draft:

The method specific identifier is simply a [CAIP-19 Asset ID](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-19.md) where all / characters are replaced by _, in order to comply with the DID spec.

solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ_spl-token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

using both '_' and '-' makes it kinda confusing

@romeo4934
Copy link
Contributor

romeo4934 commented Jun 10, 2022

Yes token or mint could be fine!

@qbig
Copy link
Author

qbig commented Nov 29, 2022

ChainAgnostic/namespaces#25 is merged. So this is resolved.

@qbig qbig closed this as completed Nov 29, 2022
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