summaryrefslogtreecommitdiffhomepage
path: root/solidity.html.markdown
diff options
context:
space:
mode:
authorMarcel Ribeiro Dantas <ribeirodantasdm@gmail.com>2022-08-02 14:55:06 +0200
committerGitHub <noreply@github.com>2022-08-02 14:55:06 +0200
commitda4c77d05b43b0f2384f58701e2fc667571c1bbf (patch)
tree2b8ae47bbcb934cc157f1e4bc6781e85456db3c4 /solidity.html.markdown
parent82134b0c2e8fdc9c6587642d76d3e85aca07117a (diff)
parent23be2f300cfab96e455e2403d8364dfc9ed35037 (diff)
Merge pull request #4465 from al-ias/fix/solidity
[solidity] Solidity minor fixes
Diffstat (limited to 'solidity.html.markdown')
-rw-r--r--solidity.html.markdown18
1 files changed, 9 insertions, 9 deletions
diff --git a/solidity.html.markdown b/solidity.html.markdown
index c52d2002..d40536b4 100644
--- a/solidity.html.markdown
+++ b/solidity.html.markdown
@@ -278,7 +278,7 @@ f(22); // call
// Delete can be called on most types
// (does NOT destroy value, but sets value to 0, the initial value)
-uint x = 5;
+delete x;
// Destructuring/Tuples
@@ -388,7 +388,7 @@ block.gasLimit();
storage['abc'] = 'def'; // maps 256 bit words to 256 bit words
-// 4. FUNCTIONS AND MORE
+// 5. FUNCTIONS AND MORE
// A. Functions
// Simple function
function increment(uint x) returns (uint) {
@@ -435,7 +435,7 @@ function increment(uint x) view returns (uint x) {
// Functions hoisted - and can assign a function to a variable
function a() {
var z = b;
- b();
+ z();
}
function b() {
@@ -494,9 +494,9 @@ Coin.LogSent().watch({}, '', function(error, result) {
// '_' (underscore) often included as last line in body, and indicates
// function being called should be placed there
modifier onlyAfter(uint _time) { require (now >= _time); _; }
-modifier onlyOwner { require(msg.sender == owner) _; }
+modifier onlyOwner { require(msg.sender == owner); _; }
// commonly used with state machines
-modifier onlyIfStateA (State currState) { require(currState == State.A) _; }
+modifier onlyIfStateA (State currState) { require(currState == State.A); _; }
// Append right after function declaration
function changeOwner(newOwner)
@@ -646,7 +646,7 @@ reveal(100, "mySecret");
// All data to start of time is stored in blockchain, so
// anyone can observe all previous data and changes
-// E. Oracles and External Data
+// D. Oracles and External Data
// Oracles are ways to interact with your smart contracts outside the blockchain.
// They are used to get data from the real world, send post requests, to the real world
// or vise versa.
@@ -671,12 +671,12 @@ reveal(100, "mySecret");
// Setting up oracle networks yourself
-// D. Cron Job
+// E. Cron Job
// Contracts must be manually called to handle time-based scheduling; can create external
// code to regularly ping, or provide incentives (ether) for others to
//
-// E. Observer Pattern
+// F. Observer Pattern
// An Observer Pattern lets you register as a subscriber and
// register a function which is called by the oracle (note, the oracle pays
// for this action to be run)
@@ -714,7 +714,7 @@ contract SomeOracle {
// Now, your client contract can addSubscriber by importing SomeOracleCallback
// and registering with Some Oracle
-// F. State machines
+// G. State machines
// see example below for State enum and inState modifier
```