Intro to Sui Objects Workshop Repo
- Install Rust and other dependencies: https://docs.sui.io/build/install#prerequisites
- git clone https://github.com/MystenLabs/sui.git --branch devnet
- git fetch upstream
- git checkout devnet-0.12.2
- cargo install --locked --git https://github.com/MystenLabs/sui.git --branch "devnet" sui sui-gateway
- sui client (use default options to connect to devnet)
- Join Sui Discord: https://discord.com/invite/GcFNX4WMrB
- Get your current wallet address with the command: sui client active-address
- Go to #devnet-faucet channel and type "!faucet [your wallet address]"
- git clone https://github.com/hyd628/sui_intro_workshop.git
- sui move build
- sui client publish --path [local file path to the sui intro workshop module] --gas-budget 30000
Set up the environment, git clone this repo, and acquire some DevNet Sui tokens per the instructions in this README.
Familiarize yourself with the sui_dinos.move contract. You will use that as the starting point for the following two tasks.
The two challenges are independent. You can work on either one, but doing the first one will give you some familiarity with the sui::coin
module, which is also used in challenge two.
Currently, we are aborting the transaction if the coin object sent in during paid minting is not the exact same amount as the minting fee.
Make the changes necessary so that we check if the coin object sent in is enough to cover the minting fee and send back any extra left as change, instead of only accepting the exact amount.
Hints:
- You will need to utilize functions in
sui::coin
. - It might be useful to redefine the existing error type for not sending in the exact amount.
Create a new method in the sui_intro_workshop::dino_nft
module for the owner of the NFT contract to withdraw the balance collected in MintingTreasury
to their own account.
Hints:
- The contract already has most of the infrastructure needed to do this. What are we using to mark the owner or minter account of the NFT contract?
- You will need to use functions from
sui::coin
andsui::balance
. - It might make sense to create a new error type for an edge case here.
- Sui Framework Docs
- Sui Developer Documentation
- Sui Explorer
- Sui CLI Tutorial
- Move Programming Language Book
- Sui by Example
When you are ready to see the solutions: