CAIPs icon indicating copy to clipboard operation
CAIPs copied to clipboard

CAIP-19: add supports for assets on Solana

Open qbig opened this issue 2 years ago • 8 comments

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}

qbig avatar Apr 19 '22 10:04 qbig

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!

bumblefudge avatar May 12 '22 21:05 bumblefudge

https://github.com/ChainAgnostic/namespaces/pull/25 @bumblefudge something like this? Or do I need to open a PR in /CAIPs repo?

qbig avatar Jun 01 '22 11:06 qbig

well-done, this is perfect!

bumblefudge avatar Jun 01 '22 11:06 bumblefudge

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

romeo4934 avatar Jun 02 '22 10:06 romeo4934

@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 avatar Jun 04 '22 11:06 qbig

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

solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ/spl-token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

qbig avatar Jun 04 '22 11:06 qbig

@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

qbig avatar Jun 10 '22 04:06 qbig

Yes token or mint could be fine!

romeo4934 avatar Jun 10 '22 09:06 romeo4934

https://github.com/ChainAgnostic/namespaces/pull/25 is merged. So this is resolved.

qbig avatar Nov 29 '22 09:11 qbig