From 4dd5126c071cd4eff01d3a45f1969a43f152a8a1 Mon Sep 17 00:00:00 2001 From: 404II <3242388085@qq.com> Date: Thu, 18 Jul 2024 18:40:53 +0800 Subject: [PATCH 1/3] task2 --- mover/404ll/notes/task1.md | 45 ++++++++++++++++++++++++++++++++++++++ mover/404ll/notes/task2.md | 25 +++++++++++++++++++++ mover/404ll/readme.md | 10 ++++----- 3 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 mover/404ll/notes/task1.md create mode 100644 mover/404ll/notes/task2.md diff --git a/mover/404ll/notes/task1.md b/mover/404ll/notes/task1.md new file mode 100644 index 000000000..b06c13e48 --- /dev/null +++ b/mover/404ll/notes/task1.md @@ -0,0 +1,45 @@ +# letmove_notes + +## task1 报错篇 + +### 网络不好,无法下载依赖 + +```powershell +Failed to build Move modules: Failed to resolve dependencies for package 'task1' + +Caused by: + 0: Fetching 'Sui' + 1: Failed to fetch to latest Git state for package 'Sui', to skip set --skip-fetch-latest-git-deps | Exit status: exit code: 128. +``` + +解决方法(个人认为魔法比较好用): + +1. 使用终端魔法,去Clash(window)中复制` powershell` 魔法后,再次部署 +2. 将`Move.toml`中的 [dependencies] + Sui = { git = "https://github.com/MystenLabs/sui.git" 的`github`替换为`gitee` + +### gas不够(命令行中大概这么个意思) + +解决方法: + +1. 浏览器领水 http://getsui.com/address 将`address`替换为命令行输入`sui client active-address`后生成的活跃地址。 +2. 找朋友给你发点,白嫖(bushi + +### 模块名称错误 + +```powershell +error[E03001]: address with no value + ┌─ \\?\D:\letsmove\mover\404ll\code\task1\sources\hello_move.move:1:8 + │ +1 │ module hello_move ::hello { + │ ^^^^^^^^^^ address 'hello_move' is not assigned a value. Try assigning it a value when calling the compiler + +``` + +解决方法:将`module hello_move ::hello` 的第一个`hello_move`替换成Move.toml中显示的名称 + +例: + +[package] + +name = "task1" \ No newline at end of file diff --git a/mover/404ll/notes/task2.md b/mover/404ll/notes/task2.md new file mode 100644 index 000000000..42319e647 --- /dev/null +++ b/mover/404ll/notes/task2.md @@ -0,0 +1,25 @@ +# task2-注意 + +windows 使用call命令时,可以将`\`删去,只在前几条语句的最后留下 空格 即可 + +### **注意1**: + +创造代币采用了one-time-witness 见证者模式,因此需要满足它的要求,否则会报错,要求如下: + +名称必须与包的名字完全相同,并且全部大写;没有字段,只有drop(销毁)能力;通过`fun init (witness: Struct, ctx: &mut TxContext) {}` 传入 + +### 注意2: + +对于call函数中地址的区分: + +sui client call --gas-budget 100000000 + +--package 0x2 + +--module coin + +--function mint_and_transfer + +--type-args '' + +--args Object id mint_coin_number coin的接受地址 \ No newline at end of file diff --git a/mover/404ll/readme.md b/mover/404ll/readme.md index aa02d5047..93ef3e000 100644 --- a/mover/404ll/readme.md +++ b/mover/404ll/readme.md @@ -21,11 +21,11 @@ - [] package id 在 scan上的查看截图:Scan截图 ## 02 move coin -- [] My Coin package id : -- [] Faucet package id : -- [] 转账 `My Coin` hash: -- [] `Faucet Coin` address1 mint hash: -- [] `Faucet Coin` address2 mint hash: +- [0xb29d13722b2f81858c9c48f8004d9021af226ff87a9c29071b8310a5bbb57dd5] My Coin package id : +- [0xb29d13722b2f81858c9c48f8004d9021af226ff87a9c29071b8310a5bbb57dd5] Faucet package id : +- [0x686e0ada089ef2dc22a31f5dd46312e39d9d8ded4c2092065add0702d6aa1e77] 转账 `My Coin` hash: +- [0xe0ec6805847c63838e4eae60ac9e15e761c310dabbf8b0eeca187e9174d17530] `Faucet Coin` address1 mint hash: +- [0xfcc52f9563bb7f3117aa271361d72232641a7f72d42a68755e82b39a8faf39f8] `Faucet Coin` address2 mint hash: ## 03 move NFT - [] nft package id : From 1ceb8888719965eef3de1ea48c2d6e1bf5baf01b Mon Sep 17 00:00:00 2001 From: 404II <3242388085@qq.com> Date: Thu, 18 Jul 2024 19:16:01 +0800 Subject: [PATCH 2/3] task2 --- mover/404ll/notes/{readme.md => task1.md} | 0 mover/404ll/notes/task2.md | 25 +++++++ mover/404ll/readme.md | 85 ++++++++++++----------- 3 files changed, 68 insertions(+), 42 deletions(-) rename mover/404ll/notes/{readme.md => task1.md} (100%) create mode 100644 mover/404ll/notes/task2.md diff --git a/mover/404ll/notes/readme.md b/mover/404ll/notes/task1.md similarity index 100% rename from mover/404ll/notes/readme.md rename to mover/404ll/notes/task1.md diff --git a/mover/404ll/notes/task2.md b/mover/404ll/notes/task2.md new file mode 100644 index 000000000..42319e647 --- /dev/null +++ b/mover/404ll/notes/task2.md @@ -0,0 +1,25 @@ +# task2-注意 + +windows 使用call命令时,可以将`\`删去,只在前几条语句的最后留下 空格 即可 + +### **注意1**: + +创造代币采用了one-time-witness 见证者模式,因此需要满足它的要求,否则会报错,要求如下: + +名称必须与包的名字完全相同,并且全部大写;没有字段,只有drop(销毁)能力;通过`fun init (witness: Struct, ctx: &mut TxContext) {}` 传入 + +### 注意2: + +对于call函数中地址的区分: + +sui client call --gas-budget 100000000 + +--package 0x2 + +--module coin + +--function mint_and_transfer + +--type-args '' + +--args Object id mint_coin_number coin的接受地址 \ No newline at end of file diff --git a/mover/404ll/readme.md b/mover/404ll/readme.md index aa02d5047..23685efae 100644 --- a/mover/404ll/readme.md +++ b/mover/404ll/readme.md @@ -1,56 +1,57 @@ -## 基本信息 -- Sui钱包地址: `0x1aa50d1de8de613816f4e3061bfc71dc8a3a5a5bf475041e29adf16fee2808a5` +- 基本信息 -- github: `404ll` + - Sui钱包地址: `0x1aa50d1de8de613816f4e3061bfc71dc8a3a5a5bf475041e29adf16fee2808a5` -## 个人简介 -- 工作经验: 0 -- 技术栈: C, solidity + - github: `404ll` + ## 个人简介 + - 工作经验: 0 + - 技术栈: C, solidity + -- 区块链专业大一在读,All in Web3,非常热爱加密,正在不断学习中,热爱建设,如果有需要帮忙的地方随叫随到! -- 联系方式: tg: '77' + - 区块链专业大一在读,All in Web3,非常热爱加密,正在不断学习中,热爱建设,如果有需要帮忙的地方随叫随到! + - 联系方式: tg: '77' -## 任务 + ## 任务 -## 01 hello move -- [sui 1.28.3] Sui cli version: -- [] Sui钱包截图: Sui钱包截图 -- [0x1a852fe63cdf97456f142a042e499e2766fef8f7579c2bb8c10fc7cb2a17904d] package id: -- [] package id 在 scan上的查看截图:Scan截图 + ## 01 hello move + - [sui 1.28.3] Sui cli version: + - [] Sui钱包截图: Sui钱包截图 + - [0x1a852fe63cdf97456f142a042e499e2766fef8f7579c2bb8c10fc7cb2a17904d] package id: + - [] package id 在 scan上的查看截图:Scan截图 -## 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 + - [0xb29d13722b2f81858c9c48f8004d9021af226ff87a9c29071b8310a5bbb57dd5] My Coin package id : + - [0xb29d13722b2f81858c9c48f8004d9021af226ff87a9c29071b8310a5bbb57dd5] Faucet package id : + - [0x686e0ada089ef2dc22a31f5dd46312e39d9d8ded4c2092065add0702d6aa1e77] 转账 `My Coin` hash: + - [0xe0ec6805847c63838e4eae60ac9e15e761c310dabbf8b0eeca187e9174d17530] `Faucet Coin` address1 mint hash: + - [0xfcc52f9563bb7f3117aa271361d72232641a7f72d42a68755e82b39a8faf39f8] `Faucet Coin` address2 mint hash: -## 03 move NFT -- [] nft package id : -- [] nft object id : -- [] 转账 nft hash: -- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) + ## 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: + ## 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 : + ## 05 Move Swap + - [] swap package id : + - [] call swap CoinA-> CoinB hash : + - [] call swap CoinB-> CoinA hash : -## 06 Dapp-kit SDK PTB -- [] save hash : + ## 06 Dapp-kit SDK PTB + - [] save hash : -## 07 Move CTF Check In -- [] CLI call 截图 : ![截图](./images/你的图片地址) -- [] flag hash : + ## 07 Move CTF Check In + - [] CLI call 截图 : ![截图](./images/你的图片地址) + - [] flag hash : -## 08 Move CTF Lets Move -- [] proof : -- [] flag hash : + ## 08 Move CTF Lets Move + - [] proof : + - [] flag hash : From d2eb01afe8310473843a428f529ecb4fe619b290 Mon Sep 17 00:00:00 2001 From: 404II <3242388085@qq.com> Date: Thu, 18 Jul 2024 23:27:12 +0800 Subject: [PATCH 3/3] task2 --- mover/404ll/code/task2/FaucetCoin/Move.lock | 34 +++++++++++++++++ mover/404ll/code/task2/FaucetCoin/Move.toml | 37 +++++++++++++++++++ .../task2/FaucetCoin/sources/faucetcoin.move | 24 ++++++++++++ .../FaucetCoin/tests/faucetcoin_tests.move | 19 ++++++++++ mover/404ll/code/task2/mycoin/Move.lock | 34 +++++++++++++++++ mover/404ll/code/task2/mycoin/Move.toml | 37 +++++++++++++++++++ .../code/task2/mycoin/sources/mycoin.move | 16 ++++++++ .../code/task2/mycoin/tests/mycoin_tests.move | 19 ++++++++++ mover/404ll/readme.md | 10 ++--- 9 files changed, 225 insertions(+), 5 deletions(-) create mode 100644 mover/404ll/code/task2/FaucetCoin/Move.lock create mode 100644 mover/404ll/code/task2/FaucetCoin/Move.toml create mode 100644 mover/404ll/code/task2/FaucetCoin/sources/faucetcoin.move create mode 100644 mover/404ll/code/task2/FaucetCoin/tests/faucetcoin_tests.move create mode 100644 mover/404ll/code/task2/mycoin/Move.lock create mode 100644 mover/404ll/code/task2/mycoin/Move.toml create mode 100644 mover/404ll/code/task2/mycoin/sources/mycoin.move create mode 100644 mover/404ll/code/task2/mycoin/tests/mycoin_tests.move diff --git a/mover/404ll/code/task2/FaucetCoin/Move.lock b/mover/404ll/code/task2/FaucetCoin/Move.lock new file mode 100644 index 000000000..120e59676 --- /dev/null +++ b/mover/404ll/code/task2/FaucetCoin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 2 +manifest_digest = "A3A4289005858BB5EC8B7DFB1830EFFBF1A44FCC005156E36FA379507A61F1BD" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { name = "Sui" }, +] + +[[move.package]] +name = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +name = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.28.4" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x796fe22eb9df4f8d926e111c888d8ef4447d4348c3131f2cb4a82f1ec09c5e63" +latest-published-id = "0x796fe22eb9df4f8d926e111c888d8ef4447d4348c3131f2cb4a82f1ec09c5e63" +published-version = "1" diff --git a/mover/404ll/code/task2/FaucetCoin/Move.toml b/mover/404ll/code/task2/FaucetCoin/Move.toml new file mode 100644 index 000000000..75767836b --- /dev/null +++ b/mover/404ll/code/task2/FaucetCoin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "FaucetCoin" +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] +faucetcoin = "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/404ll/code/task2/FaucetCoin/sources/faucetcoin.move b/mover/404ll/code/task2/FaucetCoin/sources/faucetcoin.move new file mode 100644 index 000000000..f0c1cb730 --- /dev/null +++ b/mover/404ll/code/task2/FaucetCoin/sources/faucetcoin.move @@ -0,0 +1,24 @@ +module faucetcoin::FaucetCoin { + use std::option; + use sui::transfer; + use sui::tx_context::{Self, TxContext}; + use sui::coin::{Self, Coin, TreasuryCap}; + + public struct FAUCETCOIN has drop {} + + fun init( witness:FAUCETCOIN,ctx: &mut TxContext) { + let (treasury, metadata) = coin::create_currency(witness, 7, b"404ll_FaucetCoin", b"404ll_FaucetCoin", b"FaucetCoin", option::none(), ctx); + transfer::public_freeze_object(metadata); + transfer::public_share_object(treasury) + } + public entry fun mint_and_transfer( + treasury: &mut TreasuryCap, + amount: u64, + recipient: address, + ctx: &mut TxContext, + ) { + let faucet = coin::mint(treasury, amount, ctx); + transfer::public_transfer(faucet, tx_context::sender(ctx) ) + +} +} \ No newline at end of file diff --git a/mover/404ll/code/task2/FaucetCoin/tests/faucetcoin_tests.move b/mover/404ll/code/task2/FaucetCoin/tests/faucetcoin_tests.move new file mode 100644 index 000000000..381d574d9 --- /dev/null +++ b/mover/404ll/code/task2/FaucetCoin/tests/faucetcoin_tests.move @@ -0,0 +1,19 @@ +/* +#[test_only] +module faucetcoin::faucetcoin_tests { + // uncomment this line to import the module + // use faucetcoin::faucetcoin; + + const ENotImplemented: u64 = 0; + + #[test] + fun test_faucetcoin() { + // pass + } + + #[test, expected_failure(abort_code = ::faucetcoin::faucetcoin_tests::ENotImplemented)] + fun test_faucetcoin_fail() { + abort ENotImplemented + } +} +*/ diff --git a/mover/404ll/code/task2/mycoin/Move.lock b/mover/404ll/code/task2/mycoin/Move.lock new file mode 100644 index 000000000..468c4e3c5 --- /dev/null +++ b/mover/404ll/code/task2/mycoin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 2 +manifest_digest = "6C40FE3B1765CDEAB5314EF7C5C5BB46962606BA7C4CDC2111E8A61DB77690AD" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { name = "Sui" }, +] + +[[move.package]] +name = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" } + +[[move.package]] +name = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.28.4" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x6765b41dc00617512667e5d8623ecb0ea826874614c23c90bdd1ac461ac47b67" +latest-published-id = "0x6765b41dc00617512667e5d8623ecb0ea826874614c23c90bdd1ac461ac47b67" +published-version = "1" diff --git a/mover/404ll/code/task2/mycoin/Move.toml b/mover/404ll/code/task2/mycoin/Move.toml new file mode 100644 index 000000000..905a2be97 --- /dev/null +++ b/mover/404ll/code/task2/mycoin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "FireCoin" +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] +FireCoin = "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/404ll/code/task2/mycoin/sources/mycoin.move b/mover/404ll/code/task2/mycoin/sources/mycoin.move new file mode 100644 index 000000000..e6e922173 --- /dev/null +++ b/mover/404ll/code/task2/mycoin/sources/mycoin.move @@ -0,0 +1,16 @@ +module FireCoin::FireCoin { + use std::option; + use sui::transfer; + use sui::tx_context::{Self, TxContext}; + use sui::coin::{Self, Coin, TreasuryCap}; + + public struct FIRECOIN has drop {} + + fun init( witness:FIRECOIN , ctx: &mut TxContext) { + let (treasury, metadata) = coin::create_currency(witness, 7, b"404llcoin", b"FC", b"Full of idal a flame", option::none(), ctx); + transfer::public_freeze_object(metadata); + transfer::public_transfer(treasury, tx_context::sender(ctx)) + } + + +} \ No newline at end of file diff --git a/mover/404ll/code/task2/mycoin/tests/mycoin_tests.move b/mover/404ll/code/task2/mycoin/tests/mycoin_tests.move new file mode 100644 index 000000000..e8e5f0fc4 --- /dev/null +++ b/mover/404ll/code/task2/mycoin/tests/mycoin_tests.move @@ -0,0 +1,19 @@ +/* +#[test_only] +module mycoin::mycoin_tests { + // uncomment this line to import the module + // use mycoin::mycoin; + + const ENotImplemented: u64 = 0; + + #[test] + fun test_mycoin() { + // pass + } + + #[test, expected_failure(abort_code = ::mycoin::mycoin_tests::ENotImplemented)] + fun test_mycoin_fail() { + abort ENotImplemented + } +} +*/ diff --git a/mover/404ll/readme.md b/mover/404ll/readme.md index 421c1bc65..1e59c3cef 100644 --- a/mover/404ll/readme.md +++ b/mover/404ll/readme.md @@ -22,11 +22,11 @@ - [] package id 在 scan上的查看截图:Scan截图 ## 02 move coin - - [0xb29d13722b2f81858c9c48f8004d9021af226ff87a9c29071b8310a5bbb57dd5] My Coin package id : - - [0xb29d13722b2f81858c9c48f8004d9021af226ff87a9c29071b8310a5bbb57dd5] Faucet package id : - - [0x686e0ada089ef2dc22a31f5dd46312e39d9d8ded4c2092065add0702d6aa1e77] 转账 `My Coin` hash: - - [0xe0ec6805847c63838e4eae60ac9e15e761c310dabbf8b0eeca187e9174d17530] `Faucet Coin` address1 mint hash: - - [0xfcc52f9563bb7f3117aa271361d72232641a7f72d42a68755e82b39a8faf39f8] `Faucet Coin` address2 mint hash: + - [0x6765b41dc00617512667e5d8623ecb0ea826874614c23c90bdd1ac461ac47b67] My Coin package id : + - [0x796fe22eb9df4f8d926e111c888d8ef4447d4348c3131f2cb4a82f1ec09c5e63] Faucet package id : + - [0xed3f44cfe2b4c9e7e0de2deaefd47457fdf206a763a235bb99d391bba31313b4] 转账 `My Coin` hash: + - [0x42bd0305cafd782e8cd5f3b8f92e108c1bd66b0ea8838d040ccc6bb945b35c8b] `Faucet Coin` address1 mint hash: + - [0x9b8b1f4ece3c93c75f3abc1cd14b50d0aa7135fc4ba8a6ffe5f2929dca1f78ce] `Faucet Coin` address2 mint hash: ## 03 move NFT - [] nft package id :