Skip to content

Commit

Permalink
Merge pull request #1 from iamdefinitelyahuman/v0.0.2
Browse files Browse the repository at this point in the history
v0.0.2
  • Loading branch information
iamdefinitelyahuman authored Jan 12, 2021
2 parents 56ab79f + 61c754c commit c955455
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/iamdefinitelyahuman/brownie-token-tester)

## [0.0.2](https://github.com/iamdefinitelyahuman/brownie-token-tester/tree/v0.0.2) - 2021-01-12
### Fixed
- Improved handling of string types for `success` and `revert` kwargs in `ERC20` init
- Explicitly target Vyper version `0.2.8` to avoid issues when Solidity is not installed

## [0.0.1](https://github.com/iamdefinitelyahuman/brownie-token-tester/tree/v0.0.1) - 2020-12-12
- Initial alpha release
16 changes: 14 additions & 2 deletions brownie_tokens/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
None: "return",
}

STRING_CONVERT = {
"true": True,
"false": False,
"none": None,
}

with Path(__file__).parent.joinpath("token-template.vy").open() as fp:
TEMPLATE = fp.read()

Expand All @@ -29,7 +35,7 @@ def ERC20(
name: str = "Test Token",
symbol: str = "TST",
decimals: int = 18,
success: Union[bool, None] = True,
success: Union[bool, str, None] = True,
fail: Union[bool, str, None] = "revert",
) -> Contract:
"""
Expand All @@ -54,6 +60,12 @@ def ERC20(
Contract
Deployed ERC20 contract
"""
# understand success and fail when given as strings
if isinstance(success, str) and success.lower() in STRING_CONVERT:
success = STRING_CONVERT[success.lower()]
if isinstance(fail, str) and fail.lower() in STRING_CONVERT:
fail = STRING_CONVERT[fail.lower()]

if success not in RETURN_STATEMENT:
valid_keys = [str(i) for i in RETURN_STATEMENT.keys()]
raise ValueError(f"Invalid value for `success`, valid options are: {', '.join(valid_keys)}")
Expand All @@ -66,7 +78,7 @@ def ERC20(
return_statement=RETURN_STATEMENT[success],
fail_statement=FAIL_STATEMENT[fail],
)
deployer = compile_source(source).Vyper
deployer = compile_source(source, vyper_version="0.2.8").Vyper

return deployer.deploy(
name,
Expand Down
2 changes: 1 addition & 1 deletion brownie_tokens/token-template.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @version ^0.2.0
# @version 0.2.8
"""
@notice Mock non-standard ERC20 for testing
"""
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[bumpversion]
current_version = 0.0.1
current_version = 0.0.2

[bumpversion:file:setup.py]

[flake8]
max-line-length = 100
ignore = E203,W503
per-file-ignores =
per-file-ignores =
*/__init__.py: F401

[tool:isort]
Expand All @@ -24,7 +24,7 @@ ignore_missing_imports = True
follow_imports = silent

[tool:pytest]
addopts =
addopts =
--cov brownie_tokens/
--cov-report term
--cov-report xml
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name="brownie-token-tester",
packages=find_packages(exclude=["tests", "tests.*"]),
py_modules=["brownie_tokens"],
version="0.0.1", # don't change this manually, use bumpversion instead
version="0.0.2", # don't change this manually, use bumpversion instead
license="MIT",
description="Helper objects for generating ERC20s while testing a Brownie project.",
long_description=long_description,
Expand Down

0 comments on commit c955455

Please sign in to comment.