The Configuration File¶
You can modify Brownie’s default behaviours by creating an optional configuration file.
The configuration file must be saved as brownie-config.yaml
. If saved in the root directory of a project it will be loaded whenever that project is active. If saved in your home path, it will always be loaded.
All configuration fields are optional. You can copy from the examples below and modify the settings as required.
Default Configuration¶
The following example shows all configuration settings and their default values:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | project_structure:
build: build
contracts: contracts
interfaces: interfaces
reports: reports
scripts: scripts
tests: tests
networks:
default: development
development:
gas_limit: max
gas_price: 0
reverting_tx_gas_limit: max
default_contract_owner: true
cmd_settings: null
live:
gas_limit: auto
gas_price: auto
reverting_tx_gas_limit: false
default_contract_owner: false
compiler:
evm_version: null
solc:
version: null
optimizer:
enabled: true
runs: 200
remappings: null
console:
show_colors: true
color_style: monokai
auto_suggest: true
completions: true
reports:
exclude_paths: null
exclude_contracts: null
hypothesis:
deadline: null
max_examples: 50
report_multiple_bugs: False
stateful_step_count: 10
phases:
explicit: true
reuse: true
generate: true
target: true
shrink: true
autofetch_sources: false
dependencies: null
dev_deployment_artifacts: false
|
Settings¶
Project Structure¶
Project subdirectory names. Include these fields if you wish to modify the default structure of your project.
-
project_structure.
build
¶ Project subdirectory that stores data such as compiler artifacts and unit test results.
default value:
build
-
project_structure.
contracts
¶ Project subdirectory that stores contract source files.
default value:
contracts
-
project_structure.
interfaces
¶ Project subdirectory that stores interface source files and ABIs.
default value:
interfaces
-
project_structure.
reports
¶ Project subdirectory that stores JSON report files.
default value:
reports
-
project_structure.
scripts
¶ Project subdirectory that stores scripts for deployment and interaction.
default value:
scripts
-
project_structure.
tests
¶ Project subdirectory that stores unit tests.
default value:
tests
Networks¶
-
default
¶ The default network that Brownie connects. If a different network is required, you can override this setting with the
--network
flag in the command line.default value:
development
-
networks.
development
¶ This setting is only available for development networks.
-
cmd_settings
¶ Additional commandline parameters, which are passed into Ganache as commandline arguments. These settings will update the network specific settings defined in network management whenever the project with this configuration file is active.
The following example shows all commandline settings with their default value.
fork
andunlock
have no default values andtime
will default to the current time. See adding a development network for more details on the arguments.
networks: development: gas_limit: 6721975 gas_price: 0 reverting_tx_gas_limit: 6721975 default_contract_owner: true cmd_settings: port: 8545 gas_limit: 6721975 accounts: 10 evm_version: istanbul fork: null mnemonic: brownie block_time: 0 default_balance: 100 time: 2020-05-08T14:54:08+0000 unlock: null
-
-
networks.
live
¶ Default settings for development and live environments.
-
gas_price
¶ The default gas price for all transactions. If set to
auto
the gas price is determined usingweb3.eth.gasPrice
.development default:
0
live default:
auto
-
gas_limit
¶ The default gas limit for all transactions. If set to
auto
the gas limit is determined usingweb3.eth.estimateGas
. If set tomax
, the block gas limit is used.development default:
max
live default:
auto
-
default_contract_owner
¶ If
false
, deployed contracts will not remember the account that they were created by. Every transaction will require afrom
kwarg.
-
reverting_tx_gas_limit
¶ The gas limit to use when a transaction would revert. If set to
false
, transactions that would revert will instead raise aVirtualMachineError
.development default:
max
live default:
false
-
Compiler¶
Compiler settings. See compiler settings for more information.
-
evm_version
¶ The EVM version to compile for. If
null
the most recent one is used. Possible values arebyzantium
,constantinople
,petersburg
,istanbul
,atlantis
andagharta
.default value:
null
-
compiler.
solc
¶ Settings specific to the Solidity compiler.
-
version
¶ The version of solc to use. Should be given as a string in the format
0.x.x
. If set tonull
, the version is set based on the contract pragma. Brownie supports solc versions>=0.4.22
.default value:
null
-
optimizer
¶ Optimizer settings to be passed to the Solidity compiler. Values given here are passed into the compiler with no reformatting. See the Solidity documentation for a list of possible values.
-
remappings
¶ Optional field used to supply path remappings.
remappings: - zeppelin=/usr/local/lib/open-zeppelin/contracts/ - github.com/ethereum/dapp-bin/=/usr/local/lib/dapp-bin/
-
Console¶
-
show_colors
¶ Enable or disable colorful output.
default value:
true
-
color_style
¶ Set the Pygments color style used within the console and throughout Brownie.
You can view a gallery of popular styles here.
default value:
monokai
-
auto_suggest
¶ Enable or disable type hints for contract function inputs.
default value:
true
-
completions
¶ Enable or disable autocompletion.
default value:
true
Reports¶
Settings related to reports such as coverage data and gas profiles.
-
exclude_paths
¶ Paths or glob patterns of source files to be excluded from report data.
default value:
null
reports: exclude_paths: - contracts/mocks/**/*.* - contracts/SafeMath.sol
-
exclude_contracts
¶ Contract names to be excluded from report data.
default value:
null
reports: exclude_contracts: - SafeMath - Owned
Hypothesis¶
Default settings for property-based and stateful test execution. See the Hypothesis settings documentation for a complete list of available settings.
hypothesis:
deadline: null
max_examples: 50
report_multiple_bugs: False
stateful_step_count: 10
deadline: null
phases:
explicit: true
reuse: true
generate: true
target: true
shrink: true
Other Settings¶
-
autofetch_sources
¶ If enabled, Brownie will always attempt to fetch source code for unknown addresses using
Contract.from_explorer
.default value:
false
-
dependencies
¶ A list of packages that a project depends on. Brownie will attempt to install all listed dependencies prior to compiling the project.
dependencies: - aragon/aragonOS@4.0.0 - defi.snakecharmers.eth/compound@1.1.0
See the Brownie Package Manager to learn more about package dependencies.
-
dev_deployment_artifacts
¶ If enabled, Brownie will save deployment artifacts for contracts deployed on development networks and will include the “dev” network on the deployment map.
This is useful if another application, such as a front end framework, needs access to deployment artifacts while you are on a development network.
default value:
false