Skip to content

Latest commit

 

History

History
 
 

19-brownie

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Brownie的使用

本项目使用Brownie来运行uniswapv1的test cases,基于brownie的特性对原有的uniswapv1项目 的test进行了重新编写,并且加入了详细的注释

安装 Brownie

  • 安装依赖 Brownie
pip3 install eth-brownie

在终端中运行brownie,应该可以看到类似下面这样的输出:

Brownie v1.13.0 - Python development framework for Ethereum
Usage:  brownie <command> [<args>...] [options <args>]

Commands:

  init               Initialize a new brownie project
  bake               Initialize from a brownie-mix template
  pm                 Install and manage external packages
  compile            Compile the contract source files
  console            Load the console
  test               Run test cases in the tests/ folder
  run                Run a script in the scripts/ folder
  accounts           Manage local accounts
  networks           Manage network settings
  gui                Load the GUI to view opcodes and test coverage
  analyze            Find security vulnerabilities using the MythX API

Options:

  --help -h          Display this message
  --version          Show version and exit

Type 'brownie <command> --help' for specific options and more information about
each command.

安装 Ganache

npm install -g ganache-cli

启动 Ganache

开启单独的一个窗口, 在其中启动 Ganache

ganache-cli

编译合约

cd brownie_test
brownie compile

测试合约

brownie test 

执行脚本

brownie run *.py --network kovan

参考链接

brownie 官网: https://eth-brownie.readthedocs.io/en/stable/toctree.html
旧版 Uniswap 合约: https://github.com/Uniswap/old-solidity-contracts
Uniswap V1 合约: https://github.com/Uniswap/uniswap-v1/tree/master/tests
brownie pdf 文档: https://readthedocs.org/projects/eth-brownie/downloads/pdf/v1.3.1_a/
pytest 教程: https://zhuanlan.zhihu.com/p/87775743
vyper 官网: https://vyper.readthedocs.io/en/stable