Skip to content

Commit

Permalink
feat: use static salt for deploy task
Browse files Browse the repository at this point in the history
This is so helpful when testing locally, but carries a little risk that
the code is easily front-runnable for ownership
  • Loading branch information
cpb8010 committed Dec 19, 2024
1 parent 0b7f4b3 commit 941e020
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function deploy(name: string, deployer: Wallet, proxy: boolean, args?: any
console.log("Deploying", name, "contract...");
let implContract;
if (name == FACTORY_NAME) {
implContract = await deployFactory(deployer, args![0]);
implContract = await deployFactory(deployer, args![0], ethersStaticSalt);
} else {
implContract = await create2(name, deployer, ethersStaticSalt, args);
}
Expand Down
3 changes: 1 addition & 2 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,9 @@ export async function deployFactory(wallet: Wallet, beaconAddress: string, salt?
const standardCreate2Address = utils.create2Address(wallet.address, factoryBytecodeHash, factorySalt, constructorArgs);
const accountCode = await wallet.provider.getCode(standardCreate2Address);
if (accountCode != "0x") {
logInfo(`Factory already exists!`);
logInfo(`Factory already exists at ${standardCreate2Address}`);
return AAFactory__factory.connect(standardCreate2Address, wallet);
}
logInfo(`Factory doesn't exist at ${standardCreate2Address}!`);
const factory = await deployer.deploy(
bytecodeHash,
beaconAddress,
Expand Down

0 comments on commit 941e020

Please sign in to comment.