diff --git a/mover/002/code/task1/hellomove/Move.toml b/mover/002/code/task1/hellomove/Move.toml new file mode 100644 index 000000000..be65a17c8 --- /dev/null +++ b/mover/002/code/task1/hellomove/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hellomove" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +hellomove = "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/002/code/task1/hellomove/sources/hellomove.move b/mover/002/code/task1/hellomove/sources/hellomove.move new file mode 100644 index 000000000..1609d4e9b --- /dev/null +++ b/mover/002/code/task1/hellomove/sources/hellomove.move @@ -0,0 +1,19 @@ +module hellomove::hello ; + +use std::ascii::{String, string}; +use sui::object::{Self, UID}; +use sui::transfer::transfer; +use sui::tx_context::{TxContext}; + +public struct Hello has key { + id: UID, + say: String +} + +fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id: object::new(ctx), + say: string(b"hoh"), + }; + transfer(hello_move, ctx.sender()); +} \ No newline at end of file diff --git a/mover/002/code/task1/hellomove/tests/hellomove_tests.move b/mover/002/code/task1/hellomove/tests/hellomove_tests.move new file mode 100644 index 000000000..3f6ec59dc --- /dev/null +++ b/mover/002/code/task1/hellomove/tests/hellomove_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hellomove::hellomove_tests; +// uncomment this line to import the module +// use hellomove::hellomove; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hellomove() { + // pass +} + +#[test, expected_failure(abort_code = ::hellomove::hellomove_tests::ENotImplemented)] +fun test_hellomove_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/001/co-learn-2411/images/readme.md b/mover/Aydenchange/co-learn-2411/images/readme.md similarity index 100% rename from mover/001/co-learn-2411/images/readme.md rename to mover/Aydenchange/co-learn-2411/images/readme.md diff --git a/mover/001/co-learn-2411/project/readme.md b/mover/Aydenchange/co-learn-2411/project/readme.md similarity index 100% rename from mover/001/co-learn-2411/project/readme.md rename to mover/Aydenchange/co-learn-2411/project/readme.md diff --git a/mover/001/co-learn-2411/readme.md b/mover/Aydenchange/co-learn-2411/readme.md similarity index 100% rename from mover/001/co-learn-2411/readme.md rename to mover/Aydenchange/co-learn-2411/readme.md diff --git a/mover/001/code/readme.md b/mover/Aydenchange/code/readme.md similarity index 100% rename from mover/001/code/readme.md rename to mover/Aydenchange/code/readme.md diff --git a/mover/Aydenchange/code/task1/hellomove/Move.lock b/mover/Aydenchange/code/task1/hellomove/Move.lock new file mode 100644 index 000000000..953c3ad73 --- /dev/null +++ b/mover/Aydenchange/code/task1/hellomove/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "11BAF94A33662E7D904523341D85F0402E2C1A82A85216775F5E05EC6ADE9D9C" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", 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.testnet] +chain-id = "4c78adac" +original-published-id = "0xb897790e416c68feeab5302815f8e579890016c620d9a94871fc29f17fcd4b41" +latest-published-id = "0xb897790e416c68feeab5302815f8e579890016c620d9a94871fc29f17fcd4b41" +published-version = "1" diff --git a/mover/Aydenchange/code/task1/hellomove/Move.toml b/mover/Aydenchange/code/task1/hellomove/Move.toml new file mode 100644 index 000000000..be65a17c8 --- /dev/null +++ b/mover/Aydenchange/code/task1/hellomove/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hellomove" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +hellomove = "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/Aydenchange/code/task1/hellomove/sources/hellomove.move b/mover/Aydenchange/code/task1/hellomove/sources/hellomove.move new file mode 100644 index 000000000..8fdf06aeb --- /dev/null +++ b/mover/Aydenchange/code/task1/hellomove/sources/hellomove.move @@ -0,0 +1,19 @@ +module hellomove::hello ; + +use std::ascii::{String, string}; +use sui::object::{Self, UID}; +use sui::transfer::transfer; +use sui::tx_context::{TxContext, sender}; + +public struct Hello has key { + id: UID, + say: String +} + +fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id: object::new(ctx), + say: string(b"Aydenchange"), + }; + transfer(hello_move, sender(ctx)); +} \ No newline at end of file diff --git a/mover/Aydenchange/code/task1/hellomove/tests/hellomove_tests.move b/mover/Aydenchange/code/task1/hellomove/tests/hellomove_tests.move new file mode 100644 index 000000000..3f6ec59dc --- /dev/null +++ b/mover/Aydenchange/code/task1/hellomove/tests/hellomove_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hellomove::hellomove_tests; +// uncomment this line to import the module +// use hellomove::hellomove; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hellomove() { + // pass +} + +#[test, expected_failure(abort_code = ::hellomove::hellomove_tests::ENotImplemented)] +fun test_hellomove_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/Aydenchange/images/img.png b/mover/Aydenchange/images/img.png new file mode 100644 index 000000000..7e4113f4e Binary files /dev/null and b/mover/Aydenchange/images/img.png differ diff --git a/mover/Aydenchange/images/img_1.png b/mover/Aydenchange/images/img_1.png new file mode 100644 index 000000000..b848e9ed3 Binary files /dev/null and b/mover/Aydenchange/images/img_1.png differ diff --git a/mover/Aydenchange/notes/readme.md b/mover/Aydenchange/notes/readme.md new file mode 100644 index 000000000..04d2e8587 --- /dev/null +++ b/mover/Aydenchange/notes/readme.md @@ -0,0 +1,4 @@ +# 2024.11.08 +- 安装sui环境网络太差,开始没成功,换节点后瞬间成功 +- publish代码时拷贝代码库里的代码报错string没有定义,经过ai指导修改正常运行,后来发现readme里面的代码才是正确的 +- publish连接github/gitee一直报错,目前还是没有理解,使用skip指令跳过发布成功 \ No newline at end of file diff --git a/mover/Aydenchange/readme.md b/mover/Aydenchange/readme.md new file mode 100644 index 000000000..b260e1af4 --- /dev/null +++ b/mover/Aydenchange/readme.md @@ -0,0 +1,54 @@ +## 基本信息 +- Sui钱包地址: `0xc30e46691599511840ae7ba036f9bef61aaf6afccafae36202a3bf511fc0d5a5` +> 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址 +- github: `Aydenchange` + +## 个人简介 +- 工作经验: 8年 +- 技术栈: `Java` `React` +> 重要提示 请认真写自己的简介 +- 后端开发3年,后转入传统行业从事系统分析师5年,希望入门区块链 +- 联系方式: tg: `Wu Ayden` + +## 任务 + +## 01 hello move +- [√] Sui cli version:sui 1.37.1-7839b9501066 +- [√] Sui钱包截图: ![Sui钱包截图](./images/img.png) +- [√] package id: 0xb897790e416c68feeab5302815f8e579890016c620d9a94871fc29f17fcd4b41 +- [√] package id 在 scan上的查看截图:![Scan截图](./images/img_1.png) + +## 02 move coin +- [] My Coin package id : +- [] Faucet package id : +- [] 转账 `My Coin` hash: +- [] `Faucet Coin` address1 mint hash: +- [] `Faucet Coin` address2 mint hash: + +## 03 move NFT +- [] nft package id : +- [] nft object id : +- [] 转账 nft hash: +- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) + +## 04 Move Game +- [] game package id : +- [] deposit Coin hash: +- [] withdraw `Coin` hash: +- [] play game hash: + +## 05 Move Swap +- [] swap package id : +- [] call swap CoinA-> CoinB hash : +- [] call swap CoinB-> CoinA hash : + +## 06 Dapp-kit SDK PTB +- [] save hash : + +## 07 Move CTF Check In +- [] CLI call 截图 : ![截图](./images/你的图片地址) +- [] flag hash : + +## 08 Move CTF Lets Move +- [] proof : +- [] flag hash : diff --git a/mover/001/scan/readme.md b/mover/Aydenchange/scan/readme.md similarity index 100% rename from mover/001/scan/readme.md rename to mover/Aydenchange/scan/readme.md diff --git a/mover/ChainRex/code/task7/getflag/Move.lock b/mover/ChainRex/code/task7/getflag/Move.lock new file mode 100644 index 000000000..6e7d05743 --- /dev/null +++ b/mover/ChainRex/code/task7/getflag/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "0348B6DDD825DB2342AA3FBFE1ED7615A488066F5119B163F340ED30C195D886" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", 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.suiscan-testnet] +chain-id = "4c78adac" +original-published-id = "0x0000000000000000000000000000000000000000000000000000000000000000" +latest-published-id = "0x21c522bac2b85255fdc47d411a1155efc45e9f2f03f6588e978c9e1b972a6318" +published-version = "1" diff --git a/mover/ChainRex/code/task7/getflag/Move.toml b/mover/ChainRex/code/task7/getflag/Move.toml new file mode 100644 index 000000000..550fc3772 --- /dev/null +++ b/mover/ChainRex/code/task7/getflag/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "getflag" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +getflag = "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/ChainRex/code/task7/getflag/sources/getfalg.move b/mover/ChainRex/code/task7/getflag/sources/getfalg.move new file mode 100644 index 000000000..7c4a402c5 --- /dev/null +++ b/mover/ChainRex/code/task7/getflag/sources/getfalg.move @@ -0,0 +1,32 @@ +module getflag::getflag { + use std::ascii::{ String }; + use std::bcs; + use std::hash::sha3_256; + + public struct Answer has key { + id: UID, + flag: vector + } + + fun init(ctx: &mut TxContext) { + let answer = Answer { + id: object::new(ctx), + flag: vector::empty() + }; + transfer::share_object(answer) + } + + public entry fun get_flag( + answer: &mut Answer, + github_id: String, + flag_str: String, + ) { + let mut bcs_flag = bcs::to_bytes(&flag_str); + vector::append( + &mut bcs_flag, + *github_id.as_bytes() + ); + answer.flag = sha3_256(bcs_flag); + + } +} diff --git a/mover/ChainRex/code/task7/getflag/tests/getfalg_tests.move b/mover/ChainRex/code/task7/getflag/tests/getfalg_tests.move new file mode 100644 index 000000000..0e5bb6925 --- /dev/null +++ b/mover/ChainRex/code/task7/getflag/tests/getfalg_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module getfalg::getfalg_tests; +// uncomment this line to import the module +// use getfalg::getfalg; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_getfalg() { + // pass +} + +#[test, expected_failure(abort_code = ::getfalg::getfalg_tests::ENotImplemented)] +fun test_getfalg_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/ChainRex/images/task7/cli_call.png b/mover/ChainRex/images/task7/cli_call.png new file mode 100644 index 000000000..ae1420182 Binary files /dev/null and b/mover/ChainRex/images/task7/cli_call.png differ diff --git a/mover/ChainRex/readme.md b/mover/ChainRex/readme.md index 9d79ffc3b..740581abf 100644 --- a/mover/ChainRex/readme.md +++ b/mover/ChainRex/readme.md @@ -58,8 +58,8 @@ ## 07 Move CTF Check In -- [] CLI call 截图 : ![截图](./images/你的图片地址) -- [] flag hash : +- [x] CLI call 截图 : ![截图](./images/task7/cli_call.png) +- [x] flag hash : 7AEMibphRNxX2kRj6y7fnr5eRwVQungSUmju9aeQzqvH ## 08 Move CTF Lets Move diff --git a/mover/001/notes/readme.md b/mover/Hy6ran/co-learn-2411/images/readme.md similarity index 100% rename from mover/001/notes/readme.md rename to mover/Hy6ran/co-learn-2411/images/readme.md diff --git a/mover/Hy6ran/co-learn-2411/project/readme.md b/mover/Hy6ran/co-learn-2411/project/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/Hy6ran/co-learn-2411/project/readme.md @@ -0,0 +1 @@ + diff --git a/mover/Hy6ran/co-learn-2411/readme.md b/mover/Hy6ran/co-learn-2411/readme.md new file mode 100644 index 000000000..9b3eccb1d --- /dev/null +++ b/mover/Hy6ran/co-learn-2411/readme.md @@ -0,0 +1,54 @@ +# 这个模板是2024年11月份的共学营才需要的 + +## b站,推特关注 + +- [] b站,推特关注截图: ![关注截图](./images/你的图片地址) + +## 为共学营宣传(在朋友圈或者群聊中转发海报/文章) + +- [] 宣传截图:![宣传截图](./images/你的图片地址) + +## 每周课程学习 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 参加直播答疑 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 群里分享学习笔记 + +- [] 第一篇笔记 +- [] 第二篇笔记 +- [] 第三篇笔记 +- [] 第四篇笔记 + +## 对外输出学习笔记 + +- [] 第一篇笔记【学习笔记链接】 +- [] 第二篇笔记【学习笔记链接】 +- [] 第三篇笔记【学习笔记链接】 +- [] 第四篇笔记【学习笔记链接】 + +## 在HOH社区公众号发布自己的技术文章 + +- [] 第一篇笔记【公众号文章链接】 +- [] 第二篇笔记【公众号文章链接】 +- [] 第三篇笔记【公众号文章链接】 +- [] 第四篇笔记【公众号文章链接】 + +## 直播分享学习技巧/工具推荐 + +- [] 会议截图:![会议记录截图](./images/你的图片地址) + +## 提交项目 + +- [] 项目提交![项目截图](./images/你的图片地址) + + diff --git a/mover/Hy6ran/code/images/img.png b/mover/Hy6ran/code/images/img.png new file mode 100644 index 000000000..af5866f4d Binary files /dev/null and b/mover/Hy6ran/code/images/img.png differ diff --git a/mover/Hy6ran/code/images/wallet.jpg b/mover/Hy6ran/code/images/wallet.jpg new file mode 100644 index 000000000..a697a2eed Binary files /dev/null and b/mover/Hy6ran/code/images/wallet.jpg differ diff --git a/mover/Hy6ran/code/readme.md b/mover/Hy6ran/code/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/Hy6ran/code/task1/hellomove/Move.toml b/mover/Hy6ran/code/task1/hellomove/Move.toml new file mode 100644 index 000000000..be65a17c8 --- /dev/null +++ b/mover/Hy6ran/code/task1/hellomove/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hellomove" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +hellomove = "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/Hy6ran/code/task1/hellomove/sources/hellomove.move b/mover/Hy6ran/code/task1/hellomove/sources/hellomove.move new file mode 100644 index 000000000..17f067f11 --- /dev/null +++ b/mover/Hy6ran/code/task1/hellomove/sources/hellomove.move @@ -0,0 +1,19 @@ +module hellomove::hello ; + +use std::ascii::{String, string}; +use sui::object::{Self, UID}; +use sui::transfer::transfer; +use sui::tx_context::{TxContext, sender}; + +public struct Hello has key { + id: UID, + say: String +} + +fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id: object::new(ctx), + say: string(b"Hy6ran"), + }; + transfer(hello_move, sender(ctx)); +} \ No newline at end of file diff --git a/mover/Hy6ran/code/task1/hellomove/tests/hellomove_tests.move b/mover/Hy6ran/code/task1/hellomove/tests/hellomove_tests.move new file mode 100644 index 000000000..3f6ec59dc --- /dev/null +++ b/mover/Hy6ran/code/task1/hellomove/tests/hellomove_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hellomove::hellomove_tests; +// uncomment this line to import the module +// use hellomove::hellomove; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hellomove() { + // pass +} + +#[test, expected_failure(abort_code = ::hellomove::hellomove_tests::ENotImplemented)] +fun test_hellomove_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/Hy6ran/notes/readme.md b/mover/Hy6ran/notes/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/Hy6ran/readme.md b/mover/Hy6ran/readme.md new file mode 100644 index 000000000..1fb05a11e --- /dev/null +++ b/mover/Hy6ran/readme.md @@ -0,0 +1,54 @@ +## 基本信息 +- Sui钱包地址: `0xcbf230b1e6358f62d50161f3a3df253868e7ccab3a728b8548448e5464492df6` +> 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址 +- github: `Hy6ran` + +## 个人简介 +- 工作经验: x年 +- 技术栈: `Rust` `C++` +> 重要提示 请认真写自己的简介 +- 多年web2开发经验,对Move特别感兴趣,想通过Move入门区块链 +- 联系方式: tg: `xxx` + +## 任务 + +## 01 hello move +- [√] Sui cli version: sui 1.37.1-7839b9501066 +- [√] Sui钱包截图: ![Sui钱包截图](./images/wallet.jpg) +- [√] package id: 0x18e58d1f9a4c64f0cff9c2186123fdcf718b0f78d8cdf277bb36f4c158425f6c +- [√] package id 在 scan上的查看截图:![Scan截图](./images/img.png) + +## 02 move coin +- [] My Coin package id : +- [] Faucet package id : +- [] 转账 `My Coin` hash: +- [] `Faucet Coin` address1 mint hash: +- [] `Faucet Coin` address2 mint hash: + +## 03 move NFT +- [] nft package id : +- [] nft object id : +- [] 转账 nft hash: +- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) + +## 04 Move Game +- [] game package id : +- [] deposit Coin hash: +- [] withdraw `Coin` hash: +- [] play game hash: + +## 05 Move Swap +- [] swap package id : +- [] call swap CoinA-> CoinB hash : +- [] call swap CoinB-> CoinA hash : + +## 06 Dapp-kit SDK PTB +- [] save hash : + +## 07 Move CTF Check In +- [] CLI call 截图 : ![截图](./images/你的图片地址) +- [] flag hash : + +## 08 Move CTF Lets Move +- [] proof : +- [] flag hash : diff --git a/mover/Hy6ran/scan/readme.md b/mover/Hy6ran/scan/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/Hy6ran/scan/readme.md @@ -0,0 +1 @@ + diff --git a/mover/LeonDev1024/co-learn-2411/readme.md b/mover/LeonDev1024/co-learn-2411/readme.md index eac2df571..889a8819f 100644 --- a/mover/LeonDev1024/co-learn-2411/readme.md +++ b/mover/LeonDev1024/co-learn-2411/readme.md @@ -24,14 +24,14 @@ ## 群里分享学习笔记 -- [] 第一篇笔记 +- [x] [第一篇笔记](../notes/task4/readme.md) - [] 第二篇笔记 - [] 第三篇笔记 - [] 第四篇笔记 ## 对外输出学习笔记 -- [] 第一篇笔记【学习笔记链接】 +- [x] 第一篇笔记【https://learnblockchain.cn/article/9899】 - [] 第二篇笔记【学习笔记链接】 - [] 第三篇笔记【学习笔记链接】 - [] 第四篇笔记【学习笔记链接】 diff --git a/mover/LeonDev1024/code/task4/move_game/Move.lock b/mover/LeonDev1024/code/task4/move_game/Move.lock new file mode 100644 index 000000000..2ae8d729f --- /dev/null +++ b/mover/LeonDev1024/code/task4/move_game/Move.lock @@ -0,0 +1,43 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "E37A6DED4CE1F7ADC847C4433681F6E706899D69F7D809737861BEE2E6A74A8C" +deps_digest = "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600" +dependencies = [ + { id = "Sui", name = "Sui" }, + { id = "faucet_coin", name = "faucet_coin" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[[move.package]] +id = "faucet_coin" +source = { local = "..\\faucet_coin" } + +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[move.toolchain-version] +compiler-version = "1.37.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0x1bd47788320409d493dacf5c55fccca592b4cbde9012e3cdcd4ace2b3489a48e" +latest-published-id = "0x1bd47788320409d493dacf5c55fccca592b4cbde9012e3cdcd4ace2b3489a48e" +published-version = "1" diff --git a/mover/LeonDev1024/code/task4/move_game/Move.toml b/mover/LeonDev1024/code/task4/move_game/Move.toml new file mode 100644 index 000000000..b265336c6 --- /dev/null +++ b/mover/LeonDev1024/code/task4/move_game/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "move_game" +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/testnet" } +faucet_coin = { local = "../faucet_coin" } +# 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] +move_game = "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/LeonDev1024/code/task4/move_game/sources/move_game.move b/mover/LeonDev1024/code/task4/move_game/sources/move_game.move new file mode 100644 index 000000000..de6ce748c --- /dev/null +++ b/mover/LeonDev1024/code/task4/move_game/sources/move_game.move @@ -0,0 +1,90 @@ +/* +/// Module: move_game +module move_game::move_game; +*/ +module move_game::flip_coin { + + use sui::balance; + use sui::balance::Balance; + use sui::coin; + use sui::coin::{Coin, from_balance, into_balance}; + use sui::object; + use sui::random; + use sui::random::Random; + use sui::transfer::{share_object, transfer, public_transfer}; + use sui::tx_context::sender; + use faucet_coin::leon_dev_1024_faucet_coin::{LEON_DEV_1024_FAUCET_COIN}; + + public struct Game has key { + id: UID, + val: Balance + } + + + public struct AdminCap has key { + id: UID, + } + + + fun init(ctx: &mut TxContext) { + let game = Game { + id: object::new(ctx), + val: balance::zero() + }; + share_object(game); + + let admin = AdminCap { + id: object::new(ctx) + }; + + transfer(admin, sender(ctx)); + } + + + entry fun play(game: &mut Game, flip_value: bool, in: Coin, rand: &Random, + ctx: &mut TxContext) { + let coin_value = coin::value(&in); + + let play_address = sender(ctx); + let game_val = balance::value(&game.val) ; + + if (game_val < coin_value) { + abort 100u64; + }; + + //防止 all in 战神 + //每次最大值 就是合约里面钱的10分之一就行了 + if (coin_value > game_val / 10) { + abort 101u64; + }; + + let mut gen = random::new_generator(rand, ctx); + + let mut flag = random::generate_bool(&mut gen); + + if (flip_value == flag) { + let win_balance = balance::split(&mut game.val, coin_value); + let win_coin = from_balance(win_balance, ctx); + public_transfer(win_coin, play_address); + public_transfer(in, play_address); + }else { + let in_balance = into_balance(in); + balance::join(&mut game.val, in_balance); + } + } + + + // 存钱 + public entry fun add_sui(game: &mut Game, in: Coin, _ctx: &TxContext) { + let in_balance = into_balance(in); + balance::join(&mut game.val, in_balance); + } + + // 取钱 + public entry fun remove_sui(_: &AdminCap, game: &mut Game, + amt: u64, ctx: &mut TxContext) { + let win_balance = balance::split(&mut game.val, amt); + let win_coin = from_balance(win_balance, ctx); + public_transfer(win_coin, sender(ctx)); + } +} diff --git a/mover/LeonDev1024/code/task4/move_game/tests/move_game_tests.move b/mover/LeonDev1024/code/task4/move_game/tests/move_game_tests.move new file mode 100644 index 000000000..c5ca6e5e8 --- /dev/null +++ b/mover/LeonDev1024/code/task4/move_game/tests/move_game_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module move_game::move_game_tests; +// uncomment this line to import the module +// use move_game::move_game; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_move_game() { + // pass +} + +#[test, expected_failure(abort_code = ::move_game::move_game_tests::ENotImplemented)] +fun test_move_game_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/LeonDev1024/notes/task4/asserts/flap_coin.png b/mover/LeonDev1024/notes/task4/asserts/flap_coin.png new file mode 100644 index 000000000..ab0d94d3d Binary files /dev/null and b/mover/LeonDev1024/notes/task4/asserts/flap_coin.png differ diff --git a/mover/LeonDev1024/notes/task4/asserts/image 1.png b/mover/LeonDev1024/notes/task4/asserts/image 1.png new file mode 100644 index 000000000..ef4895da9 Binary files /dev/null and b/mover/LeonDev1024/notes/task4/asserts/image 1.png differ diff --git a/mover/LeonDev1024/notes/task4/asserts/image 2.png b/mover/LeonDev1024/notes/task4/asserts/image 2.png new file mode 100644 index 000000000..dc7414107 Binary files /dev/null and b/mover/LeonDev1024/notes/task4/asserts/image 2.png differ diff --git a/mover/LeonDev1024/notes/task4/asserts/image 3.png b/mover/LeonDev1024/notes/task4/asserts/image 3.png new file mode 100644 index 000000000..24db6d3e0 Binary files /dev/null and b/mover/LeonDev1024/notes/task4/asserts/image 3.png differ diff --git a/mover/LeonDev1024/notes/task4/asserts/image 4.png b/mover/LeonDev1024/notes/task4/asserts/image 4.png new file mode 100644 index 000000000..5a58aae47 Binary files /dev/null and b/mover/LeonDev1024/notes/task4/asserts/image 4.png differ diff --git a/mover/LeonDev1024/notes/task4/asserts/image 5.png b/mover/LeonDev1024/notes/task4/asserts/image 5.png new file mode 100644 index 000000000..1b4300e21 Binary files /dev/null and b/mover/LeonDev1024/notes/task4/asserts/image 5.png differ diff --git a/mover/LeonDev1024/notes/task4/asserts/image.png b/mover/LeonDev1024/notes/task4/asserts/image.png new file mode 100644 index 000000000..cd01f4376 Binary files /dev/null and b/mover/LeonDev1024/notes/task4/asserts/image.png differ diff --git a/mover/LeonDev1024/notes/task4/readme.md b/mover/LeonDev1024/notes/task4/readme.md new file mode 100644 index 000000000..722566d20 --- /dev/null +++ b/mover/LeonDev1024/notes/task4/readme.md @@ -0,0 +1,329 @@ +# 04. move_game + +# **完成游戏的上链部署** + +- 上链网络: 主网(mainnet) + +# **需求** + +- 完成 链游相关知识的学习 +- 完成 随机数的学习,游戏必须包含随机数 +- 完成 存和取游戏资金池 +- 完成 如何存储Coin在合约的学习,游戏必须能存取[task2] 发行的`Faucet Coin`,用`task2`的 `Faucet Coin`作为游戏输赢的资产 +- 完成 第一个游戏合约部署主网 +- 的game 必须包含自己的 `github id`的元素 + +# 链游基本知识 + +## **一、链游的定义与基本概念** + +- **定义**:链游,即区块链游戏,是将游戏与区块链技术相结合的产物。它利用区块链的分布式账本、加密算法、智能合约等特性,为游戏带来全新的玩法、经济模式和所有权机制等。 +- **核心要素**: + - **区块链底层技术**:提供去中心化的账本记录,确保游戏数据的透明性、不可篡改和安全性。比如以太坊、波场等区块链平台常被用作链游的底层支撑。 + - **智能合约**:自动执行合约条款的计算机程序,在链游中用于处理游戏规则、资产交易、奖励分配等诸多事宜。例如在一款加密宠物养成游戏中,智能合约可以规定宠物繁殖的规则以及新宠物的归属等。 + - **加密货币与通证**:作为游戏内的经济媒介,玩家可通过游戏活动获取,也用于购买游戏道具、升级等。不同链游有自己的原生通证,像 Axie Infinity 中的 AXS 和 SLP。 + +## **二、链游的特点** + +- **资产所有权归玩家**:游戏内的虚拟资产(如角色、道具、土地等)以区块链上的通证形式存在,玩家真正拥有这些资产的所有权,可自由交易、转移,甚至跨游戏使用,不像传统游戏中玩家只是获得游戏厂商授予的使用权限。 +- **去中心化运营**:游戏的部分或全部运营环节由区块链网络的节点共同参与完成,减少了对单一游戏厂商的依赖。例如游戏更新、规则调整等可能通过社区投票等去中心化方式进行。 +- **透明且可审计的经济系统**:基于区块链的账本记录,游戏内的经济活动一目了然,每一笔交易、资产的产生和流转都清晰可查,能有效防止游戏厂商随意增发货币、操纵经济等情况。 + +## **三、链游的常见类型** + +- **收藏养成类**:如 Axie Infinity,玩家收集、培养虚拟宠物,通过战斗、繁殖等活动获取收益。这类游戏注重宠物的属性成长和稀有度,玩家之间可交易宠物及相关繁殖材料。 +- **角色扮演类**:结合区块链技术的传统角色扮演游戏,玩家的角色属性、装备等以区块链资产形式存在。例如 My Crypto Heroes,玩家在游戏世界中冒险,升级角色并通过完成任务等方式获取奖励通证。 +- **策略竞技类**:像 League of Kingdoms,玩家需要运用策略规划领地、组建军队,与其他玩家进行竞技对抗,胜利可获得游戏通证奖励,游戏中的领土、资源等也是可交易的区块链资产。 +- **模拟经营类**:例如 Crypto Tycoon,玩家经营虚拟企业或地产,通过合理运营产生收益,收益可以通证形式体现,且经营的资产可在市场上交易。 + +## **四、链游的发展历程** + +- **萌芽期(2013 - 2017 年)**:这一时期区块链技术逐渐兴起,一些简单的区块链游戏开始出现,主要是以比特币等加密货币为基础的简单博彩或挖矿类游戏,游戏性不强,但开启了链游的探索之路。 +- **成长期(2018 - 2021 年)**:以太坊等智能合约平台的发展推动了链游的快速成长。Axie Infinity 等具有一定游戏性和经济模型的链游受到广泛关注,吸引了大量玩家和投资者,链游行业开始形成规模。 +- **调整期(2022 - 至今)**:随着加密货币市场的波动以及监管环境的变化,链游行业也进入了调整阶段。一些粗制滥造、过度依赖炒作的链游逐渐被淘汰,而注重游戏品质、合规运营的链游仍在持续发展。 + +## **五、链游的优势与挑战** + +- **优势**: + - **创新的经济模式**:为玩家提供了新的赚钱途径,通过玩游戏可以获得有实际价值的通证,在一些发展中国家甚至催生了 “边玩边赚”(Play-to-Earn)的现象,帮助部分玩家改善了经济状况。 + - **玩家社区驱动**:去中心化的特性使得玩家在游戏发展、规则制定等方面有更多话语权,能形成更活跃、自主的玩家社区,推动游戏不断优化。 + - **跨游戏资产流通**:理论上,玩家的区块链资产可以在不同链游之间流通,增加了资产的附加值和使用场景。 +- **挑战**: + - **技术门槛**:区块链技术本身较为复杂,开发链游需要掌握区块链编程、智能合约开发等专业知识,导致开发成本较高、开发周期较长。 + - **用户体验**:部分链游由于过于注重区块链技术的应用,而忽视了游戏的基本体验,如画面质量、操作流畅性等,导致用户流失。 + - **监管不确定性**:目前全球范围内对链游的监管政策尚不明确,不同国家和地区有不同的态度和规定,这给链游的发展带来了一定的风险。 + +# 简单的翻硬币游戏 + +主要功能包括: +初始化:创建游戏对象和管理员权限对象,并将管理员权限对象转移给发送者。 +玩游戏:玩家通过猜测硬币的正反面来参与游戏,根据结果赢得或失去 SUI 币。 +添加 SUI:允许玩家向游戏中添加 SUI 币。 +移除 SUI:允许管理员从游戏中移除 SUI 币。 + +CFG流程图 + +![flap_coin.png](./asserts/flap_coin.png) + +## 1. 初始化源码解析 + +```rust +/// 定义游戏对象 +public struct Game has key { + id: UID, + val: Balance +} +/// 定义管理员权限对象 +public struct AdminCap has key { + id: UID, +} +/// 创建游戏对象和管理员权限对象,并将管理员权限对象转移给发送者。 +fun init(ctx: &mut TxContext) { + let game = Game { + id: object::new(ctx), + val: balance::zero() + }; + share_object(game); + + let admin = AdminCap { + id: object::new(ctx) + }; + transfer(admin, sender(ctx)); +} +``` + +## 2. 玩游戏源码解析 + +```rust +entry fun play(game: &mut Game, flip_value: bool, in: Coin, rand: &Random, + ctx: &mut TxContext) { + let coin_value = coin::value(&in); + + let play_address = sender(ctx); + let game_val = balance::value(&game.val) ; + /// 检查游戏余额是否足够。 + if (game_val < coin_value) { + abort 100u64; + }; + + let mut gen = random::new_generator(rand, ctx); + /// 生成随机布尔值。 + let mut flag = random::generate_bool(&mut gen); + + if (flip_value == flag) { + /// 如果玩家猜对了,将相应的余额转移给玩家。 + let win_balance = balance::split(&mut game.val, coin_value); + let win_coin = from_balance(win_balance, ctx); + public_transfer(win_coin, play_address); + public_transfer(in, play_address); + } else { + /// 否则,将玩家的投注金额加入游戏余额。 + let in_balance = into_balance(in); + balance::join(&mut game.val, in_balance); + } +} +``` + +## 3. 添加 SUI源码 + +```rust +public entry fun add_sui(game: &mut Game, in: Coin, _ctx: &TxContext) { + let in_balance = into_balance(in); + balance::join(&mut game.val, in_balance); +} +``` + +## 4. 移除 SUI源码 + +```rust +public entry fun remove_sui(_: &AdminCap, game: &mut Game, + amt: u64, ctx: &mut TxContext) { + let win_balance = balance::split(&mut game.val, amt); + let win_coin = from_balance(win_balance, ctx); + public_transfer(win_coin, sender(ctx)); +} +``` + +例子里面留了两个todo, + +1. **防止 all in 战神** + +```rust +/// 防止 all in 战神 +if (coin_value == game_val) { + abort(ERROR_EXCEED_MAX_BET); +}; + +``` + +1. **每次最大值 就是合约里面钱的10分之一** + +```rust +/// 这个限制住了自然也不存在ALLIN了 +if (coin_value > game_val / 10) { + abort 101u64; +} + +``` + +## 5. TASK操作步骤 + +### 5.1. 代码 + +```bash +/* +/// Module: move_game +module move_game::move_game; +*/ +module move_game::flip_coin { + + use sui::balance; + use sui::balance::Balance; + use sui::coin; + use sui::coin::{Coin, from_balance, into_balance}; + use sui::object; + use sui::random; + use sui::random::Random; + use sui::transfer::{share_object, transfer, public_transfer}; + use sui::tx_context::sender; + use faucet_coin::leon_dev_1024_faucet_coin::{LEON_DEV_1024_FAUCET_COIN}; + + public struct Game has key { + id: UID, + val: Balance + } + public struct AdminCap has key { + id: UID, + } + fun init(ctx: &mut TxContext) { + let game = Game { + id: object::new(ctx), + val: balance::zero() + }; + share_object(game); + + let admin = AdminCap { + id: object::new(ctx) + }; + + transfer(admin, sender(ctx)); + } + + entry fun play(game: &mut Game, flip_value: bool, in: Coin, rand: &Random, + ctx: &mut TxContext) { + let coin_value = coin::value(&in); + + let play_address = sender(ctx); + let game_val = balance::value(&game.val) ; + + if (game_val < coin_value) { + abort 100u64; + }; + + //防止 all in 战神 + //每次最大值 就是合约里面钱的10分之一就行了 + if (coin_value > game_val / 10) { + abort 101u64; + }; + + let mut gen = random::new_generator(rand, ctx); + + let mut flag = random::generate_bool(&mut gen); + + if (flip_value == flag) { + let win_balance = balance::split(&mut game.val, coin_value); + let win_coin = from_balance(win_balance, ctx); + public_transfer(win_coin, play_address); + public_transfer(in, play_address); + }else { + let in_balance = into_balance(in); + balance::join(&mut game.val, in_balance); + } + } + + // 存钱 + public entry fun add_sui(game: &mut Game, in: Coin, _ctx: &TxContext) { + let in_balance = into_balance(in); + balance::join(&mut game.val, in_balance); + } + + // 取钱 + public entry fun remove_sui(_: &AdminCap, game: &mut Game, + amt: u64, ctx: &mut TxContext) { + let win_balance = balance::split(&mut game.val, amt); + let win_coin = from_balance(win_balance, ctx); + public_transfer(win_coin, sender(ctx)); + } +} + +``` + +### 5.2. 部署 + +修改Move.toml文件,添加之前的`faucet_coin` + +![image.png](./asserts/image.png) + +```rust +sui move build --skip-fetch-latest-git-deps +``` + +### 5.3. 发布到主网 + +当前环境查看和网络环境切换参考之前的命令 + +```rust +sui client envs +sui client switch --env mainnet +sui client publish --gas-budget 100000000 --skip-fetch-latest-git-deps --skip-dependency-verification +``` + +发布成功后的交易摘要 + +```bash +Skipping dependency verification +Transaction Digest: 2kBk7UGLLrAodgVkxfmoaCh4SvQxHMuqYKKkWd8dyZeL +``` + +## 6. 测试验证 + +### 6.1 充值 + +![image.png](./asserts/image%201.png) + +### 3.2 玩游戏 play + +```bash +sui client call --package 0x1bd47788320409d493dacf5c55fccca592b4cbde9012e3cdcd4ace2b3489a48e --module flip_coin --function play --args 0xa16a5c2a95a4d9fa151dd7faf44e160bc0f1c4ef12b6fc628c3c9cd1895a0da1 true 0xafcdeac741cb1b84d72d7ac8fbb851ce81089e187f8ead34b81a6f0b544cbb59 0x8 --gas-budget 1000000 +``` + +### 3.3 提现 方法`remove_sui` + +提现参数说明, + +- **`AdminCap`**:确保只有管理员可以调用这个函数。 +- **`Game`**:用于访问和修改游戏的状态。 +- **`amt`**:指定要取出的金额。 +- **`TxContext`**:提供交易上下文信息,用于创建 `Coin` 对象和获取发送者的地址。 + +![image.png](./asserts/image%202.png) + +```bash +sui client call --package 0x1bd47788320409d493dacf5c55fccca592b4cbde9012e3cdcd4ace2b3489a48e --module flip_coin --function remove_sui --args 0xda2dc3c6cc563fb9b3d0a1050bbb237da0949014a7ca38de1fb16a62664c55cc 0xa16a5c2a95a4d9fa151dd7faf44e160bc0f1c4ef12b6fc628c3c9cd1895a0da1 100 --gas-budget 10000000 +``` + +## FAQ + +Q1: 直接钱包浏览器页面play 报错, **Expect true to be boolean, received string** + +A:提现报错,这边用Bash命令操作,注意参数的顺序,Random的object id为0x8 + +![image.png](./asserts/image%203.png) + +![image.png](./asserts/image%204.png) + +Q2: 提现报错 Error executing transaction 'DWtg68kXBTVoHYHgRxXbTbE2ckQx9zeLQPnGDnJ6H6UA': InsufficientGas + +A. 提现消耗的Gas手续费比较多,增加gas费用,最后提现成功 + +![image.png](./asserts/image%205.png) \ No newline at end of file diff --git a/mover/LeonDev1024/readme.md b/mover/LeonDev1024/readme.md index a3ecadd38..8e7285775 100644 --- a/mover/LeonDev1024/readme.md +++ b/mover/LeonDev1024/readme.md @@ -30,10 +30,10 @@ - [x] scan上的NFT截图:![Scan截图](./images/nft_scan.png) ## 04 Move Game -- [] game package id : -- [] deposit Coin hash: -- [] withdraw `Coin` hash: -- [] play game hash: +- [x] game package id : 0x1bd47788320409d493dacf5c55fccca592b4cbde9012e3cdcd4ace2b3489a48e +- [x] deposit Coin hash: BbDzt6eftcdqK72Z1yoicVTfbgkASCiCm9ggPee1TsKo +- [x] withdraw `Coin` hash: 8XsJFj9U2so3vnnyqdbgjrskXHZkEEMSo41iqD6pmvFe +- [x] play game hash: FD42jvTYqq59CUrMyDC4dLYBc8WvXdC5tjdjQ6XqFryE ## 05 Move Swap - [] swap package id : diff --git a/mover/Tornoto/code/task2/custom_coin/Move.toml b/mover/Tornoto/code/task2/custom_coin/Move.toml new file mode 100644 index 000000000..487e08c81 --- /dev/null +++ b/mover/Tornoto/code/task2/custom_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "custom_coin" +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/testnet" } + +# 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] +custom_coin = "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/Tornoto/code/task2/custom_coin/sources/faucet_coin.move b/mover/Tornoto/code/task2/custom_coin/sources/faucet_coin.move new file mode 100644 index 000000000..54165c261 --- /dev/null +++ b/mover/Tornoto/code/task2/custom_coin/sources/faucet_coin.move @@ -0,0 +1,25 @@ +module custom_coin::faucet_coin; +use custom_coin::MY_COIN::MY_COIN; +use sui::coin::TreasuryCap; + +// MY_COIN 的 decimal 是 6,每次给 1 个 +const FAUCET_AMOUNT: u64 = 1_000_000; + +public struct Faucet has key { + id: UID, + treasury_cap: TreasuryCap, +} + +public entry +fun create_faucet(treasury_cap: TreasuryCap, ctx: &mut TxContext) { + let faucet = Faucet { + id: object::new(ctx), + treasury_cap, + }; + transfer::share_object(faucet); +} + +public entry +fun request_coin(faucet: &mut Faucet, recipient: address, ctx: &mut TxContext) { + custom_coin::MY_COIN::mint(&mut faucet.treasury_cap, FAUCET_AMOUNT, recipient, ctx); +} \ No newline at end of file diff --git a/mover/Tornoto/code/task2/custom_coin/sources/my_coin.move b/mover/Tornoto/code/task2/custom_coin/sources/my_coin.move new file mode 100644 index 000000000..63e1457ef --- /dev/null +++ b/mover/Tornoto/code/task2/custom_coin/sources/my_coin.move @@ -0,0 +1,28 @@ +/// Module: custom_coin +module custom_coin::MY_COIN; +use sui::coin; +use sui::coin::TreasuryCap; + +public struct MY_COIN has drop {} + +fun init(witness: MY_COIN, ctx: &mut TxContext) { + let (treasury_cap, coin_metadata) = coin::create_currency( + witness, + 6, + b"Fc", + b"fish_coin", + b"you fish, your fish", + option::none(), + ctx + ); + transfer::public_transfer(treasury_cap, tx_context::sender(ctx)); + transfer::public_freeze_object(coin_metadata); +} + +public +fun mint(treasury_cap: &mut TreasuryCap, + amount: u64, + recipient: address, + ctx: &mut TxContext) { + coin::mint_and_transfer(treasury_cap, amount, recipient, ctx); +} diff --git a/mover/Tornoto/readme.md b/mover/Tornoto/readme.md index f68898188..bf65de0cc 100644 --- a/mover/Tornoto/readme.md +++ b/mover/Tornoto/readme.md @@ -23,11 +23,11 @@ ## 02 move coin -- [] My Coin package id : -- [] Faucet package id : -- [] 转账 `My Coin` hash: -- [] `Faucet Coin` address1 mint hash: -- [] `Faucet Coin` address2 mint hash: +- [x] My Coin package id :0xfcae7534403e4e6c0899c1a85864af7a3016e1c55fa681e223a74f5d23ee2fbc +- [x] Faucet package id :0xfcae7534403e4e6c0899c1a85864af7a3016e1c55fa681e223a74f5d23ee2fbc +- [x] 转账 `My Coin` hash:2VTNQ2ZWsgsnQid5ks7DBEorkxJoaGBZFcdeoHRTgsX8 +- [x] `Faucet Coin` address1 mint hash:841BygAzkEFTGyHAiWq1dLH8gCGYbCcqWhnQgduDwMBx +- [x] `Faucet Coin` address2 mint hash:4YJ3xjdBHwGUFNLqANU6A7JGS7HyThfftm7wxfrcZSBf ## 03 move NFT diff --git a/mover/aimotee/code/task2/aimotee_coin/Move.toml b/mover/aimotee/code/task2/aimotee_coin/Move.toml new file mode 100644 index 000000000..7f8993d5c --- /dev/null +++ b/mover/aimotee/code/task2/aimotee_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "aimotee_coin" +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://github.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] +aimotee = "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/aimotee/code/task2/aimotee_coin/sources/aimotee_coin.move b/mover/aimotee/code/task2/aimotee_coin/sources/aimotee_coin.move new file mode 100644 index 000000000..88629c601 --- /dev/null +++ b/mover/aimotee/code/task2/aimotee_coin/sources/aimotee_coin.move @@ -0,0 +1,21 @@ +module aimotee::my_coin { + use sui::coin::{Self, TreasuryCap}; + + public struct MY_COIN has drop {} + + fun init(witness: MY_COIN, ctx: &mut TxContext) { + let (treasury, metadata) = coin::create_currency(witness, 6, b"Ai", b"Aimotee", b"a coin", option::none(), ctx); + transfer::public_freeze_object(metadata); + transfer::public_transfer(treasury, ctx.sender()) + } + + public fun mint( + treasury_cap: &mut TreasuryCap, + amount: u64, + recipient: address, + ctx: &mut TxContext, + ) { + let coin = coin::mint(treasury_cap, amount, ctx); + transfer::public_transfer(coin, recipient) + } +} \ No newline at end of file diff --git a/mover/aimotee/code/task2/aimotee_coin/tests/aimotee_coin_tests.move b/mover/aimotee/code/task2/aimotee_coin/tests/aimotee_coin_tests.move new file mode 100644 index 000000000..f592f7d43 --- /dev/null +++ b/mover/aimotee/code/task2/aimotee_coin/tests/aimotee_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module aimotee_coin::aimotee_coin_tests; +// uncomment this line to import the module +// use aimotee_coin::aimotee_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_aimotee_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::aimotee_coin::aimotee_coin_tests::ENotImplemented)] +fun test_aimotee_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/aimotee/code/task2/aimotee_faucet_coin/Move.toml b/mover/aimotee/code/task2/aimotee_faucet_coin/Move.toml new file mode 100644 index 000000000..f7e0067af --- /dev/null +++ b/mover/aimotee/code/task2/aimotee_faucet_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "aimotee_faucet_coin" +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://github.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] +aimotee_faucet_coin = "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/aimotee/code/task2/aimotee_faucet_coin/sources/aimotee_faucet_coin.move b/mover/aimotee/code/task2/aimotee_faucet_coin/sources/aimotee_faucet_coin.move new file mode 100644 index 000000000..d9f468c05 --- /dev/null +++ b/mover/aimotee/code/task2/aimotee_faucet_coin/sources/aimotee_faucet_coin.move @@ -0,0 +1,22 @@ +module aimotee_faucet_coin::my_coin { + use sui::coin::{Self, TreasuryCap}; + + public struct MY_COIN has drop {} + + fun init(witness: MY_COIN, ctx: &mut TxContext) { + let (treasury, metadata) = coin::create_currency(witness, 6, b"Ai", b"Aimotee_faucet", b"a coin", option::none(), ctx); + transfer::public_freeze_object(metadata); + transfer::public_share_object(treasury) + } + + public fun mint( + treasury_cap: &mut TreasuryCap, + amount: u64, + recipient: address, + ctx: &mut TxContext, + ) { + let coin = coin::mint(treasury_cap, amount, ctx); + transfer::public_transfer(coin, recipient) + } +} +0x2::coin::TreasuryCap<0xab2b02345d11f7ee492a0c20eb943c497d76e7461c13299a6ed5ddd37b55d4eb::my_coin::MY_COIN> \ No newline at end of file diff --git a/mover/aimotee/code/task2/aimotee_faucet_coin/tests/aimotee_faucet_coin_tests.move b/mover/aimotee/code/task2/aimotee_faucet_coin/tests/aimotee_faucet_coin_tests.move new file mode 100644 index 000000000..316ff1ca0 --- /dev/null +++ b/mover/aimotee/code/task2/aimotee_faucet_coin/tests/aimotee_faucet_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module aimotee_faucet_coin::aimotee_faucet_coin_tests; +// uncomment this line to import the module +// use aimotee_faucet_coin::aimotee_faucet_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_aimotee_faucet_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::aimotee_faucet_coin::aimotee_faucet_coin_tests::ENotImplemented)] +fun test_aimotee_faucet_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/aimotee/readme.md b/mover/aimotee/readme.md index 6f06fb688..b0b07bb15 100644 --- a/mover/aimotee/readme.md +++ b/mover/aimotee/readme.md @@ -19,11 +19,11 @@ - [x] package id 在 scan上的查看截图:![Scan截图](./images/20241106-033537.png) ## 02 move coin -- [] My Coin package id : -- [] Faucet package id : -- [] 转账 `My Coin` hash: -- [] `Faucet Coin` address1 mint hash: -- [] `Faucet Coin` address2 mint hash: +- [x] My Coin package id : 0xca523fc35d04d2647aba43234665626c756d67785ab8f08f01ecc1b49d8a9562 +- [x] Faucet package id : 0xab2b02345d11f7ee492a0c20eb943c497d76e7461c13299a6ed5ddd37b55d4eb +- [x] 转账 `My Coin` hash: GfgbkWM6LwV6apGsCUNecejAAb445xyWCwPKxxc5c928 +- [x] `Faucet Coin` address1 mint hash:8GKv4WFub9krFafoJeermNqz9iWHoP6fMnYiLLDB24sm +- [x] `Faucet Coin` address2 mint hash:nESv3vMJeJv5168etPYXMUydbSM6fxqneikPmcPgKYP ## 03 move NFT - [] nft package id : diff --git a/mover/ddybhm/co-learn-2411/images/readme.md b/mover/ddybhm/co-learn-2411/images/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/ddybhm/co-learn-2411/images/task1-1.png b/mover/ddybhm/co-learn-2411/images/task1-1.png new file mode 100644 index 000000000..aa3608ff0 Binary files /dev/null and b/mover/ddybhm/co-learn-2411/images/task1-1.png differ diff --git a/mover/ddybhm/co-learn-2411/images/task1-2.png b/mover/ddybhm/co-learn-2411/images/task1-2.png new file mode 100644 index 000000000..ea79280e6 Binary files /dev/null and b/mover/ddybhm/co-learn-2411/images/task1-2.png differ diff --git a/mover/ddybhm/co-learn-2411/project/readme.md b/mover/ddybhm/co-learn-2411/project/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/ddybhm/co-learn-2411/project/readme.md @@ -0,0 +1 @@ + diff --git a/mover/ddybhm/co-learn-2411/readme.md b/mover/ddybhm/co-learn-2411/readme.md new file mode 100644 index 000000000..9b3eccb1d --- /dev/null +++ b/mover/ddybhm/co-learn-2411/readme.md @@ -0,0 +1,54 @@ +# 这个模板是2024年11月份的共学营才需要的 + +## b站,推特关注 + +- [] b站,推特关注截图: ![关注截图](./images/你的图片地址) + +## 为共学营宣传(在朋友圈或者群聊中转发海报/文章) + +- [] 宣传截图:![宣传截图](./images/你的图片地址) + +## 每周课程学习 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 参加直播答疑 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 群里分享学习笔记 + +- [] 第一篇笔记 +- [] 第二篇笔记 +- [] 第三篇笔记 +- [] 第四篇笔记 + +## 对外输出学习笔记 + +- [] 第一篇笔记【学习笔记链接】 +- [] 第二篇笔记【学习笔记链接】 +- [] 第三篇笔记【学习笔记链接】 +- [] 第四篇笔记【学习笔记链接】 + +## 在HOH社区公众号发布自己的技术文章 + +- [] 第一篇笔记【公众号文章链接】 +- [] 第二篇笔记【公众号文章链接】 +- [] 第三篇笔记【公众号文章链接】 +- [] 第四篇笔记【公众号文章链接】 + +## 直播分享学习技巧/工具推荐 + +- [] 会议截图:![会议记录截图](./images/你的图片地址) + +## 提交项目 + +- [] 项目提交![项目截图](./images/你的图片地址) + + diff --git a/mover/ddybhm/code/task1/Move.toml b/mover/ddybhm/code/task1/Move.toml new file mode 100644 index 000000000..2fd3b0f2a --- /dev/null +++ b/mover/ddybhm/code/task1/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hello_move" +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/testnet" } + +# 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] +hello_move = "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/ddybhm/code/task1/hello_move/Move.lock b/mover/ddybhm/code/task1/hello_move/Move.lock new file mode 100644 index 000000000..b3100346c --- /dev/null +++ b/mover/ddybhm/code/task1/hello_move/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "15C92DB7143AE506431E8FE14625189CE312456B12D01A47D7711D0BFBD6A124" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.36.2" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x71be873917426d654c41bdc45539057d4c98a3cdfe3b3da5bac2d23d5000506d" +latest-published-id = "0x71be873917426d654c41bdc45539057d4c98a3cdfe3b3da5bac2d23d5000506d" +published-version = "1" diff --git a/mover/ddybhm/code/task1/hello_move/Move.toml b/mover/ddybhm/code/task1/hello_move/Move.toml new file mode 100644 index 000000000..2fd3b0f2a --- /dev/null +++ b/mover/ddybhm/code/task1/hello_move/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hello_move" +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/testnet" } + +# 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] +hello_move = "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/ddybhm/code/task1/hello_move/sources/hello_move.move b/mover/ddybhm/code/task1/hello_move/sources/hello_move.move new file mode 100644 index 000000000..e8dca7f80 --- /dev/null +++ b/mover/ddybhm/code/task1/hello_move/sources/hello_move.move @@ -0,0 +1,21 @@ +module hello_move::hello { + use std::ascii::{String, string}; + use sui::object::{Self,UID}; + use sui::transfer::transfer; + use sui::tx_context::{TxContext, sender}; + + public struct Hello has key{ + id:UID, + say: String + } + + fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id:object::new(ctx), + say: string(b"ddybhm"), + }; + transfer(hello_move, sender(ctx)); + } +} + + diff --git a/mover/ddybhm/code/task1/hello_move/tests/hello_move_tests.move b/mover/ddybhm/code/task1/hello_move/tests/hello_move_tests.move new file mode 100644 index 000000000..7798d8dda --- /dev/null +++ b/mover/ddybhm/code/task1/hello_move/tests/hello_move_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hello_move::hello_move_tests; +// uncomment this line to import the module +// use hello_move::hello_move; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hello_move() { + // pass +} + +#[test, expected_failure(abort_code = ::hello_move::hello_move_tests::ENotImplemented)] +fun test_hello_move_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/ddybhm/notes/readme.md b/mover/ddybhm/notes/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/ddybhm/readme.md b/mover/ddybhm/readme.md new file mode 100644 index 000000000..694f44881 --- /dev/null +++ b/mover/ddybhm/readme.md @@ -0,0 +1,54 @@ +## 基本信息 +- Sui钱包地址: `0xfa9c575285d874e7ab35be6e344c8f3a8f27323f2c3ecde09a5e2b13ac0a1bd0` +> 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址 +- github: `ddybhm` + +## 个人简介 +- 工作经验: 0年 +- 技术栈: `Solidity` `C++` +> 重要提示 请认真写自己的简介 +- 目前为在校学生,对Move特别感兴趣,想通过Move入门区块链 +- 联系方式: WeChat: `观后感` + +## 任务 +[]() +## 01 hello move +- [X] Sui cli version:sui 1.36.2-3ada97c109cc +- [X] Sui钱包截图: ![Sui钱包截图](./co-learn-2411/images/task1-1.png) +- [X] package id: 0x71be873917426d654c41bdc45539057d4c98a3cdfe3b3da5bac2d23d5000506d +- [X] package id 在 scan上的查看截图:![Scan截图](./co-learn-2411/images/task1-2.png) + +## 02 move coin +- [] My Coin package id : +- [] Faucet package id : +- [] 转账 `My Coin` hash: +- [] `Faucet Coin` address1 mint hash: +- [] `Faucet Coin` address2 mint hash: + +## 03 move NFT +- [] nft package id : +- [] nft object id : +- [] 转账 nft hash: +- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) + +## 04 Move Game +- [] game package id : +- [] deposit Coin hash: +- [] withdraw `Coin` hash: +- [] play game hash: + +## 05 Move Swap +- [] swap package id : +- [] call swap CoinA-> CoinB hash : +- [] call swap CoinB-> CoinA hash : + +## 06 Dapp-kit SDK PTB +- [] save hash : + +## 07 Move CTF Check In +- [] CLI call 截图 : ![截图](./images/你的图片地址) +- [] flag hash : + +## 08 Move CTF Lets Move +- [] proof : +- [] flag hash : diff --git a/mover/ddybhm/scan/readme.md b/mover/ddybhm/scan/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/ddybhm/scan/readme.md @@ -0,0 +1 @@ + diff --git a/mover/gracecampo/co-learn-2411/readme.md b/mover/gracecampo/co-learn-2411/readme.md index e0d881c2c..c9d817cc4 100644 --- a/mover/gracecampo/co-learn-2411/readme.md +++ b/mover/gracecampo/co-learn-2411/readme.md @@ -24,8 +24,8 @@ ## 群里分享学习笔记 -- [] 第一篇笔记 -- [] 第二篇笔记 +- [√] 第一篇笔记 【https://learnblockchain.cn/article/9860】 +- [√] 第二篇笔记 【https://learnblockchain.cn/article/9878】 - [] 第三篇笔记 - [] 第四篇笔记 @@ -34,7 +34,8 @@ - [√] 第一篇笔记【https://blog.csdn.net/jinpeng741143592/article/details/143261589?spm=1001.2014.3001.5502】 - [√] 第二篇笔记【https://blog.csdn.net/jinpeng741143592/article/details/143251993?spm=1001.2014.3001.5502】 - [√] 第三篇笔记【https://blog.csdn.net/jinpeng741143592/article/details/143251799?spm=1001.2014.3001.5502】 -- [] 第四篇笔记【学习笔记链接】 +- [√] 第四篇笔记【https://learnblockchain.cn/article/9860】 +- [√] 第四篇笔记【https://learnblockchain.cn/article/9878】 ## 在HOH社区公众号发布自己的技术文章 diff --git a/mover/gracecampo/code/move_nft/movenft.move b/mover/gracecampo/code/move_nft/movenft.move new file mode 100644 index 000000000..d21a541ad --- /dev/null +++ b/mover/gracecampo/code/move_nft/movenft.move @@ -0,0 +1,95 @@ + +module movenft::gracecampo_nft { + use sui::url::{Self, Url}; + use std::string; + use sui::object::{Self, ID, UID}; + use sui::event; + use sui::transfer; + use sui::tx_context::{Self, TxContext}; + + public struct GRACECAMPO_NFT has store, key { + id: UID, + name: string::String, + description: string::String, + url: Url, + } + + public struct GRACECAMPO_NFT_Minted has copy, drop { + object_id: ID, + creator: address, + name: string::String, + } + public fun name(nft: &GRACECAMPO_NFT) : &string::String { + &nft.name + } + public fun description(nft: &GRACECAMPO_NFT): &string::String { + &nft.description + } + + public fun url(nft: &GRACECAMPO_NFT): &Url { + &nft.url + } + + public entry fun mint_to_sender( + name: vector, + description: vector, + url: vector, + ctx: &mut TxContext + ) { + let sender = tx_context::sender(ctx); + let nft = GRACECAMPO_NFT { + id: object::new(ctx), + name: string::utf8(name), + description: string::utf8(description), + url: url::new_unsafe_from_bytes(url), + }; + + event::emit(GRACECAMPO_NFT_Minted { + object_id: object::id(&nft), + creator: sender, + name: nft.name, + }); + + transfer::public_transfer(nft, sender); + } + public entry fun mint_to_public( + name: vector, + description: vector, + url: vector, + recipient: address, + ctx: &mut TxContext + ) { + let nft = GRACECAMPO_NFT { + id: object::new(ctx), + name: string::utf8(name), + description: string::utf8(description), + url: url::new_unsafe_from_bytes(url), + }; + + event::emit(GRACECAMPO_NFT_Minted { + object_id: object::id(&nft), + creator: recipient, + name: nft.name, + }); + + transfer::public_transfer(nft, recipient); + } + public entry fun transfer( + nft: GRACECAMPO_NFT, recipient: address, _: &mut TxContext + ) { + transfer::public_transfer(nft, recipient) + } + public entry fun update_description( + nft: &mut GRACECAMPO_NFT, + new_description: vector, + _: &mut TxContext + ) { + nft.description = string::utf8(new_description) + } + public entry fun burn(nft: GRACECAMPO_NFT, _: &mut TxContext) { + let GRACECAMPO_NFT { id, name: _, description: _, url: _ } = nft; + object::delete(id) + } + +} + diff --git a/mover/gracecampo/notes/readme.md b/mover/gracecampo/notes/readme.md index c1b6a52f9..106465eb5 100644 --- a/mover/gracecampo/notes/readme.md +++ b/mover/gracecampo/notes/readme.md @@ -1,12 +1,13 @@ -笔记导航: +# 笔记导航: -move基础: +## move基础: -环境安装 +## 环境安装 +安装sui客户端: https://learnblockchain.cn/article/9860 -语法教程 +## 语法教程 -工具使用 +## 工具使用 任务教程: diff --git "a/mover/gracecampo/notes/\344\273\273\345\212\241\346\225\231\347\250\213/task3\346\225\231\347\250\213.md" "b/mover/gracecampo/notes/\344\273\273\345\212\241\346\225\231\347\250\213/task3\346\225\231\347\250\213.md" new file mode 100644 index 000000000..fdd51aa4b --- /dev/null +++ "b/mover/gracecampo/notes/\344\273\273\345\212\241\346\225\231\347\250\213/task3\346\225\231\347\250\213.md" @@ -0,0 +1,97 @@ +# MOVE共学营TASK3教程 +💧  [HOH水分子公众号](https://mp.weixin.qq.com/s/d0brr-ao6cZ5t8Z5OO1Mog) + +🌊  [HOH水分子X账号](https://x.com/0xHOH) + +📹  [课程B站账号](https://space.bilibili.com/3493269495352098) + +💻  Github仓库 https://github.com/move-cn/letsmove + +🧑‍💻作者:gracecampo + +## MOVE共学营中的TASK3教程 +### 1. 代码部分 +> 定义NFT结构体 +```sui move + public struct GRACECAMPO_NFT has store, key { + id: UID, + name: string::String, + description: string::String, + url: Url, + } +``` +>定义监听事件 +```sui move + public struct GRACECAMPO_NFT_Minted has copy, drop { + object_id: ID, + creator: address, + name: string::String, + } +``` +>定义铸造函数 +```sui move +public entry fun mint_to_sender( + name: vector, + description: vector, + url: vector, + ctx: &mut TxContext + ) { + let sender = tx_context::sender(ctx); + let nft = GRACECAMPO_NFT { + id: object::new(ctx), + name: string::utf8(name), + description: string::utf8(description), + url: url::new_unsafe_from_bytes(url), + }; + + event::emit(GRACECAMPO_NFT_Minted { + object_id: object::id(&nft), + creator: sender, + name: nft.name, + }); + + transfer::public_transfer(nft, sender); + } +``` +>定义转移函数, +```sui move + public entry fun transfer( + nft: GRACECAMPO_NFT, recipient: address, _: &mut TxContext + ) { + transfer::public_transfer(nft, recipient) + } + public entry fun update_description( + nft: &mut GRACECAMPO_NFT, + new_description: vector, + _: &mut TxContext + ) { + nft.description = string::utf8(new_description) + } +``` +### 2. 铸造NFT +>调用铸造函数 +```shell +sui client call --package PACKAGEID --module GRACECAMPO_NFT --function mint_to_sender args NFT名称 NFT描述 NFT图片地址 +``` +调用成功后,需要记录NFT的OBJECTID,方便区块浏览器查看 +### 3. 转移NFT +>转移NFT +```shell +sui client call --package PACKAGEID --module GRACECAMPO_NFT --function transfer args NFT-OBJECTID recipient-address +``` +调用成功后,需要记录交易hash,方便区块浏览器查看 + +合约中的铸造和转移函数声明为entry,如果不熟悉命令行调用也可支持在区块浏览器调用 + +### 4. 查看交易信息 +查看NFT信息:(注意合约发布环境) +>测试网 +>> https://suiscan.xyz/testnet/object/NFT-OBJECTID +> +>> https://suiscan.xyz/testnet/tx/transfer-hash +> +>主网 +>> https://suiscan.xyz/mainnet/object/NFT-OBJECTID +> +>> https://suiscan.xyz/mainnet/tx/transfer-hash + diff --git "a/mover/gracecampo/notes/\345\267\245\345\205\267\344\275\277\347\224\250/sui-cli\344\275\277\347\224\250\346\214\207\345\215\227.md" "b/mover/gracecampo/notes/\345\267\245\345\205\267\344\275\277\347\224\250/sui-cli\344\275\277\347\224\250\346\214\207\345\215\227.md" new file mode 100644 index 000000000..fb3fe82a4 --- /dev/null +++ "b/mover/gracecampo/notes/\345\267\245\345\205\267\344\275\277\347\224\250/sui-cli\344\275\277\347\224\250\346\214\207\345\215\227.md" @@ -0,0 +1,230 @@ +# sui-cli使用指南 + +💧  [HOH水分子公众号](https://mp.weixin.qq.com/s/d0brr-ao6cZ5t8Z5OO1Mog) + +🌊  [HOH水分子X账号](https://x.com/0xHOH) + +📹  [课程B站账号](https://space.bilibili.com/3493269495352098) + +💻  Github仓库 https://github.com/move-cn/letsmove + +🧑‍💻作者:gracecampo +## sui cli 介绍 +Sui CLI 命令提供与 Sui 网络交互的终端命令入口。典型用途包括发布 Move 智能合约、获取对象信息、执行事务或管理地址。 +### 检查sui cli 安装及版本 +使用sui cli 之前,必须检查是否已经安装成功,可以在终端窗口输入一下命令 +> sui --version + +如果未安装,可参考之前文章:[如何安装sui](https://learnblockchain.cn/article/9860) + +### 查看sui cli 支持的命令列表 +> sui client + + +```text +Usage: sui client [OPTIONS] [COMMAND] + +Commands: +active-address Default address used for commands when none specified +active-env Default environment used for commands when none specified +addresses Obtain the Addresses managed by the client +balance List the coin balance of an address +call Call Move function +chain-identifier Query the chain identifier from the rpc endpoint +dynamic-field Query a dynamic field by its address +envs List all Sui environments +execute-signed-tx Execute a Signed Transaction. This is useful when the user prefers to sign elsewhere and use this command to execute +execute-combined-signed-tx Execute a combined serialized SenderSignedData string +faucet Request gas coin from faucet. By default, it will use the active address and the active network +gas Obtain all gas objects owned by the address. An address' alias can be used instead of the address +merge-coin Merge two coin objects into one coin +new-address Generate new address and keypair with keypair scheme flag {ed25519 | secp256k1 | secp256r1} with optional derivation path, default to m/44'/784'/0'/0'/0' for ed25519 or m/54'/784'/0'/0/0 for +secp256k1 or m/74'/784'/0'/0/0 for secp256r1. Word length can be { word12 | word15 | word18 | word21 | word24} default to word12 if not specified +new-env Add new Sui environment +object Get object info +objects Obtain all objects owned by the address. It also accepts an address by its alias +pay Pay coins to recipients following specified amounts, with input coins. Length of recipients must be the same as that of amounts +pay-all-sui Pay all residual SUI coins to the recipient with input coins, after deducting the gas cost. The input coins also include the coin for gas payment, so no extra gas coin is required +pay-sui Pay SUI coins to recipients following following specified amounts, with input coins. Length of recipients must be the same as that of amounts. The input coins also include the coin for gas +payment, so no extra gas coin is required +ptb Run a PTB from the provided args +publish Publish Move modules +split-coin Split a coin object into multiple coins +switch Switch active address and network(e.g., devnet, local rpc server) +tx-block Get the effects of executing the given transaction block +transfer Transfer object +transfer-sui Transfer SUI, and pay gas with the same SUI coin object. If amount is specified, only the amount is transferred; otherwise the entire object is transferred +upgrade Upgrade Move modules +verify-bytecode-meter Run the bytecode verifier on the package +verify-source Verify local Move packages against on-chain packages, and optionally their dependencies +profile-transaction Profile the gas usage of a transaction. Unless an output filepath is not specified, outputs a file `gas_profile_{tx_digest}_{unix_timestamp}.json` which can be opened in a flamegraph tool such +as speedscope +replay-transaction Replay a given transaction to view transaction effects. Set environment variable MOVE_VM_STEP=1 to debug +replay-batch Replay transactions listed in a file +replay-checkpoint Replay all transactions in a range of checkpoints +help Print this message or the help of the given subcommand(s) + +Options: +--client.config Sets the file storing the state of our user accounts (an empty one will be created if missing) +--json Return command outputs in json format +-y, --yes +-h, --help Print help + +``` +### 地址管理 +地址相关命令 +```text +sui client addresses --查看地址列表 +sui client active-address --查看当前地址 +sui client new-address ed25519 --创建地址 +sui client new-address ed25519 MY_ALIAS --自定义地址别名 +sui client switch --address ADDRESS --切换地址,也支持别名切换 +``` +查看地址列表 +> sui client addresses +```text +╭─────────────────────┬────────────────────────────────────────────────────────────────────┬────────────────╮ +│ alias │ address │ active address │ +├─────────────────────┼────────────────────────────────────────────────────────────────────┼────────────────┤ +│ quizzical-corundum │ 0x6a7e12ee188658b7fb62d00b897143808e6a54e6185843dedb54eb70e70e3efe │ * │ +│ vigilant-quartz │ 0xb76dbc0cab651095651eb550a522d450ab2a1c267ddc5ea70a263fe5b51a6013 │ │ +│ pensive-chrysoberyl │ 0xc33c26e95d20423c2a4a9179ae59e845712f01682ac6bcbccf39f0f8542e6cdd │ │ +╰─────────────────────┴────────────────────────────────────────────────────────────────────┴────────────────╯ +``` +> sui client active-address --查看当前地址 +```text +0x6a7e12ee188658b7fb62d00b897143808e6a54e6185843dedb54eb70e70e3efe +``` +> sui client new-address ed25519 +```text +╭────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Created new keypair and saved it to keystore. │ +├────────────────┬───────────────────────────────────────────────────────────────────────────┤ +│ alias │ elastic-topaz │ +│ address │ 0x9ae8ca9263455c1a1d9243ebc5986496bb315b1c3343f1100851e218e7575348 │ +│ keyScheme │ ed25519 │ +│ recoveryPhrase │ ready west frame ability drop valve quick snake bargain render ghost know │ +╰────────────────┴───────────────────────────────────────────────────────────────────────────╯ +``` +> sui client new-address ed25519 MY_ALIAS +```text +╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Created new keypair and saved it to keystore. │ +├────────────────┬────────────────────────────────────────────────────────────────────────────────┤ +│ alias │ alice │ +│ address │ 0x7307b3e2f4082027d8b59abeced019d3910346b50369af62e8b938573ec517ef │ +│ keyScheme │ ed25519 │ +│ recoveryPhrase │ version write opinion reject title isolate guard beef glare short they citizen │ +╰────────────────┴────────────────────────────────────────────────────────────────────────────────╯ +``` +> sui client switch --address ADDRESS +```text +Active address switched to 0x7307b3e2f4082027d8b59abeced019d3910346b50369af62e8b938573ec517ef +``` +### 测试代币获取 +获取测试代币命令 +```text +sui client faucet --通过水龙头获取测试代币 +sui client faucet --address ADDRESS --指定地址通过水龙头获取测试代币 +sui client faucet --url CUSTOM_FAUCET_URL ----指定水龙头URL地址获取测试代币 +sui client gas ----获取当前地址测试代币余额 +sui client gas ADDRESS ----获取指定地址测试代币余额 +``` +> sui client faucet +```text +Request successful. It can take up to 1 minute to get the coin. Run sui client gas to check your gas coins. +``` +>sui client faucet --address ADDRESS +```text +Request successful. It can take up to 1 minute to get the coin. Run sui client gas to check your gas coins. +``` +> sui client gas +```text +╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮ +│ gasCoinId │ mistBalance (MIST) │ suiBalance (SUI) │ +├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤ +│ 0xd46fd2a39983be3d9d9769c768c49ef2a16e8b36c20c28aa0634bf0d588ef7d1 │ 1000000000 │ 1.00 │ +╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯ +``` +>sui client gas ADDRESS +```text +╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮ +│ gasCoinId │ mistBalance (MIST) │ suiBalance (SUI) │ +├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤ +│ 0x0677e401bae703cddbc0332d7098e9ac78e353984ca118f1705dbc97a67a9871 │ 1000000000 │ 1.00 │ +╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯ +``` +### 环境管理 +环境相关命令 +```shell +sui client active-env --获取当前的环境地址 +sui client envs --获取环境地址列表 +sui client new-env --rpc URL --alias ALIAS --添加自定义地址 +sui client switch --env ENV_ALIAS --切换当前环境 +``` +> sui client active-env +>> testnet + +>sui client envs +```text +╭─────────┬─────────────────────────────────────┬────────╮ +│ alias │ url │ active │ +├─────────┼─────────────────────────────────────┼────────┤ +│ testnet │ https://fullnode.testnet.sui.io:443 │ * │ +│ mainnet │ https://fullnode.mainnet.sui.io:443 │ │ +│ devnet │ https://fullnode.devnet.sui.io:443 │ │ +╰─────────┴─────────────────────────────────────┴────────╯ +``` +> sui client new-env --rpc URL --alias ALIAS +```text +Added new Sui env [devnet] to config. +``` +> sui client switch --env ENV_ALIAS +```text +Active environment switched to [mainnet] +``` +创建、构建和测试 Move 项目 +```text +sui move new PROJECT_NAME 在给定文件夹中创建新的 Move 项目 +sui move build 在当前目录中构建 Move 项目 +sui move build --path PATH 从给定路径构建 Move 项目 +sui move test 在当前目录中测试 Move 项目 +``` +>sui move new PROJECT_NAME + +创建完成,会在当前目录创建一个项目脚手架,通过RustRover打开 + +>sui move build +```text +PS F:\project\move-project\task3> sui move build +UPDATING GIT DEPENDENCY https://gitee.com/MystenLabs/sui.git +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING task3 +``` +>sui move build --path PATH +```text +PS F:\project\move-project> sui move build --path .\task4\ +UPDATING GIT DEPENDENCY https://gitee.com/MystenLabs/sui.git +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING task4 +``` +>sui move test +```text +PS F:\project\move-project\task3> sui move test +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING task3 +Running Move unit tests +Test result: OK. Total tests: 0; passed: 0; failed: 0 +``` +### 执行事务 +```text +sui client publish --发布模块 +sui client call --package PACKAGE --module MODULE --function FUNCTION --调用 Move 包 +sui client merge-coin --primary-coin COIN_ID --coin-to-merge COIN_ID --合并两个硬币 +sui client split-coin --coin-id COIN_ID --amounts 1000 --将硬币拆分为两个硬币:一个具有 1000 MIST,其余的 +sui client pay-sui --input-coins COIN_ID --recipients ADDRESS --amounts 100000000 --将 0.1 SUI 转入地址,并使用相同的币种支付 gas +sui client transfer-sui --sui-coin-object-id COIN_ID --to ADDRESS --将 SUI 对象转移到一个地址,并使用相同的币种进行 gas +``` \ No newline at end of file diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/filelist.png" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/filelist.png" new file mode 100644 index 000000000..be51f7605 Binary files /dev/null and "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/filelist.png" differ diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img.png" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img.png" new file mode 100644 index 000000000..e66919f7c Binary files /dev/null and "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img.png" differ diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_1.png" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_1.png" new file mode 100644 index 000000000..87b722c15 Binary files /dev/null and "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_1.png" differ diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_2.png" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_2.png" new file mode 100644 index 000000000..9c35a38b4 Binary files /dev/null and "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_2.png" differ diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_3.png" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_3.png" new file mode 100644 index 000000000..6e2bc49dd Binary files /dev/null and "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/img_3.png" differ diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/releases.png" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/releases.png" new file mode 100644 index 000000000..35a290053 Binary files /dev/null and "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/releases.png" differ diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/version.png" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/version.png" new file mode 100644 index 000000000..cab77aed5 Binary files /dev/null and "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/image/version.png" differ diff --git "a/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/\345\256\211\350\243\205SUI.md" "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/\345\256\211\350\243\205SUI.md" new file mode 100644 index 000000000..d3b9fa6fd --- /dev/null +++ "b/mover/gracecampo/notes/\347\216\257\345\242\203\345\256\211\350\243\205/\345\256\211\350\243\205SUI.md" @@ -0,0 +1,75 @@ +# 如何安装SUI客户端 + +💧  [HOH水分子公众号](https://mp.weixin.qq.com/s/d0brr-ao6cZ5t8Z5OO1Mog) + +🌊  [HOH水分子X账号](https://x.com/0xHOH) + +📹  [课程B站账号](https://space.bilibili.com/3493269495352098) + +💻  Github仓库 https://github.com/move-cn/letsmove + +🧑‍💻作者:gracecampo + +## 支持的系统 +> Linux - Ubuntu 版本 20.04 (Bionic Beaver) 或更高版本 + +> macOS - macOS Monterey 或更高版本 + +> Microsoft Windows - Windows 10 和 11 + +Linux 和macOS 安装比较简单,执行以下安装命令即可 + +## Linux/macOS 安装命令 +>> brew install sui + +## windows安装步骤 +### 下载二进制文件 +[下载地址:](https://github.com/MystenLabs/sui) +https://github.com/MystenLabs/sui +点击链接会显示以下页面 +![release版本](/image/releases.png) + +点击右侧release,下载最新版本,当前最新版本为testnet-v1.37.2,故选择此版本 sui-testnet-v1.37.2-windows-x86_64.tgz +![下载版本](image/version.png) + +下载完成后,修改压缩包名称为sui.tgz 然后解压安装包 +要记录解压目录,比如我解压目录为:E:\software\sui + +解压后目录信息 + +![解压文件列表](image/filelist.png) + +### 配置环境变量 +按下“win+R”快捷键,打开运行对话框,输入指令: +>> sysdm.cpl + +选择高级,点击环境变量 + +![img.png](image/img.png) + +在系统变量中,找到path双击,点击新建,添加环境变量 + +![img_1.png](image/img_1.png) + +![img_2.png](image/img_2.png) + +验证是否安装完成: +按下“win+R”快捷键,打开运行对话框,输入指令: +>> cmd + +输入: +>> sui --version + +如果输出sui版本号,说明安装成功 + +![img_3.png](./image/img_3.png) + +如果输出错误,则需要确认sui目录路径是否正常,如果配置正确,可以尝试重启电脑,再次执行验证步骤。 + +更新安装包,也是以上步骤,下载最新版的安装包,解压替换原有文件即可。 + + + + + + diff --git a/mover/gracecampo/readme.md b/mover/gracecampo/readme.md index 064ea2c90..7964d1e26 100644 --- a/mover/gracecampo/readme.md +++ b/mover/gracecampo/readme.md @@ -31,10 +31,10 @@ ## 03 move NFT -- [] nft package id : -- [] nft object id : -- [] 转账 nft hash: -- [] scan 上的 NFT 截图:![Scan截图](./images/你的图片地址) +- [] nft package id : 0xaf873773b0ec5ec38e22891afac1b8b4a66f02a569fdd2220e87777d545ae69b +- [] nft object id : 0xa7b2de518c067b6fc7b62f92d99a930362eb6a98bed92e8ed233f194bc6167bc +- [] 转账 nft hash: BcW8xPGv8kZUKn4MtDyq4U49F7KMJiPSeBwt51tAeA14 +- [] scan 上的 NFT 截图:![Scan截图](./scan/moveNFT.png) ## 04 Move Game diff --git a/mover/gracecampo/scan/moveNFT.png b/mover/gracecampo/scan/moveNFT.png new file mode 100644 index 000000000..6374cdc38 Binary files /dev/null and b/mover/gracecampo/scan/moveNFT.png differ diff --git a/mover/hoh-zone/co-learn-2411/images/readme.md b/mover/hoh-zone/co-learn-2411/images/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/hoh-zone/co-learn-2411/project/readme.md b/mover/hoh-zone/co-learn-2411/project/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/hoh-zone/co-learn-2411/project/readme.md @@ -0,0 +1 @@ + diff --git a/mover/hoh-zone/co-learn-2411/readme.md b/mover/hoh-zone/co-learn-2411/readme.md new file mode 100644 index 000000000..9b3eccb1d --- /dev/null +++ b/mover/hoh-zone/co-learn-2411/readme.md @@ -0,0 +1,54 @@ +# 这个模板是2024年11月份的共学营才需要的 + +## b站,推特关注 + +- [] b站,推特关注截图: ![关注截图](./images/你的图片地址) + +## 为共学营宣传(在朋友圈或者群聊中转发海报/文章) + +- [] 宣传截图:![宣传截图](./images/你的图片地址) + +## 每周课程学习 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 参加直播答疑 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 群里分享学习笔记 + +- [] 第一篇笔记 +- [] 第二篇笔记 +- [] 第三篇笔记 +- [] 第四篇笔记 + +## 对外输出学习笔记 + +- [] 第一篇笔记【学习笔记链接】 +- [] 第二篇笔记【学习笔记链接】 +- [] 第三篇笔记【学习笔记链接】 +- [] 第四篇笔记【学习笔记链接】 + +## 在HOH社区公众号发布自己的技术文章 + +- [] 第一篇笔记【公众号文章链接】 +- [] 第二篇笔记【公众号文章链接】 +- [] 第三篇笔记【公众号文章链接】 +- [] 第四篇笔记【公众号文章链接】 + +## 直播分享学习技巧/工具推荐 + +- [] 会议截图:![会议记录截图](./images/你的图片地址) + +## 提交项目 + +- [] 项目提交![项目截图](./images/你的图片地址) + + diff --git a/mover/hoh-zone/code/readme.md b/mover/hoh-zone/code/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/hoh-zone/notes/readme.md b/mover/hoh-zone/notes/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/001/readme.md b/mover/hoh-zone/readme.md similarity index 82% rename from mover/001/readme.md rename to mover/hoh-zone/readme.md index 2480ac364..5a7c47da3 100644 --- a/mover/001/readme.md +++ b/mover/hoh-zone/readme.md @@ -1,19 +1,19 @@ ## 基本信息 -- Sui钱包地址: `0x` +- Sui钱包地址: `0x1000000000000x` > 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址 -- github: `xxx` +- github: `自己的githubid` ## 个人简介 -- 工作经验: 10000年 -- 技术栈: `xx` `xx` +- 工作经验: x年 +- 技术栈: `Rust` `C++` > 重要提示 请认真写自己的简介 -- -- 联系方式: tg: `xx` +- 多年web2开发经验,对Move特别感兴趣,想通过Move入门区块链 +- 联系方式: tg: `xxx` ## 任务 ## 01 hello move -- [] Sui cli version: sui 1.37.1-homebrew +- [] Sui cli version: - [] Sui钱包截图: ![Sui钱包截图](./images/你的图片地址) - [] package id: - [] package id 在 scan上的查看截图:![Scan截图](./images/你的图片地址) diff --git a/mover/hoh-zone/scan/readme.md b/mover/hoh-zone/scan/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/hoh-zone/scan/readme.md @@ -0,0 +1 @@ + diff --git a/mover/hwen227/co-learn-2411/images/twitter_follow.png b/mover/hwen227/co-learn-2411/images/twitter_follow.png new file mode 100644 index 000000000..b0d74269f Binary files /dev/null and b/mover/hwen227/co-learn-2411/images/twitter_follow.png differ diff --git a/mover/hwen227/co-learn-2411/images/week1.png b/mover/hwen227/co-learn-2411/images/week1.png new file mode 100644 index 000000000..029db3b6b Binary files /dev/null and b/mover/hwen227/co-learn-2411/images/week1.png differ diff --git a/mover/hwen227/co-learn-2411/images/week2.png b/mover/hwen227/co-learn-2411/images/week2.png new file mode 100644 index 000000000..6f1c5d4d2 Binary files /dev/null and b/mover/hwen227/co-learn-2411/images/week2.png differ diff --git a/mover/hwen227/co-learn-2411/project/readme.md b/mover/hwen227/co-learn-2411/project/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/hwen227/co-learn-2411/project/readme.md @@ -0,0 +1 @@ + diff --git a/mover/hwen227/co-learn-2411/readme.md b/mover/hwen227/co-learn-2411/readme.md new file mode 100644 index 000000000..45cf34c5a --- /dev/null +++ b/mover/hwen227/co-learn-2411/readme.md @@ -0,0 +1,54 @@ +# 2024年11月Move共学营 + +## b站,推特关注 + +- [√] b站,推特关注截图: ![关注截图](./images/twitter_follow.png) + +## 为共学营宣传(在朋友圈或者群聊中转发海报/文章) + +- [] 宣传截图:![宣传截图](./images/你的图片地址) + +## 每周课程学习 + +- [√] 第一周:![学习记录截图](./images/week1.png) +- [√] 第二周:![学习记录截图](./images/week2.png) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 参加直播答疑 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 群里分享学习笔记 + +- [√] [第一篇笔记](../notes/Task1%20-%20环境安装&Say%20Hello%20World%20To%20Sui.md) +- [] 第二篇笔记 +- [] 第三篇笔记 +- [] 第四篇笔记 + +## 对外输出学习笔记 + +- [√] 第一篇笔记[【学习笔记链接】](https://learnblockchain.cn/article/9905) +- [] 第二篇笔记【学习笔记链接】 +- [] 第三篇笔记【学习笔记链接】 +- [] 第四篇笔记【学习笔记链接】 + +## 在HOH社区公众号发布自己的技术文章 + +- [] 第一篇笔记【公众号文章链接】 +- [] 第二篇笔记【公众号文章链接】 +- [] 第三篇笔记【公众号文章链接】 +- [] 第四篇笔记【公众号文章链接】 + +## 直播分享学习技巧/工具推荐 + +- [] 会议截图:![会议记录截图](./images/你的图片地址) + +## 提交项目 + +- [] 项目提交![项目截图](./images/你的图片地址) + + diff --git a/mover/hwen227/code/readme.md b/mover/hwen227/code/readme.md new file mode 100644 index 000000000..774efd09a --- /dev/null +++ b/mover/hwen227/code/readme.md @@ -0,0 +1,2 @@ +## Task1 +将hello word程序部署到sui的testnet \ No newline at end of file diff --git a/mover/hwen227/code/task1/hello_move/Move.lock b/mover/hwen227/code/task1/hello_move/Move.lock new file mode 100644 index 000000000..c26bd617b --- /dev/null +++ b/mover/hwen227/code/task1/hello_move/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "8B7DC3EDF1D81F9E2D46D8251E70F4B8D7097878F02438454C30AEF9F05D81D0" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.36.2" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x0a46e385e71c71534f8d3e401ddc07a3b2d58a17204f2954e1f30fd393ee9449" +latest-published-id = "0x0a46e385e71c71534f8d3e401ddc07a3b2d58a17204f2954e1f30fd393ee9449" +published-version = "1" diff --git a/mover/hwen227/code/task1/hello_move/Move.toml b/mover/hwen227/code/task1/hello_move/Move.toml new file mode 100644 index 000000000..f99a76a8d --- /dev/null +++ b/mover/hwen227/code/task1/hello_move/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hello_move" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +hello_move = "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/hwen227/code/task1/hello_move/sources/hello_move.move b/mover/hwen227/code/task1/hello_move/sources/hello_move.move new file mode 100644 index 000000000..8df6ef978 --- /dev/null +++ b/mover/hwen227/code/task1/hello_move/sources/hello_move.move @@ -0,0 +1,19 @@ +module hello_move::hello { + use std::ascii::{String, string}; + use sui::object::{Self,UID}; + use sui::transfer::transfer; + use sui::tx_context::{TxContext, sender}; + + public struct Hello has key{ + id:UID, + say: String + } + + fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id:object::new(ctx), + say: string(b"Hello Hwen!"), + }; + transfer(hello_move, sender(ctx)); + } +} \ No newline at end of file diff --git a/mover/hwen227/code/task1/hello_move/tests/hello_move_tests.move b/mover/hwen227/code/task1/hello_move/tests/hello_move_tests.move new file mode 100644 index 000000000..7798d8dda --- /dev/null +++ b/mover/hwen227/code/task1/hello_move/tests/hello_move_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hello_move::hello_move_tests; +// uncomment this line to import the module +// use hello_move::hello_move; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hello_move() { + // pass +} + +#[test, expected_failure(abort_code = ::hello_move::hello_move_tests::ENotImplemented)] +fun test_hello_move_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/hwen227/code/task2/hwen_coin/Move.lock b/mover/hwen227/code/task2/hwen_coin/Move.lock new file mode 100644 index 000000000..2c140a4c9 --- /dev/null +++ b/mover/hwen227/code/task2/hwen_coin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "AFCD0CF67487B61251FD4A4614D519BB68E82266AB58AAE95396895647A6DBC0" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.36.2" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x14a832d436ae3c6156d76db46ea64574abf29643b29788221b6cee5ddfa8e5fc" +latest-published-id = "0x14a832d436ae3c6156d76db46ea64574abf29643b29788221b6cee5ddfa8e5fc" +published-version = "1" diff --git a/mover/hwen227/code/task2/hwen_coin/Move.toml b/mover/hwen227/code/task2/hwen_coin/Move.toml new file mode 100644 index 000000000..bd32266ef --- /dev/null +++ b/mover/hwen227/code/task2/hwen_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hwen_coin" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +hwen_coin = "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/hwen227/code/task2/hwen_coin/sources/hwen_coin.move b/mover/hwen227/code/task2/hwen_coin/sources/hwen_coin.move new file mode 100644 index 000000000..c2537f726 --- /dev/null +++ b/mover/hwen227/code/task2/hwen_coin/sources/hwen_coin.move @@ -0,0 +1,47 @@ +module hwen_coin::hwen_coin { + use sui::coin::{Self, Coin, TreasuryCap}; + use sui::url::{Self, Url}; + + public struct HWEN_COIN has drop {} + + fun init( + witness: HWEN_COIN, + ctx: &mut TxContext + ) { + let (treasury_cap, metadata) = coin::create_currency( + witness, + 9, + b"HWEN", + b"HWEN_COIN", + b"HWEN Coin", + option::some( + url::new_unsafe_from_bytes( + b"https://avatars.githubusercontent.com/u/76983474" + ) + ), + ctx + ); + transfer::public_freeze_object(metadata); + transfer::public_transfer( + treasury_cap, + tx_context::sender(ctx) + ) + } + + public entry fun mint( + treasury_cap: &mut TreasuryCap, + amount: u64, + recipient: address, + ctx: &mut TxContext + ) { + coin::mint_and_transfer(treasury_cap, amount, recipient, ctx); + } + + public fun burn( + treasury_cap: &mut TreasuryCap, + coin: Coin + ) { + coin::burn(treasury_cap, coin); + + } +} diff --git a/mover/hwen227/code/task2/hwen_coin/tests/hwen_coin_tests.move b/mover/hwen227/code/task2/hwen_coin/tests/hwen_coin_tests.move new file mode 100644 index 000000000..4588d3082 --- /dev/null +++ b/mover/hwen227/code/task2/hwen_coin/tests/hwen_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hwen_coin::hwen_coin_tests; +// uncomment this line to import the module +// use hwen_coin::hwen_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hwen_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::hwen_coin::hwen_coin_tests::ENotImplemented)] +fun test_hwen_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/hwen227/images/task1_code.png b/mover/hwen227/images/task1_code.png new file mode 100644 index 000000000..56d179ab5 Binary files /dev/null and b/mover/hwen227/images/task1_code.png differ diff --git a/mover/hwen227/images/task1_wallet.png b/mover/hwen227/images/task1_wallet.png new file mode 100644 index 000000000..da98027c9 Binary files /dev/null and b/mover/hwen227/images/task1_wallet.png differ diff --git "a/mover/hwen227/notes/Task1 - \347\216\257\345\242\203\345\256\211\350\243\205&Say Hello World To Sui.md" "b/mover/hwen227/notes/Task1 - \347\216\257\345\242\203\345\256\211\350\243\205&Say Hello World To Sui.md" new file mode 100644 index 000000000..3f6a25655 --- /dev/null +++ "b/mover/hwen227/notes/Task1 - \347\216\257\345\242\203\345\256\211\350\243\205&Say Hello World To Sui.md" @@ -0,0 +1,142 @@ +# 环境配置 + +必备的安装项包括**Git,Sui CLI**以及一个IDE **VSCode**或者**RustRover**都可以,下面仅展示Sui CLI的安装过程 +## Sui CLI的安装 + +**Sui CLI**可以用于编译、部署和测试Move智能合约,但它不仅仅是Move编译器,它可以管理**Move合约**的编译、发布、交互等操作,并执行其他与Sui节点交互的命令。这套工具是Sui生态系统中的官方CLI工具,提供了一个集成的开发环境。 + +本文使用二进制文件进行安装 +### Step1 在Github中找到安装包 + +在sui-cli的[github地址](https://github.com/MystenLabs/sui)中找到对应系统的最新的release版本,文件后缀为`.tgz`,windows系统自带解压的功能,解压结束后的文件有以下几个exe程序组成 + +| 名称 | 描述 | +|---------------------|-------------------------------------------| +| move-analyzer | 语言服务器协议实现。 | +| sui | Sui 主二进制文件。 | +| sui-bridge | Sui 原生桥接。 | +| sui-data-ingestion | 捕获全节点数据供索引器存储到数据库中。 | +| sui-faucet | 在本地网络上铸造代币的本地水龙头。 | +| sui-graphql-rpc | Sui RPC 的 GraphQL 服务。 | +| sui-node | 运行本地节点。 | +| sui-test-validator | 在本地网络上运行测试验证器以进行开发。 | +| sui-tool | 提供 Sui 实用工具。 | + +### Step2 添加sui到环境变量 + +以下是Windows系统和Mac系统的环境变量配置的方式 +#### Windows 系统 + +1. 打开系统环境变量: + - 右键点击“此电脑”或“计算机”,选择“属性”。 + - 点击“高级系统设置”,然后点击“环境变量”按钮。 +2. 在系统变量中添加sui的安装路径 + - 在“环境变量”窗口中,找到**系统变量**部分,选择 `Path` 变量,然后点击“编辑”。 + - 在“编辑环境变量”窗口中,点击“新建”,然后输入 `D:\Program Files\sui-cli`(你的 Sui CLI 文件夹路径)。 + - 确保路径输入正确,点击“确定”保存设置,直到所有窗口关闭。 +3. 在命令行中使用`sui --version`,以测试是否正确安装 + +#### Mac系统 + +1. 打开配置文件,用文本编辑器打开`nano ~/.bashrc` +2. 在打开的文本编辑器中输入`export PATH="path-to-sui"`(你的 Sui CLI 文件夹路径) +3. 保存并退出使用 + 1. 按下 `Ctrl+O` 保存文件,然后按下 `Enter` 确认文件名。 + 2. 按下 `Ctrl+X` 退出编辑器。 +4. 使配置生效,输入`source ~/.bashrc` +5. 关闭当前终端,打开一个新终端输入`sui --version`查看配置是否生效 +# 新建Hello World项目 + +在需要创立项目的目录下打开cmd命令行,输入`sui move new hello_move`,随后在vscode中打开该项目 + +此时move代码显示为灰白,需要vscode的拓展中安装move syntax,以获得高亮的move代码 + +在`source`文件夹下的`hello_move.move`文件中复制以下的hello word代码 +```move +module hello_move::hello { + use std::ascii::{String, string}; + use sui::object::{Self,UID}; + use sui::transfer::transfer; + use sui::tx_context::{TxContext, sender}; + + public struct Hello has key{ + id:UID, + say: String + } + + fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id:object::new(ctx), + say: string(b"move"), + }; + transfer(hello_move, sender(ctx)); + } +} +``` + +这个代码定义了一个简单的模块 `hello_move::hello`,可以用来初始化一个“Hello”对象,并将其转移给当前交易的发送者 +* `use std::ascii::{String, string};`等行代码是导入必要的库和模块 +* 之后,程序定义了一个名为 `Hello` 的结构体,具有 `key` 特性。这是一个 `Move` 中的自定义对象,表示它可以用作链上资源 +* `init`是一个公开函数,用于初始化 `Hello` 结构体对象并将其转移给交易发送者 + + * `ctx: &mut TxContext`:`ctx` 是一个可变引用类型的交易上下文,它用于获取创建对象所需的上下文信息 + * **`TxContext` 是一个结构体**,它包含了有关交易的上下文信息 + * **`ctx` 是 `TxContext` 类型的一个变量**,表示当前交易的上下文 + * `&mut`表示一个**可变引用**(mutable reference),在sui中`&`表示一个 不可变引用 + + * `let hello_move= Hello{}`的部分创建了一个新的 `Hello` 对象 + * 字段 `id` 通过 `object::new(ctx)` 函数生成 + * `object::new` 表示调用 `object` 模块中的 `new` 函数。`new` 函数接收一个 `TxContext` 参数,根据交易上下文生成一个独特的 ID,确保不同的对象不会拥有相同的 ID。 + * `say` 字段则通过 `string(b"move")` 设置成 "move"。 + +* `transfer` 函数将 `hello_move` 对象转移给交易的发送者,`sender(ctx)` 返回的是交易的发送者地址。 + +## 补充知识:TxContext是什么 + +在 Sui 区块链中,`TxContext` 是一个重要的结构体,它包含了与当前交易相关的一些关键数据和操作,可以帮助智能合约安全地创建对象、获取交易发送者地址等。 + +`TxContext` 可以理解为是**交易的“环境记录”**,用来存储和追踪有关交易的一些重要信息。在一个智能合约(比如 Move 合约)运行时,`TxContext` 就像是一个助手,帮我们处理和保存交易过程中所需要的各种数据和上下文。 + +`TxContext`通常包括了: + +- **谁发起了这笔交易**: + 交易的发送者是谁(也就是账户地址)?通过 `TxContext`,合约可以获取到发起交易的用户地址,这样合约就可以知道该把资产或信息分配给谁。 + +- **生成独一无二的 ID**: + 在区块链上,每一个资产或对象都需要一个独特的“身份证”(ID),以保证它是唯一的。`TxContext` 提供了生成这些独特 ID 的工具,以确保即使很多用户同时创建同种类型的资产,它们之间也不会混淆。 + +- **交易的其他信息**: + `TxContext` 还会包含一些额外的交易信息,比如交易的时间、交易的标识等。这些信息虽然不是直接操作资产时必须的,但在一些复杂的合约逻辑中可能会有帮助,比如记录操作历史等。 + +# 部署合约到Sui Testnet + +1. 先通过`sui client faucet`获取测试的sui代币 +2. 使用`sui move build` 编译move合约 + - 成功后,console会显示编译成功信息,并返回字节码文件 +3. 使用命令`sui client publish`部署合约 + * 在第一个选项中默认空格则发布到测试网中 + * 第二个选项选择0,使用ed25519密钥对方案 + * 部署成功后,积累下返回的Transaction Hush + +## 在Sui Explorer中查看发布的合约 + +区块链浏览器可以帮助我们查看链上交易、账户和智能合约的状态。Sui浏览器地址为 https://suivision.xyz/ , + +首页默认显示Sui主网,我们需要切换到刚刚部署的testnet上 + +通过过浏览器,我们可以查看到刚刚部署的合约啦 + +![testnet上的合约](../images/task1_code.png) + +## 遇到的问题 + +遇到了严重的卡顿,通常是网络问题,这时候可以 + +1. 设置代理(以下是cmd命令,powshell则用`$env:HTTPS_PROXY = "http://127.0.0.1:7897`) +```cmd +set HTTPS_PROXY=http://127.0.0.1:7897 +set HTTP_PROXY=http://127.0.0.1:7897 +``` +2. 把`Move.toml`中依赖项的下载源从github换成gitee + +我这边使用了以上步骤后还是遇到同样的问题,在文件夹中打开一个新终端执行命令设置代理,并把VPN开至全局模式才成功部署 \ No newline at end of file diff --git a/mover/hwen227/notes/readme.md b/mover/hwen227/notes/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/hwen227/readme.md b/mover/hwen227/readme.md new file mode 100644 index 000000000..5c1b450cf --- /dev/null +++ b/mover/hwen227/readme.md @@ -0,0 +1,53 @@ +## 基本信息 +- Sui钱包地址: `0xd83dda8dcdae875933dc6c1814a08e0a3e62204aeac2314a0bba0a0be757fc97` +- github: `hwen227` + +## 个人简介 +- 计算机专业,未参加工作 +- 技术栈: `java` `javascript` `python` `c++` + - 正在学习使用solidity编写智能合约,参加共学营来了解move语言以及sui生态,加深对区块链的理解 + - 寻找远程工作中 +- 联系方式: 微信: `Luca0227` + +## 任务 + +## 01 hello move +- [✓] Sui cli version: sui 1.36.2-3ada97c109cc +- [✓] Sui钱包截图: ![Sui钱包截图](./images/task1_wallet.png) +- [✓] package id: 0x0a46e385e71c71534f8d3e401ddc07a3b2d58a17204f2954e1f30fd393ee9449 +- [✓] package id 在 scan上的查看截图:![Scan截图](./images/task1_code.png) + +## 02 move coin +- [] My Coin package id : +- [] Faucet package id : +- [] 转账 `My Coin` hash: +- [] `Faucet Coin` address1 mint hash: +- [] `Faucet Coin` address2 mint hash: + +## 03 move NFT +- [] nft package id : +- [] nft object id : +- [] 转账 nft hash: +- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) + +## 04 Move Game +- [] game package id : +- [] deposit Coin hash: +- [] withdraw `Coin` hash: +- [] play game hash: + +## 05 Move Swap +- [] swap package id : +- [] call swap CoinA-> CoinB hash : +- [] call swap CoinB-> CoinA hash : + +## 06 Dapp-kit SDK PTB +- [] save hash : + +## 07 Move CTF Check In +- [] CLI call 截图 : ![截图](./images/你的图片地址) +- [] flag hash : + +## 08 Move CTF Lets Move +- [] proof : +- [] flag hash : diff --git a/mover/hwen227/scan/readme.md b/mover/hwen227/scan/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/hwen227/scan/readme.md @@ -0,0 +1 @@ + diff --git "a/mover/ilses1/co-learn-2411/images/\345\210\206\344\272\253\347\254\224\350\256\2601.png" "b/mover/ilses1/co-learn-2411/images/\345\210\206\344\272\253\347\254\224\350\256\2601.png" new file mode 100644 index 000000000..9227ecb76 Binary files /dev/null and "b/mover/ilses1/co-learn-2411/images/\345\210\206\344\272\253\347\254\224\350\256\2601.png" differ diff --git a/mover/ilses1/co-learn-2411/readme.md b/mover/ilses1/co-learn-2411/readme.md index f9ed5b53e..5a12d1867 100644 --- a/mover/ilses1/co-learn-2411/readme.md +++ b/mover/ilses1/co-learn-2411/readme.md @@ -24,7 +24,7 @@ ## 群里分享学习笔记 -- [] 第一篇笔记 +- [✓] 第一篇笔记 ![分享笔记1](./images//分享笔记1.png) - [] 第二篇笔记 - [] 第三篇笔记 - [] 第四篇笔记 diff --git a/mover/janrone/code/move_coin/faucet_j_coin/Move.lock b/mover/janrone/code/move_coin/faucet_j_coin/Move.lock new file mode 100644 index 000000000..a11b18146 --- /dev/null +++ b/mover/janrone/code/move_coin/faucet_j_coin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "140B0F8BC0FCD2D09671DA2678522755C168F410D193439B8F36A0137C1D3D22" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", 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 = "0x5865895f21bad55e8c747d2b53a3787a123b55c2dd0ea070e0813873b1e2c347" +latest-published-id = "0x5865895f21bad55e8c747d2b53a3787a123b55c2dd0ea070e0813873b1e2c347" +published-version = "1" diff --git a/mover/janrone/code/move_coin/faucet_j_coin/Move.toml b/mover/janrone/code/move_coin/faucet_j_coin/Move.toml new file mode 100644 index 000000000..98f15891c --- /dev/null +++ b/mover/janrone/code/move_coin/faucet_j_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "faucet_j_coin" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +faucet_j_coin = "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/janrone/code/move_coin/faucet_j_coin/sources/faucet_j_coin.move b/mover/janrone/code/move_coin/faucet_j_coin/sources/faucet_j_coin.move new file mode 100644 index 000000000..4917f0783 --- /dev/null +++ b/mover/janrone/code/move_coin/faucet_j_coin/sources/faucet_j_coin.move @@ -0,0 +1,48 @@ +/* +/// Module: faucet_j_coin +module faucet_j_coin::faucet_j_coin; +*/ +module faucet_j_coin::faucet_j_coin { + use sui::coin::{Self, Coin, TreasuryCap}; + use sui::url::{Self, Url}; + + public struct FAUCET_J_COIN has drop {} + + fun init( + witness: FAUCET_J_COIN, + ctx: &mut TxContext + ) { + let (treasury_cap, metadata) = coin::create_currency( + witness, + 9, + b"CRF", + b"FAUCET_COIN", + b"Janrone Faucet Coin", + option::some( + url::new_unsafe_from_bytes( + b"https://avatars.githubusercontent.com/u/1483883" + ) + ), + ctx + ); + transfer::public_freeze_object(metadata); + transfer::public_share_object(treasury_cap) + } + + public entry fun mint( + treasury_cap: &mut TreasuryCap, + amount: u64, + recipient: address, + ctx: &mut TxContext + ) { + coin::mint_and_transfer(treasury_cap, amount, recipient, ctx); + } + + public fun burn( + treasury_cap: &mut TreasuryCap, + coin: Coin + ) { + coin::burn(treasury_cap, coin); + + } +} diff --git a/mover/janrone/code/move_coin/faucet_j_coin/tests/faucet_j_coin_tests.move b/mover/janrone/code/move_coin/faucet_j_coin/tests/faucet_j_coin_tests.move new file mode 100644 index 000000000..c92e8b2c5 --- /dev/null +++ b/mover/janrone/code/move_coin/faucet_j_coin/tests/faucet_j_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module faucet_j_coin::faucet_j_coin_tests; +// uncomment this line to import the module +// use faucet_j_coin::faucet_j_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_faucet_j_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::faucet_j_coin::faucet_j_coin_tests::ENotImplemented)] +fun test_faucet_j_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/janrone/code/move_coin/j_coin/Move.lock b/mover/janrone/code/move_coin/j_coin/Move.lock new file mode 100644 index 000000000..9c773dbdc --- /dev/null +++ b/mover/janrone/code/move_coin/j_coin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "94E5810B57929C029EDD99ADABF81B3AF677AFC6047ACA871CA918E89FF5E64E" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", 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 = "0x5eba66432f3f60b472895c003872af367cc73f81c726207fae9585026da3858c" +latest-published-id = "0x5eba66432f3f60b472895c003872af367cc73f81c726207fae9585026da3858c" +published-version = "1" diff --git a/mover/janrone/code/move_coin/j_coin/Move.toml b/mover/janrone/code/move_coin/j_coin/Move.toml new file mode 100644 index 000000000..d0c167c2d --- /dev/null +++ b/mover/janrone/code/move_coin/j_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "j_coin" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +j_coin = "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/janrone/code/move_coin/j_coin/sources/j_coin.move b/mover/janrone/code/move_coin/j_coin/sources/j_coin.move new file mode 100644 index 000000000..3149382c5 --- /dev/null +++ b/mover/janrone/code/move_coin/j_coin/sources/j_coin.move @@ -0,0 +1,53 @@ +/* +/// Author: Janrone +/// Module: j_coin +module j_coin::j_coin; +*/ + +module j_coin::j_coin { + use sui::coin::{Self, Coin, TreasuryCap}; + use sui::url::{Self, Url}; + + public struct J_COIN has drop {} + + fun init( + witness: J_COIN, + ctx: &mut TxContext + ) { + let (treasury_cap, metadata) = coin::create_currency( + witness, + 9, + b"J", + b"J_COIN", + b"Janreon's Move Coin", + option::some( + url::new_unsafe_from_bytes( + b"https://avatars.githubusercontent.com/u/1483883" + ) + ), + ctx + ); + transfer::public_freeze_object(metadata); + transfer::public_transfer( + treasury_cap, + tx_context::sender(ctx) + ) + } + + public entry fun mint( + treasury_cap: &mut TreasuryCap, + amount: u64, + recipient: address, + ctx: &mut TxContext + ) { + coin::mint_and_transfer(treasury_cap, amount, recipient, ctx); + } + + public fun burn( + treasury_cap: &mut TreasuryCap, + coin: Coin + ) { + coin::burn(treasury_cap, coin); + + } +} diff --git a/mover/janrone/code/move_coin/j_coin/tests/j_coin_tests.move b/mover/janrone/code/move_coin/j_coin/tests/j_coin_tests.move new file mode 100644 index 000000000..6362cd2c9 --- /dev/null +++ b/mover/janrone/code/move_coin/j_coin/tests/j_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module j_coin::j_coin_tests; +// uncomment this line to import the module +// use j_coin::j_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_j_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::j_coin::j_coin_tests::ENotImplemented)] +fun test_j_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/janrone/readme.md b/mover/janrone/readme.md index ea0caeae4..60f978bb3 100644 --- a/mover/janrone/readme.md +++ b/mover/janrone/readme.md @@ -11,7 +11,7 @@ ## 为共学营宣传(在朋友圈或者群聊中转发海报/文章) -- [x] 宣传截图:![宣传截图](./images/wxpyq.png) +- [x] 宣传截图:![宣传截图](./co-learn-2411/images/wxpyq.png) ## 对外输出学习笔记 @@ -28,12 +28,12 @@ - [x] ![package id 在 suivision 链上截图](./co-learn-2411/images/task01-2.jpg) -## 02 move coin -- [] My Coin package id : -- [] Faucet package id : -- [] 转账 `My Coin` hash: -- [] `Faucet Coin` address1 mint hash: -- [] `Faucet Coin` address2 mint hash: +## 02 move coin +- [x] My Coin package id : 0x5eba66432f3f60b472895c003872af367cc73f81c726207fae9585026da3858c +- [x] Faucet package id : 0x5865895f21bad55e8c747d2b53a3787a123b55c2dd0ea070e0813873b1e2c347 +- [x] 转账 `My Coin` hash: 8kyMipWo4U4iCBsxvqjkN5UDQUuyeuoyoWZLXrvw4rYC +- [x] `Faucet Coin` address1 mint hash: B2YVMGK3v1Ti8TTKQ9GST95jnpAFEexqmqSdBJMsGT8z +- [x] `Faucet Coin` address2 mint hash: DsTyxsjSaYjMAmC6Bn2Nf9WyG6vpXDSoTcCM572BJ6Lg ## 03 move NFT - [] nft package id : diff --git a/mover/linqining/code/task1/hello_move/Move.lock b/mover/linqining/code/task1/hello_move/Move.lock index 30ab1cef8..c26bd617b 100644 --- a/mover/linqining/code/task1/hello_move/Move.lock +++ b/mover/linqining/code/task1/hello_move/Move.lock @@ -10,7 +10,7 @@ dependencies = [ [[move.package]] id = "MoveStdlib" -source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } [[move.package]] id = "Sui" @@ -21,7 +21,7 @@ dependencies = [ ] [move.toolchain-version] -compiler-version = "1.37.1" +compiler-version = "1.36.2" edition = "2024.beta" flavor = "sui" @@ -29,6 +29,6 @@ flavor = "sui" [env.testnet] chain-id = "4c78adac" -original-published-id = "0xdd4ca7a8ef868cfe3b9ac142bf1f6ba5643196165a6f0f6f9d76628acfab9a52" -latest-published-id = "0xdd4ca7a8ef868cfe3b9ac142bf1f6ba5643196165a6f0f6f9d76628acfab9a52" +original-published-id = "0x0a46e385e71c71534f8d3e401ddc07a3b2d58a17204f2954e1f30fd393ee9449" +latest-published-id = "0x0a46e385e71c71534f8d3e401ddc07a3b2d58a17204f2954e1f30fd393ee9449" published-version = "1" diff --git a/mover/nextuser/.gitignore b/mover/nextuser/.gitignore new file mode 100644 index 000000000..56763a4d8 --- /dev/null +++ b/mover/nextuser/.gitignore @@ -0,0 +1,3 @@ +bak +*.old +*.merge diff --git a/mover/nextuser/co-learn-2411/images/146efbb3.png b/mover/nextuser/co-learn-2411/images/146efbb3.png new file mode 100644 index 000000000..a9ab20dfe Binary files /dev/null and b/mover/nextuser/co-learn-2411/images/146efbb3.png differ diff --git a/mover/nextuser/co-learn-2411/images/3d51fd97.png b/mover/nextuser/co-learn-2411/images/3d51fd97.png new file mode 100644 index 000000000..0ce19a1f1 Binary files /dev/null and b/mover/nextuser/co-learn-2411/images/3d51fd97.png differ diff --git a/mover/nextuser/co-learn-2411/images/image-20241114072054746.png b/mover/nextuser/co-learn-2411/images/image-20241114072054746.png new file mode 100644 index 000000000..c5f74246a Binary files /dev/null and b/mover/nextuser/co-learn-2411/images/image-20241114072054746.png differ diff --git a/mover/nextuser/co-learn-2411/images/image-20241114120648749.png b/mover/nextuser/co-learn-2411/images/image-20241114120648749.png new file mode 100644 index 000000000..c37188d84 Binary files /dev/null and b/mover/nextuser/co-learn-2411/images/image-20241114120648749.png differ diff --git a/mover/nextuser/co-learn-2411/images/image-20241114120917806.png b/mover/nextuser/co-learn-2411/images/image-20241114120917806.png new file mode 100644 index 000000000..73d20eb4e Binary files /dev/null and b/mover/nextuser/co-learn-2411/images/image-20241114120917806.png differ diff --git a/mover/nextuser/co-learn-2411/images/image-20241114121009117.png b/mover/nextuser/co-learn-2411/images/image-20241114121009117.png new file mode 100644 index 000000000..26339f72c Binary files /dev/null and b/mover/nextuser/co-learn-2411/images/image-20241114121009117.png differ diff --git a/mover/nextuser/co-learn-2411/images/image-20241114122522533.png b/mover/nextuser/co-learn-2411/images/image-20241114122522533.png new file mode 100644 index 000000000..d6a8e42e5 Binary files /dev/null and b/mover/nextuser/co-learn-2411/images/image-20241114122522533.png differ diff --git a/mover/nextuser/co-learn-2411/images/readme.md b/mover/nextuser/co-learn-2411/images/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/nextuser/co-learn-2411/project/readme.md b/mover/nextuser/co-learn-2411/project/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/nextuser/co-learn-2411/project/readme.md @@ -0,0 +1 @@ + diff --git a/mover/nextuser/co-learn-2411/readme.md b/mover/nextuser/co-learn-2411/readme.md new file mode 100644 index 000000000..61c34604f --- /dev/null +++ b/mover/nextuser/co-learn-2411/readme.md @@ -0,0 +1,70 @@ +# 这个模板是2024年11月份的共学营才需要的 + +## b站,推特关注 + +- [] b站,推特关注截图: + +- ![image-20241114121009117](images/image-20241114121009117.png) + + ![image-20241114120917806](images/image-20241114120917806.png) + +- ![b站关注截图] + +- ![关注截图](images/image-20241114120648749.png) + + + +* git 关注 star + + ![image-20241114122522533](images/image-20241114122522533.png) + +## 为共学营宣传(在朋友圈或者群聊中转发海报/文章) + +- [] 宣传截图:![宣传截图](./images/你的图片地址) + +## 每周课程学习 + +- [] 第一周: + + ![学习记录截图](images/image-20241114072054746.png) + +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 参加直播答疑 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 群里分享学习笔记 + +- [] 第一篇笔记 +- [] 第二篇笔记 +- [] 第三篇笔记 +- [] 第四篇笔记 + +## 对外输出学习笔记 + +- [] 第一篇笔记【学习笔记链接】 +- [] 第二篇笔记【学习笔记链接】 +- [] 第三篇笔记【学习笔记链接】 +- [] 第四篇笔记【学习笔记链接】 + +## 在HOH社区公众号发布自己的技术文章 + +- [] 第一篇笔记【公众号文章链接】 +- [] 第二篇笔记【公众号文章链接】 +- [] 第三篇笔记【公众号文章链接】 +- [] 第四篇笔记【公众号文章链接】 + +## 直播分享学习技巧/工具推荐 + +- [] 会议截图:![会议记录截图](./images/你的图片地址) + +## 提交项目 + +- [] 项目提交![项目截图](./images/你的图片地址) + diff --git a/mover/nextuser/code/readme.md b/mover/nextuser/code/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/nextuser/code/task1/hello_move/Move.lock b/mover/nextuser/code/task1/hello_move/Move.lock new file mode 100644 index 000000000..d8190b5e2 --- /dev/null +++ b/mover/nextuser/code/task1/hello_move/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "15C92DB7143AE506431E8FE14625189CE312456B12D01A47D7711D0BFBD6A124" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", 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.testnet] +chain-id = "4c78adac" +original-published-id = "0xe1e783c536f5c11b00a624a7de9b58a55e91ae25763c27b1de6382ec54450541" +latest-published-id = "0xe1e783c536f5c11b00a624a7de9b58a55e91ae25763c27b1de6382ec54450541" +published-version = "1" diff --git a/mover/nextuser/code/task1/hello_move/Move.toml b/mover/nextuser/code/task1/hello_move/Move.toml new file mode 100644 index 000000000..2fd3b0f2a --- /dev/null +++ b/mover/nextuser/code/task1/hello_move/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hello_move" +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/testnet" } + +# 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] +hello_move = "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/nextuser/code/task1/hello_move/sources/hello_move.move b/mover/nextuser/code/task1/hello_move/sources/hello_move.move new file mode 100644 index 000000000..8a4c9ffbd --- /dev/null +++ b/mover/nextuser/code/task1/hello_move/sources/hello_move.move @@ -0,0 +1,22 @@ +/* +/// Module: hello_move +module hello_move::hello_move; +*/ +module hello_move::hello { + use std::ascii::{String, string}; + use sui::transfer::transfer; + use sui::tx_context::{sender}; + + public struct Hello has key{ + id:UID, + say: String + } + + fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id:object::new(ctx), + say: string(b"nextuser"), + }; + transfer(hello_move, sender(ctx)); + } +} diff --git a/mover/nextuser/code/task1/hello_move/sui.sh b/mover/nextuser/code/task1/hello_move/sui.sh new file mode 100644 index 000000000..8b938f10e --- /dev/null +++ b/mover/nextuser/code/task1/hello_move/sui.sh @@ -0,0 +1 @@ +sui move build --skip-fetch-latest-git-deps diff --git a/mover/nextuser/code/task1/hello_move/tests/client-testnet.log b/mover/nextuser/code/task1/hello_move/tests/client-testnet.log new file mode 100644 index 000000000..14c40d662 --- /dev/null +++ b/mover/nextuser/code/task1/hello_move/tests/client-testnet.log @@ -0,0 +1,150 @@ +ljl@ljl-i5-14400:~/work/sui/nextuser/code/task1/hello_move$ sui client publish +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.37.2 +UPDATING GIT DEPENDENCY https://gitee.com/MystenLabs/sui.git +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING hello_move +Successfully verified dependencies on-chain against source. +Transaction Digest: 3NqegjxVqgF1z3oGfsjCPTrNuTQxjskqXr2Byoxj8DB7 +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 10831200 MIST │ +│ Gas Price: 1000 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Version: 236167300 │ +│ │ Digest: CutjuoxfGFQqehVMuazzMAjBpB1Qjt1Y6nAQxEVMSL8z │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ ruc4uxVATDRWq09m+7s7fjFvV2FawQaosnBJNHdrcGcjS1N6Nfb8kZeMVFsATz2O0nztJiLofblUmH2gItZggg== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 3NqegjxVqgF1z3oGfsjCPTrNuTQxjskqXr2Byoxj8DB7 │ +│ Status: Success │ +│ Executed Epoch: 552 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x6bad4dcb4734fdba981ac24f8e509e0c5036e34c16ef1ec1048eb949b62ab039 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 236167301 │ +│ │ Digest: 47jJ6srqh3obj1P7VDR1q2tXpFg9Nz8WEEL3Ak52Q6pT │ +│ └── │ +│ ┌── │ +│ │ ID: 0xe1e783c536f5c11b00a624a7de9b58a55e91ae25763c27b1de6382ec54450541 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: EmjbGsqs72r47gGXHsRkZKhjQA4qKu2wY48gnWA2qmo7 │ +│ └── │ +│ ┌── │ +│ │ ID: 0xed5c00c2543a5e1ff165f5a2cf5afeae66f256c4237b4bd8f8a04791054bd1ec │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 236167301 │ +│ │ Digest: 6wNtJMK3ZqkRvijgFqjp9bsQN6oeyZLpz4DVF9wmr1Xf │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 236167301 │ +│ │ Digest: BVzMdApsYQ3vrn4XjRBcmTvCuwEcK71YBE3Gye4UWT8B │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 236167301 │ +│ │ Digest: BVzMdApsYQ3vrn4XjRBcmTvCuwEcK71YBE3Gye4UWT8B │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 8831200 MIST │ +│ Computation Cost: 1000000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ FURb5iFqnqF7rziXkUMypxPkYAPCyvQoHbJPPDMcDP1P │ +│ GMBJA2gEEvtwv1wGGT7ZEDkQdrmUTKaE4TeinNGQ2feC │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├──────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x6bad4dcb4734fdba981ac24f8e509e0c5036e34c16ef1ec1048eb949b62ab039 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0xe1e783c536f5c11b00a624a7de9b58a55e91ae25763c27b1de6382ec54450541::hello::Hello │ +│ │ Version: 236167301 │ +│ │ Digest: 47jJ6srqh3obj1P7VDR1q2tXpFg9Nz8WEEL3Ak52Q6pT │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xed5c00c2543a5e1ff165f5a2cf5afeae66f256c4237b4bd8f8a04791054bd1ec │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 236167301 │ +│ │ Digest: 6wNtJMK3ZqkRvijgFqjp9bsQN6oeyZLpz4DVF9wmr1Xf │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 236167301 │ +│ │ Digest: BVzMdApsYQ3vrn4XjRBcmTvCuwEcK71YBE3Gye4UWT8B │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0xe1e783c536f5c11b00a624a7de9b58a55e91ae25763c27b1de6382ec54450541 │ +│ │ Version: 1 │ +│ │ Digest: EmjbGsqs72r47gGXHsRkZKhjQA4qKu2wY48gnWA2qmo7 │ +│ │ Modules: hello │ +│ └── │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -8853080 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/mover/nextuser/code/task1/hello_move/tests/hello_move_tests.move b/mover/nextuser/code/task1/hello_move/tests/hello_move_tests.move new file mode 100644 index 000000000..7798d8dda --- /dev/null +++ b/mover/nextuser/code/task1/hello_move/tests/hello_move_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hello_move::hello_move_tests; +// uncomment this line to import the module +// use hello_move::hello_move; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hello_move() { + // pass +} + +#[test, expected_failure(abort_code = ::hello_move::hello_move_tests::ENotImplemented)] +fun test_hello_move_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nextuser/code/task3/nft_author/Move.lock b/mover/nextuser/code/task3/nft_author/Move.lock new file mode 100644 index 000000000..7940a8b9a --- /dev/null +++ b/mover/nextuser/code/task3/nft_author/Move.lock @@ -0,0 +1,40 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "775634D66A8FB4B22F1B98A9F7E11F274BAE86163A5DF0A7AFB365DFD1B032E7" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", 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.testnet] +chain-id = "4c78adac" +original-published-id = "0xa405ea3cde3a029ec5143b62c348f96ebf08675b81a73f6f6d715917e62eb43a" +latest-published-id = "0xa405ea3cde3a029ec5143b62c348f96ebf08675b81a73f6f6d715917e62eb43a" +published-version = "1" + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f" +latest-published-id = "0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f" +published-version = "1" diff --git a/mover/nextuser/code/task3/nft_author/Move.toml b/mover/nextuser/code/task3/nft_author/Move.toml new file mode 100644 index 000000000..1fb8e4977 --- /dev/null +++ b/mover/nextuser/code/task3/nft_author/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "nft_author" +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/testnet" } + +# 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] +nft_author = "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/nextuser/code/task3/nft_author/client-mainnet.log b/mover/nextuser/code/task3/nft_author/client-mainnet.log new file mode 100644 index 000000000..dc020d060 --- /dev/null +++ b/mover/nextuser/code/task3/nft_author/client-mainnet.log @@ -0,0 +1,218 @@ +ljl@ljl-i5-14400:~/work/sui/nextuser/code/task3/nft_author$ sui client publish --skip-dependency-verification +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.36.2 +UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git +^C +ljl@ljl-i5-14400:~/work/sui/nextuser/code/task3/nft_author$ sui client publish --skip-dependency-verification +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.36.2 +UPDATING GIT DEPENDENCY https://gitee.com/MystenLabs/sui.git +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING nft_author +Skipping dependency verification +Transaction Digest: F1J7GBm1unSLdet5zJQHq44rnzZXLCqv5e3WgvGg2Gvw +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 19200400 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Version: 415586834 │ +│ │ Digest: DRsx1mPqznKV9suBrc7RCR99c7WESL7Ji61kQ2tus8sf │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ VnkTzc2HJYWCySrW8BbFQSjdRzz6mgPaoRgATde1+YctpY/xrnpFof3D//k8GW5eqbC/uG/box6yP+GGIieJ1w== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: F1J7GBm1unSLdet5zJQHq44rnzZXLCqv5e3WgvGg2Gvw │ +│ Status: Success │ +│ Executed Epoch: 580 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x7f60e62f2fe72bdfc76841210435dcb3969387b8c1d74b96c6162206d3e20774 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586835 │ +│ │ Digest: 2pXTsqDKVYK2C5TvWseXDMc4JKjPKU1icUrZ8YSsLkL8 │ +│ └── │ +│ ┌── │ +│ │ ID: 0xb31a9c9d53f02ba0c1d89966f86372a0b683a9d13d475d4011e692621955d1cb │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586835 │ +│ │ Digest: 2H1L1zJtZTZNfVKrqafhDtfyGo2tnQJEZgo7WmJk8VMT │ +│ └── │ +│ ┌── │ +│ │ ID: 0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: AWsH5LoGryBRyWJdqg2TLgstha4TYc29tT6S64zcNuAp │ +│ └── │ +│ ┌── │ +│ │ ID: 0xf8fdfce05160b328a2112719a9af3ccf608d49465ee703cb74c9fca04a5703e5 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586835 │ +│ │ Digest: D4KaPQzLnoKF5kgpWe8Fx4Kgv5yoRuNntAfAYZH3TYxt │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586835 │ +│ │ Digest: CwWhCjXQtJ9TsupFU31YGfja1HNLqSoG64XuoXyViXXM │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586835 │ +│ │ Digest: CwWhCjXQtJ9TsupFU31YGfja1HNLqSoG64XuoXyViXXM │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 17700400 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 49puDQZwHRnu7zYoARCjco1dFKMiK7LVSS8B5Si1yVdh │ +│ 6ikiNifs7P194KBXkfRzc2rYEpc8k9urhUzAVMxhWzar │ +│ 8MkMyu5cseLwqyWDwg947q7U2d7ipSoGu9LZQh744JRJ │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Block Events │ +├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ EventID: F1J7GBm1unSLdet5zJQHq44rnzZXLCqv5e3WgvGg2Gvw:0 │ +│ │ PackageID: 0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f │ +│ │ Transaction Module: nft_author │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ EventType: 0x2::display::DisplayCreated<0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f::nft_author::Author> │ +│ │ ParsedJSON: │ +│ │ ┌────┬────────────────────────────────────────────────────────────────────┐ │ +│ │ │ id │ 0x7f60e62f2fe72bdfc76841210435dcb3969387b8c1d74b96c6162206d3e20774 │ │ +│ │ └────┴────────────────────────────────────────────────────────────────────┘ │ +│ └── │ +│ ┌── │ +│ │ EventID: F1J7GBm1unSLdet5zJQHq44rnzZXLCqv5e3WgvGg2Gvw:1 │ +│ │ PackageID: 0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f │ +│ │ Transaction Module: nft_author │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ EventType: 0x2::display::VersionUpdated<0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f::nft_author::Author> │ +│ │ ParsedJSON: │ +│ │ ┌─────────┬──────────┬───────┬──────────────────────────────────────────────────┐ │ +│ │ │ fields │ contents │ key │ name │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ value │ {name} │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ key │ link │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ value │ https://github.com/{name} │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ key │ image_url │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ value │ {image_url} │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ key │ description │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ value │ simple nft with the image icon from github user │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ key │ project_url │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ value │ https://github.com/{name}/letsmove │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ key │ creator │ │ +│ │ │ │ ├───────┼──────────────────────────────────────────────────┤ │ +│ │ │ │ │ value │ charles j lee │ │ +│ │ ├─────────┼──────────┴───────┴──────────────────────────────────────────────────┤ │ +│ │ │ id │ 0x7f60e62f2fe72bdfc76841210435dcb3969387b8c1d74b96c6162206d3e20774 │ │ +│ │ ├─────────┼─────────────────────────────────────────────────────────────────────┤ │ +│ │ │ version │ 1 │ │ +│ │ └─────────┴─────────────────────────────────────────────────────────────────────┘ │ +│ └── │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x7f60e62f2fe72bdfc76841210435dcb3969387b8c1d74b96c6162206d3e20774 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::display::Display<0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f::nft_author::Author> │ +│ │ Version: 415586835 │ +│ │ Digest: 2pXTsqDKVYK2C5TvWseXDMc4JKjPKU1icUrZ8YSsLkL8 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xb31a9c9d53f02ba0c1d89966f86372a0b683a9d13d475d4011e692621955d1cb │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 415586835 │ +│ │ Digest: 2H1L1zJtZTZNfVKrqafhDtfyGo2tnQJEZgo7WmJk8VMT │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xf8fdfce05160b328a2112719a9af3ccf608d49465ee703cb74c9fca04a5703e5 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::package::Publisher │ +│ │ Version: 415586835 │ +│ │ Digest: D4KaPQzLnoKF5kgpWe8Fx4Kgv5yoRuNntAfAYZH3TYxt │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 415586835 │ +│ │ Digest: CwWhCjXQtJ9TsupFU31YGfja1HNLqSoG64XuoXyViXXM │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f │ +│ │ Version: 1 │ +│ │ Digest: AWsH5LoGryBRyWJdqg2TLgstha4TYc29tT6S64zcNuAp │ +│ │ Modules: nft_author │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -17472280 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +ljl@ljl-i5-14400:~/work/sui/nextuser/code/task3/nft_author$ \ No newline at end of file diff --git a/mover/nextuser/code/task3/nft_author/sources/nft_author.move b/mover/nextuser/code/task3/nft_author/sources/nft_author.move new file mode 100644 index 000000000..2c3bf7eb3 --- /dev/null +++ b/mover/nextuser/code/task3/nft_author/sources/nft_author.move @@ -0,0 +1,61 @@ +module nft_author::nft_author; +use std::string::{String}; +use sui::package; +use sui::display; + +public struct NFT_AUTHOR has drop { } + +public struct Author has key{ + id : UID, + name : String, + image_url : String, +} + +fun init(otw : NFT_AUTHOR,ctx : &mut TxContext ){ + + let keys = vector[ + b"name".to_string(), + b"link".to_string(), + b"image_url".to_string(), + b"description".to_string(), + b"project_url".to_string(), + b"creator".to_string(), + ]; + + let values = vector[ + // For `name` one can use the `Author.name` property + b"{name}".to_string(), + // For `link` one can build a URL using an `name` property + b"https://github.com/{name}".to_string(), + //image url + b"{image_url}".to_string(), + //description: + b"simple nft with the image icon from github user ".to_string(), + // project url + b"https://github.com/{name}/letsmove".to_string(), + // Creator field can be any + b"charles j lee".to_string(), + ]; + + + let publisher = package::claim(otw,ctx); + + let mut display = display::new_with_fields(&publisher,keys,values,ctx); + display.update_version(); + + transfer::public_transfer(publisher,ctx.sender()); + transfer::public_transfer(display , ctx.sender()); + +} + + +public entry fun mint(name :String,image_url:String,to : address, ctx : &mut TxContext) { + + let author = Author{ + id : object::new(ctx), + name : name , + image_url: image_url, + }; + + transfer::transfer(author,to); +} \ No newline at end of file diff --git a/mover/nextuser/code/task3/nft_author/tests/nft_author_tests.move b/mover/nextuser/code/task3/nft_author/tests/nft_author_tests.move new file mode 100644 index 000000000..efbb63aa9 --- /dev/null +++ b/mover/nextuser/code/task3/nft_author/tests/nft_author_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module nft_author::nft_author_tests; +// uncomment this line to import the module +// use nft_author::nft_author; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_nft_author() { + // pass +} + +#[test, expected_failure(abort_code = ::nft_author::nft_author_tests::ENotImplemented)] +fun test_nft_author_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nextuser/images/01-package.jpg b/mover/nextuser/images/01-package.jpg new file mode 100644 index 000000000..6300140b1 Binary files /dev/null and b/mover/nextuser/images/01-package.jpg differ diff --git a/mover/nextuser/images/01-wallet.jpg b/mover/nextuser/images/01-wallet.jpg new file mode 100644 index 000000000..4faeab33f Binary files /dev/null and b/mover/nextuser/images/01-wallet.jpg differ diff --git a/mover/nextuser/images/image-20241113222340749.png b/mover/nextuser/images/image-20241113222340749.png new file mode 100644 index 000000000..09a15d205 Binary files /dev/null and b/mover/nextuser/images/image-20241113222340749.png differ diff --git a/mover/nextuser/images/image-20241113230252716.png b/mover/nextuser/images/image-20241113230252716.png new file mode 100644 index 000000000..3f80c7f66 Binary files /dev/null and b/mover/nextuser/images/image-20241113230252716.png differ diff --git a/mover/nextuser/images/image-20241114000654688.png b/mover/nextuser/images/image-20241114000654688.png new file mode 100644 index 000000000..85d80e04b Binary files /dev/null and b/mover/nextuser/images/image-20241114000654688.png differ diff --git a/mover/nextuser/notes/images/4c9df0a037a48da78f174af4c63b80a.jpg b/mover/nextuser/notes/images/4c9df0a037a48da78f174af4c63b80a.jpg new file mode 100644 index 000000000..1f802bb14 Binary files /dev/null and b/mover/nextuser/notes/images/4c9df0a037a48da78f174af4c63b80a.jpg differ diff --git a/mover/nextuser/notes/images/77cab47def96df0bfa0bc2000f6533c.png b/mover/nextuser/notes/images/77cab47def96df0bfa0bc2000f6533c.png new file mode 100644 index 000000000..222e23309 Binary files /dev/null and b/mover/nextuser/notes/images/77cab47def96df0bfa0bc2000f6533c.png differ diff --git a/mover/nextuser/notes/images/8983d211b2b1dceaf57ffe22183c955.png b/mover/nextuser/notes/images/8983d211b2b1dceaf57ffe22183c955.png new file mode 100644 index 000000000..c39a941b1 Binary files /dev/null and b/mover/nextuser/notes/images/8983d211b2b1dceaf57ffe22183c955.png differ diff --git a/mover/nextuser/notes/images/b751b6d5fe797767bdc15617707d711.jpg b/mover/nextuser/notes/images/b751b6d5fe797767bdc15617707d711.jpg new file mode 100644 index 000000000..5cb7c62bd Binary files /dev/null and b/mover/nextuser/notes/images/b751b6d5fe797767bdc15617707d711.jpg differ diff --git a/mover/nextuser/notes/images/eee52dccc6c1235a42e6b2025f3accc.png b/mover/nextuser/notes/images/eee52dccc6c1235a42e6b2025f3accc.png new file mode 100644 index 000000000..82c8458bd Binary files /dev/null and b/mover/nextuser/notes/images/eee52dccc6c1235a42e6b2025f3accc.png differ diff --git a/mover/nextuser/notes/images/image-20241108082047823.png b/mover/nextuser/notes/images/image-20241108082047823.png new file mode 100644 index 000000000..f9111c4d5 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241108082047823.png differ diff --git a/mover/nextuser/notes/images/image-20241109194128504.png b/mover/nextuser/notes/images/image-20241109194128504.png new file mode 100644 index 000000000..67b0c4552 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241109194128504.png differ diff --git a/mover/nextuser/notes/images/image-20241109195458570.png b/mover/nextuser/notes/images/image-20241109195458570.png new file mode 100644 index 000000000..49948a949 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241109195458570.png differ diff --git a/mover/nextuser/notes/images/image-20241109195541791.png b/mover/nextuser/notes/images/image-20241109195541791.png new file mode 100644 index 000000000..49948a949 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241109195541791.png differ diff --git a/mover/nextuser/notes/images/image-20241110213627080.png b/mover/nextuser/notes/images/image-20241110213627080.png new file mode 100644 index 000000000..730988689 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241110213627080.png differ diff --git a/mover/nextuser/notes/images/image-20241110213815476.png b/mover/nextuser/notes/images/image-20241110213815476.png new file mode 100644 index 000000000..459a2b346 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241110213815476.png differ diff --git a/mover/nextuser/notes/images/image-20241110214031742.png b/mover/nextuser/notes/images/image-20241110214031742.png new file mode 100644 index 000000000..fbdc15968 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241110214031742.png differ diff --git a/mover/nextuser/notes/images/image-20241110214212301.png b/mover/nextuser/notes/images/image-20241110214212301.png new file mode 100644 index 000000000..94ad818e3 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241110214212301.png differ diff --git a/mover/nextuser/notes/images/image-20241110223619372.png b/mover/nextuser/notes/images/image-20241110223619372.png new file mode 100644 index 000000000..def58c70c Binary files /dev/null and b/mover/nextuser/notes/images/image-20241110223619372.png differ diff --git a/mover/nextuser/notes/images/image-20241110231811470.png b/mover/nextuser/notes/images/image-20241110231811470.png new file mode 100644 index 000000000..43d6dacdf Binary files /dev/null and b/mover/nextuser/notes/images/image-20241110231811470.png differ diff --git a/mover/nextuser/notes/images/image-20241110234724177.png b/mover/nextuser/notes/images/image-20241110234724177.png new file mode 100644 index 000000000..97ce5b321 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241110234724177.png differ diff --git a/mover/nextuser/notes/images/image-20241111105759963.png b/mover/nextuser/notes/images/image-20241111105759963.png new file mode 100644 index 000000000..5da73a448 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111105759963.png differ diff --git a/mover/nextuser/notes/images/image-20241111110333165.png b/mover/nextuser/notes/images/image-20241111110333165.png new file mode 100644 index 000000000..e25f6204d Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111110333165.png differ diff --git a/mover/nextuser/notes/images/image-20241111110430310.png b/mover/nextuser/notes/images/image-20241111110430310.png new file mode 100644 index 000000000..66af649ce Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111110430310.png differ diff --git a/mover/nextuser/notes/images/image-20241111114413049.png b/mover/nextuser/notes/images/image-20241111114413049.png new file mode 100644 index 000000000..f707e1b76 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111114413049.png differ diff --git a/mover/nextuser/notes/images/image-20241111124128818.png b/mover/nextuser/notes/images/image-20241111124128818.png new file mode 100644 index 000000000..c18bc8520 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111124128818.png differ diff --git a/mover/nextuser/notes/images/image-20241111141423819.png b/mover/nextuser/notes/images/image-20241111141423819.png new file mode 100644 index 000000000..9c295a599 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111141423819.png differ diff --git a/mover/nextuser/notes/images/image-20241111194357890.png b/mover/nextuser/notes/images/image-20241111194357890.png new file mode 100644 index 000000000..60031c109 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111194357890.png differ diff --git a/mover/nextuser/notes/images/image-20241111194804064.png b/mover/nextuser/notes/images/image-20241111194804064.png new file mode 100644 index 000000000..678eb77a0 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111194804064.png differ diff --git a/mover/nextuser/notes/images/image-20241111213310276.png b/mover/nextuser/notes/images/image-20241111213310276.png new file mode 100644 index 000000000..252e051a0 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111213310276.png differ diff --git a/mover/nextuser/notes/images/image-20241111213346673.png b/mover/nextuser/notes/images/image-20241111213346673.png new file mode 100644 index 000000000..632fc0ace Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111213346673.png differ diff --git a/mover/nextuser/notes/images/image-20241111213712296.png b/mover/nextuser/notes/images/image-20241111213712296.png new file mode 100644 index 000000000..d9a65ec88 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111213712296.png differ diff --git a/mover/nextuser/notes/images/image-20241111215745220.png b/mover/nextuser/notes/images/image-20241111215745220.png new file mode 100644 index 000000000..f78885f4a Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111215745220.png differ diff --git a/mover/nextuser/notes/images/image-20241111221059544.png b/mover/nextuser/notes/images/image-20241111221059544.png new file mode 100644 index 000000000..70321cc5e Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111221059544.png differ diff --git a/mover/nextuser/notes/images/image-20241111221218590.png b/mover/nextuser/notes/images/image-20241111221218590.png new file mode 100644 index 000000000..0bb98ac89 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241111221218590.png differ diff --git a/mover/nextuser/notes/images/image-20241114080921239.png b/mover/nextuser/notes/images/image-20241114080921239.png new file mode 100644 index 000000000..321ee304b Binary files /dev/null and b/mover/nextuser/notes/images/image-20241114080921239.png differ diff --git a/mover/nextuser/notes/images/image-20241114081255239.png b/mover/nextuser/notes/images/image-20241114081255239.png new file mode 100644 index 000000000..aa7787c09 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241114081255239.png differ diff --git a/mover/nextuser/notes/images/image-20241114082116871.png b/mover/nextuser/notes/images/image-20241114082116871.png new file mode 100644 index 000000000..1c73142f6 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241114082116871.png differ diff --git a/mover/nextuser/notes/images/image-20241114085958845.png b/mover/nextuser/notes/images/image-20241114085958845.png new file mode 100644 index 000000000..e4b000a97 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241114085958845.png differ diff --git a/mover/nextuser/notes/images/image-20241114090945642.png b/mover/nextuser/notes/images/image-20241114090945642.png new file mode 100644 index 000000000..9eda02c15 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241114090945642.png differ diff --git a/mover/nextuser/notes/images/image-20241114091033160.png b/mover/nextuser/notes/images/image-20241114091033160.png new file mode 100644 index 000000000..d9e1b1b91 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241114091033160.png differ diff --git a/mover/nextuser/notes/images/image-20241114095326972.png b/mover/nextuser/notes/images/image-20241114095326972.png new file mode 100644 index 000000000..2ea9f93c8 Binary files /dev/null and b/mover/nextuser/notes/images/image-20241114095326972.png differ diff --git a/mover/nextuser/notes/lesson6.md b/mover/nextuser/notes/lesson6.md new file mode 100644 index 000000000..f5c3acfb9 --- /dev/null +++ b/mover/nextuser/notes/lesson6.md @@ -0,0 +1,38 @@ +## npm mirror + +dapp下载创建,需要设置国内mirror,访问速度更快 + +```bash +npm set registry https://mirrors.huaweicloud.com/repository/npm +npm create @mysten/dapp +``` + + # 进入创建的目录,安装以来的包 + +```bash +cd acounter +npm install +``` + +### 发布包 +sui client publish +### 确定当前环境 + +```bash +sui client active-address +sui client active-env +``` + +### 创建counter对象 +```bash +export PKG=0x9f60ac2a1f47aa738939953e9f30b9e21ff94f6b30f2cf0648658d1f84c7b0a0 +sui client call --package $PKG --module counter --function create +``` + +### 调用increment(counter) + +```bash +export COUNTER=0xc89f34c40908cb4412d730d2e16994b380ccf56944c6eca4080010e5ae48cae3 +sui client call --package $PKG --module counter --function increment --args $COUNTER +sui client object $COUNTER +``` \ No newline at end of file diff --git a/mover/nextuser/notes/readme.md b/mover/nextuser/notes/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/nextuser/notes/task1.md b/mover/nextuser/notes/task1.md new file mode 100644 index 000000000..317e3ad49 --- /dev/null +++ b/mover/nextuser/notes/task1.md @@ -0,0 +1,1135 @@ + + + + + + +2024 -11-11 第一周Move 课程答疑问题 + +### 1 github 下载问题,编译时不能访问github路径 + +![77cab47def96df0bfa0bc2000f6533c](images/77cab47def96df0bfa0bc2000f6533c.png) + + + +* 对策: + +修改Move.toml 中的github成gitee + +``` +[dependencies] +#Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +Sui = { git = "https://gitee.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +``` + + + + ### 2 git pull pull不下来,报错过早文件结束 + + + +#### 2.1 如果是 github下载问题,更换是gitee + +``` +[dependencies] +#Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +Sui = { git = "https://gitee.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +``` + +#### 2.2 gitee下载存在问题 + +* 对策: + + * windows: 使用git bash 执行以下命令,将代码下载到本地 + + * 采用 ssh 下载 + + 如 + + ```bash + git clone git@gitee.com:mystenLabs/sui.git + ``` + + + +* 方法一 :代码可以使用百度网盘下载 + + 提取码task + + ``` + https://pan.baidu.com/s/1LQwwlPz6Q2DVAod-DhD1UA + ``` + + ![image-20241111124128818](images/image-20241111124128818.png) + + + + 解压到本地路径 + + * linux如下命令 + +```bash +mkdir ~/sui-local +cd ~/sui-local +git clone git@gitee.com:mystenLabs/sui.git +git checkout framework/testnet +git pull +``` + + + +#### 2.3 修改 Move.toml ,sui框架依赖本地代码 + +* 确定 用户的主目录 + + ```bash {.line-numbers} + ljl@ljl-i5-14400:~/work/sui/demo/table_example$ cd ~ + ljl@ljl-i5-14400:~$ pwd + /home/ljl + ``` + + + +* 例子中的/home/ljl 是我的主目录,你可以更换成你下载的sui 代码路径 + +```toml +[dependencies] +#Sui = { git = "https://gitee.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +Sui = {local="/home/ljl/sui-local/sui/crates/sui-framework/packages/sui-framework" } + +``` + + + + + + + +### 问题3. 每次编译都提示, fail to resolve dependencies 问题 + +![eee52dccc6c1235a42e6b2025f3accc](images/eee52dccc6c1235a42e6b2025f3accc.png) + +#### 3.1 原因 + +github网络访问比较困难 + +#### 3.2 对策 + +* 方法1 修改工程 + +```bash {.line-numbers} +#Move.toml +[dependencies] +Sui = { git = "https://gitee.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +``` + +* 方法2 + + ```bash {.line-numbers} + sui move --skip-fetch-latest-git-deps build + ``` + + + + 可以写一个suib的脚本, 后续执行 suib即可 + + ```bash {.line-numbers} + ljl@ljl-i5-14400:~/work/sui/demo/bb$ cat /usr/bin/suib + sui move build --skip-fetch-latest-git-deps + + ``` + + + +### 4 publish 失败的原因, 不能找到 clien/server api version mismatch + +![b751b6d5fe797767bdc15617707d711](images/b751b6d5fe797767bdc15617707d711.jpg) + + + +这个是因为sui client的版本比较老,testnet已经是1.37.1 + +* 方法一 + +应该是安装的sui 二进制文件版本比较老,需要从服务器下载更新的sui 二进制文件 + + https://github.com/MystenLabs/sui/releases/tag/testnet-v1.37.1 + +也有可能是 gitee上的代码比较老, 需要更换Move.toml中dependencies 的以来路径 + +* 方法二 + +```bash + +sui client publish --skip-dependency-verification + +``` + + + + + +### 5. publish问题:没有找到Move.toml (unable to find package manifest) + +![4c9df0a037a48da78f174af4c63b80a](images/4c9df0a037a48da78f174af4c63b80a.jpg) + + + + + +```bash + +D:\work\sui>sui client publish +Unable to find package manifest at '\\?\D:\work\sui/Move.toml' or in its parents +``` + +![image-20241109195541791](images/image-20241109195541791.png) + +#### 5.1 原因 + +这是因为当前路径没有找到Move.toml 文件, 因为没有cd 到项目代码中. + +如下图, sui move new 新建项目目录之后,需要cd 到项目目录里面 + + + +![image-20241109194128504](images/image-20241109194128504.png) + +参见上图中步骤,第三部需要cd 创建的项目的目录, sui move build 会在当前目录查找Move.toml + +### 6. pubish 失败,没有gas + +#### 6.1 publish失败,gas不足 + +``` +D:\work\sui\task1>sui client balance +No coins found for this address. + +D:\work\sui\task1>sui client faucet +Request successful. It can take up to 1 minute to get the coin. Run sui client gas to check your gas coins. + +D:\work\sui\task1>sui client balance +╭────────────────────────────────────────╮ +│ Balance of coins owned by this address │ +├────────────────────────────────────────┤ +│ ╭─────────────────────────────────╮ │ +│ │ coin balance (raw) balance │ │ +│ ├─────────────────────────────────┤ │ +│ │ Sui 1000000000 1.00 SUI │ │ +│ ╰─────────────────────────────────╯ │ +╰────────────────────────────────────────╯ +``` + + + +### 7. 提示 需要 --gas-budget + +```bash +Could not automatically determine the gas budget. Please supply one using the --gas-budget flag. +``` + + + +![8983d211b2b1dceaf57ffe22183c955](images/8983d211b2b1dceaf57ffe22183c955.png) + +#### 对策:提供 gas-budget 参数 + + + +```bash +sui client publish --gas-budget 40000000 +``` + + + +### 8 .提问预编译的下载包如何使用 + +### 8.1 下载sui 编译包 + +目前的sui 预编译下载包,在 + +https://github.com/MystenLabs/sui/releases + +根据不同操作系统,下载对应的包, 下载之后,需要解压文件 + +### 8.2 环境变量设置 + +##### 8.2.1 windows 的解压和path变量设置 + +windows 使用 7-zip能解压到比如 d:\app\sui 文件目录 + +![image-20241110213627080](images/image-20241110213627080.png) + + + +![image-20241110213815476](images/image-20241110213815476.png) + + + +需要在windows设置path + +![image-20241110214212301](images/image-20241110214212301.png) + +![image-20241110214031742](images/image-20241110214031742.png) + + + +##### 8.2.2 linux的解压和path 变量设置 + +###### 8.2.2.1 linux 下载文件后解压 + +下载文件到 ~/ 目录 ,下面的代码将 tgz 文件解压到sui 目录, 如果你需要 + +```bash + +ljl@ljl-i5-14400:~$ ls *.tgz +sui-testnet-v1.36.2-ubuntu-x86_64.tgz sui-testnet-v1.37.1-ubuntu-x86_64.tgz +ljl@ljl-i5-14400:~$ mkdir sui +ljl@ljl-i5-14400:~$ cd sui +ljl@ljl-i5-14400:~/sui$ tar xzf ../sui-testnet-v1.37.1-ubuntu-x86_64.tgz +ljl@ljl-i5-14400:~/sui$ ls +move-analyzer sui-bridge sui-data-ingestion sui-faucet sui-node sui-tool +sui sui-bridge-cli sui-debug sui-graphql-rpc sui-test-validator +ljl@ljl-i5-14400:~/sui$ pwd +/home/ljl/sui +``` + +* 注意$ 之前的是命令行提示 + +* 最后的pwd看到的目录和你本人用户主目录有关. + + ###### 8.2.2.2 设置 path + +- 可以修改/etc/profile 或 ~/.bashrc 文件的尾部,增加一行 + +- 注意你将/home/ljl/sui 修改成你的sui 解压的路径 + +``` +export PATH=$PATH:/home/ljl/sui +``` + +- 执行 source ~/.bashrc + + + +##### 8.2.3 mac环境变量设置 + +###### mac 的安装类似linux, 最后路径设置需要配置在 /etc/profile + + + +# + +### 9 otw 有什么用 + +* 问题: 见证者对象有什么作用,我在好几个地方看到,只知道怎么用,不知道为什么要这么写 + +otw 在coin发币的时候用得很多, 因为otw对象智能由package构造, + +而参与增加货币相关的方法,都是由一个 参数,这个类型参数是一个OTW参数. 使用OTW 类型做泛型的对象, + +只在OTW 模块初始化的时候才能创建,以后都无法创建. One time witness + +注意 + +```ts {.line-numbers} +struct Balance{} +struct Supply{} +struct Coin{} +struct TreasureCap{} +/// unique instance of CoinMetadata that stores the metadata for this coin type. +public struct CoinMetadata has key, store { + ... +} + + + +module pkg::hk{ + public struct HK has drop {}, + + init(hk:&mut HK, ctx:mut TxContext){ + let (cap,meta) = coin::create_currency(hk,&mut ctx); + } +} +``` + + + +创建的货币沾染了一个T, 这个T 是一个OTW struct, 无法创建,无法在外部使用 + +![image-20241111221059544](images/image-20241111221059544.png) + + + +![image-20241111221218590](images/image-20241111221218590.png) + +* supply对象提供了增长货币余额balance的方法, + +* balance可以转换成coin. +* sui::balance::create_supply 是最关键的创建货币的方法 +* sui::balance::create_supply 需要一个otw对象做参数. + + create_supply 需要一个otw对象. 创建货币 需要Balance,创建Balance 需要Supply, 创建Supply 需要一个otw对象hk + +```c++ +module sui::balance; +public fun balance::create_supply(_: T): Supply { + Supply { value: 0 } +} + + +public fun increase_supply(self: &mut Supply, value: u64): Balance { + assert!(value < (18446744073709551615u64 - self.value), EOverflow); + self.value = self.value + value; + Balance { value } +} + +``` + + + +sui::balance 这个Supply 和Balance 都需要一个OTW类 + +``` +public struct Supply has store { + value: u64, +} + +/// Storable balance - an inner struct of a Coin type. +/// Can be used to store coins which don't need the key ability. +public struct Balance has store { + value: u64, +} +``` + +sui::coin 也有一个type arg 需要一个OTW 类 + +``` +/// A coin of type `T` worth `value`. Transferable and storable +public struct Coin has key, store { + id: UID, + balance: Balance, +} +``` + + 我们创建货币之后,查看到的TreasuryCap,持有一个Supply对象,因此持有了增长货币的能力. + +![image-20241111110333165](images/image-20241111110333165.png) + + + +货币创建,如下图中的HK 不能手工创建,后面创建的货币,都使用HK 类型参数 + +```ts {.line-numbers} +module coin_owner::hk { + use sui::coin::create_currency; + use sui::tx_context::{TxContext, sender}; + + public struct HK has drop {} + + fun init(hk: HK, ctx: &mut TxContext) { + let (treasury_cap, coin_metadata) = + create_currency( + hk, + 8, + b"HK", + b"HK made in hongkong", + b"HK made in hongkong", + option::none(), + ctx); + transfer::public_freeze_object(coin_metadata); + let my_address = sender(ctx); + transfer::public_transfer(treasury_cap, my_address) + } +} +``` + +货币创建方法 coin::create_currency, 里面需要第一个参数 witness是 One time witness + +![image-20241111114413049](images/image-20241111114413049.png) + + + +以下推论: + +1. 定义货币的package publish之后,获得对象id ,成为pkg_id + +2. publish的时候,临时创建了一个 pkg_id::hk::HK struct的对象 + +3. coin::create_currency 创建出来了 + + + `Supply ` 对象 + 这个对象能生成 `Balance` 对象 + 能生成 `Coin` + + + 4 .只有持有`Supply` 对象才能发币, 以后无法手工创建`Supply` 对象,因为 + +`public fun balance::create_supply(_: T): Supply` 需要一个pkg_id::hk::HK 类型的对象做输入参数, package发布之后,无法通过编程创建. + +5. TreasuryCap 只是Supply 对象的一种链上存储形式. + +6. coin::create_currency 需要一个otw 对象, 这个方法才提供了CoinMetadata,才能当做真正的货币. + + ```ts {.line-numbers} + public fun create_currency( + witness: T, + decimals: u8, + symbol: vector, + name: vector, + description: vector, + icon_url: Option, + ctx: &mut TxContext, + ): (TreasuryCap, CoinMetadata) { + // Make sure there's only one instance of the type T + assert!(sui::types::is_one_time_witness(&witness), EBadWitness); + + ( + TreasuryCap { + id: object::new(ctx), + total_supply: balance::create_supply(witness), + }, + CoinMetadata { + id: object::new(ctx), + decimals, + name: string::utf8(name), + symbol: ascii::string(symbol), + description: string::utf8(description), + icon_url, + }, + ) + } + + ``` + +7. 虽然也可以用balance::createSupply创建其他类型的balance 和coin,但是会当做其他对象看待. + + 下文中不使用otw创建的Supply,可以用来创建balance和coin. + + 不同用户都可以调用这个mint_to 方法. 创建出来的coin 不能视为代币,使用 sui client balance 不能看到. 因为没有对应的CoinMetadata + + ``` ts {.line-numbers} + + module strange_coin::jp; + use sui::balance::{Supply,Balance}; + public struct Other has drop{} + public struct SupplyHold has key,store{ + id : UID, + supply :Supply, + } + public entry fun mint_to(amount :u64,to:address,ctx : &mut TxContext){ + let other = Other{}; + let mut supply = sui::balance::create_supply(other); + let balance = supply.increase_supply(amount); + let coin = sui::coin::from_balance(balance, ctx); + let hold = SupplyHold{ + id : object::new(ctx), + supply, + }; + transfer::public_transfer(hold,tx_context::sender(ctx)); + transfer::public_transfer(coin,to); + } + ``` + + + +### 10. move table 对象的链上查看问题 + +- 问题查看 + +move 中 Table 是通过 dynamic field 实现的,在浏览器中似乎没有办法查到 table 中所有的数据,table 对应的那个 object id 在sui浏览器中也无法访问。只是浏览器不支持,还是说不能实现在链下查到 table 里所有的数据。 + +* 答复,可以看到动态字段 + + #### 10.1 直接保存的table对象 + + * 相关代码 + + ```ts {.line-numbers} + module table_example::table_example; + use sui::table::{Self,Table}; + use std::string::String; + + fun init(ctx : &mut TxContext){ + let mut tb = table::new(ctx); + tb.add(b"abc".to_string(),1); + tb.add(b"def".to_string(),2); + transfer::public_transfer(tb,tx_context::sender(ctx)); + } + ``` + + + + - 查看publish上去的对象 + + ```bash + sui client publish --skip-fetch-latest-git-deps + ``` + + 相关log + + ```bash + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + │ Object Changes │ + ├──────────────────────────────────────────────────────────────────────────────────────────────────┤ + │ Created Objects: │ + │ ┌── │ + │ │ ObjectID: 0x007c0c0b8d4139290a27523bd2645833853bfa12b6278573083abf9a8a6f8f5c │ + │ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ + │ │ Owner: Object ID: ( 0x2e05841c8910b5450efc2744ad379a2986c73cd451fcac469833d0083ccacf9c ) │ + │ │ ObjectType: 0x2::dynamic_field::Field<0x1::string::String, u32> │ + │ │ Version: 206232477 │ + │ │ Digest: 3NMXpcaGLVMa81CPJmR6Da7pKB9xdksv3qTcQzwT3Bxb │ + │ └── │ + │ ┌── │ + │ │ ObjectID: 0x2e05841c8910b5450efc2744ad379a2986c73cd451fcac469833d0083ccacf9c │ + │ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ + │ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ + │ │ ObjectType: 0x2::table::Table<0x1::string::String, u32> │ + │ │ Version: 206232477 │ + │ │ Digest: Ei39HsytUhDxrxWPX5uYohJ7CsSWbysxqvbTCEVKhZEf │ + │ └── + ``` + + + + - suiscan浏览 + + + + ``` + https://suiscan.xyz/testnet/object/0x2e05841c8910b5450efc2744ad379a2986c73cd451fcac469833d0083ccacf9c + ``` + + + +![image-20241110234724177](images/image-20241110234724177.png) + +* 相关字段 + +```ts {.line-numbers} +/// Adds a key-value pair to the table `table: &mut Table` +/// Aborts with `sui::dynamic_field::EFieldAlreadyExists` if the table already has an entry with +/// that key `k: K`. +public fun add(table: &mut Table, k: K, v: V) { + field::add(&mut table.id, k, v); + table.size = table.size + 1; +} + +``` + + + +dynamic field, 通过table address 和 属性名,一起计算字段. + +```ts {.line-numbers} +public fun add( + // we use &mut UID in several spots for access control + object: &mut UID, + name: Name, + value: Value, +) { + let object_addr = object.to_address(); + let hash = hash_type_and_key(object_addr, name); + assert!(!has_child_object(object_addr, hash), EFieldAlreadyExists); + let field = Field { + id: object::new_uid_from_hash(hash), + name, + value, + }; + add_child_object(object_addr, field) +} +``` + +#### table对象作为字段在 suivision 可以查看 + +[Sui Object](https://testnet.suivision.xyz/object/0x0a6a64b85ce448afa134c0634487bdc7bb6d4f5a621237dc92e3f1671a2467fd) + +``` +https://testnet.suivision.xyz/object/0x0a6a64b85ce448afa134c0634487bdc7bb6d4f5a621237dc92e3f1671a2467fd +``` + +```c +public struct MyStore has key ,store{ + id:UID, + total_balance : Balance, + received: Table , +} + +``` + + + +![image-20241111141423819](images/image-20241111141423819.png) + +相关对象定义: + +```ts {.line-numbers} +public struct MyStore has key ,store{ + id:UID, + total_balance : Balance, + received: Table , +} + +``` +但是相关动态字段的确看不到 + + + +### 11 sui 钱包地址和client地址 + +钱包地址与 sui 客户端地址的关系 + +* 两个不同得地址,可以认为你有两个钱包,每个钱包有不同得密码, 一般大家采用帮助记忆的12个单词来记忆 + +* 可以做钱包A中的coin 转移 到钱包B + + ```bash {.line-numbers} + + #客户端钱包的地址, + export C_ADDR="`sui client active-address`" + echo $C_ADDR + + # 浏览器钱包的地址,可以修改成你的钱包地址 + export W_ADDR=0xafe36044ef56d22494bfe6231e78dd128f097693f2d974761ee4d649e61f5fa2 + echo $W_ADDR + + # 可以查到C_ADDR 的coin + sui client gas $C_ADDR + + ljl@ljl-i5-14400:~$ sui client gas $C_ADDR + ╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮ + │ gasCoinId │ mistBalance (MIST) │ suiBalance (SUI) │ + ├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤ + │ 0xa957fcfae2a624189f4ee5e24d07be6f2e492668c8a8a3a810bb684c7ae25300 │ 3667910060 │ 3.66 │ + │ 0xb2fbb77f3168b61d21ac6c005086a1747ce451df29ade1be057c4eefcd17493b │ 1000000000 │ 1.00 │ + │ 0xda2e7328acd44f9167e306f18debf134f4200f9339241d904bc2bdd18266b00d │ 1000000000 │ 1.00 │ + ╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯ + + sui client balance $W_ADDR + # 根据输出的gasCoinId 发送给W_ADDR + export COIN=0xda2e7328acd44f9167e306f18debf134f4200f9339241d904bc2bdd18266b00d + + sui client transfer --to $W_ADDR --object-id $COIN + + # 查看钱包中的coin + + sui client gas $W_ADDR + ╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮ + │ gasCoinId │ mistBalance (MIST) │ suiBalance (SUI) │ + ├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤ + │ 0x2cbbd85ae56bb9d95746797283a6ef045fdad20d76bfe5690097f6467f96693a │ 997666048 │ 0.99 │ + │ 0x761035a215b60f6d3c08dff837b85a67f1e2620ba63a0904785924d37095c201 │ 922766720 │ 0.92 │ + │ 0xda2e7328acd44f9167e306f18debf134f4200f9339241d904bc2bdd18266b00d │ 1000000000 │ 1.00 │ + + + sui client balance $W_ADDR + ``` + + + + + +### 我们每次做publish或move-call,都需要区块链网络计算和存储,这些计算和存储需要消耗gas值。 + + + +![image-20241110231811470](images/image-20241110231811470.png) + + + +### 12 查看当前支持的网络 + +```bash + sui client envs +╭─────────┬─────────────────────────────────────┬────────╮ +│ alias │ url │ active │ +├─────────┼─────────────────────────────────────┼────────┤ +│ testnet │ https://fullnode.testnet.sui.io:443 │ * │ +│ devnet │ https://fullnode.devnet.sui.io:443 │ │ +│ local │ http://127.0.0.1:9000 │ │ +│ mainnet │ https://fullnode.mainnet.sui.io:443 │ │ +╰─────────┴─────────────────────────────────────┴────────╯ +``` + + + +配置网络devnet + +```bash +sui client new-env --alias devnet --rpc https://fullnode.devnet.sui.io:443 +``` + + + +如果没有devnet + +``` + +sui client switch --env devnet +``` + + + +### 11 自动publish到了devnet上面,不知道怎么回事,scan上面在devnet上能搜到id,但是source code显示不出 + +``` +# 查看当前的环境 +sui client envs +╭─────────┬─────────────────────────────────────┬────────╮ +│ alias │ url │ active │ +├─────────┼─────────────────────────────────────┼────────┤ +│ testnet │ https://fullnode.testnet.sui.io:443 │ │ +│ devnet │ https://fullnode.devnet.sui.io:443 │ * │ +│ local │ http://127.0.0.1:9000 │ │ +│ mainnet │ https://fullnode.mainnet.sui.io:443 │ │ +╰─────────┴─────────────────────────────────────┴────────╯ +# 带星号的是当前的环境 +sui client active-env +# 切换环境到testnet + sui client switch --env testnet +Active environment switched to [testnet] +``` + + + +### 13 ability + +* 问题: move的基础语法不熟悉,比如::是什么意思,drop、key这些都是什么含义等等,感觉可以边helloworld边讲解一下语法,每个词对应的意思,为什么需要这些 + +参看 move-book.com ,可以使用浏览器翻译查看 + +#### + +对象的4中能力(abliity) + +这四种能力是: + +- `copy` + + - 允许复制具有此功能的类型的值。 + +- `drop` + - 允许跳出作用域自动删除 + +- `store` + + - 允许具有此功能的类型的值存在于 链上中的值中。 存在sui 网络上的对象的字段 + - 对于 Sui,控制对象内部可以存储哪些[数据。](https://move-book.com/reference/abilities/object.html) 还控制哪些类型可以在其定义模块之外传 + +- `key` + - 允许类型用作存储的 “key”。表面上,这意味着该值可以是 存储中的顶级价值;换句话说,它不需要包含在另一个值中,以 在仓库里。 + + - 对于 Sui,用于表示[对象](https://move-book.com/reference/abilities/object.html)。 + +13.1 对象的几种存储状态: + +##### 13.1.1 销毁: + +* 离开作用域自动销毁,具有drop能力 + + ```ts {.line-numbers} + + public struct IgnoreMe has drop{ + a:u32, + b:u32 + } + + #[test] + fun test_ignore(){ + let im = IgnoreMe{a:3,b:4}; + print(&im); + } + ``` + + 上文定义的IgnoreMe 对象im 具有自动析构的能力`has drop`,在离开函数的作用域时候自动析构. + + + +* 编码主动析构 + + ```ts {.line-numbers} + public struct NoDrop{ value :u64 } + + #[test] + fun test_nodrop(){ + let no_drop = NoDrop{ value :34}; + print(&no_drop); + + let NoDrop{ value: _ } = no_drop; + } + ``` + +这个例子 NoDrop类型没有drop能力,对象离开作用域,需要析构,或者将对象的所有权转移. + +- 第8行是析构对象的代码 + +##### 13.1.2 转移: + +#### + + ```ts {.line-numbers} + fun useNoDrop(o : NoDrop ) : NoDrop{ + std::debug::print(&o); + o + } + + #[test] + fun testUseNoDrop(){ + let o = NoDrop{value :4}; + let d = useNoDrop(o); + NoDrop{value:_} = d; + } + ``` + +- 第1行函数UseNoDrop获得了对象o +- 第3行,函数将N哦Drop对象o 返回出去,将所有权转移出去. +- 第10 行,显示代码析构这个NoDrop对象 + + +##### 13.1.3 key:独立存储在链上: +对象独立存储在链上,必须具有key能力 `has key` + +![image-20241114085958845](images/image-20241114085958845.png) + +```ts {.line-numbers} + public struct Keyable has key{ + id : UID, + } + + #[test] + fun test_key(){ + let mut ctx = tx_context ::dummy(); + let k = Keyable{ id: object::new(&mut ctx)}; + std::debug::print(&k); + transfer::transfer(k,ctx.sender()); + } +``` +这个例子中Keyable是具有key能力的,可以通过transfer传递到sui网络上存储, 指定owner地址. + +##### 13.1.4 对象作为 共享对象存储在链上,需要具有key能力 + +![image-20241114091033160](images/image-20241114091033160.png) + +##### 13.1.4 对象作为一个对象的一部分存储,需要具有store能力 +```ts {.line-numbers} + use std::string::String; + public struct Grandson has store{ + name : String, + } + public struct Child has store{ + name : String, + child : Grandson, + } + public struct Parent has key{ + id: UID, + child: Child, + } + #[test] + fun test_store_child(){ + let mut ctx = tx_context::dummy(); + let foo = Parent { + id : object::new(&mut ctx), + child: Child { + name : b"one child".to_string(), + child: Grandson{ + name : b"a grandson".to_string(), + + }, + } + }; + std::debug::print(&foo); + transfer::freeze_object(foo); + } +``` + +- Parent是独立存储,具有key能力 + +- Child 都是作为独立存储对象Parent的字段 +- Grandson 作为Child的字段存储在链上, +- Child 和Grandson 都具有store能力 + + + +![image-20241114095326972](images/image-20241114095326972.png) + + + +原文链接:https://blog.csdn.net/ifadai/article/details/136046263 +[类型技能 - Move 参考](https://move-book.com/reference/abilities.html) + +#### 13.2 [四种能力](https://move-book.com/reference/abilities.html#the-four-abilities) + +这四种能力是: + +- `copy` + + - 允许复制具有此功能的类型的值。 + +- `drop` + + - 允许跳出作用域自动删除 + +- `store` + + - 允许具有此功能的类型的值存在于 链上中的值中。 存在sui 网络上的对象的字段 + - 对于 Sui,控制对象内部可以存储哪些[数据。](https://move-book.com/reference/abilities/object.html) 还控制哪些类型可以在其定义模块之外传 + +- `key` + + - 允许类型用作存储的 “key”。表面上,这意味着该值可以是 存储中的顶级价值;换句话说,它不需要包含在另一个值中,以 在仓库里。 + + - 对于 Sui,用于表示[对象](https://move-book.com/reference/abilities/object.html)。 + + + + + +#### 13.2.1 如果有copy能力,赋值就是拷贝成一个新对象 + +![image-20241111194804064](images/image-20241111194804064.png) + +* 上图中27行,c对象被拷贝到d,c和d指向的不是同一个对象, + +* 28 行修改了d,但是c没有被修改 +* 32行和33行中,c和d取值不同. + +#### 13.2 如果没有copy 能力,赋值就是移动对象 + +![image-20241111194357890](images/image-20241111194357890.png) + + + +#### 13.3 如果没有ability,就必须在module内提供方法去析构它 + +``` + +``` + + + +![image-20241114080921239](images/image-20241114080921239.png) + +![image-20241111213310276](images/image-20241111213310276.png) + +* 定义闪电贷的出借方,在borrow的时候获得Coin和 Loan对象, +* 在repay的时候才能销毁Loan对象, 如果借出放不调用repay,无法销毁Loan对象,交易会回滚. +* replay的时候需要校验传入的coin 要多于borrow的coin, 多出来的部分作为回报. + * 下面是 贷方代码的例子 + +```c++ {.line-numbers} +module book::loan; +//hot potato pattern +public struct Loan{ + feedback: u64, //还钱数 +} + +public struct Coin has key,store{ + id:UID, + amount:u64 +} + +//借出钱 +public fun borrow(amount:u64,ctx:&mut TxContext) :(Coin,Loan){ + let feedback = amount * 103 /100; + let c = Coin{ id: object::new(ctx),amount}; + (c, Loan{feedback}) +} + +const ErrNotEnoughFeedback:u64 = 43; +const OWNER_ADDR :address = @0xafe36044ef56d22494bfe6231e78dd128f097693f2d974761ee4d649e61f5fa2;//todo + +public fun repay(coin: Coin,loan:Loan){ + assert!(coin.amount >= loan.feedback,ErrNotEnoughFeedback); + transfer::public_transfer(coin,OWNER_ADDR); + Loan{ feedback:_} = loan; +} + +``` {.line-numbers} + +下面是借方模块的代码,使用测试代码演示 + +```c++ +#[test_only] +module book::test_loan; +use book::loan::Coin; + +////todo 贷款后赚钱的业务逻辑,这里没有实现 +fun earn_money(coin : Coin ) :Coin{ + coin +} + + +#[test] +#[expected_failure(abort_code=book::loan::ErrNotEnoughFeedback)] +fun borrow_test(){ + let mut ctx = tx_context::dummy(); + let (coin,loan) = book::loan::borrow(233,&mut ctx); + let new_money = earn_money(coin); + book::loan::repay(new_money,loan); + //todo 赚钱了,可以把feedback-amount 的钱,存入自己钱包 +} + +``` + + +#### 13.5 key ability + +目前其他模块存到链上的对象,都需要key+store能力 + +transfer::public_transfer + +transfer::public_freeze_object + +transfer::public_share_object + + + +![image-20241111213712296](images/image-20241111213712296.png) + + + +#### store + +可以作为存在链上对象的一个字段. + +![image-20241111213346673](images/image-20241111213346673.png) + + + +### 11 切割coin + +下例 从当前的余额中分割出来 0.05 个sui , 然后传给当前地址 + +```bash {.line-numbers} +export C_ADDR=`sui client active-address` + +sui client ptb \ +--split-coins gas [1000] \ +--assign coin \ +--transfer-objects [coin] @$C_ADDR \ +--gas-budget 50000000 +``` + + + + + + + +## 相关问题 + +| 2024年11月10日 11:49 | adadadadadadad | 吾妻天依美如画 | +| -------------------- | ------------------------------------------------------------ | -------------- | +| 2024年11月10日 11:52 | 完全按照视频中操作,却与视频中得到的结果不一样,可能是版本和系统不一样吧,但自己又不会调试 | 恸 | +| 2024年11月10日 11:57 | 小白提问预编译的下载包如何使用 | krypton | +| 2024年11月10日 12:00 | 见证者对象有什么作用,我在好几个地方看到,只知道怎么用,不知道为什么要这么写 | 柠栀gardenia | +| 2024年11月10日 14:02 | move 中 Table 是通过 dynamic field 实现的,在浏览器中似乎没有办法查到 table 中所有的数据,table 对应的那个 object id 在sui浏览器中也无法访问。只是浏览器不支持,还是说不能实现在链下查到 table 里所有的数据。 | Allen | +| 2024年11月10日 16:17 | 钱包地址与 sui 客户端地址的关系 | 罗基 | +| 2024年11月10日 21:05 | git pull pull不下来,报错过早文件结束 | 啊吧啊吧 | +| 2024年11月11日 12:41 | 自动publish到了devnet上面,不知道怎么回事,scan上面在devnet上能搜到id,但是source code显示不出 | 洗头就是爽 | +| 2024年11月11日 14:15 | move的基础语法不熟悉,比如::是什么意思,drop、key这些都是什么含义等等,感觉可以边helloworld边讲解一下语法,每个词对应的意思,为什么需要这些 | 周雨阳 | + + + diff --git a/mover/nextuser/readme.md b/mover/nextuser/readme.md new file mode 100644 index 000000000..6d66697f8 --- /dev/null +++ b/mover/nextuser/readme.md @@ -0,0 +1,67 @@ +## 基本信息 + +- Sui钱包地址: `0xafe36044ef56d22494bfe6231e78dd128f097693f2d974761ee4d649e61f5fa2` +> 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址 +- github: `nextuser` + +## 个人简介 +- 工作经验: 20年 +- 技术栈: `Rust` `C++` `java` `javascript` +> 重要提示 请认真写自己的简介 +- 5年web2开发经验,10年c/c++开发经验,对Move特别感兴趣,想通过Move入门区块链 +- 熟悉以太坊相关区块链技术 solidity +- 联系方式: tg: `lose_weight` wechat: `growfat` + + +## 任务 + +## 01 hello move +- [] Sui cli version: 1.37.1-7839b9501066 + +- [] Sui钱包截图: ![Sui钱包截图](images/image-20241113222340749.png) + +- [] package id: 0xe1e783c536f5c11b00a624a7de9b58a55e91ae25763c27b1de6382ec54450541[] + +- package id 在 scan上的查看截图:![Scan截图](images/image-20241113230252716.png) + + + + +## 02 move coin +- [] My Coin package id : +- [] Faucet package id : +- [] 转账 `My Coin` hash: +- [] `Faucet Coin` address1 mint hash: +- [] `Faucet Coin` address2 mint hash: + +## 03 move NFT + +- [] nft package id :0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f + +- [] nft object id : 0x92e3a52a127fda8325496807d1b91fbbc8f67a9630867f408db8350dfc46ce57 + +- [] 转账 nft hash: 6PtC65GCdxrkRUJCZ6sfTxvxVZ7bBd3R79YfCiDB8s8M + +- [] scan上的NFT截图: ![Scan截图](images/image-20241114000654688.png) + +## 04 Move Game +- [] game package id : +- [] deposit Coin hash: +- [] withdraw `Coin` hash: +- [] play game hash: + +## 05 Move Swap +- [] swap package id : +- [] call swap CoinA-> CoinB hash : +- [] call swap CoinB-> CoinA hash : + +## 06 Dapp-kit SDK PTB +- [] save hash : + +## 07 Move CTF Check In +- [] CLI call 截图 : ![截图](./images/你的图片地址) +- [] flag hash : + +## 08 Move CTF Lets Move +- [] proof : +- [] flag hash : diff --git a/mover/nextuser/readme_old.md b/mover/nextuser/readme_old.md new file mode 100644 index 000000000..a8f7d2eb0 --- /dev/null +++ b/mover/nextuser/readme_old.md @@ -0,0 +1,55 @@ +## 基本信息 +- Sui钱包地址: `0xafe36044ef56d22494bfe6231e78dd128f097693f2d974761ee4d649e61f5fa2` +> 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址 +- github: `nextuser` + +## 个人简介 +- 工作经验: 20年 +- 技术栈: `Rust` `C++` `java` `javascript` +> 重要提示 请认真写自己的简介 +- 多年web2开发经验,对Move特别感兴趣,想通过Move入门区块链 +- 熟悉以太坊相关区块链技术 solidity +- 联系方式: tg: `lose_weight` wechat: `growfat` + +## 任务 + +## 01 hello move +- [] Sui cli version:sui-client 1.36.2-3ada97c109cc +- [] Sui钱包截图: ![image-20241113222340749](images/image-20241113222340749.png) +- [] package id: 0xb374b1209c842cab56b80f298a3383c1f9015c12dbc3ea1b8d64d10b33e45c94 +- [] package id 在 scan上的查看截图:![Scan截图](./images/01-package.jpg) + +## 02 move coin +- [] My Coin package id : +- [] Faucet package id : +- [] 转账 `My Coin` hash: +- [] `Faucet Coin` address1 mint hash: +- [] `Faucet Coin` address2 mint hash: + +## 03 move NFT +- [] nft package id : +- [] nft object id : +- [] 转账 nft hash: +- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) + +## 04 Move Game +- [] game package id : +- [] deposit Coin hash: +- [] withdraw `Coin` hash: +- [] play game hash: + +## 05 Move Swap +- [] swap package id : +- [] call swap CoinA-> CoinB hash : +- [] call swap CoinB-> CoinA hash : + +## 06 Dapp-kit SDK PTB +- [] save hash : + +## 07 Move CTF Check In +- [] CLI call 截图 : ![截图](./images/你的图片地址) +- [] flag hash : + +## 08 Move CTF Lets Move +- [] proof : +- [] flag hash : diff --git a/mover/nextuser/scan/readme.md b/mover/nextuser/scan/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/nextuser/scan/readme.md @@ -0,0 +1 @@ + diff --git a/mover/qwrdxer/code/task2/task2_coin.move b/mover/qwrdxer/code/task2/task2_coin.move new file mode 100644 index 000000000..91c321004 --- /dev/null +++ b/mover/qwrdxer/code/task2/task2_coin.move @@ -0,0 +1,64 @@ + +//ref https://examples.sui-book.com/samples/coin.html + +// my coin ,只有自己能 mint burn 的coin +module task2_coin::qwrdxercoin{ + use sui::coin; + use sui::coin::{TreasuryCap, mint_and_transfer}; + + public struct QWRDXERCOIN has drop{} + fun init(witness:QWRDXERCOIN,ctx: &mut TxContext){ + let (treasury, metadata)=coin::create_currency( + witness, + 6, + b"QWRDXERCOIN", + b"", + b"", + option::none(),ctx); + transfer::public_freeze_object(metadata); + transfer::public_transfer(treasury,tx_context::sender(ctx)); + + + } + // 持有cap 的地址可以mint coin到指定地址 + public entry fun mint( + treasury_cap:&mut TreasuryCap,amount:u64,recipient:address,ctx: &mut TxContext + ){ + mint_and_transfer(treasury_cap,amount,recipient,ctx) + } + +} +//ref https://learnblockchain.cn/article/8717#%20%E5%90%88%E7%BA%A6 +//ref https://learnblockchain.cn/article/9788 +// 共享权限, 大家都能mint +module task2_coin::faucetqwrdxercoin{ + use sui::coin::{Self,TreasuryCap}; + use sui::transfer::public_share_object; + public struct FAUCETQWRDXERCOIN has drop {} + fun init(witness:FAUCETQWRDXERCOIN,ctx: &mut TxContext){ + let (treasury, metadata)=coin::create_currency( + witness, + 6, + b"FAUCETQWRDXERCOIN", + b"", + b"", + option::none(),ctx); + transfer::public_freeze_object(metadata); + public_share_object(treasury); // 共享权限 + } + // 持有cap 的地址可以mint coin到指定地址 + public entry fun mint( + treasury_cap:&mut TreasuryCap,amount:u64,recipient:address,ctx: &mut TxContext + ){ + coin::mint_and_transfer(treasury_cap,amount,recipient,ctx) + } + +} + +/* + 正确调用qwrdxercoin + sui client call --package 0x2a9a3474683292a9f88e5a404c191db5b7e9c8017380344d1ebc0d68caa3f369 --module qwrdxercoin --function mint --args 0xed02c055c9e1aad5cad787be38a1566aa3d851d94aacd62832e2e6c596b26452 10000000 0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2 --gas-budget 10000000 + 使用另一个地址调用faucet + sui client call --package 0x2a9a3474683292a9f88e5a404c191db5b7e9c8017380344d1ebc0d68caa3f369 --module faucetqwrdxercoin --function mint --args 0x16426368b63b0708ddf71d948c9d273f502785f285741508811d3b5a12d9a6f6 100000 0x527a77fde60aa65daca3d2ec5bd86595ae125edc3e957b1e33c39ea7477a825a --gas-budget 10000000 +*/ + diff --git a/mover/qwrdxer/readme.md b/mover/qwrdxer/readme.md index b013ed1e9..d06dcb3c4 100644 --- a/mover/qwrdxer/readme.md +++ b/mover/qwrdxer/readme.md @@ -19,11 +19,11 @@ - [✓] package id 在 scan上的查看截图:![Scan截图](./images/l.png) ## 02 move coin -- [] My Coin package id : -- [] Faucet package id : -- [] 转账 `My Coin` hash: -- [] `Faucet Coin` address1 mint hash: -- [] `Faucet Coin` address2 mint hash: +- [✓] My Coin package id : 0x2a9a3474683292a9f88e5a404c191db5b7e9c8017380344d1ebc0d68caa3f369 +- [✓] Faucet package id : 0x2a9a3474683292a9f88e5a404c191db5b7e9c8017380344d1ebc0d68caa3f369 +- [✓] 转账 `My Coin` hash: CkKeFBSFptCTo2Yq8DJhirsMrpkDCwhkiTCuHHWDUGaw +- [✓] `Faucet Coin` address1 mint hash:7xzyJPKZbwvh8HRC4fEsTjUKfyAqTY3SMhVY2KpQTW55 +- [✓] `Faucet Coin` address2 mint hash:GDg4keQ1fGQVjoSHwiEPeZ3D29UUWNVgAPPEB1ui2LV8 ## 03 move NFT - [] nft package id : diff --git a/mover/timecool-cpu/co-learn-2411/images/readme.md b/mover/timecool-cpu/co-learn-2411/images/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/timecool-cpu/co-learn-2411/project/readme.md b/mover/timecool-cpu/co-learn-2411/project/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/timecool-cpu/co-learn-2411/project/readme.md @@ -0,0 +1 @@ + diff --git a/mover/timecool-cpu/co-learn-2411/readme.md b/mover/timecool-cpu/co-learn-2411/readme.md new file mode 100644 index 000000000..9b3eccb1d --- /dev/null +++ b/mover/timecool-cpu/co-learn-2411/readme.md @@ -0,0 +1,54 @@ +# 这个模板是2024年11月份的共学营才需要的 + +## b站,推特关注 + +- [] b站,推特关注截图: ![关注截图](./images/你的图片地址) + +## 为共学营宣传(在朋友圈或者群聊中转发海报/文章) + +- [] 宣传截图:![宣传截图](./images/你的图片地址) + +## 每周课程学习 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 参加直播答疑 + +- [] 第一周:![学习记录截图](./images/你的图片地址) +- [] 第二周:![学习记录截图](./images/你的图片地址) +- [] 第三周:![学习记录截图](./images/你的图片地址) +- [] 第四周:![学习记录截图](./images/你的图片地址) + +## 群里分享学习笔记 + +- [] 第一篇笔记 +- [] 第二篇笔记 +- [] 第三篇笔记 +- [] 第四篇笔记 + +## 对外输出学习笔记 + +- [] 第一篇笔记【学习笔记链接】 +- [] 第二篇笔记【学习笔记链接】 +- [] 第三篇笔记【学习笔记链接】 +- [] 第四篇笔记【学习笔记链接】 + +## 在HOH社区公众号发布自己的技术文章 + +- [] 第一篇笔记【公众号文章链接】 +- [] 第二篇笔记【公众号文章链接】 +- [] 第三篇笔记【公众号文章链接】 +- [] 第四篇笔记【公众号文章链接】 + +## 直播分享学习技巧/工具推荐 + +- [] 会议截图:![会议记录截图](./images/你的图片地址) + +## 提交项目 + +- [] 项目提交![项目截图](./images/你的图片地址) + + diff --git a/mover/timecool-cpu/code/readme.md b/mover/timecool-cpu/code/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/timecool-cpu/notes/readme.md b/mover/timecool-cpu/notes/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/mover/timecool-cpu/readme.md b/mover/timecool-cpu/readme.md new file mode 100644 index 000000000..eb6fb9004 --- /dev/null +++ b/mover/timecool-cpu/readme.md @@ -0,0 +1,54 @@ +## 基本信息 +- Sui钱包地址: `0x3780117e3781549a86289e9750edaf60df3c4b8498e3052d9e958735dae95fb6` +> 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址 +- github: `timecool-cpu` + +## 个人简介 +- 工作经验: 0年 +- 技术栈: `go` `java` +> buaa研二在校生,主攻区块链开发,开发经验4年,三段大厂实习,目前在字节实习,熟悉智能合约以及区块链的热点话题,欢迎交流 +- +- 联系方式: tg: `15070691699` + +## 任务 + +## 01 hello move +- [✅] Sui cli version: sui 1.37.3-homebrew +- [✅] Sui钱包截图: ![img_1.png](static/img_1.png) +- [✅] package id: 7QeyYAeKfbTf6Bd88nBxLbTtkLnLiNy4td9ZCBuCohR4 +- [❓] package id 在 scan上的查看截图:![sui scan崩了进不去后面再补一下]![image-20241113223013283.png](static/image-20241113223013283.png) + +## 02 move coin +- [] My Coin package id : +- [] Faucet package id : +- [] 转账 `My Coin` hash: +- [] `Faucet Coin` address1 mint hash: +- [] `Faucet Coin` address2 mint hash: + +## 03 move NFT +- [] nft package id : +- [] nft object id : +- [] 转账 nft hash: +- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) + +## 04 Move Game +- [] game package id : +- [] deposit Coin hash: +- [] withdraw `Coin` hash: +- [] play game hash: + +## 05 Move Swap +- [] swap package id : +- [] call swap CoinA-> CoinB hash : +- [] call swap CoinB-> CoinA hash : + +## 06 Dapp-kit SDK PTB +- [] save hash : + +## 07 Move CTF Check In +- [] CLI call 截图 : ![截图](./images/你的图片地址) +- [] flag hash : + +## 08 Move CTF Lets Move +- [] proof : +- [] flag hash : diff --git a/mover/timecool-cpu/scan/readme.md b/mover/timecool-cpu/scan/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/mover/timecool-cpu/scan/readme.md @@ -0,0 +1 @@ + diff --git a/mover/timecool-cpu/static/image-20241113223013283.png b/mover/timecool-cpu/static/image-20241113223013283.png new file mode 100644 index 000000000..f0ac6f3b4 Binary files /dev/null and b/mover/timecool-cpu/static/image-20241113223013283.png differ diff --git a/mover/timecool-cpu/static/img.png b/mover/timecool-cpu/static/img.png new file mode 100644 index 000000000..43182c523 Binary files /dev/null and b/mover/timecool-cpu/static/img.png differ diff --git a/mover/timecool-cpu/static/img_1.png b/mover/timecool-cpu/static/img_1.png new file mode 100644 index 000000000..8b96de761 Binary files /dev/null and b/mover/timecool-cpu/static/img_1.png differ diff --git a/mover/timecool-cpu/task1/hellomove/Move.lock b/mover/timecool-cpu/task1/hellomove/Move.lock new file mode 100644 index 000000000..050b3cc64 --- /dev/null +++ b/mover/timecool-cpu/task1/hellomove/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "11BAF94A33662E7D904523341D85F0402E2C1A82A85216775F5E05EC6ADE9D9C" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.37.3" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0xb8cc340e7697ab201a7f836a9d99a5d3389ea5c41f9b49aefe86656bc5efa292" +latest-published-id = "0xb8cc340e7697ab201a7f836a9d99a5d3389ea5c41f9b49aefe86656bc5efa292" +published-version = "1" diff --git a/mover/timecool-cpu/task1/hellomove/Move.toml b/mover/timecool-cpu/task1/hellomove/Move.toml new file mode 100644 index 000000000..be65a17c8 --- /dev/null +++ b/mover/timecool-cpu/task1/hellomove/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hellomove" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +hellomove = "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/timecool-cpu/task1/hellomove/sources/hellomove.move b/mover/timecool-cpu/task1/hellomove/sources/hellomove.move new file mode 100644 index 000000000..02f70646b --- /dev/null +++ b/mover/timecool-cpu/task1/hellomove/sources/hellomove.move @@ -0,0 +1,17 @@ +module hellomove::hello ; + +use std::ascii::{String, string}; +use sui::transfer::transfer; + +public struct Hello has key { + id: UID, + say: String +} + +fun init(ctx: &mut TxContext) { + let hello_move = Hello { + id: object::new(ctx), + say: string(b"timecool-cpu"), + }; + transfer(hello_move, ctx.sender()); +} diff --git a/mover/timecool-cpu/task1/hellomove/tests/hellomove_tests.move b/mover/timecool-cpu/task1/hellomove/tests/hellomove_tests.move new file mode 100644 index 000000000..3f6ec59dc --- /dev/null +++ b/mover/timecool-cpu/task1/hellomove/tests/hellomove_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hellomove::hellomove_tests; +// uncomment this line to import the module +// use hellomove::hellomove; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hellomove() { + // pass +} + +#[test, expected_failure(abort_code = ::hellomove::hellomove_tests::ENotImplemented)] +fun test_hellomove_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/xydkd/code/task3/nft/Move.lock b/mover/xydkd/code/task3/nft/Move.lock new file mode 100644 index 000000000..a418b83ac --- /dev/null +++ b/mover/xydkd/code/task3/nft/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "9D4FCF5807A34E3110DFBA44AD92FEFEC55EE3DE8CF58F3D302F55D3004E70D1" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", 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 = "0x1e773d7a904c83664a17263c930134ec58a339be989024a89fd7f995c3aecac4" +latest-published-id = "0x1e773d7a904c83664a17263c930134ec58a339be989024a89fd7f995c3aecac4" +published-version = "1" diff --git a/mover/xydkd/code/task3/nft/Move.toml b/mover/xydkd/code/task3/nft/Move.toml new file mode 100644 index 000000000..504c662e4 --- /dev/null +++ b/mover/xydkd/code/task3/nft/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "nft" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +nft = "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/xydkd/code/task3/nft/sources/nft.move b/mover/xydkd/code/task3/nft/sources/nft.move new file mode 100644 index 000000000..8f77ae90d --- /dev/null +++ b/mover/xydkd/code/task3/nft/sources/nft.move @@ -0,0 +1,92 @@ +/* +/// Module: nft +module nft::nft; +*/ +/// Example of an unlimited "Sui Hero" collection - anyone can +/// mint their Hero. Shows how to initialize the `Publisher` and how +/// to use it to get the `Display` object - a way to describe a +/// type for the ecosystem. +module nft::nft; + +use std::string::String; +use sui::package; +use sui::display; +use sui::transfer::transfer; +use sui::tx_context::sender; + +/// The Hero - an outstanding collection of digital art. +public struct Gitnft has key, store { + id: UID, + name: String, + image_url: String, +} + +/// One-Time-Witness for the module. +public struct NFT has drop {} + +/// Claim the `Publisher` object in the module initializer +/// to then create a `Display`. The `Display` is initialized with +/// a set of fields (but can be modified later) and published via +/// the `update_version` call. +/// +/// Keys and values are set in the initializer but could also be +/// set after publishing if a `Publisher` object was created. +fun init(otw: NFT, ctx: &mut TxContext) { + let keys = vector[ + b"name".to_string(), + b"link".to_string(), + b"image_url".to_string(), + b"description".to_string(), + b"project_url".to_string(), + b"creator".to_string(), + ]; + + let values = vector[ + // For `name` one can use the `Hero.name` property + b"{name}".to_string(), + // For `link` one can build a URL using an `id` property + b"https://sui-heroes.io/hero/{id}".to_string(), + // For `image_url` use an IPFS template + `image_url` property. + b"https://avatars.githubusercontent.com/u/77824857?v=4&size=64".to_string(), + // Description is static for all `Hero` objects. + b"A true Hero of the Sui ecosystem!".to_string(), + // Project URL is usually static + b"nothing".to_string(), + // Creator field can be any + b"xydkd".to_string(), + ]; + + // Claim the `Publisher` for the package! + let publisher = package::claim(otw, ctx); + + // Get a new `Display` object for the `Hero` type. + let mut display = display::new_with_fields( + &publisher, keys, values, ctx + ); + + // Commit first version of `Display` to apply changes. + display.update_version(); + + transfer::public_transfer(publisher, ctx.sender()); + transfer::public_transfer(display, ctx.sender()); +} + +/// Anyone can mint their `Hero`! +public entry fun mint(name: String, image_url: String, ctx: &mut TxContext){ + let mygitnft = Gitnft { + id: object::new(ctx), + name, + image_url + }; + transfer(mygitnft,sender(ctx)) +} + +/// Anyone can mint their `Hero`! +public entry fun mint_to_anyone(name: String, image_url: String,recive:address, ctx: &mut TxContext){ + let mygitnft = Gitnft { + id: object::new(ctx), + name, + image_url + }; + transfer(mygitnft,recive) +} \ No newline at end of file diff --git a/mover/xydkd/code/task3/nft/tests/nft_tests.move b/mover/xydkd/code/task3/nft/tests/nft_tests.move new file mode 100644 index 000000000..3c9c56a93 --- /dev/null +++ b/mover/xydkd/code/task3/nft/tests/nft_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module nft::nft_tests; +// uncomment this line to import the module +// use nft::nft; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_nft() { + // pass +} + +#[test, expected_failure(abort_code = ::nft::nft_tests::ENotImplemented)] +fun test_nft_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/xydkd/images/10.png b/mover/xydkd/images/10.png new file mode 100644 index 000000000..540c18deb Binary files /dev/null and b/mover/xydkd/images/10.png differ diff --git a/mover/xydkd/notes/note.md b/mover/xydkd/notes/note.md index 3183502c7..f6b2a34c3 100644 --- a/mover/xydkd/notes/note.md +++ b/mover/xydkd/notes/note.md @@ -228,4 +228,6 @@ sui client switch --env devnet # 9.切换主网 sui client new-env --alias mainnet --rpc https://sui-mainnet.nodeinfra.com:443 -sui client switch --env mainnet \ No newline at end of file +sui client switch --env mainnet + +sui client publish --gas-budget 50000000 --skip-dependency-verification \ No newline at end of file diff --git a/mover/xydkd/readme.md b/mover/xydkd/readme.md index e93a12297..68e19957f 100644 --- a/mover/xydkd/readme.md +++ b/mover/xydkd/readme.md @@ -59,7 +59,7 @@ ## 提交项目 -- [x] 项目提交![项目截图](./images/6.png) +- [] 项目提交![项目截图](./images/6.png) ## 任务 @@ -78,10 +78,10 @@ - [x] `Faucet Coin` address2 mint hash:0x32301b58242d2ca99a61dd774e27e41eebb26b52a515a3a6c119737483310dfd ## 03 move NFT -- [] nft package id : -- [] nft object id : -- [] 转账 nft hash: -- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) +- [x] nft package id :0x1e773d7a904c83664a17263c930134ec58a339be989024a89fd7f995c3aecac4 +- [x] nft object id : 0xd76c72e70bb4851dd49c2326024959812c547c5d5f6bad76d17d08665269caf3 +- [x] 转账 nft hash:Hq3KF6c2EwCS1KEWGpdQLWH1hBSKy16uo8r3LECGgcgF +- [x] scan上的NFT截图:![Scan截图](./images/10.png) ## 04 Move Game - [] game package id : diff --git a/mover/yuanchengjiayu/code/task4/game/Move.lock b/mover/yuanchengjiayu/code/task4/game/Move.lock new file mode 100644 index 000000000..2e6cba80e --- /dev/null +++ b/mover/yuanchengjiayu/code/task4/game/Move.lock @@ -0,0 +1,43 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "7120FD3A1AC6452F28990DBE72F1B82E2C8BB7A8B9F8538BB962CA041562315D" +deps_digest = "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600" +dependencies = [ + { id = "Sui", name = "Sui" }, + { id = "movefaucetcoin", name = "movefaucetcoin" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[[move.package]] +id = "movefaucetcoin" +source = { local = "..\\..\\task2\\movefaucetcoin" } + +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[move.toolchain-version] +compiler-version = "1.36.2" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0xa521ddd7e07eeae313ff50f3f9963c29f1972163f23da80df8f2bdf36ab3af2d" +latest-published-id = "0xa521ddd7e07eeae313ff50f3f9963c29f1972163f23da80df8f2bdf36ab3af2d" +published-version = "1" diff --git a/mover/yuanchengjiayu/code/task4/game/Move.toml b/mover/yuanchengjiayu/code/task4/game/Move.toml new file mode 100644 index 000000000..4fe9a521b --- /dev/null +++ b/mover/yuanchengjiayu/code/task4/game/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "game" +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://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +movefaucetcoin = { local = "../../task2/movefaucetcoin" } +# 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] +game = "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/yuanchengjiayu/code/task4/game/sources/game.move b/mover/yuanchengjiayu/code/task4/game/sources/game.move new file mode 100644 index 000000000..36e0dcb1a --- /dev/null +++ b/mover/yuanchengjiayu/code/task4/game/sources/game.move @@ -0,0 +1,85 @@ +module game::game; + use movefaucetcoin::movefaucetcoin::{ MOVEFAUCETCOIN }; + use sui::coin::{Self, Coin}; + use sui::balance::{Self, Balance}; + use sui::random::{Self, Random}; + + const EUserInsufficientBalance: u64 = 1000; + const EGameInsufficientBalance: u64 = 1001; + + public struct Game has key { + id: UID, + balance: Balance, + } + + public struct Admin has key { + id: UID, + } + + fun init(ctx: &mut TxContext) { + let game = Game { + id: object::new(ctx), + balance: balance::zero(), + }; + transfer::share_object(game); + + let admin = Admin {id: object::new(ctx)}; + transfer::transfer(admin, ctx.sender()); + } + + public entry fun Deposit( + game: &mut Game, + coin: &mut Coin, + amount: u64, + ) { + assert!( + coin::value(coin) >= amount, + EUserInsufficientBalance + ); + let split_balance = balance::split(coin::balance_mut(coin), amount); + balance::join(&mut game.balance, split_balance); + } + + public entry fun Withdraw( + game: &mut Game, + _: &Admin, + amount: u64, + ctx: &mut TxContext + ) { + assert!( + game.balance.value() >= amount, + EGameInsufficientBalance + ); + let cash = coin::take(&mut game.balance, amount, ctx); + transfer::public_transfer(cash, ctx.sender()); + } + + public entry fun Play( + game: &mut Game, + rnd: &Random, + guess: bool, + coin: &mut Coin, + amount: u64, + ctx: &mut TxContext + ) { + + assert!( + game.balance.value() >= amount, + EGameInsufficientBalance + ); + + assert!( + coin::value(coin) >= amount, + EUserInsufficientBalance + ); + + let mut gen = random::new_generator(rnd, ctx); + let flag = random::generate_bool(&mut gen); + + if (flag == guess) { + let reward = coin::take(&mut game.balance, amount, ctx); + coin::join(coin, reward); + } else { + Self::Deposit(game, coin, amount) + } + } \ No newline at end of file diff --git a/mover/yuanchengjiayu/code/task4/game/tests/game_tests.move b/mover/yuanchengjiayu/code/task4/game/tests/game_tests.move new file mode 100644 index 000000000..9470e9c04 --- /dev/null +++ b/mover/yuanchengjiayu/code/task4/game/tests/game_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module game::game_tests; +// uncomment this line to import the module +// use game::game; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_game() { + // pass +} + +#[test, expected_failure(abort_code = ::game::game_tests::ENotImplemented)] +fun test_game_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/yuanchengjiayu/readme.md b/mover/yuanchengjiayu/readme.md index acd9e3eeb..e4646655d 100644 --- a/mover/yuanchengjiayu/readme.md +++ b/mover/yuanchengjiayu/readme.md @@ -30,10 +30,10 @@ - [x] scan上的NFT截图:![Scan截图](./images/task3.png) ## 04 Move Game -- [] game package id : -- [] deposit Coin hash: -- [] withdraw `Coin` hash: -- [] play game hash: +- [x] game package id : 0xa521ddd7e07eeae313ff50f3f9963c29f1972163f23da80df8f2bdf36ab3af2d +- [x] deposit Coin hash: 2VTydXGr7e7LD6vcU6fLAdnSTCdT9CdLeapYbbBX5GHL +- [x] withdraw `Coin` hash: 2tWyXHQ9mnqVFkrDm5RzdZwpWnhfWnLiSMwKAUgZeC4y +- [x] play game hash: DUxCLkRBk1D1BtXP9vYd4PM3PFffVZT9uREJ8waQgSJt ## 05 Move Swap - [] swap package id :