Skip to content

Instantly share code, notes, and snippets.

@apinanyogaratnam
Last active December 18, 2021 00:21
Show Gist options
  • Save apinanyogaratnam/3c46e7c53d1dc1b651bfb6ff09dd1c92 to your computer and use it in GitHub Desktop.
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
// 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