diff --git a/mover/nhatlapross/README.md b/mover/nhatlapross/README.md new file mode 100644 index 00000000..03225d99 --- /dev/null +++ b/mover/nhatlapross/README.md @@ -0,0 +1,46 @@ +## Basic Information +- Sui Wallet Address: `0x3808b95f4603b8140b5d2082d4d6970ded65f49dac8980db525fe6f0a0f05396` +> First-time participants must complete the registration of the wallet address through the first task to have it merged. You should use this address for subsequent tasks. We will also use this address to credit the learning rewards. +- Github: `nhatlapross` + +## Personal Introduction +- Work Experience: `1 years` +- Tech Stack: `C# typescript html` +> Important: Please take your personal introduction seriously. +- Years of experience in web2 development, particularly interested in Move, aiming to use Move as an entry point into blockchain. (This is just an example, please write your own introduction and feel free to add more details.) +- Contact: telegram `@AlvinIchikun` + +## Tasks + +### 01 hello move +- [x] Sui CLI Version: sui 1.39.3-5d4350d66d2b +- [x] Sui Wallet Screenshot: ![](images/suiwallet.png) +- [x] Package ID: 0x9b93c085bbafba5f539a9ee9d0859e996a2adc3ee40b8fa184ae108e17e50795 +- [x] Package ID's Screenshot from Explorer: ![](images/Task1PackageID.png) + +### 02 move coin +- [x] `My Coin` Package ID:0x956140d5ede902167fa66c06b97510bf576888bac73b3c3b757cd473bab144cd +- [x] `Faucet Coin` Package ID: 0x4f6267abc4f4af0f0c7caafed20630cc9081d16dfa49228d07a48469b8418d92 +- [x] Transfer `My Coin` hash: HVLFaH8BNpLTyPvrwNrt6xVcAHNHoFnGmnba79cdc4su +- [x] `Faucet Coin` address 1 mint hash:4SuWJBgwDmG8RhVYFWJsdWQDxS75Gu5ntmxKe4RM9SEQ +- [x] `Faucet Coin` address 2 mint hash:F3rLkXySLUt4xjKCimWqV8WjnT2gDSQMuN2cpnvqjkYr + +### 03 move nft +- [x] NFT Package ID: 0xa5b1cf9c2f44ef86d1a954212a043140c003a84fc0059a21489d351564eea532 +- [x] NFT Object ID: 0xb3473d47f573dd70760581c7d2d7006154913f80a5d7843d40dc47f155cfc7ad +- [x] Transfer NFT hash: Cxbqj92fk6j9uFwECiZ9onj55fJ7iBSs7K7TDuCxAtjW +- [x] NFT's Screenshot from Explorer: ![](images/AlvinNFT.png) + +### 04 move game +- [x] Game Package ID:0x4d0c262d9ebe5fa24c68256e647a54501472a720cae4496cc71bb92fa4ec579c +- [x] Deposit Coin Hash:https://suiscan.xyz/devnet/tx/XawNhfQphkTNzpvGiivNJCkfVBK3bqrrN5ZEWb35d3J +- [x] Withdraw Coin Hash:4wuP1HMwB39gGebiyHcE3yizmFYSoL8v12xnaQEp5dkD +- [x] Play Game Hash:5DvPjTwpTTADk1PMvYa3ua431t7bBUwV15QLsiLhk2vq + +### 05 move swap +- [ ] Swap Package ID: +- [ ] Call Swap Coin A -> Coin B hash: +- [ ] Call Swap Coin B -> Coin A hash: + +### 06 dapp-kit SDK PTB +- [ ] Save Hash: diff --git a/mover/nhatlapross/code/README.md b/mover/nhatlapross/code/README.md new file mode 100644 index 00000000..e69de29b diff --git a/mover/nhatlapross/code/task1/README.md b/mover/nhatlapross/code/task1/README.md new file mode 100644 index 00000000..e69de29b diff --git a/mover/nhatlapross/code/task1/hello_nhatlapross/.gitignore b/mover/nhatlapross/code/task1/hello_nhatlapross/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/nhatlapross/code/task1/hello_nhatlapross/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/nhatlapross/code/task1/hello_nhatlapross/Move.lock b/mover/nhatlapross/code/task1/hello_nhatlapross/Move.lock new file mode 100644 index 00000000..40a1c153 --- /dev/null +++ b/mover/nhatlapross/code/task1/hello_nhatlapross/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "22FA8F6B7AA00AB4EB42634D56E1912D16C0E646859580DC6761BF48E15A197A" +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.39.3" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.devnet] +chain-id = "7f81d47e" +original-published-id = "0x9b93c085bbafba5f539a9ee9d0859e996a2adc3ee40b8fa184ae108e17e50795" +latest-published-id = "0x9b93c085bbafba5f539a9ee9d0859e996a2adc3ee40b8fa184ae108e17e50795" +published-version = "1" diff --git a/mover/nhatlapross/code/task1/hello_nhatlapross/Move.toml b/mover/nhatlapross/code/task1/hello_nhatlapross/Move.toml new file mode 100644 index 00000000..092b3cd8 --- /dev/null +++ b/mover/nhatlapross/code/task1/hello_nhatlapross/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "hello_nhatlapross" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +hello_nhatlapross = "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/nhatlapross/code/task1/hello_nhatlapross/sources/hello_nhatlapross.move b/mover/nhatlapross/code/task1/hello_nhatlapross/sources/hello_nhatlapross.move new file mode 100644 index 00000000..e325b81e --- /dev/null +++ b/mover/nhatlapross/code/task1/hello_nhatlapross/sources/hello_nhatlapross.move @@ -0,0 +1,20 @@ +module hello_nhatlapross::hello_world { + use std::string; + + /// An object that contains an arbitrary string + public struct Hello_nhatlapross has key, store { + id: UID, + /// A string contained in the object + text: string::String + } + + #[lint_allow(self_transfer)] + public entry fun say_hello_nhatlapross(ctx: &mut TxContext) { + let object = Hello_nhatlapross { + id: object::new(ctx), + text: string::utf8(b"Hello handsome boy,Nhat!") + }; + transfer::public_transfer(object, tx_context::sender(ctx)); + } + +} \ No newline at end of file diff --git a/mover/nhatlapross/code/task1/hello_nhatlapross/tests/hello_nhatlapross_tests.move b/mover/nhatlapross/code/task1/hello_nhatlapross/tests/hello_nhatlapross_tests.move new file mode 100644 index 00000000..e5ae2e44 --- /dev/null +++ b/mover/nhatlapross/code/task1/hello_nhatlapross/tests/hello_nhatlapross_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hello_nhatlapross::hello_nhatlapross_tests; +// uncomment this line to import the module +// use hello_nhatlapross::hello_nhatlapross; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hello_nhatlapross() { + // pass +} + +#[test, expected_failure(abort_code = ::hello_nhatlapross::hello_nhatlapross_tests::ENotImplemented)] +fun test_hello_nhatlapross_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nhatlapross/code/task2/alvin_coin/.gitignore b/mover/nhatlapross/code/task2/alvin_coin/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/nhatlapross/code/task2/alvin_coin/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/nhatlapross/code/task2/alvin_coin/Move.lock b/mover/nhatlapross/code/task2/alvin_coin/Move.lock new file mode 100644 index 00000000..f5540632 --- /dev/null +++ b/mover/nhatlapross/code/task2/alvin_coin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "12AAC98FF9ED4D0425E11B9154A48308AE44C60329F28F6C9B34DD43A3CB52C7" +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.39.3" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.devnet] +chain-id = "7f81d47e" +original-published-id = "0x4f6267abc4f4af0f0c7caafed20630cc9081d16dfa49228d07a48469b8418d92" +latest-published-id = "0x4f6267abc4f4af0f0c7caafed20630cc9081d16dfa49228d07a48469b8418d92" +published-version = "1" diff --git a/mover/nhatlapross/code/task2/alvin_coin/Move.toml b/mover/nhatlapross/code/task2/alvin_coin/Move.toml new file mode 100644 index 00000000..065f3ebf --- /dev/null +++ b/mover/nhatlapross/code/task2/alvin_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "alvin_coin" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +alvin_coin = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nhatlapross/code/task2/alvin_coin/readme.md b/mover/nhatlapross/code/task2/alvin_coin/readme.md new file mode 100644 index 00000000..7b0885f4 --- /dev/null +++ b/mover/nhatlapross/code/task2/alvin_coin/readme.md @@ -0,0 +1,6 @@ +package id: 0x956140d5ede902167fa66c06b97510bf576888bac73b3c3b757cd473bab144cd +Treasurycap id: 0xe95ff8979f7f7e5d02ca52e064afed70a6918787fc968a6e5efdeca5422caaab + +sui client call --package 0x956140d5ede902167fa66c06b97510bf576888bac73b3c3b757cd473bab144cd --module alvin_coin --function mint_token --args 0xe95ff8979f7f7e5d02ca52e064afed70a6918787fc968a6e5efdeca5422caaab + +sui client call --package 0x2 --module coin --function mint_and_transfer --args 0xe95ff8979f7f7e5d02ca52e064afed70a6918787fc968a6e5efdeca5422caaab 10000000 0xd9322ea3470365d34b29de778623ba99be18b870702059837c4acf774b9796d7 --type-args 0x956140d5ede902167fa66c06b97510bf576888bac73b3c3b757cd473bab144cd::alvin_coin::ALVIN_COIN \ No newline at end of file diff --git a/mover/nhatlapross/code/task2/alvin_coin/sources/alvin_coin.move b/mover/nhatlapross/code/task2/alvin_coin/sources/alvin_coin.move new file mode 100644 index 00000000..0fa4fe2b --- /dev/null +++ b/mover/nhatlapross/code/task2/alvin_coin/sources/alvin_coin.move @@ -0,0 +1,37 @@ +/* +/// Module: alvin_coin +module alvin_coin::alvin_coin; +*/ + +// For Move coding conventions, see +// https://docs.sui.io/concepts/sui-move-concepts/conventions + + +module 0x0::alvin_coin{ + use sui::coin::{Self,TreasuryCap}; + use sui::tx_context::{Self, TxContext}; + use sui::transfer; + use sui::url; + public struct ALVIN_COIN has drop {} + + fun init(witness: ALVIN_COIN,ctx: &mut TxContext) { + let ascii_url = std::ascii::string(b"https://coffee-teenage-wolf-435.mypinata.cloud/ipfs/QmTkTRCQpPVRwibQ1DeTF9JLyEkQmgL1rjsAS8XE6nFEMi"); + let icon_url = url::new_unsafe(ascii_url); + let icon_url_option = option::some(icon_url); + let(treasury, coinmetadata) = coin::create_currency(witness, + 5, + b"ALC", + b"Alvin Coin", + b"My first coin", + icon_url_option, + ctx); + + transfer::public_freeze_object(coinmetadata); + transfer::public_share_object(treasury); + } + + public entry fun mint_token(treasury: &mut TreasuryCap,ctx: &mut TxContext) { + let coin_object = coin::mint(treasury,350000,ctx); + transfer::public_transfer(coin_object, ctx.sender()); + } +} \ No newline at end of file diff --git a/mover/nhatlapross/code/task2/alvin_coin/tests/alvin_coin_tests.move b/mover/nhatlapross/code/task2/alvin_coin/tests/alvin_coin_tests.move new file mode 100644 index 00000000..fcebc5f3 --- /dev/null +++ b/mover/nhatlapross/code/task2/alvin_coin/tests/alvin_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module alvin_coin::alvin_coin_tests; +// uncomment this line to import the module +// use alvin_coin::alvin_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_alvin_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::alvin_coin::alvin_coin_tests::ENotImplemented)] +fun test_alvin_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nhatlapross/code/task2/faucet_coin/.gitignore b/mover/nhatlapross/code/task2/faucet_coin/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/nhatlapross/code/task2/faucet_coin/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/nhatlapross/code/task2/faucet_coin/Move.lock b/mover/nhatlapross/code/task2/faucet_coin/Move.lock new file mode 100644 index 00000000..70b7f8ec --- /dev/null +++ b/mover/nhatlapross/code/task2/faucet_coin/Move.lock @@ -0,0 +1,26 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "F8CFCF256E2F1BB7CD401C27799A09C40777C5C100F0DFA253E86DD7F0D4ED1B" +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.39.3" +edition = "2024.beta" +flavor = "sui" diff --git a/mover/nhatlapross/code/task2/faucet_coin/Move.toml b/mover/nhatlapross/code/task2/faucet_coin/Move.toml new file mode 100644 index 00000000..1b517a2b --- /dev/null +++ b/mover/nhatlapross/code/task2/faucet_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "faucet_coin" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +faucet_coin = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nhatlapross/code/task2/faucet_coin/sources/faucet_coin.move b/mover/nhatlapross/code/task2/faucet_coin/sources/faucet_coin.move new file mode 100644 index 00000000..c5f44cc7 --- /dev/null +++ b/mover/nhatlapross/code/task2/faucet_coin/sources/faucet_coin.move @@ -0,0 +1,31 @@ +module faucet_coin::faucet_coin { + + use sui::coin::{Self, TreasuryCap}; + use sui::url; + + // OTW + public struct FAUCET_COIN has drop {} + + + + fun init(witness: FAUCET_COIN, ctx: &mut TxContext) { + let ascii_url = std::ascii::string(b"https://coffee-teenage-wolf-435.mypinata.cloud/ipfs/QmTkTRCQpPVRwibQ1DeTF9JLyEkQmgL1rjsAS8XE6nFEMi"); + let icon_url = url::new_unsafe(ascii_url); + let icon_url_option = option::some(icon_url); + let (treasury, coinmetadata) = coin::create_currency(witness, + 6, + b"ALC", + b"Alvin Coin", + b"Alvin faucet coin", + icon_url_option, + ctx); + + transfer::public_freeze_object(coinmetadata); + transfer::public_share_object(treasury); + } + + public entry fun mint_token(treasury: &mut TreasuryCap, ctx: &mut TxContext) { + let coin_object = coin::mint(treasury, 500000, ctx); + transfer::public_transfer(coin_object, ctx.sender()); + } +} \ No newline at end of file diff --git a/mover/nhatlapross/code/task2/faucet_coin/tests/faucet_coin_tests.move b/mover/nhatlapross/code/task2/faucet_coin/tests/faucet_coin_tests.move new file mode 100644 index 00000000..74b01751 --- /dev/null +++ b/mover/nhatlapross/code/task2/faucet_coin/tests/faucet_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module faucet_coin::faucet_coin_tests; +// uncomment this line to import the module +// use faucet_coin::faucet_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_faucet_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::faucet_coin::faucet_coin_tests::ENotImplemented)] +fun test_faucet_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nhatlapross/code/task3/alvin_nft/.gitignore b/mover/nhatlapross/code/task3/alvin_nft/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/nhatlapross/code/task3/alvin_nft/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/nhatlapross/code/task3/alvin_nft/Move.lock b/mover/nhatlapross/code/task3/alvin_nft/Move.lock new file mode 100644 index 00000000..416abdf5 --- /dev/null +++ b/mover/nhatlapross/code/task3/alvin_nft/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "3406E2A3A2A7C52FDFF55D28158FF7ADF4089933DCC808F38FB5AF1181590C10" +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.39.3" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.devnet] +chain-id = "7f81d47e" +original-published-id = "0xa5b1cf9c2f44ef86d1a954212a043140c003a84fc0059a21489d351564eea532" +latest-published-id = "0xa5b1cf9c2f44ef86d1a954212a043140c003a84fc0059a21489d351564eea532" +published-version = "1" diff --git a/mover/nhatlapross/code/task3/alvin_nft/Move.toml b/mover/nhatlapross/code/task3/alvin_nft/Move.toml new file mode 100644 index 00000000..5a293f65 --- /dev/null +++ b/mover/nhatlapross/code/task3/alvin_nft/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "alvin_nft" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +alvin_nft = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nhatlapross/code/task3/alvin_nft/sources/alvin_nft.move b/mover/nhatlapross/code/task3/alvin_nft/sources/alvin_nft.move new file mode 100644 index 00000000..f4fb9c30 --- /dev/null +++ b/mover/nhatlapross/code/task3/alvin_nft/sources/alvin_nft.move @@ -0,0 +1,40 @@ +/* +/// Module: alvin_nft +module alvin_nft::alvin_nft; +*/ + +// For Move coding conventions, see +// https://docs.sui.io/concepts/sui-move-concepts/conventions + + +module 0x0::alvin_nft{ + use std::string::{Self, String}; + use sui::url::{Self, Url}; + + public struct ALVIN_NFT has key,store{ + id: UID, + name: String, + image_url: Url, + creator: address + } + + //init + fun init(ctx: &mut TxContext){ + let obj = ALVIN_NFT{ + id: object::new(ctx), + name: b"Alvin Ichi developer".to_string(), + image_url: url::new_unsafe(std::ascii::string(b"https://coffee-teenage-wolf-435.mypinata.cloud/ipfs/QmebHnFqnGJRsrwFwcThvPUdt699dtWhhyqTigi9JSfsNa")), + creator: ctx.sender() + }; + transfer::transfer(obj, ctx.sender()) + } + + public entry fun mint(ctx: &mut TxContext){ + transfer::transfer(ALVIN_NFT{ + id: object::new(ctx), + name: b"Alvin Ichi developer".to_string(), + image_url: url::new_unsafe(std::ascii::string(b"https://coffee-teenage-wolf-435.mypinata.cloud/ipfs/QmebHnFqnGJRsrwFwcThvPUdt699dtWhhyqTigi9JSfsNa")), + creator: ctx.sender() + }, ctx.sender()) + } +} \ No newline at end of file diff --git a/mover/nhatlapross/code/task3/alvin_nft/tests/alvin_nft_tests.move b/mover/nhatlapross/code/task3/alvin_nft/tests/alvin_nft_tests.move new file mode 100644 index 00000000..be9c63ff --- /dev/null +++ b/mover/nhatlapross/code/task3/alvin_nft/tests/alvin_nft_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module alvin_nft::alvin_nft_tests; +// uncomment this line to import the module +// use alvin_nft::alvin_nft; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_alvin_nft() { + // pass +} + +#[test, expected_failure(abort_code = ::alvin_nft::alvin_nft_tests::ENotImplemented)] +fun test_alvin_nft_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nhatlapross/code/task4/alvin_game/.gitignore b/mover/nhatlapross/code/task4/alvin_game/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/nhatlapross/code/task4/alvin_game/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/nhatlapross/code/task4/alvin_game/Move.lock b/mover/nhatlapross/code/task4/alvin_game/Move.lock new file mode 100644 index 00000000..b2b00ee2 --- /dev/null +++ b/mover/nhatlapross/code/task4/alvin_game/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "E2243F6E64DB94614C6A3E23FB4252275CDFB1AF0CBD71598BE8CDE3585B46E1" +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.39.3" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.devnet] +chain-id = "d4b9ca36" +original-published-id = "0x4d0c262d9ebe5fa24c68256e647a54501472a720cae4496cc71bb92fa4ec579c" +latest-published-id = "0x4d0c262d9ebe5fa24c68256e647a54501472a720cae4496cc71bb92fa4ec579c" +published-version = "1" diff --git a/mover/nhatlapross/code/task4/alvin_game/Move.toml b/mover/nhatlapross/code/task4/alvin_game/Move.toml new file mode 100644 index 00000000..161e4853 --- /dev/null +++ b/mover/nhatlapross/code/task4/alvin_game/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "alvin_game" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } + +# 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] +alvin_game = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nhatlapross/code/task4/alvin_game/note.md b/mover/nhatlapross/code/task4/alvin_game/note.md new file mode 100644 index 00000000..1135028e --- /dev/null +++ b/mover/nhatlapross/code/task4/alvin_game/note.md @@ -0,0 +1,6 @@ +sui client call --package 0x4d0c262d9ebe5fa24c68256e647a54501472a720cae4496cc71bb92fa4ec579c --module alvin_game --function deposit --args 0x5e5eab7c50c66daa60ecadaa628f3253946868e0f81045f12e1d23b9ac1d7410 0xe8658844c536da12aec500c713ea2a553535c028c27ae14bd057609220748be2 1000000000 --gas-budget 200000000 + +sui client call --package 0x4d0c262d9ebe5fa24c68256e647a54501472a720cae4496cc71bb92fa4ec579c --module alvin_game --function withdraw --args 0x5e5eab7c50c66daa60ecadaa628f3253946868e0f81045f12e1d23b9ac1d7410 0x9ce2f1532b2f3aca4c819f50515ee94218e44acbdcbd8779416dfe56a501acf0 500000000 --gas-budget 200000000 + + +sui client call --package 0x4d0c262d9ebe5fa24c68256e647a54501472a720cae4496cc71bb92fa4ec579c --module alvin_game --function play --args 0x5e5eab7c50c66daa60ecadaa628f3253946868e0f81045f12e1d23b9ac1d7410 0x8 true 0xe8658844c536da12aec500c713ea2a553535c028c27ae14bd057609220748be2 --gas-budget 200000000 \ No newline at end of file diff --git a/mover/nhatlapross/code/task4/alvin_game/sources/alvin_game.move b/mover/nhatlapross/code/task4/alvin_game/sources/alvin_game.move new file mode 100644 index 00000000..a83bdb30 --- /dev/null +++ b/mover/nhatlapross/code/task4/alvin_game/sources/alvin_game.move @@ -0,0 +1,72 @@ +module 0x0::alvin_game { + + use sui::balance::{Self, Balance}; + use sui::coin::{Self, Coin}; + use sui::random::{Self, Random}; + use sui::sui::SUI; + + + public struct Game has key { + id: UID, + balance: Balance + } + + public struct Admin has key { + id: UID, + } + + fun init(ctx: &mut TxContext){ + transfer::share_object(Game { + id: object::new(ctx), + balance: balance::zero() + }); + + + transfer::transfer( + Admin{ + id: object::new(ctx) + } + , ctx.sender()) + + } + + entry fun deposit( + game: &mut Game, + coin: &mut Coin, + amount: u64 + ){ + let split_balance = balance::split(coin::balance_mut(coin), amount); + + balance::join(&mut game.balance, split_balance); + } + + + entry fun withdraw( + game: &mut Game, + _: &Admin, + amount: u64, + ctx: &mut TxContext + ){ + let cash = coin::take(&mut game.balance, amount, ctx); + + transfer::public_transfer(cash, ctx.sender()); + } + + entry fun play( + game: &mut Game, + rnd: &Random, + guess: bool, + coin: &mut Coin, + ctx: &mut TxContext + ) { + let mut gen = random::new_generator(rnd, ctx); + let flag = random::generate_bool(&mut gen); + + if(flag == guess) { + let reward = coin::take(&mut game.balance, 1_000_000_000, ctx); + coin::join(coin, reward); + } else { + deposit(game, coin, 1_000_000_000) + } + } +} \ No newline at end of file diff --git a/mover/nhatlapross/code/task4/alvin_game/tests/alvin_game_tests.move b/mover/nhatlapross/code/task4/alvin_game/tests/alvin_game_tests.move new file mode 100644 index 00000000..24c6c07e --- /dev/null +++ b/mover/nhatlapross/code/task4/alvin_game/tests/alvin_game_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module alvin_game::alvin_game_tests; +// uncomment this line to import the module +// use alvin_game::alvin_game; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_alvin_game() { + // pass +} + +#[test, expected_failure(abort_code = ::alvin_game::alvin_game_tests::ENotImplemented)] +fun test_alvin_game_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nhatlapross/code/task5/.gitignore b/mover/nhatlapross/code/task5/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/nhatlapross/code/task5/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/nhatlapross/code/task5/Move.lock b/mover/nhatlapross/code/task5/Move.lock new file mode 100644 index 00000000..e53477a1 --- /dev/null +++ b/mover/nhatlapross/code/task5/Move.lock @@ -0,0 +1,52 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "3FEC9BA9FA4A98DA3DBA875F0F9DA52ABE2823A04383F0838343226DAC97EA15" +deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3" +dependencies = [ + { id = "Sui", name = "Sui" }, + { id = "alvin_coin", name = "alvin_coin" }, + { id = "faucet_coin", name = "faucet_coin" }, +] + +[[move.package]] +id = "MoveStdlib" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" } + +[[move.package]] +id = "Sui" +source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/sui-framework" } + +dependencies = [ + { id = "MoveStdlib", name = "MoveStdlib" }, +] + +[[move.package]] +id = "alvin_coin" +source = { local = "../task2/alvin_coin" } + +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "faucet_coin" +source = { local = "../task2/faucet_coin" } + +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[move.toolchain-version] +compiler-version = "1.39.3" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.devnet] +chain-id = "d4b9ca36" +original-published-id = "0x296baecab1fa26bd40d721c724d65173c878af7e4e543da448a3bc75cf5d3191" +latest-published-id = "0x296baecab1fa26bd40d721c724d65173c878af7e4e543da448a3bc75cf5d3191" +published-version = "1" diff --git a/mover/nhatlapross/code/task5/Move.toml b/mover/nhatlapross/code/task5/Move.toml new file mode 100644 index 00000000..98d477e8 --- /dev/null +++ b/mover/nhatlapross/code/task5/Move.toml @@ -0,0 +1,39 @@ +[package] +name = "task5" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" } +alvin_coin = {local = "../task2/alvin_coin"} +faucet_coin = {local = "../task2/faucet_coin"} + +# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`. +# Revision can be a branch, a tag, and a commit hash. +# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" } + +# For local dependencies use `local = path`. Path is relative to the package root +# Local = { local = "../path/to" } + +# To resolve a version conflict and force a specific version for dependency +# override use `override = true` +# Override = { local = "../conflicting/version", override = true } + +[addresses] +task5 = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/nhatlapross/code/task5/sources/task5.move b/mover/nhatlapross/code/task5/sources/task5.move new file mode 100644 index 00000000..888d02aa --- /dev/null +++ b/mover/nhatlapross/code/task5/sources/task5.move @@ -0,0 +1,101 @@ +module 0x0::task5 { + use alvin_coin::alvin_coin::ALVIN_COIN; + use faucet_coin::faucet_coin::FAUCET_COIN; + use sui::balance::{ Self, Balance }; + use sui::coin::{ Self, Coin }; + + public struct AdminCap has key { + id: UID, + } + + public struct Pool has key { + id: UID, + my_coin: Balance, + faucet_coin: Balance + } + + + fun init(ctx: &mut TxContext) { + let pool = Pool { + id: object::new(ctx), + my_coin: balance::zero(), + faucet_coin: balance::zero() + }; + + transfer::share_object(pool); + + let admin = AdminCap { id: object::new(ctx) }; + transfer::transfer(admin, ctx.sender()); + } + + public entry fun deposit_my_coin(pool: &mut Pool, user_coin: Coin, amount: u64, ctx: &mut TxContext) { + let coin_value = user_coin.value(); + assert!(coin_value >= amount, 0); + + let mut user_balance = user_coin.into_balance(); + + if (coin_value == amount) { + balance::join(&mut pool.my_coin, user_balance); + } else { + balance::join(&mut pool.my_coin, balance::split(&mut user_balance, amount)); + let remaining_coin = coin::from_balance(user_balance, ctx); + transfer::public_transfer(remaining_coin, ctx.sender()); + } + } + + public entry fun deposit_faucet_coin(pool: &mut Pool, user_coin: Coin, amount: u64, ctx: &mut TxContext) { + let coin_value = user_coin.value(); + assert!(coin_value >= amount, 0); + + let mut user_balance = user_coin.into_balance(); + + if (coin_value == amount) { + balance::join(&mut pool.faucet_coin, user_balance); + } else { + balance::join(&mut pool.faucet_coin, balance::split(&mut user_balance, amount)); + let remaining_coin = coin::from_balance(user_balance, ctx); + transfer::public_transfer(remaining_coin, ctx.sender()); + } + } + + public entry fun withdraw_my_coin(_: &AdminCap, pool: &mut Pool, amount: u64, ctx: &mut TxContext) { + let pool_value = pool.my_coin.value(); + assert!(pool_value >= amount, 1); + + let withdraw_balance = balance::split(&mut pool.my_coin, amount); + let withdraw_coin = coin::from_balance(withdraw_balance, ctx); + + transfer::public_transfer(withdraw_coin, ctx.sender()); + } + + public entry fun withdraw_faucet_coin(_: &AdminCap, pool: &mut Pool, amount: u64, ctx: &mut TxContext) { + let pool_value = pool.faucet_coin.value(); + assert!(pool_value >= amount, 1); + + let withdraw_balance = balance::split(&mut pool.faucet_coin, amount); + let withdraw_coin = coin::from_balance(withdraw_balance, ctx); + + transfer::public_transfer(withdraw_coin, ctx.sender()); + } + + public entry fun swap_my_coin_to_faucet_coin(pool: &mut Pool, user_coin: Coin, amount: u64, ctx: &mut TxContext) { + deposit_my_coin(pool, user_coin, amount, ctx); + + // Rate 1:1 + let output_balance = balance::split(&mut pool.faucet_coin, amount); + let output_coin = coin::from_balance(output_balance, ctx); + + transfer::public_transfer(output_coin, ctx.sender()); + } + + public entry fun swap_faucet_coin_to_my_coin(pool: &mut Pool, user_coin: Coin, amount: u64, ctx: &mut TxContext) { + deposit_faucet_coin(pool, user_coin, amount, ctx); + + // Rate 1:1 + let output_balance = balance::split(&mut pool.my_coin, amount); + let output_coin = coin::from_balance(output_balance, ctx); + + transfer::public_transfer(output_coin, ctx.sender()); + } + +} diff --git a/mover/nhatlapross/code/task5/tests/task5_tests.move b/mover/nhatlapross/code/task5/tests/task5_tests.move new file mode 100644 index 00000000..006cda1f --- /dev/null +++ b/mover/nhatlapross/code/task5/tests/task5_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module task5::task5_tests; +// uncomment this line to import the module +// use task5::task5; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_task5() { + // pass +} + +#[test, expected_failure(abort_code = ::task5::task5_tests::ENotImplemented)] +fun test_task5_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/nhatlapross/images/AlvinNFT.png b/mover/nhatlapross/images/AlvinNFT.png new file mode 100644 index 00000000..1c177c39 Binary files /dev/null and b/mover/nhatlapross/images/AlvinNFT.png differ diff --git a/mover/nhatlapross/images/README.md b/mover/nhatlapross/images/README.md new file mode 100644 index 00000000..e69de29b diff --git a/mover/nhatlapross/images/Task1PackageID.png b/mover/nhatlapross/images/Task1PackageID.png new file mode 100644 index 00000000..c94ed4bd Binary files /dev/null and b/mover/nhatlapross/images/Task1PackageID.png differ diff --git a/mover/nhatlapross/images/suiwallet.png b/mover/nhatlapross/images/suiwallet.png new file mode 100644 index 00000000..f8b01f91 Binary files /dev/null and b/mover/nhatlapross/images/suiwallet.png differ diff --git a/mover/nhatlapross/notes/README.md b/mover/nhatlapross/notes/README.md new file mode 100644 index 00000000..e69de29b