Skip to content

Commit

Permalink
task 1 2 3 8
Browse files Browse the repository at this point in the history
  • Loading branch information
byte0713 committed Jul 28, 2024
1 parent 05fa106 commit 216ad28
Show file tree
Hide file tree
Showing 18 changed files with 536 additions and 0 deletions.
Binary file added mover/byte0713/images/sui-scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mover/byte0713/images/sui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mover/byte0713/images/task3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions mover/byte0713/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## 基本信息
- Sui钱包地址: `0xb5f9cdfcb991761e556178798690c81a9d2a6368c09901565f5c1231c7edc35e`
> 首次参与需要完成第一个任务注册好钱包地址才被合并,并且后续学习奖励会打入这个地址
- github: `byte0713`

## 个人简介
- 工作经验: 3年
- 技术栈: 客户端
> 重要提示 请认真写自己的简介
- 前端开发, 目前在学习 move 开发
- 联系方式: `[email protected]`

## 任务

## 01 hello move
- [x] Sui cli version: 1.27.0
- [x] Sui钱包截图: ![Sui钱包截图](./images/sui.png)
- [x] package id: 0xbb6bad3110c1069637ba376225e9a5719082c11427c9b848b3d06a1a1d51c27b
- [x] package id 在 scan上的查看截图:![Scan截图](./images/sui-scan.png)

## 02 move coin
- [x] My Coin package id : 0x284b813a1018218133922021f721717016f660d32a1285389803ac302fe74cef
- [x] Faucet package id : 0x98ac605b268d267fce113e916e7e11f0807908f79f85e709589466f993f3be2d
- [x] 转账 `My Coin` hash: C4MKxoi7oMLdUoNKHk3KfzUF7NH1xdVQsjuZVc6YzRC6
- [x] `Faucet Coin` address1 mint hash: 94ATWsJVzqGowSvUu3pcP1FzkNudHPQvY6nmE2kUs2qo
- [x] `Faucet Coin` address2 mint hash: Cxi8sKKt6ydCtCHSPvxwQRA8VNjStdvDEzCsb7iWh7ca

## 03 move NFT
- [x] nft package id : 0x53464b5dfadab4a7bd0291c5e473c331731dce376166bd23078fff7846055f8f
- [x] nft object id : 0x2185f003b119a8cf8bc7ef0f539b8d418e88eeda4408a4fe6ce43cbcf5efe318
- [x] 转账 nft hash: 7zMG2uytB1WzFZ9dM4wxvHPE7HXR5XjawZFYUkE1Myzx
- [x] scan上的NFT截图: ![Scan截图](./images/task3.png)

## 04 Move Game
- [] game package id :
- [] deposit Coin hash:
- [] withdraw `Coin` hash:
- [] play game hash:

## 05 Move Swap
- [] swap package id :
- [] call swap CoinA-> CoinB hash :
- [] call swap CoinB-> CoinA hash :

## 06 Dapp-kit SDK PTB
- [] save hash :

## 07 Move CTF Check In
- [] CLI call 截图 :
- [] flag hash :

## 08 Move CTF Lets Move
- [x] proof : 78328219
- [x] flag hash : EZBbcfA4avAfXyordFi4heAz59aoQ247XfJTXkJ1K7Qf
34 changes: 34 additions & 0 deletions mover/byte0713/task1/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 = "E03D8CCB139FD5AAA6C3DF53281A5C2A7267CEEDE876153DF254B492715959CB"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
]

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

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

dependencies = [
{ name = "MoveStdlib" },
]

[move.toolchain-version]
compiler-version = "1.27.0"
edition = "2024.beta"
flavor = "sui"

[env]

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0xbb6bad3110c1069637ba376225e9a5719082c11427c9b848b3d06a1a1d51c27b"
latest-published-id = "0xbb6bad3110c1069637ba376225e9a5719082c11427c9b848b3d06a1a1d51c27b"
published-version = "1"
39 changes: 39 additions & 0 deletions mover/byte0713/task1/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "hello_move"
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]
hello_move = "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"
##


19 changes: 19 additions & 0 deletions mover/byte0713/task1/sources/hello_move.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module hello_move::hello {
use std::ascii::{String, string};
use sui::object::{Self,UID};
use sui::transfer::transfer;
use sui::tx_context::{TxContext, sender};

public struct Hello has key{
id:UID,
say: String
}

fun init(ctx: &mut TxContext) {
let hello_move = Hello {
id:object::new(ctx),
say: string(b"byte0713"),
};
transfer(hello_move, sender(ctx));
}
}
17 changes: 17 additions & 0 deletions mover/byte0713/task1/tests/hello_move_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// #[test_only]
// module hello_move::hello_move_tests {
// // uncomment this line to import the module
// // use hello_move::hello_move;
//
// const ENotImplemented: u64 = 0;
//
// #[test]
// fun test_hello_move() {
// hello_move::hello_move::hello_move();
// }
//
// #[test, expected_failure(abort_code = ::hello_move::hello_move_tests::ENotImplemented)]
// fun test_hello_move_fail() {
// abort ENotImplemented
// }
// }
34 changes: 34 additions & 0 deletions mover/byte0713/task2/byte0713_coin/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 = "D0E55254A90D79130115C9CF54E7E42FD4405C9F3BF4704F5AD9DE7391D071B3"
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.27.0"
edition = "2024.beta"
flavor = "sui"

[env]

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

32 changes: 32 additions & 0 deletions mover/byte0713/task2/byte0713_coin/sources/byte0713_coin.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

/// Module: a_0713_coin
module a_0713_coin::a_0713_coin {
use sui::coin::{Self, Coin, TreasuryCap};
public struct A_0713_COIN has drop {}
fun init(witness: A_0713_COIN, ctx: &mut TxContext) {
let (treasury, metadata) = coin::create_currency(
witness,
6, // 6 decimal places
b"a_0713 coin", // symbol
b"a_0713 coin", // name
b"Awesome Coint", // description
option:: none(), // icon
ctx
);
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury, tx_context::sender(ctx));
}

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

public entry fun burn(treasury_cap: &mut TreasuryCap<A_0713_COIN>, coin: Coin<A_0713_COIN>) {
coin::burn(treasury_cap, coin);
}
}

34 changes: 34 additions & 0 deletions mover/byte0713/task2/byte0713_faucet/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 = "781D10BAC6910E826D6C18E1B5C381E8183574D53B2889831037BB0B2AB0CA56"
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.27.0"
edition = "2024.beta"
flavor = "sui"

[env]

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

48 changes: 48 additions & 0 deletions mover/byte0713/task2/byte0713_faucet/sources/byte0713_faucet.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/// Module: a_0713_faucet
module a_0713_faucet::a_0713_faucet {
use sui::balance::{Balance};
use sui::balance;
use sui::coin::{Self, TreasuryCap};
public struct A_0713_FAUCET has drop {}
public struct PublicWallet has key {
id: UID,
coin: Balance<A_0713_FAUCET>,
faucet_amount: u64,
}
const AMOUNT: u64 = 10^12;
const EFaucetDry: u64 = 1;
#[allow(lint(share_owned))]
fun init(witness: A_0713_FAUCET, ctx: &mut TxContext) {
let (treasury_cap, metadata) = coin::create_currency<A_0713_FAUCET>(
witness,
10,
b"A_0713 Faucet",
b"A_0713 Faucet",
b"Meme Coin",
option::none(),
ctx);
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury_cap, tx_context::sender(ctx));
let wallet = PublicWallet {
id: object::new(ctx),
coin: balance::zero(),
faucet_amount: AMOUNT,
};
transfer::share_object(wallet);
}
public entry fun mint_faucet(
treasury_cap: &mut TreasuryCap<A_0713_FAUCET>,
amount: u64,
wallet: &mut PublicWallet,
ctx: &mut TxContext) {
let coins = coin::mint(treasury_cap, amount, ctx);
balance::join(&mut wallet.coin, coin::into_balance(coins));
}
public entry fun get_faucet(wallet: &mut PublicWallet, ctx: &mut TxContext) {
let balance_amount = balance::value(&wallet.coin);
assert!(balance_amount >= wallet.faucet_amount, EFaucetDry);
let mint_balance = balance::split(&mut wallet.coin, wallet.faucet_amount);
let faucet_coin = coin::from_balance(mint_balance, ctx);
transfer::public_transfer(faucet_coin, tx_context::sender(ctx));
}
}
Loading

0 comments on commit 216ad28

Please sign in to comment.