Skip to content

Commit

Permalink
feat: enable cairo 2.6.0 contract declaration
Browse files Browse the repository at this point in the history
* feat: declare cairo2.6.0 contracts

* docs: add comment for rpc compatibility

* test: resolve cairo1v2 test file parsing error

* Update src/utils/hash/classHash.ts

---------

Co-authored-by: Petar Penovic <pp@spaceshard.io>
  • Loading branch information
PhilippeR26 and penovicp authored Mar 12, 2024
1 parent b992446 commit 0104c59
Show file tree
Hide file tree
Showing 9 changed files with 942 additions and 4 deletions.
27 changes: 27 additions & 0 deletions __mocks__/cairo/cairo260/hello260.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Cairo 2.6.0
#[starknet::interface]
trait IHelloStarknet<TContractState> {
fn set_name(ref self: TContractState, name1: felt252);
fn get_name(self: @TContractState) -> felt252;
}


#[starknet::contract]
mod HelloStarknet {
#[storage]
struct Storage {
name: felt252,
}

#[abi(embed_v0)]
impl HelloStarknetImpl of super::IHelloStarknet<ContractState> {
fn set_name(ref self: ContractState, name1: felt252) {
assert(name1 != '', 'Enter a name');
self.name.write(name1);
}

fn get_name(self: @ContractState) -> felt252 {
self.name.read()
}
}
}
Loading

0 comments on commit 0104c59

Please sign in to comment.