import { Contract , Signer } from 'ethers' ; interface ContractFactory < C extends Contract > { deploy ( ... args ) : Promise < C > ; attach ( address ) : C ; } export interface ContractFactoryConstructor < C extends Contract > { new ( signer ? ) : ContractFactory < C > ; } export async function deployContract < C extends Contract > ( deployer , Factory , args ? ) { const factory = new Factory ( deployer ) ; const contract = await factory . deploy ( ... ( args || [ ] as any ) ) ; await contract . deployed ( ) ; return contract ; }