Skip to content

Commit

Permalink
finish task2
Browse files Browse the repository at this point in the history
  • Loading branch information
wasd845 committed Aug 28, 2024
1 parent 82d39f8 commit 78af5f1
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 3 deletions.
34 changes: 34 additions & 0 deletions mover/wasd845/code/task2/faucetcoin/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 = 2
manifest_digest = "36AAF1CDEC036D88764BAC3DCDE58C0D7D361D80DBC1ED0F543FFC7DC8AA1BA6"
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.32.0"
edition = "2024.beta"
flavor = "sui"

[env]

[env.devnet]
chain-id = "814c79df"
original-published-id = "0xfc9584dfc35c87a09fc6ae75ed5f27c1c82da4aac2972e4906ae622fe2bc00c4"
latest-published-id = "0xfc9584dfc35c87a09fc6ae75ed5f27c1c82da4aac2972e4906ae622fe2bc00c4"
published-version = "1"
37 changes: 37 additions & 0 deletions mover/wasd845/code/task2/faucetcoin/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "faucetcoin"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move
# license = "" # e.g., "MIT", "GPL", "Apache 2.0"
# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"]

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

18 changes: 18 additions & 0 deletions mover/wasd845/code/task2/faucetcoin/sources/faucetcoin.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

/// Module: faucetcoin
module faucetcoin::faucetcoin {
use sui::coin::{Self, TreasuryCap};

public struct FAUCETCOIN has drop {}

fun init(waitness: FAUCETCOIN, ctx: &mut sui::tx_context::TxContext) {
let (treasury_cap, meta) = coin::create_currency(waitness, 8, b"WFCC", b"wasd845Faucet", b"wasd845Faucet Coin on task02", option::none(), ctx);
transfer::public_freeze_object(meta);
transfer::public_transfer(treasury_cap, tx_context::sender(ctx));
}

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

19 changes: 19 additions & 0 deletions mover/wasd845/code/task2/faucetcoin/tests/faucetcoin_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
#[test_only]
module faucetcoin::faucetcoin_tests {
// uncomment this line to import the module
// use faucetcoin::faucetcoin;
const ENotImplemented: u64 = 0;
#[test]
fun test_faucetcoin() {
// pass
}
#[test, expected_failure(abort_code = ::faucetcoin::faucetcoin_tests::ENotImplemented)]
fun test_faucetcoin_fail() {
abort ENotImplemented
}
}
*/
6 changes: 3 additions & 3 deletions mover/wasd845/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

## 02 move coin
- [x] My Coin package id : 0xd0388f5ee65f00e17f100d52dc3897a57a90745c7b6bdcf8761593562ae0f8ea
- [] Faucet package id :
- [x] Faucet package id : 0xfc9584dfc35c87a09fc6ae75ed5f27c1c82da4aac2972e4906ae622fe2bc00c4
- [x] 转账 `My Coin` hash: 58nSvLLjfdFqNfAQrmCpQimnKR54TY3S5Wxc5kaBevTw
- [] `Faucet Coin` address1 mint hash:
- [] `Faucet Coin` address2 mint hash:
- [x] `Faucet Coin` address1 mint hash: 632KiUGabmVNAED6e3hzZ6R7XDinN2tuDRsfhRisxJU3
- [x] `Faucet Coin` address2 mint hash: Ec7eT6zw9Ms7btpSzQa7S4x8Y8Kj6Lkey7xYgQKhNCZc

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

0 comments on commit 78af5f1

Please sign in to comment.