I have a contract
that implements an interface
, the contract has a state variable mapping(address => bytes32[]) public usersLists
, I defined a getter function signature in the interface
for this state variable, but I'm getting the following compiler error:
TypeError: Data location must be "memory" or "calldata" for return parameter in function, but none was given.
--> interfaces/IPool.sol:42:65:
|
42 | function usersLists(address user) external view returns (bytes32[]);
| ^^^^^^^^^
The interface and contract are as follows:
interface IA {
function usersLists(address user) external view returns (bytes32[]);
}
contract A is IA {
mapping(address => bytes32[]) public override usersLists;
}
Could someone please help me resolve this issue? It seems to be an issue with the list
and not bytes32
as removing []
making it a mapping(address => bytes32)
removes the compiler error, but from this answer it should be possible to return bytes32[]
.