10

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.

2 Answers 2

14

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.

1
  • 7
    Wow. Solidity v0.8.0 has JUST BEEN RELEASED WITH ABI coder v2 activated by default!!!
    – Russo
    Commented Dec 24, 2020 at 10:03
9

From the Solidity v0.8.0 Breaking Changes documentation:

ABI coder v2 is activated by default.

So it is not experimental anymore, but a standard feature since Solidity v0.8.0.

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.