(signer?: Signer)
| 95 | |
| 96 | // deploy the factory, if not already deployed. |
| 97 | async deployFactory (signer?: Signer): Promise<void> { |
| 98 | if (await this._isFactoryDeployed()) { |
| 99 | return |
| 100 | } |
| 101 | |
| 102 | await (signer ?? this.signer).sendTransaction({ |
| 103 | to: Create2Factory.factoryDeployer, |
| 104 | value: BigNumber.from(Create2Factory.factoryDeploymentFee) |
| 105 | }) |
| 106 | // (with latest geth, can't tx.wait on the very first tx: reverts with "transaction indexing is in progress") |
| 107 | await new Promise(resolve => setTimeout(resolve, 100)) |
| 108 | |
| 109 | await this.provider.sendTransaction(Create2Factory.factoryTx).then(async tx => tx.wait()) |
| 110 | |
| 111 | if (!await this._isFactoryDeployed()) { |
| 112 | throw new Error('fatal: failed to deploy deterministic deployer') |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | async _isFactoryDeployed (): Promise<boolean> { |
| 117 | if (!this.factoryDeployed) { |
no test coverage detected