Created
July 19, 2021 13:40
-
-
Save polluterofminds/f1eebbcbc413f0967729a3160d4997ff to your computer and use it in GitHub Desktop.
Minting
This file contains hidden or 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
export function mint_to(owner_id: AccountId, metadata_uri: MetadataUri): u64 { | |
const tokenId = storage.getPrimitive<u64>(TOTAL_SUPPLY, 1) | |
assert(tokenId <= MAX_SUPPLY, ERROR_MAXIMUM_TOKEN_LIMIT_REACHED) | |
tokenToOwner.set(tokenId, owner_id) | |
tokenToMetadata.set(tokenId, metadata_uri) | |
storage.set<u64>(TOTAL_SUPPLY, tokenId + 1) | |
const owner = storage.get<string>("contract_owner") | |
assert(owner != null, ERROR_OWNER_ID_DOES_NOT_MATCH_EXPECTATION) | |
return tokenId | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment