check-send-result

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 of rule severity. Must be one of “error”, “warn”, “off”. Default to warn.
Example Config
{
"rules": {
"check-send-result": "warn"
}
}
Notes
- You should use no-unused-var to track that the variable you assign the return value of .send to is actually used
- Rule will skip “.send” calls with arity != 1 to avoid false positives on ERC777 sends. you might get a false positive regardless if you define a .send function taking one argument
Examples
👍 Examples of correct code for this rule
result of “send” call checked with if statement
result of “send” call checked within a require
require(payable(walletAddress).send(moneyAmount), "Failed to send moneyAmount");
result of “send” assigned to a variable
bool success = payable(walletAddress).send(moneyAmount);
result of “send” passed to a function
doThingWithResult(payable(walletAddress).send(moneyAmount));
👎 Examples of incorrect code for this rule
result of “send” call ignored
Version
This rule was introduced in Solhint 2.0.0-alpha.0
Resources