-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Reference any GitHub issues resolved by this PR --> Closes #2598 ## Introduced changes <!-- A brief description of the changes --> - Replace `LegacyMap` storage mapping with `Map` ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [x] Added relevant tests - [x] Performed self-review of the code - [x] Added changes to `CHANGELOG.md` --------- Co-authored-by: Franciszek Job <[email protected]>
- Loading branch information
1 parent
370c3ef
commit 647483a
Showing
9 changed files
with
92 additions
and
63 deletions.
There are no files selected for viewing
9 changes: 6 additions & 3 deletions
9
crates/cheatnet/tests/contracts/src/store_load/map_simple_value_simple_key.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,17 +1,20 @@ | ||
#[starknet::contract] | ||
mod MapSimpleValueSimpleKey { | ||
use starknet::{ | ||
storage::{StoragePointerWriteAccess, StorageMapReadAccess, StoragePathEntry, Map} | ||
}; | ||
#[storage] | ||
struct Storage { | ||
values: LegacyMap<felt252, felt252>, | ||
values: Map<felt252, felt252>, | ||
} | ||
|
||
#[external(v0)] | ||
fn insert(ref self: ContractState, key: felt252, value: felt252) { | ||
self.values.write(key, value); | ||
self.values.entry(key).write(value); | ||
} | ||
|
||
#[external(v0)] | ||
fn read(self: @ContractState, key: felt252) -> felt252 { | ||
self.values.read(key) | ||
self.values.entry(key).read() | ||
} | ||
} |
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
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
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
Oops, something went wrong.