Skip to content

Commit

Permalink
Merge pull request #2165 from potato89757/main
Browse files Browse the repository at this point in the history
task2-6
  • Loading branch information
Sifotd authored Dec 13, 2024
2 parents f89876c + 8540457 commit fe100d3
Show file tree
Hide file tree
Showing 26 changed files with 980 additions and 18 deletions.
40 changes: 40 additions & 0 deletions mover/potato89757/code/Task2/generate_coin/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 = "A236805D79A413A3B07C3DCC6F251FE22E504BD8453FE8F1D79388B523090A81"
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.testnet]
chain-id = "4c78adac"
original-published-id = "0x3bc8c90965d6ecf939dbe3e8e0e6a24d5d536baf0aa5695df666a88d9d8f1a68"
latest-published-id = "0x3bc8c90965d6ecf939dbe3e8e0e6a24d5d536baf0aa5695df666a88d9d8f1a68"
published-version = "1"

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module generate_coin::faucet_coin;
use sui::coin::{Self, TreasuryCap};
use sui::tx_context::TxContext;
use sui::transfer::public_freeze_object;

public struct FAUCET_COIN has drop{}

public struct TreasuryCapHolder has key, store{
id:UID,
treasury_cap: TreasuryCap<FAUCET_COIN>,
}

fun init(otw:FAUCET_COIN, ctx: &mut TxContext){
let (treasury_cap, metadata) = coin::create_currency(
otw,
4,
b"potato89757_faucet",
b"fanshuF",
b"potato is fanshu yeah :3",
option::none(),
ctx,
);
public_freeze_object(metadata);

let treasury_cap_holder = TreasuryCapHolder{
id: object::new(ctx),
treasury_cap
};
transfer::share_object(treasury_cap_holder)
}

public entry fun mint(treasury: &mut TreasuryCapHolder, ctx: &mut TxContext){
let sender= tx_context::sender(ctx);
let treasury_cap= &mut treasury.treasury_cap;
let coin= coin::mint(treasury_cap,10, ctx);//mint coin
transfer::public_transfer(coin, sender);//transfer to specific add
}

41 changes: 41 additions & 0 deletions mover/potato89757/code/Task2/generate_coin/sources/my_coin.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module generate_coin::my_coin;
use sui::coin::{Self, TreasuryCap};
use sui::transfer;
use sui::tx_context::TxContext;

public struct MY_COIN has drop{}

public struct TreasuryCapHolder has key, store{
id:UID,
treasury_cap: TreasuryCap<MY_COIN>,
}

const Minter:address=@0x7b8e0864967427679b4e129f79dc332a885c6087ec9e187b53451a9006ee15f2;

fun init(otw:MY_COIN, ctx: &mut TxContext){
let(treasury_cap, metadata)=coin::create_currency(
otw,
4,
b"potato89757",
b"fanshu",
b"potato is fanshu",
option::none(),
ctx
);

sui::transfer::public_freeze_object(metadata);

let treasury_cap_holder = TreasuryCapHolder{
id: object::new(ctx),
treasury_cap,
};
transfer::public_transfer(treasury_cap_holder,tx_context::sender(ctx));
}

public entry fun mint(treasury: &mut TreasuryCapHolder, minter:address, amount:u64, ctx: &mut TxContext){
assert!(minter==Minter,0);
let treasury_cap=&mut treasury.treasury_cap;
let coin=coin::mint(treasury_cap,amount, ctx);//mint coin
transfer::public_transfer(coin, minter);//transfer to specific add

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module generate_coin::generate_coin_tests;
// uncomment this line to import the module
// use generate_coin::generate_coin;
const ENotImplemented: u64 = 0;
#[test]
fun test_generate_coin() {
// pass
}
#[test, expected_failure(abort_code = ::generate_coin::generate_coin_tests::ENotImplemented)]
fun test_generate_coin_fail() {
abort ENotImplemented
}
*/
34 changes: 34 additions & 0 deletions mover/potato89757/code/Task3/generate_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 = "DC3595091D0FF8B4EA079E2AC5459C03D25A297D44F2480119C7700E4FB53CA0"
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 = "0x32edf9ead5ff17e4b179d54faa7982c786773178d387df94741784b29cad11be"
latest-published-id = "0x32edf9ead5ff17e4b179d54faa7982c786773178d387df94741784b29cad11be"
published-version = "1"
37 changes: 37 additions & 0 deletions mover/potato89757/code/Task3/generate_NFT/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "generate_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]
generate_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"

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module generate_nft::nft{
use std::string::{utf8, String};
use sui::package;
use sui::display;
use sui::transfer;

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

public struct NFT has drop{}

fun init(otw: 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"http://sui-heroes.io/hero/{id}"),
utf8(b"https://pbs.twimg.com/profile_images/1815418689585614848/dJsNrfvE_400x400.jpg"),
utf8(b"Dr.Blossom exploring Move Ecosystem"),
utf8(b"http://docs.sui.io/standards/display"),
utf8(b"potato89757"),

];

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

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

display.update_version();

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

}

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

transfer::public_transfer(nft, minter);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module generate_nft::generate_nft_tests;
// uncomment this line to import the module
// use generate_nft::generate_nft;
const ENotImplemented: u64 = 0;
#[test]
fun test_generate_nft() {
// pass
}
#[test, expected_failure(abort_code = ::generate_nft::generate_nft_tests::ENotImplemented)]
fun test_generate_nft_fail() {
abort ENotImplemented
}
*/
34 changes: 34 additions & 0 deletions mover/potato89757/code/Task4/game/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 = "09E96EFF150B65B8C2F33F9094E1DCF127B543DB3BF332FE094BF07CD9DAE41E"
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.testnet]
chain-id = "4c78adac"
original-published-id = "0x2d658a1ac3f9a1169db857201d9428485e2c4c2f7cfa03c0d6def7404348b4e4"
latest-published-id = "0x2d658a1ac3f9a1169db857201d9428485e2c4c2f7cfa03c0d6def7404348b4e4"
published-version = "1"
Loading

0 comments on commit fe100d3

Please sign in to comment.