Skip to content

msg.value non-payable function#

Reports uses of msg.value in functions that are never called from a payable function. The value of msg.value is always zero in such functions.


pragma solidity ^0.8;

contract C {
    function f() public {

    function g() private {
        require(msg.value > 0); // (1)!
        // ...
  1. The function g is never called from a payable function in this example. The value of msg.value will always be zero.


The detector does not accept any additional parameters.