Skip to content

Commit

Permalink
refactor: proxy in key
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaa committed Apr 24, 2024
1 parent 5c3ba81 commit 6e60921
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
31 changes: 21 additions & 10 deletions packages/cli/src/deploy/ensureWorldFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,27 @@ export async function ensureWorldFactory(
deployerAddress: Hex,
withWorldProxy?: boolean,
): Promise<Address> {
const worldFactoryContracts = withWorldProxy
? getWorldProxyFactoryContracts(deployerAddress)
: getWorldFactoryContracts(deployerAddress);
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(worldFactoryContracts),
});
// 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 worldFactoryContracts["WorldFactory"].address;
return contracts.WorldFactory.address;
} else {
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;
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/getWorldProxyFactoryContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function getWorldProxyFactoryContracts(deployerAddress: Hex) {

return {
...worldContracts,
WorldFactory: {
WorldProxyFactory: {
bytecode: worldProxyFactoryBytecode,
deployedBytecodeSize: worldProxyFactoryDeployedBytecodeSize,
label: "world proxy factory",
Expand Down

0 comments on commit 6e60921

Please sign in to comment.