1/5
## Real Aave and Uniswap Scripting Demonstration In this lesson, we'll be showcasing a script that automatically manages our assets on the ZkSync network. The script we'll be building will utilize real money to demonstrate the process on the Aave application. We'll be working with ETH and USDC tokens. Our goal is to rebalance our portfolio to achieve a target allocation of 70% ETH and 30% USDC. Currently, our portfolio is skewed towards USDC, with 56% allocated to USDC and 43% to ETH. The script will perform the following actions: - **Deposit:** Deposit all our tokens into the Aave protocol. - **Rebalance:** Trade our tokens to reach our target allocation. We'll be using Uniswap for these trades. - **Deposit:** Deposit the rebalanced tokens back into the Aave protocol. Let's first examine our current portfolio: - Aave: - USDC: $68.86 - ETH: $180.05 - Metamask: - USDC: $160.00 - ETH: $31.96 Now, let's run our script to rebalance this portfolio. ```bash mox run deposit_and_rebalance --network zkysnc --account smallMoney ``` Our script will first deposit all of our tokens into the Aave protocol. It will then analyze the current allocation and determine the necessary trades. Finally, it will execute these trades on Uniswap and deposit the rebalanced tokens back into Aave. This script demonstrates the power of algorithmic trading, allowing us to automate the management of our portfolio and achieve our desired asset allocation. We'll be delving deeper into this process in later lessons, including how to create a notebook to test and refine our scripts. Stay tuned!
A practical guide to real Aave and Uniswap scripting - This lesson demonstrates how to use Python scripts to deposit, rebalance and trade on Aave and Uniswap, using a live example with real money on the zkSync network.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
How to build a DeFi stablecoin and customized NFT
How to deploy your smart contract on ZKsync with Moccasin
Advanced testing techniques like stateful and stateless Python fuzzing
How to write algorithmic trading scripts in Python
Hashing signatures, proxies, delegate calls, upgradable contracts, random numbers, and more!
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on April 21, 2025
Duration: 2h 21min
Duration: 1h 58min
Duration: 2h 55min
Duration: 1h 55min
Duration: 46min
Course Overview
About the course
How to build a DeFi stablecoin and customized NFT
How to deploy your smart contract on ZKsync with Moccasin
Advanced testing techniques like stateful and stateless Python fuzzing
How to write algorithmic trading scripts in Python
Hashing signatures, proxies, delegate calls, upgradable contracts, random numbers, and more!
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on April 21, 2025