• Stars
    star
    254
  • Rank 160,264 (Top 4 %)
  • Language
    JavaScript
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A pocket knife for auditing smart contracts.
_______________________________________________________________________________________/\\\_________        
 ____________________________________________/\\\______________________________________\/\\\_________       
  ___/\\\\\\\\\______________________________\/\\\____________________________/\\\______\/\\\_________      
   __/\\\/////\\\_____/\\\\\________/\\\\\\\\_\/\\\\\\\\________/\\\\\\\\___/\\\\\\\\\\\_\/\\\_________     
    _\/\\\\\\\\\\____/\\\///\\\____/\\\//////__\/\\\////\\\____/\\\/////\\\_\////\\\////__\/\\\\\\\\\\__    
     _\/\\\//////____/\\\__\//\\\__/\\\_________\/\\\\\\\\/____/\\\\\\\\\\\_____\/\\\______\/\\\/////\\\_   
      _\/\\\_________\//\\\__/\\\__\//\\\________\/\\\///\\\___\//\\///////______\/\\\_/\\__\/\\\___\/\\\_  
       _\/\\\__________\///\\\\\/____\///\\\\\\\\_\/\\\_\///\\\__\//\\\\\\\\\\____\//\\\\\___\/\\\___\/\\\_ 
        _\///_____________\/////________\////////__\///____\///____\//////////______\/////____\///____\///__

A pocket knife for developing and auditing smart contracts. Provides a series of cli commands that allow you to quickly operate on a contract, such as:

- getcode <deployedAddress> [targetFilePath] - Retrieves a contract's code from Etherscan.
- split <sourcePath> <outputDirectory> - Splits Solidity files.
- inheritance <contractPath> - Displays the inheritance tree of a contract.
- members <contractPath> - Lists all members of a contract.
- selectors <contractPath> - Lists all selectors of a contract.
- calldata <data> - Splits up calldata into a more readable format.
- blockdate <networkUrl> <blockHashOrNumber> - Gets the date of a block.
- txs <networkUrl> <contractAddress> <functionSelector> <fromBlock> [toBlock] [maxThreads] - Finds transactions.
- pastevents <networkUrl> <contractPath> <contractAddress> <eventName> <fromBlock> [toBlock] [batchSize] - Finds past events of a contract.
- disassemble <contractPath> - Disassembles bytecode to EVM opcodes.
- hex2str <hexString> - Converts hex to string.
- str2hex <asciiString> - Converts string to hex.
- transaction <networkUrl> <txHash> - Gets info about a transaction.
- block <networkUrl> [blockHashOrNumber] - Gets info about a block.
- info <networkUrlOrName> - Retrieves info about a network.
- hex2uint <hexString> - Converts hex to uint.
- uint2hex <decNumber> - Converts uint to hex.
- convert [value] [sourceDenom] [destDenom] - Converts between ether denominations.
- pad <value> [direction] [amount] [char] - Pads hex numbers.
- compile <sourcePath> <outputDirectory> [solcVersion] - Compiles single Solidity files.
- storage <networkUrl> <contractAddress> <storageSlot> - Reads the storage of a contract.
- liststorage <networkUrl> <contractPath> <contractAddress> - Reads the storage of a contract.
- checksum <address> - Checksums an address.
- selector <signature> - Calculates a selector.
- docyul [keyword] - Gets yul documentation.
- int2hex <decNumber> - Converts int to hex.
- hex2int <hexString> - Converts hex to int.

One script to rule them all!

Pocketh is basically a curated list of useful scripts, packed up in a commanderjs program.

On the fly compilation ๐Ÿš€

Pocketh uses AST information for analysing contracts, but it doesn't require you to do any compilation at all. Whenever pocketh sees a Solidity file, it will compile it in background. Pocketh's compiler is super handy btw; it can compile anything, on the spot.

Installation:

npm install --global pocketh

Usage:

pocketh <command> [options]

Documentation:

Please refer to the inline documentation of the program for a list of available commands,

pocketh --help

or, for command specific documentation.

pocketh <command> --help

Contributing:

If you think of something useful that could be added to the tool, or have an idea, please don't hesitate to create a new issue with your feature request. Or, even better, go ahead and create a PR! Pocketh's architecture is intended to be as simple as possible so that it's super easy to add new scripts. Every command is pretty much a standalone script, with the exception of a few convenient tools that are shared between some of the commands.

Running tests

Make sure that you run npm run ganache before starting tests. Then run npm test.

Note: Unfortunately, pocketh currently requires an active internet connection for some of its tests, since some commands interact with public networks like mainnet and ropsten, and use public apis like Etherscan's api.

More Repositories

1

trivias

Solidity trivias
JavaScript
98
star
2

ethernaut-cli

Ai agent cli with web3 capabilities
JavaScript
33
star
3

agalthemean

Real time AGAL shader editor based on Minimole.
ActionScript
22
star
4

hc

Holographic consensus implemented as an Aragon app
JavaScript
18
star
5

aave-credit-delegation

Helper for using Aave's credit delegation
JavaScript
17
star
6

minimole-core

Minimalistic Molehill based Flash 3D engine.
ActionScript
17
star
7

uni-token-distribution

Solidity
15
star
8

chicken

An Ethereum economic game designed to harvest greed and coerce it into a common good.
Solidity
12
star
9

alfreth

An Alfred workflow with Ethereum utilities
JavaScript
12
star
10

TheUnbelievableSequencer

A sequencer for TheAmazingAudioEngine that uses AUSampler and MIDI
Objective-C
11
star
11

coc-solidity

Solidity language extension for coc.nvim
JavaScript
10
star
12

evmgolf

Solidity
10
star
13

solmap

Solidity to EVM visualization tool.
JavaScript
7
star
14

yolo

JavaScript
6
star
15

maker-liquidations-subgraph

Studies Maker Vault liquidations
TypeScript
3
star
16

1inch-token-distribution

Solidity
2
star
17

ethsend

Simple tool to send ETH to a high number of addresses while minimizing tx count
JavaScript
2
star
18

cryptoplot

Plots cryptocurrency market prices
JavaScript
2
star
19

token-manager-subgraph

Aragon TokenManager app subgraph
TypeScript
2
star
20

solz

solc/solc-js wrapper for compiling/watching directories with solidity files
JavaScript
2
star
21

aragon-voting-subgraph

TypeScript
1
star
22

mini-token

Hardhat demo
JavaScript
1
star
23

ajsantander.github.io

Personal Site
CSS
1
star
24

synthetix-trading-rewards

POC trading rewards for use in Synthetix
Solidity
1
star
25

snx-debt-hedger

1
star
26

hc-poc

Holographic Consensus POC
JavaScript
1
star
27

aragon-subgraph

Experimental subgraph for Aragon
TypeScript
1
star
28

buidler-aragon-experiment

Experiment for building an Aragon app based on a buidler setup
TypeScript
1
star
29

solplay

Solidity playground
JavaScript
1
star
30

delegate-contract

Solidity
1
star
31

tokenless

A tokenless prediction market based on OpenZeppelin/tokenless that uses truffle-box with React + Redux + Truffle+ Router (etc).
JavaScript
1
star
32

wallet-creator

JavaScript
1
star