function inputs and outputs should be appropriately allocate using the data location keywords
-
calldata (most of the time inputs should be marked as calldata as they do not need to be modified): for input arguments (cheaper gas used compared to memory) that are read-only, non-modifiable.
-
storage vs memory inside function body. Use storage in case of updating multiple fields in a struct will be cheaper in terms of gas usage compared to memory (example needs fix: https://github.com/syns-platform/contracts/blob/main/contracts/v1/SynsMarketplace.sol#L398)
function inputs and outputs should be appropriately allocate using the data location keywords
calldata (most of the time inputs should be marked as calldata as they do not need to be modified): for input arguments (cheaper gas used compared to memory) that are read-only, non-modifiable.
storage vs memory inside function body. Use storage in case of updating multiple fields in a struct will be cheaper in terms of gas usage compared to memory (example needs fix: https://github.com/syns-platform/contracts/blob/main/contracts/v1/SynsMarketplace.sol#L398)