I have this code snippet:
pragma solidity >=0.5.0 <0.7.0;
import "@aztec/protocol/contracts/libs/NoteUtils.sol";
library EscrowUtils {
using NoteUtils for bytes;
struct Note {
address owner;
bytes32 noteHash;
}
function noteBytesToStruct(bytes memory note)
internal
pure
returns (Note memory codedNote)
{
(address owner, bytes32 noteHash, ) = note.extractNote();
return Note(owner, noteHash);
}
}
which does not throw any errors. However, when I change the visibility modifier on the function to public, I get:
This type is only supported in the new experimental ABI encoder. Use "pragma experimental ABIEncoderV2;" to enable the feature.
Why changing modifier causes this error?