Closed zhfnjust closed 2 years ago
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; contract DataLocations { uint[3] public arr; mapping(uint => address) map; struct MyStruct { uint foo; } mapping(uint => MyStruct) myStructs; function f() external { // call _f with state variables _f(arr, map, myStructs[1]); } function _f( uint[3] storage _arr, mapping(uint => address) storage _map, MyStruct storage _myStruct ) internal { // do something with storage variables }
Same applies to property & struct, besides function.
Use first, define later.