Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow publishing of source on BscScan #962

Merged
merged 8 commits into from
Mar 7, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://github.com/eth-brownie/brownie)
### Fixed
- Bump dependency version for [eth-event](https://github.com/iamdefinitelyahuman/eth-event) to [1.2.1](https://github.com/iamdefinitelyahuman/eth-event/releases/tag/v1.2.1) to mitigate the topic generation bug for events with dynamic/fixed size tuple array inputs ([#957](https://github.com/eth-brownie/brownie/pull/957))
### Added
- Automatic source code verification on BscScan

## [1.13.1](https://github.com/eth-brownie/brownie/tree/v1.13.1) - 2021-01-31
### Fixed
Expand Down
8 changes: 5 additions & 3 deletions brownie/network/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,14 @@ def publish_source(self, contract: Any, silent: bool = False) -> bool:
"""Flatten contract and publish source on the selected explorer"""

# Check required conditions for verifying
allowed_explorers = ["etherscan", "bscscan"]
url = CONFIG.active_network.get("explorer")
if url is None:
raise ValueError("Explorer API not set for this network")
if "etherscan" not in url:
if not any(allowed_explorer in url for allowed_explorer in allowed_explorers):
raise ValueError(
"Publishing source is only supported on etherscan, change the Explorer API"
f"Publishing source is only supported on {allowed_explorers},"
"change the Explorer API"
)

if os.getenv("ETHERSCAN_TOKEN"):
Expand Down Expand Up @@ -453,7 +455,7 @@ def publish_source(self, contract: Any, silent: bool = False) -> bool:
if i >= 10:
raise ValueError(f"API request failed with: {data['result']}")
elif i == 0 and not silent:
print("Waiting for etherscan to process contract...")
print(f"Waiting for {url} to process contract...")
i += 1
time.sleep(10)

Expand Down
4 changes: 2 additions & 2 deletions docs/deploy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The following actions WILL remove locally stored deployment data within your pro

To restore a deleted :func:`ProjectContract <brownie.network.contract.ProjectContract>` instance, or generate one for a deployment that was handled outside of Brownie, use the :func:`ContractContainer.at <ContractContainer.at>` method.

Verifying Deployments on Etherscan
Verifying Deployments on Etherscan/BscScan
jbargu marked this conversation as resolved.
Show resolved Hide resolved
==========================================

Brownie features automatic source code verification for solidity contracts on all networks supported by etherscan. To verify a contract while deploying it, add the ``publish_source=True`` argument:
Expand Down Expand Up @@ -119,4 +119,4 @@ If you need deployment artifacts on a development network, set :attr:`dev_deploy
These temporary deployment artifacts and the corresponding entries in :ref:`the deployment map<persistence>` will be removed whenever you (re-) load a project or connect, disconnect, revert or reset your local network.

If you use a development network that is not started by brownie - for example an external instance of ganache - the deployment artifacts will not be deleted when disconnecting from that network.
However, the network will be reset and the deployment artifacts deleted when you connect to such a network with brownie.
However, the network will be reset and the deployment artifacts deleted when you connect to such a network with brownie.