如何解决以下方法中有关低级别调用的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;
}发布于 2022-06-01 12:03:28
使用//slither-disable-next-line DETECTOR_NAME
// 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);
//slither-disable-next-line unchecked-lowlevel
(bool sent, ) = addressOfProposer.call{value: allowanceAvailable}("");
require(sent, "Failed to send ether");
// console.log("transfer success");
emit Withdraw(addressOfProposer, allowanceAvailable);
return true;
}有趣的是,它提供了一个未经检查的低级别调用警告,但是,考虑到它确实被检查了。
https://stackoverflow.com/questions/72427614
复制相似问题