How to verify with Hardhat or Truffle a smart contract using OpenZeppelin Contracts

Hello, how can I edit the contract I published?

Hi, welcome! :wave:

Do you mean you want to edit a verified contract? If so, I think you have got to contact with the developer of the etherscan to update contract.

To edit the contract codes Yes. (Contract Source Code Verified) I still had a problem when I verified the address for ownership. Because I have already registered with another email and deleted it. For now, I called for the same thing. And I sent a ticket and I do not know when they will answer me!

Sorry, I have not tried to updeate contracts and verify ownership after deployed, so I am not sure how to do it. You have got to wait for them to get the feedback.

Hi, Can you please tell me how to verify smart contract on Matic using truffle-plugin-verify. I am not getting how to get api key for matic.

So currently, I am trying to write and deploy my own contracts through reviewing others' deployed contracts. I scanned through a pretty "standard" project and grasped that the owner of that project just tried to flatten everything (the purpose is to avoid "import" and "import "@openzeppelin/.../... smt here "" on files that are not the main contract). I am not really sure about this, as this project was written like, a year ago, it used the Solidity version 0.5.0. The latest Solidity version now is 0.8.6, and we nowadays also have to add something called "SPDX License" in the first line of every solidity contract file.

So there are several things that make me feel pretty dubious:

  1. Does a "standard" smart contract (deploying to a mainnet) need the "flatten things"? Is it true to consider that a verified contract (for instance, in etherscan), must be flattened?

  2. As your comment, I understand that it's important to separate files, for some purposes like reading, maintaining, and the license one. So now, I just cannot use flatten tool (as the multiple license problem), and have to copy files (that I needed) by hand, to the contracts/ folder? Is that a good approach? What is a good way to make my contracts look "standard"?

  3. Another question just pop up in my mind while I was writing this comment: I've always been seen that all smart contract projects will have a contract like, the main one? I mean, yes, we can have multiple .sol files, we can have multiple contracts. But, there is like, a (main) contract that inherit every other (subordinate) contracts. Is that a fact?

Hey, I think just like the etherscan, register a new account and generate a new API key.

Polygon (MATIC) Blockchain Explorer (polygonscan.com)

No, you can verify your contract by the multi-files besides a flattened single file.

Standard? I am not sure, I always separate the contracts and just the plugin of hardhat to verify contracts.

I think this is up to you, if you need this contract, your main contract can inherit it. And not all the contracts should be inherited, such as the SafeMath.sol, it is a library contract, you can use it just by using SafeMath for uint256

1 Like

I'm getting the same issue...

Hi, welcome! :wave:

I think you can have a look at this article: