4

Whenever I use pragma experimental ABIEncoderV2 and truffle, I get the following warning in the terminal:

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

Is there any way to turn it off, at least for development?

Update Apr 2021: this specific issue is no longer applicable to Solidity v0.8 and above, since the abi encoder v2 has been finalised. Changing the pragma to pragma solidity ^0.8.0 will make the warning go away.

Paul Razvan Berg
  • 17,902
  • 6
  • 73
  • 143
  • Previously https://ethereum.stackexchange.com/questions/16307/is-there-a-way-to-disable-a-warning-in-solidity-code – Ismael Oct 28 '18 at 19:33

2 Answers2

5

Even if "silencing warnings" has been debated for a long time (https://github.com/ethereum/solidity/issues/2691 and https://github.com/ethereum/solidity/issues/2675), it is not yet possible to do it.

The explanation why not, is here: https://solidity.readthedocs.io/en/v0.4.25/security-considerations.html#recommendations

Marco Ottolini
  • 422
  • 4
  • 12
2

With Foundry, there is a neat way to ignore Solidity compiler warnings, and that is to use the ignored_error_codes config option:

# ignore solc warnings for missing license and exceeded contract size
# known error codes are: ["unreachable", "unused-return", "unused-param", "unused-var", "code-size", "shadowing", "func-mutability", "license", "pragma-solidity", "virtual-interfaces", "same-varname"]
# additional warnings can be added using their numeric error code: ["license", 1337]
ignored_error_codes = ["license", "code-size"]
Paul Razvan Berg
  • 17,902
  • 6
  • 73
  • 143