diff --git a/mover/hai/README.md b/mover/hai/README.md new file mode 100644 index 00000000..4cb72a51 --- /dev/null +++ b/mover/hai/README.md @@ -0,0 +1,46 @@ +## Basic Information +- Sui Wallet Address: `0xa1fcefa6d704434d6e1b5f68a13024ea8ea7df347413564b1a8e170e5f9e6fd4` +> 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: `tranvanhai0504` + +## Personal Introduction +- Work Experience: `1 years` +- Tech Stack: `REACT` `NEXTJS`, `NODEJS`, `MONGODB`, `Kotlin`, etc. +> Important: Please take your personal introduction seriously. +- 1 Year of experience in web2 development, particularly interested in Move, aiming to use Move as an entry point into blockchain. +- Contact: telegram `` + +## Tasks + +### 01 hello move +- [x] Sui CLI Version: 1.39.1 +- [x] Sui Wallet Screenshot: ![](images/sui_wallet.png) +- [x] Package ID: 0xf325a049c6a91db19a12231835da1e8abc4f6c427c2bb94dfc1e592d872203ab +- [x] Package ID's Screenshot from Explorer: ![](images/sui_explorer.png) + +### 02 move coin +- [x] `My Coin` Package ID: 0xd43e32829240189cea70cacf8363e089e372e44f77f97e56359663e850243bfe +- [x] `Faucet Coin` Package ID: 0x537540423a252ec5687dd347390af56adf7bc1790b46cf02e72d066a3b30dcc2 +- [x] Transfer `My Coin` hash: FJ9yvX4Zpb5tWuxZU5TTVEFGUKXgUKF3hKEWTPMj2jK4 +- [x] `Faucet Coin` address 1 mint hash: 1z7JqBrnK4EqLYuJEHjJqgSWTJik1EieJQ1x7ZPKg8k +- [x] `Faucet Coin` address 2 mint hash: DcnSW8QH111WjtpNUiDUvX2KmBsffFhRJRAtr8iAqJNA + +### 03 move nft +- [x] NFT Package ID: 0xd15d593a2410c89003b4c0825014bb867efbc9dca5015a38ac229a71b47db64b +- [x] NFT Object ID: 0x9c753b3b69610148da979b6419b0122f2a051971f7f066a28b30a71ccee416ef +- [x] Transfer NFT hash: F1sazvKDoMheSjpWEgrX1mYpzCmZ5tkrCNgW5JUy5DZG +- [x] NFT's Screenshot from Explorer: ![](images/NFT.png) + +### 04 move game +- [x] Game Package ID: 0x24cfdc5e0b9917929d3bbfbcf98c445207c9e98db123bbcea8e488893245b5a4 +- [x] Deposit Coin Hash: 3D3XDhtM9hYKLJ3HUZSGk99WU83kartFiu2yKfkoLbJX +- [x] Withdraw Coin Hash: rV2G239CqcdCgD8NRKFkXcJsSwETrMB5PLMjJq55SbD +- [x] Play Game Hash: HGXsR3Zk2DgXFFN2YQLXHnxMCVRSAuTyxKpNbkM8Tmnc + +### 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/hai/code/README.md b/mover/hai/code/README.md new file mode 100644 index 00000000..e69de29b diff --git a/mover/hai/code/task1/Hello_Move/.gitignore b/mover/hai/code/task1/Hello_Move/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/hai/code/task1/Hello_Move/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/hai/code/task1/Hello_Move/Move.lock b/mover/hai/code/task1/Hello_Move/Move.lock new file mode 100644 index 00000000..79085d83 --- /dev/null +++ b/mover/hai/code/task1/Hello_Move/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "52664DA431D121453DE4A63E2A2EEFD5594CFC5E814D55AE51888BE5A9230629" +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.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0xf325a049c6a91db19a12231835da1e8abc4f6c427c2bb94dfc1e592d872203ab" +latest-published-id = "0xf325a049c6a91db19a12231835da1e8abc4f6c427c2bb94dfc1e592d872203ab" +published-version = "1" diff --git a/mover/hai/code/task1/Hello_Move/Move.toml b/mover/hai/code/task1/Hello_Move/Move.toml new file mode 100644 index 00000000..4412776d --- /dev/null +++ b/mover/hai/code/task1/Hello_Move/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "Hello_Move" +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_move = "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/hai/code/task1/Hello_Move/sources/hello_move.move b/mover/hai/code/task1/Hello_Move/sources/hello_move.move new file mode 100644 index 00000000..a0f356b8 --- /dev/null +++ b/mover/hai/code/task1/Hello_Move/sources/hello_move.move @@ -0,0 +1,21 @@ +module hello_move::hello{ + + use sui::object::{Self, UID}; + use std::string::{Self, String}; + use sui::tx_context::{Self, TxContext}; + + public struct Hello_tranvanhai0504 has key{ + id: UID, + name: String, + } + + public entry fun say_hello_haitran(ctx: &mut TxContext){ + + let hello_world = Hello_tranvanhai0504 { + id: object::new(ctx), + name: b"Hello hai".to_string() + }; + + transfer::transfer(hello_world, tx_context::sender(ctx)); + } +} \ No newline at end of file diff --git a/mover/hai/code/task1/Hello_Move/tests/hello_move_tests.move b/mover/hai/code/task1/Hello_Move/tests/hello_move_tests.move new file mode 100644 index 00000000..7798d8dd --- /dev/null +++ b/mover/hai/code/task1/Hello_Move/tests/hello_move_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module hello_move::hello_move_tests; +// uncomment this line to import the module +// use hello_move::hello_move; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_hello_move() { + // pass +} + +#[test, expected_failure(abort_code = ::hello_move::hello_move_tests::ENotImplemented)] +fun test_hello_move_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/hai/code/task1/README.md b/mover/hai/code/task1/README.md new file mode 100644 index 00000000..e69de29b diff --git a/mover/hai/code/task2/my_another_coin/.gitignore b/mover/hai/code/task2/my_another_coin/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/hai/code/task2/my_another_coin/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/hai/code/task2/my_another_coin/Move.lock b/mover/hai/code/task2/my_another_coin/Move.lock new file mode 100644 index 00000000..37ce9859 --- /dev/null +++ b/mover/hai/code/task2/my_another_coin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "09266C18DE7CBB6343FECA359C45986E63E84C7C70D52C0B7C58474648B15725" +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.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0xb6ce676495e3799caea9e500a52cd9081b3c081da99d450a813dc181cf7f00a9" +latest-published-id = "0xb6ce676495e3799caea9e500a52cd9081b3c081da99d450a813dc181cf7f00a9" +published-version = "1" diff --git a/mover/hai/code/task2/my_another_coin/Move.toml b/mover/hai/code/task2/my_another_coin/Move.toml new file mode 100644 index 00000000..3811b078 --- /dev/null +++ b/mover/hai/code/task2/my_another_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "my_another_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] +my_another_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/hai/code/task2/my_another_coin/sources/my_another_coin.move b/mover/hai/code/task2/my_another_coin/sources/my_another_coin.move new file mode 100644 index 00000000..9328c64f --- /dev/null +++ b/mover/hai/code/task2/my_another_coin/sources/my_another_coin.move @@ -0,0 +1,37 @@ +module 0x0::my_another_coin{ + use sui::tx_context::{sender}; + use sui::coin::{Self, Coin, TreasuryCap}; + use sui::url::{Self}; + + // === define struct + public struct MY_ANOTHER_COIN has drop{} + + #[allow(lint(share_owned))] + fun init (witness: MY_ANOTHER_COIN, ctx: &mut TxContext){ + let (treasuryCap, coinMetadata) = coin::create_currency( + witness, + 8, + b"HAI", + b"tranvanhai0504 Coin", + b"coder binh thanh!", + option::some(url::new_unsafe_from_bytes(b"https://aggregator.walrus-testnet.walrus.space/v1/X7KET_iwogbmrgD7ITJE-ZUE6k01TrK8d8AtV4l2FfI")), + ctx + ); + transfer::public_share_object(treasuryCap); + transfer::public_share_object(coinMetadata); + } + + /// create coin and update total supply + public entry fun mint( + cap: &mut TreasuryCap, + value: u64, + receiver: address, + ctx: &mut TxContext){ + let mint_coin = coin::mint( + cap, + value, + ctx, + ); + transfer::public_transfer(mint_coin, receiver); + } +} \ No newline at end of file diff --git a/mover/hai/code/task2/my_another_coin/tests/my_another_coin_tests.move b/mover/hai/code/task2/my_another_coin/tests/my_another_coin_tests.move new file mode 100644 index 00000000..728b646a --- /dev/null +++ b/mover/hai/code/task2/my_another_coin/tests/my_another_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module my_another_coin::my_another_coin_tests; +// uncomment this line to import the module +// use my_another_coin::my_another_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_my_another_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::my_another_coin::my_another_coin_tests::ENotImplemented)] +fun test_my_another_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/hai/code/task2/my_coin/.gitignore b/mover/hai/code/task2/my_coin/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/hai/code/task2/my_coin/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/hai/code/task2/my_coin/Move.lock b/mover/hai/code/task2/my_coin/Move.lock new file mode 100644 index 00000000..99870e93 --- /dev/null +++ b/mover/hai/code/task2/my_coin/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "0A4652D38CF3C3FDB79EC6C1C98FCFF7B2E933E12B84A1DA267DB28F66AFECE3" +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.40.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x537540423a252ec5687dd347390af56adf7bc1790b46cf02e72d066a3b30dcc2" +latest-published-id = "0x537540423a252ec5687dd347390af56adf7bc1790b46cf02e72d066a3b30dcc2" +published-version = "1" diff --git a/mover/hai/code/task2/my_coin/Move.toml b/mover/hai/code/task2/my_coin/Move.toml new file mode 100644 index 00000000..b9ca003f --- /dev/null +++ b/mover/hai/code/task2/my_coin/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "my_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] +my_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/hai/code/task2/my_coin/sources/my_coin.move b/mover/hai/code/task2/my_coin/sources/my_coin.move new file mode 100644 index 00000000..efc23d02 --- /dev/null +++ b/mover/hai/code/task2/my_coin/sources/my_coin.move @@ -0,0 +1,20 @@ +module 0x0::my_coin { + + use sui::coin::{Self, TreasuryCap}; + use sui::tx_context::{Self, TxContext}; + use sui::transfer; + + public struct MY_COIN has drop {} + + fun init(witness: MY_COIN, ctx: &mut TxContext) { + let (treasury, coin_metadata) = coin::create_currency(witness, 5, b"HIGHCOIN", b"High Coin", b"my super coin", option::none(), ctx); + + transfer::public_freeze_object(coin_metadata); + transfer::public_share_object(treasury); + } + + public entry fun mint_token(treasury: &mut TreasuryCap, ctx: &mut TxContext) { + let coin_object = coin::mint(treasury, 1000000, ctx); + transfer::public_transfer(coin_object, ctx.sender()); + } +} diff --git a/mover/hai/code/task2/my_coin/tests/my_coin_tests.move b/mover/hai/code/task2/my_coin/tests/my_coin_tests.move new file mode 100644 index 00000000..cd5b3606 --- /dev/null +++ b/mover/hai/code/task2/my_coin/tests/my_coin_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module my_coin::my_coin_tests; +// uncomment this line to import the module +// use my_coin::my_coin; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_my_coin() { + // pass +} + +#[test, expected_failure(abort_code = ::my_coin::my_coin_tests::ENotImplemented)] +fun test_my_coin_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/hai/code/task3/.gitignore b/mover/hai/code/task3/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/hai/code/task3/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/hai/code/task3/Move.lock b/mover/hai/code/task3/Move.lock new file mode 100644 index 00000000..ef51d3af --- /dev/null +++ b/mover/hai/code/task3/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "DEDE53BD567ECEDC2009BE853A86F47F6BDC3F1F03A6B00FAED274F07E74A18B" +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.40.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0xd15d593a2410c89003b4c0825014bb867efbc9dca5015a38ac229a71b47db64b" +latest-published-id = "0xd15d593a2410c89003b4c0825014bb867efbc9dca5015a38ac229a71b47db64b" +published-version = "1" diff --git a/mover/hai/code/task3/Move.toml b/mover/hai/code/task3/Move.toml new file mode 100644 index 00000000..480be159 --- /dev/null +++ b/mover/hai/code/task3/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "task3" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[dependencies] +Sui = { git = "https://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] +task3 = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/hai/code/task3/sources/task3.move b/mover/hai/code/task3/sources/task3.move new file mode 100644 index 00000000..990af79f --- /dev/null +++ b/mover/hai/code/task3/sources/task3.move @@ -0,0 +1,43 @@ +/* +/// Module: task3 +module task3::task3; +*/ + +// For Move coding conventions, see +// https://docs.sui.io/concepts/sui-move-concepts/conventions + + +module 0x0::task3{ + + use std::string::{Self, String}; + use sui::url::{Self, Url}; + + public struct GitNFT has key, store { + id: UID, + name: String, + image_url: Url, + creator: address, + } + + fun init(ctx: &mut TxContext){ + let obj = GitNFT{ + id: object::new(ctx), + name: b"GitNFT".to_string(), + image_url: url::new_unsafe_from_bytes(b"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcREH8eOkHxsELIF5Ztbh9Q5_SznwHUU3bWncQ&s"), + creator: ctx.sender(), + }; + + transfer::transfer(obj, ctx.sender()); + } + + public entry fun mint(ctx: &mut TxContext){ + let obj = GitNFT{ + id: object::new(ctx), + name: b"HaiNFT".to_string(), + image_url: url::new_unsafe_from_bytes(b"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcREH8eOkHxsELIF5Ztbh9Q5_SznwHUU3bWncQ&s"), + creator: ctx.sender(), + }; + + transfer::transfer(obj, ctx.sender()); + } +} \ No newline at end of file diff --git a/mover/hai/code/task3/tests/task3_tests.move b/mover/hai/code/task3/tests/task3_tests.move new file mode 100644 index 00000000..d128fbb0 --- /dev/null +++ b/mover/hai/code/task3/tests/task3_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module task3::task3_tests; +// uncomment this line to import the module +// use task3::task3; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_task3() { + // pass +} + +#[test, expected_failure(abort_code = ::task3::task3_tests::ENotImplemented)] +fun test_task3_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/hai/code/task4/.gitignore b/mover/hai/code/task4/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/hai/code/task4/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/hai/code/task4/Move.lock b/mover/hai/code/task4/Move.lock new file mode 100644 index 00000000..debed78b --- /dev/null +++ b/mover/hai/code/task4/Move.lock @@ -0,0 +1,34 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "ED18027FE1E04C9C17AFCADBD07CCA64749BB3234A62A2FDA2C1172E7092CD17" +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.1" +edition = "2024.beta" +flavor = "sui" + +[env] + +[env.testnet] +chain-id = "4c78adac" +original-published-id = "0x24cfdc5e0b9917929d3bbfbcf98c445207c9e98db123bbcea8e488893245b5a4" +latest-published-id = "0x24cfdc5e0b9917929d3bbfbcf98c445207c9e98db123bbcea8e488893245b5a4" +published-version = "1" diff --git a/mover/hai/code/task4/Move.toml b/mover/hai/code/task4/Move.toml new file mode 100644 index 00000000..86e124a4 --- /dev/null +++ b/mover/hai/code/task4/Move.toml @@ -0,0 +1,37 @@ +[package] +name = "task4" +edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move +# license = "" # e.g., "MIT", "GPL", "Apache 2.0" +# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"] + +[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] +task4 = "0x0" + +# Named addresses will be accessible in Move as `@name`. They're also exported: +# for example, `std = "0x1"` is exported by the Standard Library. +# alice = "0xA11CE" + +[dev-dependencies] +# The dev-dependencies section allows overriding dependencies for `--test` and +# `--dev` modes. You can introduce test-only dependencies here. +# Local = { local = "../path/to/dev-build" } + +[dev-addresses] +# The dev-addresses section allows overwriting named addresses for the `--test` +# and `--dev` modes. +# alice = "0xB0B" + diff --git a/mover/hai/code/task4/sources/faucetcoin.move b/mover/hai/code/task4/sources/faucetcoin.move new file mode 100644 index 00000000..72863444 --- /dev/null +++ b/mover/hai/code/task4/sources/faucetcoin.move @@ -0,0 +1,37 @@ +module 0x0::faucetcoin{ + use sui::tx_context::{sender}; + use sui::coin::{Self, Coin, TreasuryCap}; + use sui::url::{Self}; + + // === define struct + public struct FAUCETCOIN has drop{} + + #[allow(lint(share_owned))] + fun init (witness: FAUCETCOIN, ctx: &mut TxContext){ + let (treasuryCap, coinMetadata) = coin::create_currency( + witness, + 8, + b"HAI", + b"tranvanhai0504 Coin", + b"coder binh thanh!", + option::some(url::new_unsafe_from_bytes(b"https://aggregator.walrus-testnet.walrus.space/v1/X7KET_iwogbmrgD7ITJE-ZUE6k01TrK8d8AtV4l2FfI")), + ctx + ); + transfer::public_share_object(treasuryCap); + transfer::public_share_object(coinMetadata); + } + + /// create coin and update total supply + public entry fun mint( + cap: &mut TreasuryCap, + value: u64, + receiver: address, + ctx: &mut TxContext){ + let mint_coin = coin::mint( + cap, + value, + ctx, + ); + transfer::public_transfer(mint_coin, receiver); + } +} \ No newline at end of file diff --git a/mover/hai/code/task4/sources/task4.move b/mover/hai/code/task4/sources/task4.move new file mode 100644 index 00000000..7f64970b --- /dev/null +++ b/mover/hai/code/task4/sources/task4.move @@ -0,0 +1,60 @@ +module 0x0::task_4 { + + use sui::balance::{Self, Balance}; + use sui::coin::{Self, Coin}; + use 0x0::faucetcoin::FAUCETCOIN; + use sui::random::{Self, Random, new_generator}; + use std::string::{String, utf8}; + + 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 spli_balance = balance::split(coin::balance_mut(coin), amount); + balance::join( &mut game.balance, spli_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, + random: &Random, + guess: bool, + coin: &mut Coin, + ctx: &mut TxContext + ){ + let mut newRandom = random::new_generator(random, ctx); + let flag = random::generate_bool( &mut newRandom ); + + if(flag == true){ + let reward = coin::take(&mut game.balance, 100000000, ctx); + coin::join(coin, reward); + + } + else{ + deposit(game, coin, 100000000); + } + } + +} \ No newline at end of file diff --git a/mover/hai/code/task4/tests/task4_tests.move b/mover/hai/code/task4/tests/task4_tests.move new file mode 100644 index 00000000..178d33b9 --- /dev/null +++ b/mover/hai/code/task4/tests/task4_tests.move @@ -0,0 +1,18 @@ +/* +#[test_only] +module task4::task4_tests; +// uncomment this line to import the module +// use task4::task4; + +const ENotImplemented: u64 = 0; + +#[test] +fun test_task4() { + // pass +} + +#[test, expected_failure(abort_code = ::task4::task4_tests::ENotImplemented)] +fun test_task4_fail() { + abort ENotImplemented +} +*/ diff --git a/mover/hai/code/task5/.gitignore b/mover/hai/code/task5/.gitignore new file mode 100644 index 00000000..a007feab --- /dev/null +++ b/mover/hai/code/task5/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/mover/hai/code/task5/Move.lock b/mover/hai/code/task5/Move.lock new file mode 100644 index 00000000..8d0924bd --- /dev/null +++ b/mover/hai/code/task5/Move.lock @@ -0,0 +1,44 @@ +# @generated by Move, please check-in and do not edit manually. + +[move] +version = 3 +manifest_digest = "39041E2F606C47BFD088F50F4805457D2C9B8B543AF8432CBD08EED1AF26E4D1" +deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3" +dependencies = [ + { id = "Sui", name = "Sui" }, + { id = "my_another_coin", name = "my_another_coin" }, + { id = "my_coin", name = "my_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 = "my_another_coin" +source = { local = "..\\task2\\my_another_coin" } + +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[[move.package]] +id = "my_coin" +source = { local = "..\\task2\\my_coin" } + +dependencies = [ + { id = "Sui", name = "Sui" }, +] + +[move.toolchain-version] +compiler-version = "1.39.1" +edition = "2024.beta" +flavor = "sui" diff --git a/mover/hai/code/task5/Move.toml b/mover/hai/code/task5/Move.toml new file mode 100644 index 00000000..f7c774e2 --- /dev/null +++ b/mover/hai/code/task5/Move.toml @@ -0,0 +1,30 @@ +[package] +name = "tranvanhai0504" +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" } + +my_coin = { local = "../task2/my_coin" } + +my_another_coin = { local = "../task2/my_another_coin" } + +[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/hai/code/task5/sources/tranvanhai0504.move b/mover/hai/code/task5/sources/tranvanhai0504.move new file mode 100644 index 00000000..c128a235 --- /dev/null +++ b/mover/hai/code/task5/sources/tranvanhai0504.move @@ -0,0 +1,56 @@ +module 0x0::tranvanhai0504 { + + use sui::balance::{Self, Balance}; + use my_coin::my_coin::{MY_COIN}; + use my_another_coin::my_another_coin::{MY_ANOTHER_COIN}; + use sui::coin::{Self, Coin}; + use sui::transfer; + + 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); + } + + entry fun add_money_to_pool(pool: &mut Pool, my_coin: Coin, faucet_coin: Coin) { + pool.my_coin.join(my_coin.into_balance()); + pool.faucet_coin.join(faucet_coin.into_balance()); + } + + public entry fun deposit_my_coin(pool: &mut Pool, user_coin: Coin, ctx: &mut TxContext) { + coin::put(&mut pool.my_coin, user_coin); + } + + public entry fun deposit_faucet_coin(pool: &mut Pool, user_coin: Coin, ctx: &mut TxContext) { + coin::put(&mut pool.faucet_coin, user_coin); + } + + public entry fun swap_my_coin_to_faucet_coin(pool: &mut Pool, my_coin: Coin, ctx: &mut TxContext) { + let amount = my_coin.value(); + assert!(amount > 0, 0); + + pool.my_coin.join(my_coin.into_balance()); + + let output_coin = coin::take(&mut pool.faucet_coin, amount,ctx); + transfer::public_transfer(output_coin, ctx.sender()); + } + + public entry fun swap_faucet_coin_to_my_coin(pool: &mut Pool, faucet_coin: Coin, ctx: &mut TxContext) { + let amount = faucet_coin.value(); + assert!(amount > 0, 0); + + pool.faucet_coin.join(faucet_coin.into_balance()); + + let output_coin = coin::take(&mut pool.my_coin, amount,ctx); + transfer::public_transfer(output_coin, ctx.sender()); + } +} \ No newline at end of file diff --git a/mover/hai/code/task5/tests/task5_tests.move b/mover/hai/code/task5/tests/task5_tests.move new file mode 100644 index 00000000..006cda1f --- /dev/null +++ b/mover/hai/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/hai/images/NFT.png b/mover/hai/images/NFT.png new file mode 100644 index 00000000..f3815eae Binary files /dev/null and b/mover/hai/images/NFT.png differ diff --git a/mover/hai/images/README.md b/mover/hai/images/README.md new file mode 100644 index 00000000..e69de29b diff --git a/mover/hai/images/sui_explorer.png b/mover/hai/images/sui_explorer.png new file mode 100644 index 00000000..da96fe4c Binary files /dev/null and b/mover/hai/images/sui_explorer.png differ diff --git a/mover/hai/images/sui_wallet.png b/mover/hai/images/sui_wallet.png new file mode 100644 index 00000000..08dbe8ea Binary files /dev/null and b/mover/hai/images/sui_wallet.png differ diff --git a/mover/hai/notes/README.md b/mover/hai/notes/README.md new file mode 100644 index 00000000..e69de29b