diff --git a/mover/yueliao11/code/task3/Move.lock b/mover/yueliao11/code/task3/Move.lock new file mode 100644 index 000000000..13d64c89d --- /dev/null +++ b/mover/yueliao11/code/task3/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "2B41AE4822173E239CEBD326CC63067D6D4C241D88384DA0A128A80EB8E156C9" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/mainnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/mainnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.37.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0x3da83250affdd9e22d0a601dac90a9d927149bb94292cf781650ef1fdda6da68" +latest-published-id = "0x3da83250affdd9e22d0a601dac90a9d927149bb94292cf781650ef1fdda6da68" +published-version = "1" diff --git a/mover/yueliao11/code/task3/Move.toml b/mover/yueliao11/code/task3/Move.toml new file mode 100644 index 000000000..2a36ae277 --- /dev/null +++ b/mover/yueliao11/code/task3/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "task3" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://gitee.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/mainnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +task3 = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/yueliao11/code/task3/nft.jpg b/mover/yueliao11/code/task3/nft.jpg new file mode 100644 index 000000000..0ecbd36c4 Binary files /dev/null and b/mover/yueliao11/code/task3/nft.jpg differ diff --git a/mover/yueliao11/code/task3/readme.md b/mover/yueliao11/code/task3/readme.md new file mode 100644 index 000000000..cbd3e3376 --- /dev/null +++ b/mover/yueliao11/code/task3/readme.md @@ -0,0 +1,17 @@ +``` +sui move build +sui client publish --gas-budget 100000000 +sui client call --function mint \ + --module yueliaoNFT \ + --package 0x3da83250affdd9e22d0a601dac90a9d927149bb94292cf781650ef1fdda6da68 \ + --args "yueliao11" "NFT for yueliao11" 0x7865c7cbd6dc262645ba44713f260e62a66ea99d74746e8823658270cb4a4398 \ + --gas-budget 100000000 + + # mint 一个 NFT 到指定地址 +sui client call --function mint \ + --module yueliaoNFT \ + --package 0x3da83250affdd9e22d0a601dac90a9d927149bb94292cf781650ef1fdda6da68 \ + --args "yueliao11" "NFT for yueliao11" "0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2" \ + --gas-budget 100000000 \ +![NFT Mint Screenshot](./nft.jpg) +``` \ No newline at end of file diff --git a/mover/yueliao11/code/task3/sources/task3.move b/mover/yueliao11/code/task3/sources/task3.move new file mode 100644 index 000000000..974a395d4 --- /dev/null +++ b/mover/yueliao11/code/task3/sources/task3.move @@ -0,0 +1,45 @@ +module task3::yueliaoNFT { + use sui::tx_context::{Self, TxContext}; + use sui::display; + use sui::object::{Self, UID}; + use sui::package; + use sui::transfer; + use std::string::{String, utf8}; + + public struct YUELIAONFT has drop {} + + public struct YUELIAO has key, store { + id: UID, + name: String, + description: String, + } + + fun init(otw: YUELIAONFT, ctx: &mut TxContext) { + let keys = vector[ + utf8(b"name"), + utf8(b"description"), + utf8(b"image_url") + ]; + let values = vector[ + utf8(b"yueliao11"), + utf8(b"NFT for yueliao11"), + utf8(b"https://avatars.githubusercontent.com/u/187120306?u=1902a0c17e07b76b0bb5ff5a93144d78ed5c1ed8&v=4&size=64") + ]; + let publisher = package::claim(otw, ctx); + let mut display = display::new_with_fields(&publisher, keys, values, ctx); + display::update_version(&mut display); + + let deployer = tx_context::sender(ctx); + transfer::public_transfer(publisher, deployer); + transfer::public_transfer(display, deployer); + } + + public entry fun mint(name: vector, description: vector, recipient: address, ctx: &mut TxContext) { + let nft = YUELIAO { + id: object::new(ctx), + name: utf8(name), + description: utf8(description), + }; + transfer::public_transfer(nft, recipient); + } +} \ No newline at end of file