-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added EtherScan contract verification.
- Loading branch information
Showing
10 changed files
with
183 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.. _command-line: | ||
|
||
===================== | ||
Command line commands | ||
===================== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
================================= | ||
Contract source code verification | ||
================================= | ||
|
||
.. contents:: :local: | ||
|
||
Verifying contracts on EtherScan | ||
================================ | ||
|
||
ICO package has a semi-automated process to verify deployed contracts on `EtherScan verification service <https://etherscan.io/verifyContract>`_. | ||
|
||
Benefits of verification | ||
======================== | ||
|
||
* You can see the state of your contract variables real time on EtherScan block explorer | ||
|
||
* You prove that there are deterministic and verifiable builds for your deployed smart contracts | ||
|
||
How verification works | ||
====================== | ||
|
||
* You need to have Firefox installed with necessary Selenium drivers | ||
|
||
* Give `--verify` option to a :ref:`deployment script <command-line>` | ||
|
||
* After the command line script has deployed the contract a browser will open | ||
|
||
* The script autofills the verification page details (source code, construction arguments, linked libraries) | ||
|
||
.. image:: screenshots/etherscan_verify.png | ||
:width: 600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from ico.etherscan import verify_contract | ||
from populus import Project | ||
|
||
|
||
def manual_etherscan(): | ||
"""Manual test verification on EtherScan.io.""" | ||
|
||
contract_name = "PresaleFundCollector" | ||
address = "0xb589ef3af084cc5ec905d23112520ec168478582" | ||
constructor_args = "000000000000000000000000e8baf9df0ded92c5f28aab97f13936e7716a4a5b00000000000000000000000000000000000000000000000000000000590ba32f000000000000000000000000000000000000000000000002b5e3af16b1880000" | ||
libraries = {'SafeMathLib': '0x8fd011ad5d39da2f0a09c2d89e7d6ae861fe42ba'} | ||
|
||
p = Project() | ||
chain_name = "mainnet" | ||
|
||
verify_contract( | ||
project=p, | ||
chain_name=chain_name, | ||
address=address, | ||
contract_name="PresaleFundCollector", | ||
contract_filename="PresaleFundCollector.sol", | ||
constructor_args=constructor_args, | ||
libraries=libraries) | ||
|
||
|
||
if __name__ == "__main__": | ||
manual_etherscan() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Library extraction from deployed contracts.""" | ||
from populus.chain import TestRPCChain | ||
from web3.contract import Contract | ||
|
||
from ico.utils import get_libraries | ||
|
||
|
||
def test_extract_libraries(chain: TestRPCChain, uncapped_flatprice: Contract): | ||
"""We get library information of deployed contract.""" | ||
|
||
libraries = get_libraries(chain, "UncappedCrowdsale", uncapped_flatprice) | ||
assert libraries["SafeMathLib"].startswith("0x") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters