diff options
author | Nemil Dalal <nemild@gmail.com> | 2015-11-30 16:51:53 -0500 |
---|---|---|
committer | Nemil Dalal <nemild@gmail.com> | 2015-11-30 16:51:53 -0500 |
commit | add8f68f1acdceca1b9e09d6458627c515e73047 (patch) | |
tree | e273d46dd1dd6bc6774f8a13cc5d8e8e1173bc2a /solidity.html.markdown | |
parent | 8ef890b0de22d9fd14572f4ac171a238ea4f3f20 (diff) |
Add exposition around example bank
Diffstat (limited to 'solidity.html.markdown')
-rw-r--r-- | solidity.html.markdown | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/solidity.html.markdown b/solidity.html.markdown index 2b461a95..77648e51 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -13,6 +13,10 @@ As Solidity and Ethereum are under active development, experimental or beta feat ```javascript // Let's start with a simple Bank contract, before diving into to the key components of the language +// This bank has three main capabilities: +// - deposit +// - withdrawal +// - check balance // ** START EXAMPLE ** // Start with a Natspec comment (the three slashes) that can be used @@ -57,14 +61,6 @@ contract AcmeBank { } } - // It's good practice to have a remove function, which disables this - // contract - but does mean that users have to trust the owner - function remove() { - if(msg.sender == owner) { // Only let the contract creator do this - suicide(owner); // suicide makes this contract inactive, and returns funds to the owner - } - } - // The 'constant' prevents the function from editing state variables function balance() constant { return balances[msg.sender]; @@ -406,6 +402,14 @@ function remove() { // - crowdfunding? // - Peer to peer insurance // ] + // It's good practice to have a remove function, which disables this + // contract - but does mean that users have to trust the owner + // For a decentralized bank without a trusted part + function remove() { + if(msg.sender == owner) { // Only let the contract creator do this + suicide(owner); // suicide makes this contract inactive, and returns funds to the owner + } + } // *** END EXAMPLE *** |