#solidity #web3 #ethereum #etherscan #cli-applications

multisol-writer

Write the contracts collected with the multisol crate to a directory

4 stable releases

1.1.0 Feb 15, 2021
1.0.2 Jan 10, 2021
1.0.1 Dec 28, 2020
1.0.0 Dec 27, 2020

#7 in #etherscan


Used in multisol

MIT license

12KB
198 lines

Multisol Github Actions Crates.io License: MIT

Multisol is a CLI application for verifying Solidity contracts on Etherscan.

You give it the path to your target contract and it generates a directory with that contract and all its dependencies at the same relative path. Multisol refactors the source code to import dependencies from their new location.

  • Designed to be used with Etherscan's multi-part compiler type
  • Framework agnostic, so it is compatible with Hardhat, Truffle, or vanilla Solidity projects
  • Compatible with contracts imported from "node_modules"

Installation

Homebrew

This works only if you're a user of macOS.

$ brew tap paulrberg/multisol
$ brew install multisol

Cargo

Cargo works across operating systems, but it requires you to have Cargo installed on your machine.

$ cargo install multisol

Binaries

Archives of precompiled binaries for multisol are available for macOS, Linux and Windows in our releases page.

Use this installation option if you are in doubt with regard to the others.

Example

The listing below will generate a folder named "multisol-balancesheet" that can be used to verify the source code for a deployed instance of the BalanceSheet.sol contract part of the hifi monorepo.

git clone https://github.com/hifi-finance/hifi /tmp/example
cd /tmp/example
yarn install
yarn build
cd packages/protocol
multisol contracts/BalanceSheet.sol

After the folder is generated, you go to the contract's tab on Etherscan, click the "Verify & Publish" button and select the "Solidity (Multi-Part files)" option in the dropdown. Then, you upload the folder, hit submit and voilà, your contract is verified on Etherscan!

Limitations

  • No support for specific symbol imports like import {symbol1 as alias} from "filename"
  • Doesn't work when two or more contract files share the same name
  • Doesn't work when the contract files do not have the "sol" extension
  • Not compatible with Pnpm or Yarn PnP

Acknowledgements

This project was inspired by Solt, but Multisol is different insofar it uses the multi-part compilation option on Etherscan, while Solt uses standard json input format.

License

This project is licensed under MIT.


lib.rs:

This is a crate that writes the collected contracts to a directory named "multisol-contract_name".

Dependencies

~4.5–6MB
~104K SLoC