Skip to content

Commit

Permalink
task2
Browse files Browse the repository at this point in the history
  • Loading branch information
ytbiu committed Nov 18, 2024
1 parent 5dd3b7b commit 3d54c50
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 0 deletions.
34 changes: 34 additions & 0 deletions mover/ytbiu/code/task2/mycoin/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 = "1393B3A86BC22B7FE61E23DBB2EF7BE1A330BF07AB402600F7E7CFF6E9DC82F9"
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.3"
edition = "2024.beta"
flavor = "sui"

[env]

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

19 changes: 19 additions & 0 deletions mover/ytbiu/code/task2/mycoin/sources/faucet.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
/// Module: mycoin
module mycoin::mycoin;
*/
module mycoin::faucet {
use sui::coin::{Self,TreasuryCap};

public struct FAUCET has drop{}

fun init(witness: FAUCET,ctx: &mut TxContext) {
let (treasury, metadata) = coin::create_currency(witness, 6, b"MYC", b"ytbiu my coin", b"ytbiu my coin", option::none(), ctx);
transfer::public_freeze_object(metadata);
transfer::public_share_object(treasury);
}

public entry fun mint(cap : &mut TreasuryCap<FAUCET>, amount: u64, to: address, ctx: &mut TxContext){
coin::mint_and_transfer(cap, amount,to,ctx);
}
}
20 changes: 20 additions & 0 deletions mover/ytbiu/code/task2/mycoin/sources/mycoin.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
/// Module: mycoin
module mycoin::mycoin;
*/
module mycoin::mycoin {
use sui::coin::{Self,TreasuryCap};

public struct MYCOIN has drop{}

fun init(witness: MYCOIN,ctx: &mut TxContext) {
let (treasury, metadata) = coin::create_currency(witness, 6, b"MYC", b"ytbiu my coin", b"ytbiu my coin", option::none(), ctx);
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury,tx_context::sender(ctx));
}

public entry fun mint(cap : &mut TreasuryCap<MYCOIN>, amount: u64, to: address, ctx: &mut TxContext){
let minted_coint = coin::mint(cap, amount,ctx);
transfer::public_transfer(minted_coint, to);
}
}
18 changes: 18 additions & 0 deletions mover/ytbiu/code/task2/mycoin/tests/mycoin_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module mycoin::mycoin_tests;
// uncomment this line to import the module
// use mycoin::mycoin;
const ENotImplemented: u64 = 0;
#[test]
fun test_mycoin() {
// pass
}
#[test, expected_failure(abort_code = ::mycoin::mycoin_tests::ENotImplemented)]
fun test_mycoin_fail() {
abort ENotImplemented
}
*/

0 comments on commit 3d54c50

Please sign in to comment.