-
Notifications
You must be signed in to change notification settings - Fork 899
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 #1894 from jdf12/main
第二周参与直播&第二周学习_共学营
- Loading branch information
Showing
17 changed files
with
163 additions
and
33 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
18 changes: 0 additions & 18 deletions
18
mover/jdf12/code/task1/hello_move/tests/hello_move_tests.move
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,34 @@ | ||
# @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.1" | ||
edition = "2024.beta" | ||
flavor = "sui" | ||
|
||
[env] | ||
|
||
[env.mainnet] | ||
chain-id = "35834a8a" | ||
original-published-id = "0xc3f979a4dc8fe5c0387ecd06cf5be44df4ddeaa635272b0f1456b3f706960705" | ||
latest-published-id = "0xc3f979a4dc8fe5c0387ecd06cf5be44df4ddeaa635272b0f1456b3f706960705" | ||
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,30 @@ | ||
//包名my_coin 模块名jdf12_coin | ||
module my_coin::jdf12_coin; | ||
use std::option::{Option, none, some}; | ||
use sui::coin::create_currency; | ||
use sui::transfer::{public_freeze_object, public_transfer}; | ||
use sui::url; | ||
use sui::url::Url; | ||
|
||
public struct JDF12_COIN has drop{} | ||
|
||
fun init(jdf12Coin:JDF12_COIN, ctx: &mut TxContext){ | ||
|
||
let no:Option<Url> = none<Url>(); | ||
//为代币设置图片连接 | ||
let url = url::new_unsafe_from_bytes(b"https://img0.baidu.com/it/u=1023821093,4105519612&fm=253&fmt=auto&app=138&f=JPEG?w=359&h=499"); | ||
let yes:Option<Url> = some<Url>(url); | ||
//创建一个代币 | ||
/* | ||
treasuryCap : 货币的铸造权限 | ||
coinMetadata : 代币的元数据信息 | ||
*/ | ||
let (treasuryCap, coinMetadata) = create_currency(jdf12Coin,8,b"jdf12",b"jdf12",b"this is jdf12_coin",yes,ctx); | ||
//冻结对象,该对象不能被修改 | ||
public_freeze_object(coinMetadata); | ||
//转移铸造权限,将铸造权限转移到发送此交易的账户上 | ||
//现在是将铸币的权限发送给我们自己 | ||
public_transfer(treasuryCap,ctx.sender()) | ||
} | ||
|
||
|
29 changes: 29 additions & 0 deletions
29
mover/jdf12/code/task2/my_coin/sources/jdf12_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,29 @@ | ||
module my_coin::jdf12_faucet_coin { | ||
|
||
use std::option::{Option, none, some}; | ||
use sui::coin::create_currency; | ||
use sui::transfer::{public_freeze_object, public_transfer, public_share_object}; | ||
use sui::url; | ||
use sui::url::Url; | ||
|
||
//水龙头coin | ||
public struct JDF12_FAUCET_COIN has drop{} | ||
|
||
fun init(jdf12FaucetCoin:JDF12_FAUCET_COIN, ctx: &mut TxContext){ | ||
|
||
let no:Option<Url> = none<Url>(); | ||
//为代币设置图片连接 | ||
let url = url::new_unsafe_from_bytes(b"https://img0.baidu.com/it/u=1023821093,4105519612&fm=253&fmt=auto&app=138&f=JPEG?w=359&h=499"); | ||
let yes:Option<Url> = some<Url>(url); | ||
//创建一个代币 | ||
/* | ||
treasuryCap : 货币的铸造权限 | ||
coinMetadata : 代币的元数据信息 | ||
*/ | ||
let (treasuryCap, coinMetadata) = create_currency(jdf12FaucetCoin,8,b"jdf12_faucet_coin",b"jdf12_faucet_coin",b"this is jdf12_faucet_coin",yes,ctx); | ||
//冻结对象,该对象不能被修改 | ||
public_freeze_object(coinMetadata); | ||
//转移铸造权限,将铸造权限共享出去,任何人都可以使用 | ||
public_share_object(treasuryCap) | ||
} | ||
} |
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 | ||
} | ||
*/ |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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