Case
Suppose you hold $GALA and want to put it to work earning yield in a lending protocol, specifically by converting it into interest bearing $aETHWETH in a single atomic transaction. With GlueX’s unified Router API and smart contract integrations, you can swap one token and deposit the proceeds into a lending vault atomically, without juggling approvals or multiple onchain calls. In this guide, we’ll walk through exactly how to:- Build a swap quote to convert $GALA into $WETH
- Bundle that quote into a Zap that deposits directly into the Aave vault to receive $aETHWETH
- Submit the transaction and verify the resulting vault deposit
Transaction hash: 0xd0c48d25ac3e0ab111b3ab401903d4a357baa22ee9c9efb832e0b80278ba5ba3

How It Works
- Transfer $GALA from the user’s wallet
- Swap $GALA for $WETH via Uniswap V3
- Receive $aETHWETH via Aave V3
- Start earning yield automatically
Why This Matters?
Moving from a regular token to a yield bearing asset usually requires multiple platforms, manual steps and higher fees. GlueX removes these barriers, bringing: ✅ Time efficiency - One transaction instead of many ✅ Cost savings - Lesser gas fees ✅ Simplicity - No manual interactions with multiple protocols This tutorial uses $GALA → $aETHWETH as an example, but GlueX allows you to swap any token to any yield generating token in a single transactionImplementation
Prerequisites
Before running the script, ensure you have the following installed:- Python 3.10
- Web3 (
pip install web3
) - Requests (
pip install requests
)
Setup and Configuration
Fetching a Swap Quote
Before executing the transaction, fetch a quote from the GlueX RouterApproving the Router Contract
Before executing the swap, the router contract needs permission to spend the user’s GALA tokensExecuting the Transaction
After approval, we execute the transaction using the calldata from the quotePutting Everything Together
Conclusion
With GlueX, moving from $GALA to a yield generating asset like $aETHWETH takes just one transaction. This tutorial demonstrates:- Fetching a swap quote
- Approving the router contract to spend $GALA
- Executing the transaction to swap and deposit smoothly
Depositing to a Lending Vault