Skip to content

drparadox05/AegisSC

Repository files navigation

AegisYield

Overview

This protocol is designed to automate the selection and rebalancing of yield-generating assets on Ethereum using Chainlink Functions and Chainlink Automation. It dynamically fetches the highest APY (Annual Percentage Yield) from leading lending protocols and triggers rebalancing in a core contract, ensuring optimal yield for users.

Problem Statement

Yield optimization in DeFi is challenging due to the rapidly changing rates across protocols. Manually monitoring and reallocating funds is inefficient and error-prone. There is a need for a trustless, automated solution that continuously tracks yields and reallocates assets to maximize returns.

Solution & Detailed Flow

This protocol leverages Chainlink Functions and Automation to provide a fully automated, decentralized yield optimization system:

  1. Automated Scheduling:
    Chainlink Automation triggers the protocol at regular intervals (e.g., daily) to check if a rebalance is needed.

  2. Off-chain Data Fetching:
    Using Chainlink Functions, the protocol fetches APY data from Defilama, filtering for eligible pools on Ethereum from protocols like Aave, Compound, and Spark.

  3. Selection Logic:
    The fetched pools are filtered and sorted by APY. The pool with the highest APY is selected.

  4. On-chain Update:
    The protocol decodes the result and updates the core contract with the new optimal asset, APY, and protocol.

  5. Rebalancing:
    The core contract's triggerRebalance function is called, reallocating funds to the new optimal yield source.

  6. Access Control:
    Only the contract owner or the Chainlink Automation contract can trigger sensitive functions, ensuring security.

Architecture

Deployment

  • Network: Sepolia Testnet
    Note: Due to the lack of real APY data APIs on testnets, this protocol demonstration uses mainnet data sources..

  • Eth Seploia Deployed Addresses:

    • AegisCore Contract: 0xCd4A9CbA195675d04157f508543e8b6e002759bF
    • Automation Contract: 0xb3e10fd45402C314c17da0bB253565D13370981a
    • Other Relevant Contracts: 0x0Ce29C4222EDB06FA4f28Cf3a3029fa4175cfCDf

About

Smart Contracts for Aegis Protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published