Fruit Balance System
The Fruit Balance System is the real-time credit ledger used throughout the TRN ecosystem to track each user’s spendable earnings and enforce platform-wide financial integrity. It operates as a soft accounting layer that reflects how much TRN a user is allowed to spend, withdraw, or transfer—based on what they’ve legitimately earned or received, minus their consumption.
This system is tightly integrated with the TRNUsageOracle
, which enforces all transactions against the current fruit balance and pending adjustments from Merkle drops. It guarantees that no user can go into debt, no double-spending is possible, and all activity is transparently rate-limited by actual platform contribution or ad engagement.
Core Concepts
1. Fruit Balance = Spendable TRN
A user’s fruit balance represents TRN that they have:
Earned from views, retrns, subscriptions, ad views, or boosted post engagement
Not yet withdrawn or transferred
Cleared by the Merkle drop or projected in real-time based on
TRNUsageOracle
The fruit balance acts as the real-time spending balance:
Used when viewing content (1 TRN)
Used to auto-renew subscriptions
Required for boosting posts or initiating actions
2. Live Credit Simulation
During the day, the fruit balance reflects projected earnings that have not yet been finalized by Merkle drop.
This enables:
Real-time content viewing without waiting for end-of-day settlement
Campaign participation
Continuous platform usage (until fruit reaches 0)
However, this credit is strictly limited:
If fruit reaches zero, the user is automatically paused
They must watch ads, earn from posts, or wait for the next drop to continue
3. Two-Part Ledger View
The user interface and backend differentiate between:
fruitBalance
Current usable TRN, including projected fruit for the day
walletBalance
The user’s actual TRN in their wallet, which is hooked in to check against the users fruit balance.
If fruitBalance == walletBalance
and the fruit has not yet dropped, the user is frozen until new earnings or the next Merkle cycle.
4. Daily Reset via Merkle Drop
At the end of each UTC day:
The fruit balance is reconciled
All pending usage and earnings are processed
The wallet is topped up (or not) based on net balance
Subscriptions are renewed
This ensures that all economic activity is sealed, preventing manipulation or abuse.
5. No Negative Balances
Users cannot spend more TRN than they have in their fruit balance.
All actions (views, posts, boosts, subscriptions) are validated in real-time against
fruitBalance
.If the result of any action would create a negative balance:
The action is rejected immediately by the
TRNUsageOracle
.This ensures perfect systemic solvency.
Use Cases
Viewing a post (1 TRN)
Deducted from fruit in real-time
Receiving a retrn
Fruit increases immediately (pending Merkle confirmation)
Boosted post view
Viewer receives 90% TRN as projected fruit
Watching an ad
Credits fruit upon full viewing
Subscription renewal
Deducted from fruit immediately after Merkle drop
Manual subscription purchase
Allowed only if projected fruit covers cost
TRN transfer to another user
Requires full reconciliation of fruit
Attempted action at 0 fruit
Pauses user; can only access old/owned/boosted posts
Safeguards
No staking is required
No overdraft allowed
No speculative spending
No transfers without ledger settlement
All usage is pre-authorized via the oracle and visible to the user as a fruit balance. The separation between fruit and wallet ensures users can’t drain tokens or bypass systemic fairness.
Files to Reference
FruitBalanceLedger.sol
TRNUsageOracle.sol
TRNUsageOracleViewAdapter.ts
DailyMerkleDropProcessor.ts
InteractionPauseController.sol
AdRewardCreditor.ts
SubscriptionRenewalEnforcer.ts
Summary
The Fruit Balance System is the trustless credit engine of the TRN ecosystem. It reflects user-earned TRN in real time, blocks overspending, powers seamless daily platform interactions, and ensures that no one earns more than they’re supposed to or spends what they haven’t earned. Together with the TRNUsageOracle
, it forms the backbone of platform integrity.
Last updated