Deployed to mainnet but errored with insufficient funds

Hello,

Deployed out upgradable Token Contract with a Proxy on the Mainnet

Contract code is here: https://github.com/overqint/erc20_nnn

unfortunately I got an error at the end of the deployment and and the artifacts are not created/saved.

I can not interact with the token over the truffle console: NNNToken has not been deployed to detected network (network/artifact mismatch)

Is there a way to create the artifacts “manually”

As @abcoathup mentioned it it also possible over etherscan or programmatically with web3js to interact with the contracts
but would be easier at the moment to interact with the truffle console.

Another important question is:

If we decide to upgrade the contract will this failed deployment have an effect and would cause problems?

The main problem is also that I am not able to verify the contract on etherscan; what I have tried so far:

Created Constructor Parameters here:

Argument 1 String: Novem Gold Token
Argument 2 String: NNN

Result:
0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000104e6f76656d20476f6c6420546f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e4e4e0000000000000000000000000000000000000000000000000000000000

  1. flattened the contracts into 1 file and tried to verify with and without constructor parameters:
    https://etherscan.io/verifyContract-solc?a=0x4cdbd3d80036a05a3162d492287a0960dce4a385&c=v0.7.5%2Bcommit.eb77ed08&lictype=3

  1. Uploading the build/contracts/NNNToken.json and trying to verify it with and without constructor parameters:
    https://etherscan.io/verifyContract-solc-json?a=0x4cdbd3d80036a05a3162d492287a0960dce4a385&c=v0.7.5%2Bcommit.eb77ed08&lictype=3

  1. Tried to verify with this tool: https://kalis.me/verify-truffle-smart-contracts-etherscan/
    truffle run verify NNNToken --network ropsten
    or
    truffle run verify NNNToken --network mainnet

with no luck

1 Like

Maybe you can have a look at this one: OpenZeppelin Upgrades: Step by Step Tutorial for Hardhat

1 Like

Thanks I have read the article, it’s very similar to truffle upgrade, I have managed to test and deploy upgrades locally, please see my question, would be a update further down the road a problem if artifacts or or something else is missing (about truffles deploy process) that I’m not aware of and would make problem during the update process?

1 Like

Your upgradeable contract seems to have deployed correctly. The problem may be just that Truffle didn’t store the address in the artifact file because the migrations failed. This would be the source of the “has not been deployed” error.

The address is stored in the networks field of the JSON artifact. It would look something like this:

  "networks": {
    "<network id>": {
      "events": {},
      "links": {},
      "address": "<contract address>" // this would be the proxy address
    }
  },

You could try to add this entry in manually, but I’m not familiar enough with Truffle to understand if this would be a problem.

You can also just use your contract through the Truffle console by using:

new NNNToken(/* proxy address */)

instead of NNNToken.deployed().

As for problems with upgrades in the future, due to the half-failed migrations: it may have happened that your migration contract didn’t update to reflect the last run migration, and so a subsequent truffle migrate command will re-run one of your current migrations, and if I’m not mistaken that would redeploy your contract.

I would recommend consulting Truffle about this particular situation and see if our assessment about the migrations potentiall rerunning is correct, and what can be done to remedy it.

2 Likes

Thanks for all the information.

This also helped a lot:

new NNNToken(/* proxy address */)

1 Like

HI @intoverq,

To verify the implementation contract we can do the following (rather than flattening): Verify smart contract inheriting from OpenZeppelin Contracts

If you still have issues, please create a separate topic in #support:contracts

Thanks for the feedback @abcoathup
Created a new topic:

1 Like