mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 15:38:06 -05:00
* 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>
63 lines
2.0 KiB
TypeScript
63 lines
2.0 KiB
TypeScript
import { ethers } from "hardhat";
|
|
import { DeployFunction } from "hardhat-deploy/types";
|
|
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
|
import { deployFromFactory } from "../scripts/hardhat/utils";
|
|
import { get1559Fees } from "../scripts/utils";
|
|
import {
|
|
LogContractDeployment,
|
|
getDeployedContractAddress,
|
|
getRequiredEnvVar,
|
|
tryStoreAddress,
|
|
tryVerifyContractWithConstructorArgs,
|
|
} from "../common/helpers";
|
|
|
|
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
const { deployments } = hre;
|
|
|
|
const contractName = "TimeLock";
|
|
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);
|
|
|
|
const provider = ethers.provider;
|
|
|
|
// This should be the safe
|
|
const timeLockProposers = getRequiredEnvVar("TIMELOCK_PROPOSERS");
|
|
|
|
// This should be the safe
|
|
const timelockExecutors = getRequiredEnvVar("TIMELOCK_EXECUTORS");
|
|
|
|
// This should be the safe
|
|
const adminAddress = getRequiredEnvVar("TIMELOCK_ADMIN_ADDRESS");
|
|
|
|
const minDelay = process.env.MIN_DELAY || 0;
|
|
|
|
if (existingContractAddress === undefined) {
|
|
console.log(`Deploying initial version, NB: the address will be saved if env SAVE_ADDRESS=true.`);
|
|
} else {
|
|
console.log(`Deploying new version, NB: ${existingContractAddress} will be overwritten if env SAVE_ADDRESS=true.`);
|
|
}
|
|
const contract = await deployFromFactory(
|
|
contractName,
|
|
provider,
|
|
minDelay,
|
|
timeLockProposers?.split(","),
|
|
timelockExecutors?.split(","),
|
|
adminAddress,
|
|
await get1559Fees(provider),
|
|
);
|
|
|
|
await LogContractDeployment(contractName, contract);
|
|
const contractAddress = await contract.getAddress();
|
|
|
|
await tryStoreAddress(hre.network.name, contractName, contractAddress, contract.deploymentTransaction()!.hash);
|
|
|
|
const args = [minDelay, timeLockProposers?.split(","), timelockExecutors?.split(","), adminAddress];
|
|
|
|
await tryVerifyContractWithConstructorArgs(
|
|
contractAddress,
|
|
"contracts/messageService/lib/TimeLock.sol:TimeLock",
|
|
args,
|
|
);
|
|
};
|
|
export default func;
|
|
func.tags = ["Timelock"];
|