A CLI tool/wrapper around Foundry that supercharges and simplifies your decentralised application workflow.
Vibe-CLI allows you to easily fork, compile, deploy, and call contracts on various networks. It also allows you to easily test your contracts, and interact with your contracts using scripts.
Check out the example project.
npm | npm install -g vibe-cli |
pnpm | pnpm add -g vibe-cli |
Bun | bun add -g vibe-cli |
vibe init
This command should be ran in the root directory of your project. It will create a vibe
directory, a vibe.config.js
file, a .vibe
file and a foundry.toml
file.
Vibe-CLI requires Foundry to be installed on your system. If Foundry is not installed, Vibe-CLI will ask if you would like to install it when running any command.
Warning
If you’re on Windows, you will need to install and use Git BASH or WSL as your terminal, since Foundryup currently does not support Powershell or Cmd.
Note
Vibe-CLI and Foundry require you to use the .t.sol
extension for your test files, and .s.sol
for your script files in order for it to work correctly.
vibe fork <network> [-d]
(See list of supported networks here.)
For example, to fork the Binance Smart Chain mainnet: vibe fork bsc
.
This command can be ran from any directory. It will fork the network specified in the command using Anvil.
If the --deploy (-d)
flag is set, the contracts specified in vibe.config.js
under that chain will be deployed to the network after forking.
Vibe-CLI will pass any other flags directly to Anvil.
vibe compile
This command will compile the contracts specified in the vibe.config.js
file in your project.
vibe deploy <network>
This command will deploy the contracts specified in the vibe.config.js
file in your project to the network specified in the command.
Contracts are deployed in order. If one contract depends on an already deployed contract, you can use it as a constructor argument by using the $
symbol followed by the contract name (e.g. "$Counter"
).
vibe run <network> <command> [args]
This command will run the Solidity script defined in the vibe.config.js
file in your project with the command and arguments specified.
vibe supply <network> <address>
This command will supply the supply balance in ETH and tokens defined in the vibe.config.js
file in your project to the specified addresses on a forked network.
vibe check <network>
It will run the tests located in the vibe/tests
directory of your project (unless specified otherwise in the config) on the network specified in the command using forge test
.
vibe curl <method> [args]
This command will run the RPC method specified in the command with the provided arguments on the currently forked network (e.g. vibe curl evm_setIntervalMining 2
).
Note
Any filenames in the configuration should be specified without any file extensions.
- port: The port to run the Anvil server on when forking (default:
8545
) - paths: An object containing the paths to various directories
- src: The directory containing the Solidity files (default:
'vibe/src'
) - out: The directory to output the compiled contracts (default:
'vibe/out'
) - scripts: The directory containing the scripts to be called (default:
'vibe/scripts'
) - dest: An array of directories to copy the ABI and deployment addresses to (default:
['vibe/deployed']
)
- src: The directory containing the Solidity files (default:
- chains: An object containing the chains to fork and deploy to
- [chain name]: Objects containing the chain information (see here for the list of default chains)
- id: The chain ID (e.g. 56 for Binance Smart Chain)
- rpcUrls: An array of RPC URLs
- privateKey: The private key that will deploy contracts and call scripts
- forkBlockNr: The block number to fork from (defaults to the latest block)
- forkBlockTime: The duration (mining interval) of each block in seconds (defaults to 5)
- forkScripts: An array of scripts to be ran upon forking the chain (e.g.
["name arg1 arg2"]
) - supplyAddresses: An array of addresses that will receive the starting balance and supply tokens upon forking
- supplyBalance: The starting balance of the account
- supplyTokens: An array of objects that represent the tokens to supply
- address: The token address
- from: An array of (whale) addresses to transfer from
- amount: The amount to transfer
- [chain name]: Objects containing the chain information (see here for the list of default chains)
- compile: An array of contracts to be compiled with
vibe compile
- fileName: The Solidity file containing the contracts
- contracts: An array of contract names to compile
- deploy: An object containing contracts to be deployed per chain with
vibe deploy [chain name]
- [chain name]: An array of objects containing the file names and contracts to be deployed
- fileName: The Solidity file containing the contract
- contracts: An array of contract objects
- name: The contract name
- args: An array of arguments to pass to the constructor
- [chain name]: An array of objects containing the file names and contracts to be deployed
- scripts: An object containing Solidity scripts to be ran with
vibe run [chain name] [command] [args]
- [chain name]: Objects containing commands that can be used to run scripts on the chain
- [command]: Objects containing scripts to be ran with the command as key
- fileName: The Solidity file containing the script to be ran
- script: The script to be ran
- [command]: Objects containing scripts to be ran with the command as key
- [chain name]: Objects containing commands that can be used to run scripts on the chain
{
"abi": [],
"deployments": {
"[chain ID]": "contract address (0x...)"
}
}
This file contains the addresses of the deployed contracts. It is automatically generated when deploying contracts.