-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support sepolia network tests (#386)
- Loading branch information
Showing
9 changed files
with
252 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod balance; | ||
mod contract_with_constructor; | ||
mod events; | ||
mod map; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#[starknet::interface] | ||
trait IMap<T> { | ||
// Returns the value associated with the given key. | ||
fn get(self: @T, key: felt252) -> felt252; | ||
// Sets the value associated with the given key. | ||
fn put(ref self: T, key: felt252, value: felt252); | ||
} | ||
|
||
#[starknet::contract] | ||
mod Map { | ||
use traits::Into; | ||
|
||
#[storage] | ||
struct Storage { | ||
map: LegacyMap::<felt252, felt252>, | ||
} | ||
|
||
#[external(v0)] | ||
impl Map of super::IMap<ContractState> { | ||
fn get(self: @ContractState, key: felt252) -> felt252 { | ||
self.map.read(key) | ||
} | ||
fn put(ref self: ContractState, key: felt252, value: felt252) { | ||
self.map.write(key, value); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Declare this file as a StarkNet contract and set the required | ||
// builtins. | ||
%lang starknet | ||
%builtins pedersen range_check | ||
|
||
from starkware.cairo.common.cairo_builtins import HashBuiltin | ||
|
||
// Define a storage variable. | ||
@storage_var | ||
func storage(key: felt) -> (value: felt) { | ||
} | ||
|
||
@external | ||
func put{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(key: felt, value: felt) { | ||
storage.write(key, value); | ||
return (); | ||
} | ||
|
||
@view | ||
func get{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(key: felt) -> ( | ||
res: felt | ||
) { | ||
let (value) = storage.read(key); | ||
return (value,); | ||
} |
1 change: 0 additions & 1 deletion
1
lib/src/test/resources/contracts_v2/src/salted_counter_contract.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters