CentoAI is an AI-powered DeFi portfolio manager that optimizes yield farming and flash loan arbitrage across top DeFi protocols like Aave, Compound, and Uniswap V3. Built using Coinbase AgentKit, Privy, and deployed on Base and Arbitrum, CentoAI automates fund management and strategy execution to maximize user returns.
- AI-Driven Yield Optimization: Dynamically reallocates funds to the highest-yielding opportunities across DeFi protocols.
- Flash Loan Arbitrage: Executes arbitrage strategies using Balancer V2 flash loans for risk-free profits.
- Multi-Protocol Integration: Supports Aave, Compound, Uniswap V3, and Balancer V2.
- On-Chain Automation: Uses Coinbase AgentKit to automate fund movements and strategy execution.
- User-Friendly Vaults: Each user gets a personalized vault to deposit funds and set strategies.
- Seamless Onboarding: Leverages Privy for embedded wallets and social logins, making it easy for users to onboard and interact with DeFi.
- Base Deployment: Deployed on Base for low-cost, high-speed transactions.
- Arbitrum Deployment: Deployed on Arbitrum for low-cost, high-speed transactions.
- Core Framework: Coinbase AgentKit
- Onboarding: Privy
- Blockchain: Base, Arbitrum
- Frontend: Next.js + OnchainKit
- Backend: Node.js
- Smart Contracts: Solidity (Foundry for testing and deployment)
Base Sepolia : VaultFactory
Arbitrum Sepolia : VaultFactory
CentoAI is built on a modular architecture, with the following key components:
- LiquidityManager.sol: Manages liquidity across Aave, Compound, and Uniswap V3.
- Arbitrage.sol: Executes flash loan arbitrage strategies using Balancer V2.
- Vault.sol: Manages user balances and strategy execution.
- VaultFactory.sol: Deploys personalized vaults for users.
- Built with Next.js and OnchainKit for seamless wallet integration and portfolio visualization.
- Provides a user-friendly dashboard for monitoring portfolio performance and strategy execution.
- Integrates Privy for embedded wallets and social logins, enabling users to onboard with email or existing wallets.
- Node.js backend for handling off-chain computations and API integrations.
- Fetches real-time APY data from DeFi protocols and provides it to the AI agent.
- Analyzes yield opportunities and arbitrage strategies using machine learning models.
- Executes strategies securely using Coinbase AgentKit.
- Users connect their wallets or sign in with email/social login using Privy.
- A personalized vault is deployed for the user using VaultFactory.sol.
- Users deposit ERC20 tokens (e.g., USDC, ETH) into their vault.
- The AI agent fetches real-time APY data from Aave, Compound, and Uniswap V3.
- It analyzes yield opportunities and identifies arbitrage opportunities using Balancer V2 flash loans.
- The AI agent executes strategies such as:
- Yield Farming: Moves funds between protocols to maximize APY.
- Flash Loan Arbitrage: Executes risk-free arbitrage between DEXes.
- Users can monitor their portfolio performance, strategy execution, and transaction history through the dashboard.
- The dashboard provides insights into:
- Current APY across protocols.
- Profit/loss from arbitrage strategies.
- Historical performance of the portfolio.
- Manages liquidity across Aave, Compound, and Uniswap V3.
- Key Functions:
supplyLiquidityOnAave: Supplies liquidity to Aave.withdrawLiquidityFromCompound: Withdraws liquidity from Compound.swapOnUniswap: Executes token swaps on Uniswap V3.
- Executes flash loan arbitrage strategies using Balancer V2.
- Key Functions:
executeTrade: Initiates a flash loan and executes arbitrage.receiveFlashLoan: Callback function for flash loan execution.
- Manages user balances and strategy execution.
- Key Functions:
depositERC20: Deposits ERC20 tokens into the vault.withdrawERC20: Withdraws ERC20 tokens from the vault.lendTokens: Lends tokens to Aave or Compound.
- Deploys personalized vaults for users.
- Key Functions:
createVault: Deploys a new vault for a user.getVaultAddress: Retrieves the vault address for a user.
- Used for secure, programmatic wallet interactions.
- Enables the AI agent to execute on-chain actions (e.g., deposits, withdrawals, swaps).
- Provides embedded wallets and social logins, making it easy for users to onboard and interact with DeFi.
- Supports both web3-native users (with existing wallets) and newcomers (with email/social login).
- CentoAI is deployed on Base and Arbitrum for low-cost, high-speed transactions.
- Supports yield farming and arbitrage strategies on both networks.
CentoAI is designed to compete in the following ETHGlobal Agentic Ethereum tracks:
- Most Innovative Use of AgentKit: CentoAI uses AgentKit to automate complex DeFi strategies, abstracting away the complexity for users.
- Best Combination of AgentKit + OnchainKit: The frontend integrates OnchainKit for seamless wallet interactions and portfolio visualization.
- Viral Consumer App Award: CentoAIβs user-friendly interface and AI-driven strategies make it accessible to both DeFi experts and beginners.
- AgentKit Pool Prize: CentoAI is built with AgentKit in a meaningful way for users to interact with the DeFi ecosystem.
- Build an AI-Powered App on Base: CentoAI is deployed on Base, leveraging its low-cost, high-speed infrastructure for seamless DeFi operations.
- Best Consumer Experience Built with Server Wallets: CentoAI uses Privy to provide a seamless onboarding experience, enabling users to sign in with email, social login, or existing wallets. This makes CentoAI accessible to all users, regardless of their web3 experience.
- Most Innovative AI Agent Applications: CentoAI combines yield farming and flash loan arbitrage to push the boundaries of DeFi automation.
contracts/
βββ lib/ # Dependencies
βββ scripts/ # Deployment and utility scripts
βββ src/ # Smart contracts for onchain actions
βββ test/ # Unit & Forked Tests of Smart contracts
βββ scripts/ # Deployment and utility scripts
βββ README.md # This file
βββ LICENSE # MIT License
- Foundry: Install Foundry for smart contract development and testing.
curl -L https://foundry.paradigm.xyz | bash foundryup
-
Clone the repository:
git clone https://github.com/Cento-AI/contracts cd cento-ai -
Install dependencies:
forge install
-
Compile the smart contract:
forge build
-
Deploy the contract to the Base Sepolia Testnet:
forge script script/DeployVaultFactory.sol:DeployVaultFactory <BASE_SEPOLIA_RPC_URL> --private-key <PRIVATE_KEY> --broadcast --verify --verifier blockscout --verifier-url https://base-sepolia.blockscout.com/api/
Deploy the contract to the Arbitrum Sepolia Testnet:
forge script script/DeployVaultFactory.sol:DeployVaultFactory <ARBITRUM_SEPOLIA_RPC_URL> --private-key <PRIVATE_KEY> --broadcast --verify --verifier blockscout --verifier-url https://arbitrum-sepolia.blockscout.com/api/
Foundry is used for testing the Arbitrage contract. To run the tests:
-
Write your tests in the test directory.
-
Run the tests using:
forge test
CentoAI is a proof-of-concept project built for the ETHGlobal Agentic Ethereum hackathon. It is not audited and should not be used in production. Use at your own risk.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See LICENSE for details.
- ETHGlobal for hosting the Agentic Ethereum hackathon.
- Coinbase, Base, Privy, and Arbitrum for their support and tooling.
