Skip to content

Commit

Permalink
complete task2
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxudan committed Nov 21, 2024
1 parent c39010e commit 261fbc4
Show file tree
Hide file tree
Showing 10 changed files with 235 additions and 5 deletions.
1 change: 1 addition & 0 deletions mover/Aydenchange/code/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sui client call --package 0x2 --module coin --function mint_and_transfer --type-args 0x4a63c9ccdd5488637d6d1e6be17efbbd0de8e191fe8cc8eb06a3abff0daf2d6f::aydenchange_faucet::AYDENCHANGE_FAUCET --args 0x4adedd29b8357af46cb8028866b2d8398528917596ffb9635b68baf56daca14e 100000000 0x63cff068a582222a2d6f0391158a2d64cd652134b6e6bf442ed61ba487189dae
40 changes: 40 additions & 0 deletions mover/Aydenchange/code/task2/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 = "E7A65BF39B740E195045E87B46B06936199C063AFE29D8948B9C6B9B853033A8"
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.37.4"
edition = "2024.beta"
flavor = "sui"

[env]

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

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

42 changes: 42 additions & 0 deletions mover/Aydenchange/code/task2/sources/coin.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module task2::aydenchange_coin;

use std::option;
use sui::coin;
use sui::coin::{TreasuryCap, Coin};
use sui::transfer;
use sui::tx_context::{TxContext};

public struct AYDENCHANGE_COIN has drop {}

fun init(witness: AYDENCHANGE_COIN, ctx: &mut TxContext) {
let (treasury,
metadata) =
coin::create_currency(
witness,
6,
b"AYDENCHANGE_COIN",
b"AYDENCHANGE_COIN",
b"this is aydenchange_coin",
option::none(),
ctx);
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury, ctx.sender());
}

public entry fun mint(
treasury_cap: &mut TreasuryCap<AYDENCHANGE_COIN>,
amount: u64,
recipient: address,
ctx: &mut TxContext,
) {
let coin = coin::mint(treasury_cap, amount, ctx);
transfer::public_transfer(coin, recipient)
}

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

33 changes: 33 additions & 0 deletions mover/Aydenchange/code/task2/sources/faucet.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module task2::aydenchange_faucet;

use sui::coin::{Self,TreasuryCap, Coin};

public struct AYDENCHANGE_FAUCET has drop {}

fun init(witness: AYDENCHANGE_FAUCET, ctx: &mut TxContext) {
let (treasury, metadata) = coin::create_currency<AYDENCHANGE_FAUCET>(
witness,
6,
b"AYDENCHANGE_FAUCET",
b"AYDENCHANGE_FAUCET",
b"this is aydenchangefaucet",
option::none(),
ctx);
transfer::public_freeze_object(metadata);
transfer::public_share_object(treasury)
}
public entry fun mint(
treasury: &mut TreasuryCap<AYDENCHANGE_FAUCET>,
amount: u64,
recipient: address,
ctx: &mut TxContext
) {
coin::mint_and_transfer(treasury, amount, recipient, ctx);
}
public entry fun burn(
treasury: &mut TreasuryCap<AYDENCHANGE_FAUCET>,
coin: Coin<AYDENCHANGE_FAUCET>
) {
coin::burn(treasury, coin);
}

18 changes: 18 additions & 0 deletions mover/Aydenchange/code/task2/tests/task2_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module task2::task2_tests;
// uncomment this line to import the module
// use task2::task2;
const ENotImplemented: u64 = 0;
#[test]
fun test_task2() {
// pass
}
#[test, expected_failure(abort_code = ::task2::task2_tests::ENotImplemented)]
fun test_task2_fail() {
abort ENotImplemented
}
*/
37 changes: 37 additions & 0 deletions mover/Aydenchange/code/task3/Move.toml
Original file line number Diff line number Diff line change
@@ -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 ([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]
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"

4 changes: 4 additions & 0 deletions mover/Aydenchange/code/task3/sources/task3.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
/// Module: task3
module task3::task3;
*/
18 changes: 18 additions & 0 deletions mover/Aydenchange/code/task3/tests/task3_tests.move
Original file line number Diff line number Diff line change
@@ -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
}
*/
10 changes: 5 additions & 5 deletions mover/Aydenchange/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
- [] package id 在 scan上的查看截图:![Scan截图](./images/img_1.png)

## 02 move coin
- [] My Coin package id :
- [] Faucet package id :
- [] 转账 `My Coin` hash:
- [] `Faucet Coin` address1 mint hash:
- [] `Faucet Coin` address2 mint hash:
- [] My Coin package id : 0x4a63c9ccdd5488637d6d1e6be17efbbd0de8e191fe8cc8eb06a3abff0daf2d6f
- [] Faucet package id : 0x4a63c9ccdd5488637d6d1e6be17efbbd0de8e191fe8cc8eb06a3abff0daf2d6f
- [] 转账 `My Coin` hash: G8Dv6xEZeuD7jyMW25gsQ7doVnAmkNsEzt2vmcMkBzsF
- [] `Faucet Coin` address1 mint hash: AzQbHtEyRhQZ6bDgxuW6joBhEAFUDkMcfqBKaniUKEjS
- [] `Faucet Coin` address2 mint hash: 6jxt8izbdZHws7cL5Y6ESBT2kJeLXeqWAmT9F5LMyziT

## 03 move NFT
- [] nft package id :
Expand Down

0 comments on commit 261fbc4

Please sign in to comment.