Skip to content

Commit

Permalink
refactor: early return
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <[email protected]>
  • Loading branch information
yonadaa and holic authored Apr 24, 2024
1 parent 6e60921 commit 0e5fdb7
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions packages/cli/src/deploy/ensureWorldFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,23 @@ export async function ensureWorldFactory(
deployerAddress: Hex,
withWorldProxy?: boolean,
): Promise<Address> {
if (!withWorldProxy) {
const contracts = getWorldFactoryContracts(deployerAddress);

// WorldFactory constructor doesn't call InitModule, only sets its address, so we can do these in parallel since the address is deterministic
await ensureContractsDeployed({
client,
deployerAddress,
contracts: Object.values(contracts),
});

return contracts.WorldFactory.address;
} else {
if (withWorldProxy) {
const contracts = getWorldProxyFactoryContracts(deployerAddress);

// WorldFactory constructor doesn't call InitModule, only sets its address, so we can do these in parallel since the address is deterministic
await ensureContractsDeployed({
client,
deployerAddress,
contracts: Object.values(contracts),
});

return contracts.WorldProxyFactory.address;
}

const contracts = getWorldFactoryContracts(deployerAddress);
// WorldFactory constructor doesn't call InitModule, only sets its address, so we can do these in parallel since the address is deterministic
await ensureContractsDeployed({
client,
deployerAddress,
contracts: Object.values(contracts),
});
return contracts.WorldFactory.address;
}

0 comments on commit 0e5fdb7

Please sign in to comment.