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 finished #1876

Closed
wants to merge 1 commit into from
Closed
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
Empty file.
40 changes: 40 additions & 0 deletions mover/nextuser/code/task2/coin_faucet/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 = "62BDF732EB260FBE78937D0DA9E2263282DAD9BD9A6008D6B50D8382395D8D22"
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.1"
edition = "2024.beta"
flavor = "sui"

[env]

[env.devnet]
chain-id = "0fc07bbe"
original-published-id = "0x957b7ab911f9c9c404dd8f72480985bded2db8b158d1d7da0f9d9dfb5a137823"
latest-published-id = "0x957b7ab911f9c9c404dd8f72480985bded2db8b158d1d7da0f9d9dfb5a137823"
published-version = "1"

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

28 changes: 28 additions & 0 deletions mover/nextuser/code/task2/coin_faucet/sources/client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
sui client publish --skip-fetch-latest-git-deps --skip-dependency-verification



# devnet
export PKG=0x5004eab7e42fd66ad3b7475632ae3070e9a4015f8f8976009e7e8637592e9d76
export JP_CAP=0xdd789eee513521bcf04ad857aaa549e97017261bb7054fbf865a208a31c17d4b


# SET THE ADDRESS to receive
export W_ADDR=0x7cbe5e6596e23266dd5763dd89b4ab1195516908ecde8febfe96685c7cbe6432
# the current client active-address
export C_ADDR=0x540105a7d2f5f54a812c630f2996f1790ed0e60d1f9a870ce397f03e4cec9b38

# faucet , mint_and_transfer
sui client switch --address $C_ADDR
sui client call --package 0x2 --module coin --function mint_and_transfer --type-args $PKG::jp::JP --args $JP_CAP 8800000 $C_ADDR
sui client balance $C_ADDR



sui client switch --address $W_ADDR
sui client call --package 0x2 --module coin --function mint_and_transfer --type-args $PKG::jp::JP --args $JP_CAP 7700000 $C_ADDR
sui client balance $W_ADDR




26 changes: 26 additions & 0 deletions mover/nextuser/code/task2/coin_faucet/sources/jp.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//use as faucet
module coin_faucet::jp{
use sui::coin;
use sui::url;

const JyqUrl:vector<u8> = b"https://tse4-mm.cn.bing.net/th/id/OIP-C.XVkbV--98d7_YfeLR2a_fAHaHa?rs=1&pid=ImgDetMain";

public struct JP has drop{ }

fun init( otw :JP , ctx : &mut TxContext)
{
let (cap,meta) = coin::create_currency(
otw,
0,
b"YEN",
b"YEN of Japan",
b"Japanese money",
option::some(url::new_unsafe_from_bytes(JyqUrl)),
ctx);

transfer::public_share_object(cap);
transfer::public_freeze_object(meta);
}


}
Loading