Skip to content

hashgraph/hedera-accelerator-rwa-defi-be

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Hedera RWA DeFi Accelerator

⚠️ WARNING: No audits have been done on this codebase. No warranties. This code is 'in progress' and is intended for demonstration and/or start of your project. You need to do your own QA & Audits before using this.

A comprehensive suite of smart contracts for tokenizing real-world assets (RWA) and providing DeFi functionality on the Hedera EVM. This project enables the creation of compliant, governable, and yield-generating tokenized real estate assets.

πŸš€ Quick Start

# Clone the repository
git clone https://github.com/hashgraph/hedera-accelerator-defi-eip.git
cd hedera-accelerator-defi-eip

# Install dependencies
yarn install

# Compile contracts
yarn compile

# Run tests
yarn test

# Deploy to testnet
yarn deploy

πŸ“š Documentation

Comprehensive documentation is available in the docs/ folder:

🧩 Core Components

🏒 Buildings Module

Complete tokenization suite for real estate assets:

  • ERC3643 Security Tokens with built-in compliance
  • ERC4626 Vaults for asset management and yield generation
  • Governance System for on-chain decision making
  • Treasury Management for fund flows
  • Identity Integration using OnchainID for KYC/AML

πŸ”„ Auto Compounder

Automated yield optimization:

  • Dual Vault Support (ERC4626 and ERC7540)
  • Automatic Compounding of rewards
  • Exchange Rate Tracking for performance monitoring
  • Uniswap Integration for asset swaps

πŸ“Š Vault V2 (RewardsVault4626)

ERC4626-compliant yield vault:

  • Standard Compliance with ERC4626 interface
  • Multi-token Rewards system
  • Lock Periods for withdrawal restrictions
  • User Management with individual tracking

🎯 Slice

Portfolio management and rebalancing:

  • Automated Rebalancing based on price oracles
  • Multi-asset Portfolios with target allocations
  • Yield Optimization across multiple buildings
  • Dynamic Composition based on metadata

πŸš€ Key Features

  • πŸ”’ Compliance Ready: Built-in KYC/AML and regulatory compliance
  • πŸ›οΈ Governance: On-chain voting and decision making
  • πŸ’° Yield Generation: Automated yield capture and compounding
  • πŸ”„ Automation: Automated rebalancing and task execution
  • πŸ“Š Portfolio Management: Multi-asset portfolio management
  • πŸ” Audit Trail: Complete audit and compliance tracking
  • 🎨 Metadata: Rich on-chain metadata for assets
  • πŸ’± Trading: Controlled token exchange mechanisms

πŸ› οΈ Technology Stack

  • Solidity 0.8.24: Smart contract development
  • Hardhat: Development framework
  • OpenZeppelin: Security and standards
  • ERC3643 (T-REX): Security token standard
  • ERC4626: Vault standard
  • ERC7540: Asynchronous vault operations
  • Chainlink: Price oracles
  • Uniswap V2: DEX integration

🌐 Network Support

Network Chain ID Status Explorer
Hedera Testnet 296 βœ… Active HashScan Testnet
Hedera Mainnet 295 βœ… Active HashScan Mainnet
Hedera Previewnet 297 βœ… Active HashScan Previewnet

πŸ“ Project Structure

hedera-accelerator-defi-eip/
β”œβ”€β”€ contracts/           # Smart contracts
β”‚   β”œβ”€β”€ audit/          # Audit registry
β”‚   β”œβ”€β”€ autocompounder/ # Auto compounding
β”‚   β”œβ”€β”€ buildings/      # Building tokenization
β”‚   β”œβ”€β”€ erc721/         # Enhanced NFTs
β”‚   β”œβ”€β”€ exchange/       # Token exchange
β”‚   β”œβ”€β”€ slice/          # Portfolio management
β”‚   β”œβ”€β”€ treasury/       # Fund management
β”‚   β”œβ”€β”€ upkeeper/       # Task automation
β”‚   └── vaultV2/        # ERC4626 vaults
β”œβ”€β”€ docs/               # Documentation
β”œβ”€β”€ examples/           # Usage examples
β”œβ”€β”€ scripts/            # Deployment scripts
β”œβ”€β”€ test/               # Test suites
└── data/               # Deployment data
    β”œβ”€β”€ abis/           # Contract ABIs
    └── deployments/    # Deployment addresses

πŸ§ͺ Testing

# Run all tests
yarn test

# Run specific test suite
yarn hardhat test test/buildings/

# Run with gas reporting
yarn test --gas-report

# Generate coverage report
yarn hardhat coverage

πŸš€ Deployment

Environment Setup

Create a .env file:

RPC_URL=https://testnet.hashio.io/api
PRIVATE_KEY=your_private_key_here
COINMARKETCAP_API_KEY=your_api_key_here

Deploy to Testnet

# Deploy all contracts
yarn deploy

# Deploy specific components
yarn hardhat run scripts/deploy-building.ts --network testnet
yarn hardhat run scripts/deploy-autocompounder-factory.ts --network testnet

Deploy to Mainnet

# Deploy to mainnet (use with caution)
yarn hardhat run scripts/deploy.ts --network mainnet

πŸ“Š Data Folder

The data/ folder contains important deployment and configuration information:

  • abis/: Contract ABIs for all deployed contracts
  • deployments/: Deployment addresses by network
  • chain-296.json: Hedera testnet deployment addresses

Accessing Deployment Data

import deployments from "./data/deployments/chain-296.json";

// Get building factory address
const buildingFactory = deployments.factories.BuildingFactory;

// Get implementation addresses
const tokenImpl = deployments.implementations.Token;

πŸ”— Integration Examples

Deploy a Building

import { ethers } from "hardhat";

async function deployBuilding() {
    const buildingFactory = await ethers.getContractAt("BuildingFactory", factoryAddress);

    const buildingDetails = {
        tokenURI: "https://example.com/building-metadata",
        tokenName: "Building Token",
        tokenSymbol: "BT",
        tokenDecimals: 18,
        tokenMintAmount: ethers.parseEther("1000000"),
        treasuryReserveAmount: ethers.parseUnits("10000", 6),
        treasuryNPercent: 2000, // 20%
        governanceName: "Building Governance",
        vaultShareTokenName: "Building Vault Share",
        vaultShareTokenSymbol: "BVS",
        vaultFeeReceiver: feeReceiverAddress,
        vaultFeeToken: usdcAddress,
        vaultFeePercentage: 100, // 1%
        vaultCliff: 0,
        vaultUnlockDuration: 86400 * 30, // 30 days
        aTokenName: "Building Auto Compounder",
        aTokenSymbol: "BAC",
    };

    await buildingFactory.newBuilding(buildingDetails);
}

Create a Slice Portfolio

async function createSlice() {
    const slice = await ethers.deployContract("Slice", [
        uniswapRouterAddress,
        usdcAddress,
        "Real Estate Slice",
        "RES",
        "https://example.com/metadata",
    ]);

    // Add allocations to portfolio
    await slice.addAllocation(buildingAAddress, oracleAAddress, 3000);
    await slice.addAllocation(buildingBAddress, oracleBAddress, 3000);
    await slice.addAllocation(buildingCAddress, oracleCAddress, 4000);
}

🀝 Contributing

We welcome contributions! Please see our contributing guide for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

Code Standards

  • Follow Solidity style guide
  • Add comprehensive tests
  • Update documentation
  • Ensure gas optimization

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

πŸ†˜ Support

  • Documentation: Check the docs/ folder
  • Issues: Open an issue in this repository
  • Technical Support: See our support guide
  • Community: Join the Hedera Discord

⚠️ Disclaimer

This software is provided "as is" without warranty of any kind. The code is in active development and has not been audited. Use at your own risk and ensure proper testing and auditing before production use.


Ready to get started? Check out our comprehensive documentation or explore the examples folder for practical usage examples.

About

No description or website provided.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 11