From 8603b05fcdbb8322433bcb3581b69fdf1a8dd5c5 Mon Sep 17 00:00:00 2001 From: Rob Stupay Date: Wed, 18 Sep 2019 17:53:30 +0200 Subject: [PATCH] update to docs --- FAQ.md | 7 ----- docs/FAQ.md | 71 ++++++++++++++++++++++++++++++++++---------------- docs/index.rst | 3 ++- docs/run.md | 33 +++++++++++++---------- docs/udapp.md | 22 ++++------------ 5 files changed, 74 insertions(+), 62 deletions(-) delete mode 100644 FAQ.md diff --git a/FAQ.md b/FAQ.md deleted file mode 100644 index 45699ea48b..0000000000 --- a/FAQ.md +++ /dev/null @@ -1,7 +0,0 @@ -**Q: compiler might be in a non-sane state** -``error: "Uncaught JavaScript exception: RangeError: Maximum call stack size exceeded. -The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet. -It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected)."`` - -**A: Old versions of solidity compiler had this problem with chrome.** -Please change the compiler version in Solidity Plugin to the newer one or use another browser. diff --git a/docs/FAQ.md b/docs/FAQ.md index 384daf4737..a27a8fdf3a 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -1,53 +1,78 @@ -**Q:** There is an error about that the compiler might be in a non-sane state. +FAQ +=== + +### Solidity compiler + +**Q: Error: compiler might be in a non-sane state** ``` -error: Uncaught JavaScript exception: RangeError: Maximum call stack size exceeded. +error: "Uncaught JavaScript exception: RangeError: Maximum call stack size exceeded. The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet. -It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected). +It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected)." ``` **A:** Old versions of solidity compiler had this problem with chrome. Please change the compiler version in Solidity Plugin to the newer one or use another browser. +**Q:** I’m getting an issue with Maximum call stack exceed and various other errors, can't compile. + +**A:** Try a different browser or a newer solidity compiler version. + +### Deploy & Run **Q:** I am using an Infura endpoint in my app, but when I try to deploy against that endpoint in remix IDE selecting "web3 provider" and putting my endpoint in, it's telling me that it can't connect **A:** If the endpoint you are using is http, it won't work. - **Q:** Where is deploy button? -**A:** You should activate Deploy & Run module in the Plugin Manager. -Or you can activate everything you need to work with solidity from "Home" -> "Solidity" environment. - +**A:** Its in the Deploy & Run module. If you haven't activated that module, you should do that by clicking Deploy & Run module in the Plugin Manager. +You could also activate everything you need to work with solidity on the landing page ( click the remix logo at the top left for the screen) and click the "Solidity" button in the environment section. **Q:** How to pass a tuple to a public function in Remix? -**A:** Pass it as an array. -**Q:** How to pass a tuple to a public function in Remix? -**A: Pass it as an array. +**A:** Pass it as an array []. **Q:** How to input a struct as input to a parameter of a function in the Deploy & Run module? -**A:** For inputting a struct, the easiest way is to use array [] -If the struct members have names, using js object should work {name: value, name1: value} +**A:** For inputting a struct, just like a tuple, pass it in as an array []. Also you need to put in the line: + +`pragma experimental ABIEncoderV2;` at the top of the solidity file. -For example, if the struct is: +For example, here's a solidity file with a struct is an input parameter. ``` -struct r -{ - string t, - uint r +pragma solidity >=0.4.22 <0.6.0; +pragma experimental ABIEncoderV2; + +contract daPeeps { + struct Peep {uint a; uint b;} // declaration of Peep type + Peep peep; //declaration of an object of Peep type + + constructor () public + { + peep.a = 0; // definition/initialisation of object + peep.b = 0; // + } + + function initPeepToPeep(Peep memory i) public payable { + peep.a = i.a; + peep.b = i.b; + } + function setPeep(uint a, uint b) public payable { + peep.a = a; + peep.b = b; + } + + function getPeep() public view returns(Peep memory) + { + return peep; + } } ``` -You can use: - -["this is a string", 23] - -NOTE: - So is there fixed order in Structs - like in mappings? By not writing the names of the members, we update the values by the order in the array. +The input of initPeepToPeeps takes a struct. If you input +`[1,2]` the transaction will go through. -Also you need to use ABIEncoderV2 (**where is this?**). diff --git a/docs/index.rst b/docs/index.rst index 2567a9d62a..adc9ae3688 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -60,6 +60,7 @@ Useful links: contract_metadata create_deploy tutorial_debug + FAQ import remix_commands remixd @@ -79,7 +80,7 @@ Useful links: .. toctree:: :maxdepth: 2 - :caption: Tutorials and workshops slides + :caption: Tutorials and workshops remix_tutorials_github diff --git a/docs/run.md b/docs/run.md index fe35b8b466..ccbabdcdf7 100644 --- a/docs/run.md +++ b/docs/run.md @@ -77,28 +77,34 @@ contract will popup below. Using the Recorder ------------------ -The Recorder allows to you to save a bunch of transactions in a JSON file and +The Recorder is a tool used to save a bunch of transactions in a JSON file and rerun them later either in the same environment or in another. -You can also update the file adjust the transaction list, tweak input -parameters, change linked library, etc... +Saving to the JSON file ( by default its called senario.json) allows one to easily check the transaction list, tweak input parameters, change linked library, etc... + +There are many use cases for the recorder. + +For instance: -There are many use cases for the recorder, for instance: - After having coded and tested contracts in a constrained - environment (like the JavaScript VM), you can easily - redeploy them in a more persisted environment (like a - Geth node) in order to check whether everything behaves normally - in a classic environment. + environment (like the JavaScript VM), you could then change the environment and redeploy it to a more realistic environment like a test net with an **injected web3** or to a Geth node. By using the generated **senario.json** file, you will be using all the same settings that you used in the Javascript VM. And this mean that you won't need to click the interface 100 times or whatever to get the state that you achieved originally. So the recorder could be a tool to protect your sanity. + + You can also change the settings in the senario.json file to customize the playback. + - Deploying contract does often require more than creating one - transaction. ( **note: is this point needed?**) -- Working in a dev environment often requires setting up the - state in a first place. ( **note: is this saying - After testing in on the JsVM, quickly deploying another environment in a controlled fashion. **) + transaction and so the recorder will automate this deployment. + +- Working in a dev environment often requires to setup the + state in a first place. ![](images/a-runtab-recorder.png) -To save some transactions click on the floppy disc icon. A file called senario.json will be written and saved in the file explorer. +### senario.json +To create this file in the recorder, you first of course need to have run some transactions. In the image above - it has a `0` next to **Transactions Recorded**. So this isn't the right moment to save transactions because - well because there aren't any. Each time you make a transaction, that number will increment. Then when you are ready, click the floppy disk icon and the senario.json file will be created. + +The JSON file below is an example of the senario.json file. -Below is an example of this file where 3 transactions are executed: +In it, 3 transactions are executed: The first corresponds to the deployment of the lib `testLib`. @@ -118,7 +124,6 @@ All these transactions are created using the value of the accounts `account{0}`. ``` -{.sourceCode .none} { "accounts": { "account{0}": "0xca35b7d915458ef540ade6068dfe2f44e8fa733c" diff --git a/docs/udapp.md b/docs/udapp.md index d3dbb4cfa9..bb74796e3d 100644 --- a/docs/udapp.md +++ b/docs/udapp.md @@ -55,22 +55,10 @@ Clicking the clipboard icon will encode the inputs and will copy them. Only a v So if you made a mistake and put a uint8 where an address should have been, clicking the clipboard here will give you an error. +### Passing in a tuple or a struct to a function +To pass a tuple in, you need to put in an an array []. -### Inputting structs in the expanded view -For inputting a struct, the easiest way is to use array [] +Similarly, to pass in a struct as a parameter of a function, it needs to be put in as an array []. Also note that the line +`pragma experimental ABIEncoderV2;` +needs to put in at the top of the solidity file. -If the struct members have names, using js object should work {name: value, name1: value} - -For example, if the struct is: - -``` -struct r -{ - string t, - uint r -} -``` - -You can use: - -["this is a string", 23]