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: contracts/SelfDestructible.sol

Architecture

Inheritance Graph

graph TD SelfDestructible[SelfDestructible] --> Owned[Owned]

Constants

SELFDESTRUCT_DELAY

Source

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.

Value: 4 weeks

Type: uint256

Variables

initiationTime

Source

The timestamp at which the self destruction was begun.

Type: uint256

selfDestructBeneficiary

Source

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

Type: address

selfDestructInitiated

Source

True iff the contract is currently undergoing self destruction.

Type: bool

Constructor

constructor

Source

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

Details

Signature

()

Visibility

internal

State Mutability

nonpayable

Requires

Emits

Restricted Functions

initiateSelfDestruct

Source

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

Details

Signature

initiateSelfDestruct()

Visibility

external

State Mutability

nonpayable

Modifiers

Emits

selfDestruct

Source

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

Details

Signature

selfDestruct()

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

setSelfDestructBeneficiary

Source

Changes the self destruct beneficiary.

Details

Signature

setSelfDestructBeneficiary(address payable _beneficiary)

Visibility

external

State Mutability

nonpayable

Requires

Modifiers

Emits

terminateSelfDestruct

Source

Resets the timer and disables self destruction.

Details

Signature

terminateSelfDestruct()

Visibility

external

State Mutability

nonpayable

Modifiers

Emits

Events

SelfDestructBeneficiaryUpdated

Source

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

Signature: SelfDestructBeneficiaryUpdated(address newBeneficiary)

SelfDestructInitiated

Source

Self destruction was initiated with the indicated delay time.

Signature: SelfDestructInitiated(uint256 selfDestructDelay)

SelfDestructTerminated

Source

Self destruction was terminated by the contract owner.

Signature: SelfDestructTerminated()

SelfDestructed

Source

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

Signature: SelfDestructed(address beneficiary)