β οΈ 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.
# 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 deployComprehensive documentation is available in the docs/ folder:
- π Complete Documentation - Start here for an overview
- ποΈ Buildings Module - Tokenized real estate assets
- π Auto Compounder - Automated yield optimization
- π Vault - ERC4626-compliant yield vaults
- π― Slice - Portfolio management and rebalancing
- ποΈ Treasury - Fund management and distribution
- π³οΈ Governance - On-chain governance for building decisions
- π Audit Registry - Building audit management
- π¨ ERC721 Metadata - Enhanced NFT with on-chain metadata
- π± Exchange - One-sided token exchange
- βοΈ Upkeeper - Automated task execution system
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
Automated yield optimization:
- Dual Vault Support (ERC4626 and ERC7540)
- Automatic Compounding of rewards
- Exchange Rate Tracking for performance monitoring
- Uniswap Integration for asset swaps
ERC4626-compliant yield vault:
- Standard Compliance with ERC4626 interface
- Multi-token Rewards system
- Lock Periods for withdrawal restrictions
- User Management with individual tracking
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
- π 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
- 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 | Chain ID | Status | Explorer |
|---|---|---|---|
| Hedera Testnet | 296 | β Active | HashScan Testnet |
| Hedera Mainnet | 295 | β Active | HashScan Mainnet |
| Hedera Previewnet | 297 | β Active | HashScan Previewnet |
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
# 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 coverageCreate a .env file:
RPC_URL=https://testnet.hashio.io/api
PRIVATE_KEY=your_private_key_here
COINMARKETCAP_API_KEY=your_api_key_here# 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 (use with caution)
yarn hardhat run scripts/deploy.ts --network mainnetThe data/ folder contains important deployment and configuration information:
abis/: Contract ABIs for all deployed contractsdeployments/: Deployment addresses by networkchain-296.json: Hedera testnet deployment addresses
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;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);
}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);
}We welcome contributions! Please see our contributing guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
- Follow Solidity style guide
- Add comprehensive tests
- Update documentation
- Ensure gas optimization
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Documentation: Check the docs/ folder
- Issues: Open an issue in this repository
- Technical Support: See our support guide
- Community: Join the Hedera Discord
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.