Contact A:

function redeemAssetsForBuyback(address[] calldata tokens) external {
  // ...

I would like to call redeemAssetsForBuyback from Contract B:

function initiateRedeem() external {
  // ...
  // I have address[] memory payload ready to be sent
  address[] memory myPayload;

  // Can I transform myPayload to address[] calldata?
  IContractA(contractAAdrress).redeemAssetsForBuyback(myPayload); // Parameter mismatchs

I can change the redeemAssetsForBuyback function's parameter to be memory instead of calldata and my issue resolves on JS VM at Remix but I read that I should be using calldata here.

So, can I somehow create a address[] calldata on ContractB and call ContractA's function with it? If not, is it okay to use redeemAssetsForBuyback(address[] memory tokens)?

1 Answer 1


This is one way to do so:

pragma solidity ^0.8.0;

contract A {
    event Received(bytes);
    function redeemAssetsForBuyback(address[] calldata) external{
      emit Received(msg.data);

contract B{
    function initiateRedeem(address _contractA, address[] calldata address_array) external {
        (bool success, ) = _contractA.call(
            abi.encodeWithSignature("redeemAssetsForBuyback(address[])", address_array)

If you deploy ContractA and pass the address of ContractA to initiateRedeem() in ContractB along with your array of address, it will make an call to redeemAssetsForBuyback function in contractA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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