Skip to content

Commit

Permalink
Edited 07smart-contracts-solidity.asciidoc with Atlas code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kristenORM committed Nov 12, 2018
1 parent 5edabf2 commit 2b04adc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 07smart-contracts-solidity.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ Note that you must explicitly add this command to your contract if you want it t

==== Adding a Constructor and selfdestruct to Our Faucet Example

((("constructor function","adding to faucet example")))((("Faucet.sol contract (test example)","adding constructor and selfdestruct to")))((("selfdestruct function")))((("Solidity","adding constructor/selfdestruct to faucet example")))The +Faucet+ example contract we introduced in <<intro_chapter>> does not have any constructor or +selfdestruct+ functions. It is an eternal contract that cannot be deleted. Let's change that, by adding a constructor and +selfdestruct+ function. We probably want +selfdestruct+ to be callable _only_ by the EOA that originally created the contract. By convention, this is usually stored in an address variable called +owner+. Our constructor sets the +owner+ variable, and the +selfdestruct+ function will first check that the owner called it directly.
((("constructor function","adding to faucet example")))((("Faucet.sol contract (test example)","adding constructor and selfdestruct to")))((("Solidity","adding constructor/selfdestruct to faucet example")))The +Faucet+ example contract we introduced in <<intro_chapter>> does not have any constructor or +selfdestruct+ functions. It is an eternal contract that cannot be deleted. Let's change that, by adding a constructor and +selfdestruct+ function. We probably want +selfdestruct+ to be callable _only_ by the EOA that originally created the contract. By convention, this is usually stored in an address variable called +owner+. Our constructor sets the +owner+ variable, and the +selfdestruct+ function will first check that the owner called it directly.

First, our constructor:

Expand Down

0 comments on commit 2b04adc

Please sign in to comment.