From d0d19693ff89551dccb1ebd29d4c6bb94e8ee28d Mon Sep 17 00:00:00 2001 From: MartinYeung5 <41377418+MartinYeung5@users.noreply.github.com> Date: Fri, 15 Mar 2024 21:00:34 +0800 Subject: [PATCH 1/3] Rename student_no.txt to 100243206.txt --- student_no.txt => 100243206.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename student_no.txt => 100243206.txt (100%) diff --git a/student_no.txt b/100243206.txt similarity index 100% rename from student_no.txt rename to 100243206.txt From 06a5adada43ef4c8d1c15a99c5909005d91ce823 Mon Sep 17 00:00:00 2001 From: MartinYeung5 Date: Sat, 16 Mar 2024 08:42:55 +0800 Subject: [PATCH 2/3] 20240318build1 --- task1/sources/main.move | 4 ++-- task2/sources/main.move | 16 +++++++++------- task3/sources/m1.move | 8 ++++---- task4/sources/main.move | 11 ++++++++--- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/task1/sources/main.move b/task1/sources/main.move index 2507060..5ee0d8f 100644 --- a/task1/sources/main.move +++ b/task1/sources/main.move @@ -5,13 +5,13 @@ module 0x42::Task1 { // TODO // Define a struct called Wallet with a single field called balance of type u64. struct Wallet has drop { - // ... + balance: u64 } // TODO // Define a function called myWallet that returns a Wallet with a balance of 1000. fun myWallet(): Wallet { - // ... + Wallet { balance : 1000} } #[test] diff --git a/task2/sources/main.move b/task2/sources/main.move index d6746d8..35aa25a 100644 --- a/task2/sources/main.move +++ b/task2/sources/main.move @@ -4,14 +4,15 @@ module 0x42::Task2{ // TODO // Define a struct Foo with two fields: u: u64, b: bool with ability to drop - struct Foo { - // ... + struct Foo has drop{ + u: u64, + b: bool } // TODO // Define a function gen_Fool that takes two arguments: u: u64, b: bool and returns a Foo fun gen_Fool(u:u64, b:bool): Foo { - // ... + Foo {u, b} } #[test] @@ -32,14 +33,15 @@ module 0x42::Task2{ // TODO // Define a struct Soo with two fields: x: u64, y: u64 with ability to copy - struct Soo { - // ... + struct Soo has copy{ + x: u64, + y: u64 } // TODO // Define a function gen_Soo that takes two arguments: x: u64, y: u64 and returns a Soo fun gen_Soo(x:u64, y:u64): Soo { - // ... + Soo {x, y} } #[test] @@ -70,7 +72,7 @@ module 0x42::Task2{ // TODO // Define a function gen_Moo that takes an argument: x: u64 and returns a Moo fun gen_Moo(x:u64): Moo { - // ... + Moo {x} } #[test] diff --git a/task3/sources/m1.move b/task3/sources/m1.move index e3542c4..9a3f1cb 100644 --- a/task3/sources/m1.move +++ b/task3/sources/m1.move @@ -1,4 +1,4 @@ -// Tasl3 - module +// Task3 - module // Observe the function permissions called in M1, M2, and M3. // modify the visibility of the functions in M1, and set the M1 module visibility. @@ -6,17 +6,17 @@ module 0x42::M1{ // TODO // Define a module friend M2 - friend ; + friend 0x42::M2; // TODO // Define a function num that returns 66 with choose public or friend visibility - fun num():u64 { + public fun num():u64 { 66 } // TODO // Define a function num2 that returns 88 with choose public or friend visibility - fun num2():u64 { + public fun num2():u64 { 88 } } \ No newline at end of file diff --git a/task4/sources/main.move b/task4/sources/main.move index daa4423..6a2e60d 100644 --- a/task4/sources/main.move +++ b/task4/sources/main.move @@ -12,19 +12,24 @@ module 0x42::Task4 { // TODO // 1. create a deleteable object public fun createDeleteableObject(caller: &signer):ConstructorRef { - // ... + let caller_address = signer::address_of(caller); + let obj = object::create_object(caller_address); + obj } // TODO // 2. create a named object public fun createNamedObject(caller: &signer):ConstructorRef { - // ... + let obj = object::create_named_object(caller, NAME); + obj } // TODO // 3. create a sticky object public fun createStickyObject(caller: &signer):ConstructorRef { - // ... + let caller_address = signer::address_of(caller); + let obj = object::create_sticky_object(caller_address); + obj } #[test(caller = @0x88)] From 82741b3ca28f700ec480ce00c42b33742095f057 Mon Sep 17 00:00:00 2001 From: MartinYeung5 <41377418+MartinYeung5@users.noreply.github.com> Date: Sat, 16 Mar 2024 08:57:54 +0800 Subject: [PATCH 3/3] Update and rename 100243206.txt to student_no.txt --- 100243206.txt => student_no.txt | 1 + 1 file changed, 1 insertion(+) rename 100243206.txt => student_no.txt (83%) diff --git a/100243206.txt b/student_no.txt similarity index 83% rename from 100243206.txt rename to student_no.txt index 2a6816f..a6611ff 100644 --- a/100243206.txt +++ b/student_no.txt @@ -1 +1,2 @@ # Please enter your 9-digit student number below. +100243206