跳转到内容

Initialization

constructor()
ERC721(DUTCH_AUCTION_COLLECTION_NAME, DUTCH_AUCTION_COLLECTION_SYMBOL)
{}
fun init_module(creator: &signer) {
let description = string::utf8(DUTCH_AUCTION_COLLECTION_DESCRIPTION);
let name = string::utf8(DUTCH_AUCTION_COLLECTION_NAME);
let uri = string::utf8(DUTCH_AUCTION_COLLECTION_URI);
collection::create_unlimited_collection(
creator,
description,
name,
option::none(),
uri,
);
}

init_module 会先创建一个 collection object,后续所有 token object 都会归属于它。相比 Solidity,这里仍然存在“一次性初始化”步骤,但产物不再是继承了 ERC-721 行为的合约状态机,而是一套链上的 object 结构。