Skip to content

An implementation of ERC721 NFT token contract with metadata for Starknet using Cairo 2.3

Notifications You must be signed in to change notification settings

kfastov/starknet-erc721-metadata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NFT Smart Contract for Starknet

This repository contains a smart contract designed for the Starknet blockchain, tailored for managing non-fungible tokens (NFTs) with a linkage to IPFS for metadata storage.

Prerequisites

To build and deploy this smart contract on Starknet, you will need the following tools:

  • Starkli: Command-line tool for Starknet to compile and deploy your contracts.

  • Scarb: The build toolchain and package manager for Cairo and Starknet ecosystems.

Please follow the linked guides to install each necessary component before attempting to build or deploy the smart contract.

Non-Standard Methods

In addition to the standard ERC721 methods, this contract implements a few non-standard methods for enhanced functionality:

  • mint: A method to mint new NFTs, restricted to be called by the contract's admin only. It allows batch minting up to a defined MAX_MINT_AMOUNT.

  • max_supply: Retrieves the maximum supply of tokens that can be minted.

  • total_supply: Provides the total number of tokens that have been minted.

  • set_base_uri: Sets a base URI that will be common for all tokens. .

Build and deploy

To deploy this smart contract to Starknet, you will use starkli to declare the contract class and deploy its instances on Starknet after compiling the contract with Scarb.

Build the contract:

scarb build

Declare the contract:

starkli declare target/dev/erc721_ipfs_example_ERC721IPFSTemplate.contract_class.json

Deploy the contract with constructor args:

starkli deploy {{CONTRACT_CLASS_HASH}} {{admin_account_address}} {{name}} {{symbol}} {{max_supply}}

Contributing

Contributions of all kinds are welcome. If you want to tip me a beer, you can send me some ETH to 0x02dc32837907CA92B5B99e7C2470fFF9c62FAB91F2cc1Ef1416A07171F1eF8C5

About

An implementation of ERC721 NFT token contract with metadata for Starknet using Cairo 2.3

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages