Aave Yield Optimization for USDC Wallet Management - n8n Workflow

Automate your DeFi yield strategy using this powerful n8n workflow. Monitor your USDC balance, automatically deposit excess funds into Aave, and top off your wallet when low. Use this n8n template for reliable Web3 automation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

DeFi Users and Yield Farmers who want to automate their asset allocation strategies.
Users of the Base network interested in hands-free Aave interaction.
Finance professionals seeking advanced, scheduled n8n templates for crypto treasury management.
Anyone needing a reliable n8n workflow to ensure a minimum operational USDC balance while maximizing interest income.

Overview

Managing cryptocurrency balances manually can be tedious, especially when trying to maintain an operational minimum while simultaneously earning interest on surplus funds. This sophisticated n8n workflow solves this problem by creating an automated, scheduled financial agent using the 1Shot API for secure Web3 interactions and Telegram for instantaneous notifications.

This n8n solution acts as a balance sentinel: regularly checking your delegated wallet balance against two predefined thresholds. If funds are significantly high, the n8n node system initiates a deposit into Aave. If funds drop too low, it automatically tops off the balance by withdrawing from Aave savings. This self-balancing n8n template ensures capital efficiency and security, maximizing your use of the Aave protocol while maintaining liquidity for daily operations. This particular n8n workflow demonstrates advanced integration between off-chain logic and on-chain execution.

How it Works

This powerful n8n workflow operates on a recurring schedule, triggered by the Schedule Trigger n8n node:


  1. Configuration and Trigger: The process starts with the Schedule Trigger n8n trigger, initiating the sequence. The Savings Configs n8n node defines critical parameters, including the delegation wallet address, the upper savings threshold, the lower top-off threshold, and the Telegram chat ID.

  2. Balance Check: The n8n workflow uses the 1Shot API n8n node to check the user’s current USDC wallet balance and their Aave savings balance.

  3. Decision Point: A Switch n8n node evaluates the current USDC balance:

Deposit Path: If the balance exceeds the moveToSavingsThreshold, the flow calculates the Excess Funds and proceeds to the deposit routine.
Withdraw Path: If the balance drops below the topOffBalance, the flow calculates the required withdrawal amount to top off the wallet.
* No Change Path: If the balance is between the thresholds, a simple status notification is sent via Telegram.

  1. Execution (Deposit): If depositing, the n8n workflow first executes an approve USDC transaction (using the 1Shot API n8n node) allowing Aave to spend the required amount, followed by the Deposit USDC into Aave L2Pool transaction. Success is confirmed via Telegram.

  2. Execution (Withdraw): If withdrawing, the Calculate Insufficient Funds n8n node determines the exact withdrawal amount. If savings are sufficient (checked by the If n8n node), the Withdraw from Aave transaction is executed. The final balances are confirmed via Telegram, providing an audit trail for the automated n8n node actions.

Installation Guide

To set up this advanced n8n workflow, follow these steps:


  1. Import the n8n template: Copy the provided JSON and import it directly into your n8n instance.

  2. 1Shot API Credentials: Sign up for 1Shot API, generate an API key and secret, and configure the 'oneShotOAuth2Api' credential in n8n. All 1Shot n8n node instances require this credential.

  3. Telegram Credentials: Create a Telegram bot using BotFather, obtain the API token, and set up a 'telegramApi' credential in n8n.

  4. Configure Savings Thresholds: Click on the Savings Configs n8n node (a Code node) and update the variables:

moveToSavingsThreshold: The balance (in atomic units) above which funds will be deposited.
topOffBalance: The balance below which funds will be withdrawn from Aave.
delegator: Your delegated wallet address (must be configured with 1Shot).
telegramChatId: Your private chat ID with the Telegram bot.

  1. Configure n8n Trigger: Adjust the Schedule Trigger n8n trigger to run at your desired frequency (e.g., every 24 hours).

  2. Activate: Activate the n8n workflow to begin automated monitoring and balancing.

Node Details

Schedule Trigger (n8n trigger): Initiates the entire n8n workflow on a recurring, time-based schedule, ensuring continuous monitoring of balances.
Savings Configs (Code n8n node): Stores critical configuration variables, including wallet addresses, token details, Aave pool details, and the operational thresholds used for decision-making in the n8n workflow.
Check User's USDC Balance / Aave Savings (1Shot API n8n node - Read): Performs read operations on the blockchain (via 1Shot) to fetch the current balances of USDC and aBasUSDC (Aave savings token) for the delegated wallet.
Switch (Logic n8n node): The core control flow mechanism. Determines if the workflow should proceed down the 'deposit', 'withdraw', or 'no change' path based on the wallet's current USDC balance relative to the configured thresholds.
Calculate Excess/Insufficient Funds (Code n8n node): Calculates the precise amount of USDC required for transaction (either deposit or withdrawal) based on the input thresholds and current balances.
approve USDC (1Shot API n8n node - Execute): Executes the ERC-20 approval function, granting the Aave pool contract permission to move the calculated excess funds from the user's wallet.
Deposit USDC into Aave L2Pool (1Shot API n8n node - Execute): Executes the supply function on the Aave contract, moving the excess funds into savings.
Withdraw from Aave (1Shot API n8n node - Execute): Executes the withdraw function on the Aave contract, moving funds from savings back to the user's wallet.


  • Telegram n8n node (Multiple Instances): Provides detailed confirmations, failure alerts, and status reports to the user, ensuring transparency regarding all n8n node actions and on-chain transactions.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

1Shot API lets you bring onchain actions into your n8n workflows.

Featured*