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

NEP-14 and NEP-15 support #1651

Closed
gsmachado opened this issue Jan 9, 2021 · 5 comments
Closed

NEP-14 and NEP-15 support #1651

gsmachado opened this issue Jan 9, 2021 · 5 comments

Comments

@gsmachado
Copy link

I don't know if I just overlooked, or maybe the documentation didn't mention it, but I could not find a way to compile a smart contract and outputting the ABI of it.

My question is:
How can I compile the examples/token/token.go and output an ABI/manifest that is compatible with NEP-14/NEP-15?

@roman-khimov
Copy link
Member

I'll check the documentation, but we of course do support NEP-15 manifests, take a look at workshop page for example. The only potential inconvenience is that the compiler needs both Go source code and YAML metadata file (but our examples do have them) with name/standards/safe methods/events description to generate proper manifest.

In your case it would be something like this:

$ ./bin/neo-go contract compile -i examples/token/token.go -c examples/token/token.yml -m examples/token/token.manifest -o examples/token/token.nef

@gsmachado
Copy link
Author

Thanks! Actually, I simply didn't read the fucking manual, and also didn't execute neo-go contract compile --help, which I found out right after I posted this issue. 👍

It's all fine, and thanks anyway for your answer! 💯

@gsmachado
Copy link
Author

@roman-khimov

Just a follow-up question: What's the reason for having the .yml metadata along with the Go smart contracts? I would like to have an insight into your design decision.

@roman-khimov
Copy link
Member

We need to get metadata from somewhere, currently that's contract's name, list of supported standards, list of safe methods and events. And we don't have anything similar to C# attributes in Go (the closest thing probably is tag in structure field declaration, but that's just for struct fields), so we either need to invent some magic comments (or magic variables, see #1038 also) or use a separate "project descriptor" file. We've used YAMLs for metadata in Neo 2.x implementation, so adapting them to Neo 3 was a natural choice.

I'm open for better suggestions though.

@gsmachado
Copy link
Author

@roman-khimov thanks for the clarification!

Let's close this issue and I will move the discussion about this to #1038 . 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants