Open Arcticae opened 3 months ago
snforge
It should be easier to construct something like those helpers, when Store trait is available for usage:
Store
fn load<T, +Store<T>>(target: ContractAddress, base_address: felt252) -> T { Store::<T>::read(0, base_address).unwrap() } fn load_path<T>(base_address: felt252) -> StoragePath<T> { StoragePath::<T> { pedersen::HashState {base_address} } }
Then the usage of the cheats would be more intuitive since we would not have to specify the sizes:
// Given storage: struct Storage { a: Map<u8,u8>, b: MyStruct } // Construct load/store paths with addresses and bind to types: let path_a = load_path::<Map<u8,u8>>(selector!("a")); let path_b = load_path::<MyStruct>(selector!("b")); // Retrieve values: path_a.entry(5).read(); path_b.read();
Blocked by #2347
Which components does the task require to be changed? (think hard pls)
snforge
Description
It should be easier to construct something like those helpers, when
Store
trait is available for usage:Then the usage of the cheats would be more intuitive since we would not have to specify the sizes: