This is the Beaker CLI. It contains a library and interface for validating and
managing Ethereum smart contracts compatible with BeakerOS. This repo includes
the base beaker
CLI, written in Rust, as well as an additional analysis
executable, written in Haskell, which the main CLI sometimes calls.
This is configured to build using stack.
NB: cargo
commands must be run in the beaker-wrapper
directory.
cargo build
cargo run
Currently the rust executable is only a wrapper around the Haskell executable,
however, basic tests can be run with cargo test
.
In order to run the tests, you will need to install a solidity compiler. It is currently configured to use the solcjs compiler from npm. You will also need a locally running test network to run on-chain tests. Ganache works well for this.
npm i -D solc
npm i ganache-cli
./node_modules/.bin/ganache-cli
stack test
In order to produce documentation for the Haskell code run:
stack haddock --open .
The CLI contains a number of commands. Where a contract is read from file there
is the --read READ-TYPE
options. READ-TYPE
is the format of the input file.
By default it binary (bin
), but it can also accept hex-encoded, and
take the output from the solc compiler. The following types are accepted.
bin
hex
solc
All of the test files in this repo currently require the --read solc
option (which is not the default).
This prints the parsed opcodes of the contract in the internal format.
cargo run -- opcodes INPUT-PATH --read READ-TYPE
This prints the internal structured code representation.
cargo run -- opcodes INPUT-PATH --read READ-TYPE
The check
command lists all of the non-compliances with all of the beaker
procedure standard requirements. If non are listed the procedure is compliant.
cargo run -- check INPUT-PATH --read READ-TYPE
INPUT-PATH
is the path of the file where the contract is contained.