matter-labs / block-explorer

zkSync Era Block Explorer
Apache License 2.0
127 stars 113 forks source link

Vyper API Example #285

Closed PatrickAlphaC closed 1 month ago

PatrickAlphaC commented 2 months ago

According to the git commit it looks like the explorer support vyper contract via the API.

Is there an example/documentation of using the API to verify a vyper smart contract on the era explorer?

PatrickAlphaC commented 1 month ago

All set here:

https://github.com/zkSync-Community-Hub/zksync-developers/discussions/681

dutterbutter commented 1 month ago

Example for posterity:

'{"contractAddress":"0x570ecE11BAA365E2109498Ab3D0dd44D199F106C","sourceCode":{"contracts/CreateForwarder.vy":"# @version ^0.3.3\\n# vim: ft=python\\n\\ninterface Greeter:\\n    def setup(name: String[100]): nonpayable\\n\\nforwarder: public(address)\\n\\n@external\\ndef deploy(_masterCopy: address, _greeting: String[100]):\\n    self.forwarder = create_forwarder_to(_masterCopy)\\n    # Greeter.__init__ was not called, else this would fail\\n    Greeter(self.forwarder).setup(_greeting)\\n","contracts/Greeter.vy":"# @version ^0.3.3\\n# vim: ft=python\\n\\nowner: public(address)\\ngreeting: public(String[100])\\n\\n# __init__ is not called when deployed from create_forwarder_to\\n@external\\ndef __init__():\\n  self.owner = msg.sender\\n  self.greeting = \\"Hola mundo\\"\\n\\n# call once after create_forwarder_to\\n@external\\ndef setup(_greeting: String[100]):\\n  assert self.owner == ZERO_ADDRESS, \\"owner != zero address\\"\\n  self.owner = msg.sender\\n  self.greeting = _greeting\\n\\n@external\\n@view\\ndef greet() -> String[100]:\\n    return self.greeting\\n"},"codeFormat":"vyper-multi-file","contractName":"Greeter","compilerVyperVersion":"0.3.9","compilerZkvyperVersion":"v1.5.3","constructorArguments":"0x","optimizationUsed":true}'