Files
linea-monorepo/contracts/deploy/11_deploy_TestERC20.ts
Andrei A. 390d6ff860 Feat/122 Add TokenBridge e2e tests (#210)
* fix: add mutex in account manager to avoid nonce issue

* fix: optimize global setup

* Limiting number of concurrent traces API requests for the local stack to avoid occasional OOM-s

* Limiting number of verticles for Traces API node

* Add E2E TokenBridge tests

* fixing test and adding concurency

* fixing test and adding concurency

* fixing test and adding concurency

* fixing test and adding concurency

* fixing nonce management

* deploying l2token for the L2 -> L1 test

* adjusting accounts for L2->L1 test

* adjusting l2TestContractAddress

* use nonce management for L1->L2 test

* adjusting the TestERC20 contract and tests

* rebasing with fix/133-improve-e2e-tests-performance

* fix: update jest config to exit even if there are open handles

* Trying out Besu untuned and raising limit per endpoint to 2 for traces

* Trying out Besu untuned and raising limit per endpoint to 2 for traces and Shomei node

* Using besu untuned for arithmetization as well

* Compile once and parallelise setRemoteTokenBridge

* feat: deploy smart contracts from artifacts + change e2e tests setup

* fix: update pnpm

* fix: remove compile contracts gradle task

* fix: remove compileContracts gradle task

* fix: refactor genesis generator dockerfile + downgrade l1-el-node besu version

* fix: move abi from e2e folder to contract folder + refactor contracts deployments scripts

* feat: add deployment script from artifacts for LineaRollupV6

* update pnpm version in get-started.md

* fix: update console log in deployment scripts

* fix: update besu version + fix deployment scripts

* correct addresses

* fix import

* use abi and bytecode for deployments

* use upgradable beacon for BridgedToken ABI deploys

* use saved abi and bytecode for TestERC20 deploy

* correct deployBridgedTokenAndTokenBridge casing

* optimize token bridge e2e calls

* use explicit message event data

* use precomputed nonces for e2e stack

---------

Co-authored-by: VGau <victorien.gauch@consensys.net>
Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com>
Co-authored-by: Roman <4833306+Filter94@users.noreply.github.com>
Co-authored-by: thedarkjester <grant.southey@consensys.net>
Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com>
2024-10-31 18:03:53 +01:00

49 lines
1.8 KiB
TypeScript

import { ethers, network } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
getRequiredEnvVar,
tryVerifyContract,
tryStoreAddress,
validateDeployBranchAndTags,
getDeployedContractAddress,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "TestERC20";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);
const tokenName = getRequiredEnvVar("TEST_ERC20_NAME");
const tokenSymbol = getRequiredEnvVar("TEST_ERC20_SYMBOL");
const initialSupply = getRequiredEnvVar("TEST_ERC20_INITIAL_SUPPLY");
if (!existingContractAddress) {
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 TestERC20Factory = await ethers.getContractFactory(contractName);
const contract = await TestERC20Factory.deploy(tokenName, tokenSymbol, ethers.parseEther(initialSupply));
await contract.waitForDeployment();
const contractAddress = await contract.getAddress();
const deployTx = contract.deploymentTransaction();
if (!deployTx) {
throw "Deployment transaction not found.";
}
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);
};
export default func;
func.tags = ["TestERC20"];