Last active
December 18, 2021 00:21
-
-
Save apinanyogaratnam/3c46e7c53d1dc1b651bfb6ff09dd1c92 to your computer and use it in GitHub Desktop.
Solidity script to burn Ethereum. The funds sent to the burn() function will be sent to the contract's address and it will self destruct (delete the code) which causes the contract to be unusable again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Burn { | |
constructor() {} | |
function payMe() public payable {} | |
function getBalance() public view returns (uint) { | |
return address(this).balance; | |
} | |
function burn() public { | |
selfdestruct(payable(address(this))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment