This tutorial demonstrates cross-chain DeFi composability using Stargate Finance. The example smart contract:
- Bridges ETH from Optimism Sepolia to Ethereum Sepolia
- Automatically deposits received tokens into Aave on the destination chain
This pattern can be adapted for various cross-chain use cases and integrated with other DeFi protocols.
The /src
directory contains the following smart contracts:
StargateComposer.sol
: Main contract that handles composablecross-chain token transfer via StargateReceivel.sol
: Contract for receiving callbacks from Stargate bridge operations withinlzCompose
function
yarn install & forge build
Deploy StargateComposer
contract on Optimism Sepolia
make dc
# Update address of the composer in TransferEth.s.sol
Deploy Receiver
contract on Ethereum Sepolia
make dr
Execute cross-chain transfer of ETH
from Optimism Sepolia
to Ethereum Sepolia
make et
Join our community of developers creating universal apps.
- Stargate on GitHub: Stargate protocol open source code.
- Discord Builders Community: Chat with Stargate builders community.