2
  1. What is the exact signature of selfdestruct? (parameters, return type, ..). I couldn't find it. Where can I find it by my self?

  2. Does the address given to selfdestruct is used to send the remaining ethers of the deleted contract to?

  3. Does solidity authorized anyone (any EOA or any contract) to call selfdestruct on any contract (does it mean that I can delete uniswap? I guess not, so what are the rules?).

  4. Is there a way to disable future calls to selfdestruct on my contract from my self or other parties?

  5. What are the best practices of selfdestruct?

1 Answer 1

3

What is the exact signature of selfdestruct? (parameters, return type, ..). I couldn't find it. Where can I find it by my self?

You can refer to the official solidity doc here : https://docs.soliditylang.org/en/latest/units-and-global-variables.html#contract-related

Does the address given to selfdestruct is used to send the remaining ethers of the deleted contract to?

Exactly

Does solidity authorized anyone (any EOA or any contract) to call selfdestruct on any contract (does it mean that I can delete uniswap? I guess not, so what are the rules?).

selfdestruct is optional, you can have contracts that doesn't include selfdestruct and most of them doesn't. If theory if you create a function that calls selfdestruct on your contracts, if there is no access control ( e.g, onlyOwner) anyone (EOA or not) can call it.

Is there a way to disable future calls to selfdestruct on my contract from my self or other parties?

As mentioned you can either not implement selfdestruct to your contract, or you can protect it to make sure only specific user(s) can call it.

What are the best practices of selfdestruct?

selfdestruct is being deprecated. I don't recommend you to use it. https://eips.ethereum.org/EIPS/eip-4758

1
  • Excellent! Thank you!
    – Stav Alfi
    Mar 24, 2023 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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