WARNING: Experimental features are turned on. Do not use experimental features on live deployments

// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
pragma experimental ABIEncoderV2;

I have a warning in my .sol files. I don’t know what is the meaning of this warning. Can you help me for this?

warning in this line –> pragma experimental ABIEncoderV2;

>Solution :

Generally speaking, experimental features can be unstable and produce unexpected and undocumented bugs – which you might not want in a production environment. Hence the warning.

This specific ABIEncoderV2 was introduced in Solidity version 0.5, enabling use of nested arrays and mappings. In this Solidity version, the encoder’s stability was marked as experimental (i.e. likely unstable).

Docs: https://docs.soliditylang.org/en/v0.5.17/layout-of-source-files.html#abiencoderv2

Note that these docs are for a deprecated Solidity version 0.5.

In the current Solidity version 0.8, the ABIEncoderV2 encoder is stable and no longer experimental. So if you’re compiling the project with the latest compiler version, you can freely remove the pragma experimental statement, which will also remove the warning.

Leave a Reply