Skip to content

Commit 28dcc0f

Browse files
pxrlnicholaspai
andauthored
feat: deploy scripts should default to deploying Implementation, not Proxy, contracts in production (#448)
Also, update deployments with the v3 upgrades! Co-authored-by: nicholaspai <[email protected]>
1 parent c92993e commit 28dcc0f

19 files changed

+10144
-4122
lines changed

deploy/003_deploy_optimism_spokepool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1919
// Construct this spokepool with a:
2020
// * A WETH address of the WETH address
2121
// * A depositQuoteTimeBuffer of 1 hour
22-
// * A fillDeadlineBuffer of 9 hours
22+
// * A fillDeadlineBuffer of 8 hours
2323
// * Native USDC address on L2
2424
// * CCTP token messenger address on L2
2525
const constructorArgs = [
2626
"0x4200000000000000000000000000000000000006",
2727
3600,
28-
32400,
28+
28800,
2929
L2_ADDRESS_MAP[spokeChainId].l2Usdc,
3030
// L2_ADDRESS_MAP[spokeChainId].cctpTokenMessenger,
3131
// For now, we are not using the CCTP bridge and can disable by setting
3232
// the cctpTokenMessenger to the zero address.
3333
ZERO_ADDRESS,
3434
];
35-
await deployNewProxy("Optimism_SpokePool", constructorArgs, initArgs);
35+
await deployNewProxy("Optimism_SpokePool", constructorArgs, initArgs, spokeChainId === 10);
3636
};
3737
module.exports = func;
3838
func.tags = ["OptimismSpokePool", "optimism"];

deploy/005_deploy_arbitrum_spokepool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2020
// Construct this spokepool with a:
2121
// * A WETH address of the WETH address
2222
// * A depositQuoteTimeBuffer of 1 hour
23-
// * A fillDeadlineBuffer of 9 hours
23+
// * A fillDeadlineBuffer of 8 hours
2424
// * Native USDC address on L2
2525
// * CCTP token messenger address on L2
2626
const constructorArgs = [
2727
L2_ADDRESS_MAP[spokeChainId].l2Weth,
2828
3600,
29-
32400,
29+
28800,
3030
L2_ADDRESS_MAP[spokeChainId].l2Usdc,
3131
// L2_ADDRESS_MAP[spokeChainId].cctpTokenMessenger,
3232
// For now, we are not using the CCTP bridge and can disable by setting
3333
// the cctpTokenMessenger to the zero address.
3434
ZERO_ADDRESS,
3535
];
36-
await deployNewProxy("Arbitrum_SpokePool", constructorArgs, initArgs);
36+
await deployNewProxy("Arbitrum_SpokePool", constructorArgs, initArgs, spokeChainId === 42161);
3737
};
3838
module.exports = func;
3939
func.tags = ["ArbitrumSpokePool", "arbitrum"];

deploy/007_deploy_ethereum_spokepool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1616
// Construct this spokepool with a:
1717
// * A WETH address of the WETH address
1818
// * A depositQuoteTimeBuffer of 1 hour
19-
// * A fillDeadlineBuffer of 9 hours
20-
const constructorArgs = [L1_ADDRESS_MAP[chainId].weth, 3600, 32400];
21-
await deployNewProxy("Ethereum_SpokePool", constructorArgs, initArgs);
19+
// * A fillDeadlineBuffer of 8 hours
20+
const constructorArgs = [L1_ADDRESS_MAP[chainId].weth, 3600, 28800];
21+
await deployNewProxy("Ethereum_SpokePool", constructorArgs, initArgs, chainId === "1");
2222

2323
// Transfer ownership to hub pool.
2424
};

deploy/011_deploy_polygon_spokepool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2323
// Construct this spokepool with a:
2424
// * A WETH address of the WETH address
2525
// * A depositQuoteTimeBuffer of 1 hour
26-
// * A fillDeadlineBuffer of 9 hours
26+
// * A fillDeadlineBuffer of 8 hours
2727
// * Native USDC address on L2
2828
// * CCTP token messenger address on L2
2929
const constructorArgs = [
3030
L2_ADDRESS_MAP[spokeChainId].wMatic,
3131
3600,
32-
32400,
32+
28800,
3333
L2_ADDRESS_MAP[spokeChainId].l2Usdc,
3434
// L2_ADDRESS_MAP[spokeChainId].cctpTokenMessenger,
3535
// For now, we are not using the CCTP bridge and can disable by setting
3636
// the cctpTokenMessenger to the zero address.
3737
ZERO_ADDRESS,
3838
];
39-
await deployNewProxy("Polygon_SpokePool", constructorArgs, initArgs);
39+
await deployNewProxy("Polygon_SpokePool", constructorArgs, initArgs, spokeChainId === 137);
4040
};
4141

4242
module.exports = func;

deploy/016_deploy_zksync_spokepool.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,40 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2626
// Construct this spokepool with a:
2727
// * A WETH address of the WETH address
2828
// * A depositQuoteTimeBuffer of 1 hour
29-
// * A fillDeadlineBuffer of 9 hours
30-
const constructorArgs = [L2_ADDRESS_MAP[spokeChainId].l2Weth, 3600, 32400];
31-
32-
const proxy = await zkUpgrades.deployProxy(deployer.zkWallet, artifact, initArgs, {
33-
initializer: "initialize",
34-
kind: "uups",
35-
constructorArgs,
36-
unsafeAllow: ["delegatecall"], // Remove after upgrading openzeppelin-contracts-upgradeable post v4.9.3.
37-
});
38-
console.log(`Deployment transaction hash: ${proxy.deployTransaction.hash}.`);
39-
await proxy.deployed();
40-
console.log(`${contractName} deployed to chain ID ${spokeChainId} @ ${proxy.address}.`);
29+
// * A fillDeadlineBuffer of 8 hours
30+
const constructorArgs = [L2_ADDRESS_MAP[spokeChainId].l2Weth, 3600, 28800];
31+
32+
let newAddress;
33+
// On production, we'll rarely want to deploy a new proxy contract so we'll default to deploying a new implementation
34+
// contract.
35+
if (spokeChainId === 324) {
36+
const _deployment = await deployer.deploy(artifact, constructorArgs);
37+
newAddress = _deployment.address;
38+
console.log(`New ${contractName} implementation deployed @ ${newAddress}`);
39+
} else {
40+
const proxy = await zkUpgrades.deployProxy(deployer.zkWallet, artifact, initArgs, {
41+
initializer: "initialize",
42+
kind: "uups",
43+
constructorArgs,
44+
unsafeAllow: ["delegatecall"], // Remove after upgrading openzeppelin-contracts-upgradeable post v4.9.3.
45+
});
46+
console.log(`Deployment transaction hash: ${proxy.deployTransaction.hash}.`);
47+
await proxy.deployed();
48+
console.log(`${contractName} deployed to chain ID ${spokeChainId} @ ${proxy.address}.`);
49+
newAddress = proxy.address;
50+
}
4151

4252
// Save the deployment manually because OZ's hardhat-upgrades packages bypasses hardhat-deploy.
4353
// See also: https://stackoverflow.com/questions/74870472
4454
const extendedArtifact = await deployments.getExtendedArtifact(contractName);
4555
const deployment: DeploymentSubmission = {
46-
address: proxy.address,
56+
address: newAddress,
4757
...extendedArtifact,
4858
};
4959
await deployments.save(contractName, deployment);
5060

5161
// Verify the proxy + implementation contract.
52-
await hre.run("verify:verify", { address: proxy.address });
62+
await hre.run("verify:verify", { address: newAddress, constructorArguments: constructorArgs });
5363
};
5464

5565
module.exports = func;

deploy/025_deploy_base_spokepool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1818
// Construct this spokepool with a:
1919
// * A WETH address of the WETH address
2020
// * A depositQuoteTimeBuffer of 1 hour
21-
// * A fillDeadlineBuffer of 9 hours
21+
// * A fillDeadlineBuffer of 8 hours
2222
// * Native USDC address on L2
2323
// * CCTP token messenger address on L2
2424
const constructorArgs = [
2525
"0x4200000000000000000000000000000000000006",
2626
3600,
27-
32400,
27+
28800,
2828
L2_ADDRESS_MAP[spokeChainId].l2Usdc,
2929
// L2_ADDRESS_MAP[spokeChainId].cctpTokenMessenger,
3030
// For now, we are not using the CCTP bridge and can disable by setting
3131
// the cctpTokenMessenger to the zero address.
3232
ZERO_ADDRESS,
3333
];
34-
await deployNewProxy("Base_SpokePool", constructorArgs, initArgs);
34+
await deployNewProxy("Base_SpokePool", constructorArgs, initArgs, spokeChainId === 8453);
3535
};
3636
module.exports = func;
3737
func.tags = ["BaseSpokePool", "base"];

0 commit comments

Comments
 (0)