solhint

payable-fallback

Category Badge Default Severity Badge warn

Description

When fallback is not payable and there is no receive function you will not be able to receive currency.

Options

This rule accepts a string option for rule severity. Must be one of “error”, “warn”, “off”. Defaults to warn.

Example Config

{
  "rules": {
    "payable-fallback": "warn"
  }
}

Notes

Examples

👍 Examples of correct code for this rule

Fallback is payable

function() public payable {}

Fallback is payable

fallback() external payable {}

👎 Examples of incorrect code for this rule

Fallback is not payable

function() {} function g() payable {}

Fallback is not payable

fallback() {} function g() payable {}

Version

This rule was introduced in Solhint 5.0.4

Resources