Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 1.97 KB

payable-fallback.md

File metadata and controls

68 lines (50 loc) · 1.97 KB
warning layout title
This is a dynamically generated file. Do not edit manually.
default
payable-fallback | 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". Defaults to warn.

Example Config

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

Notes

  • Solhint allows this rule to automatically fix the code with --fix option
  • Instead of having a fallback function to receive native currency it is recommended to code a receive() function [here]

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