1

I'm just wondering what would happen if I don't put a selfdestrut() method in my smart contract.

As I read from the Solidity documentation (Self-destruct):

Even if a contract’s code does not contain a call to selfdestruct, it can still perform that operation using delegatecall or callcode.

But... does it mean that anyone could call selfdestruct() to any contract?

2

No, means that if you use delegate call in your contract and the code at the target address contains a line with selfdestruct(someaddress), this code will be executed in your contract context, effectively destroying your contract.

This means you should be careful when using delegatecall and only use it in contracts that you wrote or that you know well.

Hope this helps

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.