thBonds Implementation
Tharwa Bonds solve a fundamental problem in DeFi: how to offer predictable, fixed yields without relying on token emissions or unsustainable farming mechanics. This page explains how our bond system works, from the economic model to the technical implementation.
What Problem Do Tharwa Bonds Solve?
Traditional DeFi yield comes from:
Liquidity mining: Unsustainable token emissions
Lending protocols: Variable rates that can crash during stress
Yield farming: Complex strategies with smart contract risks
Tharwa Bonds offer something different: Fixed yields backed by real-world asset performance, structured like traditional bonds but with DeFi composability.
The Bond Model Explained
How Traditional Bonds Work:
Buy bond for $950
Receive $1000 at maturity
$50 profit = yield
Problems for DeFi:
No composability
No secondary markets
Complex legal structures
How Tharwa Bonds Work:
Buy bond for 0.96 thUSD
Receive 1.00 thUSD at maturity
0.04 thUSD profit = yield
DeFi Advantages:
ERC-1155 NFTs (tradeable)
On-chain metadata
Instant settlement
Composable with other protocols
Contract Overview
Contract
TharwaBondVaultV1.sol
Standard
ERC-1155 with financial metadata
Address
0xAc02FF90bC709A134cD4Ad0b50BaB8be9e0f504e (Mainnet)
Audit
Security
0 Critical, 0 High findings
How Tharwa Bonds Work: Technical Architecture
The Token ID System: Why It's Brilliant
Tharwa Bonds use a unique approach to NFT IDs that makes them both predictable and composable:
Key Insight: Each bond's NFT ID equals its maturity timestamp truncated to UTC midnight
Example: A 90-day bond purchased on January 1st, 2025 would have token ID 1712102400 (April 1st, 2025 at 00:00:00 UTC)
Why This Matters:
Predictable IDs: Anyone can calculate a bond's ID without querying the contract
No Collisions: Same maturity date = same token ID = fungible bonds
Easy Integration: External protocols can work with bonds without complex lookups
Metadata Efficiency: Token ID contains the maturity information
Bond Configuration System
Instead of hardcoding bond parameters, Tharwa uses a flexible configuration system:
Real-World Example:
What this means:
Users pay 0.96 thUSD to buy a bond
They receive 1.00 thUSD at maturity (90 days later)
Maximum 1M thUSD worth of these bonds can be issued
4.17% return over 90 days ≈ 3.94% APY
What this means:
Users pay 0.88 thUSD to buy a bond
They receive 1.00 thUSD at maturity (360 days later)
Maximum 4M thUSD worth of these bonds can be issued
13.64% return over 360 days ≈ 8.00% APY
User Bond Tracking
For each bond purchase, the contract stores essential information:
Why We Track This:
principal: Needed for early exit penalty calculationsmaturityAmount: The guaranteed payout (always 1:1 with face value)purchaseTime: Determines how much penalty decays over time
Example User Bond:
Token ID Calculation: The Technical Deep Dive
The token ID system is one of Tharwa Bonds' most innovative features. Let's break down exactly how it works and why it's designed this way:
The Algorithm
Why Truncate to Midnight?
Without Truncation:
Bond bought at 14:30 UTC → Token ID:
1712156200Bond bought at 09:15 UTC → Token ID:
1712137300Same maturity day, different token IDs
No fungibility between bonds
Complex secondary markets
Result: Fragmented liquidity and poor user experience
With Midnight Truncation:
Bond bought at 14:30 UTC → Token ID:
1712102400(midnight)Bond bought at 09:15 UTC → Token ID:
1712102400(midnight)Same maturity day, same token ID
Perfect fungibility
Unified secondary markets
Result: Liquid, efficient bond markets
Real-World Example
Scenario: Two users buy 90-day bonds on the same day:
User A buys at 2:30 PM UTC
User B buys at 9:15 AM UTC
Traditional Approach: Different token IDs, no fungibility Tharwa Approach: Same token ID (maturity_date_at_midnight), perfect fungibility
Impact: User A can sell to User B seamlessly, or both can trade on secondary markets as the same asset.
Bond Economics: How Fixed Yields Work
The Discount Bond Model
Tharwa Bonds use a discount bond structure - the foundation of institutional fixed-income markets:
How Discount Bonds Work:
Purchase below par: Buy bond for less than face value
Hold to maturity: No coupon payments during term
Redeem at par: Receive full face value at maturity
Profit = Discount: Yield comes from the price difference
Why This Model:
Simple structure: No complex payment schedules
Predictable returns: Known yield from day one
Capital efficient: No need for coupon reserves
Institutional standard: Familiar to traditional investors
Our Bond Structure:
90 days
0.96 thUSD
1.00 thUSD
4.17%
~3.94%
180 days
0.93 thUSD
1.00 thUSD
7.53%
~5.91%
360 days
0.88 thUSD
1.00 thUSD
13.64%
~8.00%
Mathematical Foundation:
Example: 90-day bond
Buy for 0.96 thUSD, receive 1.00 thUSD
Return = (1.00/0.96)^(365/90) - 1 = 3.94% APY
Yield Source & Sustainability
Issuance Caps: Preventing Over-Leverage
Each bond type has strict issuance caps to prevent over-leverage:
90 days
1M thUSD
Short-term liquidity
Minimal duration risk
180 days
2M thUSD
Medium-term allocation
Balanced risk/reward
360 days
4M thUSD
Long-term commitment
Higher cap for better yields
Why Caps Matter:
Prevents over-issuance beyond portfolio capacity
Maintains yield sustainability by limiting obligations
Protects protocol solvency during stress scenarios
Enables gradual scaling as the protocol matures
Core Functions
Bond Purchase
Early Exit System: Balancing Liquidity and Commitment
The early exit system is designed to provide liquidity while protecting the protocol from excessive redemption pressure.
The Penalty Calculation Algorithm
Understanding the Penalty Formula
Penalty Calculation:
Key Variables:
INITIAL_PENALTY: 20% (2000 basis points)timeElapsed: How long you've held the bondtotalTime: Full bond durationpenalty: Decreases linearly to 0% at maturity
Exit Amount:
360-Day Bond Scenario:
Purchase: 0.88 thUSD on Day 0
Face Value: 1.00 thUSD at maturity
Early Exit Timeline:
Day 0: 20% penalty → Exit for ~0.70 thUSD
Day 90: 15% penalty → Exit for ~0.75 thUSD
Day 180: 10% penalty → Exit for ~0.79 thUSD
Day 270: 5% penalty → Exit for ~0.84 thUSD
Day 360: 0% penalty → Redeem for 1.00 thUSD
Why This Works:
Early exit possible but discouraged
Penalty decreases as commitment increases
Protocol protected from excessive redemptions
User flexibility maintained
Why Penalty on Principal, Not Face Value?
Secondary Market Alternative
Instead of early exit penalties, users can trade bonds on secondary markets:
Direct Protocol Exit:
Immediate: Get thUSD instantly
Penalty: Time-decaying penalty applied
Predictable: Exact amount calculable
Guaranteed: Protocol always honors exits
Best for: Emergency liquidity needs
NFT Marketplace Trading:
No penalty: Trade at market price
Price discovery: Market determines value
Composable: Works with any ERC-1155 marketplace
Flexible: Can sell partial positions
Best for: Optimizing returns and market timing
Maturity Redemption
Bond Metadata
On-Chain Metadata Structure
Each bond NFT contains rich metadata for composability:
Dynamic Metadata Updates
Integration Examples
Purchase Bond via Contract
Secondary Market Trading
Production Status thBonds are live on Ethereum mainnet with over $XXX TVL and 0 security incidents since launch.
Last updated
