# run_solidity

> Runs the main function of a Solidity file

Latest version **0.1.0** (published 2022-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install run_solidity
pnpm add run_solidity
yarn add run_solidity
bun add run_solidity
```

Provides the command `run_solidity`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2022-06-12 |
| First published | 2022-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | VictorTaelin |
| Maintainers | maiavictor |
| Keywords | why, this, doesnt, exist |

## Links

- npm: https://www.npmjs.com/package/run_solidity
- Repository: https://github.com/victortaelin/run_solidity
- Homepage: https://github.com/victortaelin/run_solidity#readme
- Issues: https://github.com/victortaelin/run_solidity/issues
- npm.io page: https://npm.io/package/run_solidity

## Dependencies (1)

- [ethers](https://npm.io/package/ethers.md) ^5.6.8

## Recent versions

- 0.1.0 (latest) — 2022-06-12

## README

run_solidity
============

Runs the `main()` function of all contracts in a Solidity file.

Installing
==========

1. [Install the Solidity compiler](https://docs.soliditylang.org/en/v0.8.14/installing-solidity.html)

2. [Install Ganache](https://trufflesuite.com/ganache/)

3. Install `run_solidity`: `npm i -g run_solidity`

Usage
=====

1. Start the local Ganache network:

    ```
    NODE_OPTIONS=--openssl-legacy-provider ganache-cli
    ```

2. Create a Solidity contract and save as `main.sol`:

    ```
    // SPDX-License-Identifier: MIT

    pragma solidity >=0.4.22 <=0.9.0;

    contract Example {

      event Hello(uint256 number);

      function main() public {
        for (uint i = 0; i < 10; ++i) {
          emit Hello(i);
        }
        buy(500);
      }
          
    }
    ```

3. Run it with `run_solidity main.sol`

This will run the `main()` function on each contract inside this `.sol` file. It
will show all the events emitted, and the total gas used. That's all.

---
_Source: https://npm.io/package/run_solidity · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
