Smart Contracts
Contains Ethereum smart contract code for the Linea Rollup and Message Service.
LineaRollup (L1MessageService)
The Linea Rollup, which contains the L1MessageService, is the smart contract that is responsible for:
- Submitting messages to be sent to Linea (L2) for later claiming.
- Anchoring of L2 message Merkle roots to allow later claiming.
- Claiming of messages sent from L2 to Ethereum mainnet (L1).
- Submission of L2 compressed data using EIP-4844 blobs or via calldata.
- Finalization of L2 state on L1 using a Zero Knowledge Proof.
L2MessageService
The L2MessageService is the L2 smart contract that is responsible for:
- Submitting messages to be sent to L1 for later claiming.
- Anchoring of L1 to L2 Message hashes for later claiming.
- Claiming of messages sent from L1 to L2.
Linea Canonical Token Bridge
The Canonical Token Bridge (TokenBridge) is a canonical ERC20 token brige between Ethereum and Linea networks.
The TokenBridge utilises the L1MessageService and the L2MessageService for the transmission of messages between each layer's TokenBridge.
Documentation: Token Bridge
Style Guide
Please see the Smart Contract Style Guide for in depth smart contract layout and styling.
Audit reports
Please see Audits for a historical list of all the smart contract audits.
Development & Testing
Please see Testing guidelines for in depth testing layout and styling.
This project uses the following libraries
- PNPM as the Package Manager
- Ethers as Ethereum library
- Hardhat as development environment
- Chai for assertions
- GoLang for the compilation of code to autogenerate data for L2 data and proofs (not strictly required)
- Docker for the local stack to run in
If you already have an understanding of the tech stack, use our Get Started guide.
To run the tests:
Testing without coverage
cd contracts # from the root folder
pnpm install
npx hardhat test
Testing with coverage
cd contracts # from the root folder
pnpm install
npx hardhat coverage
Deploying the contracts to the local stack
Prerequisites:
- Be sure Docker is running.
Some caveats:
- The L2 chain will not produce empty blocks if there are no transactions, so it would be useful to execute a script to keep the chain "moving".
- The following script can be run with the expectation the local stack is running: generateL2Traffic.ts
- To execute it run the following from the
e2e
folder: npx ts-node src/common/generateL2Traffic.ts
- For blob submission and finalization, there needs to be sufficient blocks to trigger it. Keeping the chain moving on L2 is vital for this to take place.
From the root of the repository:
Please read the MakeFile: MakeFile
# This will deploy all the relevant services and smart contracts
make fresh-start-all-traces-v2
To deploy all the contracts
If the stack is already running, to redeploy the contracts, the following commands can be used:
Note: The addresses change per deployment due to nonce increments, so be sure to validate the correct ones are being used.
NB: The end to end tests run against a fresh stack and deploy with predetermined addresses.
If there is a need to get predetermined addresses for contract deployments, the following script can be used precomputeDeployedAddresses.ts.
This can be used by altering the values in the script file and running the script (from the /contracts
folder) with: npx ts-node scripts/operational/precomputeDeployedAddress.ts
Note the following nonce values for a fresh stack deploy:
The LineaRollup deploy uses nonce 3 as the following are deployed beforehand:
- The verifier contract
- The implementation LineaRollup.sol contract
- The proxy admin contract
The L2MessageService deploy uses nonce 2 as the following are deployed beforehand:
- The implementation L2MessageService.sol contract
- The proxy admin contract
Deploying the L1 contracts
# This will deploy the Linea Rollup that is currently deployed on Mainnet - the current version is the LineaRollupV5.
# Some end to end tests will test future upgrades to validate the stack remains functional.
# Note: By default a test/placeholder verifier contract is used `IntegrationTestTrueVerifier` if you wish to use a proper verifier, adjust the
# PLONKVERIFIER_NAME=IntegrationTestTrueVerifier in the make command to be something like PLONKVERIFIER_NAME=PlonkVerifierForDataAggregation .
# Be sure to check the parameter values in the Makefile before executing the command.
# Deploy v5
make deploy-linea-rollup-v5
# Or deploy v6
make deploy-linea-rollup-v6
make deploy-token-bridge-l1
Deploying the L2 contracts
# This will deploy the current L2 Message Service.
# Some end to end tests will test future upgrades to validate the stack remains functional.
make deploy-l2messageservice
make deploy-token-bridge-l2
Deploying L1 and L2 together
make deploy-contracts
The above command will trigger the following commands to deploy:
- deploy-linea-rollup-v5
- deploy-token-bridge-l1
- deploy-l1-test-erc20
- deploy-l2messageservice
- deploy-token-bridge-l2
- deploy-l2-test-erc20
Note: the deploy-l1-test-erc20 and deploy-l1-test-erc20 commands are executed for use in the end to end tests.
Linea Deployment Scripts
This document aims to explain how to get started with deploying the Linea deployment scripts. There are several ways the scripts can be executed dependant on:
- If you're storing deployment variables in an environment file (.env)
- If you plan to deploy an individual script which will deploy a single contract.
- If you plan to deploy a chained deployment script that will include multiple contracts.
Running the script with an .env file set, you will need to make sure that the correct variables are set in the .env file, considering the network that you're deploying on. In this way when the script is being run, it will take the variables it needs to execute the script from that .env file.
Running the script without an .env file will require you to place the variables as command-line arguments.
The command-line arguments will create or replace existing .env (only in memory) environment variables. If the variables are provided in the terminal as command-line arguments, they will have priority over the same variables if they are defined in the .env file. These need not exist in the .env file.
Furthermore, you can also specify a general set of variables in the .env file (SAVE_ADDRESS, VERIFY_CONTRACT, GOERLI_PRIVATE_KEY, LINEA_GOERLI_PRIVATE_KEY, MAINNET_PRIVATE_KEY, LINEA_MAINNET_PRIVATE_KEY, ETHERSCAN_API_KEY, LINEASCAN_API_KEY, INFURA_API_KEY) and provide only the script-specific variables as command-line arguments, when you run each script.
Setting SAVE_ADDRESS=true
will make the script write a file in the deployments// folder which stores the contract address, abi and transaction hash.
Setting VERIFY_CONTRACT=true
will start the verifying stage after the contract is deployed, provided that there is a ETHERSCAN_API_KEY
or LINEASCAN_API_KEY
available in the .env or provided as CLI argument.
Network Specific Variables
Dependant on which network you are using, a specific network private key needs to be used, as well as the corresponding API Key or RPC URL. Also, dependant on which network you choose, the block explorer used could be different, so the block explorer parameter name might need to be adjusted. The following table highlights which private key variable will be used per network. Please use the variable that pertains to the network. e.g. for linea_goerli
use LINEA_GOERLI_PRIVATE_KEY
(LINEA_GOERLI_PRIVATE_KEY=<key> INFURA_API_KEY=<key>
)
Network |
Private key parameter name |
API Key / RPC URL |
Block explorer parameter name |
goerli |
GOERLI_PRIVATE_KEY |
INFURA_API_KEY |
ETHERSCAN_API_KEY |
linea_goerli |
LINEA_GOERLI_PRIVATE_KEY |
INFURA_API_KEY |
LINEASCAN_API_KEY |
mainnet |
MAINNET_PRIVATE_KEY |
INFURA_API_KEY |
ETHERSCAN_API_KEY |
linea_mainnet |
LINEA_MAINNET_PRIVATE_KEY |
INFURA_API_KEY |
LINEASCAN_API_KEY |
custom |
CUSTOM_PRIVATE_KEY |
CUSTOM_BLOCKCHAIN_URL |
ETHERSCAN_API_KEY |
zkevm_dev |
PRIVATE_KEY |
BLOCKCHAIN_NODE or L2_BLOCKCHAIN_NODE |
n/a |
Generalized Command Format
<possible CLI environment arguments> npx hardhat deploy --network goerli --tags <contract tags, comma delimitted list>
Order of Precedence
When deploying, if required variables such as deployed contract addresses are not defined in the .env or provided as CLI arguments, the script will look and check if it can use the addresses stored in the deployments// folder.
The order of priority (unless specified otherwise) will be:
- CLI arguments,
- .env variables ,
- deployments//
Deployments and their parameters
Verifier
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash] |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
PLONKVERIFIER_NAME |
true |
string |
The name of the PlonkVerifier contract that should be deployed |
Base command:
npx hardhat deploy --network goerli --tags PlonkVerifier
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true GOERLI_PRIVATE_KEY=<key> ETHERSCAN_API_KEY=<key> INFURA_API_KEY=<key> PLONKVERIFIER_NAME=PlonkVerifierForMultiTypeDataAggregation npx hardhat deploy --network goerli --tags PlonkVerifier
(make sure to replace <key>
with actual values)
LineaRollup
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash] |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
LINEA_ROLLUP_INITIAL_STATE_ROOT_HASH |
true |
bytes |
Initial State Root Hash |
LINEA_ROLLUP_INITIAL_L2_BLOCK_NUMBER |
true |
uint256 |
Initial L2 Block Number |
LINEA_ROLLUP_SECURITY_COUNCIL |
true |
address |
L1 Security Council Address |
LINEA_ROLLUP_OPERATORS |
true |
address |
L1 Operators Addresses (comma-delimited if multiple) |
LINEA_ROLLUP_RATE_LIMIT_PERIOD |
true |
uint256 |
L1 Rate Limit Period |
LINEA_ROLLUP_RATE_LIMIT_AMOUNT |
true |
uint256 |
L1 Rate Limit Amount |
Base command:
npx hardhat deploy --network goerli --tags LineaRollup
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true GOERLI_PRIVATE_KEY=<key> ETHERSCAN_API_KEY=<key> INFURA_API_KEY=<key> LINEA_ROLLUP_INITIAL_STATE_ROOT_HASH=<bytes> LINEA_ROLLUP_INITIAL_L2_BLOCK_NUMBER=<value> LINEA_ROLLUP_SECURITY_COUNCIL=<address> LINEA_ROLLUP_OPERATORS=<address> LINEA_ROLLUP_RATE_LIMIT_PERIOD=<value> LINEA_ROLLUP_RATE_LIMIT_AMOUNT=<value> npx hardhat deploy --network goerli --tags LineaRollup
(make sure to replace <value>
<key>
<bytes>
<address>
with actual values).
Linea Voyage XP Token
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash] |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
LINEA_VOYAGE_XP_ADMIN_ADDRESS |
true |
address |
Admin and minter addresss |
Base command:
npx hardhat deploy --network linea_goerli --tags LineaVoyageXPToken
Timelock
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash] |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
TIMELOCK_PROPOSERS |
true |
address |
Timelock Proposers address |
TIMELOCK_EXECUTORS |
true |
address |
Timelock Executors address |
TIMELOCK_ADMIN_ADDRESS |
true |
address |
Timelock Admin address |
MIN_DELAY |
true |
uint256 |
Timelock Minimum Delay |
Base command:
npx hardhat deploy --network goerli --tags Timelock
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true GOERLI_PRIVATE_KEY=<key> ETHERSCAN_API_KEY=<key> INFURA_API_KEY=<key> TIMELOCK_PROPOSERS=<address> TIMELOCK_EXECUTORS=<address> TIMELOCK_ADMIN_ADDRESS=<address> MIN_DELAY=<value> npx hardhat deploy --network goerli --tags Timelock
(make sure to replace <value>
<key>
<address>
with actual values)
L2MessageService
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash] |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
L2MSGSERVICE_SECURITY_COUNCIL |
true |
address |
L2 Security council address |
L2MSGSERVICE_L1L2_MESSAGE_SETTER |
true |
address |
L1L2 Message Setter address on L2 |
L2MSGSERVICE_RATE_LIMIT_PERIOD |
true |
uint256 |
L2 Rate Limit Period |
L2MSGSERVICE_RATE_LIMIT_AMOUNT |
true |
uint256 |
L2 Rate Limit Amount |
Base command:
npx hardhat deploy --network linea_goerli --tags L2MessageService
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true GOERLI_PRIVATE_KEY=<key> LINEASCAN_API_KEY=<key> INFURA_API_KEY=<key> L2MSGSERVICE_SECURITY_COUNCIL=<address> L2MSGSERVICE_L1L2_MESSAGE_SETTER=<address> L2MSGSERVICE_RATE_LIMIT_PERIOD=<value> L2MSGSERVICE_RATE_LIMIT_AMOUNT=<value> npx hardhat deploy --network linea_goerli --tags L2MessageService
(make sure to replace <value>
<key>
<address>
with actual values)
BridgedToken
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash]. |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract. |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract. |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
Base command:
npx hardhat deploy --network linea_goerli --tags BridgedToken
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_GOERLI_PRIVATE_KEY=<key> INFURA_API_KEY=<key> npx hardhat deploy --network linea_goerli --tags BridgedToken
(make sure to replace <value>
<key>
<address>
with actual values)
CustomBridgedToken
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
CUSTOMTOKENBRIDGE_NAME |
true |
string |
Token's name |
CUSTOMTOKENBRIDGE_SYMBOL |
true |
string |
Token's symbol |
CUSTOMTOKENBRIDGE_DECIMALS |
true |
uint256 |
Token's decimals |
CUSTOMTOKENBRIDGE_BRIDGE_ADDRESS |
true |
address |
Token bridge's address |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash]. |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract. |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract. |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
Base command:
npx hardhat deploy --network linea_goerli --tags CustomBridgedToken
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_GOERLI_PRIVATE_KEY=<key> INFURA_API_KEY=<key> CUSTOMTOKENBRIDGE_NAME=<name> CUSTOMTOKENBRIDGE_SYMBOL=<symbol> CUSTOMTOKENBRIDGE_DECIMALS=<decimals> CUSTOMTOKENBRIDGE_BRIDGE_ADDRESS=<address> npx hardhat deploy --network linea_goerli --tags CustomBridgedToken
(make sure to replace <key>
<address>
<name>
<symbol>
<decimals>
with actual values)
TokenBridge
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash]. |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract. |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract. |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
L2_MESSAGE_SERVICE_ADDRESS |
true |
address |
L2 Message Service address used when deploying TokenBridge. |
LINEA_ROLLUP_ADDRESS |
true |
address |
L1 Rollup address used when deploying Token Bridge. |
REMOTE_CHAIN_ID |
true |
uint256 |
ChainID of the remote (target) network |
TOKEN_BRIDGE_L1 |
false |
true|false |
If Token Bridge is deployed on L1, TOKEN_BRIDGE_L1 should be set to true . Otherwise it should be false |
L1_RESERVED_TOKEN_ADDRESSES |
false |
address |
If TOKEN_BRIDGE_L1=true, then L1_RESERVED_TOKEN_ADDRESSES should be defined. If multiple addresses, provide them in a comma-delimited array. |
L2_RESERVED_TOKEN_ADDRESSES |
false |
address |
If TOKEN_BRIDGE_L1=false, then L2_RESERVED_TOKEN_ADDRESSES should be defined. If multiple addresses, provide them in a comma-delimited array. |
Base command:
npx hardhat deploy --network linea_goerli --tags TokenBridge
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_GOERLI_PRIVATE_KEY=<key> INFURA_API_KEY=<key> REMOTE_CHAIN_ID=<uint256> TOKEN_BRIDGE_L1=true L1_RESERVED_TOKEN_ADDRESSES=<address> L2_MESSAGE_SERVICE_ADDRESS=<address> LINEA_ROLLUP_ADDRESS=<address> npx hardhat deploy --network linea_goerli --tags TokenBridge
(make sure to replace <value>
<key>
<address>
with actual values)
Chained Deployments
This section describes the scripts that can be run to deploy multiple contracts in a sequence.
L1MessageService Chained Deployments
This will run the script that deploys PlonkVerifier, LineaRollup , Timelock contracts.
Parameters that should be filled either in .env or passed as CLI arguments:
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash] |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
LINEA_ROLLUP_INITIAL_STATE_ROOT_HASH |
true |
bytes |
Initial State Root Hash |
LINEA_ROLLUP_INITIAL_L2_BLOCK_NUMBER |
true |
uint256 |
Initial L2 Block Number |
LINEA_ROLLUP_SECURITY_COUNCIL |
true |
address |
Security Council Address |
LINEA_ROLLUP_OPERATORS |
true |
address |
Operators Addresses (comma-delimited if multiple) |
LINEA_ROLLUP_RATE_LIMIT_PERIOD |
true |
uint256 |
L1 Rate Limit Period |
LINEA_ROLLUP_RATE_LIMIT_AMOUNT |
true |
uint256 |
L1 Rate Limit Amount |
TIMELOCK_PROPOSERS |
true |
address |
Timelock Proposers address |
TIMELOCK_EXECUTORS |
true |
address |
Timelock Executors address |
TIMELOCK_ADMIN_ADDRESS |
true |
address |
Timelock Admin address |
MIN_DELAY |
true |
uint256 |
Timelock Minimum Delay |
PLONKVERIFIER_NAME |
true |
string |
PlonkVerifier contract name that should be deployed |
Base command:
npx hardhat deploy --network goerli --tags PlonkVerifier,LineaRollup,Timelock
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true GOERLI_PRIVATE_KEY=<key> ETHERSCAN_API_KEY=<key> INFURA_API_KEY=<key> LINEA_ROLLUP_INITIAL_STATE_ROOT_HASH=<bytes> LINEA_ROLLUP_INITIAL_L2_BLOCK_NUMBER=<value> LINEA_ROLLUP_SECURITY_COUNCIL=<address> LINEA_ROLLUP_OPERATORS=<address> LINEA_ROLLUP_RATE_LIMIT_PERIOD=<value> LINEA_ROLLUP_RATE_LIMIT_AMOUNT=<value> TIMELOCK_PROPOSERS=<address> TIMELOCK_EXECUTORS=<address> TIMELOCK_ADMIN_ADDRESS=<address> MIN_DELAY=<value> PLONKVERIFIER_NAME=PlonkVerifierForMultiTypeDataAggregation npx hardhat deploy --network goerli --tags PlonkVerifier,LineaRollup,Timelock
(make sure to replace <value>
<bytes>
<key>
<address>
with actual values)
L2MessageService Chained Deployments
This will run the script that deploys Timelock, L2MessageService contracts.
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash] |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
L2MSGSERVICE_SECURITY_COUNCIL |
true |
address |
L2 Security council address |
L2MSGSERVICE_L1L2_MESSAGE_SETTER |
true |
address |
L1L2 Message Setter address on L2 |
L2MSGSERVICE_RATE_LIMIT_PERIOD |
true |
uint256 |
L2 Rate Limit Period |
L2MSGSERVICE_RATE_LIMIT_AMOUNT |
true |
uint256 |
L2 Rate Limit Amount |
TIMELOCK_PROPOSERS |
true |
address |
Timelock Proposers address |
TIMELOCK_EXECUTORS |
true |
address |
Timelock Executors address |
TIMELOCK_ADMIN_ADDRESS |
true |
address |
Timelock Admin address |
MIN_DELAY |
true |
uint256 |
Timelock Minimum Delay |
Base command:
npx hardhat deploy --network linea_goerli --tags L2MessageService,Timelock
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEA_GOERLI_PRIVATE_KEY=<key> LINEASCAN_API_KEY=<key> INFURA_API_KEY=<key> L2MSGSERVICE_SECURITY_COUNCIL=<address> L2MSGSERVICE_L1L2_MESSAGE_SETTER=<address> L2MSGSERVICE_RATE_LIMIT_PERIOD=<value> L2MSGSERVICE_RATE_LIMIT_AMOUNT=<value> TIMELOCK_PROPOSERS=<address> TIMELOCK_EXECUTORS=<address> TIMELOCK_ADMIN_ADDRESS=<address> MIN_DELAY=<value> npx hardhat deploy --network linea_goerli --tags L2MessageService_Timelock
(make sure to replace <value>
<key>
<address>
with actual values)
TokenBridge & BridgedToken Chained Deployments
This will run the script that deploys the TokenBridge and BridgedToken contracts.
Parameter name |
Required |
Input Value |
Description |
SAVE_ADDRESS |
false |
true|false |
Saves file with deployment details [address, abi, transaction hash]. |
VERIFY_CONTRACT |
false |
true|false |
Verifies the deployed contract. |
*PRIVATE_KEY |
true |
key |
Network-specific private key used when deploying the contract. |
*BLOCK_EXPLORER_API_KEY |
false |
key |
Network-specific Block Explorer API Key used for verifying deployed contracts. |
INFURA_API_KEY |
true |
key |
Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
L2_MESSAGE_SERVICE_ADDRESS |
true |
address |
L2 Message Service address used when deploying TokenBridge. |
LINEA_ROLLUP_ADDRESS |
true |
address |
L1 Rollup address used when deploying Token Bridge. |
REMOTE_CHAIN_ID |
true |
uint256 |
ChainID of the remote (target) network |
TOKEN_BRIDGE_L1 |
false |
true|false |
If Token Bridge is deployed on L1, TOKEN_BRIDGE_L1 should be set to true . Otherwise it should be false |
L1_RESERVED_TOKEN_ADDRESSES |
false |
address |
If TOKEN_BRIDGE_L1=true, then L1_RESERVED_TOKEN_ADDRESSES should be defined. If multiple addresses, provide them in a comma-delimited array. |
L2_RESERVED_TOKEN_ADDRESSES |
false |
address |
If TOKEN_BRIDGE_L1=false, then L2_RESERVED_TOKEN_ADDRESSES should be defined. If multiple addresses, provide them in a comma-delimited array. |
Base command:
npx hardhat deploy --network linea_goerli --tags BridgedToken,TokenBridge
Base command with cli arguments:
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_GOERLI_PRIVATE_KEY=<key> INFURA_API_KEY=<key> REMOTE_CHAIN_ID=<uint256> TOKEN_BRIDGE_L1=true L1_RESERVED_TOKEN_ADDRESSES=<address> L2_MESSAGE_SERVICE_ADDRESS=<address> LINEA_ROLLUP_ADDRESS=<address> npx hardhat deploy --network linea_goerli --tags BridgedToken,TokenBridge
(make sure to replace <value>
<key>
<address>
with actual values)