Git Product home page Git Product logo

etherman's Introduction

etherman

A tool for contract deployment and testing.

Usage

Install solc first, the executable will be located automatically.

$ etherman --help

Usage: etherman [OPTIONS] COMMAND [arg...]

Deploys arbitrary contract on an arbitrary EVM. Requires solc 0.6.x or later.

Options:
      --solc-path         Set path solc executable. Found using 'which' otherwise (env $DEPLOYER_SOLC_PATH)
  -N, --name              Specify contract name to use. (env $DEPLOYER_CONTRACT_NAME) (default "Counter")
  -S, --source            Set path for .sol source file of the contract. (env $DEPLOYER_SOL_SOURCE_FILE) (default "contracts/Counter.sol")
  -E, --endpoint          Specify the JSON-RPC endpoint for accessing Ethereum node (env $DEPLOYER_RPC_URI) (default "http://localhost:8545")
  -G, --gas-price         Override estimated gas price with this option. (env $DEPLOYER_TX_GAS_PRICE) (default 50)
  -L, --gas-limit         Set the maximum gas for tx. (env $DEPLOYER_TX_GAS_LIMIT) (default 5000000)
      --cache-dir         Set cache dir for build artifacts. (env $DEPLOYER_CACHE_DIR) (default "build/")
      --no-cache          Disables build cache completely. (env $DEPLOYER_DISABLE_CACHE)
      --cover             Enables code coverage orchestration (env $DEPLOYER_ENABLE_COVERAGE)
      --keystore-dir      Specify Ethereum keystore dir (Geth or Clef) prefix. (env $DEPLOYER_KEYSTORE_DIR)
  -F, --from              Specify the from address. If specified, must exist in keystore, ledger or match the privkey. (env $DEPLOYER_FROM)
      --from-passphrase   Passphrase to unlock the private key from armor, if empty then stdin is used. (env $DEPLOYER_FROM_PASSPHRASE)
  -P, --from-pk           Provide a raw Ethereum private key of the validator in hex. (env $DEPLOYER_FROM_PK)
      --ledger            Use the Ethereum app on hardware ledger to sign transactions. (env $DEPLOYER_USE_LEDGER)

Commands:
  build                   Builds given contract and cached build artefacts. Optional step.
  deploy                  Deploys given contract on the EVM chain. Caches build artefacts.
  tx                      Creates a transaction for particular contract method. Uses build cache.
  call                    Calls method of a particular contract. Uses build cache.
  logs                    Loads logs of a particular event from contract.

Run 'etherman COMMAND --help' for more information on a command.

Deploying

$ etherman deploy --help

Usage: etherman deploy [--bytecode | --await] [ARGS...]

Deploys given contract on the EVM chain. Caches build artefacts.

Arguments:
  ARGS             Contract constructor's arguments. Will be ABI-encoded.

Options:
      --bytecode   Produce hex-encoded contract bytecode only. Do not interact with RPC.
      --await      Await transaction confirmation from the RPC. (default true)

Example

$ etherman -E http://localhost:1317 -P 59F455CBF7B02A2C1F6B55B4D8D8FEF21BCD530457A9570999FB1C12C82F5201 -G 0 deploy
$ etherman --source contracts/Counter.sol deploy --bytecode

Method transact

$ etherman tx --help

Usage: etherman tx [--await] ADDRESS METHOD [ARGS...]

Creates a transaction for particular contract method. Uses build cache.

Arguments:
  ADDRESS          Contract address to interact with.
  METHOD           Contract method to transact.
  ARGS             Method transaction arguments. Will be ABI-encoded.

Options:
      --bytecode   Produce hex-encoded ABI-packed params bytecode only. Do not interact with RPC.
      --await      Await transaction confirmation from the RPC. (default true)

Example

$ etherman -E http://localhost:1317 -P 1F2FAB11FA77AE1110D9E9AF59191C656B8BA1093F1480F99486F635E38597CC -G 0 \
    tx 0x33832d3A5e359A0689088c832755461dDaD5d41B add
$ etherman -E http://localhost:1317 -P 1F2FAB11FA77AE1110D9E9AF59191C656B8BA1093F1480F99486F635E38597CC -G 0 \
    tx --await=false 0x33832d3A5e359A0689088c832755461dDaD5d41B addValue 10

Read logs

$ etherman logs --help

Usage: etherman logs ADDRESS TX_HASH EVENT_NAME

Loads logs of a particular event from contract.

Arguments:
  ADDRESS      Contract address to interact with.
  TX_HASH      Transaction hash to find receipt.
  EVENT_NAME   Contract event to find in the logs.

Example

etherman -E http://localhost:1317 logs 0x33832d3A5e359A0689088c832755461dDaD5d41B 0x8d2a06a2811cc4be16536c54e693ef1c268f8d04956fa0899e18372f6201fbe9 Increment

Verifying on Etherscan

The simplest way to verify the contract on Etherscan (e.g. on https://kovan.etherscan.io/verifyContract) is to upload the Standard JSON for the contract.

$ etherman --source Peggy.sol --name Peggy build --standard-json > peggy-standard.json

$ etherman --source ./@openzeppelin/contracts/ProxyAdmin.sol --name ProxyAdmin build --standard-json > proxy-admin-standard.json

$ etherman --source ./@openzeppelin/contracts/TransparentUpgradeableProxy.sol --name TransparentUpgradeableProxy build --standard-json > proxy-standard.json

Then submit the Standard JSON files with proper Solc version used.

License

Apache 2.0

etherman's People

Contributors

albertchon avatar dbrajovic avatar gorgos avatar kakysha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

etherman's Issues

Rename repo/binary + add contract call support

evm-deploy-contract implies that each command sent is related to a deployment, yet one can use the tx command to send transactions. It woud be more accurate to change the name to evm-contract to reduce the potential for confusion.

Also, it would also be useful to support contract calls as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.