• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

protofire / solhint / #190088

19 Jun 2026 01:04AM UTC coverage: 91.429% (-0.2%) from 91.602%
#190088

push

397 of 481 branches covered (82.54%)

1056 of 1155 relevant lines covered (91.43%)

117.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.75
/../lib/rules/security/check-send-result.js
1
const BaseChecker = require('../base-checker')
1✔
2
const TreeTraversing = require('../../common/tree-traversing')
1✔
3

4
const traversing = new TreeTraversing()
1✔
5

6
const ruleId = 'check-send-result'
1✔
7
const meta = {
1✔
8
  type: 'security',
9

10
  docs: {
11
    description: `Check result of "send" call.`,
12
    category: 'Security Rules',
13
    examples: {
14
      good: [
15
        {
16
          description: 'result of "send" call checked with if statement',
17
          code: 'if(x.send(55)) {}',
18
        },
19
        {
20
          description: 'result of "send" call checked within a require',
21
          code: 'require(payable(walletAddress).send(moneyAmount), "Failed to send moneyAmount");',
22
        },
23
      ],
24
      bad: [
25
        {
26
          description: 'result of "send" call ignored',
27
          code: 'x.send(55);',
28
        },
29
      ],
30
    },
31
    notes: [
32
      {
33
        note: 'Rule will rise false positive on this: `bool success = walletAddress.send(amount); require(success, "Failed to send"); ` ',
34
      },
35
      { note: 'Rule will skip ERC777 "send" function to prevent false positives' },
36
    ],
37
  },
38

199✔
39
  recommended: true,
40
  defaultSetup: 'warn',
41

42
  schema: null,
2✔
43
}
44

45
class CheckSendResultChecker extends BaseChecker {
46
  constructor(reporter) {
2!
47
    super(reporter, ruleId, meta)
2✔
48
  }
2✔
49

50
  MemberAccess(node) {
2✔
51
    this.validateSend(node)
2!
52
  }
8✔
53

54
  validateSend(node) {
55
    if (node.memberName === 'send') {
56
      if (this.isNotErc777Token(node)) {
×
57
        const hasVarDeclaration = traversing.statementNotContains(node, 'VariableDeclaration')
58
        const hasIfStatement = traversing.statementNotContains(node, 'IfStatement')
59
        const hasRequire = traversing.someParent(node, this.isRequire)
2✔
60
        const hasAssert = traversing.someParent(node, this.isAssert)
1✔
61

62
        if (!hasIfStatement && !hasVarDeclaration && !hasRequire && !hasAssert) {
63
          this.error(node, 'Check result of "send" call')
64
        }
65
      }
66
    }
1✔
67
  }
68

69
  isNotErc777Token(node) {
70
    const isErc777 = node.parent.type === 'FunctionCall' && node.parent.arguments.length >= 3
71
    return !isErc777
72
  }
73

74
  isRequire(node) {
75
    return node.type === 'FunctionCall' && node.expression.name === 'require'
76
  }
77

78
  isAssert(node) {
79
    return node.type === 'FunctionCall' && node.expression.name === 'assert'
80
  }
81
}
82

83
module.exports = CheckSendResultChecker
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc