I have a contract called Erc20Recover in which I have the following function:
pragma solidity >=0.8.0; contract Erc20Recover { function _setNonRecoverableTokens(IErc20[] calldata tokens) public { // ... } } I have another contract called HToken which inherits from Erc20Recover and in whose constructor I attempted to call _setNonRecoverableTokens:
pragma solidity >=0.8.0; contract HToken is Erc20Recover { constructor(underlying) { IErc20[1] memory nonRecoverableTokens = [underlying]; _setNonRecoverableTokens(nonRecoverableTokens); } } But the code does not compile:
Invalid type for argument in function call. Invalid implicit conversion from contract IErc20[1] memory to contract IErc20[] calldata requested.
How can I turn that in-memory static array into a calldata array? Or, more generally, how can I call _setNonRecoverableTokens?
For context: IErc20 is my implementation of the ERC-20 interface.
memorytocalldatabut I fixed my problem by defining thetokensarray asmemory.