Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(100243254): move exam #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions student_no.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Please enter your 9-digit student number below.
100243254
4 changes: 2 additions & 2 deletions task1/sources/main.move
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
16 changes: 9 additions & 7 deletions task2/sources/main.move
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions task3/sources/m1.move
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
8 changes: 5 additions & 3 deletions task4/sources/main.move
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ module 0x42::Task4 {
// TODO
// 1. create a deleteable object
public fun createDeleteableObject(caller: &signer):ConstructorRef {
// ...
let caller_address = signer::address_of(caller);
object::create_object(caller_address)
}

// 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 {
// ...
let caller_address = signer::address_of(caller);
object::create_sticky_object(caller_address)
}

#[test(caller = @0x88)]
Expand Down
Loading