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 tokens in nns #2286

Merged
merged 2 commits into from
Feb 2, 2021
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
6 changes: 3 additions & 3 deletions src/neo/SmartContract/Native/NonfungibleToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ public BigInteger BalanceOf(DataCache snapshot, UInt160 owner)
}

[ContractMethod(0_01000000, CallFlags.ReadStates)]
private IIterator Tokens(DataCache snapshot)
protected IIterator Tokens(DataCache snapshot)
{
var results = snapshot.Find(new[] { Prefix_Token }).GetEnumerator();
var results = snapshot.Find(CreateStorageKey(Prefix_Token).ToArray()).GetEnumerator();
return new StorageIterator(results, FindOptions.ValuesOnly | FindOptions.DeserializeValues | FindOptions.PickField1, null);
}

[ContractMethod(0_01000000, CallFlags.ReadStates)]
private IIterator TokensOf(DataCache snapshot, UInt160 owner)
protected IIterator TokensOf(DataCache snapshot, UInt160 owner)
{
NFTAccountState account = snapshot.TryGet(CreateStorageKey(Prefix_Account).Add(owner))?.GetInteroperable<NFTAccountState>();
IReadOnlyList<byte[]> tokens = account?.Tokens ?? (IReadOnlyList<byte[]>)System.Array.Empty<byte[]>();
Expand Down