Skip to content
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

完成 task2,task3 #1286

Merged
merged 3 commits into from
Aug 1, 2024
Merged
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
8 changes: 7 additions & 1 deletion mover/0xhutou/code/task3/myfirstnft/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies = [
]

[move.toolchain-version]
compiler-version = "1.25.1"
compiler-version = "1.29.2"
edition = "2024.beta"
flavor = "sui"

Expand All @@ -32,3 +32,9 @@ chain-id = "35834a8a"
original-published-id = "0x700945ac0913a6f8659d0e440857fb74fa0959d9c7003501d8b311f7536978a8"
latest-published-id = "0x700945ac0913a6f8659d0e440857fb74fa0959d9c7003501d8b311f7536978a8"
published-version = "1"

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0x6e30e2e240c97917fd2b7c7ca5a591f2ca79e74fe2e1092b413687ea88adc230"
latest-published-id = "0x6e30e2e240c97917fd2b7c7ca5a591f2ca79e74fe2e1092b413687ea88adc230"
published-version = "1"
7 changes: 0 additions & 7 deletions mover/0xhutou/code/task3/myfirstnft/sources/myfirstnft.move
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ module myfirstnft::myfirstnft {
/// One-Time-Witness for the module.
public struct MYFIRSTNFT has drop {}

/// In the module initializer one claims the `Publisher` object
/// to then create a `Display`. The `Display` is initialized with
/// a set of fields (but can be modified later) and published via
/// the `update_version` call.
///
/// Keys and values are set in the initializer but could also be
/// set after publishing if a `Publisher` object was created.
fun init(otw: MYFIRSTNFT, ctx: &mut TxContext) {
let keys = vector[
utf8(b"name"),
Expand Down
40 changes: 40 additions & 0 deletions mover/1pzq/code/task2/coinfacet/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 = 2
manifest_digest = "CB2C1B89FDD217A7F39235AF8A973C638FE27F14B1F262AF5A61F8DF4F7DBC8D"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
]

[[move.package]]
name = "MoveStdlib"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" }

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

dependencies = [
{ name = "MoveStdlib" },
]

[move.toolchain-version]
compiler-version = "1.27.0"
edition = "2024.beta"
flavor = "sui"

[env]

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

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

36 changes: 36 additions & 0 deletions mover/1pzq/code/task2/coinfacet/sources/coinfacet.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// Module: coinfacet
module coinfacet::coinfacet {

use sui::coin::{Self, TreasuryCap};
use sui::tx_context::TxContext;

public struct COINFACET has drop {}

fun init(witness: COINFACET, ctx: &mut TxContext) {
let (mint_id, metadata) = coin::create_currency(witness, 6, b"COINFACET", b"", b"", std::option::none(), ctx);
transfer::public_freeze_object(metadata);
transfer::public_share_object(mint_id)
}

public entry fun mint(
treasury_cap: &mut TreasuryCap<COINFACET>,
ctx: &mut TxContext,
) {
let coinfacet_coin = coin::mint(treasury_cap, 10000000, ctx);
transfer::public_transfer(coinfacet_coin, tx_context::sender(ctx))
}

}
/*
Package:
0x7840c8e3c523f0a2f4e8795ff7ab8269eeda12be297b54f9ed9ce80aa178bccb


TreasuryCap:
0x8d9061370db68049ef268ac8c9566f15b827a1dfbe19332872db45477af6cb94
ObjectType: 0x2::coin::TreasuryCap<0x7840c8e3c523f0a2f4e8795ff7ab8269eeda12be297b54f9ed9ce80aa178bccb::coinfacet::COINFACET>

CoinMetadata:
0x46e95586f401866658384d5bfa363c49a886d25edcd95376ba7032b0272fbf45
ObjectType: 0x2::coin::CoinMetadata<0x7840c8e3c523f0a2f4e8795ff7ab8269eeda12be297b54f9ed9ce80aa178bccb::coinfacet::COINFACET>
*/
19 changes: 19 additions & 0 deletions mover/1pzq/code/task2/coinfacet/tests/coinfacet_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
#[test_only]
module coinfacet::coinfacet_tests {
// uncomment this line to import the module
// use coinfacet::coinfacet;

const ENotImplemented: u64 = 0;

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

#[test, expected_failure(abort_code = ::coinfacet::coinfacet_tests::ENotImplemented)]
fun test_coinfacet_fail() {
abort ENotImplemented
}
}
*/
40 changes: 40 additions & 0 deletions mover/1pzq/code/task2/my_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 = 2
manifest_digest = "0A4652D38CF3C3FDB79EC6C1C98FCFF7B2E933E12B84A1DA267DB28F66AFECE3"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
]

[[move.package]]
name = "MoveStdlib"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" }

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

dependencies = [
{ name = "MoveStdlib" },
]

[move.toolchain-version]
compiler-version = "1.27.0"
edition = "2024.beta"
flavor = "sui"

[env]

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

[env.mainnet]
chain-id = "35834a8a"
original-published-id = "0xe9f70ff13eefa964cdd63460da595d87048f974d62cb9aa92adcebc57998043b"
latest-published-id = "0xe9f70ff13eefa964cdd63460da595d87048f974d62cb9aa92adcebc57998043b"
published-version = "1"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "task2"
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 ([email protected])", "John Snow ([email protected])"]
Expand All @@ -19,7 +19,7 @@ Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-fram
# Override = { local = "../conflicting/version", override = true }

[addresses]
task2 = "0x0"
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.
Expand Down
40 changes: 40 additions & 0 deletions mover/1pzq/code/task2/my_coin/sources/my_coin.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Module: my_coin
module my_coin::my_coin {
use std::option;
use sui::coin::{Self, Coin, TreasuryCap};
use sui::transfer;
use sui::tx_context::{Self, TxContext};

public struct MY_COIN has drop {}

fun init(witness: MY_COIN, ctx: &mut TxContext) {
let (treasury_cap, metadata) = coin::create_currency<MY_COIN>(
witness,
2,
b"MY",
b"MYCOIN",
b"MY COIN",
option::none(),
ctx
);
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury_cap, tx_context::sender(ctx));

}

public entry fun mint(treasury_cap: &mut TreasuryCap<MY_COIN>, amount: u64, recipient: address, ctx: &mut TxContext){
coin::mint_and_transfer(treasury_cap, amount, recipient, ctx);
}

public entry fun burn(treasury_cap: &mut TreasuryCap<MY_COIN>, coin: Coin<MY_COIN>) {
coin::burn(treasury_cap, coin);
}
}

/*
Package 0xe9f70ff13eefa964cdd63460da595d87048f974d62cb9aa92adcebc57998043b
CoinMetadata 0xb5cbfad7b7b25d6c671b5f449ea5c3e90c743659970291914e1b56d1ff204962
ObjectType: 0x2::coin::CoinMetadata<0xe9f70ff13eefa964cdd63460da595d87048f974d62cb9aa92adcebc57998043b::my_coin::MY_COIN> │
TreasuryCap 0xd6133909f2e796df397d5826ee6c0375ed4e743ee1ba38f7bf26f06f607983fa
ObjectType: 0x2::coin::TreasuryCap<0xe9f70ff13eefa964cdd63460da595d87048f974d62cb9aa92adcebc57998043b::my_coin::MY_COIN> │ │
*/
19 changes: 19 additions & 0 deletions mover/1pzq/code/task2/my_coin/tests/my_coin_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
#[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
}
}
*/
7 changes: 0 additions & 7 deletions mover/1pzq/code/task2/sources/task2.move

This file was deleted.

19 changes: 0 additions & 19 deletions mover/1pzq/code/task2/tests/task2_tests.move

This file was deleted.

40 changes: 40 additions & 0 deletions mover/1pzq/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 = 2
manifest_digest = "9787EC7B3F0B631FD328C6E69F0E6D1B03DD3363C3819C95ACE51411F0B92394"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
]

[[move.package]]
name = "MoveStdlib"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates/sui-framework/packages/move-stdlib" }

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

dependencies = [
{ name = "MoveStdlib" },
]

[move.toolchain-version]
compiler-version = "1.29.2"
edition = "2024.beta"
flavor = "sui"

[env]

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

[env.mainnet]
chain-id = "35834a8a"
original-published-id = "0xae98f7099f2417d0a32e1089d6ea36f138926a62a7eba85f57cda01815a530cf"
latest-published-id = "0xae98f7099f2417d0a32e1089d6ea36f138926a62a7eba85f57cda01815a530cf"
published-version = "1"
38 changes: 38 additions & 0 deletions mover/1pzq/code/task3/my_nft/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[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"
nft_protocol = "0xbdd1811dd6e8feb2c7311d193bbf92cb45d3d6a8fb2b6ec60dc19adf20c18796"

# 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"

Loading