Here's a code snippet that uses Hardhat, Ethers and TypeChain:
import { TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { task } from "hardhat/config";
import { PRBProxy__factory } from "../../typechain/factories/PRBProxy__factory";
const DETERMINISTIC_DEPLOYMENT_PROXY_ADDRESS: string = "0x7A0D94F55792C434d74a40883C6ed8545E406D12";
task("deploy:contract:prb-proxy").setAction(async function (_, { ethers }): Promise<void> {
const signers: SignerWithAddress[] = await ethers.getSigners();
const deployer: SignerWithAddress = signers[0];
const prbProxyFactory: PRBProxy__factory = new PRBProxy__factory(deployer);
const deploymentTx: TransactionRequest = prbProxyFactory.getDeployTransaction();
deploymentTx.to = DETERMINISTIC_DEPLOYMENT_PROXY_ADDRESS;
const txResponse: TransactionResponse = await deployer.sendTransaction(deploymentTx);
await txResponse.wait();
});
You can replace PRBProxy__factory
with your own contract factory.