Contract name format for Foundry Upgrades

As per the docs we need to pass the file name when calling deployTransparentProxy.

The problem is what happens when the contract name is different from the file name.

For example: If MyContract.sol contains the contract MyContract, then it will work. As it will query the path out/MyContract.sol/MyContract.json.

But if MyContract.sol contains a contract MyToken, then it doesn't work, because it again queries for the same path: out/MyContract.sol/MyContract.json instead of out/MyContract.sol/MyToken.json.

I couldn't find anything in the docs, am I missing something?

See the "Foundry artifact format" section of https://docs.openzeppelin.com/upgrades-plugins/1.x/api-foundry-upgrades#contract_name_formats

For the example you mentioned, you can use MyContract.sol:MyToken

1 Like