project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

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.

RWA Vault

Created At

ETHGlobal Bangkok

Project Description

Introduction

RWA 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 Features

  1. Tokenized 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.
  2. Performance Metrics

    • Deposit Rate: totalSupply / totalAssets
    • Withdrawal Rate: totalAssets / totalSupply
    • totalSupply: 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.
  3. RWA Leverage Extension

    • Allows 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 a Liquidity Manager who ensures loan health and liquidates risky positions.

Key Roles

  • Oracle 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 Aspects

  • Enhanced 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 Cases

  • Institutional 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.

How it's Made

Framework and Tools
I built the project using the Hardhat framework, a versatile development environment for Ethereum-based projects. It provided the foundation for writing, testing, and deploying smart contracts efficiently.

Smart Contract Development
I leveraged OpenZeppelin’s ERC-4626 tokenized vault implementation as 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 Process

  1. Project Setup
    I initialized the project using Hardhat, configured the environment, and installed necessary dependencies, including OpenZeppelin’s libraries and testing tools.

  2. Smart Contract Implementation

    • Developed the RWA Vault contract, utilizing the ERC-4626 standard to manage vault shares and RWAs.
    • Built the RWA Leverage extension, allowing locked shares to be leveraged for additional liquidity.
    • Integrated roles like the Oracle Manager for AUM updates and the Liquidity Manager for active loan monitoring.
  3. Writing Test Cases
    I wrote comprehensive tests using Mocha and Chai to 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.

  4. Deployment Scripts
    I crafted custom deployment scripts to automate the deployment process. These scripts ensured smooth contract deployment on the Mantle testnet, verifying that all components were operational and properly configured.

  5. Testnet Deployment and Dry Run

    • Deployed 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 Highlights

  • Dynamic 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 Technologies

  • OpenZeppelin: 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.

background image mobile

Join the mailing list

Get the latest news and updates