brownie-token-tester – 布朗尼令牌测试仪区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,brownie-token-tester – 布朗尼令牌测试仪区块链毕设代写 是一篇很好的国外资料

brownie-token-tester

Helper objects for generating ERC20s while testing a Brownie project.

Dependencies

  • python3 version 3.6 or greater, python3-dev
  • brownie version 1.11.6 or greater
  • ganache-cli version 6.11.0 or greater

Installation

via pipx

If you have installed Brownie using pipx, you need to add brownie-token-tester into the same virtual environment:

pipx inject eth-brownie brownie-token-tester

via pip

You can install the latest release via pip:

pip install brownie-token-tester

via setuptools

You can clone the repository and use setuptools for the most up-to-date version:

git clone https://github.com/iamdefinitelyahuman/brownie-token-tester.git cd brownie-token-tester python3 setup.py install

Quick Usage

Import the library from within a Brownie test, script or console:

from brownie_tokens import ERC20, MintableForkToken

You can then make use of the following functionality:

ERC20

Deploys a generic ERC20 contract for testing purposes.

def ERC20(     name: str = "Test Token",     symbol: str = "TST",     decimals: int = 18,     success: Union[bool, None] = True,     fail: Union[bool, str, None] = "revert", ) -> Contract:
  • The success kwarg is used to set the token’s return value upon a successful call to approve, transfer or transferFrom. Valid values are True, False, and None.
  • The fail kwarg sets the token’s behaviour upon failed calls to the above methods. Use "revert" if the transaction should revert, or True, False, and None to return a value without reverting.

The resulting deployment adheres to the ERC20 Token Standard and additionally implements one non-standard method:

def _mint_for_testing(target: address, amount: uint256): nonpayable

This method increases the balance of target by amount. It may be called by any account.

MintableForkToken

MintableForkToken is used to standardize the process of minting tokens when working in a forked mainnet environment. The MintableForkToken class inherits from and may be used interchangeably with the Contract class. It exposes one additional method, _mint_for_testing, with the same API as given above.

For tokens where custom logic is implemented, this is an actual minting event. For most tokens, the “minting” process involves a query to the Ethplorer API to get a list of top token holders, and then transferring their balances to target.

Tokens for which custom logic is currently implemented:

  • Aave tokens
  • LinkUSD
  • pBTC
  • renBTC
  • renZEC
  • RSV
  • USDN
  • sBTC
  • tBTC
  • wBTC
  • wZEC

Development

This project is still in early development and should be considered an alpha. Comments, questions, criticisms and pull requests are welcomed.

License

This project is licensed under the MIT license.


布朗尼令牌测试仪

用于在测试Brownie项目时生成erc20的Helper对象。

依赖项

  • python3版本3.6或更高版本,python3 dev
  • 布朗尼版本1.11.6或更高版本
  • ganache cli版本6.11.0或更高版本

安装

通过pipx

如果您使用pipx安装了Browne,则需要将Browne token tester添加到同一虚拟环境中:

pipx inject eth-brownie brownie-token-tester

通过setuptools

您可以通过pip安装最新版本:

pip install brownie-token-tester

快速使用

您可以克隆存储库并使用setuptools获取最新版本:

git clone https://github.com/iamdefinitelyahuman/brownie-token-tester.git cd brownie-token-tester python3 setup.py install

ERC20

从Browne测试、脚本或控制台中导入库:

from brownie_tokens import ERC20, MintableForkToken

然后您可以使用以下功能:

开发

部署一个通用的ERC20契约以进行测试。

def ERC20(     name: str = "Test Token",     symbol: str = "TST",     decimals: int = 18,     success: Union[bool, None] = True,     fail: Union[bool, str, None] = "revert", ) -> Contract:
  • success kwarg用于在成功调用approve、transfer或transferFrom时设置令牌的返回值。有效值为True、False和None。
  • fail kwarg设置对上述方法调用失败时令牌的行为。如果事务应该还原,则使用“revert”,或者使用True、False和None返回值而不还原。Aave代币

生成的部署遵循ERC20令牌标准,并额外实现了一种非标准方法:

def _mint_for_testing(target: address, amount: uint256): nonpayable

此方法按数量增加目标的余额。它可以被任何帐户调用。

许可证

MintableForkToken用于标准化在分叉的mainnet环境中工作时生成令牌的过程。MintableForkToken类继承自Contract类,可以与Contract类互换使用。它公开了一个额外的方法,用于测试的方法,与上面给出的API相同。

对于实现自定义逻辑的令牌,这是一个实际的铸币事件。对于大多数代币,“造币”过程涉及到对Ethplorer API的查询,以获得顶级代币持有者的列表,然后将其余额转移到target。

当前为其实现自定义逻辑的令牌:

  • Aave tokens
  • LinkUSD
  • pBTC
  • renBTC
  • renZEC
  • RSV
  • USDN
  • sBTC
  • tBTC
  • wBTC
  • wZEC

Development

此项目仍处于早期开发阶段,应将其视为alpha。欢迎评论、提问、批评和请求。

License

这个项目是根据麻省理工学院的许可证授权的。

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/20020.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » brownie-token-tester – 布朗尼令牌测试仪区块链毕设代写

提供最优质的资源集合

立即查看 了解详情