Skip to content

task1-3 #2539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

task1-3 #2539

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mover/cyhzuishuai/code/task1/hellomove/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
34 changes: 34 additions & 0 deletions mover/cyhzuishuai/code/task1/hellomove/Move.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# @generated by Move, please check-in and do not edit manually.

[move]
version = 3
manifest_digest = "11BAF94A33662E7D904523341D85F0402E2C1A82A85216775F5E05EC6ADE9D9C"
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 = "0x7f4b5698f00e6750ceabae25d0e7ff17a9ca18b22c664503685e7b140f58d689"
latest-published-id = "0x7f4b5698f00e6750ceabae25d0e7ff17a9ca18b22c664503685e7b140f58d689"
published-version = "1"
37 changes: 37 additions & 0 deletions mover/cyhzuishuai/code/task1/hellomove/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "hellomove"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move
# license = "" # e.g., "MIT", "GPL", "Apache 2.0"
# authors = ["..."] # e.g., ["Joe Smith ([email protected])", "John Snow ([email protected])"]

[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]
hellomove = "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"

17 changes: 17 additions & 0 deletions mover/cyhzuishuai/code/task1/hellomove/sources/hellomove.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module hellomove::hellomove ;

use std::ascii::{String, string};
use sui::transfer::transfer;

public struct Hello has key {
id: UID,
say: String
}

fun init(ctx: &mut TxContext) {
let hello_move = Hello {
id: object::new(ctx),
say: string(b"cyhzuishuai1"),
};
transfer(hello_move, ctx.sender());
}
18 changes: 18 additions & 0 deletions mover/cyhzuishuai/code/task1/hellomove/tests/hellomove_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module hellomove::hellomove_tests;
// uncomment this line to import the module
// use hellomove::hellomove;

const ENotImplemented: u64 = 0;

#[test]
fun test_hellomove() {
// pass
}

#[test, expected_failure(abort_code = ::hellomove::hellomove_tests::ENotImplemented)]
fun test_hellomove_fail() {
abort ENotImplemented
}
*/
1 change: 1 addition & 0 deletions mover/cyhzuishuai/code/task2/coin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
40 changes: 40 additions & 0 deletions mover/cyhzuishuai/code/task2/coin/Move.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# @generated by Move, please check-in and do not edit manually.

[move]
version = 3
manifest_digest = "759D5BBA961C7BD0C265B42CE2CE995EB9A05D5E4C74EAF83D084518BD03BB0F"
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.47.0"
edition = "2024.beta"
flavor = "sui"

[env]

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0x4eed605122e67f503363f25d6b86625ebdbd76ab1b4ade13e97f9b7bbaeec757"
latest-published-id = "0x4eed605122e67f503363f25d6b86625ebdbd76ab1b4ade13e97f9b7bbaeec757"
published-version = "1"

[env.mainnet]
chain-id = "35834a8a"
original-published-id = "0xd113118ef846c2d85dda904ad01ea0fe33194681fd54ba759020f41dbd121f14"
latest-published-id = "0xd113118ef846c2d85dda904ad01ea0fe33194681fd54ba759020f41dbd121f14"
published-version = "1"
37 changes: 37 additions & 0 deletions mover/cyhzuishuai/code/task2/coin/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "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 ([email protected])", "John Snow ([email protected])"]

[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" }

# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`.
# Revision can be a branch, a tag, and a commit hash.
# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" }

# For local dependencies use `local = path`. Path is relative to the package root
# Local = { local = "../path/to" }

# To resolve a version conflict and force a specific version for dependency
# override use `override = true`
# Override = { local = "../conflicting/version", override = true }

[addresses]
coin = "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"

23 changes: 23 additions & 0 deletions mover/cyhzuishuai/code/task2/coin/sources/btc_cyh.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module coin::btc_cyh;
use sui::coin;
use sui::transfer::public_freeze_object;
use sui::transfer::public_transfer;
use sui::coin::TreasuryCap;
public struct BTC_CYH has drop{

}


fun init(witness:BTC_CYH, ctx: &mut TxContext){
let (treasury, coin_metadata) =
coin::create_currency(witness,6,b"BTC_CYH",b"BTC_CYH",b"this is BTC_CYH",option::none(),ctx);
public_freeze_object(coin_metadata);

public_transfer(treasury, ctx.sender());
}



public entry fun mint(treasury_cap: &mut TreasuryCap<BTC_CYH>, amount: u64, recipient: address, ctx: &mut TxContext){
coin::mint_and_transfer(treasury_cap, amount, recipient, ctx);
}
23 changes: 23 additions & 0 deletions mover/cyhzuishuai/code/task2/coin/sources/btc_cyh_test.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module coin::btc_cyh_test;
use sui::coin;
use sui::transfer::public_freeze_object;
use sui::coin::TreasuryCap;
use sui::transfer::public_share_object;
public struct BTC_CYH_TEST has drop{

}


fun init(witness:BTC_CYH_TEST, ctx: &mut TxContext){
let (treasury, coin_metadata) =
coin::create_currency(witness,6,b"BTC_CYH_TEST",b"BTC_CYH_TEST",b"this is BTC_CYH_TEST",option::none(),ctx);
public_freeze_object(coin_metadata);

public_share_object(treasury);
}



public entry fun mint(treasury_cap: &mut TreasuryCap<BTC_CYH_TEST>, amount: u64, recipient: address, ctx: &mut TxContext){
coin::mint_and_transfer(treasury_cap, amount, recipient, ctx);
}
4 changes: 4 additions & 0 deletions mover/cyhzuishuai/code/task2/coin/sources/call.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sui client call --package 0xd113118ef846c2d85dda904ad01ea0fe33194681fd54ba759020f41dbd121f14 \
--module btc_cyh \
--function mint \
--args 0xf811d98266e1e6ef216765d9f5ab464c6cd0f108d2f1e1108ea4d30e1b0658f2 10000000 0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2 \
4 changes: 4 additions & 0 deletions mover/cyhzuishuai/code/task2/coin/sources/call2.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sui client call --package 0xd113118ef846c2d85dda904ad01ea0fe33194681fd54ba759020f41dbd121f14 \
--module btc_cyh_test \
--function mint \
--args 0x9712448a5befb1afc2147d4aef9d4b4314c8dccef107f86c49c3550a26cd9e91 10000000 0xa7ec687d3e7465a56e91df2f6043ebfd33875d9815f36b6334c4f2b5d8389906 \
18 changes: 18 additions & 0 deletions mover/cyhzuishuai/code/task2/coin/tests/coin_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module coin::coin_tests;
// uncomment this line to import the module
// use coin::coin;

const ENotImplemented: u64 = 0;

#[test]
fun test_coin() {
// pass
}

#[test, expected_failure(abort_code = ::coin::coin_tests::ENotImplemented)]
fun test_coin_fail() {
abort ENotImplemented
}
*/
1 change: 1 addition & 0 deletions mover/cyhzuishuai/code/task3/my_nft/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
40 changes: 40 additions & 0 deletions mover/cyhzuishuai/code/task3/my_nft/Move.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# @generated by Move, please check-in and do not edit manually.

[move]
version = 3
manifest_digest = "4C9B47E7441289AA0D50D87EEB9836BD01CE3604E3B249490E7F2046EAEE3400"
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.47.0"
edition = "2024.beta"
flavor = "sui"

[env]

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0x129846ad2e0ff2f2b5e8ef6f87ca09855a0d2e12840ef96683c4c360f9d48b1c"
latest-published-id = "0x129846ad2e0ff2f2b5e8ef6f87ca09855a0d2e12840ef96683c4c360f9d48b1c"
published-version = "1"

[env.mainnet]
chain-id = "35834a8a"
original-published-id = "0x8095a90b14f23a43618ed863af87ac683ce8b604cc2db118312a0ec34478022b"
latest-published-id = "0x8095a90b14f23a43618ed863af87ac683ce8b604cc2db118312a0ec34478022b"
published-version = "1"
37 changes: 37 additions & 0 deletions mover/cyhzuishuai/code/task3/my_nft/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "my_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 ([email protected])", "John Snow ([email protected])"]

[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_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"

4 changes: 4 additions & 0 deletions mover/cyhzuishuai/code/task3/my_nft/call.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sui client call --package 0x8095a90b14f23a43618ed863af87ac683ce8b604cc2db118312a0ec34478022b \
--module my_nft \
--function mint \
--args 0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2 \
31 changes: 31 additions & 0 deletions mover/cyhzuishuai/code/task3/my_nft/sources/my_nft.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module my_nft::my_nft;
use sui::transfer::transfer;
use sui::tx_context::sender;
use std::string;
use std::string::String;


public struct MyNft has key{
id: UID,
name: String,
image_url: String,
}

fun init(ctx: &mut TxContext){
let my_nft = MyNft{
id:object::new(ctx),
name:string::utf8(b"cyhzuishuai"),
image_url:string::utf8(b"https://github.com/cyhzuishuai/images/blob/main/%E5%A4%B4%E5%83%8F.jpg?raw=true")
};
transfer(my_nft,sender(ctx))
}

public entry fun mint(recipient: address, ctx: &mut TxContext){
let my_nft = MyNft{
id:object::new(ctx),
name:string::utf8(b"cyhzuishuai"),
image_url:string::utf8(b"https://github.com/cyhzuishuai/images/blob/main/%E5%A4%B4%E5%83%8F.jpg?raw=true")
};
transfer(my_nft,recipient);
}

Loading