wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.19k stars 292 forks source link

Perform "execute" and "read" with companionNetworks #429

Open itinance opened 1 year ago

itinance commented 1 year ago

Is your feature request related to a problem? Please describe.

Since we already have the option for companionNetworks in the network-config, it would be helpful to be able to use them also within execute or read-method.

Describe the solution you'd like My concrete example:

    // getting a contract from a companion-network
    const reg = await hre.companionNetworks['reg'].deployments.get(
        'TFContractRegistry'
    ); 

and performing read/execute calls on this specific contract BUT on the companion-network

    // this executes on the current network
    const address = await read('TFContractRegistry', 'getContract', path, chainId);

    // what would be cool: taking the deployment/contract from companionNetwork above
    const address = await read(reg, 'getContract', path, chainId);

Describe alternatives you've considered none

Additional context