From 61331604e0139b727f58a4af17f58b5c3a1da3a1 Mon Sep 17 00:00:00 2001 From: PierreOssun <35110271+PierreOssun@users.noreply.github.com> Date: Sat, 2 Dec 2023 17:41:16 +0100 Subject: [PATCH] Add tutorial to bridge SBY token with LayerZero (#539) * Aded Layer Zero doc * Update AstarEVM-zkEVM.md typo * Update AstarEVM-zkEVM.md * Update AstarEVM-zkEVM.md --------- Co-authored-by: Ivan <95318860+andabak@users.noreply.github.com> Co-authored-by: Megan Skye Phoenix <58894568+meganskye@users.noreply.github.com> --- .../bridges-relays/AstarEVM-zkEVM.md | 50 +++++++++++++++++++ .../bridges-relays/astar-bridge.md | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 docs/build/zkEVM/integrations/bridges-relays/AstarEVM-zkEVM.md diff --git a/docs/build/zkEVM/integrations/bridges-relays/AstarEVM-zkEVM.md b/docs/build/zkEVM/integrations/bridges-relays/AstarEVM-zkEVM.md new file mode 100644 index 00000000000..2c8cf4c2962 --- /dev/null +++ b/docs/build/zkEVM/integrations/bridges-relays/AstarEVM-zkEVM.md @@ -0,0 +1,50 @@ +--- +title: Astar EVM <-> zkEVM Bridge +--- + +## Overview + +:::note +Please note that the LayerZero bridge is only available between Shibuya and zKatana testnets at this time. In this walkthrough we will describe how to bridge Shibuya token to zKatana. +::: + +A LayerZero integration functionally connects the EVM on Astar parachain to the zkEVM on Ethereum. This takes the form of two smart contract-based endpoints that allow the chains to send messages to one another other. + +## LSBY Token + +LayerZero has a standard for synthetic assets that can be locked on a source chain and minted on another called Omnichain Fungible Token or **OFT**, which we will refer to going forward. + +For this walkthrough, on the Shibuya side, the contract is [NativeOFT](https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/v2/fee/NativeOFTWithFee.sol), which acts as an ERC20 wrapper contract (the function is payable) so you can send it some SBY tokens, and it will respond by sending a cross-chain message to the OFT contract on zKatana to mint LSBY, otherwise known as LayerZero (synthetic) SBY. + +On the zKatana side, the contract is [OFT](https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/token/oft/v2/fee/OFTWithFee.sol), which acts as the ERC20 SBY synthetic asset on zKatana, which should exist in a 1:1 ratio with its NativeOFT counterpart. + +### Bridging LSBY Tokens + +To facilitate token transfer, we have provided a sample repository containing a utility script: + +:::info + +Note: The current method is provisional and specific to testnet environments. The eventual mainnet implementation will incorporate the bridging of Native ASTR tokens through the Astar Portal. + +::: + +1. Fork the [Repository](https://github.com/AstarNetwork/layer-zero-bridge-contracts-testnet) + +2. Install dependencies by running `npm install` + +3. Create a .env file (based on the .env.example) in the root directory + +4. Add your [private key](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key) in the .env file + +5. Run `npm hardhat compile` to compile the contracts + +#### Shibuya EVM → zKatana +To send 1 SBY from shibuya-testnet to zkatana-testnet, run the following command (Note that the --quantity flag is in wei): + +`npx hardhat astarWithFeeSend --quantity 1000000000000000000 --target-network zkatana-testnet --network astar-testnet` + +#### zKatana → Shibuya EVM + +To send 1SBY from zkatana-testnet to shibuya-testnet, run the following command (Note that the --quantity flag is in wei): + +`npx hardhat astarWithFeeSend --quantity 1000000000000000000 --target-network astar-testnet --network zkatana-testnet` diff --git a/docs/build/zkEVM/integrations/bridges-relays/astar-bridge.md b/docs/build/zkEVM/integrations/bridges-relays/astar-bridge.md index fe9d077a026..bc8f98b6006 100644 --- a/docs/build/zkEVM/integrations/bridges-relays/astar-bridge.md +++ b/docs/build/zkEVM/integrations/bridges-relays/astar-bridge.md @@ -1,5 +1,5 @@ --- -title: Astar Bridge +title: ETH <-> zkEVM Bridge --- import bridge1 from '/docs/build/zkEVM/img/astar-bridge-zKatana-Shibuya1.jpg'