Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dutterbutter/zksync-layer0-example
https://github.com/dutterbutter/zksync-layer0-example
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dutterbutter/zksync-layer0-example
- Owner: dutterbutter
- License: mit
- Created: 2023-10-06T00:52:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-06T13:23:09.000Z (over 1 year ago)
- Last Synced: 2024-04-14T10:32:06.507Z (9 months ago)
- Language: Solidity
- Size: 91.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🌐 OmniCounter Example using LayerZero and zkSync
Learn how to send a cross-chain message from `optimism-goerli` to `zksync-testnet`.
## 🛠 Installation
### Prerequisites
1. NodeJS & Yarn installed.
2. Wallets funded on both `optimism-goerli` and `zksync-testnet` networks.### Install Dependencies
Run the following command to install required dependencies:
```bash
yarn install
```### Environment Setup
Create a `.env` file at the project root with your `PRIVATE_KEY`:
```env
PRIVATE_KEY=""
```## 🚀 Example
OmniCounter is a simplistic contract that incorporates a counter. The only way to increment this counter is *remotely*!
### Step 1: Deploy OmniCounters
Deploy the contract on both networks:
```bash
npx hardhat --network zksync-testnet deploy --tags OmniCounter
npx hardhat --network optimism-goerli deploy --tags OmniCounter
```### Step 2: Configure Remote Addresses
Navigate to the `setTrustedRemote.js` file under `/tasks` and add the zkSync deployed address to the following field:
```
const ZKSYNC_OMNICOUNTER = "YOUR-ZKSYNC-DEPLOYED-OMNICOUNTER-ADDRESS
```Establish trust between contracts to enable message reception:
```bash
npx hardhat --network zksync-testnet setTrustedRemote --target-network optimism-goerli --contract OmniCounter
npx hardhat --network optimism-goerli setTrustedRemote --target-network zksync-testnet --contract OmniCounter
```### Step 3: Send Cross-Chain Message
Time to send a cross-chain message from `optimism-goerli` to `zksync-testnet`:
```bash
npx hardhat --network optimism-goerli incrementCounter --target-network zksync-testnet
```## 🌐 Official Links
- 🌍 [Website](https://zksync.io/)
- 📚 [Documentation](https://v2-docs.zksync.io/dev/)
- 🖥 [GitHub](https://github.com/matter-labs)
- 🐦 [Twitter](https://twitter.com/zksync)
- 💬 [Discord](https://discord.gg/nMaPGrDDwk)