flow
flow copied to clipboard
Update & improve Cadence onboarding tutorials and best practices docs
Context
The Cadence tutorials (e.g. https://docs.onflow.org/cadence/tutorial/01-first-steps) were originally written almost a year ago. Cadence has changed a lot since then! It's time to update them to be demonstrative of modern Cadence.
Definition of Done
The following should be addressed for each tutorial listed below:
- Code is updated to be compatible with the latest Cadence version (syntax errors and semantic errors are corrected)
- Code is updated to better demonstrate idiomatic Cadence (when applicable)
- Where needed, tutorial instructions are updated for clarity or to remove outdated references
Tutorials:
- [x] Hello World
- [x] Fungible Tokens
- [x] Non-Fungible Tokens
- [x] Marketplace Setup
- [x] Marketplace
- [ ] Composable Resources
- [ ] Voting
@10thfloor Where are the automated tests for the tutorials located? Probably would be good to include something in this ticket for making sure those get updated with the latest code too and are still passing.
@robmyers Do you feel good enough about the kitty items marketplace contract that you could use that as the marketplace tutorial instead of what we currently have?
Two things were reported that I can think off:
-
UFix64
constructor is called for number literals that are already inferred to beUFix64
(now; they didn't use to. BTW: negative fixed-point literals are inferred toFix64
), e.g.UFix64(1.0)
->1.0
- No need to force-unwrap the result of
getCapability
calls anymore, the result is now non-optional.
Luckily this is right place to discuss this, right now we have the ft tutorial placed after the nft tutorial, is that intended to be that way?
@alilloig yes that was intentional after the recent tutorials audit
When we update the two remaining tutorials it will be nice to update the links (e.g. https://docs.onflow.org/cadence/tutorial/07-marketplace-setup/ is actually the 5th tutorial now, not the 7th)
Actually, the link is correct. The title and sidebar for the tutorials is wrong there. Marketplace setup should be the 7th tutorial, marketplace the 8th tutorial, composable the 9th, and voting the 10th. Can you update those also?
Yeah that's true, I'll update it! I'm assuming I only need to update the title
field on the .mdx
files, that is correct?
You'll also need to update the gatsby-config
file in the onflow/flow repo