2

I received the error message UnimplementedFeatureError: Only byte arrays can be encoded from calldata currently from the compiler, but without any reference to a file or line. In a big project, and with a lot of changes, this made the source difficult to find.

The code that caused it ultimately was of this form:

pragma solidity >0.5.0;
pragma experimental ABIEncoderV2;

contract Foo {
    constructor(address[] memory _addrs) public {}
}

contract FooFactory {
    function createInstance(address[] calldata _addrs) external {
        new Foo(_addrs);
    }
}
3

Ultimately, the fix was to implement FooFactory as public:

contract FooFactory {
    function createInstance(address[] memory _addrs) public {
        new Foo(_addrs);
    }
}

but another fix would be to remove the pragma experimental ABIEncoderV2; line if you don't need it.

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.