-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: add contract verification with standard json input #304
Conversation
@charles-cooper could you please review it again? I have updated to add delay for block confirmation before verifying the contract. |
@@ -85,10 +89,13 @@ def __init__(self, compiler_data, filename=None): | |||
def __call__(self, *args, **kwargs): | |||
return self.deploy(*args, **kwargs) | |||
|
|||
def deploy(self, *args, **kwargs): | |||
return VyperContract( | |||
def deploy(self, *args, verify=False, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verify could be a list of explorer names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I follow the reference issue linked in the description
"settings": self.compiler_data.settings | ||
}) | ||
|
||
# constructing the request body for verification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented it out for now since it's not working yet, I'm not sure whether you read the description or not
source_code = json.dumps({ | ||
"language": "Vyper", | ||
"sources": { | ||
self.filename: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only supports a single file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in a single contract
# "contractname": f"{self.filename}:{self.contract_name}", | ||
# "compilerversion": self.compiler_data.settings.compiler_version, | ||
# } | ||
body = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeahhh!
|
||
# NOTE: comment these fuzz tests for now to test verifying contract |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what? besides not adding tests, this is disabling existing ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for comment is to reduce cost on fuzz test txn, as I try to make sure the verification really works, will enable it back soon if you want.
You might prefer LLM code than the hands-written one
What I did
reference to this feature issue #267
How I did it
as the one that don't have any background with Python before, I need to search alot and honestly, asked GPT alot, but not copy the whole thing, and create a PR, and done, not like that. let get to the point:
Following on the requirements of the feature issue, which is verify via vyper standard json input:
How to verify it
there is an integration test to verify recent deployed
simple_contract
on blockscout intest_sepolia_env.py
fileDescription for the changelog
verify
flag todeploy
function inVyperDeployer
classETHERSCAN_API_KEY
: api key for verifying on etherscan or etherscan-liked block explorerETHERSCAN_API_URL
: custom api url for etherscan-liked block explorerBLOCKSCOUT_API_URL
: base api url for blockscout explorer. e.g.https://eth-sepolia.blockscout.com
on ethereum sepoliaverify
function inVyperContract
class with the same function signature on the reference issue, which point to below functions based on given params_verify_blockscout
internal function inVyperContract
class with no args need, since it is only need the correct API URL and correct request payload for it to work properly_verify_etherscan
internal function inVyperContract
class withapi_key
pass through from theverify
parent function. At the time of writing, it is not functioning yet, will include in the future commitslink to verified contract on blockscout explorer: https://eth-sepolia.blockscout.com/address/0x3650800AE650D9D7A482d5bf32525774fb982725
link to bounty on bountycaster: https://www.bountycaster.xyz/bounty/0x85ef641ecf3680980c65fd2f3db0b0122d716934