From c32e7e59001c96625f701b3232c9b2f65a6da20b Mon Sep 17 00:00:00 2001 From: xinyouyuerlibuzu <146720603+xinyouyuerlibuzu@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:54:47 +0800 Subject: [PATCH 1/6] Update student_no.txt --- student_no.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/student_no.txt b/student_no.txt index 2a6816f..2ba2d42 100644 --- a/student_no.txt +++ b/student_no.txt @@ -1 +1,2 @@ # Please enter your 9-digit student number below. +100243383 From 859828c27285b18155cb0834bde5358c74b5f793 Mon Sep 17 00:00:00 2001 From: xinyouyuerlibuzu <146720603+xinyouyuerlibuzu@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:55:49 +0800 Subject: [PATCH 2/6] Update main.move --- task1/sources/main.move | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/task1/sources/main.move b/task1/sources/main.move index 2507060..af01bd6 100644 --- a/task1/sources/main.move +++ b/task1/sources/main.move @@ -5,13 +5,15 @@ 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] @@ -19,4 +21,4 @@ module 0x42::Task1 { let wallet = myWallet(); assert!(wallet.balance == 1000, 0); } -} \ No newline at end of file +} From 1a40570896b0f17bc7d2bb0bd7feb94c4071f0bf Mon Sep 17 00:00:00 2001 From: xinyouyuerlibuzu <146720603+xinyouyuerlibuzu@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:56:38 +0800 Subject: [PATCH 3/6] Update main.move --- task2/sources/main.move | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/task2/sources/main.move b/task2/sources/main.move index d6746d8..fed281f 100644 --- a/task2/sources/main.move +++ b/task2/sources/main.move @@ -4,14 +4,18 @@ 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 { - // ... + return Foo{ + u, + b + } } #[test] @@ -32,14 +36,18 @@ 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 { - // ... + return Soo{ + x, + y + } } #[test] @@ -70,7 +78,9 @@ 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] @@ -80,4 +90,4 @@ module 0x42::Task2{ assert!(k.s.x == 42,0); let Koo { s: Moo { x: _ } } = k; } -} \ No newline at end of file +} From d006f512134327e3d8cce30ea4d534331494ae43 Mon Sep 17 00:00:00 2001 From: xinyouyuerlibuzu <146720603+xinyouyuerlibuzu@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:57:54 +0800 Subject: [PATCH 4/6] Update m1.move --- task3/sources/m1.move | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/task3/sources/m1.move b/task3/sources/m1.move index e3542c4..c8c2418 100644 --- a/task3/sources/m1.move +++ b/task3/sources/m1.move @@ -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(friend) fun num2():u64 { 88 } -} \ No newline at end of file +} From d3a4727c3eb8a89a649b7301c2845deb80e9a359 Mon Sep 17 00:00:00 2001 From: xinyouyuerlibuzu <146720603+xinyouyuerlibuzu@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:58:12 +0800 Subject: [PATCH 5/6] Update m3.move --- task3/sources/m3.move | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/task3/sources/m3.move b/task3/sources/m3.move index 1b25c74..363eba0 100644 --- a/task3/sources/m3.move +++ b/task3/sources/m3.move @@ -4,6 +4,6 @@ module 0x42::M3{ use 0x42::M1::num; let n = num(); - assert(n == 66,0); + assert!(n == 66,0); } -} \ No newline at end of file +} From 18742771d283c806b83ed9d74e3ae12d6c40ebe3 Mon Sep 17 00:00:00 2001 From: xinyouyuerlibuzu <146720603+xinyouyuerlibuzu@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:58:57 +0800 Subject: [PATCH 6/6] Update main.move --- task4/sources/main.move | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/task4/sources/main.move b/task4/sources/main.move index daa4423..1a4e971 100644 --- a/task4/sources/main.move +++ b/task4/sources/main.move @@ -12,19 +12,19 @@ module 0x42::Task4 { // TODO // 1. create a deleteable object public fun createDeleteableObject(caller: &signer):ConstructorRef { - // ... + object::create_object(signer::address_of(caller)) } // TODO // 2. create a named object public fun createNamedObject(caller: &signer):ConstructorRef { - // ... + object::create_named_object(caller,NAME) } // TODO // 3. create a sticky object public fun createStickyObject(caller: &signer):ConstructorRef { - // ... + object::create_sticky_object(signer::address_of(caller)) } #[test(caller = @0x88)] @@ -49,4 +49,4 @@ module 0x42::Task4 { assert!( object::address_from_constructor_ref(&obj2) == @0xfab16b00983f01e5c2b7682472a4f4c3e5929fbba987958570b6290c02817df2, 1); } -} \ No newline at end of file +}