run_solidity

0.1.0 • Public • Published

run_solidity

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

Installing

  1. Install the Solidity compiler

  2. Install 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.

Readme

Keywords

Package Sidebar

Install

npm i run_solidity

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

3.13 kB

Total Files

4

Last publish

Collaborators

  • maiavictor