Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reserve-protocol/poke
CLI tool for interacting with smart contracts
https://github.com/reserve-protocol/poke
Last synced: about 1 month ago
JSON representation
CLI tool for interacting with smart contracts
- Host: GitHub
- URL: https://github.com/reserve-protocol/poke
- Owner: reserve-protocol
- License: other
- Created: 2019-05-22T22:17:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-04T21:12:18.000Z (over 1 year ago)
- Last Synced: 2024-06-20T10:06:21.592Z (6 months ago)
- Language: Go
- Size: 132 KB
- Stars: 15
- Watchers: 7
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
poke
---Poke is a CLI tool for interacting with smart contracts. See https://medium.com/reserve-currency/poke-a-cli-tool-for-ethereum-development-b4bb66f4e438 for an overview.
# Installation
The easiest way to get started is to [download the latest binary release](https://dl.equinox.io/reserve-protocol/poke/stable).
To install poke from source, you'll need [Go 1.12+](https://golang.org/dl/), with modules enabled (eg `GO111MODULE=on`). Just clone this repo locally and run `go install` in the repo root:
git clone https://github.com/reserve-protocol/poke.git
cd poke
go installIt may be useful to have [`solc-select`](https://github.com/crytic/solc-select) when you finally decide to run `poke` if you will be using it directly on `.sol` files. Optionally, you can use `poke` directly on `.json`s, though presumably you will have created those with a compiler like `solc` or `solc-select` in the first place as well.
# Examples
## Directly from Solidity file
Usually you can just run `poke token.sol`, but things can also get complicated. Here's an example:SOLC_VERSION=0.4.24 poke ReserveRights.sol -c ReserveRightsToken \
transfer 0x91c987bf62D25945dB517BDAa840A6c661374402 100 \
-F hardware \
-n https://mainnet.infura.io/v3/d884cdc2e05b4f0897f6dffd0bdc1821 \
--address 0x8762db106b2c2a0bccb3a80d1ed41273552616e8What's happening here:
- We set the `solc` version to 0.4.24
- We specify the contract name with -c, since in this case the contract name differs from the file name
- We call the `transfer` function, with two arguments: the address and a value
- We use the -F flag to specify to use the hardware key that is plugged in via USB
- We use the -n flag to direct it to mainnet
- We use the --address flag to specify the token address the ReserveRightsToken is deployed at## Directly on compiler output
If you've already run `solc` with the flag `--combined-json abi,bin,userdoc,devdoc,...`, then instead of naming a Solidity file on the command line, you can instead provide solc's output combined JSON file. For instance, the same example from before would be:poke ReserveRights.json -c ReserveRightsToken \
transfer 0x91c987bf62D25945dB517BDAa840A6c661374402 100 \
-F hardware \
-n https://mainnet.infura.io/v3/d884cdc2e05b4f0897f6dffd0bdc1821 \
--address 0x8762db106b2c2a0bccb3a80d1ed41273552616e8This may integrate better with workflow build tools like `make`.
# Troubleshooting
If when using a hardware wallet you encounter it skipping over the "Waiting for you to confirm..." step, it's likely because you don't have contract data enabled on your hardware wallet.