* placeholder docs * adding more documentation * documentation work in progress * add main linking or index documents * add a link images * add messaging flows * linking operator documentation and folder cleanup * use correct pathing on tokenbridge.md * link workflow documents * add function signatures * remove welcome to * cross reference blob submission and finalization * remove confusing text * use better definition of shnarf * fix broken link * add charter, diagram and address book * docs(LSC): Rename security-council-charter-v1.3.md to security-council-charter.md Signed-off-by: Julien Marchand <julien-marchand@users.noreply.github.com> * Update contracts/docs/mainnet-address-book.csv Co-authored-by: Julien Marchand <julien-marchand@users.noreply.github.com> Signed-off-by: The Dark Jester <thedarkjester@users.noreply.github.com> --------- Signed-off-by: Julien Marchand <julien-marchand@users.noreply.github.com> Signed-off-by: The Dark Jester <thedarkjester@users.noreply.github.com> Co-authored-by: Julien Marchand <julien-marchand@users.noreply.github.com>
3.6 KiB
Linea Token Bridge
Documentation
Token Bridge is a canonical brige between Ethereum and Linea networks.
Install
Packages
To install packages, execute:
npm i
Config
To setup config, copy the .env.template to .env, for example:
cp .env.template .env
Edit .env and add your configuration values.
| Var | Description | Default |
|---|---|---|
| L1_RESERVED_TOKEN_ADDRESSES | Reserved L1 token addresses | 0x07865c6E87B9F70255377e024ace6630C1Eaa37F |
| L2_RESERVED_TOKEN_ADDRESSES | Reserved L2 token addresses | 0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068 |
| ETHERSCAN_API_KEY | Etherscan API key |
Deploy
On a Local Testnet network with mocked messaging service
In a first terminal, run:
npx hardhat node
In a second terminal, run:
npx hardhat run --network localhost scripts/tokenBridge/test/deployMock.ts
On a Sepolia Testnet network with mocked messaging service
In a terminal, run:
npx hardhat run --network sepolia scripts/tokenBridge/test/deployMock.ts
On Sepolia Testnet and Sepolia Linea Testnet
To deploy the contracts, you will need to run the Bridged Token, Token Bridge, and Token Bridge operational scripts.
You can refer to the following links that describe the usage of these scripts.
All addresses created will be stored in the deployments folder as a separate file. ./contracts/deployment/<network_name>
Development
Testing
To run tests, execute:
npm run test
or
npx hardhat test
Test coverage
This project uses the Hardhat plugin solidity-coverage to assess the overall coverage of the unit tests. To generate a boilerplate report, use the following command:
npm run coverage
or
npx hardhat coverage --solcoverjs ./.solcover.js
The report will be generated in the coverage folder at the root of the repository. To visualize it in your web browser, you can use the coverage/index.html file.
Note: the second command line might not work if the folder coverage already exists. If you encounter an issue, please delete the whole coverage folder and let hardhat-coverage regenerate a new one.
Contract verification on Etherscan
To verify the contract on Etherscan.
npx hardhat verify --network NETWORK DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1" "Constructor argument 2"
Gas Estimation
You can estimate the contracts gas costs.
- On a terminal start a local node:
npx hardhat node
- On another terminal, execute the gas estimation script:
npx hardhat run --network localhost scripts/tokenBridge/gasEstimation/gasEstimation.ts
It should return gas estimation:
basic bridgeToken: 162080
bridgeToken with permit: 243910
bridgeToken after confirmDeploy: 126453
bridgeToken with permit after confirmDeploy: 202909
Formatting Commands
Lint Solidity
npm run lint:sol
Lint TypeScript
npm run lint:ts
Prettier
Check format code:
npm run prettier:check
Format code:
npm run prettier