solplate

Simple utility for generating boilerplate Solidity contracts

MIT License

Stars
32

Solplate Github Actions License: MIT

Simple utility for generating boilerplate Solidity contracts.

Demo

Build

You need to have Rust and Cargo installed on your machine. See the installation guide here.

Then, clone this repo and install the CLI globally, like this:

cargo install --path .

Usage

With no arguments (defaults to the latest Solidity version):

$ solplate

With a Solidity version passed as the first and only argument:

$ solplate "0.6.2"

To save the output to a Solidity file:

$ solplate "0.6.2" > src/Contract.sol

With VSCode

You can add Solplate as a task in your global tasks.json file:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Generate Solidity Boilerplate",
      "type": "shell",
      "command": "solplate ${input:version}",
      "presentation": {
        "reveal": "never"
      }
    }
  ],
  "inputs": [
    {
      "id": "version",
      "default": "0.8.19",
      "description": "Solidity version",
      "type": "promptString"
    }
  ]
}

To speed up your workflow, you can add a key bind for the task in keybindings.json, e.g.

[
  {
    "key": "CMD+k b",
    "command": "workbench.action.tasks.runTask",
    "args": "Generate Solidity Boilerplate"
  }
]

License

This project is licensed under MIT.