将ETH发送到任意用户(Slither警告)
我如何通过以下方法解决有关低级别调用的Slither警告:
// A proposer calls function and if address has an allowance, recieves ETH in return.
function getPayout(address payable addressOfProposer)
public
returns (bool)
{
// Get the available allowance first amd store in uint256.
uint256 allowanceAvailable = _payoutTotals[addressOfProposer];
require(allowanceAvailable > 0, "You do not have any funds available.");
_decreasePayout(addressOfProposer, allowanceAvailable);
(bool sent, ) = addressOfProposer.call{value: allowanceAvailable}("");
require(sent, "Failed to send ether");
// console.log("transfer success");
emit Withdraw(addressOfProposer, allowanceAvailable);
return true;
}
How do I resolve Slither warning about the low level call in the following method:
// A proposer calls function and if address has an allowance, recieves ETH in return.
function getPayout(address payable addressOfProposer)
public
returns (bool)
{
// Get the available allowance first amd store in uint256.
uint256 allowanceAvailable = _payoutTotals[addressOfProposer];
require(allowanceAvailable > 0, "You do not have any funds available.");
_decreasePayout(addressOfProposer, allowanceAvailable);
(bool sent, ) = addressOfProposer.call{value: allowanceAvailable}("");
require(sent, "Failed to send ether");
// console.log("transfer success");
emit Withdraw(addressOfProposer, allowanceAvailable);
return true;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
// Slither-disable-next-line detector_name
:有趣的是,它给出了未检查的低级呼叫警告,但是,鉴于它似乎确实已被检查。
Use
//slither-disable-next-line DETECTOR_NAME
:It's interesting that it gives an unchecked low-level call warning, however, given that it does appear to be checked.