check-send-result

March 10, 2025 ยท View on GitHub

Recommended Badge Category Badge Default Severity Badge warn

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

Description

Check result of "send" call.

Options

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

Example Config

{
  "rules": {
    "check-send-result": "warn"
  }
}

Notes

  • Rule will rise false positive on this: bool success = walletAddress.send(amount); require(success, "Failed to send");
  • Rule will skip ERC777 "send" function to prevent false positives

Examples

๐Ÿ‘ Examples of correct code for this rule

result of "send" call checked with if statement

if(x.send(55)) {}

result of "send" call checked within a require

require(payable(walletAddress).send(moneyAmount), "Failed to send moneyAmount");

๐Ÿ‘Ž Examples of incorrect code for this rule

result of "send" call ignored

x.send(55);

Version

This rule was introduced in Solhint 2.0.0-alpha.0

Resources