Solidity – What Happens to a Token When Its Smart Contract Dies?

contract-developmentsmart-contract-walletssolidity

I don't think I understand the process of minting tokens. As far as I understand, a contract that creates a token has full control and governance over the token (creation, destruction, transactions) any contract that wants to interact with the token will have to interact with the tokens smart contract.

If that assumption is correct, then can I add a selfdestruct method to a tokens contract directly, and if so what happens to its tokens after this method is called?

But if this assumption is incorrect, I'd greatly appreciate being enlightened, and also how are other contracts and wallets able to interact with a token?

Best Answer

As far as I understand, a contract that creates a token has full control and governance over the token (creation, destruction, transactions) any contract that wants to interact with the token will have to interact with the tokens smart contract.

That is correct, it's just that a contract doesn't "create" a token, a token IS a smart contract.

then can I add a selfdestruct method to a tokens contract directly

You can, but it's highly discouraged as 1) For anyone to interact seriously with your token you'll need to verify it and therefore expose the source code. 2) Any token with a potential call to self-destruct or anything potentially sending all the balance to the owner (a rug pull) will never see meaningful activity. Self destruct has nothing to do in a token, and actually has nothing to do on a blockchain, it's likely that it will be neutralized in the near future.

if so what happens to its tokens after this method is called?

Self destruct will forward all the contract balance to a specific address, and then the contract code and storage will be cleared. So no more interaction will be possible.

You can put selfdestruct in a token contract, but don't. It's a strong sign of bad practice / design at best, and a honeypot at worst.

Related Topic