diff --git a/mover/qwrdxer/code/task5/cmd.sh b/mover/qwrdxer/code/task5/cmd.sh new file mode 100644 index 000000000..894ca72df --- /dev/null +++ b/mover/qwrdxer/code/task5/cmd.sh @@ -0,0 +1,398 @@ +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ Gas Owner: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ Gas Budget: 33116000 MIST │ +│ Gas Price: 750 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x66304f3dfd22f5209bff3fef0c4da9df77ff656e07f5f16ee9f6d233c613bf27 │ +│ │ Version: 420167053 │ +│ │ Digest: 9gaVNcbtyjzEjm8rp3mLic6ZKMCyMFem9Ucwdo68LQ9F │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ FGCf2khY84o8xLXXY7gR6Czmv4FbslHIDEujAoYUEd4Tsw63J7QcyKRm8F5D6DNSzrK6ZYBtdcvyoc3FMg04CQ== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: EdyFY8wtPc6pErLYTd55VbPzgU9uYiMU6KvUkRmAYxeB │ +│ Status: Success │ +│ Executed Epoch: 586 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x0f91bfa5e9c0f2d92287771ed68042b564781da9e78855c2d64e9e171cb7436d │ +│ │ Owner: Immutable │ +│ │ Version: 420167054 │ +│ │ Digest: 7xdsNJ4Vw7qcEEA6Heb7FNP7Y55canFp16FMNe7npEm1 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x1db50d717e2ecad7b55d277237db3f7d579357ab79e371c4a3f5dc4d0ba52e59 │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ Version: 420167054 │ +│ │ Digest: H1EdLQBS9sLcxj8VpEcVJX6WRiZ51ZMb9A1SMYrmyvFz │ +│ └── │ +│ ┌── │ +│ │ ID: 0x3e7aa58d91050a37bde593209b2fc46c550001cb13da51dde83be5e33ac6cb57 │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ Version: 420167054 │ +│ │ Digest: 5xF5VXostD5NJCUu5sKieCgosQctorHwDkCPSnemRHy1 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: 7t88hbho67Yz1cHonf7wrv6VPULi3jmE4MBXXpkDH3q3 │ +│ └── │ +│ ┌── │ +│ │ ID: 0x84bc9bc113ce987eb35ee92f1faf61ddb38ac8c6b9d2f4d15c0479a70b350580 │ +│ │ Owner: Immutable │ +│ │ Version: 420167054 │ +│ │ Digest: 7yrFSj1qzCX8j2TXF9GjUzLYD2fxgkmgSTqgjwAQmdDB │ +│ └── │ +│ ┌── │ +│ │ ID: 0x8b1d00d1dadb2a5c5c9db6cfcba611e5c8be56513f3e62e3ef687def5c27dae2 │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ Version: 420167054 │ +│ │ Digest: 77NNchMxMwRXq4BPe9gYhh3az73ENUeRuiMGbt3JDkPt │ +│ └── │ +│ ┌── │ +│ │ ID: 0xa57ddfa65f3f524e4d057edf4a1a0dec70946083da7190a8e0b4f2b91b815875 │ +│ │ Owner: Immutable │ +│ │ Version: 420167054 │ +│ │ Digest: 7PwjwXsGGSBQ7xuDNAcRRA46NLvZZobGXZcKKuqc37TN │ +│ └── │ +│ ┌── │ +│ │ ID: 0xfc2bd925a6c4d4fa711240d759b9084fb859e9b58ec19799a2ea56d37204a507 │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ Version: 420167054 │ +│ │ Digest: 7t7mXzVkzg27X4NWk6SzVXgvThDgPkkEWdkdMveon83H │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x66304f3dfd22f5209bff3fef0c4da9df77ff656e07f5f16ee9f6d233c613bf27 │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ Version: 420167054 │ +│ │ Digest: 7DbvUzo5fL5xSJJMmTbeyhhzHubDdvaXKpNKoc48Mv8 │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x66304f3dfd22f5209bff3fef0c4da9df77ff656e07f5f16ee9f6d233c613bf27 │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ Version: 420167054 │ +│ │ Digest: 7DbvUzo5fL5xSJJMmTbeyhhzHubDdvaXKpNKoc48Mv8 │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 31616000 MIST │ +│ Computation Cost: 750000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 49puDQZwHRnu7zYoARCjco1dFKMiK7LVSS8B5Si1yVdh │ +│ 4XMTF4L9pjHKtYRoYJnR8rWyBp8Zewvak7PVmSEEuTKR │ +│ 8MkMyu5cseLwqyWDwg947q7U2d7ipSoGu9LZQh744JRJ │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x0f91bfa5e9c0f2d92287771ed68042b564781da9e78855c2d64e9e171cb7436d │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_USDT::QWRDXER_USDT> │ +│ │ Version: 420167054 │ +│ │ Digest: 7xdsNJ4Vw7qcEEA6Heb7FNP7Y55canFp16FMNe7npEm1 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x1db50d717e2ecad7b55d277237db3f7d579357ab79e371c4a3f5dc4d0ba52e59 │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 420167054 │ +│ │ Digest: H1EdLQBS9sLcxj8VpEcVJX6WRiZ51ZMb9A1SMYrmyvFz │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x3e7aa58d91050a37bde593209b2fc46c550001cb13da51dde83be5e33ac6cb57 │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_USDT::QWRDXER_USDT> │ +│ │ Version: 420167054 │ +│ │ Digest: 5xF5VXostD5NJCUu5sKieCgosQctorHwDkCPSnemRHy1 │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x84bc9bc113ce987eb35ee92f1faf61ddb38ac8c6b9d2f4d15c0479a70b350580 │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_DOGE::QWRDXER_DOGE> │ +│ │ Version: 420167054 │ +│ │ Digest: 7yrFSj1qzCX8j2TXF9GjUzLYD2fxgkmgSTqgjwAQmdDB │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x8b1d00d1dadb2a5c5c9db6cfcba611e5c8be56513f3e62e3ef687def5c27dae2 │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_RMB::QWRDXER_RMB> │ +│ │ Version: 420167054 │ +│ │ Digest: 77NNchMxMwRXq4BPe9gYhh3az73ENUeRuiMGbt3JDkPt │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xa57ddfa65f3f524e4d057edf4a1a0dec70946083da7190a8e0b4f2b91b815875 │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Immutable │ +│ │ ObjectType: 0x2::coin::CoinMetadata<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_RMB::QWRDXER_RMB> │ +│ │ Version: 420167054 │ +│ │ Digest: 7PwjwXsGGSBQ7xuDNAcRRA46NLvZZobGXZcKKuqc37TN │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0xfc2bd925a6c4d4fa711240d759b9084fb859e9b58ec19799a2ea56d37204a507 │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ ObjectType: 0x2::coin::TreasuryCap<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_DOGE::QWRDXER_DOGE> │ +│ │ Version: 420167054 │ +│ │ Digest: 7t7mXzVkzg27X4NWk6SzVXgvThDgPkkEWdkdMveon83H │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x66304f3dfd22f5209bff3fef0c4da9df77ff656e07f5f16ee9f6d233c613bf27 │ +│ │ Sender: 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 420167054 │ +│ │ Digest: 7DbvUzo5fL5xSJJMmTbeyhhzHubDdvaXKpNKoc48Mv8 │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5 │ +│ │ Version: 1 │ +│ │ Digest: 7t88hbho67Yz1cHonf7wrv6VPULi3jmE4MBXXpkDH3q3 │ +│ │ Modules: qwrdxer_DOGE, qwrdxer_RMB, qwrdxer_USDT │ +│ └── │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -31387880 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ + + +│ │ ObjectType: 0x2::coin::TreasuryCap<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_RMB::QWRDXER_RMB> 0x8b1d00d1dadb2a5c5c9db6cfcba611e5c8be56513f3e62e3ef687def5c27dae2 +│ │ ObjectType: 0x2::coin::TreasuryCap<0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5::qwrdxer_USDT::QWRDXER_USDT> │0x3e7aa58d91050a37bde593209b2fc46c550001cb13da51dde83be5e33ac6cb57 +# 领水 +sui client call --package 0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5 --module qwrdxer_RMB --function mint --args 0x8b1d00d1dadb2a5c5c9db6cfcba611e5c8be56513f3e62e3ef687def5c27dae2 1000000000 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b --gas-budget 10000000 + +sui client call --package 0x624279676894ea3ea17937402ec82c0a9681fdf34dd4b5dce75ccde4dd56a8f5 --module qwrdxer_USDT --function mint --args 0x3e7aa58d91050a37bde593209b2fc46c550001cb13da51dde83be5e33ac6cb57 1000000000 0x01bde56f16b7ad996f559ff2d34fa7a11030a8f303ff69bfe1017b321591cc5b --gas-budget 10000000 + +# 存钱 +admin_cap: 0x057bb2450d43c518561ba16d5693bfd3e10c1e5d8e84729035aadb5122106ca7 +swap_bank: 0x4dfdb243dcbc0cc041619e0a48da4ab01e95400062a6ec1c592273396bbdb16c +packageid: 0x48251c536f9c06c5a68d958ce4c1ba6ee1d1bf36698ab42b0c1929d12969a840 + +public entry fun deposit_CoinUSDT(_:&AdminCap,bank:&mut SwapBank,usdtcoin:Coin,_:&mut TxContext){ +sui client call --package 0x48251c536f9c06c5a68d958ce4c1ba6ee1d1bf36698ab42b0c1929d12969a840 --module task5_swap --function deposit_CoinRMB \ +--args 0x057bb2450d43c518561ba16d5693bfd3e10c1e5d8e84729035aadb5122106ca7 0x4dfdb243dcbc0cc041619e0a48da4ab01e95400062a6ec1c592273396bbdb16c 0xa377c0e86efa13a9ff669b0d0cf3be9aff44bc9d2dcdf96ac7653654e69a1ca3 --gas-budget 10000000 + +sui client call --package 0x48251c536f9c06c5a68d958ce4c1ba6ee1d1bf36698ab42b0c1929d12969a840 --module task5_swap --function deposit_CoinUSDT \ +--args 0x057bb2450d43c518561ba16d5693bfd3e10c1e5d8e84729035aadb5122106ca7 0x4dfdb243dcbc0cc041619e0a48da4ab01e95400062a6ec1c592273396bbdb16c 0xa5d7125976b2c3a2c8d3eab6c4954d3153aa683dff7b89f6bd27e5dc0264a0a2 --gas-budget 10000000 + +# swap +sui client call --package 0x48251c536f9c06c5a68d958ce4c1ba6ee1d1bf36698ab42b0c1929d12969a840 --module task5_swap --function swap_USDT_TO_RMB \ +--args 0x4dfdb243dcbc0cc041619e0a48da4ab01e95400062a6ec1c592273396bbdb16c 0xe87cb58658f6078bcb896d90c1fe29853b71f1f3bfca6e6f1dc76fce54c73fd6 --gas-budget 10000000 + +sui client call --package 0x48251c536f9c06c5a68d958ce4c1ba6ee1d1bf36698ab42b0c1929d12969a840 --module task5_swap --function swap_RMB_TO_USDT \ +--args 0x4dfdb243dcbc0cc041619e0a48da4ab01e95400062a6ec1c592273396bbdb16c 0x6c245963e1beb1685d66002894583ac343a39702d52e555ee9d2f9bf58af5e19 --gas-budget 10000000 +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Data │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Sender: 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e │ +│ Gas Owner: 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e │ +│ Gas Budget: 21243200 MIST │ +│ Gas Price: 1000 MIST │ +│ Gas Payment: │ +│ ┌── │ +│ │ ID: 0x137401866fb084a460bb3dddff5ef3e4b9c7f3ae3edf8521c4e25d722f7637e4 │ +│ │ Version: 236168707 │ +│ │ Digest: FDqzJRrUHbm9JP6kcpLKbL3dKAYWpCheYwPs9N9XVCGS │ +│ └── │ +│ │ +│ Transaction Kind: Programmable │ +│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ Input Objects │ │ +│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Pure Arg: Type: address, Value: "0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e" │ │ +│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ╭─────────────────────────────────────────────────────────────────────────╮ │ +│ │ Commands │ │ +│ ├─────────────────────────────────────────────────────────────────────────┤ │ +│ │ 0 Publish: │ │ +│ │ ┌ │ │ +│ │ │ Dependencies: │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ +│ │ │ 0x0000000000000000000000000000000000000000000000000000000000000002 │ │ +│ │ │ 0x7dccdb3a368c516201c525084920b0d05a6d0aa0582b9ce305407f0fcbe809f8 │ │ +│ │ └ │ │ +│ │ │ │ +│ │ 1 TransferObjects: │ │ +│ │ ┌ │ │ +│ │ │ Arguments: │ │ +│ │ │ Result 0 │ │ +│ │ │ Address: Input 0 │ │ +│ │ └ │ │ +│ ╰─────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ Signatures: │ +│ qLRqPDgrLo+hTNZu2jG0qOHi8lN9+neWhAVe5dw8pA4bE8IzfS8EyN+IkhGs0JQ7qTCVyXc3kR7l5tNS7RcQCg== │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Transaction Effects │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Digest: FP4zgCsxWSVwWrUP7gwzRyt6H8inXa4xXHEwqzmq4EbY │ +│ Status: Success │ +│ Executed Epoch: 558 │ +│ │ +│ Created Objects: │ +│ ┌── │ +│ │ ID: 0x5d0625806abc8767669088d87be27ae46aebc866f2eb5e043d8030e294bccd65 │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ Version: 236168708 │ +│ │ Digest: 3B8rsp4u4cHhtAsj5SyBGzsqVLKvsbBYQxL2G2CyCmWA │ +│ └── │ +│ ┌── │ +│ │ ID: 0x5e478cf977b27d86cad94507d2cd0cca626b19f3d853d38516ee19e535f28947 │ +│ │ Owner: Shared( 236168708 ) │ +│ │ Version: 236168708 │ +│ │ Digest: JiGSg5h4rDwJTiKWBk3f5h8bBd2XNot22PqcmAPZLrh │ +│ └── │ +│ ┌── │ +│ │ ID: 0x730177df75e2772275582a8d20621a0a957579be314cb197ef9bb1ecd9dae843 │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ Version: 236168708 │ +│ │ Digest: ErehcbmURWsgWDm2SJCGwLNfoUHvYdK2MbEP1GxESzNJ │ +│ └── │ +│ ┌── │ +│ │ ID: 0xaef7604777b24b9348ba605126d3880172744d6887616ca514ce46031c76a737 │ +│ │ Owner: Immutable │ +│ │ Version: 1 │ +│ │ Digest: 8WfnWdmtbTyXoDqZwAhEv2p6nfKkH6jZCPFntNSGvdyH │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ID: 0x137401866fb084a460bb3dddff5ef3e4b9c7f3ae3edf8521c4e25d722f7637e4 │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ Version: 236168708 │ +│ │ Digest: 5FEBam8M65dPe5Cj8nfYtFGZBvnTpuk1YK5nFzEwHesp │ +│ └── │ +│ Gas Object: │ +│ ┌── │ +│ │ ID: 0x137401866fb084a460bb3dddff5ef3e4b9c7f3ae3edf8521c4e25d722f7637e4 │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ Version: 236168708 │ +│ │ Digest: 5FEBam8M65dPe5Cj8nfYtFGZBvnTpuk1YK5nFzEwHesp │ +│ └── │ +│ Gas Cost Summary: │ +│ Storage Cost: 19243200 MIST │ +│ Computation Cost: 1000000 MIST │ +│ Storage Rebate: 978120 MIST │ +│ Non-refundable Storage Fee: 9880 MIST │ +│ │ +│ Transaction Dependencies: │ +│ 7MGpKbf6Pg9LgDWd73Cv1W83SPXHb7fQTm3BLzkFqZL1 │ +│ GMBJA2gEEvtwv1wGGT7ZEDkQdrmUTKaE4TeinNGQ2feC │ +│ HavfYHBdgJysknuk6B4h4JtCRC293HyqywD2ZHRCM4q6 │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────╮ +│ No transaction block events │ +╰─────────────────────────────╯ + +╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Object Changes │ +├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ Created Objects: │ +│ ┌── │ +│ │ ObjectID: 0x5d0625806abc8767669088d87be27ae46aebc866f2eb5e043d8030e294bccd65 │ +│ │ Sender: 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ ObjectType: 0x2::package::UpgradeCap │ +│ │ Version: 236168708 │ +│ │ Digest: 3B8rsp4u4cHhtAsj5SyBGzsqVLKvsbBYQxL2G2CyCmWA │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x5e478cf977b27d86cad94507d2cd0cca626b19f3d853d38516ee19e535f28947 │ +│ │ Sender: 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e │ +│ │ Owner: Shared( 236168708 ) │ +│ │ ObjectType: 0xaef7604777b24b9348ba605126d3880172744d6887616ca514ce46031c76a737::task5_swap::SwapBank │ +│ │ Version: 236168708 │ +│ │ Digest: JiGSg5h4rDwJTiKWBk3f5h8bBd2XNot22PqcmAPZLrh │ +│ └── │ +│ ┌── │ +│ │ ObjectID: 0x730177df75e2772275582a8d20621a0a957579be314cb197ef9bb1ecd9dae843 │ +│ │ Sender: 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ ObjectType: 0xaef7604777b24b9348ba605126d3880172744d6887616ca514ce46031c76a737::task5_swap::AdminCap │ +│ │ Version: 236168708 │ +│ │ Digest: ErehcbmURWsgWDm2SJCGwLNfoUHvYdK2MbEP1GxESzNJ │ +│ └── │ +│ Mutated Objects: │ +│ ┌── │ +│ │ ObjectID: 0x137401866fb084a460bb3dddff5ef3e4b9c7f3ae3edf8521c4e25d722f7637e4 │ +│ │ Sender: 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI> │ +│ │ Version: 236168708 │ +│ │ Digest: 5FEBam8M65dPe5Cj8nfYtFGZBvnTpuk1YK5nFzEwHesp │ +│ └── │ +│ Published Objects: │ +│ ┌── │ +│ │ PackageID: 0xaef7604777b24b9348ba605126d3880172744d6887616ca514ce46031c76a737 │ +│ │ Version: 1 │ +│ │ Digest: 8WfnWdmtbTyXoDqZwAhEv2p6nfKkH6jZCPFntNSGvdyH │ +│ │ Modules: task5_swap │ +│ └── │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ Balance Changes │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ┌── │ +│ │ Owner: Account Address ( 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e ) │ +│ │ CoinType: 0x2::sui::SUI │ +│ │ Amount: -19265080 │ +│ └── │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/mover/qwrdxer/code/task5/coin.move b/mover/qwrdxer/code/task5/coin.move new file mode 100644 index 000000000..2437c9623 --- /dev/null +++ b/mover/qwrdxer/code/task5/coin.move @@ -0,0 +1,93 @@ +/* +/// Module: task5_coin +module task5_coin::task5_coin; +*/ + +//ref https://examples.sui-book.com/samples/coin.html +//ref https://learnblockchain.cn/article/8717#%20%E5%90%88%E7%BA%A6 +//ref https://learnblockchain.cn/article/9788 + +// Coin1 RMB +module task5_coin::qwrdxer_RMB{ + use sui::coin; + use sui::coin::{TreasuryCap, mint_and_transfer}; + + public struct QWRDXER_RMB has drop{} + fun init(witness:QWRDXER_RMB,ctx: &mut TxContext){ + let (treasury, metadata)=coin::create_currency( + witness, + 6, + b"QWRDXERRMB", + b"", + b"", + option::none(),ctx); + transfer::public_freeze_object(metadata); + transfer::public_transfer(treasury,tx_context::sender(ctx)); + } + // 持有cap 的地址可以mint coin到指定地址 + public entry fun mint( + treasury_cap:&mut TreasuryCap,amount:u64,recipient:address,ctx: &mut TxContext + ){ + mint_and_transfer(treasury_cap,amount,recipient,ctx) + } + +} + +// Coin 2 USDT +module task5_coin::qwrdxer_USDT{ + use sui::coin; + use sui::coin::{TreasuryCap, mint_and_transfer}; + + public struct QWRDXER_USDT has drop{} + fun init(witness:QWRDXER_USDT,ctx: &mut TxContext){ + let (treasury, metadata)=coin::create_currency( + witness, + 6, + b"QWRDXERUSDT", + b"", + b"", + option::none(),ctx); + transfer::public_freeze_object(metadata); + transfer::public_transfer(treasury,tx_context::sender(ctx)); + } + // 持有cap 的地址可以mint coin到指定地址 + public entry fun mint( + treasury_cap:&mut TreasuryCap,amount:u64,recipient:address,ctx: &mut TxContext + ){ + mint_and_transfer(treasury_cap,amount,recipient,ctx) + } + +} +// Coin 3 DOGE +module task5_coin::qwrdxer_DOGE{ + use sui::coin; + use sui::coin::{TreasuryCap, mint_and_transfer}; + + public struct QWRDXER_DOGE has drop{} + fun init(witness:QWRDXER_DOGE,ctx: &mut TxContext){ + let (treasury, metadata)=coin::create_currency( + witness, + 6, + b"QWRDXERDOGE", + b"", + b"", + option::none(),ctx); + transfer::public_freeze_object(metadata); + transfer::public_transfer(treasury,tx_context::sender(ctx)); + } + // 持有cap 的地址可以mint coin到指定地址 + public entry fun mint( + treasury_cap:&mut TreasuryCap,amount:u64,recipient:address,ctx: &mut TxContext + ){ + mint_and_transfer(treasury_cap,amount,recipient,ctx) + } + +} + +/* + 正确调用qwrdxercoin + sui client call --package 0x2a9a3474683292a9f88e5a404c191db5b7e9c8017380344d1ebc0d68caa3f369 --module qwrdxercoin --function mint --args 0xed02c055c9e1aad5cad787be38a1566aa3d851d94aacd62832e2e6c596b26452 10000000 0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2 --gas-budget 10000000 + 使用另一个地址调用faucet + sui client call --package 0x319ea40d6a669cd26f787fb432d2bd29b0bf71f9354486eae9bbab8517ff6bb0 --module faucetqwrdxercoin --function mint --args 0xdaba562b748d108e6cea27d23a7c8487729a60ff041cbb31d6c7c7bd92d1e8a1 10000000 0x3f130ae9c17e02f07fa4bb2e758365e5d1aa8c0b921f1a7dc0cf917a9c1aa07e --gas-budget 10000000 +*/ + diff --git a/mover/qwrdxer/code/task5/qwrdxer.move b/mover/qwrdxer/code/task5/qwrdxer.move new file mode 100644 index 000000000..73bb34760 --- /dev/null +++ b/mover/qwrdxer/code/task5/qwrdxer.move @@ -0,0 +1,117 @@ + +//第一个是简单的SWAP,交换的代币为QWRDXER_RMB 和QWRDXER_USDT +module qwrdxer::task5_swap{ + use sui::balance::{Self,Balance, zero}; + use sui::coin; + use sui::coin::{Coin}; + use sui::event::emit; + use sui::transfer::{share_object, public_transfer}; + use sui::tx_context::sender; + use task5_coin::qwrdxer_RMB::QWRDXER_RMB; + use task5_coin::qwrdxer_USDT::QWRDXER_USDT; + + //日志结构体 + public struct LogBank has drop,copy{ + bank_value_RMB:u64, + bank_value_USDT:u64, + bank_value_change:u64 + } + + public struct AdminCap has key{ + id:UID + } + public struct SwapBank has store,key{ + id:UID, + Coin_RMB:Balance, + Coin_USDT:Balance, + } + fun init(ctx:&mut TxContext){ + //初始化银行 + let bank= SwapBank{ + id:object::new(ctx), + Coin_RMB:zero(), + Coin_USDT:zero() + }; + //共享出去 + share_object(bank); + //创建管理员权限 + transfer::transfer(AdminCap{id:object::new(ctx)},tx_context::sender(ctx)) + } + + // 管理员能调用的存取函数 + public entry fun deposit_CoinRMB(_:&AdminCap,bank:&mut SwapBank,rmbcoin:Coin,_:&mut TxContext){ + let rmbbalance=coin::into_balance(rmbcoin); + let changevalue=balance::value(&rmbbalance); + bank.Coin_RMB.join(rmbbalance); + emit( + LogBank{ + bank_value_RMB:balance::value(&bank.Coin_RMB), + bank_value_USDT:balance::value(&bank.Coin_USDT), + bank_value_change:changevalue + } + ) + } + + public entry fun withDraw_CoinRMB(_:&AdminCap,bank:&mut SwapBank,amt:u64,ctx:&mut TxContext){ + let rmbbalance=balance::split(&mut bank.Coin_RMB,amt); + let cach=coin::from_balance(rmbbalance,ctx); + transfer::public_transfer(cach,ctx.sender()); + emit( + LogBank{ + bank_value_RMB:balance::value(&bank.Coin_RMB), + bank_value_USDT:balance::value(&bank.Coin_USDT), + bank_value_change:amt + } + ) + } + public entry fun deposit_CoinUSDT(_:&AdminCap,bank:&mut SwapBank,usdtcoin:Coin,_:&mut TxContext){ + let usdtbalance=coin::into_balance(usdtcoin); + let changevalue=balance::value(&usdtbalance); + bank.Coin_USDT.join(usdtbalance); + emit( + LogBank{ + bank_value_RMB:balance::value(&bank.Coin_RMB), + bank_value_USDT:balance::value(&bank.Coin_USDT), + bank_value_change:changevalue + } + ) + } + + public entry fun withDraw_CoinUSDT(_:&AdminCap,bank:&mut SwapBank,amt:u64,ctx:&mut TxContext){ + let usdtbalance=balance::split(&mut bank.Coin_USDT,amt); + let cach=coin::from_balance(usdtbalance,ctx); + transfer::public_transfer(cach,ctx.sender()); + emit( + LogBank{ + bank_value_RMB:balance::value(&bank.Coin_RMB), + bank_value_USDT:balance::value(&bank.Coin_USDT), + bank_value_change:amt + } + ) + } + //swap交换函数实现 + public entry fun swap_RMB_TO_USDT(bank:&mut SwapBank,rmbCoin: Coin,ctx:&mut TxContext){ + let coinvalue=coin::value(&rmbCoin); + let swapbalance=coinvalue *730000 /100000; + //RMB 入 Bank + let rmbbalance=coin::into_balance(rmbCoin); + balance::join(&mut bank.Coin_RMB,rmbbalance); + //取出 USDT + let usdtbalance=balance::split(&mut bank.Coin_USDT,swapbalance); + let usdtcoin=coin::from_balance(usdtbalance,ctx); + //发送给对方 + public_transfer(usdtcoin,sender(ctx)); + } + public entry fun swap_USDT_TO_RMB(bank:&mut SwapBank,usdtCoin: Coin,ctx:&mut TxContext){ + let coinvalue=coin::value(&usdtCoin); + let swapbalance=coinvalue*100000 /730000; + //RMB 入 Bank + let usdtbalance=coin::into_balance(usdtCoin); + balance::join(&mut bank.Coin_USDT,usdtbalance); + //取出 USDT + let rmbbalance=balance::split(&mut bank.Coin_RMB,swapbalance); + let rmbtcoin=coin::from_balance(rmbbalance,ctx); + //发送给对方 + public_transfer(rmbtcoin,sender(ctx)); + } +} \ No newline at end of file diff --git a/mover/qwrdxer/readme.md b/mover/qwrdxer/readme.md index ebb695de0..fc8bed82b 100644 --- a/mover/qwrdxer/readme.md +++ b/mover/qwrdxer/readme.md @@ -39,9 +39,9 @@ 3fEZrqVfa5qVMMzq35gDktiqF1RNA9sSJg7bh8KJzs7i ## 05 Move Swap -- [] swap package id : -- [] call swap CoinA-> CoinB hash : -- [] call swap CoinB-> CoinA hash : +- [√] swap package id : 0x48251c536f9c06c5a68d958ce4c1ba6ee1d1bf36698ab42b0c1929d12969a840 +- [√] call swap CoinA-> CoinB hash : 5Gpmj7w7nonDEa48qtrsHyvaxSxXrY47Vonsqmyg5TdR +- [√] call swap CoinB-> CoinA hash : F4vBUtrMMEJmtcUNvKfJEaPghYj37U3ehFkfVW5o155W ## 06 Dapp-kit SDK PTB - [] save hash :