0xKubitus / starknet-erc721-cairo-v0

my solutions to Starknet ERC721 workshop (Cairo version 0)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starknet ERC721 Workshop Guide (Cairo version 0)

This repository contains the solutions to the exercises presented in the ERC721 Workshop created by StarkWare to teach developers how to use StarkNet.

You can find detailed guides on how to solve each exercise step by step on David Barreto' blog




IMPORTANT NOTES:

ATTENTION: This workshop uses Cairo version 0 contracts and its guide is adapted to older versions of the cairo compiler.
=> If you are using a recent version of Cairo (v0.9.0 or higher), the commands from the above guide might now be deprecated... No worries, I've got your back!


1) THE 'COMPILE' COMMAND:

Since Cairo v0.11.0.2 was released this is how to compile Cairo version 0 contracts:

starknet-compile-deprecated path/of/your/contract.cairo --output path/to/compiled/contract.json --abi path/to/abis

(adding "abi" flag is not necessary, but is used to invoke/call your functions from the CLI)




2) THE 'DECLARE' COMMAND:

Also, note that in case you're running Cairo version >= 0.9.0 (if I remember well), you need to "DECLARE" your contracts (and get their class hash) before deploying them.
=> Since in this tutorial our contracts will be written in cairo version 0, here is how you should declare your contracts:

starknet declare --contract path/of/your/compiled/contract.json --deprecated

BONUS:
You may need to specify the account used to pay fees if you have multiple accounts setup locally:
-> Open your terminal and run: cat ~/.starknet_accounts/starknet_open_zeppelin_accounts.json
=> you now have all details about your local accounts.

So, if you want/need to use a specific account ->

starknet declare --contract path/of/your/compiled/contract.json --deprecated --account your_account_name_here



3) THE 'DEPLOY' COMMAND:

Now, here's how to deploy your cairo 0 contracts (not sure exactly if/how/when it changed):

starknet deploy --class_hash 0xclassHashOfYourFunction --inputs arg1 arg2 argx --network alpha-goerli --account your_account_name_here

Obviously, "inputs" are not necessary relevant but this is where you give arguments to your constructor function - note that the arguments' values should be decimals (integers) or hex.




In case these command are not relevant anymore by the time you're reading this => feel free to check the Cairo language versions release details.

About

my solutions to Starknet ERC721 workshop (Cairo version 0)


Languages

Language:Cairo 96.4%Language:Python 3.6%