Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix-nep11token #874

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Neo.SmartContract.Framework/Nep11Token.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ public abstract class Nep11Token<TokenState> : TokenContract
protected const byte Prefix_Token = 0x03;
protected const byte Prefix_AccountToken = 0x04;

public sealed override byte Decimals => 0;
public sealed override byte Decimals
{
[Safe]
get => 0;
}

[Safe]
public static UInt160 OwnerOf(ByteString tokenId)
{
if (tokenId.Length > 64) throw new Exception("The argument \"tokenId\" should be 64 or less bytes long.");
StorageMap tokenMap = new(Storage.CurrentContext, Prefix_Token);
TokenState token = (TokenState)StdLib.Deserialize(tokenMap[tokenId]);
var tokenKey = tokenMap[tokenId] ?? throw new Exception("The token with given \"tokenId\" does not exist.");
TokenState token = (TokenState)StdLib.Deserialize(tokenKey);
return token.Owner;
}

Expand Down