0

What actually happens after self destruct function is called ?

//SPDX-License-Identifier:MIT
pragma solidity 0.8.7;
contract PiggyBank{
    event Deposit(uint amount);
    event Withdraw(uint amount);
    receive() external payable {
        emit Deposit(msg.value);
    }
    address public owner = msg.sender;
    function withdraw() external{
        require(msg.sender ==owner ,"not owner");
        emit Withdraw(address(this).balance);
        selfdestruct(payable(msg.sender));
    }
}

In the above code if I destruct the contract then also I am able to access the functions of Smart Contract.What about the events I have emitted on Blockchain?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.