Treasury System
The treasury system manages platform funds through four specialized treasuries, each dedicated to specific purposes within the Looping Binary ecosystem.
What are Treasuries?
Treasuries are system-controlled wallets that hold and manage coins for specific platform purposes. They enable organized fund management, transparent accounting, and secure payment processing across all connected platforms.
The Four Treasuries
Each treasury serves a distinct purpose in the ecosystem:
Course Treasury
COURSEManages payments for educational courses and learning materials on the LMS platform (Intellex).
Use Cases:
- Course enrollment payments
- Learning material purchases
- Certification fees
- Workshop and training sessions
Subscription Treasury
SUBSCRIPTIONHandles recurring subscription payments for premium features and services across all platforms.
Use Cases:
- Monthly/annual memberships
- Premium platform features
- Ad-free experiences
- Exclusive community access
Reward Treasury
REWARDDedicated to distributing prizes, bonuses, and incentives to users across all platforms.
Use Cases:
- Tournament prize pools
- Achievement rewards
- Referral bonuses
- Promotional giveaways
General Treasury
GENERALMulti-purpose treasury for miscellaneous transactions and platform operations not covered by other treasuries.
Use Cases:
- E-commerce purchases
- General service payments
- Platform fees
- Operational expenses
Treasury Operations
Get Treasury Balance
Check the current balance of any treasury:
fetch('https://api.loopingbinary.com/api/admin/treasury/COURSE/balance', {
headers: {
'x-api-key': process.env.LB_API_KEY,
'Authorization': 'Bearer ' + token
}
})Response:
{
"treasuryType": "COURSE",
"balance": 45780.50,
"lastUpdated": "2025-10-02T17:45:00Z"
}Transfer to Treasury
Users can transfer coins to treasuries for purchases:
fetch('https://api.loopingbinary.com/api/coins/transfer-to-treasury', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
},
body: JSON.stringify(({
treasuryType: 'COURSE',
amount: 50,
reason: 'Purchase: Advanced JavaScript Course'
})
})Transfer from Treasury
Admins can transfer coins from treasuries to users (payouts, refunds):
fetch('https://api.loopingbinary.com/api/admin/treasury/transfer', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.LB_API_KEY,
'Authorization': 'Bearer ' + token
},
body: JSON.stringify(({
fromTreasury: 'REWARD',
toUserId: 123,
amount: 500,
reason: 'Tournament 1st place prize'
})
})Treasury Types Reference
Use these exact values when specifying treasury types in API calls:
| Type | Value | Purpose |
|---|---|---|
| Course Treasury | COURSE | LMS platform payments |
| Subscription Treasury | SUBSCRIPTION | Recurring memberships |
| Reward Treasury | REWARD | Prizes and incentives |
| General Treasury | GENERAL | Miscellaneous transactions |
Security & Access Control
- Only admins with proper API keys can check treasury balances
- Treasury-to-user transfers require admin permissions
- All treasury operations are logged with complete audit trails
- Treasuries cannot have negative balances
- Transfer limits can be configured per treasury type
Common Use Cases
Course Purchase Flow
- User selects a course on LMS platform
- User transfers coins to COURSE treasury
- Platform grants course access to user
- Treasury balance increases
Tournament Prize Distribution
- Tournament ends with winners determined
- Admin transfers from REWARD treasury to winners
- Winners receive coins in their wallets
- REWARD treasury balance decreases
Subscription Renewal
- Monthly subscription comes due
- System automatically transfers from user to SUBSCRIPTION treasury
- If successful, subscription remains active
- If insufficient balance, subscription is paused