-
Notifications
You must be signed in to change notification settings - Fork 1k
Add NFT to TokenManagement #4365
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
base: master
Are you sure you want to change the base?
Conversation
src/Neo/SmartContract/StorageItem.cs
Outdated
| /// </summary> | ||
| /// <param name="integer">The integer value to set.</param> | ||
| public void Set(BigInteger integer) | ||
| public BigInteger Set(BigInteger integer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be void as before, just return the sum in the Add method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| [ContractMethod(CpuFee = 1 << 17, StorageFee = 1 << 10, RequiredCallFlags = CallFlags.All)] | ||
| internal async Task<UInt160> MintNFT(ApplicationEngine engine, UInt160 assetId, UInt160 account, Map properties) | ||
| { | ||
| if (properties.Count > 8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assetId is not checked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is checked in AddTotalSupply().
| const FindOptions options = FindOptions.KeysOnly | FindOptions.RemovePrefix; | ||
| var prefixKey = CreateStorageKey(Prefix_NFTOwnerUniqueIdIndex, account); | ||
| var enumerator = snapshot.Find(prefixKey).GetEnumerator(); | ||
| return new StorageIterator(enumerator, 21, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return new StorageIterator(enumerator, 21, options); | |
| return new StorageIterator(enumerator, Prefix_NFTOwnerUniqueIdIndex, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21 is the prefix length to be removed.
| engine.SnapshotCache.Add(key, new(new NFTState | ||
| { | ||
| AssetId = assetId, | ||
| Owner = account, | ||
| Properties = properties | ||
| })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| engine.SnapshotCache.Add(key, new(new NFTState | |
| { | |
| AssetId = assetId, | |
| Owner = account, | |
| Properties = properties | |
| })); | |
| var storageItem = new StorageItem(new NFTState | |
| { | |
| AssetId = assetId, | |
| Owner = account, | |
| Properties = properties | |
| }); | |
| storageItem.Seal(); // Seal immediately to prevent post-validation mutations | |
| engine.SnapshotCache.Add(key, storageItem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
properties can be changed. We need Seal() for storageItem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Description
Add NFT to TokenManagement
Type of change
How Has This Been Tested?
Checklist: