[Chore] - standardise contract deploy logs (#460)

* standardise contract deploy logs

* apply standardization to hardhat deploy scripts

* Update contracts/common/helpers/deployments.ts

Co-authored-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com>
Signed-off-by: The Dark Jester <thedarkjester@users.noreply.github.com>

* fix copy paste issues

* use refactored deployment logger

* add a lint space

---------

Signed-off-by: The Dark Jester <thedarkjester@users.noreply.github.com>
Co-authored-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com>
This commit is contained in:
The Dark Jester
2024-12-18 15:13:56 +00:00
committed by GitHub
parent bc0cfbb059
commit 4405f315a9
24 changed files with 237 additions and 237 deletions

View File

@@ -1,4 +1,4 @@
import { ethers, AbstractSigner, Interface, InterfaceAbi } from "ethers";
import { ethers, AbstractSigner, Interface, InterfaceAbi, BaseContract } from "ethers";
export function getInitializerData(contractAbi: InterfaceAbi, initializerFunctionName: string, args: unknown[]) {
const contractInterface = new Interface(contractAbi);
@@ -12,6 +12,7 @@ export function getInitializerData(contractAbi: InterfaceAbi, initializerFunctio
}
export async function deployContractFromArtifacts(
contractName: string,
abi: ethers.InterfaceAbi,
bytecode: ethers.BytesLike,
wallet: AbstractSigner,
@@ -20,5 +21,21 @@ export async function deployContractFromArtifacts(
) {
const factory = new ethers.ContractFactory(abi, bytecode, wallet);
const contract = await factory.deploy(...args);
return contract.waitForDeployment();
await LogContractDeployment(contractName, contract);
return contract;
}
export async function LogContractDeployment(contractName: string, contract: BaseContract) {
const txReceipt = await contract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Deployment transaction not found.";
}
const contractAddress = await contract.getAddress();
const chainId = (await contract.deploymentTransaction()!.provider.getNetwork()).chainId;
console.log(
`contract=${contractName} deployed: address=${contractAddress} blockNumber=${txReceipt.blockNumber} chainId=${chainId}`,
);
}

View File

@@ -2,7 +2,13 @@ import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { deployFromFactory } from "../scripts/hardhat/utils";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress, getRequiredEnvVar } from "../common/helpers";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
getRequiredEnvVar,
LogContractDeployment,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
@@ -18,17 +24,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Deploying new version, NB: ${existingContractAddress} will be overwritten if env SAVE_ADDRESS=true.`);
}
const contract = await deployFromFactory(contractName, provider);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
console.log(`${contractName} deployed at ${contractAddress}`);
process.env.PLONKVERIFIER_ADDRESS = contractAddress;
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Deployment transaction not found.";
}
await tryStoreAddress(hre.network.name, contractName, contractAddress, deployTx.hash);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
await tryVerifyContract(contractAddress);
};

View File

@@ -4,6 +4,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
import { deployFromFactory } from "../scripts/hardhat/utils";
import { get1559Fees } from "../scripts/utils";
import {
LogContractDeployment,
getDeployedContractAddress,
getRequiredEnvVar,
tryStoreAddress,
@@ -43,16 +44,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
adminAddress,
await get1559Fees(provider),
);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
console.log(`${contractName} deployed at ${contractAddress}`);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Deployment transaction not found.";
}
await tryStoreAddress(hre.network.name, contractName, contractAddress, deployTx.hash);
const args = [minDelay, timeLockProposers?.split(","), timelockExecutors?.split(","), adminAddress];
await tryVerifyContractWithConstructorArgs(

View File

@@ -8,6 +8,7 @@ import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
LogContractDeployment,
} from "../common/helpers";
import {
LINEA_ROLLUP_INITIALIZE_SIGNATURE,
@@ -75,15 +76,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
unsafeAllow: ["constructor"],
},
);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
const txReceipt = await contract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${contractName} deployed: address=${contractAddress} blockNumber=${txReceipt.blockNumber}`);
await tryStoreAddress(hre.network.name, contractName, contractAddress, txReceipt.hash);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
await tryVerifyContract(contractAddress);
};

View File

@@ -2,6 +2,7 @@ import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { deployUpgradableFromFactory } from "../scripts/hardhat/utils";
import {
LogContractDeployment,
getDeployedContractAddress,
getRequiredEnvVar,
tryStoreAddress,
@@ -60,15 +61,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
const txReceipt = await contract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${contractName} deployed: address=${contractAddress} blockNumber=${txReceipt.blockNumber}`);
await tryStoreAddress(hre.network.name, contractName, contractAddress, txReceipt.hash);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
await tryVerifyContract(contractAddress);
};

View File

@@ -8,6 +8,7 @@ import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
LogContractDeployment,
} from "../common/helpers";
import {
L1_L2_MESSAGE_SETTER_ROLE,
@@ -59,14 +60,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
unsafeAllow: ["constructor"],
},
);
const contractAddress = await contract.getAddress();
const txReceipt = await contract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${contractName} deployed: address=${contractAddress} blockNumber=${txReceipt.blockNumber}`);
await tryStoreAddress(hre.network.name, contractName, contractAddress, txReceipt.hash);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
await tryVerifyContract(contractAddress);
};

View File

@@ -4,7 +4,13 @@ import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import path from "path";
import { deployUpgradableWithAbiAndByteCode } from "../scripts/hardhat/utils";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress, getRequiredEnvVar } from "../common/helpers";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
getRequiredEnvVar,
LogContractDeployment,
} from "../common/helpers";
import { abi, bytecode } from "./V1/L2MessageServiceV1Deployed.json";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
@@ -54,15 +60,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
const txReceipt = await contract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${contractName} deployed at ${contractAddress}`);
await tryStoreAddress(hre.network.name, contractName, contractAddress, txReceipt.hash);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
await tryVerifyContract(contractAddress);

View File

@@ -2,7 +2,12 @@ import { ethers, network, upgrades } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { BridgedToken } from "../typechain-types";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress } from "../common/helpers";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
LogContractDeployment,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
@@ -23,19 +28,18 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const BridgedToken = await ethers.getContractFactory(contractName);
const bridgedToken = (await upgrades.deployBeacon(BridgedToken)) as unknown as BridgedToken;
await bridgedToken.waitForDeployment();
await LogContractDeployment(contractName, bridgedToken);
const bridgedTokenAddress = await bridgedToken.getAddress();
process.env.BRIDGED_TOKEN_ADDRESS = bridgedTokenAddress;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const deployTx = bridgedToken.deployTransaction;
if (!deployTx) {
throw "Contract deployment transaction receipt not found.";
}
await tryStoreAddress(network.name, contractName, bridgedTokenAddress, deployTx.hash);
await tryStoreAddress(
hre.network.name,
contractName,
bridgedTokenAddress,
bridgedToken.deploymentTransaction()!.hash,
);
if (process.env.TOKEN_BRIDGE_L1 === "true") {
console.log(`L1 BridgedToken beacon deployed on ${network.name}, at address:`, bridgedTokenAddress);

View File

@@ -14,6 +14,7 @@ import {
tryStoreAddress,
tryStoreProxyAdminAddress,
getRequiredEnvVar,
LogContractDeployment,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
@@ -100,15 +101,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
]);
await tokenBridge.waitForDeployment();
await LogContractDeployment(contractName, tokenBridge);
const tokenBridgeAddress = await tokenBridge.getAddress();
const deployTx = tokenBridge.deploymentTransaction();
if (!deployTx) {
throw "Contract deployment transaction receipt not found.";
}
await tryStoreAddress(network.name, contractName, tokenBridgeAddress, deployTx.hash);
await tryStoreAddress(hre.network.name, contractName, tokenBridgeAddress, tokenBridge.deploymentTransaction()!.hash);
const proxyAdminAddress = await upgrades.erc1967.getAdminAddress(tokenBridgeAddress);

View File

@@ -8,6 +8,7 @@ import {
getDeployedContractAddress,
tryStoreAddress,
getRequiredEnvVar,
LogContractDeployment,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
@@ -25,16 +26,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`Deploying new version, NB: ${existingContractAddress} will be overwritten if env SAVE_ADDRESS=true.`);
}
const contract = await deployFromFactory(contractName, provider, adminAddress, await get1559Fees(provider));
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
console.log(`${contractName} deployed at ${contractAddress}`);
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Contract deployment transaction receipt not found.";
}
await tryStoreAddress(hre.network.name, contractName, contractAddress, deployTx.hash);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
const args = [adminAddress];

View File

@@ -8,6 +8,7 @@ import {
getDeployedContractAddress,
tryStoreAddress,
getRequiredEnvVar,
LogContractDeployment,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
@@ -35,19 +36,13 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
transferAddresses,
await get1559Fees(provider),
);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
console.log(`${contractName} deployed at ${contractAddress}`);
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Contract deployment transaction receipt not found.";
}
await tryStoreAddress(hre.network.name, contractName, contractAddress, deployTx.hash);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
const args = [adminAddress, minterAddress, transferAddresses];
await tryVerifyContractWithConstructorArgs(contractAddress, "contracts/token/LineaSurgeXP.sol:LineaSurgeXP", args);
};
export default func;

View File

@@ -34,19 +34,20 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
);
await customBridgedToken.waitForDeployment();
const customBridgedTokenAddress = await customBridgedToken.getAddress();
const deployTx = customBridgedToken.deploymentTransaction();
if (!deployTx) {
throw "Contract deployment transaction receipt not found.";
const txReceipt = await customBridgedToken.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Deployment transaction not found.";
}
await tryStoreAddress(network.name, contractName, customBridgedTokenAddress, deployTx.hash);
const contractAddress = await customBridgedToken.getAddress();
console.log(`CustomBridgedToken deployed on ${network.name}, at address:`, customBridgedTokenAddress);
console.log(
`contract=${contractName} deployed: address=${contractAddress} blockNumber=${txReceipt.blockNumber} chainId=${chainId}`,
);
await tryVerifyContract(customBridgedTokenAddress);
await tryStoreAddress(network.name, contractName, contractAddress, txReceipt.hash);
await tryVerifyContract(contractAddress);
};
export default func;
func.tags = ["CustomBridgedToken"];

View File

@@ -2,6 +2,7 @@ import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { deployFromFactory } from "../scripts/hardhat/utils";
import { get1559Fees } from "../scripts/utils";
import { LogContractDeployment } from "contracts/common/helpers";
const func: DeployFunction = async function () {
const contractName = "TestEIP4844";
@@ -9,14 +10,7 @@ const func: DeployFunction = async function () {
const provider = ethers.provider;
const contract = await deployFromFactory(contractName, provider, await get1559Fees(provider));
const contractAddress = await contract.getAddress();
console.log(`${contractName} deployed at ${contractAddress}`);
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Contract deployment transaction receipt not found.";
}
await LogContractDeployment(contractName, contract);
};
export default func;
func.tags = ["TestEIP4844"];

View File

@@ -1,7 +1,13 @@
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { deployUpgradableFromFactory } from "../scripts/hardhat/utils";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress, getRequiredEnvVar } from "../common/helpers";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
getRequiredEnvVar,
LogContractDeployment,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
@@ -30,15 +36,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
},
);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
const txReceipt = await contract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${contractName} deployed: address=${contractAddress} blockNumber=${txReceipt.blockNumber}`);
await tryStoreAddress(hre.network.name, contractName, contractAddress, txReceipt.hash);
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
await tryVerifyContract(contractAddress);
};

View File

@@ -1,7 +1,13 @@
import { ethers, network } from "hardhat";
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { getRequiredEnvVar, tryVerifyContract, tryStoreAddress, getDeployedContractAddress } from "../common/helpers";
import {
getRequiredEnvVar,
tryVerifyContract,
tryStoreAddress,
getDeployedContractAddress,
LogContractDeployment,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
@@ -22,18 +28,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const TestERC20Factory = await ethers.getContractFactory(contractName);
const contract = await TestERC20Factory.deploy(tokenName, tokenSymbol, ethers.parseEther(initialSupply));
await contract.waitForDeployment();
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Deployment transaction not found.";
}
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
await tryStoreAddress(network.name, contractName, contractAddress, deployTx.hash);
const chainId = (await ethers.provider.getNetwork()).chainId;
console.log(`${contractName} deployed on ${network.name}, chainId=${chainId}, at address: ${contractAddress}`);
await tryVerifyContract(contractAddress);
};

View File

@@ -1,9 +1,15 @@
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { deployFromFactory } from "../scripts/hardhat/utils";
import { getRequiredEnvVar, tryVerifyContractWithConstructorArgs } from "../common/helpers";
import {
LogContractDeployment,
getRequiredEnvVar,
tryStoreAddress,
tryVerifyContractWithConstructorArgs,
} from "../common/helpers";
import { HardhatRuntimeEnvironment } from "hardhat/types";
const func: DeployFunction = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const contractName = "CallForwardingProxy";
const provider = ethers.provider;
@@ -12,14 +18,11 @@ const func: DeployFunction = async function () {
const targetAddress = getRequiredEnvVar("LINEA_ROLLUP_ADDRESS");
const contract = await deployFromFactory(contractName, provider, targetAddress);
await LogContractDeployment(contractName, contract);
const contractAddress = await contract.getAddress();
console.log(`${contractName} deployed at ${contractAddress}`);
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Deployment transaction not found.";
}
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
const args = [targetAddress];

View File

@@ -1,7 +1,20 @@
import { abi as ProxyAdminAbi, bytecode as ProxyAdminBytecode } from "./static-artifacts/ProxyAdmin.json";
import { abi as BridgedTokenAbi, bytecode as BridgedTokenBytecode } from "./dynamic-artifacts/BridgedToken.json";
import { abi as TokenBridgeAbi, bytecode as TokenBridgeBytecode } from "./dynamic-artifacts/TokenBridge.json";
import {
contractName as ProxyAdminContractName,
abi as ProxyAdminAbi,
bytecode as ProxyAdminBytecode,
} from "./static-artifacts/ProxyAdmin.json";
import {
contractName as BridgedTokenContractName,
abi as BridgedTokenAbi,
bytecode as BridgedTokenBytecode,
} from "./dynamic-artifacts/BridgedToken.json";
import {
contractName as TokenBridgeContractName,
abi as TokenBridgeAbi,
bytecode as TokenBridgeBytecode,
} from "./dynamic-artifacts/TokenBridge.json";
import {
contractName as UpgradeableBeaconContractName,
abi as UpgradeableBeaconAbi,
bytecode as UpgradeableBeaconBytecode,
} from "./static-artifacts/UpgradeableBeacon.json";
@@ -23,8 +36,6 @@ import { deployContractFromArtifacts, getInitializerData } from "../common/helpe
async function main() {
const ORDERED_NONCE_POST_L2MESSAGESERVICE = 3;
const ORDERED_NONCE_POST_LINEAROLLUP = 4;
const bridgedTokenName = "BridgedToken";
const tokenBridgeName = "TokenBridge";
const l2MessageServiceAddress = process.env.L2MESSAGESERVICE_ADDRESS;
const lineaRollupAddress = process.env.LINEA_ROLLUP_ADDRESS;
@@ -55,10 +66,18 @@ async function main() {
}
}
const tokenBridgeContractImplementationName = "tokenBridgeContractImplementation";
const [bridgedToken, tokenBridgeImplementation, proxyAdmin] = await Promise.all([
deployContractFromArtifacts(BridgedTokenAbi, BridgedTokenBytecode, wallet, { nonce: walletNonce }),
deployContractFromArtifacts(TokenBridgeAbi, TokenBridgeBytecode, wallet, { nonce: walletNonce + 1 }),
deployContractFromArtifacts(ProxyAdminAbi, ProxyAdminBytecode, wallet, { nonce: walletNonce + 2 }),
deployContractFromArtifacts(BridgedTokenContractName, BridgedTokenAbi, BridgedTokenBytecode, wallet, {
nonce: walletNonce,
}),
deployContractFromArtifacts(tokenBridgeContractImplementationName, TokenBridgeAbi, TokenBridgeBytecode, wallet, {
nonce: walletNonce + 1,
}),
deployContractFromArtifacts(ProxyAdminContractName, ProxyAdminAbi, ProxyAdminBytecode, wallet, {
nonce: walletNonce + 2,
}),
]);
const bridgedTokenAddress = await bridgedToken.getAddress();
@@ -67,12 +86,10 @@ async function main() {
const chainId = (await provider.getNetwork()).chainId;
console.log(`${bridgedTokenName} contract deployed at ${bridgedTokenAddress}`);
console.log(`${tokenBridgeName} Implementation contract deployed at ${tokenBridgeImplementationAddress}`);
console.log(`L1 ProxyAdmin deployed: address=${proxyAdminAddress}`);
console.log(`Deploying UpgradeableBeacon: chainId=${chainId} bridgedTokenAddress=${bridgedTokenAddress}`);
const beaconProxy = await deployContractFromArtifacts(
UpgradeableBeaconContractName,
UpgradeableBeaconAbi,
UpgradeableBeaconBytecode,
wallet,
@@ -114,7 +131,8 @@ async function main() {
},
]);
const proxyContract = await deployContractFromArtifacts(
await deployContractFromArtifacts(
TokenBridgeContractName,
TransparentUpgradeableProxyAbi,
TransparentUpgradeableProxyBytecode,
wallet,
@@ -122,17 +140,6 @@ async function main() {
proxyAdminAddress,
initializer,
);
const proxyContractAddress = await proxyContract.getAddress();
const txReceipt = await proxyContract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(
`${tokenBridgeName} deployed: chainId=${chainId} address=${proxyContractAddress} blockNumber=${txReceipt.blockNumber}`,
);
}
main().catch((error) => {

View File

@@ -1,10 +1,15 @@
import { ethers } from "ethers";
import * as dotenv from "dotenv";
import {
contractName as L2MessageServiceContractName,
abi as L2MessageServiceAbi,
bytecode as L2MessageServiceBytecode,
} from "./dynamic-artifacts/L2MessageService.json";
import { abi as ProxyAdminAbi, bytecode as ProxyAdminBytecode } from "./static-artifacts/ProxyAdmin.json";
import {
contractName as ProxyAdminContractName,
abi as ProxyAdminAbi,
bytecode as ProxyAdminBytecode,
} from "./static-artifacts/ProxyAdmin.json";
import {
abi as TransparentUpgradeableProxyAbi,
bytecode as TransparentUpgradeableProxyBytecode,
@@ -38,16 +43,26 @@ async function main() {
walletNonce = parseInt(process.env.L2_NONCE);
}
const l2MessageServiceContractImplementationName = "L2MessageServiceImplementation";
const [l2MessageServiceImplementation, proxyAdmin] = await Promise.all([
deployContractFromArtifacts(L2MessageServiceAbi, L2MessageServiceBytecode, wallet, { nonce: walletNonce }),
deployContractFromArtifacts(ProxyAdminAbi, ProxyAdminBytecode, wallet, { nonce: walletNonce + 1 }),
deployContractFromArtifacts(
l2MessageServiceContractImplementationName,
L2MessageServiceAbi,
L2MessageServiceBytecode,
wallet,
{
nonce: walletNonce,
},
),
deployContractFromArtifacts(ProxyAdminContractName, ProxyAdminAbi, ProxyAdminBytecode, wallet, {
nonce: walletNonce + 1,
}),
]);
const proxyAdminAddress = await proxyAdmin.getAddress();
const l2MessageServiceImplementationAddress = await l2MessageServiceImplementation.getAddress();
console.log(`L2 ProxyAdmin deployed: address=${proxyAdminAddress}`);
const pauseTypeRoles = getEnvVarOrDefault("L2MSGSERVICE_PAUSE_TYPE_ROLES", L2_MESSAGE_SERVICE_PAUSE_TYPES_ROLES);
const unpauseTypeRoles = getEnvVarOrDefault(
"L2MSGSERVICE_UNPAUSE_TYPE_ROLES",
@@ -69,7 +84,8 @@ async function main() {
unpauseTypeRoles,
]);
const proxyContract = await deployContractFromArtifacts(
await deployContractFromArtifacts(
L2MessageServiceContractName,
TransparentUpgradeableProxyAbi,
TransparentUpgradeableProxyBytecode,
wallet,
@@ -77,15 +93,6 @@ async function main() {
proxyAdminAddress,
initializer,
);
const proxyContractAddress = await proxyContract.getAddress();
const txReceipt = await proxyContract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${messageServiceName} deployed: address=${proxyContractAddress} blockNumber=${txReceipt.blockNumber}`);
}
main().catch((error) => {

View File

@@ -1,6 +1,14 @@
import { ethers } from "ethers";
import { abi as londonEvmYulAbi, bytecode as londonEvmYulBytecode } from "./static-artifacts/LondonEvmCodes.json";
import { abi as opcodeTesterAbi, bytecode as opcodeTesterBytecode } from "./static-artifacts/OpcodeTester.json";
import {
contractName as londonEvmYulName,
abi as londonEvmYulAbi,
bytecode as londonEvmYulBytecode,
} from "./static-artifacts/LondonEvmCodes.json";
import {
contractName as opcodeTesterName,
abi as opcodeTesterAbi,
bytecode as opcodeTesterBytecode,
} from "./static-artifacts/OpcodeTester.json";
import { deployContractFromArtifacts } from "../common/helpers/deployments";
async function main() {
@@ -8,36 +16,35 @@ async function main() {
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
console.log(`Deploying London EVM Yul based contract with verbatim bytecode`);
const londonEvmYulAddress = await deployLondonEvmYul(wallet, provider);
const londonEvmYulAddress = await deployLondonEvmYul(wallet);
console.log(`Deploying the main OPCODE tester with yul contract at ${londonEvmYulAddress}`);
await deployOpcodeTester(wallet, provider, londonEvmYulAddress);
await deployOpcodeTester(wallet, londonEvmYulAddress);
}
async function deployLondonEvmYul(wallet: ethers.Wallet, provider: ethers.JsonRpcApiProvider): Promise<string> {
async function deployLondonEvmYul(wallet: ethers.Wallet): Promise<string> {
const walletNonce = await wallet.getNonce();
const londonEvmYul = await deployContractFromArtifacts(londonEvmYulAbi, londonEvmYulBytecode, wallet, {
nonce: walletNonce,
});
const londonEvmYul = await deployContractFromArtifacts(
londonEvmYulName,
londonEvmYulAbi,
londonEvmYulBytecode,
wallet,
{
nonce: walletNonce,
},
);
const londonEvmYulAddress = await londonEvmYul.getAddress();
const chainId = (await provider.getNetwork()).chainId;
console.log(`londonEvmYulAddress deployed: address=${londonEvmYulAddress} chainId=${chainId}`);
return londonEvmYulAddress;
}
async function deployOpcodeTester(
wallet: ethers.Wallet,
provider: ethers.JsonRpcApiProvider,
londonEvmYulAddress: string,
) {
async function deployOpcodeTester(wallet: ethers.Wallet, londonEvmYulAddress: string) {
const walletNonce = await wallet.getNonce();
const opcodeTester = await deployContractFromArtifacts(
await deployContractFromArtifacts(
opcodeTesterName,
opcodeTesterAbi,
opcodeTesterBytecode,
wallet,
@@ -46,12 +53,6 @@ async function deployOpcodeTester(
nonce: walletNonce,
},
);
const opcodeTesterAddress = await opcodeTester.getAddress();
const chainId = (await provider.getNetwork()).chainId;
console.log(`opcodeTesterAddress deployed: address=${opcodeTesterAddress} chainId=${chainId}`);
}
main().catch((error) => {

View File

@@ -3,7 +3,11 @@ import fs from "fs";
import path from "path";
import * as dotenv from "dotenv";
import { abi as LineaRollupV5Abi, bytecode as LineaRollupV5Bytecode } from "./dynamic-artifacts/LineaRollupV5.json";
import { abi as ProxyAdminAbi, bytecode as ProxyAdminBytecode } from "./static-artifacts/ProxyAdmin.json";
import {
contractName as ProxyAdminContractName,
abi as ProxyAdminAbi,
bytecode as ProxyAdminBytecode,
} from "./static-artifacts/ProxyAdmin.json";
import {
abi as TransparentUpgradeableProxyAbi,
bytecode as TransparentUpgradeableProxyBytecode,
@@ -46,7 +50,7 @@ async function main() {
const lineaRollupTateLimitAmountInWei = getRequiredEnvVar("LINEA_ROLLUP_RATE_LIMIT_AMOUNT");
const lineaRollupGenesisTimestamp = getRequiredEnvVar("LINEA_ROLLUP_GENESIS_TIMESTAMP");
const lineaRollupName = "LineaRollupV5";
const lineaRollupImplementationName = "LineaRollupV5Implementation";
const verifierArtifacts = findContractArtifacts(path.join(__dirname, "./dynamic-artifacts"), verifierName);
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
@@ -63,15 +67,15 @@ async function main() {
}
const [verifier, lineaRollupImplementation, proxyAdmin] = await Promise.all([
deployContractFromArtifacts(verifierArtifacts.abi, verifierArtifacts.bytecode, wallet, {
deployContractFromArtifacts(verifierName, verifierArtifacts.abi, verifierArtifacts.bytecode, wallet, {
nonce: walletNonce,
gasPrice,
}),
deployContractFromArtifacts(LineaRollupV5Abi, LineaRollupV5Bytecode, wallet, {
deployContractFromArtifacts(lineaRollupImplementationName, LineaRollupV5Abi, LineaRollupV5Bytecode, wallet, {
nonce: walletNonce + 1,
gasPrice,
}),
deployContractFromArtifacts(ProxyAdminAbi, ProxyAdminBytecode, wallet, {
deployContractFromArtifacts(ProxyAdminContractName, ProxyAdminAbi, ProxyAdminBytecode, wallet, {
nonce: walletNonce + 2,
gasPrice,
}),
@@ -81,9 +85,6 @@ async function main() {
const verifierAddress = await verifier.getAddress();
const lineaRollupImplementationAddress = await lineaRollupImplementation.getAddress();
console.log(`${verifierName} deployed: address=${verifierAddress}`);
console.log(`L1 ProxyAdmin deployed: address=${proxyAdminAddress}`);
const initializer = getInitializerData(LineaRollupV5Abi, "initialize", [
lineaRollupInitialStateRootHash,
lineaRollupInitialL2BlockNumber,
@@ -95,7 +96,8 @@ async function main() {
lineaRollupGenesisTimestamp,
]);
const proxyContract = await deployContractFromArtifacts(
await deployContractFromArtifacts(
lineaRollupName,
TransparentUpgradeableProxyAbi,
TransparentUpgradeableProxyBytecode,
wallet,
@@ -104,15 +106,6 @@ async function main() {
initializer,
{ gasPrice },
);
const proxyContractAddress = await proxyContract.getAddress();
const txReceipt = await proxyContract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${lineaRollupName} deployed: address=${proxyContractAddress} blockNumber=${txReceipt.blockNumber}`);
}
main().catch((error) => {

View File

@@ -3,7 +3,11 @@ import fs from "fs";
import path from "path";
import * as dotenv from "dotenv";
import { abi as LineaRollupV6Abi, bytecode as LineaRollupV6Bytecode } from "./dynamic-artifacts/LineaRollupV6.json";
import { abi as ProxyAdminAbi, bytecode as ProxyAdminBytecode } from "./static-artifacts/ProxyAdmin.json";
import {
contractName as ProxyAdminContractName,
abi as ProxyAdminAbi,
bytecode as ProxyAdminBytecode,
} from "./static-artifacts/ProxyAdmin.json";
import {
abi as TransparentUpgradeableProxyAbi,
bytecode as TransparentUpgradeableProxyBytecode,
@@ -54,6 +58,7 @@ async function main() {
const lineaRollupGenesisTimestamp = getRequiredEnvVar("LINEA_ROLLUP_GENESIS_TIMESTAMP");
const multiCallAddress = "0xcA11bde05977b3631167028862bE2a173976CA11";
const lineaRollupName = "LineaRollupV6";
const lineaRollupImplementationName = "LineaRollupV6Implementation";
const pauseTypeRoles = getEnvVarOrDefault("LINEA_ROLLUP_PAUSE_TYPE_ROLES", LINEA_ROLLUP_PAUSE_TYPES_ROLES);
const unpauseTypeRoles = getEnvVarOrDefault("LINEA_ROLLUP_UNPAUSE_TYPE_ROLES", LINEA_ROLLUP_UNPAUSE_TYPES_ROLES);
@@ -79,24 +84,24 @@ async function main() {
}
const [verifier, lineaRollupImplementation, proxyAdmin] = await Promise.all([
deployContractFromArtifacts(verifierArtifacts.abi, verifierArtifacts.bytecode, wallet, {
deployContractFromArtifacts(verifierName, verifierArtifacts.abi, verifierArtifacts.bytecode, wallet, {
nonce: walletNonce,
gasPrice,
}),
deployContractFromArtifacts(LineaRollupV6Abi, LineaRollupV6Bytecode, wallet, {
deployContractFromArtifacts(lineaRollupImplementationName, LineaRollupV6Abi, LineaRollupV6Bytecode, wallet, {
nonce: walletNonce + 1,
gasPrice,
}),
deployContractFromArtifacts(ProxyAdminAbi, ProxyAdminBytecode, wallet, { nonce: walletNonce + 2, gasPrice }),
deployContractFromArtifacts(ProxyAdminContractName, ProxyAdminAbi, ProxyAdminBytecode, wallet, {
nonce: walletNonce + 2,
gasPrice,
}),
]);
const proxyAdminAddress = await proxyAdmin.getAddress();
const verifierAddress = await verifier.getAddress();
const lineaRollupImplementationAddress = await lineaRollupImplementation.getAddress();
console.log(`${verifierName} deployed: address=${verifierAddress}`);
console.log(`L1 ProxyAdmin deployed: address=${proxyAdminAddress}`);
const initializer = getInitializerData(LineaRollupV6Abi, "initialize", [
{
initialStateRootHash: lineaRollupInitialStateRootHash,
@@ -113,7 +118,8 @@ async function main() {
},
]);
const proxyContract = await deployContractFromArtifacts(
await deployContractFromArtifacts(
lineaRollupName,
TransparentUpgradeableProxyAbi,
TransparentUpgradeableProxyBytecode,
wallet,
@@ -122,15 +128,6 @@ async function main() {
initializer,
{ gasPrice },
);
const proxyContractAddress = await proxyContract.getAddress();
const txReceipt = await proxyContract.deploymentTransaction()?.wait();
if (!txReceipt) {
throw "Contract deployment transaction receipt not found.";
}
console.log(`${lineaRollupName} deployed: address=${proxyContractAddress} blockNumber=${txReceipt.blockNumber}`);
}
main().catch((error) => {

View File

@@ -1,5 +1,9 @@
import { ethers } from "ethers";
import { abi as TestERC20Abi, bytecode as TestERC20Bytecode } from "./static-artifacts/TestERC20.json";
import {
contractName as TestERC20ContractName,
abi as TestERC20Abi,
bytecode as TestERC20Bytecode,
} from "./static-artifacts/TestERC20.json";
import { deployContractFromArtifacts } from "../common/helpers/deployments";
import { get1559Fees } from "../scripts/utils";
import { getRequiredEnvVar } from "../common/helpers/environment";
@@ -35,7 +39,8 @@ async function main() {
}
}
const testERC20 = await deployContractFromArtifacts(
await deployContractFromArtifacts(
TestERC20ContractName,
TestERC20Abi,
TestERC20Bytecode,
wallet,
@@ -47,12 +52,6 @@ async function main() {
gasPrice,
},
);
const testERC20Address = await testERC20.getAddress();
const chainId = (await provider.getNetwork()).chainId;
console.log(`testERC20 deployed: address=${testERC20Address} chainId=${chainId}`);
}
main().catch((error) => {

View File

@@ -75,10 +75,10 @@ fun executeCommand(
}
internal val lineaRollupAddressPattern = Pattern.compile(
"^LineaRollup(?:.*)? deployed: address=(0x[0-9a-fA-F]{40}) blockNumber=(\\d+)"
"^contract=LineaRollup(?:.*)? deployed: address=(0x[0-9a-fA-F]{40}) blockNumber=(\\d+)"
)
internal val l2MessageServiceAddressPattern = Pattern.compile(
"^L2MessageService(?:.*)? deployed: address=(0x[0-9a-fA-F]{40}) blockNumber=(\\d+)"
"^contract=L2MessageService(?:.*)? deployed: address=(0x[0-9a-fA-F]{40}) blockNumber=(\\d+)"
)
data class DeployedContract(

View File

@@ -11,7 +11,7 @@ class MakefileContractDeploymentHelperKtTest {
getDeployedAddress(
listOf(
"L2MessageService artifact has been deployed in 1.2659626659999998s ",
"L2MessageService deployed: address=0xFE48d65B84AA0E23594Fd585c11cAD831F90AcB6 blockNumber=8",
"contract=L2MessageService deployed: address=0xFE48d65B84AA0E23594Fd585c11cAD831F90AcB6 blockNumber=8",
""
),
l2MessageServiceAddressPattern
@@ -24,7 +24,7 @@ class MakefileContractDeploymentHelperKtTest {
getDeployedAddress(
listOf(
"L2MessageServiceV1.2.3 artifact has been deployed in 1.2659626659999998s ",
"L2MessageServiceV1.2.3 deployed: address=0xFE48d65B84AA0E23594Fd585c11cAD831F90AcB6 blockNumber=8",
"contract=L2MessageServiceV1.2.3 deployed: address=0xFE48d65B84AA0E23594Fd585c11cAD831F90AcB6 blockNumber=8",
""
),
l2MessageServiceAddressPattern
@@ -40,7 +40,7 @@ class MakefileContractDeploymentHelperKtTest {
getDeployedAddress(
listOf(
"LineaRollup artifact has been deployed in 1.855172125s ",
"LineaRollup deployed: address=0x8613180dF1485B8b87DEE3BCf31896659eb1a092 blockNumber=1414",
"contract=LineaRollup deployed: address=0x8613180dF1485B8b87DEE3BCf31896659eb1a092 blockNumber=1414",
""
),
lineaRollupAddressPattern
@@ -53,7 +53,7 @@ class MakefileContractDeploymentHelperKtTest {
getDeployedAddress(
listOf(
"LineaRollupV5.2.1 artifact has been deployed in 1.855172125s ",
"LineaRollupV5.2.1 deployed: address=0x8613180dF1485B8b87DEE3BCf31896659eb1a092 blockNumber=1414",
"contract=LineaRollupV5.2.1 deployed: address=0x8613180dF1485B8b87DEE3BCf31896659eb1a092 blockNumber=1414",
""
),
lineaRollupAddressPattern