Solidity – Understanding Abi Encoder V2

ethereum-classicsolidity

I came across the following code and found the term "pragma experimental ABIEncoderV2". Can anybody be specific in telling what this actually means?

//pragma solidity ^0.5.2;
pragma experimental ABIEncoderV2;
contract test {

struct document{
   string ipfsHash;
   string documentName;
   bytes32 accessKey;
}

struct grantAccess{
   address owner;
   address single;     
}

This is a part of the code I found over the web.

Best Answer

Solidity v0.4-v0.7

The standard ABI coder does not allow arrays of dynamic types, structs or nested variables between the Solidity contract and the dApp.

The ABI v2 coder; which allows structs, nested and dynamic variables to be passed into functions, returned from functions and emitted by events.

Note: Do not use experimental features on live deployments.

Solidity v0.8 and above

As per the list of v0.8 breaking changes, the ABIEncoderV2 is not experimental anymore - it is actually enabled by default by the compiler.

Related Topic