openzeppelin-upgrades icon indicating copy to clipboard operation
openzeppelin-upgrades copied to clipboard

Support TypeChain in deployProxy function

Open frimoldi opened this issue 2 years ago • 8 comments

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();
}

frimoldi avatar Mar 09 '22 15:03 frimoldi

@frangio please let me know your thoughts on this.

frimoldi avatar Mar 11 '22 15:03 frimoldi

@frangio sure, I'll take a look as soon as I can.

frimoldi avatar Mar 22 '22 00:03 frimoldi

@frimoldi Let us know if you can carry on with this. :slightly_smiling_face:

frangio avatar Apr 05 '22 20:04 frangio

@frangio Yes. Sorry for the delay, I'll find some time this week.

frimoldi avatar Apr 05 '22 20:04 frimoldi

Would love this

0xakihiko avatar Sep 12 '22 14:09 0xakihiko

Any update on this?

0xWhiteleaf avatar Aug 09 '23 13:08 0xWhiteleaf

@frimoldi Hey! How it's going ?)

bulbazavr1024 avatar Sep 15 '23 18:09 bulbazavr1024

What's the status of this?

frankbonnet avatar Sep 28 '23 06:09 frankbonnet