New answers tagged

0

When the contract makes a transfer it does not use your state variable balance, but rather the balance of the contract as in address(this).balance. Since that balance is not being checked, transfer(amount) may revert because address(this).balance < amount is possible. The code below applies the proper check and the warning message is gone: pragma solidity ...


Top 50 recent answers are included