Skip to content

Commit

Permalink
Merge pull request #1953 from huahuahua1223/main
Browse files Browse the repository at this point in the history
task3完成和共学营更新
  • Loading branch information
Sifotd authored Nov 20, 2024
2 parents 6c72236 + f086581 commit 3a171bd
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions mover/huahuahua1223/co-learn-2411/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

- [x] 第一周:![学习记录截图](./images/第一周学习记录.png)
- [x] 第二周:![学习记录截图](./images/第二周学习记录.png)
- [] 第三周:![学习记录截图](./images/你的图片地址)
- [x] 第三周:![学习记录截图](./images/第三周学习记录.png)
- [] 第四周:![学习记录截图](./images/你的图片地址)

## 参加直播答疑
Expand All @@ -27,13 +27,13 @@
- [x] 第一篇笔记
- [x] 第二篇笔记
- [x] 第三篇笔记
- [] 第四篇笔记
- [x] 第四篇笔记

## 对外输出学习笔记

- [x] 第一篇笔记【[学习笔记链接](https://blog.csdn.net/Huahua_1223/article/details/143750762)
- [x] 第二篇笔记【[学习笔记链接](https://hua1223.blog.csdn.net/article/details/143866005)
- [] 第三篇笔记【学习笔记链接】
- [x] 第三篇笔记【[学习笔记链接](https://hua1223.blog.csdn.net/article/details/143895408)
- [] 第四篇笔记【学习笔记链接】

## 在HOH社区公众号发布自己的技术文章
Expand Down
34 changes: 34 additions & 0 deletions mover/huahuahua1223/code/task3/my_nft/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 = "1C7E4E6784885553F41F77ACBDC5306913E332B17CDD69A828BE8590288858D2"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ id = "Sui", name = "Sui" },
]

[[move.package]]
id = "MoveStdlib"
source = { git = "https://gitee.com/MystenLabs/sui.git", rev = "framework/testnet", subdir = "crates\\sui-framework\\packages\\move-stdlib" }

[[move.package]]
id = "Sui"
source = { git = "https://gitee.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.35.2"
edition = "2024.beta"
flavor = "sui"

[env]

[env.mainnet]
chain-id = "35834a8a"
original-published-id = "0x2f7822ab2a65f1a15dfbe475e24ff39cc13f1bd7b824265d697e4aeab3998258"
latest-published-id = "0x2f7822ab2a65f1a15dfbe475e24ff39cc13f1bd7b824265d697e4aeab3998258"
published-version = "1"
37 changes: 37 additions & 0 deletions mover/huahuahua1223/code/task3/my_nft/Move.toml
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://gitee.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"

62 changes: 62 additions & 0 deletions mover/huahuahua1223/code/task3/my_nft/sources/display_nft.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module my_nft::display_nft{
use std::string;
use std::string::{utf8, String};
use sui::tx_context::{sender};
use sui::package;
use sui::display;

public struct MyNFT has key, store {
id: UID,
name: String,
image_url: String,
}

public struct DISPLAY_NFT has drop {}

fun init(otw: DISPLAY_NFT, ctx: &mut TxContext) {
let keys = vector[
utf8(b"name"),
utf8(b"link"),
utf8(b"image_url"),
utf8(b"description"),
utf8(b"project_url"),
utf8(b"creator"),
];

let values = vector[
utf8(b"{name}"),
utf8(b"https://sui-heroes.io/hero/{id}"),
utf8(b"{image_url}"),
utf8(b"A true Hero of the Sui ecosystem!"),
utf8(b"https://sui-heroes.io"),
utf8(b"Unknown Sui Fan")
];

let publisher = package::claim(otw, ctx);

let mut display = display::new_with_fields<MyNFT>(
&publisher, keys, values, ctx
);

display::update_version(&mut display);

transfer::public_transfer(publisher, sender(ctx));
transfer::public_transfer(display, sender(ctx));

let nft = MyNFT {
id: object::new(ctx),
name: string::utf8(b"huahuahua1223 display nft"),
image_url: string::utf8(b"https://avatars.githubusercontent.com/u/138219491"),
};

transfer::public_transfer(nft, sender(ctx));
}


public entry fun mint(name: String, image_url: String, ctx: &mut TxContext) {
let id = object::new(ctx);
let nft = MyNFT { id, name, image_url };
transfer::public_transfer(nft, sender(ctx));
}
}

18 changes: 18 additions & 0 deletions mover/huahuahua1223/code/task3/my_nft/tests/my_nft_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module my_nft::my_nft_tests;
// uncomment this line to import the module
// use my_nft::my_nft;
const ENotImplemented: u64 = 0;
#[test]
fun test_my_nft() {
// pass
}
#[test, expected_failure(abort_code = ::my_nft::my_nft_tests::ENotImplemented)]
fun test_my_nft_fail() {
abort ENotImplemented
}
*/
Binary file added mover/huahuahua1223/images/NFT截图.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions mover/huahuahua1223/notes/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,18 @@ sui client call --package 0x2 --module coin --function mint_and_transfer --type-
sui client call --package 0x2 --module coin --function mint_and_transfer --type-args 0x4e393fad36baba534f8cbfa9852665c49a69be64cf5b82576f267007e187d036::huahuahua1223_faucet_coin::HUAHUAHUA1223_FAUCET_COIN --args 0x0b1d96bcc48a001596fd1b8a98c9166f8653aee9888a12d221e807c0f5be0009 10000000000 0xfcaab3c6b0758f32b8e6782a23ab10a59ff0884a0785cd3d8ee391ccf96ca50a

sui client call --package 0x2 --module coin --function mint_and_transfer --type-args 0x4e393fad36baba534f8cbfa9852665c49a69be64cf5b82576f267007e187d036::huahuahua1223_faucet_coin::HUAHUAHUA1223_FAUCET_COIN --args 0x0b1d96bcc48a001596fd1b8a98c9166f8653aee9888a12d221e807c0f5be0009 10000000000 0xba05e5ff69321ed26d686dc08ecb9df43113139f6483893740b35a8361c6c4a7
```


# task3
## 1. 创建项目
sui move new my_nft
cd .\my_nft\
sui move build

[nft对象标准](https://docs.sui.io/standards/display)

部署合约
```bash
sui client publish --skip-dependency-verification
```
8 changes: 4 additions & 4 deletions mover/huahuahua1223/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
- [x] `Faucet Coin` address2 mint hash:`825rrdSMnRQwKB6ebNvVjhzYPhE4Wk3LVPwWt7STxJGc`

## 03 move NFT
- [] nft package id :
- [] nft object id :
- [] 转账 nft hash:
- [] scan上的NFT截图:![Scan截图](./images/你的图片地址)
- [x] nft package id :`0x2f7822ab2a65f1a15dfbe475e24ff39cc13f1bd7b824265d697e4aeab3998258`
- [x] nft object id : `0xac19559587d38820e6b88089dc5cb22abe9296c2f0d10e7bcdd778733bb36103`
- [x] 转账 nft hash:`H9s6UewebGgA2QVZsKutfZh72vFDHfuBUv7hnWw4qpZg`
- [x] scan上的NFT截图:![Scan截图](./images/NFT截图.png)

## 04 Move Game
- [] game package id :
Expand Down

0 comments on commit 3a171bd

Please sign in to comment.