1

If I create a smart contract and coin, can I for example some day close the contract and these coins are useless or can not be used for example? Is it possible or not?

  • Yes, you can implement a pausable token, or just suicide the contract – Raghav Sood Aug 14 '18 at 15:02
  • and if for example one exchanger is still my token listed and i suicide the token; close it and pause it, or like you say destruct completely the token what will happen with the tokens listed on the exchanger, he can still trade these tokens? – Perl Aug 14 '18 at 15:11
  • They can trade within the exchange, but no withdrawals or deposits will be possible. Any sane exchange would delist you if that happens. – Raghav Sood Aug 14 '18 at 15:16
2

The Open-Zeppelin library for Solidity has a few life-cycle contracts which handle scenarios like the one you describe. You can find them all here:

https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/contracts/lifecycle

Destructible.sol

This is the one that most closely resembles what you are looking to do, and supports two functions:

function destroy() public onlyOwner {
  selfdestruct(owner);
}

function destroyAndSend(address _recipient) public onlyOwner {
  selfdestruct(_recipient);
}

First it takes advantage of another Open-Zeppelin library called Ownable.sol which allows a contract to have a specified address as the owner of the contract. By default, it is the contract creator.

Then Destructible.sol enables the owner to specifically destroy the contract, either sending any remaining ETH balance to themselves or a specific recipient.

1

If the contract supports such functionality, then yes.

You basically have two options:

1) Write code to deny usage of the contract based on some criteria. For example you can write a function which, when called, disables all other functionality in the contract.

2) Implement a self destruct function in the contract. This will remove the contract and it can no longer be used after that. This is the hammer approach and not very...subtle. Details here: http://solidity.readthedocs.io/en/v0.4.24/introduction-to-smart-contracts.html#self-destruct

  • and if for example one exchanger is still my token listed and i suicide the token; close it and pause it, or like you say destruct completely the token what will happen with the tokens listed on the exchanger, he can still trade these tokens? – Perl Aug 14 '18 at 15:11
  • Please don't double-post your questions. This was answered above. – Lauri Peltonen Aug 14 '18 at 15:23

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.