我们来学习一下Metaplex的nft标准
Token Metadata program给token提供了修饰结构体 Metadata结构体给token提供了基本信息 nft应该有以下链上metadata信息
pub struct Metadata {
pub key: Key,
pub update_authority: Pubkey,
pub mint: Pubkey,
pub data: Data,
// Immutable, once flipped, all sales of this metadata are considered secondary.
pub primary_sale_happened: bool,
// Whether or not the data struct is mutable, default is not
pub is_mutable: bool,
/// nonce for easy calculation of editions, if present
pub edition_nonce: Option<u8>,
/// Token Standard is deterministic and will change from SemiFungible to NonFungible if
/// you call the create master edition call and it succeeds.
pub token_standard: Option<TokenStandard>,
/// Since we cannot easily change Metadata, we add the new DataV2 fields here at the end.
/// Collection
pub collection: Option<Collection>,
/// Uses
pub uses: Option<Uses>,
}
不同的token standards
pub enum TokenStandard {
NonFungible, // This is a master edition
FungibleAsset, // A token with metadata that can also have attributes, sometimes called Semi Fungible
Fungible, // A token with simple metadata
NonFungibleEdition, // This is a limited edition
}
Metaplex不是一个单独的合约,是一个合约生态,由4个合约组成 1.Token Metadata 2.Token Vault 3.Auction 4.Metaplex
1.Token Metadata 这是整个合约生态的基础 和这个合约交互的是自己的mint 这是一个mint装饰器 用metadata PDA来装饰mint,有了name,symbol,uri等等 Phantom Wallet用了这个metadata account和uri字段,连接manifest.json文件,展示NFT 如果你的mint有一个token,可以增加一个附加decoration PDA,就是MasterEdition,主版本 这个PDA表示这个mint可以mint其他复制品
2.Token Vault Token Vault就像一个负责token分配的公司或托管 你可以创建一个vault对象,然后插入任意数量的token 它有几个不同的状态 1.Activated 2.Combined
3.Auction
The Auction Contract represents an auction primitive, and it knows nothing about NFTs, or Metadata, or anything else in the Metaplex ecosystem. All it cares about is that it has a resource address, it has auction mechanics, and it is using those auction mechanics to auction off that resource. It currently supports English Auctions and Open Edition Auctions (no winners but bids are tracked.) Its only purpose is to track who won what place in an auction and to collect money for those wins. When you place bids, or cancel them, you are interacting with this contract. However, when you redeem bids, you are not interacting with this contract, but Metaplex, because while it can provide proof that you did indeed win 4th place, it has no opinion on how the resource being auctioned off is divvied up between 1st, 2nd, 3rd, and 4th place winners, for example.
This contract will be expanded in the future to include other auction types, and better guarantees between that the auctioneer claiming the bid actually has provided the prize by having the winner sign a PDA saying that they received the prize. Right now this primitive contract should not be used in isolation, but in companionship with another contract (like Metaplex in our case) that makes such guarantees that prizes are delivered if prizes are won.
Metaplex Metaplex合约的基本产品是AuctionManagers,他们是其他三个合约结构体的连接。AuctionManager的目的是为了了解一个Auction对象拍卖Vault的内容。 Vault的内容有 1.Limited Edition Prints 2.Open Edition Prints 3.Full Rights Transfers 4.Single Token Transfers 它把内容的支付协调给拍卖的赢家们。一个AuctionManager需要一个Vault,和一个Auction,还需要Auction的resource key被设置成Vault
mint一个NFT 1.pay for the upload 2.creating a token mint 3.creating a token associated account - this is a special type of account that allows you to receive a token or tokens made by a mint 4.creating a token metadata account 5.upload the files 6.mint one token? 7.create master edition
1-4是在同一个tx中 6-7是在同一个tx中
|