RWA Vault
RWA Vault is a DeFi project featuring two smart contracts: RWA Vault and RWA Leverage. Users can lend assets for vault shares backed by a diversified basket of real-world assets (RWAs). The project enhances liquidity management and capital efficiency in decentralized finance.
Screenshots






Problem Statement
IntroductionRWA Vault is a next-generation DeFi protocol on Mantle, designed to bridge the gap between decentralized finance and real-world assets (RWAs). It leverages the ERC-4626 tokenized vault standard to provide users with a seamless and innovative way to gain exposure to RWAs while maximizing yield potential.Core FeaturesTokenized Vault (RWA Vault)Users deposit assets into the RWA Vault and receive ERC-4626-compliant vault shares.The vault’s underlying asset is a dynamically managed basket of RWAs.Share prices reflect the performance of the vault’s portfolio, adjusting based on the value of the underlying assets.Performance MetricsDeposit Rate:totalSupply / totalAssetsWithdrawal Rate:totalAssets / totalSupplytotalSupply:Represents the total circulating shares of the vault.totalAssets:Consists of:Cash:Undeployed capital ensuring continuous liquidity for user withdrawals.AUM (Assets Under Management):The deployed capital value in RWAs, updated by an Oracle Manager.RWA Leverage ExtensionAllows users to lock their vault shares for a fixed period.Locked shares can be leveraged to borrow additional funds, subject to vault liquidity.Users benefit from increased returns but incur penalties for late repayments.Managed by aLiquidity Managerwho ensures loan health and liquidates risky positions.Key RolesOracle Manager:Regularly updates the vault’s AUM, impacting share price calculations.Liquidity Manager:Monitors and manages active loans, ensuring optimal liquidity usage and risk mitigation.Innovative AspectsEnhanced Liquidity Management:Continuous liquidity through cash reserves ensures users can withdraw anytime, while planned capital lockups optimize deployment.Dynamic Yield Mechanism:A flexible framework that adjusts based on real-time asset performance.Leverage Incentives:Encourages user participation by offering leveraged positions with structured risk management.Use CasesInstitutional and Retail Investors:Seamless exposure to real-world assets with dynamic risk-return profiles.Borrowers:Access to liquidity backed by locked-up shares.DeFi Ecosystem Growth on Mantle:Demonstrates the potential of combining RWA tokenization with cutting-edge DeFi mechanics.
Solution
Framework and ToolsI built the project using theHardhat framework, a versatile development environment for Ethereum-based projects. It provided the foundation for writing, testing, and deploying smart contracts efficiently.Smart Contract DevelopmentI leveragedOpenZeppelin’s ERC-4626 tokenized vault implementationas the core of the project. This standard ensured a robust and secure vault design, simplifying the process of creating yield-bearing tokenized assets while adhering to industry best practices.Development ProcessProject SetupI initialized the project using Hardhat, configured the environment, and installed necessary dependencies, including OpenZeppelin’s libraries and testing tools.Smart Contract ImplementationDeveloped theRWA Vaultcontract, utilizing the ERC-4626 standard to manage vault shares and RWAs.Built theRWA Leverageextension, allowing locked shares to be leveraged for additional liquidity.Integrated roles like theOracle Managerfor AUM updates and theLiquidity Managerfor active loan monitoring.Writing Test CasesI wrote comprehensive tests usingMochaandChaito ensure the correctness of deposit/withdrawal logic, share price calculations, and leverage mechanisms. This included edge cases to validate the robustness of the Oracle and Liquidity Managers.Deployment ScriptsI crafted custom deployment scripts to automate the deployment process. These scripts ensured smooth contract deployment on theMantle testnet, verifying that all components were operational and properly configured.Testnet Deployment and Dry RunDeployed the contracts on Mantle’s testnet, simulating real-world interactions.Conducted a dry run to evaluate system performance under different scenarios, including high withdrawal demand and stress testing of the leverage feature.Hacky HighlightsDynamic AUM Calculation: A notable innovation was the integration of a custom Oracle system to regularly update the vault’s AUM, ensuring real-time share price adjustments.Flexible Liquidity Management: By separating cash reserves and deployed capital, I maintained continuous liquidity for withdrawals while maximizing yield potential.Optimized Gas Usage: During testing, I identified and optimized high-gas functions, significantly reducing transaction costs.Partner TechnologiesOpenZeppelin: The ERC-4626 implementation provided a secure and standardized foundation, saving development time and ensuring compatibility with DeFi tools.Mantle Network: Deploying on Mantle allowed me to leverage its scalability and low fees, ensuring an optimal user experience.This approach ensured a well-structured, secure, and efficient project build, aligning with Mantle’s goal of pushing the boundaries of DeFi innovation.
Hackathon
ETHGlobal Bangkok
2024
Contributors
- unblocktechie
22 contributions