Skip to content

SelfDestructible

Description

SelfDestructible allows an inheriting contract to be destroyed by its owner, who must announce an intention to destroy it, and then wait for a four week cooling-off period before it can be destroyed. Any ether remaining in the contract at this time is forwarded to a nominated beneficiary.

Source: SelfDestructible.sol

Architecture


Inheritance Graph

SelfDestructible inheritance graph


Variables


initiationTime

The timestamp at which the self destruction was begun.

Type: uint public


selfDestructInitiated

True iff the contract is currently undergoing self destruction.

Type: bool public


selfDestructBeneficiary

The address where any lingering eth in this contract will be sent.

Type: address public


SELFDESTRUCT_DELAY

The duration (four weeks) that must be waited between self destruct initiation and actual destruction. That is the contract can only be destroyed after the timestamp initiationTime + SELFDESTRUCT_DELAY.

Type: uint public constant

Value: 4 weeks


Functions


constructor

Initialises the inherited Owned instance and nominates that owner as the initial self destruct beneficiary.

Details

Signature

constructor(address _owner) public

Superconstructors

Preconditions

  • The provided owner must not be the zero address.

Emits


setSelfDestructBeneficiary

Changes the self destruct beneficiary.

Details

Signature

setSelfDestructBeneficiary(address _beneficiary) external

Modifiers

Preconditions

  • The provided beneficiary must not be the zero address.

Emits


initiateSelfDestruct

Begins the self destruct countdown, updating initiationTime and selfDestructInitiated. Only once the delay has elapsed can the contract be destroyed.

Details

Signature

initiateSelfDestruct() external

Modifiers

Emits


terminateSelfDestruct

Resets the timer and disables self destruction.

Details

Signature

terminateSelfDestruct() external

Modifiers

Emits


selfDestruct

If self destruction is active and the timer has elapsed, destroy this contract and forward its ether to selfDestructBeneficiary.

Details

Signature

selfDestruct() external

Modifiers

Preconditions

Emits

Events


SelfDestructTerminated

Self destruction was terminated by the contract owner.

Signature: SelfDestructTerminated()


SelfDestructed

The contract was destroyed, forwarding the ether on to the beneficiary.

Signature: SelfDestructed(address beneficiary)


SelfDestructInitiated

Self destruction was initiated with the indicated delay time.

Signature: SelfDestructInitiated(uint selfDestructDelay)


SelfDestructBeneficiaryUpdated

The self destruct beneficiary was changed to the indicated new address.

Signature: SelfDestructBeneficiaryUpdated(address newBeneficiary)