blockscout / blockscout

Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
http://docs.blockscout.com
GNU General Public License v3.0
3.51k stars 2.37k forks source link

Improvement of standard input json verification endpoint #5389

Closed kj-crypto closed 1 year ago

kj-crypto commented 2 years ago

Improve code parsing and endpoint params for /api?module=contract&action=verifysourcecode

Environment

Expected behaviour

1. Allow sourcecode to be Map

Currently sourcecode accepts only encoded json string. It's better to pass Map without unnecessary nesting.

2. Make arg params more verbose

It would be nice to unitize arg param keywords across other api endpoints e.q module=contract&action=verifySourceCode&codeFormat={solidity-standard-json-input}&contractAddress={contractAddress}&contractName={contractName}&compilerVersion={compilerVersion}&sourceCode={sourceCode} Current keywords like sourcecode={sourcecode} it's not easily to interpret

3. Add new lines in code formatting view to improve code readability

Add <%= line <> "\n" %> in following: https://github.com/blockscout/blockscout/blob/f67aaf85c0873035538e6200f5ac57caf41d81eb/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex#L106 https://github.com/blockscout/blockscout/blob/f67aaf85c0873035538e6200f5ac57caf41d81eb/apps/block_scout_web/lib/block_scout_web/templates/address_contract/index.html.eex#L119

kj-crypto commented 2 years ago

Update

There would be also useful if compilerVersion could accept such format: 0.8.13. That simplifies param passing.

nikitosing commented 1 year ago

@kj-crypto I think you need to use /api?module=contract&action=verify It allows do what you want. verifysourcecode serves for verification via standard JSON input About compiler versions such approach won't work since we can have different commits for one version of compiler. Also in such a case will be impossible to handle nighlty versions