Skip to content

clementh59/defi-buddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

defi-buddy

Concept

DeFi Buddy automatically monitors your DeFi portfolio and prepares transactions for you to approve, so you don't miss critical information that could impact your positions. For example, when you have a position on Aave and a hack is announced, or bad debt is detected, you want to react immediately. That's what the DeFi Buddy allows you to do. It also detects portfolio inefficiencies and proposes transactions to rebalance or optimize your positions.

The system works by first analyzing your portfolio when you come for the first time on the web app, which fetches your positions from Octav. The backend then automatically creates monitoring workflows via Otomato for each protocol you're using (Aave, Uniswap, ENS, etc.). These workflows monitor on-chain events, protocol updates, security alerts, and market conditions. Every 15 minutes, the backend refetches your portfolio, detects changes, and dynamically starts or stops workflows based on your current positions. When a workflow is triggered (e.g., health factor drops, liquidity goes out of range, or a security issue is detected), Otomato sends a notification to the XMTP agent, which analyzes the context and proposes a ready-to-approve transaction directly to your mobile device. This creates a seamless flow from portfolio monitoring to actionable transaction proposals, ensuring you're always informed and can react quickly to protect or optimize your DeFi positions.

Architecture

Overall Flow

Screenshots

Otomato Workflow Builder

Otomato Workflow Builder

Portfolio Dashboard

Portfolio Dashboard

Transaction Proposals

Transaction Proposal 1 Transaction Proposal 2

Project Structure

web-app

The web-app folder contains a Next.js frontend application that visualizes DeFi portfolio data using the Octav Portfolio API. Built with React, TypeScript, and Tailwind CSS, it provides a dashboard interface for viewing portfolio positions, net worth, and asset distribution across protocols. It also allows the user to see what monitoring the DeFi Buddy is doing for him.

backend

The backend folder contains an Express.js server that manages DeFi monitoring workflows using the Otomato SDK. It fetches portfolio data, stores wallet information locally, and automatically creates workflows for protocols like Aave, ENS, and Uniswap. The server periodically refetches data to detect changes and start/stop workflows.

agent-sdk-starter

The agent-sdk-starter folder contains an XMTP agent that enables conversational DeFi interactions. It listens for XMTP messages, analyzes the current context and proposes DeFi transactions based on the context. The agent supports commands like /balance and /tx, and includes an HTTP server for programmatic message sending.

How to use

  1. Start the backend server (see backend README)
  2. Start the XMTP agent (see agent-sdk-starter README)
  3. Start the web-app (see web-app README)

Important: Make sure to create the XMTP chat first by sending an initial message from your wallet to the agent's address before workflows can send notifications.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •