Deleting Contracts
Contracts can be deleted forever from the blockchain with the function selfdestruct
.
selfdestruct
takes in a single argument, a payable
address to forcefully send all of Ether store in the contract.
For example
selfdestruct(payable(msg.sender))
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Kill {
function kill() external {
// Write your code here
selfdestruct(payable(msg.sender));
}
}
Last updated
Was this helpful?