aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/contracts.rst8
-rw-r--r--docs/control-structures.rst2
-rw-r--r--docs/index.rst9
-rw-r--r--docs/miscellaneous.rst65
-rw-r--r--docs/style-guide.rst2
-rw-r--r--docs/types.rst6
6 files changed, 83 insertions, 9 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index c02c1490..3d592ecf 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -23,6 +23,9 @@ name as the contract) is executed once.
From ``web3.js``, i.e. the JavaScript
API, this is done as follows::
+ // Need to specify some source including contract name for the data param below
+ var source = "contract CONTRACT_NAME { function CONTRACT_NAME(unit a, uint b) {} }";
+
// The json abi array generated by the compiler
var abiArray = [
{
@@ -41,7 +44,8 @@ API, this is done as follows::
}
];
- var MyContract = web3.eth.contract(abiArray);
+ var MyContract_ = web3.eth.contract(source);
+ MyContract = web3.eth.contract(MyContract_.CONTRACT_NAME.info.abiDefinition);
// deploy new contract
var contractInstance = MyContract.new(
10,
@@ -85,7 +89,7 @@ This means that cyclic creation dependencies are impossible.
// Only the creator can alter the name --
// the comparison is possible since contracts
// are implicitly convertible to addresses.
- if (msg.sender == creator)
+ if (msg.sender == address(creator))
name = newName;
}
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index f30a5bdd..9d7ebeac 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -113,7 +113,7 @@ The evaluation order of expressions is not specified (more formally, the order
in which the children of one node in the expression tree are evaluated is not
specified, but they are of course evaluated before the node itself). It is only
guaranteed that statements are executed in order and short-circuiting for
-boolean expressions is done.
+boolean expressions is done. See :ref:`order` for more information.
.. index:: ! assignment
diff --git a/docs/index.rst b/docs/index.rst
index 940fe5e7..5ca5c4a9 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -38,9 +38,6 @@ Available Solidity Integrations
* `Visual Studio Extension <https://visualstudiogallery.msdn.microsoft.com/96221853-33c4-4531-bdd5-d2ea5acc4799/>`_
Solidity plugin for Microsoft Visual Studio that includes the Solidity compiler.
-* `Mix IDE <https://github.com/ethereum/mix/>`_
- Qt based IDE for designing, debugging and testing solidity smart contracts.
-
* `Package for SublimeText — Solidity language syntax <https://packagecontrol.io/packages/Ethereum/>`_
Solidity syntax highlighting for SublimeText editor.
@@ -59,6 +56,12 @@ Available Solidity Integrations
* `Vim Solidity <https://github.com/tomlion/vim-solidity/>`_
Plugin for the Vim editor providing syntax highlighting.
+Discontinued:
+
+* `Mix IDE <https://github.com/ethereum/mix/>`_
+ Qt based IDE for designing, debugging and testing solidity smart contracts.
+
+
Solidity Tools
-------------------------------
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 9b067fb1..304fce14 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -130,7 +130,7 @@ index mentioned above.
The encoding in the source mapping for the bytecode is more complicated:
It is a list of ``s:l:f:j`` separated by ``;``. Each of these
elements corresponds to an instruction, i.e. you cannot use the byte offset
-but have to use the instruction offset or PC (program counter).
+but have to use the instruction offset (push instructions are longer than a single byte).
The fields ``s``, ``l`` and ``f`` are as above and ``j`` can be either
``i``, ``o`` or ``-`` signifying whether a jump instruction goes into a
function, returns from a function or is a regular jump as part of e.g. a loop.
@@ -202,6 +202,69 @@ Tips and Tricks
Cheatsheet
**********
+.. index:: precedence
+
+.. _order:
+
+Order of Precedence of Operators
+================================
+
+The following is the order of precedence for operators, listed in order of evaluation.
+
++------------+-------------------------------------+--------------------------------------------+
+| Precedence | Description | Operator |
++============+=====================================+============================================+
+| *1* | Postfix increment and decrement | ``++``, ``--`` |
++ +-------------------------------------+--------------------------------------------+
+| | Function-like call | ``<func>(<args...>)`` |
++ +-------------------------------------+--------------------------------------------+
+| | Array subscripting | ``<array>[<index>]`` |
++ +-------------------------------------+--------------------------------------------+
+| | Member access | ``<object>.<member>`` |
++ +-------------------------------------+--------------------------------------------+
+| | Parentheses | ``(<statement>)`` |
++------------+-------------------------------------+--------------------------------------------+
+| *2* | Prefix increment and decrement | ``++``, ``--`` |
++ +-------------------------------------+--------------------------------------------+
+| | Unary plus and minus | ``+``, ``-`` |
++ +-------------------------------------+--------------------------------------------+
+| | Unary operations | ``after``, ``delete`` |
++ +-------------------------------------+--------------------------------------------+
+| | Logical NOT | ``!`` |
++ +-------------------------------------+--------------------------------------------+
+| | Bitwise NOT | ``~`` |
++------------+-------------------------------------+--------------------------------------------+
+| *3* | Exponentiation | ``**`` |
++------------+-------------------------------------+--------------------------------------------+
+| *4* | Multiplication, division and modulo | ``*``, ``/``, ``%`` |
++------------+-------------------------------------+--------------------------------------------+
+| *5* | Addition and subtraction | ``+``, ``-`` |
++------------+-------------------------------------+--------------------------------------------+
+| *6* | Bitwise shift operators | ``<<``, ``>>`` |
++------------+-------------------------------------+--------------------------------------------+
+| *7* | Bitwise AND | ``&`` |
++------------+-------------------------------------+--------------------------------------------+
+| *8* | Bitwise XOR | ``^`` |
++------------+-------------------------------------+--------------------------------------------+
+| *9* | Bitwise OR | ``|`` |
++------------+-------------------------------------+--------------------------------------------+
+| *10* | Inequality operators | ``<``, ``>``, ``<=``, ``>=`` |
++------------+-------------------------------------+--------------------------------------------+
+| *11* | Equality operators | ``==``, ``!=`` |
++------------+-------------------------------------+--------------------------------------------+
+| *12* | Logical AND | ``&&`` |
++------------+-------------------------------------+--------------------------------------------+
+| *13* | Logical OR | ``||`` |
++------------+-------------------------------------+--------------------------------------------+
+| *14* | Ternary operator | ``<conditional> ? <if-true> : <if-false>`` |
++------------+-------------------------------------+--------------------------------------------+
+| *15* | Assignment operators | ``=``, ``|=``, ``^=``, ``&=``, ``<<=``, |
+| | | ``>>=``, ``+=``, ``-=``, ``*=``, ``/=``, |
+| | | ``%=`` |
++------------+-------------------------------------+--------------------------------------------+
+| *16* | Comma operator | ``,`` |
++------------+-------------------------------------+--------------------------------------------+
+
.. index:: block, coinbase, difficulty, number, block;number, timestamp, block;timestamp, msg, data, gas, sender, value, now, gas price, origin, sha3, ripemd160, sha256, ecrecover, addmod, mulmod, cryptography, this, super, selfdestruct, balance, send
Global Variables
diff --git a/docs/style-guide.rst b/docs/style-guide.rst
index 99db8147..c509a9d4 100644
--- a/docs/style-guide.rst
+++ b/docs/style-guide.rst
@@ -640,7 +640,7 @@ words. (for example:``MAX_BLOCKS``)
Modifiers
=========
-Function modifiers should use lowercase words separated by underscores.
+Use mixedCase.
Avoiding Collisions
diff --git a/docs/types.rst b/docs/types.rst
index 50e86ed0..35f0e247 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -12,6 +12,9 @@ see :ref:`type-deduction` below) at
compile-time. Solidity provides several elementary types which can be combined
to form complex types.
+In addition, types can interact with each other in expressions containing
+operators. For a quick reference of the various operators, see :ref:`order`.
+
.. index:: ! value type, ! type;value
Value Types
@@ -542,7 +545,8 @@ shown in the following example:
Campaign c = campaigns[campaignID];
if (c.amount < c.fundingGoal)
return false;
- c.beneficiary.send(c.amount);
+ if (!c.beneficiary.send(c.amount))
+ throw;
c.amount = 0;
return true;
}