From 47f49bc28b4546ecbb114e43cdd7ab3378bc1913 Mon Sep 17 00:00:00 2001 From: Anton Alekseev Date: Tue, 10 Apr 2018 21:12:03 +0300 Subject: Fix dead link to style guide, mention Emacs mode --- solidity.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index a0f8cd40..6174286c 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -829,7 +829,6 @@ someContractAddress.callcode('function_name'); ## Additional resources - [Solidity Docs](https://solidity.readthedocs.org/en/latest/) - [Smart Contract Best Practices](https://github.com/ConsenSys/smart-contract-best-practices) -- [Solidity Style Guide](https://ethereum.github.io/solidity//docs/style-guide/): Ethereum's style guide is heavily derived from Python's [pep8](https://www.python.org/dev/peps/pep-0008/) style guide. - [EthFiddle - The JsFiddle for Solidity](https://ethfiddle.com/) - [Browser-based Solidity Editor](https://remix.ethereum.org/) - [Gitter Solidity Chat room](https://gitter.im/ethereum/solidity) @@ -850,9 +849,10 @@ someContractAddress.callcode('function_name'); - [Hacking Distributed Blog](http://hackingdistributed.com/) ## Style -- Python's [PEP8](https://www.python.org/dev/peps/pep-0008/) is used as the baseline style guide, including its general philosophy +- [Solidity Style Guide](http://solidity.readthedocs.io/en/latest/style-guide.html): Ethereum's style guide is heavily derived from Python's [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide. ## Editors +- [Emacs Solidity Mode](https://github.com/ethereum/emacs-solidity) - [Vim Solidity](https://github.com/tomlion/vim-solidity) - Editor Snippets ([Ultisnips format](https://gist.github.com/nemild/98343ce6b16b747788bc)) -- cgit v1.2.3 From 6bdff7f79ac9d561763840ecf9554147a1a8ac4d Mon Sep 17 00:00:00 2001 From: Chris Zimmerman Date: Mon, 8 Oct 2018 12:09:51 -0400 Subject: Adds deprecation reminder for constant modifier in Solidity English documentation. --- solidity.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index 004c225e..c0074b33 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -111,6 +111,7 @@ contract SimpleBank { // CapWords /// @return The balance of the user // 'constant' prevents function from editing state variables; // allows function to run locally/off blockchain + // NOTE: 'constant' on functions is an alias to 'view', but this is deprecated and is planned to be dropped in version 0.5.0. function balance() constant public returns (uint) { return balances[msg.sender]; } -- cgit v1.2.3 From 067a5df121f3541539321a2a9f32713fd5ebb0f2 Mon Sep 17 00:00:00 2001 From: Bhoomtawath Plinsut Date: Tue, 27 Feb 2018 17:29:12 +0700 Subject: Fix solidity --- solidity.html.markdown | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index c0074b33..f654b470 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -109,10 +109,9 @@ contract SimpleBank { // CapWords /// @notice Get balance /// @return The balance of the user - // 'constant' prevents function from editing state variables; + // 'view' (ex: constant) prevents function from editing state variables; // allows function to run locally/off blockchain - // NOTE: 'constant' on functions is an alias to 'view', but this is deprecated and is planned to be dropped in version 0.5.0. - function balance() constant public returns (uint) { + function balance() view public returns (uint) { return balances[msg.sender]; } } @@ -342,25 +341,26 @@ function increment(uint x, uint y) returns (uint x, uint y) { // Call previous functon uint (a,b) = increment(1,1); -// 'constant' (alias for 'view') +// 'view' (alias for 'constant') // indicates that function does not/cannot change persistent vars -// Constant function execute locally, not on blockchain +// View function execute locally, not on blockchain +// Noted: constant keyword will soon be deprecated. uint y = 1; -function increment(uint x) constant returns (uint x) { +function increment(uint x) view returns (uint x) { x += 1; y += 1; // this line would fail - // y is a state variable, and can't be changed in a constant function + // y is a state variable, and can't be changed in a view function } -// 'pure' is more strict than 'constant', and does not +// 'pure' is more strict than 'view' or 'constant', and does not // even allow reading of state vars // The exact rules are more complicated, so see more about -// constant/pure: +// view/pure: // http://solidity.readthedocs.io/en/develop/contracts.html#view-functions // 'Function Visibility specifiers' -// These can be placed where 'constant' is, including: +// These can be placed where 'view' is, including: // public - visible externally and internally (default for function) // external - only visible externally (including a call made with this.) // private - only visible in the current contract -- cgit v1.2.3 From ecf0baab1ce6595b0c944d0b881614d8fd42aef9 Mon Sep 17 00:00:00 2001 From: Divay Prakash Date: Sun, 28 Oct 2018 17:57:02 +0530 Subject: Add author name to contributor section --- solidity.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index f654b470..acf750f7 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -4,6 +4,7 @@ filename: learnSolidity.sol contributors: - ["Nemil Dalal", "https://www.nemil.com"] - ["Joseph Chow", ""] + - ["Bhoomtawath Plinsut", "https://github.com/varshard"] --- Solidity lets you program on [Ethereum](https://www.ethereum.org/), a -- cgit v1.2.3 From a60fa493a2cb58fe730b43afb5102400d5b6cc0f Mon Sep 17 00:00:00 2001 From: Sacricarl <40169256+Sacricarl@users.noreply.github.com> Date: Fri, 23 Nov 2018 16:01:08 +0100 Subject: Add Superblocks Lab IDE to additional resources Added a useful tool for beginners to learn and experiment with when using Solidity --- solidity.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index acf750f7..4ff770eb 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -831,6 +831,7 @@ someContractAddress.callcode('function_name'); ## Additional resources - [Solidity Docs](https://solidity.readthedocs.org/en/latest/) - [Smart Contract Best Practices](https://github.com/ConsenSys/smart-contract-best-practices) +- [Superblocks Lab - Browser based IDE for Solidity](https://lab.superblocks.com/) - [EthFiddle - The JsFiddle for Solidity](https://ethfiddle.com/) - [Browser-based Solidity Editor](https://remix.ethereum.org/) - [Gitter Solidity Chat room](https://gitter.im/ethereum/solidity) -- cgit v1.2.3 From 4d487850893fb52c8345fae25c06822e7f0e3857 Mon Sep 17 00:00:00 2001 From: shooter Date: Tue, 4 Dec 2018 00:21:52 +0800 Subject: Fix: `console.log` is javascript grammer --- solidity.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index 4ff770eb..a545f3ce 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -237,7 +237,7 @@ uint x[][5]; // arr with 5 dynamic array elements (opp order of most languages) // Dictionaries (any type to any other type) mapping (string => uint) public balances; balances["charles"] = 1; -console.log(balances["ada"]); // is 0, all non-set key values return zeroes +// balances["ada"] is 0, all non-set key values return zeroes // 'public' allows following from another contract contractName.balances("charles"); // returns 1 // 'public' created a getter (but not setter) like the following: -- cgit v1.2.3 From 484e1325ef5c1cda1298b82c64252405e57d6a98 Mon Sep 17 00:00:00 2001 From: shooter Date: Tue, 4 Dec 2018 00:25:57 +0800 Subject: Javascript code mixes with Solidity code, not good --- solidity.html.markdown | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index a545f3ce..d3f70623 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -403,8 +403,12 @@ event LogSent(address indexed from, address indexed to, uint amount); // note ca // Call LogSent(from, to, amount); -// For an external party (a contract or external entity), to watch using -// the Web3 Javascript library: +/** + +For an external party (a contract or external entity), to watch using +the Web3 Javascript library: + +// The following is Javascript code, not Solidity code Coin.LogSent().watch({}, '', function(error, result) { if (!error) { console.log("Coin transfer: " + result.args.amount + @@ -415,6 +419,8 @@ Coin.LogSent().watch({}, '', function(error, result) { "Receiver: " + Coin.balances.call(result.args.to)); } } +**/ + // Common paradigm for one contract to depend on another (e.g., a // contract that depends on current exchange rate provided by another) -- cgit v1.2.3 From 84f9aa47fce4e2ac0b2b22d5077426fe1162b027 Mon Sep 17 00:00:00 2001 From: shooter Date: Tue, 25 Dec 2018 15:05:13 +0800 Subject: update chinese version content --- solidity.html.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index d3f70623..d215180d 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -5,6 +5,7 @@ contributors: - ["Nemil Dalal", "https://www.nemil.com"] - ["Joseph Chow", ""] - ["Bhoomtawath Plinsut", "https://github.com/varshard"] + - ["Shooter", "https://github.com/liushooter"] --- Solidity lets you program on [Ethereum](https://www.ethereum.org/), a @@ -237,7 +238,7 @@ uint x[][5]; // arr with 5 dynamic array elements (opp order of most languages) // Dictionaries (any type to any other type) mapping (string => uint) public balances; balances["charles"] = 1; -// balances["ada"] is 0, all non-set key values return zeroes +// balances["ada"] result is 0, all non-set key values return zeroes // 'public' allows following from another contract contractName.balances("charles"); // returns 1 // 'public' created a getter (but not setter) like the following: -- cgit v1.2.3 From e7a2c6d888c5c5da7db436eed12bac5c41474d73 Mon Sep 17 00:00:00 2001 From: Aldaschwede <32069769+Aldaschwede@users.noreply.github.com> Date: Tue, 6 Aug 2019 17:29:19 +0200 Subject: Update solidity.html.markdown added qualifier payable to the function Info, hence without it's not compileable --- solidity.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'solidity.html.markdown') diff --git a/solidity.html.markdown b/solidity.html.markdown index d215180d..cc719ec7 100644 --- a/solidity.html.markdown +++ b/solidity.html.markdown @@ -483,7 +483,7 @@ for(uint x = 0; x < refundAddressList.length; x++) { // A. Calling external contract contract InfoFeed { - function info() returns (uint ret) { return 42; } + function info() payable returns (uint ret) { return 42; } } contract Consumer { -- cgit v1.2.3