Skip to content

ishinu/Force-Send-Ether-in-Solidity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Force Send Ether Sample Project

  • With help of selfdestruct(address) functionality of Solidity, we can destruct self contract and send all ethers in existing contract to the address passed as an argument in function call.

  • This ignores all the condition checks in the called contract and force sends Ether to that contract.

  • To prevent any miss functionality in called contract due to this behaviour, we should store contract ether balance in state variable and use them in condition checks rather than directly putting address(this).balance expression.

To demonstrate the fix, refer to EthStoreV2.