Created
February 27, 2022 06:26
-
-
Save harry830622/578fbb6d744fa4522d160fe959639449 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 初始化合約, | |
// 創造一個全新 collection 作為官方 reserve , | |
// 然後也創造一個 Admin 來管裡所有 NBA Top Shot 卡片的狀態, | |
// 並發出合約已經初始化的 event | |
init() { | |
// Initialize contract fields | |
self.currentSeries = 0 | |
self.playDatas = {} | |
self.setDatas = {} | |
self.sets <- {} | |
self.nextPlayID = 1 | |
self.nextSetID = 1 | |
self.totalSupply = 0 | |
// Put a new Collection in storage | |
self.account.save<@Collection>(<- create Collection(), to: /storage/MomentCollection) | |
// Create a public capability for the Collection | |
self.account.link<&{MomentCollectionPublic}>(/public/MomentCollection, target: /storage/MomentCollection) | |
// Put the Minter in storage | |
self.account.save<@Admin>(<- create Admin(), to: /storage/TopShotAdmin) | |
emit ContractInitialized() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment