harmony-one / harmony

The core protocol of harmony
https://harmony.one
GNU Lesser General Public License v3.0
1.46k stars 287 forks source link

[Feature] Block Explorer supports to be accessed via API #3895

Open kingster-will opened 2 years ago

kingster-will commented 2 years ago

Problem/limitation At Hand

Currently, it seems the block explorer doesn't support API accessibility like BSC/ Ethscan. it leads to developer cannot publishing the source code of smart contract to the block explorer with tools like Brownie or Hardhat, since the these tools require API accessiblity of the block explorer.

It hit error "ValueError: Publishing source is only supported on etherscan, bscscan, polygonscan,change the Explorer API " when trying deploy the smart contract with Brownie.

Which component?

Proposed Solution

A clear and concise description of what you want to happen.

Alternatives Considered

A clear and concise description of any alternative solutions or features you've considered.

Additional Context

The details error as below for reference:


brownie run ./scripts/deploy.py --network  one-test                                                                                                                                                     
Brownie v1.16.1 - Python development framework for Ethereum

WxchContractsProject is the active project.

Running 'scripts/deploy.py::main'...
Enter password for "test3":
Transaction sent: 0x3daad38be3068da031416a08fea67d9fa0b09f9fb655078580afb7a1c6e1fec6
  Gas price: 10.0 gwei   Gas limit: 1165307   Nonce: 3
  WXCH.constructor confirmed   Block: 15854096   Gas used: 1059370 (90.91%)
  WXCH deployed at: 0xf84d7228Dda7654B1d66Af05Dc171CbF0DB71d97

  File "brownie/_cli/run.py", line 49, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/deploy.py", line 9, in main
    wxch = WXCH.deploy({'from': acc}, publish_source=True)
  File "brownie/network/contract.py", line 599, in __call__
    return tx["from"].deploy(
  File "brownie/network/account.py", line 555, in deploy
    contract.publish_source(deployed_contract, silent=silent)
  File "brownie/network/contract.py", line 391, in publish_source
    raise ValueError(
ValueError: Publishing source is only supported on etherscan, bscscan, polygonscan,change the Explorer API 
potvik commented 2 years ago

To support tools like Brownie or Hardhat we should to correct verification api to etherscan format. Also may be we will need to add multiple file upload feature. Need more time to inspect details.

current verification api is here https://ctrver.t.hmny.io/codeVerification