Loading...
Contracts can be deleted from the blockchain by calling selfdestruct
.
selfdestruct
sends all remaining Ether stored in the contract to an designated address which must be of type payable.
pragma solidity ^0.8.3;
contract Task2{
//create a function to destruct contract and retrieve amount (hint : use selfdestruct function in solidity)
//The address which will store the amounts present in solidity once the contract gets destroyed
address payable addr ;
function destroyContract()public
{
selfdestruct(addr);
}
}
For many more exciting tutorials keep following my username @BlockTalks_Raj
!!!!!HAPPY LEARNING!!!!!