---
title: "Discussion on \"Building a Cross-Chain Swap with LayerZero\" | Hashnode"
description: "Discussion on \"Building a Cross-Chain Swap with LayerZero\". We will build a DApp with LayerZero that allows users to bridge and swap MATIC tokens from Mumbai testnet to ETH tokens on Sepolia testnet."
url: "https://hashnode.com/posts/building-a-cross-chain-swap-with-layerzero/64e71c0ba22cd603433ce60b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Building a Cross-Chain Swap with LayerZero](https://blog.developerdao.com/building-a-cross-chain-swap-with-layerzero?utm_source=hashnode&utm_medium=feed)

We will build a DApp with LayerZero that allows users to bridge and swap MATIC tokens from Mumbai testnet to ETH tokens on Sepolia testnet.

Aug 24, 2023 · 14 min read · blog.developerdao.com  
Read the article

-   [#blockchain](https://hashnode.com/tag/blockchain)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#web3](https://hashnode.com/tag/web3)

## Written by

[Priyank Gupta](https://hashnode.com/@Genesis0308)

@Genesis0308

  
[View profile](https://hashnode.com/@Genesis0308)

I am hungry, hardworking and ambitious. I am also an abject fool. But my awesomeness makes up for that.

I love new people and I love new technologies. Trying to find my footing in the Web3 industry, hoping to become a better programmer and a more consistent shipper. Part-time Rustacean 🦀

## Responses 3

Markdown supported · ⌘↵ to post

[Balamurugan Nagarajan](https://hashnode.com/@BalaSmart)

[Jan 16, 2025](https://hashnode.com/posts/building-a-cross-chain-swap-with-layerzero/64e71c0ba22cd603433ce60b/comment/67896536763d3b72366ca3af)

Does LayerZero (LZ) support cross-chain transfers to non-EVM chains?

[Den](https://hashnode.com/@dnx2k2)

[Jan 11, 2024](https://hashnode.com/posts/building-a-cross-chain-swap-with-layerzero/64e71c0ba22cd603433ce60b/comment/659fa1acd842226d80926512)

Very good tutorial. Couple of fixes to get it work today after some libraries updates^

1.  Due to actual version of OpenZeppelin v5+ its necessary to use 0.8.20+ version of Solidity. 0.8.23 works OK as of now.
    
2.  Because of the same OppenZeppelin major version change it's necessary to add Ownable super class initialization: in file lib/solidity-examples/contracts/lzApp/LzApp.sol change constructor to `constructor(address _endpoint) Ownable(_msgSender()) {      lzEndpoint = ILayerZeroEndpoint(_endpoint);  }`
    
3.  In the scripts section you have to change MyScript name to DeployMumbai and DeploySepolia.
    

[Priyank Gupta](https://hashnode.com/@Genesis0308)

[Jan 11, 2024](https://hashnode.com/posts/building-a-cross-chain-swap-with-layerzero/64e71c0ba22cd603433ce60b/comment/659fa1acd842226d80926512#reply-659faa25f95d9a1afe06a6c6)

Hey thanks mate, you really went through the whole article it seems. I wrote this back when I was trying to seduce layerZero into giving me a job lol.

Also started a dedicated Solidity + Foundry book before I ultimately did not make it into LZ and finally just gave up on Solidity as a whole. Give this on LayerZero a read too:

[solidity-in-foundry.com/Applications/LayerZero/La…](https://www.solidity-in-foundry.com/Applications/LayerZero/LayerZero.html)

I will implement your suggestions as soon as I can.

[Den](https://hashnode.com/@dnx2k2)

[Jan 11, 2024](https://hashnode.com/posts/building-a-cross-chain-swap-with-layerzero/64e71c0ba22cd603433ce60b/comment/659fa1acd842226d80926512#reply-659fb39dd842226d8093609e)

[Priyank Gupta](https://hashnode.com/@Genesis0308) Thanks. Amazing tutorial!

[Joseph Tran](https://hashnode.com/@Josephtran)

[Nov 4, 2023](https://hashnode.com/posts/building-a-cross-chain-swap-with-layerzero/64e71c0ba22cd603433ce60b/comment/6546703108e6f2d0c473a876)

Good tutorial! It's easy to understand with beginner developer. Hope you keep sharing. Many thanks.
