From 97010f321e11ace7a5d5f3971158b12a959124ce Mon Sep 17 00:00:00 2001 From: country cousin Date: Thu, 13 Jun 2024 17:30:22 +0000 Subject: [PATCH] added updates based on cairo version 2.6.3 --- exercises/arrays/arrays1.cairo | 3 --- exercises/arrays/arrays2.cairo | 3 --- exercises/arrays/arrays3.cairo | 3 --- exercises/enums/enums2.cairo | 3 +-- exercises/enums/enums3.cairo | 2 -- .../move_semantics/move_semantics1.cairo | 4 ---- .../move_semantics/move_semantics2.cairo | 1 - .../move_semantics/move_semantics3.cairo | 4 ---- .../move_semantics/move_semantics4.cairo | 5 +---- .../move_semantics/move_semantics5.cairo | 2 +- .../move_semantics/move_semantics6.cairo | 3 +-- exercises/options/options1.cairo | 2 -- exercises/options/options2.cairo | 2 -- exercises/options/options3.cairo | 3 --- .../primitive_types/primitive_types4.cairo | 4 ---- exercises/starknet/basics/starknet1.cairo | 8 -------- exercises/starknet/basics/starknet2.cairo | 9 --------- exercises/starknet/basics/starknet3.cairo | 8 -------- exercises/starknet/basics/starknet4.cairo | 8 -------- .../starknet/interoperability/starknet5.cairo | 20 ------------------- exercises/structs/structs3.cairo | 1 - exercises/variables/variables1.cairo | 2 -- exercises/variables/variables2.cairo | 1 - exercises/variables/variables3.cairo | 1 - exercises/variables/variables4.cairo | 1 - exercises/variables/variables5.cairo | 1 - exercises/variables/variables6.cairo | 1 - 27 files changed, 4 insertions(+), 101 deletions(-) diff --git a/exercises/arrays/arrays1.cairo b/exercises/arrays/arrays1.cairo index 51af64456..d2ff9cc0f 100644 --- a/exercises/arrays/arrays1.cairo +++ b/exercises/arrays/arrays1.cairo @@ -6,9 +6,6 @@ // I AM NOT DONE -use array::ArrayTrait; -use option::OptionTrait; - fn create_array() -> Array { let a = ArrayTrait::new(); // something to change here... a.append(1); diff --git a/exercises/arrays/arrays2.cairo b/exercises/arrays/arrays2.cairo index 5c724df2d..652255c00 100644 --- a/exercises/arrays/arrays2.cairo +++ b/exercises/arrays/arrays2.cairo @@ -5,9 +5,6 @@ // I AM NOT DONE -use array::ArrayTrait; -use option::OptionTrait; - // Don't modify this function fn create_array() -> Array { let mut a = ArrayTrait::new(); diff --git a/exercises/arrays/arrays3.cairo b/exercises/arrays/arrays3.cairo index 5a66fe8fd..a5f8a8ccc 100644 --- a/exercises/arrays/arrays3.cairo +++ b/exercises/arrays/arrays3.cairo @@ -4,9 +4,6 @@ // I AM NOT DONE -use array::ArrayTrait; -use option::OptionTrait; - fn create_array() -> Array { let a = ArrayTrait::new(); // something to change here... a.append(0); diff --git a/exercises/enums/enums2.cairo b/exercises/enums/enums2.cairo index 33e245662..6bf121fa8 100644 --- a/exercises/enums/enums2.cairo +++ b/exercises/enums/enums2.cairo @@ -4,8 +4,7 @@ // I AM NOT DONE use debug::PrintTrait; -use array::ArrayTrait; -use traits::Into; + #[derive(Copy, Drop)] enum Message { // TODO: define the different variants used below diff --git a/exercises/enums/enums3.cairo b/exercises/enums/enums3.cairo index 784721ca9..0f982e8aa 100644 --- a/exercises/enums/enums3.cairo +++ b/exercises/enums/enums3.cairo @@ -4,8 +4,6 @@ // I AM NOT DONE -use debug::PrintTrait; - #[derive(Drop, Copy)] enum Message { // TODO: implement the message variant types based on their usage below } diff --git a/exercises/move_semantics/move_semantics1.cairo b/exercises/move_semantics/move_semantics1.cairo index 8d187e2bd..0aa2f743f 100644 --- a/exercises/move_semantics/move_semantics1.cairo +++ b/exercises/move_semantics/move_semantics1.cairo @@ -3,11 +3,7 @@ // I AM NOT DONE -use array::ArrayTrait; -use array::ArrayTCloneImpl; -use array::SpanTrait; use debug::PrintTrait; -use clone::Clone; fn main() { let arr0 = ArrayTrait::new(); diff --git a/exercises/move_semantics/move_semantics2.cairo b/exercises/move_semantics/move_semantics2.cairo index c56e6f5be..b10f6bc7e 100644 --- a/exercises/move_semantics/move_semantics2.cairo +++ b/exercises/move_semantics/move_semantics2.cairo @@ -2,7 +2,6 @@ // Make me compile without changing line 16 or moving line 13! // Execute `starklings hint move_semantics2` or use the `hint` watch subcommand for a hint. -use array::ArrayTrait; use debug::PrintTrait; // I AM NOT DONE diff --git a/exercises/move_semantics/move_semantics3.cairo b/exercises/move_semantics/move_semantics3.cairo index 40aebe690..d09f8f2ec 100644 --- a/exercises/move_semantics/move_semantics3.cairo +++ b/exercises/move_semantics/move_semantics3.cairo @@ -5,10 +5,6 @@ // I AM NOT DONE -use array::ArrayTrait; -use array::ArrayTCloneImpl; -use array::SpanTrait; -use clone::Clone; use debug::PrintTrait; fn main() { diff --git a/exercises/move_semantics/move_semantics4.cairo b/exercises/move_semantics/move_semantics4.cairo index e57d8a22b..82d938b39 100644 --- a/exercises/move_semantics/move_semantics4.cairo +++ b/exercises/move_semantics/move_semantics4.cairo @@ -5,10 +5,7 @@ // Execute `starklings hint move_semantics4` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use array::ArrayTrait; -use array::ArrayTCloneImpl; -use array::SpanTrait; -use clone::Clone; + use debug::PrintTrait; fn main() { diff --git a/exercises/move_semantics/move_semantics5.cairo b/exercises/move_semantics/move_semantics5.cairo index 6b88d5089..85838d542 100644 --- a/exercises/move_semantics/move_semantics5.cairo +++ b/exercises/move_semantics/move_semantics5.cairo @@ -4,7 +4,7 @@ // Execute `starklings hint move_semantics5` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use array::ArrayTrait; + #[test] fn main() { let mut a = ArrayTrait::new(); diff --git a/exercises/move_semantics/move_semantics6.cairo b/exercises/move_semantics/move_semantics6.cairo index 1880c94a7..54c2e7405 100644 --- a/exercises/move_semantics/move_semantics6.cairo +++ b/exercises/move_semantics/move_semantics6.cairo @@ -3,7 +3,6 @@ // You can't change anything except adding or removing references. // I AM NOT DONE -use debug::PrintTrait; #[derive(Drop)] struct Number { @@ -27,5 +26,5 @@ fn get_value(number: Number) -> u32 { fn set_value(number: Number) { let value = 2222222; number = Number { value }; - number.value.print(); + println!("Number is: {}", number.value); } diff --git a/exercises/options/options1.cairo b/exercises/options/options1.cairo index f9f0b4909..164010b73 100644 --- a/exercises/options/options1.cairo +++ b/exercises/options/options1.cairo @@ -3,8 +3,6 @@ // I AM NOT DONE -use option::OptionTrait; - // This function returns how much icecream there is left in the fridge. // If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them // all, so there'll be no more left :( diff --git a/exercises/options/options2.cairo b/exercises/options/options2.cairo index 2e703de1b..6732a4804 100644 --- a/exercises/options/options2.cairo +++ b/exercises/options/options2.cairo @@ -3,8 +3,6 @@ // I AM NOT DONE -use option::OptionTrait; - #[test] fn test_options() { let target = 'starklings'; diff --git a/exercises/options/options3.cairo b/exercises/options/options3.cairo index 024d69365..4bdd7d6d9 100644 --- a/exercises/options/options3.cairo +++ b/exercises/options/options3.cairo @@ -3,9 +3,6 @@ // I AM NOT DONE -use option::OptionTrait; -use array::ArrayTrait; - #[derive(Drop)] struct Student { name: felt252, diff --git a/exercises/primitive_types/primitive_types4.cairo b/exercises/primitive_types/primitive_types4.cairo index bbefa6f47..bdcec80fa 100644 --- a/exercises/primitive_types/primitive_types4.cairo +++ b/exercises/primitive_types/primitive_types4.cairo @@ -5,10 +5,6 @@ // I AM NOT DONE -use traits::Into; -use traits::TryInto; -use option::OptionTrait; - fn sum_u8s(x: u8, y: u8) -> u8 { x + y } diff --git a/exercises/starknet/basics/starknet1.cairo b/exercises/starknet/basics/starknet1.cairo index 23ecb6d50..3e0865c50 100644 --- a/exercises/starknet/basics/starknet1.cairo +++ b/exercises/starknet/basics/starknet1.cairo @@ -24,18 +24,10 @@ mod JoesContract { #[cfg(test)] mod test { - use array::ArrayTrait; - use array::SpanTrait; use super::JoesContract; use starknet::syscalls::deploy_syscall; - use traits::TryInto; - use option::OptionTrait; - use starknet::class_hash::Felt252TryIntoClassHash; - use core::result::ResultTrait; use super::IJoesContractDispatcher; use super::IJoesContractDispatcherTrait; - use starknet::ContractAddress; - use debug::PrintTrait; #[test] #[available_gas(2000000000)] diff --git a/exercises/starknet/basics/starknet2.cairo b/exercises/starknet/basics/starknet2.cairo index 3b676122c..76ff6a82b 100644 --- a/exercises/starknet/basics/starknet2.cairo +++ b/exercises/starknet/basics/starknet2.cairo @@ -38,19 +38,10 @@ trait IJillsContract { #[cfg(test)] mod test { - use starknet::ContractAddress; - use array::ArrayTrait; - use array::SpanTrait; - use debug::PrintTrait; - use traits::TryInto; use starknet::syscalls::deploy_syscall; - use option::OptionTrait; - use starknet::class_hash::Felt252TryIntoClassHash; - use core::result::ResultTrait; use super::IJillsContractDispatcher; use super::IJillsContractDispatcherTrait; - use starknet::Felt252TryIntoContractAddress; use super::JillsContract; #[test] #[available_gas(2000000000)] diff --git a/exercises/starknet/basics/starknet3.cairo b/exercises/starknet/basics/starknet3.cairo index b210088c7..573a94654 100644 --- a/exercises/starknet/basics/starknet3.cairo +++ b/exercises/starknet/basics/starknet3.cairo @@ -54,15 +54,7 @@ mod ProgressTracker { #[cfg(test)] mod test { use starknet::ContractAddress; - use array::ArrayTrait; - use array::SpanTrait; - use debug::PrintTrait; - use traits::TryInto; use starknet::syscalls::deploy_syscall; - use core::result::ResultTrait; - - use starknet::Felt252TryIntoContractAddress; - use option::OptionTrait; use super::IProgressTrackerDispatcher; use super::IProgressTrackerDispatcherTrait; use super::ProgressTracker; diff --git a/exercises/starknet/basics/starknet4.cairo b/exercises/starknet/basics/starknet4.cairo index 5f61646ef..dbe175d4f 100644 --- a/exercises/starknet/basics/starknet4.cairo +++ b/exercises/starknet/basics/starknet4.cairo @@ -64,15 +64,7 @@ mod LizInventory { #[cfg(test)] mod test { use starknet::ContractAddress; - use array::ArrayTrait; - use array::SpanTrait; - use debug::PrintTrait; - use traits::TryInto; use starknet::syscalls::deploy_syscall; - use core::result::ResultTrait; - - use starknet::Felt252TryIntoContractAddress; - use option::OptionTrait; use super::LizInventory; use super::ILizInventoryDispatcher; use super::ILizInventoryDispatcherTrait; diff --git a/exercises/starknet/interoperability/starknet5.cairo b/exercises/starknet/interoperability/starknet5.cairo index 62b1d8dbe..47ecb980e 100644 --- a/exercises/starknet/interoperability/starknet5.cairo +++ b/exercises/starknet/interoperability/starknet5.cairo @@ -4,14 +4,6 @@ // I AM NOT DONE -use core::traits::Into; -use core::result::ResultTrait; -use starknet::syscalls::deploy_syscall; -use array::ArrayTrait; -use traits::TryInto; -use option::OptionTrait; -use starknet::class_hash::Felt252TryIntoClassHash; - #[starknet::interface] trait IContractA { fn set_value(ref self: TContractState, value: u128) -> bool; @@ -21,13 +13,9 @@ trait IContractA { #[starknet::contract] mod ContractA { - use traits::Into; - use starknet::info::get_contract_address; use starknet::ContractAddress; use super::IContractBDispatcher; use super::IContractBDispatcherTrait; - use result::ResultTrait; - use debug::PrintTrait; #[storage] struct Storage { @@ -88,15 +76,7 @@ mod ContractB { #[cfg(test)] mod test { - use option::OptionTrait; use starknet::syscalls::deploy_syscall; - use traits::Into; - use traits::TryInto; - use starknet::class_hash::Felt252TryIntoClassHash; - use array::ArrayTrait; - use result::ResultTrait; - use starknet::ContractAddress; - use super::ContractA; use super::IContractADispatcher; use super::IContractADispatcherTrait; diff --git a/exercises/structs/structs3.cairo b/exercises/structs/structs3.cairo index 21d04b513..c7012bdbd 100644 --- a/exercises/structs/structs3.cairo +++ b/exercises/structs/structs3.cairo @@ -6,7 +6,6 @@ // I AM NOT DONE -use array::ArrayTrait; #[derive(Copy, Drop)] struct Package { sender_country: felt252, diff --git a/exercises/variables/variables1.cairo b/exercises/variables/variables1.cairo index de0169fce..5a3e1c15b 100644 --- a/exercises/variables/variables1.cairo +++ b/exercises/variables/variables1.cairo @@ -4,8 +4,6 @@ // I AM NOT DONE -use debug::PrintTrait; - fn main() { x = 5 ; println!(" x is {}", x) diff --git a/exercises/variables/variables2.cairo b/exercises/variables/variables2.cairo index f8fec80ad..ef6d486fa 100644 --- a/exercises/variables/variables2.cairo +++ b/exercises/variables/variables2.cairo @@ -2,7 +2,6 @@ // Execute `starklings hint variables2` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; fn main() { let x; diff --git a/exercises/variables/variables3.cairo b/exercises/variables/variables3.cairo index a6bfe4d32..010055135 100644 --- a/exercises/variables/variables3.cairo +++ b/exercises/variables/variables3.cairo @@ -2,7 +2,6 @@ // Execute `starklings hint variables3` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; fn main() { let x: felt252; diff --git a/exercises/variables/variables4.cairo b/exercises/variables/variables4.cairo index dc5197628..d0dc514cf 100644 --- a/exercises/variables/variables4.cairo +++ b/exercises/variables/variables4.cairo @@ -2,7 +2,6 @@ // Execute `starklings hint variables4` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; fn main() { let x = 3; diff --git a/exercises/variables/variables5.cairo b/exercises/variables/variables5.cairo index 9a4256efa..a5757dc0b 100644 --- a/exercises/variables/variables5.cairo +++ b/exercises/variables/variables5.cairo @@ -2,7 +2,6 @@ // Execute `starklings hint variables5` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; fn main() { let number = 1_u8; // don't change this line diff --git a/exercises/variables/variables6.cairo b/exercises/variables/variables6.cairo index 2d84320a6..9b5a8cc1c 100644 --- a/exercises/variables/variables6.cairo +++ b/exercises/variables/variables6.cairo @@ -2,7 +2,6 @@ // Execute `starklings hint variables6` or use the `hint` watch subcommand for a hint. // I AM NOT DONE -use debug::PrintTrait; const NUMBER = 3; const SMALL_NUMBER = 3_u8;