-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1922 from zhtkeepup/task2&task3
task2 & task3
- Loading branch information
Showing
17 changed files
with
438 additions
and
106 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 = "0A4652D38CF3C3FDB79EC6C1C98FCFF7B2E933E12B84A1DA267DB28F66AFECE3" | ||
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.devnet] | ||
chain-id = "0fc07bbe" | ||
original-published-id = "0x3d9b75db063ad1b584ac0a67a19923b78214da867bbf9bd80a43df0273509376" | ||
latest-published-id = "0x3d9b75db063ad1b584ac0a67a19923b78214da867bbf9bd80a43df0273509376" | ||
published-version = "1" | ||
|
||
[env.mainnet] | ||
chain-id = "35834a8a" | ||
original-published-id = "0x0b0b06cc47146f8d4f0db905dc1492354169ae416c78d371e14f0d13c8876836" | ||
latest-published-id = "0x0b0b06cc47146f8d4f0db905dc1492354169ae416c78d371e14f0d13c8876836" | ||
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 = "my_coin" | ||
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] | ||
my_coin = "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,7 @@ | ||
sui client call --package 0x2 \ | ||
--module coin \ | ||
--function mint_and_transfer \ | ||
--type-args 0x63b706b16338bc592a5c784a650dbe9c74a4c0572ed6e95f6a9c6b7a76df6dff::my_coin::MY_COIN \ | ||
--args 0xa49accfcbac4a6b9ffb5678d5704ff50219f6462a0068bd449645045030b661e \ | ||
10000000000 \ | ||
0x264742e5020aafcb51f214513f1b7d5ce7eb2d6473c9b47f1343aa89402fa621 |
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,27 @@ | ||
sui client publish | ||
sui client envs; sui client addresses; | ||
sui client switch --address funny-crocidolite | ||
|
||
sui client faucet | ||
|
||
sui client new-address ed25519 | ||
|
||
sui client switch --env devnet | ||
|
||
sui client balance 0x111111111 | ||
|
||
|
||
|
||
/* | ||
c: &mut TreasuryCap<T>, | ||
amount: u64, | ||
recipient: address, | ||
// ctx: &mut TxContext, | ||
*/ | ||
|
||
sui client call --package 0x2 --module coin --function mint_and_transfer --type-args 0x0b0b06cc47146f8d4f0db905dc1492354169ae416c78d371e14f0d13c8876836::my_coin::MY_COIN --args 0x2bb3e8fba75d462bb0081ec46c62107692d2814cf028ec3264129b17d381c69e 10000000000 0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2 --gas-budget 5000000 | ||
|
||
sui client call --package 0x2 --module coin --function mint_and_transfer --type-args 0x0b0b06cc47146f8d4f0db905dc1492354169ae416c78d371e14f0d13c8876836::faucet_coin::FAUCET_COIN --args 0xac408f565c41f605e72824eacb498721669330650f0a5d5558913e1bff7620a5 10000000000 0x264742e5020aafcb51f214513f1b7d5ce7eb2d6473c9b47f1343aa89402fa621 --gas-budget 5000000 | ||
|
||
|
||
|
28 changes: 28 additions & 0 deletions
28
mover/zhtkeepup/code/task2/my_coin/sources/faucet_coin.move
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,28 @@ | ||
|
||
/// Module: my_coin | ||
module my_coin::faucet_coin; | ||
|
||
use std::option::{none, some}; | ||
use sui::coin; | ||
use sui::coin::create_currency; | ||
use sui::transfer::{public_freeze_object, public_transfer, public_share_object}; | ||
use sui::url; | ||
use sui::url::Url; | ||
|
||
public struct FAUCET_COIN has drop { | ||
|
||
} | ||
|
||
fun init(faucet_coin:FAUCET_COIN, ctx: &mut TxContext) { | ||
|
||
let no:Option<Url> = none<Url>(); | ||
let url = url::new_unsafe_from_bytes(b"https://etherscan.io/token/images/centre-usdc_28.png"); | ||
let yes = some<Url>(url); | ||
|
||
let (treasury, coin_metadata) = create_currency(faucet_coin,8,b"FaucetCoin",b"FaucetCoin",b"faucet coin.",no,ctx); | ||
|
||
public_freeze_object(coin_metadata); | ||
|
||
public_share_object(treasury); | ||
// public_transfer(treasury, ctx.sender()); | ||
} |
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,28 @@ | ||
|
||
/// Module: my_coin | ||
module my_coin::my_coin; | ||
|
||
use std::option::{none, some}; | ||
use sui::coin; | ||
use sui::coin::create_currency; | ||
use sui::transfer::{public_freeze_object, public_transfer, public_share_object}; | ||
use sui::url; | ||
use sui::url::Url; | ||
|
||
public struct MY_COIN has drop { | ||
|
||
} | ||
|
||
fun init(my_coin:MY_COIN, ctx: &mut TxContext) { | ||
|
||
let no:Option<Url> = none<Url>(); | ||
let url = url::new_unsafe_from_bytes(b"https://etherscan.io/token/images/centre-usdc_28.png"); | ||
let yes = some<Url>(url); | ||
|
||
let (treasury, coin_metadata) = create_currency(my_coin,8,b"MyCoin",b"MyCoin",b"my coin.",no,ctx); | ||
|
||
public_freeze_object(coin_metadata); | ||
|
||
// public_share_object(treasury); | ||
public_transfer(treasury, ctx.sender()); | ||
} |
18 changes: 18 additions & 0 deletions
18
mover/zhtkeepup/code/task2/my_coin/tests/my_coin_tests.move
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 my_coin::my_coin_tests; | ||
// uncomment this line to import the module | ||
// use my_coin::my_coin; | ||
const ENotImplemented: u64 = 0; | ||
#[test] | ||
fun test_my_coin() { | ||
// pass | ||
} | ||
#[test, expected_failure(abort_code = ::my_coin::my_coin_tests::ENotImplemented)] | ||
fun test_my_coin_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,46 @@ | ||
# @generated by Move, please check-in and do not edit manually. | ||
|
||
[move] | ||
version = 3 | ||
manifest_digest = "4C9B47E7441289AA0D50D87EEB9836BD01CE3604E3B249490E7F2046EAEE3400" | ||
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 = "0x020ede4d61aab752af4f703633b8b4efbf05897b903feb0471cd31ebae70f09b" | ||
latest-published-id = "0x020ede4d61aab752af4f703633b8b4efbf05897b903feb0471cd31ebae70f09b" | ||
published-version = "1" | ||
|
||
[env.devnet] | ||
chain-id = "0fc07bbe" | ||
original-published-id = "0x4fa6978a5bcb02b11030b911caacf183dbb2b611d78debe6b24e4fbb4fd10c26" | ||
latest-published-id = "0x4fa6978a5bcb02b11030b911caacf183dbb2b611d78debe6b24e4fbb4fd10c26" | ||
published-version = "1" | ||
|
||
[env.mainnet] | ||
chain-id = "35834a8a" | ||
original-published-id = "0x76c65ad4cbf1a0fac148ba88e15b2d542b5c151a970601a81f889faa09bc336e" | ||
latest-published-id = "0x76c65ad4cbf1a0fac148ba88e15b2d542b5c151a970601a81f889faa09bc336e" | ||
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 = "my_nft" | ||
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] | ||
my_nft = "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" | ||
|
Oops, something went wrong.