3

What purpose does the "calldata" serve in this parameter _owners? Is it a new keyword?

  function setup(address[] calldata _owners, uint256 _threshold, address to, bytes calldata data)

Taken from Gnosis Safe Contract - GnosisSafe.sol

8

As per the Solidity version 0.5.0 breaking changes here :

Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables.

So currently, reference types comprise structs, arrays and mappings. If you use a reference type, you always have to explicitly provide the data area where the type is stored:

  • memory (whose lifetime is limited to a function call)
  • storage (the location where the state variables are stored)

  • calldata (special data location that contains the function arguments, only available for external function call parameters).

So here in the shared contract, data location has been mentioned which is calldata. Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.