Skip to main content

Implementation

This section will explore a smart contract that implements the NFT standard for the Casper Network, introduced as CEP-47. Please visit GitHub for the most up-to-date implementation.

To successfully execute this reference contract, you must copy the entire contract file with all the necessary imports, declarations, and functions. To execute the contract, you need to deploy the .wasm file on the network.

Installing Required Crates

This sample CEP-47 NFT contract requires the following crates to function correctly:

  • casper_contract - A Rust library for writing smart contracts on the Casper Network
  • casper_types - Types used to allow the creation of Wasm contracts and tests for use on the Casper Network
  • cep47 - A library for developing CEP-47 tokens for the Casper Network
import-crates

Constructing the Contract

The constructor uses three arguments to initialize the contract:

  • name - Name of the NFT token
  • symbol - Symbol of the NFT token
  • meta - Metadata about the NFT token
cep47-constructor

Implementing Contract Endpoints

Contract endpoints handle token operations with your account and other accounts. Refer to the list of endpoints in the introduction section and endpoint event stream details in the token management section.