-
Notifications
You must be signed in to change notification settings - Fork 102
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
Numerous modifications and optimization for Template.NEP5.CSharp #304
Conversation
{ | ||
balances.Delete(from); | ||
Error("The parameters from and to SHOULD be 20-byte addresses."); |
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.
No, should keep it, throw an exception. This is defined in nep5 standard.
The parameters from and to SHOULD be 20-byte addresses. If not, this method SHOULD throw an exception.
Waiting for #302
public static extern void Notify(string eventName, params object[] state); |
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.
Great changes, @chenzhitong!
if (amount <= 0) throw new Exception("The parameter amount MUST be greater than 0."); | ||
if (!IsPayable(to)) throw new Exception("Receiver cannot receive."); | ||
if (!Runtime.CheckWitness(from) && !from.Equals(ExecutionEngine.CallingScriptHash)) throw new Exception("No authorization."); | ||
if (AssetStorage.Get(from) < amount) throw new Exception("Insufficient balance."); | ||
if (amount == 0 || from == to) return true; |
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.
amount <= 0
will throw exception, so amount == 0
is impossible in there?
…piler has upgraded and then changed the code back.
@chenzhitong could you check our reviews? |
Pass test, it's down @shargon . |
@ProDog done, could you check it? |
This can merge. |
Adjust the code structure:
AssetStorage
class andTotalSupplyStorage
class to make it more versatileStoragePrefixBalance
property andStoragePrefixContract
propertyNEP5.Admin.cs
toNEP5.Owner.cs
Optimize the writing:
?.ToBigInteger() ?? 0
toTryToBigInteger()
Fix the balance error in Mint method:
OnTransfer(null, tx.Sender, balance + contribution);
Feature improvements:
change