-
Notifications
You must be signed in to change notification settings - Fork 113
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
NEP-3 Ammendment #84
Comments
Good suggestion. |
Ricardo, please see this. @lock9 |
Another important feature is a Witness type on NEP-3. I'll explain the details. Using this, someone could write this code on NEP-5 (general language): This means that parameter from is already validated by witness system (no explicit Runtime.CheckWitness will be needed on code). Devpacks could adapt to it, for example, on C# we could provide a type conversion from Address type (or byte[]) to a Witness object. This function basically calls Runtime.CheckWitness over the parameter, verifies if it's correct, and return a Witness (same as a byte[], but validated from code perspective). object Main(string op, object[] args) {
...
if (op == "transfer") {
Witness from = ((byte[])args[0]).ToWitness(); // fails if it's not a verified witness (implicit call to Runtime.CheckWitness)
Address to = ((byte[])args[1]).ToAddress(); // fails if size is not 20
BigInteger value = ((BigInteger)args[2]).AsBigInteger(); // Shall we create a NonNegative type too? avoids negative values here already...
return Transfer(from, to, value); // we could do in a single line too
}
...
} If this was standard since the beggining, we could have also avoided some validation problems on smart contracts. What do you think @lightszero @erikzhang @shargon ? |
See neo-project/neo#906 for other applications (automatically deducing that a witness is needed, on wallets via ABI). A good example is also DomainRegister example, that requires authentication from both sides: transfer(Witness a, Witness b, String domain). |
@igormcoelho what if you divide this into 2 issues? it will be easier to implement, review and test. Regarding the initial proposition, I think we should support JSON. Someone mentioned some json stuff these days, I just don't remember where. It was in the persistence layer I think 🤔 No Json = No Happy developers |
Ok, so we have many possibilities for ammendments here hahaha |
@igormcoelho can you make a list? |
I believe NeoContract ABI (https://github.com/neo-project/proposals/blob/master/nep-3.mediawiki) may have useful ammendments:
The text was updated successfully, but these errors were encountered: