crvUSD Metavault
LlamaLend MetaVault: A smart contract optimizing yields across multiple LlamaLend markets. It automates allocations based on trusted third-party target weights, minimizing on-chain transactions while maintaining close-to-target distributions for maximum capital efficiency.
Screenshots



Problem Statement
The LlamaLend MetaVault is an innovative DeFi solution designed to maximize returns for users by leveraging multiple LlamaLend markets. This ERC-4626 compliant contract acts as a meta-layer, automatically distributing user deposits across various LlamaLend markets based on target weights set by a trusted third party.Key features include:Trusted weight setting: A designated third party can adjust target allocations across markets.Efficiency-focused rebalancing: The contract realigns assets across markets while minimizing the number of on-chain transactions.Automated deposit and withdrawal handling: The MetaVault optimizes asset distribution during user interactions, maintaining allocations close to target weights.Fully on-chain operations: All logic and execution happen on-chain, ensuring transparency and eliminating off-chain dependencies.By using the MetaVault, users can benefit from expert-curated allocations and potentially higher yields without the need to manually manage multiple positions across LlamaLend markets. This project aims to enhance capital efficiency in the LlamaLend ecosystem and provide a streamlined experience for users seeking optimized returns.
Solution
The LlamaLend MetaVault is built using Solidity and incorporates several sophisticated design patterns:ERC-4626 Compliance: The contract inherits from OpenZeppelin's ERC4626 implementation, ensuring compatibility with the tokenized vault standard.Efficient Market Management: A struct-based approach is used to manage multiple LlamaLend markets, allowing for flexible addition and removal of underlying strategies.Transaction-Minimizing Algorithms: Custom algorithms for deposit allocation and withdrawal deallocation ensure optimal distribution of assets while minimizing the number of on-chain interactions with individual markets.Precision Balancing: The implementation uses an EPSILON value (200 basis points) to allow for slight deviations from target allocations, reducing unnecessary rebalancing transactions.Trusted Controls: The contract includes functions for a designated party to update target weights, enabling expert-driven allocation strategies.Gas Optimization: Efficient looping and conditional checks are employed to minimize gas costs during operations.Safety Measures: The contract includes checks to prevent actions that would leave no enabled markets or set invalid allocation targets.On-Chain Execution: All logic, including complex rebalancing operations, is executed entirely on-chain, ensuring full transparency and eliminating off-chain dependencies.This implementation showcases advanced Solidity programming techniques and a deep understanding of DeFi mechanics, particularly in the realm of yield optimization and multi-market management within the LlamaLend ecosystem.
Hackathon
ETHGlobal Brussels
2024