-
Notifications
You must be signed in to change notification settings - Fork 891
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wuxudan
committed
Nov 21, 2024
1 parent
c39010e
commit 261fbc4
Showing
10 changed files
with
235 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
/// Module: task3 | ||
module task3::task3; | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters