Cadence
Contract Addresses
Addresses for the deployed smart contracts imported in the examples below.
Network | TopShot | TopShotMarketV3 | TopShotLocking | MetadataViews |
---|---|---|---|---|
Testnet | 0x877931736ee77cff | 0x547f177b243b4d80 | 0x877931736ee77cff | 0x631e88ae7f1d7c20 |
Mainnet | 0x0b2a3299cc857e29 | 0xc1e4f4f4c4257510 | 0x0b2a3299cc857e29 | 0x1d7e57aa55817448 |
What is Cadence?
Cadence is a new smart contract programming language for use on the Flow Blockchain. Cadence introduces new features to smart contract programming that help developers ensure that their code is safe, secure, clear, and approachable. Some of these features are:
- Type safety and a strong static type system
- Resource-oriented programming, a new paradigm that pairs linear types with object capabilities to create a secure and declarative model for digital ownership by ensuring that resources (and their associated assets) can only exist in one location at a time, cannot be copied, and cannot be accidentally lost or deleted
- Built-in pre-conditions and post-conditions for functions and transactions
- The utilization of capability-based security, which enforces access control by requiring that access to objects is restricted to only the owner and those who have a valid reference to the object
Resource-oriented programming, and by extension Cadence, is the perfect programming environment for Non-Fungible Tokens (NFTs), because users are able to store their NFT objects directly in their accounts and transact peer-to-peer. Please see the blog post about resources to understand why they are perfect for digital assets like NBA Top Shot Moments.
We recommend that anyone who is reading this should have already completed the Cadence Tutorials, so they can build a basic understanding of the programming language.
Scripts
A script is a very simple transaction type in Cadence that can only read the state of an account or contract. It is useful for querying the metadata about an NFT, a collection or a set. The following guide provide example scripts for interacting with the blockchain for NBA Top Shot data. The scripts can also be found on GitHub.
Top Shot Examples
🗃️ Collections
12 items
🗃️ Events
3 items
🗃️ Plays
4 items
🗃️ Sets
9 items
🗃️ Subeditions
3 items
🗃️ Miscellaneous
3 items