Skip to content

Commit

Permalink
Merge pull request #3200 from ethereum/ccg1
Browse files Browse the repository at this point in the history
small updates
  • Loading branch information
ryestew committed May 17, 2024
2 parents 8f6ed5f + 0d6e6e6 commit 1a74f79
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion docs/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AI Tools

Remix has integrated two AI tools:
- ChatGPT
- Solidity Copilot which uses our own LLM (large language model) called Solcoder.
- Remix's Solidity Copilot which uses our own LLM (large language model) called Solcoder.

## Remix's Solidity Copilot
Solidity Copilot helps in writing code using code completion. The switch to activate Solidity Copilot is at the top of the Editor.
Expand Down
8 changes: 4 additions & 4 deletions docs/code_contribution_guide.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Code Contribution Guide
=======================

Remix is an open source tool and we encourage everyone to help us improve it.
Please open issues, give feedback or contribute by a pulling request
to our codebase.
Remix is an open source tool. Please help us improve it by:
- Opening issues in our [GitHub repo](https://github.com/ethereum/remix-project).
- Writing some code and making a pulling request.

The Remix application is built with JavaScript and it doesn't use any frameworks. We rely on a selected set of npm modules, like `yo-yo`, `csjs-inject` among others. Check out the `package.json` files in the Remix submodules to learn more about the stack.
The Remix application is built with Typescript and React.

To learn more, please visit our [GitHub page](https://github.com/ethereum/remix-project).
8 changes: 3 additions & 5 deletions docs/foundry.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
Foundry
============

_(Supported since Remix IDE v0.25.0)_

Foundry Provider
Deploying to Anvil
------------------

**Foundry Provider** is a plugin on Remix IDE which enables users to deploy the contract to the Foundry's built-in **Anvil** blockchain. `Foundry Provider` can be chosen from the list of environments in `Deploy & Run Transactions` plugin.
To deploy to Anvil, Foundry's test chain, it needs to be running on your computer. Then select the **Foundry Provider** in the **Environments** section of the **Deploy & Run** module.

![](images/a-foundry-provider.png)

As soon as you select `Foundry Provider`, a modal is opened asking for the `Anvil JSON-RPC Endpoint`.

![](images/a-foundry-provider-modal.png)

If Foundry Anvil node is running with default options, the default endpoint value in modal will not need any change. In case, Anvil node host and port are different, JSON-RPC endpoint should be updated in the modal text box.
If Foundry Anvil node is running with default options, the default endpoint value in modal doesn't need to be changed. If the Anvil node host and port are different, then the JSON-RPC endpoint should be updated in the modal's text box.

Once the correct endpoint is filled in the modal, just click on `OK` and the accounts from the Anvil node will be loaded in the `ACCOUNT` section. Network id will also be shown.

Expand Down
2 changes: 0 additions & 2 deletions docs/locations.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Remix URLs & Links with Parameters

- Remix Desktop is an Electron App. Here is the [release page](https://github.com/ethereum/remix-desktop/releases).

- Remix has a VSCode extension called [Ethereum Remix](https://marketplace.visualstudio.com/items?itemName=RemixProject.ethereum-remix).

- The Remix twitter account is [EthereumRemix](https://twitter.com/EthereumRemix).

- The Remix Project Medium publication is: [https://medium.com/remix-ide](https://medium.com/remix-ide).
Expand Down
31 changes: 18 additions & 13 deletions docs/running_js_scripts.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
Running Scripts
===============

_JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions._

Remix IDE supports execution of JS scripts.
Remix IDE supports execution of JS & TS scripts.

## Write & Run a script

Create a file with `.js` extension and put your logic inside it. Once ready, there are two ways to run this script:
Create a file with `.js` or `.ts` extension and put your logic inside it. To run a script either:

- Click the green play button in the upper left of the Editor.

- Right click on the script name in the `File Explorers` and click on the **Run** option.

1. Make the script the active file in the editor and run `remix.exeCurrent()` from Remix terminal
2. Just right click on the script name in the `Files Explorers` plugin and click on the **Run** option. **ShortCut**: `Ctrl+Shift+S` when the script is displayed in the editor.
- `Ctrl+Shift+S` when the script is displayed in the editor.

Here is a sample script:
- Make the script the active file in the editor and run `remix.exeCurrent()` from Remix terminal

Here is a sample .js script:

```
function test() {
Expand All @@ -30,7 +33,7 @@ Running it using one of options mentioned above will show result in Remix termin

![](images/a-running-scripts-run.png)

## Why run JavaScript Scripts in Remix?
## Why run scripts in Remix?
* To mimic how the front-end of your dapp will use web3.js or ethers.js
* To quickly deploy and interact with a bunch of instances of a contract without going through the Remix GUI.
* To run some tests on a previous deployed contract.
Expand All @@ -50,14 +53,14 @@ Remix accepts async/await scripts to run [web3.js](https://web3js.readthedocs.io
## JS Scripts in the File Explorers
In the **scripts** folder of a **workspace**, there are 2 example files: one using **web3.js** and the other using **ethers.js**.

## Compile a contract and run a script on the fly
It is often convenient when drafting a contract to run a script just after the compilation succeeded.
## Compile a contract and run a script in one click
When drafting a contract, it can be helpful to run a script just after the compilation succeeds.

That way one can quickly deploy and call several contracts in order to set them in a desired state for testing purpose.
With this technique, one can write some code then quickly deploy and set the state of the contracts.

Also if the script contains Mocha tests, those will also be run.
The script can contains Mocha tests to be run.

In order to do so, add the NatSpec tag `@custom:dev-run-script` to the contract followed by the absolute file path, like:
In order to connect a contract with a script, add the **NatSpec** tag `@custom:dev-run-script` to the contract followed by the absolute file path, like:

```code
/**
Expand All @@ -68,6 +71,8 @@ In order to do so, add the NatSpec tag `@custom:dev-run-script` to the contract
contract ContractName {}
```

When you are ready to deploy the code for real, remove the NatSpec comment `@custom:dev-run-script`.

**ShortCut**: `Ctrl+Shift+S` , when editing a solidity file, will compile that file and then will run the script. In contrast, Ctrl+S will only start the compiling.

## An Example Script
Expand Down
22 changes: 11 additions & 11 deletions docs/unittesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ Click the
![](images/a-user-testing-icon.png) (double check)
icon from icon bar to move to the `Solidity Unit Testing` plugin.

If you haven't used this plugin before and are not seeing `double check` icon, you have to activate it from Remix plugin manager.
If you haven't used this plugin before and are not seeing the `double check` icon, you have to activate it from Remix plugin manager.

Go to the plugin manager by clicking the ![](images/a-plug.png) (plug) icon and activate `Solidity Unit Testing` plugin.

![](images/a-unit-testing-from-pm.png)

Now `double check` icon will appear on the left side icon bar. Clicking on icon will load the plugin in the side panel.
Now the `double check` icon will appear on the left side icon bar. Clicking on the icon will load the plugin in the side panel.

<i>Alternatively, just select `Solidity` environment from Remix IDE `Home` tab. This will activate `Solidity Unit Testing` plugin along with `Solidity Compiler`, `Deploy & Run Transactions` & `Solidity Static Analysis` plugins.</i>
<i>Alternatively, select `Solidity` environment from Remix IDE `Home` tab. This will activate `Solidity Unit Testing` plugin along with `Solidity Compiler`, `Deploy & Run Transactions` & `Solidity Static Analysis` plugins.</i>

After successful loading, plugin looks like this:

![](images/a-unit-testing-feature.png)

Test directory
----------
Plugin asks you to provide a directory which will be your workspace only for this plugin. To select directory, as soon as you add `/` to the path, it shows the possible options.
Plugin asks you to provide a directory which will be your unit testing workspace (not to be confused with a Workspace in the File Explorer). To select directory, as soon as you add `/` to the path, it shows the possible options. [Rob Edit]

![](images/a-unit-testing-test-directory.png)

Expand All @@ -31,13 +31,13 @@ Default test directory is `browser/tests`.

Generate
----------
Select a solidity file which you want to test and click on the button `Generate`. It will generate a test file dedicated to selected file **in the test directory**.
Select the Solidity file which you want to test and click on the `Generate` button. In the `test` directory, a test file will be created for your selected file.

If no file is selected, it will still create a file with generic name as `newFile_test.sol`.
If no file is selected, a generic test file named, `newFile_test.sol` will be created.

This file contains sufficient information to give better understanding about developing tests for a contract.
This file contains information about developing tests for a contract.

Generic file looks as:
Below is an example of a generic test file:

```
pragma solidity >=0.4.22 <0.8.0;
Expand Down Expand Up @@ -87,9 +87,9 @@ Write Tests
-----------
Write sufficient unit tests to ensure that your contract works as expected under different scenarios.

Remix injects a built-in `assert` library which can be used for testing. You can visit the library documentation [here](./assert_library).
Remix injects a built-in `assert` library for testing. You can visit the library documentation [here](./assert_library).

Apart from this, Remix allows usage of some special functions in the test file to make testing more structural. They are as:
Additionally, Remix allows the usage of special functions in the test file to make testing more structural. They are:

* `beforeEach()` - Runs before each test
* `beforeAll()` - Runs before all tests
Expand All @@ -100,7 +100,7 @@ To get started, see [this simple example](./unittesting_examples.html#simple-exa

Run
-----
Once you are done with writing tests, select the file(s) and click on `Run` to execute the tests. The execution will run in a separate environment. After completing the execution of one file, a test summary will be shown as below:
Once you are done with writing tests, select the file(s) and click on `Run` to execute the tests. The execution will run in a separate environment. After completing the execution of one file, a test summary will be shown:

![](images/a-unit-testing-run-result.png)

Expand Down

0 comments on commit 1a74f79

Please sign in to comment.