diff --git a/mover/xdd-object/code/task2/xdd_object/.gitignore b/mover/xdd-object/code/task2/xdd_object/.gitignore new file mode 100644 index 000000000..a007feab0 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/xdd-object/code/task2/xdd_object/Move.toml b/mover/xdd-object/code/task2/xdd_object/Move.toml new file mode 100644 index 000000000..66240cf4e --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "xdd_object" +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] +xdd_object = "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/xdd-object/code/task2/xdd_object/call.sh b/mover/xdd-object/code/task2/xdd_object/call.sh new file mode 100644 index 000000000..aad123911 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object/call.sh @@ -0,0 +1,28 @@ +sui client call --package 包名 --module 模块名 --function 方法名 --args 权限id(TreasuryCap对应的id) 金额 + + +sui client call --package 0xba67f9e412da95fa110516926ce34257b1f988240ec2f6fd08fbe512c8ce45a8 --module xdd_object --function mint_xdd_object --args 0xc93bc1e5ef92f68148a602b53dc65d39a3cf6e6a18d9cf6337e6de5c340a7ce5 1000000000000 + + + + +#铸币,只有自己有权限 +sui client call --package 0x2 --module coin --function mint_and_transfer \ + --type-args 0x7e81cbf616ef12f9049ede655c0d9ee31283fbe8f15067f749b010c40c280d76::usd::USD \ + --args 0x8ea7753c31670fe2ab6042901c13ed2b174b420ee09b7f16482531080cef831b 10000000000 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 + +#usd +sui client call --package 0x2 --module coin --function mint_and_transfer --type-args 0x7e81cbf616ef12f9049ede655c0d9ee31283fbe8f15067f749b010c40c280d76::usd::USD --args 0x8ea7753c31670fe2ab6042901c13ed2b174b420ee09b7f16482531080cef831b 10000000000 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 + +#铸币,所有人都有权限 +#sui client call --package 包名 --module 模块名 --function 方法名 --type-args 币种 --args 权限id(TreasuryCap对应的id) 金额 地址 + +sui client call --package 0x2 --module coin --function mint_and_transfer --type-args 0x5eb4ac5d056728b852c659eb39c3cccc787568727f66ae246095530dcb17da80::rmb::RMB --args 0x302296d929561950c86c95f7b5df3c7c89288dd72f2adbda8c5e8a3a8570ae4d 10000000000 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 + + + + +# 正式环境 +sui client call --package 0x2cdd34202d285b2f4579955b57cb29cfd1c7ac9178cdc0d8424e47eb0c7a4016 --module xdd_object --function mint_xdd_object --args 0xd0df52564401b64c96a88f29751297cf8213658800a427e7c2a78b57d6ecf5ac 100000000000 + + diff --git a/mover/xdd-object/code/task2/xdd_object/log b/mover/xdd-object/code/task2/xdd_object/log new file mode 100644 index 000000000..a46831f62 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object/log @@ -0,0 +1,157 @@ +Transaction Digest: 3FNdwFA1XeVWMKW9b9zwLUy17eK3yh2cBdDDUAdmoJGF +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 15111600 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Version: 458803129 │ +│ │ Digest: EwGwZXiVoHzsXwHrZ4hxAaMSPED42jWshpQMht6RVHrB │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ l4dDatugFphEuietVd7WSf7GI2JSesInr8GJ5SMxXqbMcNRmbGSVkMfcGP73Q7i21BnJqtM3c0IBu5LxwmAVDw== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 3FNdwFA1XeVWMKW9b9zwLUy17eK3yh2cBdDDUAdmoJGF │ +│ Status: Success │ +│ Executed Epoch: 622 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x2cdd34202d285b2f4579955b57cb29cfd1c7ac9178cdc0d8424e47eb0c7a4016 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: BY1KngFjEfS4HwoozkQT4pr32iCeRmfBsVrNuBkox8Nj │ +│ └── │ +│ ┌── │ +│ │ ID: 0x66c0bd1bf58b3db0c13e2924ce43da50a958375aebdf8242344c315c345ddac7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803130 │ +│ │ Digest: DS6TkAiBMqS4NkzB5rsdvxp91i22HejosBXmDKxcBem3 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x8dea707f3f17484029fd4994ca53de3c47617063430f2a9cd91e9954a129b334 │ +│ │ Owner: Immutable │ +│ │ Version: 458803130 │ +│ │ Digest: 3mk8DW6Et1iGUuMni9PZjnshMmLjwPCYQYbc7WdB14Ux │ +│ └── │ +│ ┌── │ +│ │ ID: 0xd0df52564401b64c96a88f29751297cf8213658800a427e7c2a78b57d6ecf5ac │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803130 │ +│ │ Digest: 4jWF1eoFhoU6Ja7nGdr8fWdNvGVQXaznzNygVFFHpkMA │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803130 │ +│ │ Digest: 6aeLoZdvhYR4tgAwpuS3SLfz5TMqrCS2SRTd8kiT3brb │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803130 │ +│ │ Digest: 6aeLoZdvhYR4tgAwpuS3SLfz5TMqrCS2SRTd8kiT3brb │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 13611600 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 5DcxLBzLXg1WsocDj3FDjJ1hFMu4XAKAc9bkZFxCFKLw │ +│ CrzVT94WvHWqQGR9WmbmC5bap45GaNBzse1vTHfzcs8a │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x66c0bd1bf58b3db0c13e2924ce43da50a958375aebdf8242344c315c345ddac7 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 458803130 │ +│ │ Digest: DS6TkAiBMqS4NkzB5rsdvxp91i22HejosBXmDKxcBem3 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x8dea707f3f17484029fd4994ca53de3c47617063430f2a9cd91e9954a129b334 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0x2cdd34202d285b2f4579955b57cb29cfd1c7ac9178cdc0d8424e47eb0c7a4016::xdd_object::XDD_OBJECT> │ +│ │ Version: 458803130 │ +│ │ Digest: 3mk8DW6Et1iGUuMni9PZjnshMmLjwPCYQYbc7WdB14Ux │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xd0df52564401b64c96a88f29751297cf8213658800a427e7c2a78b57d6ecf5ac │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x2cdd34202d285b2f4579955b57cb29cfd1c7ac9178cdc0d8424e47eb0c7a4016::xdd_object::XDD_OBJECT> │ +│ │ Version: 458803130 │ +│ │ Digest: 4jWF1eoFhoU6Ja7nGdr8fWdNvGVQXaznzNygVFFHpkMA │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 458803130 │ +│ │ Digest: 6aeLoZdvhYR4tgAwpuS3SLfz5TMqrCS2SRTd8kiT3brb │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x2cdd34202d285b2f4579955b57cb29cfd1c7ac9178cdc0d8424e47eb0c7a4016 │ +│ │ Version: 1 │ +│ │ Digest: BY1KngFjEfS4HwoozkQT4pr32iCeRmfBsVrNuBkox8Nj │ +│ │ Modules: xdd_object │ +│ └── │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -13383480 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/xdd-object/code/task2/xdd_object/sources/xdd_object.move b/mover/xdd-object/code/task2/xdd_object/sources/xdd_object.move new file mode 100644 index 000000000..f661803fe --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object/sources/xdd_object.move @@ -0,0 +1,42 @@ +module xdd_object::xdd_object { + use std::option::none; + use sui::coin; + use sui::coin::{create_currency, TreasuryCap}; + use sui::transfer::{public_transfer, public_freeze_object}; + use sui::tx_context::TxContext; + use sui::url::Url; + + public struct XDD_OBJECT has drop { + + } + + + fun init(xddObject: XDD_OBJECT, ctx: &mut TxContext) { + //创建代币 + let (treasuryCap, coinMetadata) = create_currency( + xddObject, + 9, + b"XDD_OBJECT", + b"XDD_OBJECT", + b"", + none(), + ctx); + + //冻结货币元数据 + public_freeze_object(coinMetadata); + + //将铸币权限给创建人 + public_transfer(treasuryCap, ctx.sender()); + } + + //铸币方法 + public entry fun mint_xdd_object(cap: &mut TreasuryCap, value: u64, ctx: &mut TxContext) { + //铸币 + let xddCoin = coin::mint(cap, value, ctx); + //将代币转给某人, 也可以给指定地址 + public_transfer(xddCoin, ctx.sender()); + } + + + +} diff --git a/mover/xdd-object/code/task2/xdd_object/tests/xdd_object_tests.move b/mover/xdd-object/code/task2/xdd_object/tests/xdd_object_tests.move new file mode 100644 index 000000000..4c3bbd3e7 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object/tests/xdd_object_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module xdd_object::xdd_object_tests; +// uncomment this line to import the module +// use xdd_object::xdd_object; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_xdd_object() { + // pass +} + +#[test, expected_failure(abort_code = ::xdd_object::xdd_object_tests::ENotImplemented)] +fun test_xdd_object_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/xdd-object/code/task2/xdd_object_faucet/.gitignore b/mover/xdd-object/code/task2/xdd_object_faucet/.gitignore new file mode 100644 index 000000000..a007feab0 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object_faucet/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/xdd-object/code/task2/xdd_object_faucet/Move.toml b/mover/xdd-object/code/task2/xdd_object_faucet/Move.toml new file mode 100644 index 000000000..dfcbba1c2 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object_faucet/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "xdd_object_faucet" +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] +xdd_object_faucet = "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/xdd-object/code/task2/xdd_object_faucet/call.sh b/mover/xdd-object/code/task2/xdd_object_faucet/call.sh new file mode 100644 index 000000000..60eb9c920 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object_faucet/call.sh @@ -0,0 +1,10 @@ +sui client call --package 包名 --module 模块名 --function 方法名 --args 权限id(TreasuryCap对应的id) 金额 接收地址 + +sui client call --package 0x1806931dfd9024b573fbd8abe56e3bc52c7f7030400921b7b9e859ca17b73c31 --module xdd_object_faucet --function mint_xdd_object_faucet --args 0x0dfb9a7f966d73da20e89a55b8f9bf6fb96a3f219b2d1eab50b4b1faf34afd81 1000000000000 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 + + + + +#生产环境 +sui client call --package 0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2 --module xdd_object_faucet --function mint_xdd_object_faucet --args 0x9dc0a87820bac5b153b5f8771f4ce16827a53ed672447b2c6a1320924326e6b6 10000000000 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 +sui client call --package 0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2 --module xdd_object_faucet --function mint_xdd_object_faucet --args 0x9dc0a87820bac5b153b5f8771f4ce16827a53ed672447b2c6a1320924326e6b6 10000000000 0x517f05f8975255e1ab82bc74419d29601ac85d761acff71f00749478edd723b8 diff --git a/mover/xdd-object/code/task2/xdd_object_faucet/log b/mover/xdd-object/code/task2/xdd_object_faucet/log new file mode 100644 index 000000000..5716a8103 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object_faucet/log @@ -0,0 +1,157 @@ +Transaction Digest: 4bmmzaJwnpesaDPQ7WckdztXuE84EyNyGYprxE1JiDAr +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 15909600 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Version: 458803130 │ +│ │ Digest: 6aeLoZdvhYR4tgAwpuS3SLfz5TMqrCS2SRTd8kiT3brb │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ AVlQKdGfvP7yrmSMU7IoZa5xrFtIxgD6z4fy7/UPZqfcaJ5VJhWoKuGM3nYGKDnjt9hqNxFWefuopCsmCosQCQ== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 4bmmzaJwnpesaDPQ7WckdztXuE84EyNyGYprxE1JiDAr │ +│ Status: Success │ +│ Executed Epoch: 622 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: A8CNvHgdAMMvw6Az3oHQXJVFDfGninA2aPnrrU57FvtE │ +│ └── │ +│ ┌── │ +│ │ ID: 0x43817954cd860185c01fee753f2b278e608f891f6ff6b7da5cafb431802ac5f9 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803131 │ +│ │ Digest: CHFFpHYcketJ2pESghy5RV2bKrbWkt21F4rK7GhHJavm │ +│ └── │ +│ ┌── │ +│ │ ID: 0x9dc0a87820bac5b153b5f8771f4ce16827a53ed672447b2c6a1320924326e6b6 │ +│ │ Owner: Shared( 458803131 ) │ +│ │ Version: 458803131 │ +│ │ Digest: CxYEVC7zjYz9BStuYe8g7qE6qpcRScWfaPTpGLoeH42W │ +│ └── │ +│ ┌── │ +│ │ ID: 0xb68261928ffe6602a37f6dedd929169e8a4633739a9c63cd5f522f43fd9af60a │ +│ │ Owner: Immutable │ +│ │ Version: 458803131 │ +│ │ Digest: 4ugfFp7Sar476HHmYuWdpXGeGyvcZSq8hWVLZt5gvrPF │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803131 │ +│ │ Digest: 92Jo5uvMfRHtQ8YL8XMG8m81Jtatzafvm8W8h7GoFT8Z │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803131 │ +│ │ Digest: 92Jo5uvMfRHtQ8YL8XMG8m81Jtatzafvm8W8h7GoFT8Z │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 14409600 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 3FNdwFA1XeVWMKW9b9zwLUy17eK3yh2cBdDDUAdmoJGF │ +│ CrzVT94WvHWqQGR9WmbmC5bap45GaNBzse1vTHfzcs8a │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x43817954cd860185c01fee753f2b278e608f891f6ff6b7da5cafb431802ac5f9 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 458803131 │ +│ │ Digest: CHFFpHYcketJ2pESghy5RV2bKrbWkt21F4rK7GhHJavm │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x9dc0a87820bac5b153b5f8771f4ce16827a53ed672447b2c6a1320924326e6b6 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Shared( 458803131 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2::xdd_object_faucet::XDD_OBJECT_FAUCET> │ +│ │ Version: 458803131 │ +│ │ Digest: CxYEVC7zjYz9BStuYe8g7qE6qpcRScWfaPTpGLoeH42W │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xb68261928ffe6602a37f6dedd929169e8a4633739a9c63cd5f522f43fd9af60a │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2::xdd_object_faucet::XDD_OBJECT_FAUCET> │ +│ │ Version: 458803131 │ +│ │ Digest: 4ugfFp7Sar476HHmYuWdpXGeGyvcZSq8hWVLZt5gvrPF │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 458803131 │ +│ │ Digest: 92Jo5uvMfRHtQ8YL8XMG8m81Jtatzafvm8W8h7GoFT8Z │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2 │ +│ │ Version: 1 │ +│ │ Digest: A8CNvHgdAMMvw6Az3oHQXJVFDfGninA2aPnrrU57FvtE │ +│ │ Modules: xdd_object_faucet │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -14181480 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/xdd-object/code/task2/xdd_object_faucet/sources/xdd_object_faucet.move b/mover/xdd-object/code/task2/xdd_object_faucet/sources/xdd_object_faucet.move new file mode 100644 index 000000000..d44df0654 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object_faucet/sources/xdd_object_faucet.move @@ -0,0 +1,42 @@ + +/// Module: xdd_object_faucet +module xdd_object_faucet::xdd_object_faucet{ + use std::option::none; + use sui::coin; + use sui::coin::{create_currency, TreasuryCap}; + use sui::transfer::{public_transfer, public_freeze_object, public_share_object}; + use sui::tx_context::TxContext; + use sui::url::Url; + + public struct XDD_OBJECT_FAUCET has drop { + + } + + + fun init(xddObject: XDD_OBJECT_FAUCET, ctx: &mut TxContext) { + //创建代币 + let (treasuryCap, coinMetadata) = create_currency( + xddObject, + 9, + b"XDD_OBJECT_FAUCET", + b"XDD_OBJECT_FAUCET", + b"XDD_OBJECT_FAUCET", + none(), + ctx); + + //冻结货币元数据 + public_freeze_object(coinMetadata); + + //将铸币权限给所有人 + public_share_object(treasuryCap); + } + + //铸币方法 + public entry fun mint_xdd_object_faucet(cap: &mut TreasuryCap, value: u64, recipient: address, ctx: &mut TxContext) { + //铸币 + let xddCoin = coin::mint(cap, value, ctx); + //将代币转给某人, 也可以给指定地址 + public_transfer(xddCoin, recipient); + } + +} \ No newline at end of file diff --git a/mover/xdd-object/code/task2/xdd_object_faucet/tests/xdd_object_faucet_tests.move b/mover/xdd-object/code/task2/xdd_object_faucet/tests/xdd_object_faucet_tests.move new file mode 100644 index 000000000..2b2329093 --- /dev/null +++ b/mover/xdd-object/code/task2/xdd_object_faucet/tests/xdd_object_faucet_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module xdd_object_faucet::xdd_object_faucet_tests; +// uncomment this line to import the module +// use xdd_object_faucet::xdd_object_faucet; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_xdd_object_faucet() { + // pass +} + +#[test, expected_failure(abort_code = ::xdd_object_faucet::xdd_object_faucet_tests::ENotImplemented)] +fun test_xdd_object_faucet_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/xdd-object/code/task3/.gitignore b/mover/xdd-object/code/task3/.gitignore new file mode 100644 index 000000000..a007feab0 --- /dev/null +++ b/mover/xdd-object/code/task3/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/xdd-object/code/task3/Move.toml b/mover/xdd-object/code/task3/Move.toml new file mode 100644 index 000000000..084bf0aba --- /dev/null +++ b/mover/xdd-object/code/task3/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "task3" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://gitee.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/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] +task3 = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/xdd-object/code/task3/call.sh b/mover/xdd-object/code/task3/call.sh new file mode 100644 index 000000000..70798be42 --- /dev/null +++ b/mover/xdd-object/code/task3/call.sh @@ -0,0 +1,6 @@ +sui client call --package 0xac952c1cf68c9fd51d346ababcae2688f4d13e384b4050008aa92e565d2e505c --module task3 --function mint --args https://avatars.githubusercontent.com/u/24604365 0x517f05f8975255e1ab82bc74419d29601ac85d761acff71f00749478edd723b8 + + + +#正式环境 +sui client call --package 0x60d57d7822e3eb37959ff19c21c9de7df2af7143c189c347a573a473644390bc --module task3 --function mint --args https://avatars.githubusercontent.com/u/24604365 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 \ No newline at end of file diff --git a/mover/xdd-object/code/task3/log b/mover/xdd-object/code/task3/log new file mode 100644 index 000000000..cdeeb9f1f --- /dev/null +++ b/mover/xdd-object/code/task3/log @@ -0,0 +1,143 @@ +Transaction Digest: Hq5mQsUkG4vHzs3w39ie31XAocf6VBbBfCfTHagiC1W7 +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 11539600 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Version: 458803137 │ +│ │ Digest: 3PScrwgteVMQA8tkupinkt7VhTQdNcRUSTRvBnnv1M2H │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ evnXL8EGbFFesc76+V8upYXGyqPOeGVkVdGjuYJs1qN2XrFeXkWvUoezO5/mCoPXY4j525y1YWImnwV6laWUCw== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: Hq5mQsUkG4vHzs3w39ie31XAocf6VBbBfCfTHagiC1W7 │ +│ Status: Success │ +│ Executed Epoch: 622 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x1f189b1243957b0d434cd45890b66ae273dc52d9d0fe4d0bd14b5857410165dd │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803138 │ +│ │ Digest: A4Fr5tmmfaR69hWBMm6kRm5HDGMGj8fEvJQSw95JPNjF │ +│ └── │ +│ ┌── │ +│ │ ID: 0x1ffebc091d73be49a289a2a3d401af3547f45a8e001b185639168568f5d7ad94 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803138 │ +│ │ Digest: A2dx97FQD3Ep7F27XHZWLB8iSFosntFRRJhUBgzHrUw7 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x60d57d7822e3eb37959ff19c21c9de7df2af7143c189c347a573a473644390bc │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: FpckL8JbXA3rwtGPwn7CmzB2RkAqmhTYw5T2jp83oaMd │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803138 │ +│ │ Digest: BwvDPxDqWTfLibk6T8kXco5NxFnEnVsAwqGtyXNf57gM │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803138 │ +│ │ Digest: BwvDPxDqWTfLibk6T8kXco5NxFnEnVsAwqGtyXNf57gM │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 10039600 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 4HTZGBT1Xk1aKffp5fLAiDqKnwW8W5EySbhdHLUkq4uZ │ +│ CrzVT94WvHWqQGR9WmbmC5bap45GaNBzse1vTHfzcs8a │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x1f189b1243957b0d434cd45890b66ae273dc52d9d0fe4d0bd14b5857410165dd │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x60d57d7822e3eb37959ff19c21c9de7df2af7143c189c347a573a473644390bc::task3::XddNFT │ +│ │ Version: 458803138 │ +│ │ Digest: A4Fr5tmmfaR69hWBMm6kRm5HDGMGj8fEvJQSw95JPNjF │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x1ffebc091d73be49a289a2a3d401af3547f45a8e001b185639168568f5d7ad94 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 458803138 │ +│ │ Digest: A2dx97FQD3Ep7F27XHZWLB8iSFosntFRRJhUBgzHrUw7 │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 458803138 │ +│ │ Digest: BwvDPxDqWTfLibk6T8kXco5NxFnEnVsAwqGtyXNf57gM │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x60d57d7822e3eb37959ff19c21c9de7df2af7143c189c347a573a473644390bc │ +│ │ Version: 1 │ +│ │ Digest: FpckL8JbXA3rwtGPwn7CmzB2RkAqmhTYw5T2jp83oaMd │ +│ │ Modules: task3 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -9811480 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/xdd-object/code/task3/sources/task3.move b/mover/xdd-object/code/task3/sources/task3.move new file mode 100644 index 000000000..aa9202a1a --- /dev/null +++ b/mover/xdd-object/code/task3/sources/task3.move @@ -0,0 +1,40 @@ + +module task3::task3{ + use std::string; + use std::string::String; + use sui::object; + use sui::object::UID; + use sui::transfer::transfer; + use sui::tx_context::{TxContext, sender}; + + public struct XddNFT has key{ + id: UID, + name: String, + image_url: String, + } + + + fun init(ctx: &mut TxContext) { + let nft = XddNFT{ + id:object::new(ctx), + name: string::utf8(b"XDD NFT"), + image_url: string::utf8(b"https://avatars.githubusercontent.com/u/24604365"), + }; + // 初始化时给自己一个nft + transfer(nft, ctx.sender() ) + } + + //提供方法给外部调用, 给指定用户发送一个nft + public entry fun mint(url: String, add: address, ctx: &mut TxContext) { + let nft = XddNFT{ + id:object::new(ctx), + name: string::utf8(b"XDD NFT"), + image_url: url, + }; + transfer(nft, add) + } + +} + + + diff --git a/mover/xdd-object/code/task3/tests/task3_tests.move b/mover/xdd-object/code/task3/tests/task3_tests.move new file mode 100644 index 000000000..d128fbb0f --- /dev/null +++ b/mover/xdd-object/code/task3/tests/task3_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module task3::task3_tests; +// uncomment this line to import the module +// use task3::task3; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_task3() { + // pass +} + +#[test, expected_failure(abort_code = ::task3::task3_tests::ENotImplemented)] +fun test_task3_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/xdd-object/code/task4/.gitignore b/mover/xdd-object/code/task4/.gitignore new file mode 100644 index 000000000..a007feab0 --- /dev/null +++ b/mover/xdd-object/code/task4/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/xdd-object/code/task4/Move.toml b/mover/xdd-object/code/task4/Move.toml new file mode 100644 index 000000000..9d462d82f --- /dev/null +++ b/mover/xdd-object/code/task4/Move.toml @@ -0,0 +1,48 @@ +[package] +name = "task4" +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)"] + +#version = "0.0.0" +#published-at = "0x4e0b41c7e253f7ed700a6f7b2aab108c6e4166743943a8baed439e484833789f" + + +[dependencies] +Sui = { git = "https://gitee.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +#mycoin = { local = "../task2/" } +# 引入自己创建的代币 +xdd_object_faucet={local = "../task2/xdd_object_faucet"} + +# 引入第三方代币(未成功) +#xdd_object = { address = "0xba67f9e412da95fa110516926ce34257b1f988240ec2f6fd08fbe512c8ce45a8", local = "xdd_object" } + + +# 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] +task4 = "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/xdd-object/code/task4/call.sh b/mover/xdd-object/code/task4/call.sh new file mode 100644 index 000000000..0f9726faf --- /dev/null +++ b/mover/xdd-object/code/task4/call.sh @@ -0,0 +1,31 @@ +sui client call --package 包名 --module 模块名 --function 方法名 --type-args 币种 --args 权限id(TreasuryCap对应的id) 金额 地址 + + +# 添加奖池金额 参数解释:第一个game共享对象id, 第二个资产id +sui client call --package 0x4e0b41c7e253f7ed700a6f7b2aab108c6e4166743943a8baed439e484833789f --module task4 --function add_sui --args 0x97419f15d3153a252eac3b14761090203d1cf55e0a621c38b8a6eb8e5af26317 0xca7259653a9b56ab0b2db111815387bdefcf8c5e70ce91734b69262f68027ad5 + +# 从奖池取出金额 参数解释:第一个权限id, 第二个game共享对象id, 第三个取出金额 + +sui client call --package 0x4e0b41c7e253f7ed700a6f7b2aab108c6e4166743943a8baed439e484833789f --module task4 --function remove_sui --args 0xc4b03e52c54283121c3cf7754105f16030dab872c845242ff219b8f73b435050 0x97419f15d3153a252eac3b14761090203d1cf55e0a621c38b8a6eb8e5af26317 1000000000 + +# 玩游戏 参数解释:第一个game共享对象id, 第二个:随机数id 0x8, 第三个:自己选择的值, 第四个:金额id + +sui client call --package 0x51883c68119fd598933c0860172355a861e10cee82370ae2c855a424ecece287 --module task4 --function play --args 0x97419f15d3153a252eac3b14761090203d1cf55e0a621c38b8a6eb8e5af26317 0x8 true 0xa00c32cc4f21c54097086ba21e372edfdae2841440e5e686c985559f6a25c49c + + +# 将金额拆分 + + +# 升级包 参数:权限id UpgradeCap +sui client upgrade --upgrade-capability 0x8e7cfb863d44c342d6d6aefb391c80f5da1de32c6ec8d2a0778dbd2be0320aa4 + + + + + +#正式环境 +sui client call --package 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231 --module game --function add_game_pool --args 0x174f9a7fc481ad7b5509c04f91e095638067a55843a24493816f3b6b347d426b 0x4dd838600add91e985856d6cad331531b698d2ab4dcda01c79a15b7541f59bdf + +sui client call --package 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231 --module game --function play --args 0x174f9a7fc481ad7b5509c04f91e095638067a55843a24493816f3b6b347d426b true 0x059c5529c8779030e9c4679063d1e567a152e3bbe814ced5d0cb2530867776db 0x8 + +sui client call --package 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231 --module game --function get_game_pool --args 0xf81131820ba24bb3184b34ef58152407ee1078c54b5b56394867ce6eeff895b8 0x174f9a7fc481ad7b5509c04f91e095638067a55843a24493816f3b6b347d426b 10000000000 \ No newline at end of file diff --git a/mover/xdd-object/code/task4/log b/mover/xdd-object/code/task4/log new file mode 100644 index 000000000..1e8cdd934 --- /dev/null +++ b/mover/xdd-object/code/task4/log @@ -0,0 +1,159 @@ +Transaction Digest: 5yT1A86XcZPEFKjQKpTiWzeaMsXdp4RqNuw652kX1Q7T +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 17908400 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Version: 458803141 │ +│ │ Digest: CggHy69NPVvLQeii2nXML5E34tNcg3ZMMLXGVETMXgcT │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ 0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ aq8q4sJCr2clUBT3531Z8s9x+og3tGuSmkVsrMttoiK3QzdHTsVTgUKWpWBrfo4UZTmhYgtOFXpR6FSoDeIHDA== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 5yT1A86XcZPEFKjQKpTiWzeaMsXdp4RqNuw652kX1Q7T │ +│ Status: Success │ +│ Executed Epoch: 622 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x174f9a7fc481ad7b5509c04f91e095638067a55843a24493816f3b6b347d426b │ +│ │ Owner: Shared( 458803142 ) │ +│ │ Version: 458803142 │ +│ │ Digest: AQmjix5LnFvCz2uiHKSj8rRsP5ynkJxp84FSAsdDG7Gj │ +│ └── │ +│ ┌── │ +│ │ ID: 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: Ff7TXH23ZCoYD3PziMMyMR88wSdpjbCnMiHuGwg4bfKa │ +│ └── │ +│ ┌── │ +│ │ ID: 0xe8c225519b9559fb9e53dd8f48af4ca454601d3777b371c3bd93ced786ae31d9 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803142 │ +│ │ Digest: Ce8zGjpTXvM8fjzr16ZBXLhoBh2REJoBS5vU1wczZ8T5 │ +│ └── │ +│ ┌── │ +│ │ ID: 0xf81131820ba24bb3184b34ef58152407ee1078c54b5b56394867ce6eeff895b8 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803142 │ +│ │ Digest: 4AoKb6gwx6vxzkxwDvREKwcytBgUsSx8BR2dGv4FNbqF │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803142 │ +│ │ Digest: 7au2JLaojKjJUU8b5hVeQK5KmtCdyT2mhwTkgkM2kG4q │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803142 │ +│ │ Digest: 7au2JLaojKjJUU8b5hVeQK5KmtCdyT2mhwTkgkM2kG4q │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 16408400 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 4bmmzaJwnpesaDPQ7WckdztXuE84EyNyGYprxE1JiDAr │ +│ 7KwxNsp5BYYk1ceYABe9rub5HMJxXzJtfxkyxBJH5pEk │ +│ CrzVT94WvHWqQGR9WmbmC5bap45GaNBzse1vTHfzcs8a │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x174f9a7fc481ad7b5509c04f91e095638067a55843a24493816f3b6b347d426b │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Shared( 458803142 ) │ +│ │ ObjectType: 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231::game::GamePool │ +│ │ Version: 458803142 │ +│ │ Digest: AQmjix5LnFvCz2uiHKSj8rRsP5ynkJxp84FSAsdDG7Gj │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xe8c225519b9559fb9e53dd8f48af4ca454601d3777b371c3bd93ced786ae31d9 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 458803142 │ +│ │ Digest: Ce8zGjpTXvM8fjzr16ZBXLhoBh2REJoBS5vU1wczZ8T5 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xf81131820ba24bb3184b34ef58152407ee1078c54b5b56394867ce6eeff895b8 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231::game::AdminCap │ +│ │ Version: 458803142 │ +│ │ Digest: 4AoKb6gwx6vxzkxwDvREKwcytBgUsSx8BR2dGv4FNbqF │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 458803142 │ +│ │ Digest: 7au2JLaojKjJUU8b5hVeQK5KmtCdyT2mhwTkgkM2kG4q │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231 │ +│ │ Version: 1 │ +│ │ Digest: Ff7TXH23ZCoYD3PziMMyMR88wSdpjbCnMiHuGwg4bfKa │ +│ │ Modules: game │ +│ └── │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -16180280 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/xdd-object/code/task4/sources/game.move b/mover/xdd-object/code/task4/sources/game.move new file mode 100644 index 000000000..7ce07abd5 --- /dev/null +++ b/mover/xdd-object/code/task4/sources/game.move @@ -0,0 +1,109 @@ +module task4::game { + use sui::balance; + use sui::balance::Balance; + use sui::coin; + use sui::coin::Coin; + use sui::object; + use sui::object::UID; + use sui::random; + use sui::random::Random; + use sui::transfer::{transfer, share_object, public_transfer}; + use sui::tx_context::TxContext; + use xdd_object_faucet::xdd_object_faucet::XDD_OBJECT_FAUCET; + + const PramsGt5:u64 = 0x1001; + const PramsGtPool:u64 = 0x1002; + + //游戏奖池 + public struct GamePool has key{ + id: UID, + //奖池余额 + pool: Balance + } + + //权限 + public struct AdminCap has key{ + id:UID + } + + //初始化游戏数据 + fun init(ctx: &mut TxContext) { + //创建管理员权限 + let adminCap = AdminCap{id: object::new(ctx)}; + + //创建游戏奖池 + let gamePool = GamePool{ + id: object::new(ctx), + pool: balance::zero() + }; + + //将游戏管理员权限给自己 + transfer(adminCap, ctx.sender()); + + //将奖池权限分享出去 + share_object(gamePool); + } + + + //玩游戏 + public entry fun play(gamePool: &mut GamePool, in: bool, amount: Coin, rand: &Random, ctx: &mut TxContext) { + //校验金额不能大于5 + let amt = amount.value(); + assert!(amt <= 5000000000, PramsGt5); + + //金额不能大于奖池 + let poolAmt = gamePool.pool.value(); + assert!(amt <= poolAmt, PramsGtPool); + + let mut gen = random::new_generator(rand, ctx); + let ranFlag = random::generate_bool(&mut gen); + + if (in == ranFlag){ + //用户赢到的钱 + let win = gamePool.pool.split(amount.value()); + //将balance转成代币 + let winCoin = coin::from_balance(win, ctx); + //将赢到的代币转给参与者 + public_transfer(winCoin, ctx.sender()); + //将用户参与的金额还回去 + public_transfer(amount, ctx.sender()); + }else { //输了 + //将用户参与的金额存入奖池 + gamePool.pool.join(coin::into_balance(amount)); + } + + + + + + } + + + + + //给奖池增加金额 + public entry fun add_game_pool(gamePool: &mut GamePool, amount: Coin, _ctx: &mut TxContext) { + //将代币转换吃balance + let userAmount = coin::into_balance(amount); + + //将balance存到游戏奖池 + gamePool.pool.join(userAmount); + } + + + //将奖池金额取出 + public entry fun get_game_pool(_: &AdminCap, gamePool: &mut GamePool, amount: u64, ctx: &mut TxContext) { + //从奖池取出的余额 + let takeAmount = gamePool.pool.split(amount); + + //将余额转成代币 + let xddCoin = coin::from_balance(takeAmount, ctx); + + //将代币转给自己 + public_transfer(xddCoin, ctx.sender()); + } + + + + +} diff --git a/mover/xdd-object/code/task4/sources/task4.move b/mover/xdd-object/code/task4/sources/task4.move new file mode 100644 index 000000000..9d88b28a9 --- /dev/null +++ b/mover/xdd-object/code/task4/sources/task4.move @@ -0,0 +1,112 @@ +// /* +// /// Module: task4 +// module task4::task4; +// */ +// +// // For Move coding conventions, see +// // https://docs.sui.io/concepts/sui-move-concepts/conventions +// +// // 1、掌握怎么存钱 Balace Coin -> Balance +// // 2、掌握怎么取钱 from_balance Balance -> Coin +// // 3、掌握交互 +// +// module task4::task4{ +// use sui::balance; +// use sui::balance::Balance; +// use sui::coin; +// use sui::coin::Coin; +// use sui::object; +// use sui::object::UID; +// use sui::random; +// use sui::random::Random; +// use sui::sui::SUI; +// use sui::transfer::{share_object, public_transfer, transfer}; +// use sui::tx_context::TxContext; +// #[test_only] +// use std::debug::print; +// #[test_only] +// use std::string; +// // use 0x7e81cbf616ef12f9049ede655c0d9ee31283fbe8f15067f749b010c40c280d76::usd::USD; +// +// public struct Game has key{ +// id: UID, +// // 在合约存钱都要用 Balance +// amount: Balance +// // amount: Balance +// } +// +// //权限 +// public struct AdminCap has key{ +// id: UID, +// } +// +// fun init(ctx: &mut TxContext) { +// let game = Game{ +// id: object::new(ctx), +// amount: balance::zero() +// }; +// +// //设置游戏所有权 +// share_object(game); +// +// //将管理员权限给自己 +// let adminCap = AdminCap{id:object::new(ctx)}; +// transfer(adminCap, ctx.sender()); +// } +// +// // #[test] +// // fun test() { +// // assert!(1 <= 5, 0x10086); +// // print(&string::utf8(b"11111")); +// // } +// +// +// //玩游戏, game:游戏, rand:随机数 @0x8, in:输入的值(true:正面, false:反面), amt:参与金额, ctx:当前玩的人 +// entry fun play(game: &mut Game, rand: &Random, in: bool, amt: Coin, ctx: &mut TxContext) { +// //获取用参与金额 +// let amt_num = amt.value(); +// let game_num = game.amount.value(); +// +// //断言,判断奖池金额 +// assert!(game_num >= amt_num, 0x10086); +// assert!(amt_num <= 5000000000, 0x10087); +// +// +// //随机生成布尔值 +// let mut gen = random::new_generator(rand, ctx); +// let flag = random::generate_bool(&mut gen); +// +// if(in == flag) { //赢 加倍奖励 +// let win_balance = game.amount.split(amt_num); +// let win_coin = coin::from_balance(win_balance, ctx); +// public_transfer(win_coin, ctx.sender()); +// public_transfer(amt, ctx.sender()); +// } else { //输 输了就没了 +// //将coin转成balance +// let amt_balance = coin::into_balance(amt); +// //将输的钱转到奖池 +// game.amount.join(amt_balance); +// +// } +// +// } +// +// //给奖池加钱 +// public entry fun add_sui(game: &mut Game, amt: Coin, _: &mut TxContext) { +// let amt_balance = coin::into_balance(amt); +// game.amount.join(amt_balance); +// } +// +// //从奖池取钱 +// public entry fun remove_sui(_: &AdminCap, game: &mut Game, amt: u64, ctx: &mut TxContext) { +// let out_balance = game.amount.split(amt); +// let out_coin = coin::from_balance(out_balance, ctx); +// public_transfer(out_coin, ctx.sender()); +// } +// +// //获取当前奖池余额 +// public entry fun get_pool(game: &mut Game,_: &mut TxContext) : u64{ +// game.amount.value() +// } +// +// } \ No newline at end of file diff --git a/mover/xdd-object/code/task4/tests/task4_tests.move b/mover/xdd-object/code/task4/tests/task4_tests.move new file mode 100644 index 000000000..178d33b9e --- /dev/null +++ b/mover/xdd-object/code/task4/tests/task4_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module task4::task4_tests; +// uncomment this line to import the module +// use task4::task4; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_task4() { + // pass +} + +#[test, expected_failure(abort_code = ::task4::task4_tests::ENotImplemented)] +fun test_task4_fail() { + abort ENotImplemented +} +*/ diff --git "a/mover/xdd-object/code/task4/\345\215\207\347\272\247log" "b/mover/xdd-object/code/task4/\345\215\207\347\272\247log" new file mode 100644 index 000000000..b7c10b277 --- /dev/null +++ "b/mover/xdd-object/code/task4/\345\215\207\347\272\247log" @@ -0,0 +1,147 @@ +Transaction Digest: 5TrRqJLfYkoPiAVaZxzjcVJD6DonWPhDRNHBrXvGzxgM +╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 13173140 MIST │ +│ Gas Price: 1000 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Version: 289569416 │ +│ │ Digest: BuWsfo1S2MjNbfNGCZRd49FUqMmZqMeu1fsiJXpyGaod │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Imm/Owned Object ID: 0x8e7cfb863d44c342d6d6aefb391c80f5da1de32c6ec8d2a0778dbd2be0320aa4 │ │ +│ │ 1 Pure Arg: Type: u8, Value: 0 │ │ +│ │ 2 Pure Arg: Type: vector, Value: [113,41,186,50,204,89,77,7,113,157,188,217,181,157,92,7,143,38,103,180,79,17,13,64,213,0,156,84,135,230,178,58] │ │ +│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├───────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 MoveCall: │ │ +│ │ ┌ │ │ +│ │ │ Function: authorize_upgrade │ │ +│ │ │ Module: package │ │ +│ │ │ Package: 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ Arguments: │ │ +│ │ │ Input 0 │ │ +│ │ │ Input 1 │ │ +│ │ │ Input 2 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 Upgrade: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ Current Package ID: 0x4e0b41c7e253f7ed700a6f7b2aab108c6e4166743943a8baed439e484833789f │ │ +│ │ │ Ticket: Result 0 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 2 MoveCall: │ │ +│ │ ┌ │ │ +│ │ │ Function: commit_upgrade │ │ +│ │ │ Module: package │ │ +│ │ │ Package: 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ Arguments: │ │ +│ │ │ Input 0 │ │ +│ │ │ Result 1 │ │ +│ │ └ │ │ +│ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ puRRI/JkP/xi1JAHbu+sAdxpvT1EUJ7qHOzMaoTff1qCU0abf53JuhxlOli9zPJu5BGBWPJgHGpiLh/ymhPWDg== │ +│ │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 5TrRqJLfYkoPiAVaZxzjcVJD6DonWPhDRNHBrXvGzxgM │ +│ Status: Success │ +│ Executed Epoch: 590 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x51883c68119fd598933c0860172355a861e10cee82370ae2c855a424ecece287 │ +│ │ Owner: Immutable │ +│ │ Version: 2 │ +│ │ Digest: FMEssMWzir1bSZHzTcouzEpA4C9pJnHta7GXHTgZjfDR │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569417 │ +│ │ Digest: 6S86W4jJQikDa3UQdMMkZCX1dVxCPfjv7ogyF7fqtPyn │ +│ └── │ +│ ┌── │ +│ │ ID: 0x8e7cfb863d44c342d6d6aefb391c80f5da1de32c6ec8d2a0778dbd2be0320aa4 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569417 │ +│ │ Digest: 5ECrjXfrdHoGYsvU4hWc4oU1pAnijNmz3h1U8vyxvkGm │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569417 │ +│ │ Digest: 6S86W4jJQikDa3UQdMMkZCX1dVxCPfjv7ogyF7fqtPyn │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 12790800 MIST │ +│ Computation Cost: 1000000 MIST │ +│ Storage Rebate: 2595780 MIST │ +│ Non-refundable Storage Fee: 26220 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 5imKZYET4cJnHZsQk7ayrTwvJwExTX2nUHrSn9JTmSbV │ +│ 7V8GcjJ88nory8dmqtJHz7Gwxy7YJ5JQrvfVA9w8YHkn │ +│ Gtwgse64nSVXhQvmqCpwCe5xJz9N4VypvEGJUy5DyG4e │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├──────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 289569417 │ +│ │ Digest: 6S86W4jJQikDa3UQdMMkZCX1dVxCPfjv7ogyF7fqtPyn │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x8e7cfb863d44c342d6d6aefb391c80f5da1de32c6ec8d2a0778dbd2be0320aa4 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 289569417 │ +│ │ Digest: 5ECrjXfrdHoGYsvU4hWc4oU1pAnijNmz3h1U8vyxvkGm │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x51883c68119fd598933c0860172355a861e10cee82370ae2c855a424ecece287 │ +│ │ Version: 2 │ +│ │ Digest: FMEssMWzir1bSZHzTcouzEpA4C9pJnHta7GXHTgZjfDR │ +│ │ Modules: task4 │ +│ └── │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -11195020 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git "a/mover/xdd-object/code/task4/\350\207\252\345\267\261\344\273\243\345\270\201\347\211\210\346\234\254call.sh" "b/mover/xdd-object/code/task4/\350\207\252\345\267\261\344\273\243\345\270\201\347\211\210\346\234\254call.sh" new file mode 100644 index 000000000..6f520557f --- /dev/null +++ "b/mover/xdd-object/code/task4/\350\207\252\345\267\261\344\273\243\345\270\201\347\211\210\346\234\254call.sh" @@ -0,0 +1,11 @@ +sui client call --package 包名 --module 模块名 --function 方法名 --args 权限id(TreasuryCap对应的id) 金额 地址 + +#添加奖池 参数1:奖池 参数二:代币id +sui client call --package 0x5da0720885ac25b58704ac11c1664bedb5917026b38850ef24c5a2684860a765 --module game --function add_game_pool --args 0x6f39c0b0e4c0bb21bc32ac94947db9d06fdf908827c46e4e81f50063faf034b9 0x9259b931868bbb433e98cacd2ec40b199c0abfcc14201f9dc582ceaee7a2bccf + +#玩游戏 可能需要设置gas费 --gas-budget 10000000 +sui client call --package 0x5da0720885ac25b58704ac11c1664bedb5917026b38850ef24c5a2684860a765 --module game --function play --args 0x6f39c0b0e4c0bb21bc32ac94947db9d06fdf908827c46e4e81f50063faf034b9 true 0xf45c462a4009894e8ad6e0e8ec59cf366f1ff5bb714a838241b6f9391303ebe9 0x8 + + + + diff --git "a/mover/xdd-object/code/task4/\350\207\252\345\267\261\344\273\243\345\270\201\347\211\210\346\234\254log" "b/mover/xdd-object/code/task4/\350\207\252\345\267\261\344\273\243\345\270\201\347\211\210\346\234\254log" new file mode 100644 index 000000000..cf488f182 --- /dev/null +++ "b/mover/xdd-object/code/task4/\350\207\252\345\267\261\344\273\243\345\270\201\347\211\210\346\234\254log" @@ -0,0 +1,159 @@ +Transaction Digest: 97pMpHr4b84ng1CDjF7hnxPwf9aQN7Bjcbn49w82q61P +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 18408400 MIST │ +│ Gas Price: 1000 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Version: 289569427 │ +│ │ Digest: xV9ysMZEpeZ2h22Dzy5qyNo4NuMXLdQe2XAdqD6oQSS │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ 0x1806931dfd9024b573fbd8abe56e3bc52c7f7030400921b7b9e859ca17b73c31 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ L2zB63uxrMMiN4LrgboYXoS5MA7l1V7SaTudVvcUFCailRj3QDOKH9FqBDyJNlB9oWo5CQcRJl5v3mMugXLMDw== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 97pMpHr4b84ng1CDjF7hnxPwf9aQN7Bjcbn49w82q61P │ +│ Status: Success │ +│ Executed Epoch: 592 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x5bff15b0c5a0707e26c9b2f247b2c5ecc3e09ff31529b1022bdfae5630887b65 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569428 │ +│ │ Digest: cSJUWUA5xia76PdSVJp9W96xuxp3TsenAk68AwPLB7C │ +│ └── │ +│ ┌── │ +│ │ ID: 0x5da0720885ac25b58704ac11c1664bedb5917026b38850ef24c5a2684860a765 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: FiJXhp6Yf2W9pPDh1sM4HxMZWt8XyoMYWtiUf9yDbwj5 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x6f39c0b0e4c0bb21bc32ac94947db9d06fdf908827c46e4e81f50063faf034b9 │ +│ │ Owner: Shared( 289569428 ) │ +│ │ Version: 289569428 │ +│ │ Digest: Gv29K16RPgKnu4GQBRRNrt6aSR8UTo6px3vXeUKmN7n9 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x70e1e80d7be3ae4a5f9e62b2ed4709ff1389c920e03167868c15b1de59bbebcb │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569428 │ +│ │ Digest: Aea9p3FTFF8sZ3acQaiwh3kRm5ySs4sMdLGgpjyTcCQw │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569428 │ +│ │ Digest: HhSD98TukNUy8jyc49G8kSb5TVpRpi2niKmf39zQ66oN │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569428 │ +│ │ Digest: HhSD98TukNUy8jyc49G8kSb5TVpRpi2niKmf39zQ66oN │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 16408400 MIST │ +│ Computation Cost: 1000000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 719G4VadderQjo7pzjSu6ZYAAXDtdubhttMe8qeqnuVp │ +│ AbFwqLCQpBcjkSFAGavQKBaTUK6Nzur4UGnYSXCYWi1E │ +│ Gtwgse64nSVXhQvmqCpwCe5xJz9N4VypvEGJUy5DyG4e │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x5bff15b0c5a0707e26c9b2f247b2c5ecc3e09ff31529b1022bdfae5630887b65 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 289569428 │ +│ │ Digest: cSJUWUA5xia76PdSVJp9W96xuxp3TsenAk68AwPLB7C │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x6f39c0b0e4c0bb21bc32ac94947db9d06fdf908827c46e4e81f50063faf034b9 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Shared( 289569428 ) │ +│ │ ObjectType: 0x5da0720885ac25b58704ac11c1664bedb5917026b38850ef24c5a2684860a765::game::GamePool │ +│ │ Version: 289569428 │ +│ │ Digest: Gv29K16RPgKnu4GQBRRNrt6aSR8UTo6px3vXeUKmN7n9 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x70e1e80d7be3ae4a5f9e62b2ed4709ff1389c920e03167868c15b1de59bbebcb │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x5da0720885ac25b58704ac11c1664bedb5917026b38850ef24c5a2684860a765::game::AdminCap │ +│ │ Version: 289569428 │ +│ │ Digest: Aea9p3FTFF8sZ3acQaiwh3kRm5ySs4sMdLGgpjyTcCQw │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 289569428 │ +│ │ Digest: HhSD98TukNUy8jyc49G8kSb5TVpRpi2niKmf39zQ66oN │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x5da0720885ac25b58704ac11c1664bedb5917026b38850ef24c5a2684860a765 │ +│ │ Version: 1 │ +│ │ Digest: FiJXhp6Yf2W9pPDh1sM4HxMZWt8XyoMYWtiUf9yDbwj5 │ +│ │ Modules: game │ +│ └── │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -16430280 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/xdd-object/code/task5/.gitignore b/mover/xdd-object/code/task5/.gitignore new file mode 100644 index 000000000..a007feab0 --- /dev/null +++ b/mover/xdd-object/code/task5/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/xdd-object/code/task5/Move.toml b/mover/xdd-object/code/task5/Move.toml new file mode 100644 index 000000000..7c71d0915 --- /dev/null +++ b/mover/xdd-object/code/task5/Move.toml @@ -0,0 +1,39 @@ +[package] +name = "task5" +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" } +xdd_object={local = "../task2/xdd_object"} +xdd_object_faucet={local = "../task2/xdd_object_faucet"} + +# 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] +task5 = "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/xdd-object/code/task5/call.sh b/mover/xdd-object/code/task5/call.sh new file mode 100644 index 000000000..a81758e67 --- /dev/null +++ b/mover/xdd-object/code/task5/call.sh @@ -0,0 +1,28 @@ +sui client call --package 包名 --module 模块名 --function 方法名 --args 权限id(TreasuryCap对应的id) 金额 地址 + +#系统存入XDD_OBJECT +sui client call --package 0xf9d6fc47cf25e25dd0a104f373642a764620c401bf62788b0d39ce7e9e215c91 --module xdd_object_swap --function save_xdd_object_balance --args 0xc434eb80cc7d1e58333ad519daffb4a171d15126aaa576a1ccf0d5e1a863ee04 0x4d2f813a0a8ff39d99be6d83c1666d0de0840ce5cb8ebc4f97b8da717e134ef7 0xb3577d808192199c483f26478e9a8f90415d252eb3ec602f517e1c3051489820 + +#系统存入XDD_OBJECT_FAUCET +sui client call --package 0xf9d6fc47cf25e25dd0a104f373642a764620c401bf62788b0d39ce7e9e215c91 --module xdd_object_swap --function save_xdd_object_faucet_balance --args 0xc434eb80cc7d1e58333ad519daffb4a171d15126aaa576a1ccf0d5e1a863ee04 0x4d2f813a0a8ff39d99be6d83c1666d0de0840ce5cb8ebc4f97b8da717e134ef7 0xf21892bec8ee4f8e5aefaccf427fd2eef47aa14396f9578bc6fecd843b7ae326 + +#使用XDD_OBJECT兑换XDD_OBJECT_FAUCET, 比例1:2 +sui client call --package 0xf9d6fc47cf25e25dd0a104f373642a764620c401bf62788b0d39ce7e9e215c91 --module xdd_object_swap --function xdd_object_to_faucet --args 0x4d2f813a0a8ff39d99be6d83c1666d0de0840ce5cb8ebc4f97b8da717e134ef7 0x5bdbce5b0e3289daaf081784805830a698e6b5e26d4f1a8d579c236e61e2d787 + +#使用XDD_OBJECT_FAUCET兑换XDD_OBJECT, 比例2:1 +sui client call --package 0xf9d6fc47cf25e25dd0a104f373642a764620c401bf62788b0d39ce7e9e215c91 --module xdd_object_swap --function faucet_to_xdd_object --args 0x4d2f813a0a8ff39d99be6d83c1666d0de0840ce5cb8ebc4f97b8da717e134ef7 0x71552ad65c346f819b024b5b7958fa09aac4eb9020e7e48e5b86e3bdc88d3cd6 + + + +#正式环境 +#系统存入XDD_OBJECT +sui client call --package 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca --module xdd_object_swap --function save_xdd_object_balance --args 0x5342a55d6360d2f83baa380c0f9f05857f7973b0e17bcb687561057d2bf9e46c 0x8a79cf33cb9e862166541e52636615af6efc1cb1accd5ae4bdb1f96c655ec638 0x03b4603a431f9b2acb8db1c5b5eb932e239df7f24f8498435c12bf20b74ed239 + +#系统存入XDD_OBJECT_FAUCET +sui client call --package 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca --module xdd_object_swap --function save_xdd_object_faucet_balance --args 0x5342a55d6360d2f83baa380c0f9f05857f7973b0e17bcb687561057d2bf9e46c 0x8a79cf33cb9e862166541e52636615af6efc1cb1accd5ae4bdb1f96c655ec638 0xe63ce85eb29897e47c6c4b6abbfc94f4b67290f071fe11f5fa6271806047755a + +#使用XDD_OBJECT兑换XDD_OBJECT_FAUCET, 比例1:2 +sui client call --package 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca --module xdd_object_swap --function xdd_object_to_faucet --args 0x8a79cf33cb9e862166541e52636615af6efc1cb1accd5ae4bdb1f96c655ec638 0xc9b52229909d820e6775a6a8db8b9855dd56cee9588568f6890e3a2157f3e411 + +#使用XDD_OBJECT_FAUCET兑换XDD_OBJECT, 比例2:1 +sui client call --package 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca --module xdd_object_swap --function faucet_to_xdd_object --args 0x8a79cf33cb9e862166541e52636615af6efc1cb1accd5ae4bdb1f96c655ec638 0xa31b045db3fe8d65a5203b39ebc057910675effe7cfb5112bef36a6db72195fe diff --git a/mover/xdd-object/code/task5/log b/mover/xdd-object/code/task5/log new file mode 100644 index 000000000..6ce3132e3 --- /dev/null +++ b/mover/xdd-object/code/task5/log @@ -0,0 +1,161 @@ +Transaction Digest: FSdknBSTZtk16BcVi23B2M3RXaq6yPKKdXpS7qh9CLHa +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 20317600 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Version: 458803147 │ +│ │ Digest: 366VQcKYGgJZB9AbHRGMB7eQn2kEDcti4cXvsFz2YXP3 │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ 0x2cdd34202d285b2f4579955b57cb29cfd1c7ac9178cdc0d8424e47eb0c7a4016 │ │ +│ │ │ 0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ VwyfiveLYCLcwvzXAC1OFZOHp17Kapq54x2+JRk9NXX3O1MrPcmSQ9U1sGLGsOKIOcqQuqTkhzrhdKY1NAD0Cw== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: FSdknBSTZtk16BcVi23B2M3RXaq6yPKKdXpS7qh9CLHa │ +│ Status: Success │ +│ Executed Epoch: 622 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x5342a55d6360d2f83baa380c0f9f05857f7973b0e17bcb687561057d2bf9e46c │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803148 │ +│ │ Digest: CAtowM7k9etr9gYHWASHvsM8a18dqc6u81vcMC7781u8 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x8a79cf33cb9e862166541e52636615af6efc1cb1accd5ae4bdb1f96c655ec638 │ +│ │ Owner: Shared( 458803148 ) │ +│ │ Version: 458803148 │ +│ │ Digest: 5HX9Z1yYZrnjxwcohLosa5Hq5u5aqPtyQqbTPJkRAH5Z │ +│ └── │ +│ ┌── │ +│ │ ID: 0xb5b93e918d5c55a0d9d705f5aa35f4fe143b353ada9c2692302bdac6157b5655 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803148 │ +│ │ Digest: 95DtXvtYLTvXGVuM4FZ5aZKGzgHd4ShyAxfEicXDHCtG │ +│ └── │ +│ ┌── │ +│ │ ID: 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: A4vEM9YQeLcVjAU3f1uhFuwAVeCVxFg26Z9rem8ykPKv │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803148 │ +│ │ Digest: GRxgp9xUY3jGYqs5RMthNJWnqL8WFAwA8s7goLwem7WP │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 458803148 │ +│ │ Digest: GRxgp9xUY3jGYqs5RMthNJWnqL8WFAwA8s7goLwem7WP │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 18817600 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 3FNdwFA1XeVWMKW9b9zwLUy17eK3yh2cBdDDUAdmoJGF │ +│ 48Dsd2AjJVpQBE9Utwt9EqyYMLw7HvnszscgKPwUzVPJ │ +│ 4bmmzaJwnpesaDPQ7WckdztXuE84EyNyGYprxE1JiDAr │ +│ CrzVT94WvHWqQGR9WmbmC5bap45GaNBzse1vTHfzcs8a │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x5342a55d6360d2f83baa380c0f9f05857f7973b0e17bcb687561057d2bf9e46c │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca::xdd_object_swap::AdminCap │ +│ │ Version: 458803148 │ +│ │ Digest: CAtowM7k9etr9gYHWASHvsM8a18dqc6u81vcMC7781u8 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x8a79cf33cb9e862166541e52636615af6efc1cb1accd5ae4bdb1f96c655ec638 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Shared( 458803148 ) │ +│ │ ObjectType: 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca::xdd_object_swap::Bank │ +│ │ Version: 458803148 │ +│ │ Digest: 5HX9Z1yYZrnjxwcohLosa5Hq5u5aqPtyQqbTPJkRAH5Z │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xb5b93e918d5c55a0d9d705f5aa35f4fe143b353ada9c2692302bdac6157b5655 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 458803148 │ +│ │ Digest: 95DtXvtYLTvXGVuM4FZ5aZKGzgHd4ShyAxfEicXDHCtG │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xe12f0c2b95b59a1eaa061cac68ea8cfd126a9865954de8cae1d9cf8ac30998e7 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 458803148 │ +│ │ Digest: GRxgp9xUY3jGYqs5RMthNJWnqL8WFAwA8s7goLwem7WP │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca │ +│ │ Version: 1 │ +│ │ Digest: A4vEM9YQeLcVjAU3f1uhFuwAVeCVxFg26Z9rem8ykPKv │ +│ │ Modules: xdd_object_swap │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -18589480 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/xdd-object/code/task5/sources/xdd_object_swap.move b/mover/xdd-object/code/task5/sources/xdd_object_swap.move new file mode 100644 index 000000000..a4cd3478d --- /dev/null +++ b/mover/xdd-object/code/task5/sources/xdd_object_swap.move @@ -0,0 +1,102 @@ +module task5::xdd_object_swap { + use sui::balance; + use sui::balance::Balance; + use sui::coin; + use sui::coin::Coin; + use sui::object; + use sui::object::UID; + use sui::transfer::{share_object, transfer, public_transfer}; + use sui::tx_context::TxContext; + use xdd_object::xdd_object::XDD_OBJECT; + use xdd_object_faucet::xdd_object_faucet::XDD_OBJECT_FAUCET; + + const BankXddObjectLow:u64 = 0x10001; + const BankXddObjectFaucetLow:u64 = 0x10002; + + //管理员权限 + public struct AdminCap has key{ + id: UID + } + + //交易所 + public struct Bank has key{ + id: UID, + xdd_object: Balance, + xdd_object_faucet: Balance + } + + + + //初始化方法 + fun init(ctx: &mut TxContext) { + //创建管理员权限,并将管理员权限给自己 + let adminCap = AdminCap{id: object::new(ctx)}; + transfer(adminCap, ctx.sender()); + + //创建交易所, 将交易所权限共享 + let bank = Bank{ + id: object::new(ctx), + xdd_object: balance::zero(), + xdd_object_faucet: balance::zero() + }; + share_object(bank); + } + + //管理员存入金额 + public entry fun save_xdd_object_balance(_: &AdminCap, bank: &mut Bank, amount: Coin, _ctx: &mut TxContext) { + bank.xdd_object.join(coin::into_balance(amount)); + } + + public entry fun save_xdd_object_faucet_balance(_: &AdminCap, bank: &mut Bank, amount: Coin, _ctx: &mut TxContext) { + bank.xdd_object_faucet.join(coin::into_balance(amount)); + } + + //管理员取出金额 + public entry fun get_xdd_object_balance(_: &AdminCap, bank: &mut Bank, amount: u64, ctx: &mut TxContext) { + let balance = bank.xdd_object.split(amount); + let out = coin::from_balance(balance, ctx); + public_transfer(out, ctx.sender()); + } + + public entry fun get_xdd_object_faucet_balance(_: &AdminCap, bank: &mut Bank, amount: u64, ctx: &mut TxContext) { + let balance = bank.xdd_object_faucet.split(amount); + let out = coin::from_balance(balance, ctx); + public_transfer(out, ctx.sender()); + } + + //用XDD_OBJECT 兑换 XDD_OBJECT_FAUCET 比例 1:2 + public entry fun xdd_object_to_faucet(bank: &mut Bank, amount: Coin, ctx: &mut TxContext) { + let amountVal = amount.value()*2; + assert!(bank.xdd_object_faucet.value() >= amountVal, BankXddObjectFaucetLow); + + //将XDD_OBJECT存到余额 + bank.xdd_object.join(coin::into_balance(amount)); + + //取出XDD_OBJECT_FAUCET + let out_balance = bank.xdd_object_faucet.split(amountVal); + let out_coin = coin::from_balance(out_balance, ctx); + + //将取出来的钱转给用户 + public_transfer(out_coin, ctx.sender()) + + } + + + + //用XDD_OBJECT_FAUCET 兑换 XDD_OBJECT 比例 2:1 + public entry fun faucet_to_xdd_object(bank: &mut Bank, amount: Coin, ctx: &mut TxContext) { + let amountVal = amount.value()/2; + assert!(bank.xdd_object.value() >= amountVal, BankXddObjectFaucetLow); + + //将XDD_OBJECT存到余额 + bank.xdd_object_faucet.join(coin::into_balance(amount)); + + //取出XDD_OBJECT_FAUCET + let out_balance = bank.xdd_object.split(amountVal); + let out_coin = coin::from_balance(out_balance, ctx); + + //将取出来的钱转给用户 + public_transfer(out_coin, ctx.sender()) + } + +} diff --git a/mover/xdd-object/code/task5/tests/task5_tests.move b/mover/xdd-object/code/task5/tests/task5_tests.move new file mode 100644 index 000000000..006cda1f9 --- /dev/null +++ b/mover/xdd-object/code/task5/tests/task5_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module task5::task5_tests; +// uncomment this line to import the module +// use task5::task5; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_task5() { + // pass +} + +#[test, expected_failure(abort_code = ::task5::task5_tests::ENotImplemented)] +fun test_task5_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/xdd-object/code/task8/.gitignore b/mover/xdd-object/code/task8/.gitignore new file mode 100644 index 000000000..a007feab0 --- /dev/null +++ b/mover/xdd-object/code/task8/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/xdd-object/code/task8/Cargo.toml b/mover/xdd-object/code/task8/Cargo.toml new file mode 100644 index 000000000..97b3a5dc1 --- /dev/null +++ b/mover/xdd-object/code/task8/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "task8" +version = "0.1.0" +edition = "2021" +[dependencies] +sha3 = "0.10" +bcs = "0.1.4" +serde = { version = "1.0", features = ["derive"] } +hex = "0.4" \ No newline at end of file diff --git a/mover/xdd-object/code/task8/Move.toml b/mover/xdd-object/code/task8/Move.toml new file mode 100644 index 000000000..c550e02e6 --- /dev/null +++ b/mover/xdd-object/code/task8/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "task8" +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] +task8 = "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/xdd-object/code/task8/call.sh b/mover/xdd-object/code/task8/call.sh new file mode 100644 index 000000000..aa7776083 --- /dev/null +++ b/mover/xdd-object/code/task8/call.sh @@ -0,0 +1,9 @@ +sui client call --package 包名 --module 模块名 --function 方法名 --args 权限id(TreasuryCap对应的id) 金额 地址 + +sui client call --package 0x3eec30bde456855fa679baaa60038bd094eedc46e471a3b4567a93d470a14bf6 --module lets_move --function get_flag --args LetsMoveCTF "xdd-object" 0x47ee41c827fb472c6dcad930b4456271de2a4531aa13d16780cb8121c8007dc3 0x8 + + +sui client call --package 0x097a3833b6b5c62ca6ad10f0509dffdadff7ce31e1d86e63e884a14860cedc0f --module lets_move --function get_flag --args 0xcabbc40000000000 "xdd-object" 0x19e76ca504c5a5fa5e214a45fca6c058171ba333f6da897b82731094504d5ab9 0x8 + + + diff --git a/mover/xdd-object/code/task8/log b/mover/xdd-object/code/task8/log new file mode 100644 index 000000000..f25e70893 --- /dev/null +++ b/mover/xdd-object/code/task8/log @@ -0,0 +1,143 @@ +Transaction Digest: HME8Z4kVpnc3Dcnb69uFDhy3kJJMQdrh8SXZLpMAaJtT +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Owner: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ Gas Budget: 16470400 MIST │ +│ Gas Price: 1000 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Version: 289569473 │ +│ │ Digest: 6qGwvPtHt9DNgLK8M3oa6bw4KjVecStkDXGPducD9pEu │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ juxYdBJ89FsIv0buEuAGEg/w3wCKYWP5PcmK1+3LmYQO0uyJep5RxeYXtUEmAzCmR/gQVoWPEhZIs7RJRKIHDA== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: HME8Z4kVpnc3Dcnb69uFDhy3kJJMQdrh8SXZLpMAaJtT │ +│ Status: Success │ +│ Executed Epoch: 593 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x3eec30bde456855fa679baaa60038bd094eedc46e471a3b4567a93d470a14bf6 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: J8wmV7Lu1iskqRpCphgQXCCWHbFZ5zz35V1cZ6hbwws │ +│ └── │ +│ ┌── │ +│ │ ID: 0x47ee41c827fb472c6dcad930b4456271de2a4531aa13d16780cb8121c8007dc3 │ +│ │ Owner: Shared( 289569474 ) │ +│ │ Version: 289569474 │ +│ │ Digest: BkvcHawg1nAdY5VNHZrWnDEieMPk1nbmfc2kDe5xetBE │ +│ └── │ +│ ┌── │ +│ │ ID: 0x73b560ea4744447d01d5e9daae165445497e02286fc2d6c0847a5c2f501b01b4 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569474 │ +│ │ Digest: CzG6MrBcbN4TFcVPa2LRGybkUXi4frpDzZZPS4Tsep65 │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569474 │ +│ │ Digest: 9Dietc4DHTLHMXjEybGYZmsW3WUb3keQEwaauNknZUHc │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ Version: 289569474 │ +│ │ Digest: 9Dietc4DHTLHMXjEybGYZmsW3WUb3keQEwaauNknZUHc │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 14470400 MIST │ +│ Computation Cost: 1000000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 9tjFWpDcaUxuSBo3PeDgEUpEnksZgnHSh64jZuMYTmYU │ +│ Gtwgse64nSVXhQvmqCpwCe5xJz9N4VypvEGJUy5DyG4e │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x47ee41c827fb472c6dcad930b4456271de2a4531aa13d16780cb8121c8007dc3 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Shared( 289569474 ) │ +│ │ ObjectType: 0x3eec30bde456855fa679baaa60038bd094eedc46e471a3b4567a93d470a14bf6::lets_move::Challenge │ +│ │ Version: 289569474 │ +│ │ Digest: BkvcHawg1nAdY5VNHZrWnDEieMPk1nbmfc2kDe5xetBE │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x73b560ea4744447d01d5e9daae165445497e02286fc2d6c0847a5c2f501b01b4 │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 289569474 │ +│ │ Digest: CzG6MrBcbN4TFcVPa2LRGybkUXi4frpDzZZPS4Tsep65 │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x026373cf3928b8e2a245fa272bee8c59b2f239a3672456cb44c39305c90c1cbd │ +│ │ Sender: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 289569474 │ +│ │ Digest: 9Dietc4DHTLHMXjEybGYZmsW3WUb3keQEwaauNknZUHc │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x3eec30bde456855fa679baaa60038bd094eedc46e471a3b4567a93d470a14bf6 │ +│ │ Version: 1 │ +│ │ Digest: J8wmV7Lu1iskqRpCphgQXCCWHbFZ5zz35V1cZ6hbwws │ +│ │ Modules: lets_move │ +│ └── │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -14492280 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/xdd-object/code/task8/sources/lets_move.move b/mover/xdd-object/code/task8/sources/lets_move.move new file mode 100644 index 000000000..6738d4007 --- /dev/null +++ b/mover/xdd-object/code/task8/sources/lets_move.move @@ -0,0 +1,88 @@ +module task8::lets_move { + use std::ascii::{String, string}; + use std::hash; + use sui::bcs; + use sui::event::emit; + use sui::random; + use sui::random::Random; + use sui::transfer::share_object; + + const EPROOF: u64 = 110; + + public struct Flag has copy, drop { + sender: address, + flag: bool, + ture_num: u64, + github_id: String + } + + public struct Challenge has key { + id: UID, + str: String, + difficulity: u64, + ture_num: u64 + } + + fun init(ctx: &mut TxContext) { + //共享数据 + let flag_str = Challenge{ + id: object::new(ctx), + str: string(b"LetsMoveCTF"), + difficulity: 3, + ture_num: 0, + }; + share_object(flag_str); + } + + //暴露方法 + entry fun get_flag(proof:vector, github_id: String, challenge: &mut Challenge, rand: &Random, ctx: &mut TxContext) { + let mut full_proof: vector = vector::empty(); + vector::append(&mut full_proof, proof); + vector::append(&mut full_proof, ctx.sender().to_bytes()); + vector::append(&mut full_proof, bcs::to_bytes(challenge)); + + let hash = hash::sha3_256(full_proof); + + let mut prefix_sum: u32 = 0; + let mut i: u64 = 0; + while (i < challenge.difficulity) { + prefix_sum = prefix_sum + (*vector::borrow(&hash, i) as u32); + i = i + 1; + }; + + assert!(prefix_sum == 0, EPROOF); + + challenge.str = get_random_str(rand, ctx); + challenge.ture_num = challenge.ture_num + 1; + + emit(Flag{ + sender: ctx.sender(), + flag: true, + ture_num: challenge.ture_num, + github_id + }); + + } + + + //获取随机字符 + fun get_random_str(rand: &Random, ctx: &mut TxContext) :String { + let mut gen = random::new_generator(rand, ctx); + + let mut str_len = random::generate_u8_in_range(&mut gen, 4, 30); + + let mut rand: vector = b""; + while (str_len != 0) { + let rand_num = random::generate_u8_in_range(&mut gen, 34, 126); + vector::push_back(&mut rand, rand_num); + str_len = str_len - 1; + }; + + string(rand) + } + + + + + +} diff --git a/mover/xdd-object/code/task8/sources/test.move b/mover/xdd-object/code/task8/sources/test.move new file mode 100644 index 000000000..f83acfa9c --- /dev/null +++ b/mover/xdd-object/code/task8/sources/test.move @@ -0,0 +1,185 @@ +/* +/// Module: task8 +module task8::task8; +*/ + +// For Move coding conventions, see +// https://docs.sui.io/concepts/sui-move-concepts/conventions + +module task8::test { + use std::ascii::{String, string}; + use std::hash; + use sui::event; + use sui::bcs; + use sui::random; + use sui::random::Random; + use sui::transfer::share_object; + use std::debug::print; + use sui::address; + + const EPROOF: u64 = 110; + + public struct Challenge has drop { + id:ID, + str: String, + difficulity: u64, + ture_num: u64 + } + + // #[test] + // fun test_challenge_fail() { + // let challenge:Challenge = Challenge{ + // id: object::id_from_address(@0x19e76ca504c5a5fa5e214a45fca6c058171ba333f6da897b82731094504d5ab9), + // str:std::ascii::string(b"UG4c[wf4L&Y2"), + // difficulity: 3, + // ture_num: 109, + // }; + // + // + // + // // let cbyte = bcs::to_bytes(&challenge); + // // print(&cbyte.to_string()); + // let mut prefix_sum: u32 = 1; + // let name = std::ascii::string(b"proof"); + // let borrowname = std::ascii::string(b"getproof"); + // let mut proof = b"1234567892"; + // let mut strlen:u8 =30; + // let call_addr = @0xc1f4704452819f75c258fe3a01e54d6561899e3478f818625ee8be716fbdd007; + // print(&call_addr.to_bytes()); + // while (prefix_sum!=0){ + // strlen = strlen+1; + // let mut proof = b"1234567892"; + // // let mut proof = b"SnyLUIXawx"; + // let mut proof = getRandomString(b"UG4c[wf4L&Y2", strlen); + // + // let mut full_proof: vector = vector::empty(); + // vector::append(&mut full_proof, proof); + // vector::append(&mut full_proof, call_addr.to_bytes()); + // vector::append(&mut full_proof, bcs::to_bytes(&challenge)); + // + // let hash: vector = hash::sha3_256(full_proof); + // // print(&name); + // print(&proof); + // prefix_sum = 0; + // let mut i: u64 = 0; + // while (i < challenge.difficulity) { + // let borrorval = (*vector::borrow(&hash, i) as u32); + // + // prefix_sum = prefix_sum + borrorval; + // i = i + 1; + // }; + // + // print(&prefix_sum); + // if (prefix_sum==0){ + // print(&borrowname); + // print(&proof); + // break + // } + // }; + // return + // + // } + + fun getRandomString(laststr:vector,strLen:u8): String { + + let mut gen = sui::random::new_generator_from_seed_for_testing(laststr); + + let mut str_len = strLen; + + let mut rand: vector = b""; + while (str_len != 0) { + let rand_num = random::generate_u8_in_range(&mut gen, 34, 126); + vector::push_back(&mut rand, rand_num); + str_len = str_len - 1; + }; + + string(rand) + } + + #[test] + fun test() { + let mut i:u32 = 200; + while (i>0) { + let random_bytes = get_random_str(); + let re = test1(random_bytes); + // + if(re==0) { + print(&random_bytes); + print(&string(random_bytes)); + print(&re); + break + }; + i = i-1; + }; + + + // let mut gen = random::new_generator_for_testing(); + // let random_bytes: vector = random::(&mut gen, 10); + + + // print(&test1(b"fasfFDVasf")); + // let mut i:u32 = 500; + // while (i>0) { + // let mut gen = random::new_generator_for_testing(); + // let random_bytes: vector = random::generate_bytes(&mut gen, 10); + // let re = test1(random_bytes); + // if(re==0) { + // print(&re); + // print(&random_bytes); + // break + // }; + // i = i-1u32; + // }; + + // let a:vector = 0x5862790000000000; + // print(&test1(b"0x5862790000000000")); + + } + + fun get_random_str() :vector { + let mut gen = random::new_generator_for_testing(); + + let mut str_len = random::generate_u8_in_range(&mut gen, 4, 10); + + let mut rand: vector = b""; + while (str_len != 0) { + let rand_num = random::generate_u8_in_range(&mut gen, 65, 90); + vector::push_back(&mut rand, rand_num); + str_len = str_len - 1; + }; + + rand + } + + + + fun test1(proof:vector) : u32{ + + let mut challenge:Challenge = Challenge{ + id: object::id_from_address(@0x19e76ca504c5a5fa5e214a45fca6c058171ba333f6da897b82731094504d5ab9), + str:std::ascii::string(b"UG4c[wf4L&Y2"), + difficulity: 3, + ture_num: 109, + }; + + let adr = @0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2; + let mut full_proof: vector = vector::empty(); + vector::append(&mut full_proof, proof); + vector::append(&mut full_proof, adr.to_bytes()); + vector::append(&mut full_proof, bcs::to_bytes(&challenge)); + + let hash = hash::sha3_256(full_proof); + + let mut prefix_sum: u32 = 0; + let mut i: u64 = 0; + while (i < 3) { + prefix_sum = prefix_sum + (*vector::borrow(&hash, i) as u32); + i = i + 1; + }; + + // assert!(prefix_sum == 0, EPROOF); + prefix_sum + } + + +} diff --git a/mover/xdd-object/code/task8/src/main.rs b/mover/xdd-object/code/task8/src/main.rs new file mode 100644 index 000000000..a856a0156 --- /dev/null +++ b/mover/xdd-object/code/task8/src/main.rs @@ -0,0 +1,70 @@ +use sha3::{Digest, Sha3_256}; +use hex::{self, FromHex}; +use bcs; +use serde::{Deserialize, Serialize}; + +// 定义与 Move 中 Challenge 相对应的结构体 +#[derive(Serialize, Deserialize)] +struct UID { + id: [u8; 32], +} + +#[derive(Serialize, Deserialize)] +struct Challenge { + id: UID, + str: String, + difficulity: u64, + ture_num: u64, +} + +fn main() { + // SENDER_BYTES: 将你的 Sui 地址(0x0fdd...)去掉"0x"前缀并转为 32字节数组 + let sender_hex = "0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2"; + let sender_bytes = <[u8; 32]>::from_hex(sender_hex).expect("Invalid sender hex"); + + // 按照从链上 object 命令中获得的信息构建 Challenge 对象 + // Challenge fields: + // id: 0x19e76ca504c5a5fa5e214a45fca6c058171ba333f6da897b82731094504d5ab9 + // str: "Wz;N" + // difficulity: 3 + // ture_num: 105 + let object_id_hex = "19e76ca504c5a5fa5e214a45fca6c058171ba333f6da897b82731094504d5ab9";//链上对象 + let object_id = <[u8; 32]>::from_hex(object_id_hex).expect("Invalid object_id hex"); + + let challenge = Challenge { + id: UID { id: object_id }, + str: "UG4c[wf4L&Y2".to_string(), + difficulity: 3, + ture_num: 109, + }; + + // BCS 序列化 challenge 对象 + let challenge_bcs_bytes = bcs::to_bytes(&challenge).expect("BCS serialization failed"); + + // 难度要求:hash 的前 3 个字节为 0 + const DIFFICULTY: usize = 3; + + let mut proof_counter: u64 = 0; + loop { + // 将 proof_counter 转成字节 + let proof_bytes = proof_counter.to_le_bytes(); + + // 拼接 proof || sender_bytes || challenge_bcs_bytes + let mut full_data = Vec::new(); + full_data.extend_from_slice(&proof_bytes); + full_data.extend_from_slice(&sender_bytes); + full_data.extend_from_slice(&challenge_bcs_bytes); + + // 计算 sha3_256 哈希 + let hash = Sha3_256::digest(&full_data); + + // 检查前3字节是否全0 + if hash.iter().take(DIFFICULTY).all(|&b| b == 0) { + println!("Found valid proof (hex): {}", hex::encode(&proof_bytes)); + println!("Hash: {}", hex::encode(&hash)); + break; + } + + proof_counter = proof_counter.wrapping_add(1); + } +} \ No newline at end of file diff --git a/mover/xdd-object/code/task8/tests/task8_tests.move b/mover/xdd-object/code/task8/tests/task8_tests.move new file mode 100644 index 000000000..0eb1f08ae --- /dev/null +++ b/mover/xdd-object/code/task8/tests/task8_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module task8::task8_tests; +// uncomment this line to import the module +// use task8::task8; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_task8() { + // pass +} + +#[test, expected_failure(abort_code = ::task8::task8_tests::ENotImplemented)] +fun test_task8_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/xdd-object/img/task3.png b/mover/xdd-object/img/task3.png new file mode 100644 index 000000000..bf9035e0e Binary files /dev/null and b/mover/xdd-object/img/task3.png differ diff --git a/mover/xdd-object/readme.md b/mover/xdd-object/readme.md index 90a36ea33..f1de664b0 100644 --- a/mover/xdd-object/readme.md +++ b/mover/xdd-object/readme.md @@ -20,28 +20,28 @@ - [x] package id: 0x98b379e2c8041537e8435a2242f6604b76592656ba53ceb07891141afc92bbf3 ## 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 : 0x2cdd34202d285b2f4579955b57cb29cfd1c7ac9178cdc0d8424e47eb0c7a4016 +- [x] Faucet package id : 0x2ba9a31fbd3e1ef640c0c52fd4f0a719ba881514133fcd5884b48b62c0eb58d2 +- [x] 转账 `My Coin` hash: 4HTZGBT1Xk1aKffp5fLAiDqKnwW8W5EySbhdHLUkq4uZ +- [x] `Faucet Coin` address1 mint hash: 0x0c651eb9cd6ffa4928b5a9481f09591834a68f452cfbb8932cd6ac3643a61eb2 +- [x] `Faucet Coin` address2 mint hash: 0x517f05f8975255e1ab82bc74419d29601ac85d761acff71f00749478edd723b8 ## 03 move NFT -- [] nft package id : -- [] nft object id : -- [] 转账 nft hash: -- [] scan上的NFT截图:![Scan截图](./images/你的图片地址) +- [x] nft package id : 0x60d57d7822e3eb37959ff19c21c9de7df2af7143c189c347a573a473644390bc +- [x] nft object id : 0x1f189b1243957b0d434cd45890b66ae273dc52d9d0fe4d0bd14b5857410165dd +- [x] 转账 nft hash: 7KwxNsp5BYYk1ceYABe9rub5HMJxXzJtfxkyxBJH5pEk +- [x] scan上的NFT截图:![Scan截图](./img/task3.png) ## 04 Move Game -- [] game package id : -- [] deposit Coin hash: -- [] withdraw `Coin` hash: -- [] play game hash: +- [x] game package id : 0xa42426f6efe44d433240afab9373d311ca8aa5159a41f1fe490e8b77881c2231 +- [x] deposit Coin hash: 6JptC45G1m2K7DvDT4GXdJEvURgAAsPtjex73ZoD5e3w +- [x] withdraw `Coin` hash: 48Dsd2AjJVpQBE9Utwt9EqyYMLw7HvnszscgKPwUzVPJ +- [x] play game hash: D6mrSDmLNxMiGZUdu62EVoz8oPDUcpVrVVpb89YLKc1Q ## 05 Move Swap -- [] swap package id : -- [] call swap CoinA-> CoinB hash : -- [] call swap CoinB-> CoinA hash : +- [x] swap package id : 0xc3fefe6818f438ea24c5f1fc2268a52354fceabf372d5170bc9494cf96f553ca +- [x] call swap CoinA-> CoinB hash : EVvJfKKD3gSY4AjqXNKYCMSLerHiPeYf3bT8meeW34dg +- [x] call swap CoinB-> CoinA hash : GKpULZfR2Qvps9oqP2WehxoTepkZgG18tHSV8RnpM9Nn ## 06 Dapp-kit SDK PTB - [] save hash :