1

I'm not specifying a solidity version so I'm not sure which solidity version brownie is using to compile my contract.

I'm using pragma solidity ^0.8.0; so I'm not sure which version above 0.8.0 brownie is using.

I would like to know so that I can verify a smart contract on ftm explorer (explorer for Fantom Opera network) since including the FTMSCAN_TOKEN in .env and publishing while deploying in brownie-python doesn't seem to be working.

P.S. also doesn't work with POLYGONSCAN_TOKEN and deploying to polygon with publish_source=config["networks"][network.show_active()].get("verify"), so my last resort is just verifying through explorer so need to know solidity compiler version brownie is using.

1 Answer 1

1

When the compiler version is not explicitly declared, Brownie looks at the version pragma of each contract and uses the latest matching compiler version that has been installed. If no matching version is found, the most recent release is installed. source

For your case you just need to type brownie console and check it:

import solcx
solcx.get_solc_version(with_commit_hash=True)

output example: Version('0.8.10+commit.fc410830')

found it here.

1
  • This is great to know, thanks! I will try this. my pragma version was set to ^0.8.0 but I explicitly set it to 0.8.11 so I knew which one and the verification worked.
    – tythereum
    Feb 8, 2022 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.