openzeppelin-upgrades
openzeppelin-upgrades copied to clipboard
Support TypeChain in deployProxy function
As discussed in https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/325, this change allows deployProxy
to returned a typed Contract
instance, so the user can use things like Typechain without loosing contract's types definition.
Usage example in a hardhat script 👇🏽
import { ethers, upgrades } from "hardhat";
import { Greeter__factory } from "../typechain";
async function main() {
const signer = (await ethers.getSigners())[0];
const factory = new Greeter__factory(signer);
const greeter = await upgrades.deployProxy<Greeter__factory>(factory, {
constructorArgs: ["Fran"],
});
await greeter.deployed();
// this is now type safe
await greeter.greet();
}
@frangio please let me know your thoughts on this.
@frangio sure, I'll take a look as soon as I can.
@frimoldi Let us know if you can carry on with this. :slightly_smiling_face:
@frangio Yes. Sorry for the delay, I'll find some time this week.
Would love this
Any update on this?
@frimoldi Hey! How it's going ?)
What's the status of this?