1

I'm having a little problem verifying my smart contract on Polygonscan. As it didn't work when I first launched the contract I looked up how to do it afterwards and found this piece of code:

from brownie import TokenCreator

def verify_later():
    token = TokenCreator.at("0x4Ce961a0BeA661c50744884c59cEe7f4ff7374F8")
    TokenCreator.publish_source(token)

def main():
    verify_later()

I've already figured some problems out: At first the api token wasn't working but seems to be fixed now.

When I now try to run the code I run into the following error which isn't really telling me anything (Note: I removed the first 5 digits of the API key):

Running 'scripts\verify_later.py::main'...
  File "C:\Users\paulk\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\run.py", line 51, in main       
    return_value, frame = run(
  File "C:\Users\paulk\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\scripts.py", line 110, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File ".\scripts\verify_later.py", line 8, in main
    verify_later()
  File ".\scripts\verify_later.py", line 5, in verify_later
    TokenCreator.publish_source(token)
  File "C:\Users\paulk\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\contract.py", line 408, in publish_source
    data = response.json()
  File "C:\Users\paulk\.local\pipx\venvs\eth-brownie\lib\site-packages\requests\models.py", line 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: [Errno Expecting value]

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title></head>
<body>
    <form method="post" action="./?apikey=*****7HYDIJS14WEPV6ND2ERHVCF3JRMBF+%2f%2fPolygon&amp;module=account&amp;action=txlist&amp;address=0x4Ce961a0BeA661c50744884c59cEe7f4ff7374F8&amp;page=1&amp;sort=asc&amp;offset=1" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="MtwldsWYVQEVMCPeaD7Ba8sCueWYyKNiHjySpgUasQw+pbbx75Mh/2Ea8K72UBeXiCqNzIBzJharHjDaTI2g7urAhmz98CtTFdC9IVcNT03CqhUVnreMoFq3F6GpvCxI" />

<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="CA0B0334" />
        <div>
            invalid resource end point
            <br />
            <font size="1">
            Test#1: <a href='/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest&apikey=YourApiKeyToken'>api?module=account&action=balance&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a&tag=latest&apikey=YourApiKeyToken</a><br />
            Test#2: <a href='/api?module=account&action=txlist&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&startblock=0&endblock=99999999&page=1&offset=10&sort=asc&apikey=YourApiKeyToken'>api/api?module=account&action=txlist&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a&startblock=0&endblock=99999999&page=1&offset=10&sort=asc&apikey=YourApiKeyToken</a><br />
            </font>
        </div>
    </form>
</body>
</html>
: 4

I hope that somebody can help me resolve. Another way of verifying would also be an option (except from the online form because as the contract is a token contract I'm inheriting and importing quite much so I'd have to pase all the code of everything in (which I tried and didn't work))

Thanks in advance!

Labu
  • 11
  • 1

0 Answers0