Error: function "owner" will shadow "owner". Please update code to avoid conflict

Hi, I am trying to deploy my Pool contract via a proxy using the hardhat-deploy plugin.

Everything was fine until I used the proxy: true to specify deployment through a default proxy.

  const poolDeployResult = await deploy('Pool', {
    from: deployer,
    log: true,
    skipIfAlreadyDeployed: true,
    proxy: true,
    nonce: getNonce(),

When I execute this, I get :

Error HH604: Error running JSON-RPC server: ERROR processing /user/core/deploy/001_Pool.ts:
Error: function "owner" will shadow "owner". Please update code to avoid conflict.
    at Object.mergeABIs (/user/core/node_modules/hardhat-deploy/src/utils.ts:558:19)
    at _deployViaEIP173Proxy (core/node_modules/hardhat-deploy/src/helpers.ts:999:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.deployFunc [as func] (core/deploy/001_Pool.ts:30:28)
    at async DeploymentsManager.executeDeployScripts (/core/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1049:22)
    at async DeploymentsManager.runDeploy (/core/node_modules/hardhat-deploy/src/DeploymentsManager.ts:885:5)
    at async Environment._runTaskDefinition (/core/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
    at async (/core/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
    at async SimpleTaskDefinition.action (/core/node_modules/hardhat-deploy/src/index.ts:528:32)
    at async Environment._runTaskDefinition (/core/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)

Any hints on how to solve this shadowing problem? The pool contract is indeed Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable, PausableUpgradeable but I don't see why it now shows a problem with the keyword owner.

When taking a look at the hardhat-deploy plugin, this is the code that raises the exception.

          if (fragment.type === 'function') {
            throw new Error(
              `function "${}" will shadow "${}". Please update code to avoid conflict.`

Any help would be highly appreciated.

If possible, could you please share the full source code at here?

Not sure, maybe you can search owner in the full code.

Actually I found out why....

The issue is that the contract is Ownable (so it has an owner function) which conflict with hardhat-deploy default proxy which also has an owner function (hardhat-deploy default proxies are EIP-173 compatible)

So an option would be to deploy via transparent proxy.
Thanks @Skyge anyway.

1 Like