From 9a5979c7776f08681e3e5d320655fbe42107bb5f Mon Sep 17 00:00:00 2001 From: nextuser Date: Mon, 25 Nov 2024 00:22:26 +0800 Subject: [PATCH] task4 --- mover/nextuser/code/task2/coin_demo | 0 .../nextuser/code/task2/coin_faucet/Move.lock | 46 ++ .../nextuser/code/task2/coin_faucet/Move.toml | 43 ++ .../code/task2/coin_faucet/devnet.log | 162 ++++++ .../code/task2/coin_faucet/sources/client.sh | 39 ++ .../code/task2/coin_faucet/sources/jp.move | 23 + .../code/task2/coin_faucet/sources/main.log | 472 ++++++++++++++++++ .../code/task2/coin_faucet/testnet.log | 158 ++++++ .../coin_faucet/tests/coin_faucet_tests.move | 18 + mover/nextuser/code/task2/coin_jp/Move.lock | 40 ++ mover/nextuser/code/task2/coin_jp/Move.toml | 37 ++ .../code/task2/coin_jp/sources/client.sh | 49 ++ .../code/task2/coin_jp/sources/coin_jp.move | 24 + .../task2/coin_jp/tests/coin_jp_tests.move | 18 + mover/nextuser/code/task2/coin_own/Move.lock | 46 ++ mover/nextuser/code/task2/coin_own/Move.toml | 37 ++ .../task2/coin_own/sources/client-mainet.log | 360 +++++++++++++ .../code/task2/coin_own/sources/client.sh | 13 + .../code/task2/coin_own/sources/ydt.move | 24 + .../coin_own/tests/coint_demo_tests.move | 18 + mover/nextuser/code/task4/game/Move.lock | 49 ++ mover/nextuser/code/task4/game/Move.toml | 44 ++ .../code/task4/game/client-mainnet.sh | 111 ++++ .../code/task4/game/client-testnet.sh | 134 +++++ .../code/task4/game/publish.mainnet.log | 160 ++++++ .../code/task4/game/sources/game.move | 192 +++++++ .../code/task4/game/sources/utils.move | 6 + .../code/task4/game/tests/game_tests.move | 238 +++++++++ mover/nextuser/readme.md | 18 +- task/03.move_nft.md | 19 +- 30 files changed, 2587 insertions(+), 11 deletions(-) create mode 100644 mover/nextuser/code/task2/coin_demo create mode 100644 mover/nextuser/code/task2/coin_faucet/Move.lock create mode 100644 mover/nextuser/code/task2/coin_faucet/Move.toml create mode 100644 mover/nextuser/code/task2/coin_faucet/devnet.log create mode 100644 mover/nextuser/code/task2/coin_faucet/sources/client.sh create mode 100644 mover/nextuser/code/task2/coin_faucet/sources/jp.move create mode 100644 mover/nextuser/code/task2/coin_faucet/sources/main.log create mode 100644 mover/nextuser/code/task2/coin_faucet/testnet.log create mode 100644 mover/nextuser/code/task2/coin_faucet/tests/coin_faucet_tests.move create mode 100644 mover/nextuser/code/task2/coin_jp/Move.lock create mode 100644 mover/nextuser/code/task2/coin_jp/Move.toml create mode 100644 mover/nextuser/code/task2/coin_jp/sources/client.sh create mode 100644 mover/nextuser/code/task2/coin_jp/sources/coin_jp.move create mode 100644 mover/nextuser/code/task2/coin_jp/tests/coin_jp_tests.move create mode 100644 mover/nextuser/code/task2/coin_own/Move.lock create mode 100644 mover/nextuser/code/task2/coin_own/Move.toml create mode 100644 mover/nextuser/code/task2/coin_own/sources/client-mainet.log create mode 100644 mover/nextuser/code/task2/coin_own/sources/client.sh create mode 100644 mover/nextuser/code/task2/coin_own/sources/ydt.move create mode 100644 mover/nextuser/code/task2/coin_own/tests/coint_demo_tests.move create mode 100644 mover/nextuser/code/task4/game/Move.lock create mode 100644 mover/nextuser/code/task4/game/Move.toml create mode 100644 mover/nextuser/code/task4/game/client-mainnet.sh create mode 100644 mover/nextuser/code/task4/game/client-testnet.sh create mode 100644 mover/nextuser/code/task4/game/publish.mainnet.log create mode 100644 mover/nextuser/code/task4/game/sources/game.move create mode 100644 mover/nextuser/code/task4/game/sources/utils.move create mode 100644 mover/nextuser/code/task4/game/tests/game_tests.move diff --git a/mover/nextuser/code/task2/coin_demo b/mover/nextuser/code/task2/coin_demo new file mode 100644 index 000000000..e69de29bb diff --git a/mover/nextuser/code/task2/coin_faucet/Move.lock b/mover/nextuser/code/task2/coin_faucet/Move.lock new file mode 100644 index 000000000..6ec210afc --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/Move.lock @@ -0,0 +1,46 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "A6B185D652F2E52598DF913D8FD8F3C7E7951747943037A12D877B7999220FE4" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { local = "/home/ljl/sui-devnet/sui/crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { local = "/home/ljl/sui-devnet/sui/crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.38.0" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.devnet] +chain-id = "ec8bffc7" +original-published-id = "0xc07ee2857e593ad33aa04bd77127604832529cee0947dcf5eb4fb4f72b5cb66a" +latest-published-id = "0xc07ee2857e593ad33aa04bd77127604832529cee0947dcf5eb4fb4f72b5cb66a" +published-version = "1" + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76" +latest-published-id = "0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76" +published-version = "1" + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d" +latest-published-id = "0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d" +published-version = "1" diff --git a/mover/nextuser/code/task2/coin_faucet/Move.toml b/mover/nextuser/code/task2/coin_faucet/Move.toml new file mode 100644 index 000000000..15a5f7335 --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/Move.toml @@ -0,0 +1,43 @@ +[package] +name = "coin_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 = "git@github.com:MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/devnet" } +Sui = {local= "/home/ljl/sui-devnet/sui/crates/sui-framework/packages/sui-framework"} +# 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] +#devnet +# coin_faucet = "0xc07ee2857e593ad33aa04bd77127604832529cee0947dcf5eb4fb4f72b5cb66a" + +#testnet +#coin_faucet = "0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d" +#mainnet +coin_faucet = "0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nextuser/code/task2/coin_faucet/devnet.log b/mover/nextuser/code/task2/coin_faucet/devnet.log new file mode 100644 index 000000000..31e9f66b4 --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/devnet.log @@ -0,0 +1,162 @@ +[warning] Client/Server api version mismatch, client api version : 1.38.0, server api version : 1.39.0 +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING coin_faucet +Successfully verified dependencies on-chain against source. +Transaction Digest: Grk6WtyfR6XhpuNG6KZi8y6FHXCs6ZizJrMKUXT1bukM +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 15847200 MIST │ +│ Gas Price: 1000 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x5ef37511064f692f9e3265538bcb5954078f0b9da09dc1b9246266827925445d │ +│ │ Version: 179 │ +│ │ Digest: 6tbvE7YtBJS3nYjAfcMh5CdCdZnajmtMLh9c2JPDRVaS │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ 8UMUyRSkrmB72wcWzaOCYxrsaln3AH1p8wu5IWXu5IABHZ3/urtdOFd+9ctP1jQdpAJxlh3D8THGyzgJwIB68w== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: Grk6WtyfR6XhpuNG6KZi8y6FHXCs6ZizJrMKUXT1bukM │ +│ Status: Success │ +│ Executed Epoch: 61 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x6edd3e1315d5acf86e7a1cf4bbe5e54edca7b51dd4d72cffffcb0a3093a7d803 │ +│ │ Owner: Shared( 180 ) │ +│ │ Version: 180 │ +│ │ Digest: 49qAZbnDYQ52Paa6PSqw6AntZWKr6rKy8r5PuVAkv1o3 │ +│ └── │ +│ ┌── │ +│ │ ID: 0xc07ee2857e593ad33aa04bd77127604832529cee0947dcf5eb4fb4f72b5cb66a │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: EtrpyZSVCVp6CCfZH6W3UZJeR2gW87bzWRjFtf1eSHTL │ +│ └── │ +│ ┌── │ +│ │ ID: 0xc4aa816838d941ebb9f85cb593d2320f662bdf73032ebaba52c25f5e6440249c │ +│ │ Owner: Immutable │ +│ │ Version: 180 │ +│ │ Digest: 7CeFx8pXxMArp8UcZRVszQYQK6jSU3G6vQKLHEUTmGco │ +│ └── │ +│ ┌── │ +│ │ ID: 0xec7a7dcaf998c96345ccb3222d8bcac955a5b45a23ebbc4e194c3a850cda62d5 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 180 │ +│ │ Digest: ELpoZmZZZEeHGy8UArSFqsPBSX8hmxRugFm92TKwqHGi │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x5ef37511064f692f9e3265538bcb5954078f0b9da09dc1b9246266827925445d │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 180 │ +│ │ Digest: C2E59hMYCWJwTMtMdQXyKhiTRdR89LHmd7vgo1gmeVbh │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x5ef37511064f692f9e3265538bcb5954078f0b9da09dc1b9246266827925445d │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 180 │ +│ │ Digest: C2E59hMYCWJwTMtMdQXyKhiTRdR89LHmd7vgo1gmeVbh │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 13847200 MIST │ +│ Computation Cost: 1000000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ Ecnn77CJ7okaPik3MJWPSmxW7PUyKHi32VNdh69RZ7ae │ +│ Eo6fqQZoxyJThGZpo9JYNxDNr73ZtJu6g4mMof65kZEh │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x6edd3e1315d5acf86e7a1cf4bbe5e54edca7b51dd4d72cffffcb0a3093a7d803 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 180 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0xc07ee2857e593ad33aa04bd77127604832529cee0947dcf5eb4fb4f72b5cb66a::jp::JP> │ +│ │ Version: 180 │ +│ │ Digest: 49qAZbnDYQ52Paa6PSqw6AntZWKr6rKy8r5PuVAkv1o3 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xc4aa816838d941ebb9f85cb593d2320f662bdf73032ebaba52c25f5e6440249c │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0xc07ee2857e593ad33aa04bd77127604832529cee0947dcf5eb4fb4f72b5cb66a::jp::JP> │ +│ │ Version: 180 │ +│ │ Digest: 7CeFx8pXxMArp8UcZRVszQYQK6jSU3G6vQKLHEUTmGco │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xec7a7dcaf998c96345ccb3222d8bcac955a5b45a23ebbc4e194c3a850cda62d5 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 180 │ +│ │ Digest: ELpoZmZZZEeHGy8UArSFqsPBSX8hmxRugFm92TKwqHGi │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x5ef37511064f692f9e3265538bcb5954078f0b9da09dc1b9246266827925445d │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 180 │ +│ │ Digest: C2E59hMYCWJwTMtMdQXyKhiTRdR89LHmd7vgo1gmeVbh │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0xc07ee2857e593ad33aa04bd77127604832529cee0947dcf5eb4fb4f72b5cb66a │ +│ │ Version: 1 │ +│ │ Digest: EtrpyZSVCVp6CCfZH6W3UZJeR2gW87bzWRjFtf1eSHTL │ +│ │ Modules: jp │ +│ └── │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -13869080 │ +│ └── │ +╰──────────────────────────────────────────────────────────────────────────────────────────── \ No newline at end of file diff --git a/mover/nextuser/code/task2/coin_faucet/sources/client.sh b/mover/nextuser/code/task2/coin_faucet/sources/client.sh new file mode 100644 index 000000000..997fca92a --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/sources/client.sh @@ -0,0 +1,39 @@ +sui client publish --skip-fetch-latest-git-deps --skip-dependency-verification + +查看输出结果中的 0x2::coin::TreasuryCap 对象 + + + │ ObjectID: 0x8e1bebaac6dd33bf486fb294981f13fb6946051f465db0c25401b61b01f7421e │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x65a0995fd59c97b94fd975a3fb42c745cdff54711c1caae2934858e6eb99adb4::jp::JP> │ +│ │ Version: 236167313 │ +│ │ Digest: BnpekhzZQWQnR77hpGMZyhafRrMe57AyJainuFX8xEjg + + +# testnet +export PKG=0x65a0995fd59c97b94fd975a3fb42c745cdff54711c1caae2934858e6eb99adb4 +export JP_CAP=0x8e1bebaac6dd33bf486fb294981f13fb6946051f465db0c25401b61b01f7421e + +# 获取当前激活的地址 +export C_ADDR=`sui client active-address` + +# 执行铸币,transfer给本地址 +sui client call --package 0x2 --module coin --function mint_and_transfer --type-args $PKG::jp::JP --args $JP_CAP 8800000 $C_ADDR + +# 获得输出创建coin + Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x95245c704b124aa96f49ab1cdd459c7219d1dc1165faaeae80a514524e8308e2 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x65a0995fd59c97b94fd975a3fb42c745cdff54711c1caae2934858e6eb99adb4::jp::JP> │ +│ │ Version: 236167314 │ +│ │ Digest: Gh2shitikPnbxxffpPj5mnWwrUCNJChEPyCNaBB2YHMV + +# 查看获得货币 +sui client balance $C_ADDR + + + + diff --git a/mover/nextuser/code/task2/coin_faucet/sources/jp.move b/mover/nextuser/code/task2/coin_faucet/sources/jp.move new file mode 100644 index 000000000..12d2b4ec7 --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/sources/jp.move @@ -0,0 +1,23 @@ +//use as faucet +module coin_faucet::jp{ + use sui::coin; + use sui::url; + const JyqUrl:vector = b"https://tse4-mm.cn.bing.net/th/id/OIP-C.XVkbV--98d7_YfeLR2a_fAHaHa?rs=1&pid=ImgDetMain"; + + public struct JP has drop{ } + + fun init( otw :JP , ctx : &mut TxContext) + { + let (cap,meta) = coin::create_currency( + otw, + 0, + b"YEN", + b"YEN of Japan", + b"Japanese money", + option::some(url::new_unsafe_from_bytes(JyqUrl)), + ctx); + + transfer::public_share_object(cap); + transfer::public_freeze_object(meta); + } +} \ No newline at end of file diff --git a/mover/nextuser/code/task2/coin_faucet/sources/main.log b/mover/nextuser/code/task2/coin_faucet/sources/main.log new file mode 100644 index 000000000..0dfbfcb7c --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/sources/main.log @@ -0,0 +1,472 @@ +# PUBLISH + +ljl@ljl-i5-14400:~/work/sui/move-cn/letsmove/mover/nextuser/code/task2/coin_faucet$ sui client publish --skip-fetch-latest-git-deps --skip-dependency-verification +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.36.2 +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING coin_faucet +Skipping dependency verification +Transaction Digest: 3j9AJ67C7KuTZmTJDynkUAzoqndBqDT6wBNwFzbWbrS9 +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 15347200 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Version: 415586835 │ +│ │ Digest: CwWhCjXQtJ9TsupFU31YGfja1HNLqSoG64XuoXyViXXM │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ YB5MDuoPvu/kKhLScW9sJh8gbmP4CrXb0nJFNVmOZtYpMaiSBiJGp/UQCKdATl3G0yVhi8vTG/6DC5zIH8a0uQ== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 3j9AJ67C7KuTZmTJDynkUAzoqndBqDT6wBNwFzbWbrS9 │ +│ Status: Success │ +│ Executed Epoch: 583 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x40f320ef9b8f228438592983c317729a3fed394a0d2835ee6260337a1387c026 │ +│ │ Owner: Immutable │ +│ │ Version: 415586836 │ +│ │ Digest: F5ZeKUSmXStZ1Gz44gy29UYzbpXvEektbMUpFKTPrknZ │ +│ └── │ +│ ┌── │ +│ │ ID: 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: 7B7fh29Zw4VjHGiMK2mWSzCrJ2fN4S563uJrLutSUWZC │ +│ └── │ +│ ┌── │ +│ │ ID: 0xbad24e197d67cd74928c571bb3c4d6656b6e8ca2fcfd4beac99d2cd31c23ab0d │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586836 │ +│ │ Digest: EcQNZ6HivobpwqbYcPkBoksdsCqM7KN98Li6qXuNN5Xz │ +│ └── │ +│ ┌── │ +│ │ ID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Owner: Shared( 415586836 ) │ +│ │ Version: 415586836 │ +│ │ Digest: BKjhMrqnDb6EikQ5mQPLty7TRvASPiooQaW99gJtC6Wb │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586836 │ +│ │ Digest: 9CJFKQUQ5DwtZWvjYFWTmvFF3vmbgp3V6Y2bRW8SKgdf │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586836 │ +│ │ Digest: 9CJFKQUQ5DwtZWvjYFWTmvFF3vmbgp3V6Y2bRW8SKgdf │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 13847200 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 49puDQZwHRnu7zYoARCjco1dFKMiK7LVSS8B5Si1yVdh │ +│ 8MkMyu5cseLwqyWDwg947q7U2d7ipSoGu9LZQh744JRJ │ +│ F1J7GBm1unSLdet5zJQHq44rnzZXLCqv5e3WgvGg2Gvw │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x40f320ef9b8f228438592983c317729a3fed394a0d2835ee6260337a1387c026 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP> │ +│ │ Version: 415586836 │ +│ │ Digest: F5ZeKUSmXStZ1Gz44gy29UYzbpXvEektbMUpFKTPrknZ │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xbad24e197d67cd74928c571bb3c4d6656b6e8ca2fcfd4beac99d2cd31c23ab0d │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 415586836 │ +│ │ Digest: EcQNZ6HivobpwqbYcPkBoksdsCqM7KN98Li6qXuNN5Xz │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 415586836 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP> │ +│ │ Version: 415586836 │ +│ │ Digest: BKjhMrqnDb6EikQ5mQPLty7TRvASPiooQaW99gJtC6Wb │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 415586836 │ +│ │ Digest: 9CJFKQUQ5DwtZWvjYFWTmvFF3vmbgp3V6Y2bRW8SKgdf │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76 │ +│ │ Version: 1 │ +│ │ Digest: 7B7fh29Zw4VjHGiMK2mWSzCrJ2fN4S563uJrLutSUWZC │ +│ │ Modules: jp │ +│ └── │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -13619080 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + +## FAUCET 1 + + +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 3796720 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Version: 415586836 │ +│ │ Digest: 9CJFKQUQ5DwtZWvjYFWTmvFF3vmbgp3V6Y2bRW8SKgdf │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Shared Object ID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ │ +│ │ 1 Pure Arg: Type: u64, Value: "8800000" │ │ +│ │ 2 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭──────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 MoveCall: │ │ +│ │ ┌ │ │ +│ │ │ Function: mint_and_transfer │ │ +│ │ │ Module: coin │ │ +│ │ │ Package: 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ Type Arguments: │ │ +│ │ │ 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP │ │ +│ │ │ Arguments: │ │ +│ │ │ Input 0 │ │ +│ │ │ Input 1 │ │ +│ │ │ Input 2 │ │ +│ │ └ │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ 9AJRKljzkRxLPvlxu7rzxeGzsxAutiUpuzqgnJH4zLBSg9uF5ZAfyN30I+Zf0Ig6k9lscIZxB2WTLq7FN4JYWQ== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 6wFAe3HwXUHzwfcVLK63KBXmv3vnr1XykRWN37gMUd4M │ +│ Status: Success │ +│ Executed Epoch: 583 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x4bd4b3d46fc17957013dc7d5735a8563a3c41425ebc3487f99c912e518792217 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586837 │ +│ │ Digest: AGszFLa9RKJogYgT1qbJip2RhjYd3C9SGPqbbFpUmaG7 │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586837 │ +│ │ Digest: 6AWin51QVW3dhaDDLVBjRbB1PXGV2q4mEaoyQHbgnsST │ +│ └── │ +│ ┌── │ +│ │ ID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Owner: Shared( 415586836 ) │ +│ │ Version: 415586837 │ +│ │ Digest: EHLV4LzaYVV2dxnpX4DHhmpJB4cDUX33jTMGB3Gjqhxt │ +│ └── │ +│ Shared Objects: │ +│ ┌── │ +│ │ ID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Version: 415586836 │ +│ │ Digest: BKjhMrqnDb6EikQ5mQPLty7TRvASPiooQaW99gJtC6Wb │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586837 │ +│ │ Digest: 6AWin51QVW3dhaDDLVBjRbB1PXGV2q4mEaoyQHbgnsST │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 3952000 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 2633400 MIST │ +│ Non-refundable Storage Fee: 26600 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 3j9AJ67C7KuTZmTJDynkUAzoqndBqDT6wBNwFzbWbrS9 │ +│ 49puDQZwHRnu7zYoARCjco1dFKMiK7LVSS8B5Si1yVdh │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x4bd4b3d46fc17957013dc7d5735a8563a3c41425ebc3487f99c912e518792217 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP> │ +│ │ Version: 415586837 │ +│ │ Digest: AGszFLa9RKJogYgT1qbJip2RhjYd3C9SGPqbbFpUmaG7 │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 415586837 │ +│ │ Digest: 6AWin51QVW3dhaDDLVBjRbB1PXGV2q4mEaoyQHbgnsST │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 415586836 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP> │ +│ │ Version: 415586837 │ +│ │ Digest: EHLV4LzaYVV2dxnpX4DHhmpJB4cDUX33jTMGB3Gjqhxt │ +│ └── │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -2068600 │ +│ └── │ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP │ +│ │ Amount: 8800000 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +ljl@ljl-i5-14400:~/work/sui/move-cn/letsmove/mover/nextuser/code/task2/coin_faucet$ sui client balance $C_ADDR +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.36.2 +╭──────────────────────────────────────────────╮ +│ Balance of coins owned by this address │ +├──────────────────────────────────────────────┤ +│ ╭──────────────────────────────────────────╮ │ +│ │ coin balance (raw) balance │ │ +│ ├──────────────────────────────────────────┤ │ +│ │ Sui 266840040 0.26 SUI │ │ +│ │ YEN of Japan 8800000 8.80M YEN │ │ +│ ╰──────────────────────────────────────────╯ │ +╰──────────────────────────────────────────────╯ + +## FAUCET 2 +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 │ +│ Gas Owner: 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 │ +│ Gas Budget: 3796720 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xc78c9bf0d263ea91610e04cd31cb5fbe131db94416e6010098575829b10297bc │ +│ │ Version: 416420239 │ +│ │ Digest: tGkJgw6oYfiC1tqfvjDXTgJUVaRbhYfQhkBiVdaTcRB │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Shared Object ID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ │ +│ │ 1 Pure Arg: Type: u64, Value: "7700000" │ │ +│ │ 2 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭──────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 MoveCall: │ │ +│ │ ┌ │ │ +│ │ │ Function: mint_and_transfer │ │ +│ │ │ Module: coin │ │ +│ │ │ Package: 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ Type Arguments: │ │ +│ │ │ 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP │ │ +│ │ │ Arguments: │ │ +│ │ │ Input 0 │ │ +│ │ │ Input 1 │ │ +│ │ │ Input 2 │ │ +│ │ └ │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ XeqrYMSzP1Frm8q7VLoOSsPdWzKd5ieQQIl0Vm5UoKLEKZbNkcDWIA+RqeSPeuzSoszgErlRr9WBkdkLiO46Cg== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 4S49DwS3ZkXKcQ7aTr4USyL9sowe9324CyM4riU7FcxB │ +│ Status: Success │ +│ Executed Epoch: 583 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x7dd540dadf993cdc48300f0d6916d48fa49f433891699b2952c4472324de1143 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 416420240 │ +│ │ Digest: DwxQv869J1xUBxKYw6odTpfnasNa4Fvfif82gSBC2s6m │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xc78c9bf0d263ea91610e04cd31cb5fbe131db94416e6010098575829b10297bc │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ Version: 416420240 │ +│ │ Digest: HXVBwd2VMHTpeTKkFQoPbECD15oe2Hs1C6hqpnxbvDGU │ +│ └── │ +│ ┌── │ +│ │ ID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Owner: Shared( 415586836 ) │ +│ │ Version: 416420240 │ +│ │ Digest: A1zdhnfZ663Xo8x54RLREDsfzhLAmtxmMUuUKAALibaL │ +│ └── │ +│ Shared Objects: │ +│ ┌── │ +│ │ ID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Version: 415586837 │ +│ │ Digest: EHLV4LzaYVV2dxnpX4DHhmpJB4cDUX33jTMGB3Gjqhxt │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xc78c9bf0d263ea91610e04cd31cb5fbe131db94416e6010098575829b10297bc │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ Version: 416420240 │ +│ │ Digest: HXVBwd2VMHTpeTKkFQoPbECD15oe2Hs1C6hqpnxbvDGU │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 3952000 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 2633400 MIST │ +│ Non-refundable Storage Fee: 26600 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 3Kr9F6gTat1vsVPoNsUZwFFpZNGHypH53EjTaUhejMig │ +│ 3j9AJ67C7KuTZmTJDynkUAzoqndBqDT6wBNwFzbWbrS9 │ +│ 49puDQZwHRnu7zYoARCjco1dFKMiK7LVSS8B5Si1yVdh │ +│ 6wFAe3HwXUHzwfcVLK63KBXmv3vnr1XykRWN37gMUd4M │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x7dd540dadf993cdc48300f0d6916d48fa49f433891699b2952c4472324de1143 │ +│ │ Sender: 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP> │ +│ │ Version: 416420240 │ +│ │ Digest: DwxQv869J1xUBxKYw6odTpfnasNa4Fvfif82gSBC2s6m │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xc78c9bf0d263ea91610e04cd31cb5fbe131db94416e6010098575829b10297bc │ +│ │ Sender: 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 416420240 │ +│ │ Digest: HXVBwd2VMHTpeTKkFQoPbECD15oe2Hs1C6hqpnxbvDGU │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b │ +│ │ Sender: 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 │ +│ │ Owner: Shared( 415586836 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP> │ +│ │ Version: 416420240 │ +│ │ Digest: A1zdhnfZ663Xo8x54RLREDsfzhLAmtxmMUuUKAALibaL │ +│ └── │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP │ +│ │ Amount: 7700000 │ +│ └── │ +│ ┌── │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -2068600 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/nextuser/code/task2/coin_faucet/testnet.log b/mover/nextuser/code/task2/coin_faucet/testnet.log new file mode 100644 index 000000000..ccfc80a74 --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/testnet.log @@ -0,0 +1,158 @@ +Successfully verified dependencies on-chain against source. +Transaction Digest: 6LunhHfwU5w8MEZAEAuJrWqVzCRNXDWEQCURoyta7V6L +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 15847200 MIST │ +│ Gas Price: 1000 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Version: 236167322 │ +│ │ Digest: ujwnZK8txufFs7opb1McTpMFrazKmZ8G8TFUSufkNBM │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ e0Sr4vRuoYyc+GiDCUyZcfXzcuxNGLu+cIa7ikeLCGxM01a0k15MynsLc3HfaqnLO9gwlIgShjOJE3gxxdD8gQ== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: 6LunhHfwU5w8MEZAEAuJrWqVzCRNXDWEQCURoyta7V6L │ +│ Status: Success │ +│ Executed Epoch: 563 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x8716618e17eefea6fee46c9d9d936a4960f1e868feaaa2c6e60138f11d04c5ab │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 236167323 │ +│ │ Digest: C1ipUEteCnYiLyrdyTEsu32uMxLUDbEHyhwgiUTRu3Sq │ +│ └── │ +│ ┌── │ +│ │ ID: 0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: 2UQNxG79UwFzRyvVACy9j863JrewUTcmtoLViYoQiy3K │ +│ └── │ +│ ┌── │ +│ │ ID: 0xaf1d13e03f1cd1045ee3d4dbd8710d73fe58414ccbfb52e99de85b45c1bb488c │ +│ │ Owner: Immutable │ +│ │ Version: 236167323 │ +│ │ Digest: BUP7ntKN8p2JtaAdpb7PUZPLSTmHpQhsxakCaLJYLQN3 │ +│ └── │ +│ ┌── │ +│ │ ID: 0xebe5855ce55333795adad3767935c13b1edb9db71d4a5488d4c60f2a1dc5d975 │ +│ │ Owner: Shared( 236167323 ) │ +│ │ Version: 236167323 │ +│ │ Digest: 2PnZg58j7GD8YgKunCiphUeVSb2Z9KZavrh3e2SqEMp4 │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 236167323 │ +│ │ Digest: Bbv4BknmNeh2QMfj1rdJfNnhjo29ye2S61yE6hFFk9t3 │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 236167323 │ +│ │ Digest: Bbv4BknmNeh2QMfj1rdJfNnhjo29ye2S61yE6hFFk9t3 │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 13847200 MIST │ +│ Computation Cost: 1000000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 6o4x1J9Qq3vznWHhiDmDFyb7254wGc1LKtkcffQ4swfw │ +│ GMBJA2gEEvtwv1wGGT7ZEDkQdrmUTKaE4TeinNGQ2feC │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x8716618e17eefea6fee46c9d9d936a4960f1e868feaaa2c6e60138f11d04c5ab │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 236167323 │ +│ │ Digest: C1ipUEteCnYiLyrdyTEsu32uMxLUDbEHyhwgiUTRu3Sq │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xaf1d13e03f1cd1045ee3d4dbd8710d73fe58414ccbfb52e99de85b45c1bb488c │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d::jp::JP> │ +│ │ Version: 236167323 │ +│ │ Digest: BUP7ntKN8p2JtaAdpb7PUZPLSTmHpQhsxakCaLJYLQN3 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xebe5855ce55333795adad3767935c13b1edb9db71d4a5488d4c60f2a1dc5d975 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 236167323 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d::jp::JP> │ +│ │ Version: 236167323 │ +│ │ Digest: 2PnZg58j7GD8YgKunCiphUeVSb2Z9KZavrh3e2SqEMp4 │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x310c92035b6ae47b44860f66b82177d71251c3faf22b1f192fe51e99a18f1cf2 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 236167323 │ +│ │ Digest: Bbv4BknmNeh2QMfj1rdJfNnhjo29ye2S61yE6hFFk9t3 │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d │ +│ │ Version: 1 │ +│ │ Digest: 2UQNxG79UwFzRyvVACy9j863JrewUTcmtoLViYoQiy3K │ +│ │ Modules: jp │ +│ └── │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -13869080 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/mover/nextuser/code/task2/coin_faucet/tests/coin_faucet_tests.move b/mover/nextuser/code/task2/coin_faucet/tests/coin_faucet_tests.move new file mode 100644 index 000000000..2f46df2ff --- /dev/null +++ b/mover/nextuser/code/task2/coin_faucet/tests/coin_faucet_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module coin_faucet::coin_faucet_tests; +// uncomment this line to import the module +// use coin_faucet::coin_faucet; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_coin_faucet() { + // pass +} + +#[test, expected_failure(abort_code = ::coin_faucet::coin_faucet_tests::ENotImplemented)] +fun test_coin_faucet_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nextuser/code/task2/coin_jp/Move.lock b/mover/nextuser/code/task2/coin_jp/Move.lock new file mode 100644 index 000000000..caea40250 --- /dev/null +++ b/mover/nextuser/code/task2/coin_jp/Move.lock @@ -0,0 +1,40 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "4CE6757E5D8A5D84A0D61971AD51AFD3C50F07242DE035B037BA492BA5E4523D" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.37.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x3afd47bd360bcb8d4046cffbe80ff0b87bd05bad6237f60d738a0a2f51e993c5" +latest-published-id = "0x3afd47bd360bcb8d4046cffbe80ff0b87bd05bad6237f60d738a0a2f51e993c5" +published-version = "1" + +[env.devnet] +chain-id = "0fc07bbe" +original-published-id = "0xc4357446187b885ca5254dc02a7f3a33f9ec860045aeb112d60ed225506663d1" +latest-published-id = "0xc4357446187b885ca5254dc02a7f3a33f9ec860045aeb112d60ed225506663d1" +published-version = "1" diff --git a/mover/nextuser/code/task2/coin_jp/Move.toml b/mover/nextuser/code/task2/coin_jp/Move.toml new file mode 100644 index 000000000..b560cb029 --- /dev/null +++ b/mover/nextuser/code/task2/coin_jp/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "coin_jp" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +coin_jp = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nextuser/code/task2/coin_jp/sources/client.sh b/mover/nextuser/code/task2/coin_jp/sources/client.sh new file mode 100644 index 000000000..a03d1cbb9 --- /dev/null +++ b/mover/nextuser/code/task2/coin_jp/sources/client.sh @@ -0,0 +1,49 @@ +# devnet +export PKG=0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76 +export JP_CAP=0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b + + +# SET THE ADDRESS to receive +export W_ADDR=0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 +# the current client active-address +export C_ADDR=0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + +# faucet , mint_and_transfer +sui client switch --address $C_ADDR +sui client call --package 0x2 --module coin --function mint_and_transfer --type-args $PKG::jp::JP --args $JP_CAP 8800000 $C_ADDR +sui client balance $C_ADDR + + +#0xeff9d4ac9f5c3d97be2f0be1aaab797d76ce148263471ad7bf4604f5811afdf::jp::JP +# testnet +│ ┌── │ +│ │ ObjectID: 0x1dc620b3918d04ca2799a5fb25d1f3e8ff4ba626a78d3a3d722c32b6c68922c7 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0xeff9d4ac9f5c3d97be2f0be1aaab797d76ce148263471ad7bf4604f5811afdf::jp::JP> │ +│ │ Version: 236167315 │ +│ │ Digest: 5vqw8LRLJzL492rPozqwMh5W6fZFLtqTc8fD54sLvg1T │ +│ └── + + + public fun get_supply(cap : &TreasuryCap):u64{ + let s =sui::coin::supply_immut(cap); + sui::balance::supply_value(s) + } + +# testnet +export PKG=0xeff9d4ac9f5c3d97be2f0be1aaab797d76ce148263471ad7bf4604f5811afdf +export JP_CAP=0x1dc620b3918d04ca2799a5fb25d1f3e8ff4ba626a78d3a3d722c32b6c68922c7 +sui client ptb --move-call 0x2::coin::supply_immut "<$PKG::jp::JP>" @$JP_CAP \ +--assign sid \ +--move-call 0x2::balance::supply_value "<$PKG::jp::JP>" sid + +#devnet +│ ┌── │ +│ │ ObjectID: 0x99906636f780bb8798f39c3c78b5c73248793aa9d789c8307f62de1e7866c2dd │ +│ │ Sender: 0xf7ec2215e565b7a18d7b00e70fccda74b30c3ecceffb5857b1b3d2249e28e94f │ +│ │ Owner: Account Address ( 0xf7ec2215e565b7a18d7b00e70fccda74b30c3ecceffb5857b1b3d2249e28e94f ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x3afd47bd360bcb8d4046cffbe80ff0b87bd05bad6237f60d738a0a2f51e993c5::jp::JP> + +export PKG=0xf7ec2215e565b7a18d7b00e70fccda74b30c3ecceffb5857b1b3d2249e28e94f +export JP_CAP=0x99906636f780bb8798f39c3c78b5c73248793aa9d789c8307f62de1e7866c2dd \ No newline at end of file diff --git a/mover/nextuser/code/task2/coin_jp/sources/coin_jp.move b/mover/nextuser/code/task2/coin_jp/sources/coin_jp.move new file mode 100644 index 000000000..f54a463be --- /dev/null +++ b/mover/nextuser/code/task2/coin_jp/sources/coin_jp.move @@ -0,0 +1,24 @@ +module coin_jp::jp{ + public struct JP has drop{ } + const JpUrl:vector = b"https://tse4-mm.cn.bing.net/th/id/OIP-C.XVkbV--98d7_YfeLR2a_fAHaHa"; + + fun init( jp :JP , ctx : &mut TxContext) + { + let (treasuryCap,coinMetadata) = sui::coin::create_currency( + jp, + 0, + b"YEN", + b"YEN of Japan", + b"Japanese money", + option::some(sui::url::new_unsafe_from_bytes(JpUrl)), + ctx); + + transfer::public_transfer(treasuryCap,ctx.sender()); + transfer::public_freeze_object(coinMetadata); + } + use sui::coin::TreasuryCap; + public fun get_supply(cap : &TreasuryCap):u64{ + let s =sui::coin::supply_immut(cap); + sui::balance::supply_value(s) + } +} \ No newline at end of file diff --git a/mover/nextuser/code/task2/coin_jp/tests/coin_jp_tests.move b/mover/nextuser/code/task2/coin_jp/tests/coin_jp_tests.move new file mode 100644 index 000000000..e0a0d5b07 --- /dev/null +++ b/mover/nextuser/code/task2/coin_jp/tests/coin_jp_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module coin_jp::coin_jp_tests; +// uncomment this line to import the module +// use coin_jp::coin_jp; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_coin_jp() { + // pass +} + +#[test, expected_failure(abort_code = ::coin_jp::coin_jp_tests::ENotImplemented)] +fun test_coin_jp_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nextuser/code/task2/coin_own/Move.lock b/mover/nextuser/code/task2/coin_own/Move.lock new file mode 100644 index 000000000..714cce7f9 --- /dev/null +++ b/mover/nextuser/code/task2/coin_own/Move.lock @@ -0,0 +1,46 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "B6F18F40A14EE667670B9229382CE85B9C8C903BBFED8B07868214B2EA5CFA69" +deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/devnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/devnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[move.toolchain-version] +compiler-version = "1.37.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0xd81316014a5261dde8f584181fed7a5a13cd17be451790a38646b2bd00704188" +latest-published-id = "0xd81316014a5261dde8f584181fed7a5a13cd17be451790a38646b2bd00704188" +published-version = "1" + +[env.devnet] +chain-id = "0fc07bbe" +original-published-id = "0xf0b931b280b23dc7b99bf10355eae49b701e9668503048d869b6740e94783542" +latest-published-id = "0xf0b931b280b23dc7b99bf10355eae49b701e9668503048d869b6740e94783542" +published-version = "1" + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2" +latest-published-id = "0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2" +published-version = "1" diff --git a/mover/nextuser/code/task2/coin_own/Move.toml b/mover/nextuser/code/task2/coin_own/Move.toml new file mode 100644 index 000000000..64ef663ab --- /dev/null +++ b/mover/nextuser/code/task2/coin_own/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "coin_own" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/devnet" } + +# 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] +coin_own = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nextuser/code/task2/coin_own/sources/client-mainet.log b/mover/nextuser/code/task2/coin_own/sources/client-mainet.log new file mode 100644 index 000000000..a43865569 --- /dev/null +++ b/mover/nextuser/code/task2/coin_own/sources/client-mainet.log @@ -0,0 +1,360 @@ +ljl@ljl-i5-14400:~/work/sui/move-cn/letsmove/mover/nextuser/code/task2/coin_own$ sui client publish --skip-fetch-latest-git-deps --skip-dependency-verification +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.36.2 +INCLUDING DEPENDENCY Sui +INCLUDING DEPENDENCY MoveStdlib +BUILDING coin_own +Skipping dependency verification +Transaction Digest: HV1N8xgK4mnz79ymdFMkEpszCrqyjxT1jSLdCaAaeqis +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 17049600 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Version: 415586837 │ +│ │ Digest: 6AWin51QVW3dhaDDLVBjRbB1PXGV2q4mEaoyQHbgnsST │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ NdvWVps1UyndRo66N+XgkTApBLXKjrS9qJmjzsKzBBdIHU3UFWeongtYxxrQFJ20cQ9sHnKCLsVKxC52eRtIeA== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: HV1N8xgK4mnz79ymdFMkEpszCrqyjxT1jSLdCaAaeqis │ +│ Status: Success │ +│ Executed Epoch: 583 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x8cb47cb91a16bd7bf68488791edb74317f821fcf472410493e3fbceb471d3d9d │ +│ │ Owner: Immutable │ +│ │ Version: 415586838 │ +│ │ Digest: 7iJ3Xk91YKcRDvv451hKuvddxqfTiiw834CWcMoyoTzp │ +│ └── │ +│ ┌── │ +│ │ ID: 0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: HZquXneU77FVtegouBHEDh8QEWxf56ZJowq56DXB5HEC │ +│ └── │ +│ ┌── │ +│ │ ID: 0xc6c730b35f3971c13f1a8c829c8632ba0775f28cf55b93744dc12cc32f5f1f7e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586838 │ +│ │ Digest: 8PfmZYdhpuvwMxFs5CVCnvY56uYCrLJNe48hK63Q31Gx │ +│ └── │ +│ ┌── │ +│ │ ID: 0xf9d195abea3592072ff6b6d2bc97740d2bebd9a167490808b1670368f4f793f5 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586838 │ +│ │ Digest: AvU5rTZs4vWbmgUiJ2DjFDVHBycKDR8YWdhRbfkXWSfE │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586838 │ +│ │ Digest: FYemLZHQKsUBvaAVvuwKVCKaKwWn4wLQCBZC8BkRvaeh │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586838 │ +│ │ Digest: FYemLZHQKsUBvaAVvuwKVCKaKwWn4wLQCBZC8BkRvaeh │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 15549600 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 49puDQZwHRnu7zYoARCjco1dFKMiK7LVSS8B5Si1yVdh │ +│ 6wFAe3HwXUHzwfcVLK63KBXmv3vnr1XykRWN37gMUd4M │ +│ 8MkMyu5cseLwqyWDwg947q7U2d7ipSoGu9LZQh744JRJ │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes + │ +├───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: + │ +│ ┌── + │ +│ │ ObjectID: 0x8cb47cb91a16bd7bf68488791edb74317f821fcf472410493e3fbceb471d3d9d + │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + │ +│ │ Owner: Immutable + │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2::yuan_da_tou::YUAN_DA_TOU> │ +│ │ Version: 415586838 + │ +│ │ Digest: 7iJ3Xk91YKcRDvv451hKuvddxqfTiiw834CWcMoyoTzp + │ +│ └── + │ +│ ┌── + │ +│ │ ObjectID: 0xc6c730b35f3971c13f1a8c829c8632ba0775f28cf55b93744dc12cc32f5f1f7e + │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) + │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2::yuan_da_tou::YUAN_DA_TOU> │ +│ │ Version: 415586838 + │ +│ │ Digest: 8PfmZYdhpuvwMxFs5CVCnvY56uYCrLJNe48hK63Q31Gx + │ +│ └── + │ +│ ┌── + │ +│ │ ObjectID: 0xf9d195abea3592072ff6b6d2bc97740d2bebd9a167490808b1670368f4f793f5 + │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) + │ +│ │ ObjectType: 0x2::package::UpgradeCap + │ +│ │ Version: 415586838 + │ +│ │ Digest: AvU5rTZs4vWbmgUiJ2DjFDVHBycKDR8YWdhRbfkXWSfE + │ +│ └── + │ +│ Mutated Objects: + │ +│ ┌── + │ +│ │ ObjectID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e + │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) + │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> + │ +│ │ Version: 415586838 + │ +│ │ Digest: FYemLZHQKsUBvaAVvuwKVCKaKwWn4wLQCBZC8BkRvaeh + │ +│ └── + │ +│ Published Objects: + │ +│ ┌── + │ +│ │ PackageID: 0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2 + │ +│ │ Version: 1 + │ +│ │ Digest: HZquXneU77FVtegouBHEDh8QEWxf56ZJowq56DXB5HEC + │ +│ │ Modules: yuan_da_tou + │ +│ └── + │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +ljl@ljl-i5-14400:~/work/sui/move-cn/letsmove/mover/nextuser/code/task2/coin_own$ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -15321480 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ + + +# move MoveCall + +ljl@ljl-i5-14400:~/work/sui/move-cn/letsmove/mover/nextuser/code/task2/coin_own$ sui client call --package 0x2 --module coin --function mint_and_transfer --type-args $PKG::yuan_da_tou::YUAN_DA_TOU --args $YDT_CAP 5000000 $W_ADDR + +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.36.2 +Transaction Digest: DQMWZ4nEYZ4Cc6MN8HXkRWmajTJTh9Psf9euSDCTSUJt +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 3934888 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Version: 415586838 │ +│ │ Digest: FYemLZHQKsUBvaAVvuwKVCKaKwWn4wLQCBZC8BkRvaeh │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Imm/Owned Object ID: 0xc6c730b35f3971c13f1a8c829c8632ba0775f28cf55b93744dc12cc32f5f1f7e │ │ +│ │ 1 Pure Arg: Type: u64, Value: "5000000" │ │ +│ │ 2 Pure Arg: Type: address, Value: "0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├───────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 MoveCall: │ │ +│ │ ┌ │ │ +│ │ │ Function: mint_and_transfer │ │ +│ │ │ Module: coin │ │ +│ │ │ Package: 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ Type Arguments: │ │ +│ │ │ 0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2::yuan_da_tou::YUAN_DA_TOU │ │ +│ │ │ Arguments: │ │ +│ │ │ Input 0 │ │ +│ │ │ Input 1 │ │ +│ │ │ Input 2 │ │ +│ │ └ │ │ +│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ ihsW3qV08lxKuv1Wx6jOlJKm6NE1wgUyqTmpW+jNXxl6mPBhDeqZt1rBXkdNFIezqT6WRExoujv94DHa34ikSg== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: DQMWZ4nEYZ4Cc6MN8HXkRWmajTJTh9Psf9euSDCTSUJt │ +│ Status: Success │ +│ Executed Epoch: 583 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0xd51aa08144aac919d3a3574b056b65a8cd775ac594e519bd99a8a5ce31a9f441 │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ Version: 415586839 │ +│ │ Digest: XaCXU9giQvgySyQG2Yv3fi7C2jYp9kCUWgEtqwGGnLm │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xc6c730b35f3971c13f1a8c829c8632ba0775f28cf55b93744dc12cc32f5f1f7e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586839 │ +│ │ Digest: 9wYLF3zJYwRF5oq2AnEqQCHSc6smTi4gRTY29XRDXPRD │ +│ └── │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586839 │ +│ │ Digest: 7DVzthFwi2ARMPJTSDkMYFwFBQ8eZV5DDEDKzZ4pkcC9 │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586839 │ +│ │ Digest: 7DVzthFwi2ARMPJTSDkMYFwFBQ8eZV5DDEDKzZ4pkcC9 │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 4225600 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 2768832 MIST │ +│ Non-refundable Storage Fee: 27968 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 49puDQZwHRnu7zYoARCjco1dFKMiK7LVSS8B5Si1yVdh │ +│ HV1N8xgK4mnz79ymdFMkEpszCrqyjxT1jSLdCaAaeqis │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0xd51aa08144aac919d3a3574b056b65a8cd775ac594e519bd99a8a5ce31a9f441 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ ObjectType: 0x2::coin::Coin<0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2::yuan_da_tou::YUAN_DA_TOU> │ +│ │ Version: 415586839 │ +│ │ Digest: XaCXU9giQvgySyQG2Yv3fi7C2jYp9kCUWgEtqwGGnLm │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xc6c730b35f3971c13f1a8c829c8632ba0775f28cf55b93744dc12cc32f5f1f7e │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2::yuan_da_tou::YUAN_DA_TOU> │ +│ │ Version: 415586839 │ +│ │ Digest: 9wYLF3zJYwRF5oq2AnEqQCHSc6smTi4gRTY29XRDXPRD │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 415586839 │ +│ │ Digest: 7DVzthFwi2ARMPJTSDkMYFwFBQ8eZV5DDEDKzZ4pkcC9 │ +│ └── │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -2206768 │ +│ └── │ +│ ┌── │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ CoinType: 0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2::yuan_da_tou::YUAN_DA_TOU │ +│ │ Amount: 5000000 │ +│ └── │ +╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +ljl@ljl-i5-14400:~/work/sui/move-cn/letsmove/mover/nextuser/code/task2/coin_own$ sui client balance $W_ADDR +[warn] Client/Server api version mismatch, client api version : 1.37.1, server api version : 1.36.2 +╭─────────────────────────────────────────────╮ +│ Balance of coins owned by this address │ +├─────────────────────────────────────────────┤ +│ ╭─────────────────────────────────────────╮ │ +│ │ coin balance (raw) balance │ │ +│ ├─────────────────────────────────────────┤ │ +│ │ Sui 7931400 0.00 SUI │ │ +│ │ yuan da tou 5000000 5.00K YDT │ │ +│ ╰─────────────────────────────────────────╯ │ +╰─────────────────────────────────────────────╯ +ljl@ljl-i5-14400:~/work/sui/move-cn/letsmove/mover/nextuser/code/task2/coin_own$ \ No newline at end of file diff --git a/mover/nextuser/code/task2/coin_own/sources/client.sh b/mover/nextuser/code/task2/coin_own/sources/client.sh new file mode 100644 index 000000000..d1d398640 --- /dev/null +++ b/mover/nextuser/code/task2/coin_own/sources/client.sh @@ -0,0 +1,13 @@ + +sui client publish --skip-fetch-latest-git-deps --skip-dependency-verification + +# devnet +export PKG=0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2 +export YDT_CAP=0xc6c730b35f3971c13f1a8c829c8632ba0775f28cf55b93744dc12cc32f5f1f7e +# the current client active-address +export C_ADDR=0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + +# coin_own ydt , mint_and_transfer +sui client switch --address $C_ADDR +sui client call --package 0x2 --module coin --function mint_and_transfer --type-args $PKG::yuan_da_tou::YUAN_DA_TOU --args $YDT_CAP 5000000 $W_ADDR +sui client balance $W_ADDR \ No newline at end of file diff --git a/mover/nextuser/code/task2/coin_own/sources/ydt.move b/mover/nextuser/code/task2/coin_own/sources/ydt.move new file mode 100644 index 000000000..a249047b9 --- /dev/null +++ b/mover/nextuser/code/task2/coin_own/sources/ydt.move @@ -0,0 +1,24 @@ +module coin_own::yuan_da_tou{ + use sui::coin; + use sui::url; + const YdtUrl:vector = b"https://images.ebaiyin.com/fileImgs/Ebaiyin.Ebaiyin/KingEditor/20171103/26db18bb30ac48a094f4d00481e7b66d.jpg"; + + public struct YUAN_DA_TOU has drop{ } + + fun init( otw :YUAN_DA_TOU , ctx : &mut TxContext) + { + let (cap,meta) = coin::create_currency( + otw, + 3, + b"YDT", + b"yuan da tou", + b"silver coin,minted by the president of yuan shih-k'ai", + option::some(url::new_unsafe_from_bytes(YdtUrl)), + ctx); + + transfer::public_transfer(cap,ctx.sender()); + transfer::public_freeze_object(meta); + } + +} + diff --git a/mover/nextuser/code/task2/coin_own/tests/coint_demo_tests.move b/mover/nextuser/code/task2/coin_own/tests/coint_demo_tests.move new file mode 100644 index 000000000..c5339c22f --- /dev/null +++ b/mover/nextuser/code/task2/coin_own/tests/coint_demo_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module coint_demo::coint_demo_tests; +// uncomment this line to import the module +// use coint_demo::coint_demo; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_coint_demo() { + // pass +} + +#[test, expected_failure(abort_code = ::coint_demo::coint_demo_tests::ENotImplemented)] +fun test_coint_demo_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nextuser/code/task4/game/Move.lock b/mover/nextuser/code/task4/game/Move.lock new file mode 100644 index 000000000..716867f88 --- /dev/null +++ b/mover/nextuser/code/task4/game/Move.lock @@ -0,0 +1,49 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "8B11B2576E69D1F37BADA83991D43DF83689ABCB4E49AAA7C7BC12BBEE03F84A" +deps_digest = "3C4103934B1E040BB6B23F1D610B4EF9F2F1166A50A104EADCF77467C004C600" +dependencies = [ + { id = "Sui", name = "Sui" }, + { id = "coin_faucet", name = "coin_faucet" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { local = "/home/ljl/sui-devnet/sui/crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { local = "/home/ljl/sui-devnet/sui/crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[[move.package]] +id = "coin_faucet" +source = { local = "../../task2/coin_faucet" } + +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[move.toolchain-version] +compiler-version = "1.38.0" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0xd2b6739f08e1f2f764ea4c6e643edfd16752762665334147b3da6ac951ed895e" +latest-published-id = "0xd2b6739f08e1f2f764ea4c6e643edfd16752762665334147b3da6ac951ed895e" +published-version = "1" + +[env.mainnet] +chain-id = "35834a8a" +original-published-id = "0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25" +latest-published-id = "0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25" +published-version = "1" diff --git a/mover/nextuser/code/task4/game/Move.toml b/mover/nextuser/code/task4/game/Move.toml new file mode 100644 index 000000000..6e76fc772 --- /dev/null +++ b/mover/nextuser/code/task4/game/Move.toml @@ -0,0 +1,44 @@ +[package] +name = "game" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +#Sui = { git = "git@github.com:MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/devnet" } + +Sui = {local="/home/ljl/sui-devnet/sui/crates/sui-framework/packages/sui-framework"} +coin_faucet = { local ="../../task2/coin_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] +game = "0x0" +book = "0x0" +#testnet +#coin_faucet = "0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d" +#mainnet +coin_faucet="0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nextuser/code/task4/game/client-mainnet.sh b/mover/nextuser/code/task4/game/client-mainnet.sh new file mode 100644 index 000000000..8590b6b64 --- /dev/null +++ b/mover/nextuser/code/task4/game/client-mainnet.sh @@ -0,0 +1,111 @@ + + + +# 代币的发布 task2/coin_faucet/ (已经在task2完成) +## 发布代币 + + +# 代码依赖包说明 +在task2/coin/faucet/Move.toml + task4/game/Move.toml + 标注跟环境匹配的coin_faucet package地址 + + +# testnet 定义代币的变量 +export PKG=0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76 +export JP_CAP=0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b +export B_ADDR=0xf7ec2215e565b7a18d7b00e70fccda74b30c3ecceffb5857b1b3d2249e28e94f +export A_ADDR=0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 +export OWNER_ADDR=0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + +# 游戏发布和调用 +## 发布game包 + +sui client switch --address $OWNER_ADDR +sui client publish +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x86afb31c444e12753611161af10ba43ea5749f79f5010b6d9368ec57bfbc8199 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 415586840 ) │ +│ │ ObjectType: 0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25::game::GameStorage │ +│ │ Version: 415586840 │ +│ │ Digest: BFFNLKod3jH9x5dr4UZWHo3bxMgCNMAcmmvDyaBpznsT │ +│ └── + +│ ┌── │ +│ │ ObjectID: 0xf22f117dccabd82f9f424fea239cb8662e4cde5607d6f507ae105be31ecd0775 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25::game::AdminCap │ +│ │ Version: 415586840 │ +│ │ Digest: 5cRLQ1exaMurWdCz24dZGqxWkggDwkVUrfPe7wnzwGJm │ +│ └── + + +export PKG_GAME=0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25 +export GAME_ID=0x86afb31c444e12753611161af10ba43ea5749f79f5010b6d9368ec57bfbc8199 +export GAME_ADMIN=0xf22f117dccabd82f9f424fea239cb8662e4cde5607d6f507ae105be31ecd0775 + + +# 找个coin + + + + +# faucet 获取JP coin 或找到已经分配的JP coin + +sui client call --package 0x2 --module coin --function mint_and_transfer \ +--type-args $PKG::jp::JP --args $JP_CAP 60000 $OWNER_ADDR + + + + +## OWNER 拥有的coin +export COIN_ID=0x7dd540dadf993cdc48300f0d6916d48fa49f433891699b2952c4472324de1143 + +## 存入COIN +sui client call --package $PKG_GAME --module game --function deposit \ +--args $GAME_ID $COIN_ID 60000 + +## play game +### 获取jp coin + + +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x98124e90db7e530abf61ca8fe33494b5a247ff61107c9ce11f4456bd5882fb85 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76::jp::JP> │ +│ │ Version: 416420244 │ +│ │ Digest: 3gBDcmvmyeMVEChHATVfkkK2rvyhQnzGK37xiwWAVwmo │ +│ └── + +# 查看mint结果 +export COIN_A=0x98124e90db7e530abf61ca8fe33494b5a247ff61107c9ce11f4456bd5882fb85 +sui client object $COIN_A + +sui client switch --address $A_ADDR +# 玩游戏 +sui client ptb --move-call $PKG_GAME::game::play @$GAME_ID @0x8 @$COIN_A 100 3 +## transaction +猜数失败 7Pir3oNfkMV2UKUD1s2CgzYXfJAV3QHethfs1qJ1eCF +猜数成功 21iVdmFaie9SxQczY8cQZiCuWFDtTeo9tEY8sFb3dVHy +## 查看余额 +sui client object $COIN_A | grep balance + +# 取款,需要切换到owner +sui client switch --address $OWNER_ADDR +sui client ptb --move-call $PKG_GAME::game::withdraw @$GAME_ADMIN @$GAME_ID + + + + + + + + + + +## withdraw diff --git a/mover/nextuser/code/task4/game/client-testnet.sh b/mover/nextuser/code/task4/game/client-testnet.sh new file mode 100644 index 000000000..a951b9a3c --- /dev/null +++ b/mover/nextuser/code/task4/game/client-testnet.sh @@ -0,0 +1,134 @@ + + +# 代币的发布 task2/coin_faucet/ +## 发布代币 + +sui client publish --skip-fetch-latest-git-deps --skip-dependency-verification + +查看输出结果中的 0x2::coin::TreasuryCap 对象 + +│ ┌── │ +│ │ ObjectID: 0xebe5855ce55333795adad3767935c13b1edb9db71d4a5488d4c60f2a1dc5d975 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 236167323 ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d::jp::JP> │ +│ │ Version: 236167323 │ +│ │ Digest: 2PnZg58j7GD8YgKunCiphUeVSb2Z9KZavrh3e2SqEMp4 │ +│ └── + +# testnet 定义代币的变量 +export PKG=0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d +export JP_CAP=0xebe5855ce55333795adad3767935c13b1edb9db71d4a5488d4c60f2a1dc5d975 +export A_ADDR=0xf7ec2215e565b7a18d7b00e70fccda74b30c3ecceffb5857b1b3d2249e28e94f +export B_ADDR=0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432 +export OWNER_ADDR=0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 + + + +## 执行铸币,transfer给本地址 +sui client call --package 0x2 --module coin --function mint_and_transfer --type-args $PKG::jp::JP --args $JP_CAP 8800000 $C_ADDR + +## 获得输出创建coin +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x7b99079885750871a465ba372524a77f38e05782ac5beec01ab3c15b467d2d11 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x9d5271ec037a50cafae643b4cc495c9e58ec993267b192d2693587f08c23367d::jp::JP> │ +│ │ Version: 236167324 │ +│ │ Digest: EA3ZWf8ZBX2pAB7vVg2Wirq9jrYu9eXspfjWprdXXE7w │ +│ └── + + + +## 配置代币的对象和用户地址 + + + + + + + +sui client call --package 0x2 --module coin --function mint_and_transfer \ +--type-args $PKG::jp::JP --args $JP_CAP 10000 $B_ADDR + +# 游戏发布和调用 +## 发布game包 + +sui client switch --address $OWNER_ADDR +sui client publish + +│ ┌── │ +│ │ ObjectID: 0xc887273b5b03cf3a5f0d5174d057fbea6bd668038ec0b4d8384646a58c2d7c59 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 236167920 ) │ +│ │ ObjectType: 0xd2b6739f08e1f2f764ea4c6e643edfd16752762665334147b3da6ac951ed895e::game::GameStorage │ +│ │ Version: 236167920 │ +│ │ Digest: FYTc87SYuN6aoKwcsHfJztUpVF3x4CW3u4j1iVRVpD2n │ +│ └── + + ┌── │ +│ │ ObjectID: 0xecac6a6d0f7c5bbc3a5e7936b61d5243099a3a27d27d2cd67292f19eb7b79a85 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0xd2b6739f08e1f2f764ea4c6e643edfd16752762665334147b3da6ac951ed895e::game::AdminCap │ +│ │ Version: 236167920 │ +│ │ Digest: GzhT2ZZ7e1ctTRz4h2ncGxkdqbofSrahkZ2rUFHancwt + + +export PKG_GAME=0xd2b6739f08e1f2f764ea4c6e643edfd16752762665334147b3da6ac951ed895e +export GAME_ID=0xc887273b5b03cf3a5f0d5174d057fbea6bd668038ec0b4d8384646a58c2d7c59 +export GAME_ADMIN=0xecac6a6d0f7c5bbc3a5e7936b61d5243099a3a27d27d2cd67292f19eb7b79a85 + + +# 找个coin +sui client objects $OWNER_ADDR + +# faucet 获取JP coin +sui client call --package 0x2 --module coin --function mint_and_transfer \ +--type-args $PKG::jp::JP --args $JP_CAP 60000 $OWNER_ADDR + +sui client call --package 0x2 --module coin --function mint_and_transfer \ +--type-args $PKG::jp::JP --args $JP_CAP 10000 $A_ADDR + + + +## 根据前面输出结果,找到一个大于等于60000 +export COIN_ID=0x6f3670814d0bb98d1f5f70019ddb32b8bfaeb1a5da87836ad0a6f8d8e0a5fc05 + +## 存入COIN +sui client call --package $PKG_GAME --module game --function deposit \ +--args $GAME_ID $COIN_ID 60000 + +## play game +### 获取jp coin +sui client switch --address $A_ADDR + +sui client call --package 0x2 --module coin --function mint_and_transfer \ +--type-args $PKG::jp::JP --args $JP_CAP 10000 $A_ADDR + + +export COIN_A=0x32b8b8add40fdb363c9e895d6d24184a9097aebff573ed6de3a13b52c0dab885 +sui client ptb --split-coins @$COIN_A [100] \ +--assign coin_sub --move-call $PKG_GAME::game::play @$GAME_ID @0x8 coin_sub.0 100 3 + +sui client ptb --move-call $PKG_GAME::game::play @$GAME_ID @0x8 @$COIN_A 100 3 +sui client object $COIN_A | grep balance + + + + +sui client ptb --split-coins @$COIN_A [100] \ +--assign coin_sub \ +--move-call $PKG_GAME::game::play @$GAME_ID @0x8 coin_sub.0 3 + +sui client object $COIN_A + + + + + + + + +## withdraw diff --git a/mover/nextuser/code/task4/game/publish.mainnet.log b/mover/nextuser/code/task4/game/publish.mainnet.log new file mode 100644 index 000000000..7ddaaa6f6 --- /dev/null +++ b/mover/nextuser/code/task4/game/publish.mainnet.log @@ -0,0 +1,160 @@ +Successfully verified dependencies on-chain against source. +Transaction Digest: ETNvAAQXmjNbMrm92NZVxTVsHpRt6tWLBuPosBXNG9HU +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Owner: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ Gas Budget: 26017600 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Version: 415586839 │ +│ │ Digest: 7DVzthFwi2ARMPJTSDkMYFwFBQ8eZV5DDEDKzZ4pkcC9 │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ V6wRaXwGMWdCzu+ERWbc3HwEfFkN9qaj9rojs22VZvsg4QSgRkIdnTERY8r1qxRe2XMfu8ZSsaHBlVyFub8abg== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: ETNvAAQXmjNbMrm92NZVxTVsHpRt6tWLBuPosBXNG9HU │ +│ Status: Success │ +│ Executed Epoch: 591 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: 566u1MN4u9xTh36DCDWoLE8JgiF5yZaAF1ZxS3ek3wyD │ +│ └── │ +│ ┌── │ +│ │ ID: 0x86afb31c444e12753611161af10ba43ea5749f79f5010b6d9368ec57bfbc8199 │ +│ │ Owner: Shared( 415586840 ) │ +│ │ Version: 415586840 │ +│ │ Digest: BFFNLKod3jH9x5dr4UZWHo3bxMgCNMAcmmvDyaBpznsT │ +│ └── │ +│ ┌── │ +│ │ ID: 0x88ab3c1061e1cc6dbb127695b20e5cd2eeefcd3ae887d459732265962f9b676d │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586840 │ +│ │ Digest: EecyspyVT6PAt7ViVqPuRvcGKs7VL89TJPnPFZaDNyQx │ +│ └── │ +│ ┌── │ +│ │ ID: 0xf22f117dccabd82f9f424fea239cb8662e4cde5607d6f507ae105be31ecd0775 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586840 │ +│ │ Digest: 5cRLQ1exaMurWdCz24dZGqxWkggDwkVUrfPe7wnzwGJm │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586840 │ +│ │ Digest: DQxF8kXKYX2JCihrsfYtH52zjPrNMXm1gSihMdtGmnxF │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ Version: 415586840 │ +│ │ Digest: DQxF8kXKYX2JCihrsfYtH52zjPrNMXm1gSihMdtGmnxF │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 24517600 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 3j9AJ67C7KuTZmTJDynkUAzoqndBqDT6wBNwFzbWbrS9 │ +│ DQMWZ4nEYZ4Cc6MN8HXkRWmajTJTh9Psf9euSDCTSUJt │ +│ FPQJirZF6XaBX9wcmQbPUPPX9CzbpymnF3c8vtnpHqWt │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x86afb31c444e12753611161af10ba43ea5749f79f5010b6d9368ec57bfbc8199 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Shared( 415586840 ) │ +│ │ ObjectType: 0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25::game::GameStorage │ +│ │ Version: 415586840 │ +│ │ Digest: BFFNLKod3jH9x5dr4UZWHo3bxMgCNMAcmmvDyaBpznsT │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x88ab3c1061e1cc6dbb127695b20e5cd2eeefcd3ae887d459732265962f9b676d │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 415586840 │ +│ │ Digest: EecyspyVT6PAt7ViVqPuRvcGKs7VL89TJPnPFZaDNyQx │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xf22f117dccabd82f9f424fea239cb8662e4cde5607d6f507ae105be31ecd0775 │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25::game::AdminCap │ +│ │ Version: 415586840 │ +│ │ Digest: 5cRLQ1exaMurWdCz24dZGqxWkggDwkVUrfPe7wnzwGJm │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0xd5d7d66c296d0980d3d355a61d6f3a33b94ae9d8520b741724fe22106ac2c40e │ +│ │ Sender: 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 415586840 │ +│ │ Digest: DQxF8kXKYX2JCihrsfYtH52zjPrNMXm1gSihMdtGmnxF │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25 │ +│ │ Version: 1 │ +│ │ Digest: 566u1MN4u9xTh36DCDWoLE8JgiF5yZaAF1ZxS3ek3wyD │ +│ │ Modules: game, utils │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38 ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -24289480 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/mover/nextuser/code/task4/game/sources/game.move b/mover/nextuser/code/task4/game/sources/game.move new file mode 100644 index 000000000..81d2dd3d9 --- /dev/null +++ b/mover/nextuser/code/task4/game/sources/game.move @@ -0,0 +1,192 @@ + +module game::game; +use sui::coin::{Self, Coin}; +use sui::balance; +use sui::event::{emit}; +use sui::random::{Self, Random}; +use coin_faucet::jp::JP; +use book::utils::log; +public struct GameStorage has key{ + + id : UID, + playerBalance : balance::Balance, + admin_id:ID, +} + + +public struct PlayerEvent has copy,drop{ + player_address : address, + pay_amount : u64, + gain_amount: u64, + fee : u64, + guess : u8, + result : u8, +} + +public struct DepositEvent has copy,drop{ + sender : address, + from : u64, + to : u64 +} + +public fun get_balance(game:&GameStorage) : u64{ + game.playerBalance.value() +} + +public struct AdminCap has key{ + id : UID, +} + + +fun init(ctx: &mut TxContext){ + let game_uid = object::new(ctx); + + let admin_cap = AdminCap{ + id : object::new(ctx), + }; + let game = GameStorage{ + id : game_uid, + playerBalance : balance::zero(), + admin_id : * admin_cap.id.as_inner(), + }; + + transfer::transfer(admin_cap,ctx.sender()); + transfer::share_object(game); +} + +#[allow(lint(self_transfer))] +public fun deposit(game:&mut GameStorage,coin_in:Coin, amount:u64,ctx: &mut TxContext ){ + let mut coin = coin_in; + let c = coin.split(amount,ctx); + let sender = ctx.sender(); + if(coin.value() == 0){ + coin::destroy_zero(coin); + } + else + { + //多余的钱返回给sender + transfer::public_transfer(coin,sender); + }; + + let from = game.playerBalance.value(); + + game.playerBalance.join(sui::coin::into_balance(c)); + let event = DepositEvent{ + sender, + from , + to : game.playerBalance.value() + }; + emit(event); + +} + +/// 实在6点太难中了,只测试3点 +const MAX_DIC_NUM:u8 = 3; +const PAY_TIMES : u64 = 3; //下注赔付倍数 + +public(package) fun dice(random:& Random,ctx: &mut TxContext) : u8{ + let mut g = random::new_generator(random, ctx); + //let val = ( storage.last_nonce) * MULTIPLIER + INCREMENT; + g.generate_u8_in_range(1,MAX_DIC_NUM) +} + + +const FEE_RATE : u64 = 10; //手续费率 百分比 +const EAmountTooLarge : u64 = 1 ; +const EAmountLessThan20 : u64 = 2; +const ECoinAmountIllegal : u64 = 3; +const ENoRight : u64 = 4; + +/// 这里不能是public,否则可以在外部编写合约循环调用, +#[allow(lint(self_transfer))] +entry fun play(game:&mut GameStorage, + random:&Random, + mut c : Coin, + amount : u64, + guess:u8, + ctx: &mut TxContext){ + + assert!(amount >= 20,EAmountLessThan20); + assert!(c.value() >= amount,ECoinAmountIllegal); + let target_amount = amount * PAY_TIMES; + let fee = (target_amount * FEE_RATE) / 100; //手续费,获胜之后抽取 + let real_amount = target_amount - fee ; //获胜的实际金额,扣除实际 + let add_amount = real_amount - amount; + let mut gain_amount = 0; + let mut pay_fee = 0; + log(b"storage balance :",&game.playerBalance.value()); + log(b"add amount", &add_amount); + assert!(game.playerBalance.value() >= add_amount,EAmountTooLarge); + + let dice_num = dice( random,ctx); + if(guess == dice_num){ + + //猜中了,给他的币增加余额 + let pay_coin = balance::split(&mut game.playerBalance, add_amount ).into_coin(ctx); + gain_amount = real_amount; + pay_fee = fee; + coin::join(&mut c,pay_coin); + //log(b"猜对了,增加:", &add_amount); + } + else{ + //猜错了,切一块下来 + //log(b"猜错了,减少: ", &amount); + let new_coin = sui::coin::split(&mut c,amount,ctx); + game.playerBalance.join(new_coin.into_balance()); + }; + + if(c.value() > 0){ + transfer::public_transfer(c,ctx.sender()); + } + else{ + c.destroy_zero(); + }; + + emit(PlayerEvent{ + player_address : ctx.sender(), + pay_amount : amount, + gain_amount : gain_amount, + fee : pay_fee, + guess : guess, + result : dice_num, + }); + +} + +entry fun withdraw(cap:&AdminCap,storage : &mut GameStorage,ctx :&mut TxContext){ + //避免package升级传入新的AdminCap对象 + assert!(cap.id.to_address() == storage.admin_id.to_address(),ENoRight); + let value = storage.playerBalance.value(); + let coin = storage.playerBalance.split(value).into_coin(ctx); + transfer::public_transfer(coin,ctx.sender()); +} + +//节省资源 +#[test_only] +fun destory_storage(storage : GameStorage,ctx : &mut TxContext){ + let GameStorage{ + id, + playerBalance, + admin_id:_, + } = storage; + object::delete(id); + let coin = playerBalance.into_coin(ctx); + transfer::public_transfer(coin,ctx.sender()); +} + +//节省资源 +#[test_only] +entry fun destroy(cap:AdminCap,storage : GameStorage,ctx :&mut TxContext){ + //避免package升级传入新的AdminCap对象 + assert!(cap.id.to_address() == storage.admin_id.to_address()); + let AdminCap{id} = cap; + object::delete(id); + destory_storage(storage,ctx); +} + +#[test_only] +public fun init_for_testing(ctx:&mut TxContext){ + init(ctx); +} + + diff --git a/mover/nextuser/code/task4/game/sources/utils.move b/mover/nextuser/code/task4/game/sources/utils.move new file mode 100644 index 000000000..8c85464a7 --- /dev/null +++ b/mover/nextuser/code/task4/game/sources/utils.move @@ -0,0 +1,6 @@ +module book::utils; +use std::string::{Self}; +public fun log (msg: vector ,t: &T){ + std::debug::print(& string::utf8(msg)); + std::debug::print(t); +} \ No newline at end of file diff --git a/mover/nextuser/code/task4/game/tests/game_tests.move b/mover/nextuser/code/task4/game/tests/game_tests.move new file mode 100644 index 000000000..7a8088404 --- /dev/null +++ b/mover/nextuser/code/task4/game/tests/game_tests.move @@ -0,0 +1,238 @@ +#[test_only] +module game::game_tests ; + use sui::tx_context::{Self, TxContext}; + use sui::test_scenario::{Self as test, Scenario, next_tx}; + use sui::coin::{Self, Coin}; + use sui::sui::SUI; + use game::game::{Self, GameStorage}; + use sui::random::{Self, Random}; + use coin_faucet::jp::JP; + use book::utils::log; + + const ADMIN:address = @0xABCD; + const PLAYER :address = @0x1234; + // 测试初始化 + fun init_test(): (Scenario, address) { + let mut scenario = test::begin(@0x0); + random::create_for_testing(test::ctx(&mut scenario)); + + // 初始化游戏存储 + next_tx(&mut scenario, ADMIN); + { + game::init_for_testing(test::ctx(&mut scenario)); + }; + + + (scenario, ADMIN) + } + + #[test_only] + fun deposite_value(sc :Scenario,amount : u64): Scenario{ + let mut scenario = sc; + + // 创建测试用的 SUI coin + next_tx( &mut scenario, ADMIN); + { + let mut storage = test::take_shared(&scenario); + let ctx = test::ctx( &mut scenario); + let coin = coin::mint_for_testing(amount, ctx); + + // 测试存款 + game::deposit(&mut storage, coin, amount, ctx); + + assert!(game::get_balance(&storage) == amount, 1); + test::return_shared(storage); + }; + scenario + } + + #[test] + fun test_deposit_play_success() { + let (mut scenario, _) = init_test(); + let rnd :Random = test::take_shared(&scenario); + + scenario = deposite_value(scenario,10000); + + next_tx(&mut scenario, PLAYER); + { + + let mut storage = test::take_shared(&scenario); + let ctx = test::ctx(&mut scenario); + let coin = coin::mint_for_testing(500, ctx); + let guess = 3; + game::play(&mut storage,&rnd,coin,100,guess,ctx); + assert!(game::get_balance(&storage) != 10000); + test::return_shared(storage); + }; + test::return_shared(rnd); + test::end(scenario); + } + + #[test] + #[expected_failure(abort_code = game::EAmountTooLarge)] + fun test_play_insufficient_balance() { + let (mut scenario, _) = init_test(); + + let rnd = test::take_shared(&mut scenario); + + //存入太少,余额不足 + scenario = deposite_value(scenario,300); + next_tx(&mut scenario, PLAYER); + { + + let mut storage = test::take_shared(&scenario); + let ctx = test::ctx(&mut scenario); + let coin = coin::mint_for_testing(200, ctx); + + let guess = 2; + // 尝试在余额不足的情况下玩游戏 + game::play(&mut storage, &rnd,coin , 200,guess,ctx); + + test::return_shared(storage); + }; + test::return_shared(rnd); + test::end(scenario); + } + + + + #[test] + #[expected_failure(abort_code = game::ECoinAmountIllegal)] + fun test_play_coin_amount_illegal() { + let (mut scenario, _) = init_test(); + let rnd = test::take_shared(&mut scenario); + + //存入太少,余额不足 + scenario = deposite_value(scenario,600); + next_tx(&mut scenario, PLAYER); + { + + let mut storage = test::take_shared(&scenario); + let ctx = test::ctx(&mut scenario); + let coin = coin::mint_for_testing(199, ctx); + + let guess = 2; + // 尝试在余额不足的情况下玩游戏 + game::play(&mut storage, &rnd,coin , 200,guess,ctx); + + test::return_shared(storage); + }; + test::return_shared(rnd); + test::end(scenario); + } + + + + #[test] + #[expected_failure(abort_code = game::EAmountLessThan20)] + fun test_play_less20() { + let (mut scenario, _) = init_test(); + let rnd = test::take_shared(&mut scenario); + + scenario = deposite_value(scenario,10000 ); + + next_tx(&mut scenario, PLAYER); + { + let mut storage = test::take_shared(&scenario); + let ctx = test::ctx(&mut scenario); + let coin = coin::mint_for_testing(19, ctx); + + let guess = 2; + // 尝试在不足20 yen 玩游戏 + game::play(&mut storage, &rnd,coin , 19,guess,ctx); + + test::return_shared(storage); + }; + test::return_shared(rnd); + test::end(scenario); + } + + #[test] + fun test_play_success() { + let (mut scenario, _) = init_test(); + let rnd = test::take_shared(& scenario); + + scenario = deposite_value(scenario,10000 ); + + // 测试游戏玩法 + next_tx(&mut scenario, PLAYER); + { + + let mut storage:GameStorage = test::take_shared(&scenario); + let coin = coin::mint_for_testing(1000, test::ctx(&mut scenario)); + let coin_id = object::id(&coin); + log(b"coin id: ",&coin_id); + game::play(&mut storage, &rnd,coin,200,1, test::ctx(&mut scenario)); + test::next_tx(&mut scenario,PLAYER); + + let coin : Coin = test::take_from_sender_by_id(&scenario, coin_id); + log(b"1. 交易之后的金额",&coin.value()); + game::play(&mut storage, &rnd,coin,200,2, test::ctx(&mut scenario)); + test::next_tx(&mut scenario,PLAYER); + + let coin : Coin = test::take_from_sender_by_id(&scenario, coin_id); + log(b"2. 交易之后的金额",&coin.value()); + game::play(&mut storage, &rnd,coin,200,3, test::ctx(&mut scenario)); + test::next_tx(&mut scenario,PLAYER); + let coin : Coin = test::take_from_sender_by_id(&scenario, coin_id); + log(b"3. 交易之后的金额",&coin.value()); + + // 验证余额变化 + assert!(game::get_balance(&storage) != 10000, 1); + log(b"交易之后的金额",&coin.value()); + //验证比赛之后的金额 + assert!(coin.value() != 1000); + test::return_to_sender(&scenario, coin); + test::return_shared(rnd); + test::return_shared(storage); + }; + + test::end(scenario); + } + + + + #[test] + fun test_dice() { + let (mut scenario, _) = init_test(); + let rnd :Random = test::take_shared(&scenario); + + test::next_tx(&mut scenario, @0x1234); + { + let mut i =0; + loop{ + let num = game::dice(&rnd, scenario.ctx()); + log(b"dice num:",&num); + i = i + 1; + if(i >= 10) break; + }; + }; + + + test::return_shared(rnd); + test::end(scenario); + } + + #[test] + fun test_withdraw(){ + use std::string::{Self,String}; + let (mut scenario,_) = init_test(); + + test::next_tx(&mut scenario, ADMIN); + { + scenario = deposite_value(scenario,10000 ); + }; + test::next_tx(&mut scenario, ADMIN); + { + let mut storage:GameStorage = test::take_shared(&scenario); + let admin_cap : game::AdminCap = test::take_from_sender(&scenario); + game::withdraw(&admin_cap, &mut storage, test::ctx(&mut scenario)); + + test::return_shared(storage); + test::return_to_sender(&scenario,admin_cap); + }; + + test::end(scenario); + } + + \ No newline at end of file diff --git a/mover/nextuser/readme.md b/mover/nextuser/readme.md index 6d66697f8..ac8963f1c 100644 --- a/mover/nextuser/readme.md +++ b/mover/nextuser/readme.md @@ -28,11 +28,11 @@ ## 02 move coin -- [] My Coin package id : -- [] Faucet package id : -- [] 转账 `My Coin` hash: -- [] `Faucet Coin` address1 mint hash: -- [] `Faucet Coin` address2 mint hash: +- [] My Coin package id :0xb6b7cc1b7b4e7183ba42341c22f10c56b86d70e14a02d4f321769c687b2dabd2 +- [] Faucet package id : 0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76 +- [] 转账 `My Coin` hash:DQMWZ4nEYZ4Cc6MN8HXkRWmajTJTh9Psf9euSDCTSUJt +- [] `Faucet Coin` address1 mint hash:6wFAe3HwXUHzwfcVLK63KBXmv3vnr1XykRWN37gMUd4M +- [] `Faucet Coin` address2 mint hash:4S49DwS3ZkXKcQ7aTr4USyL9sowe9324CyM4riU7FcxB ## 03 move NFT @@ -45,10 +45,10 @@ - [] scan上的NFT截图: ![Scan截图](images/image-20241114000654688.png) ## 04 Move Game -- [] game package id : -- [] deposit Coin hash: -- [] withdraw `Coin` hash: -- [] play game hash: +- [] game package id :0x80f3da6457c89720ca6de5474d2d130b5d7b2c5a443bfad3daa36299d77c4d25 +- [] deposit Coin hash:3J4PHqktepgHGFj7TRk2UQ4BFXEPWPWk6iGyeWJuf9o8 +- [] withdraw `Coin` hash:9FWvZVpohexsHreMbMaLUmB73feei3iEykEUYZ9a9tKP +- [] play game hash:21iVdmFaie9SxQczY8cQZiCuWFDtTeo9tEY8sFb3dVHy ## 05 Move Swap - [] swap package id : diff --git a/task/03.move_nft.md b/task/03.move_nft.md index 21760b0fa..ef578377c 100644 --- a/task/03.move_nft.md +++ b/task/03.move_nft.md @@ -5,11 +5,26 @@ ## 需求 - 完成 NFT相关知识的学习 + - 完成可以mint NFT的合约上链 + + 0xcaf1d107eb08c9c7e39fab4eba69dedfa7a427e2859d63238a8b906a79e6fa0f + - 给自己地址mint一个NFT + + 0x92e3a52a127fda8325496807d1b91fbbc8f67a9630867f408db8350dfc46ce57 + - NFT必须是自己 github 的头像作为图片 + + https://avatars.githubusercontent.com/u/250826?v=4 + - mint 一个 nft 发送到地址: `0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2` + + transaction digest: 6PtC65GCdxrkRUJCZ6sfTxvxVZ7bBd3R79YfCiDB8s8M + - 提交mint到自己地址的浏览器查看(Scan)截图 -- -## 任务指南 \ No newline at end of file + ![image-20241114001306518](images/image-20241114001306518.png) + +## +