Incorrectly Payable
What it detects
This detector highlights functions with the payable
modifier where no ether or token transfer is intended. Accepting value in such cases can lock funds or cause unexpected side effects.
Typical symptoms
- Function collects ether but never uses it
- Unclear mechanism to withdraw mistakenly sent funds
Solidity snippet (v0.8.25)
pragma solidity ^0.8.25;
contract PayableMistake {
// Not supposed to accept ether
function setValue(uint256 x) external payable {}
}
Why it matters on EVM
Marking unnecessary payable functions can trick users into sending ether that the contract cannot properly handle or refund.