solhint

payable-fallback

Recommended Badge Category Badge Default Severity Badge warn

The {“extends”: “solhint:recommended”} property in a configuration file enables this rule.

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 of rule severity. Must be one of “error”, “warn”, “off”. Default 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 2.0.0-alpha.0

Resources