Sending contract balance when deployProxy
Scenario
I want to integrate the OZ Upgrade plugin into my actual contract. My actual contract is able to receive eth balance during the deployment process. (payable ctor)
Goal
Adding a way for sending contract balance to deployProxy function.
References
I asked on OZ community forum and team suggested to open an issue. See : https://forum.openzeppelin.com/t/sending-contract-balance-when-deployproxy/25855
Code to reproduce
My actual contract
....omissis...
const myContractFactory = await hre.ethers.getContractFactory("MyContract");
const myContract= await myContractFactory .deploy({
//note : after deploy my contract balance is 0.001 eth
value: hre.ethers.utils.parseEther("0.001"),
});
...omissis...
Updated Contract using OZProxy
....omissis...
let balance = hre.ethers.utils.parseEther("0.0001");
const myContractFactory = await hre.ethers.getContractFactory("MyContract");
const myContract = await upgrades.deployProxy(myContractFactory,
{
//it doesn't work
value: balance,
initializer: "setup"
});
...omissis...
Thank you :)
Wow!, I thought I was finally gonna get help here LOL
Any updates on this? I would like to send a value when deploying a proxy.
We think this would be good to add. Here is what we propose in terms of usage and behaviour. Let us know if you have comments.
Usage would be with a value option for the deployProxy, deployBeaconProxy, and platform.deployContract functions, similar to the example suggested in the description above.
This value would be used only when deploying the proxy.
An initializer is not required. But if an initializer is called when deploying the proxy, the value will be provided to the initializer and the initializer MUST be payable.
Note that the value would NOT be used when deploying the implementation contract, proxy admin contract, or when upgrading a proxy.