RUJI Lend & Borrow
This guide covers integrating RUJI Lending (supply-side) and RUJI Credit (borrow-side CDP loans) into your application.
Overview
Contract
Purpose
User Actions
Architecture
┌─────────────────┐ ┌─────────────────┐
│ Ghost Vault │ │ Ghost Vault │
│ (BTC) │ │ (USDC) │ ... per asset
└────────┬────────┘ └────────┬────────┘
│ │
│ Borrows from │
▼ ▼
┌─────────────────────────────────────────┐
│ Ghost Credit │
│ (Manages Credit Accounts / CDPs) │
└─────────────────────────────────────────┘
│
│ Creates
▼
┌─────────────────────────────────────────┐
│ Credit Account │
│ (User's isolated margin account) │
│ - Holds collateral │
│ - Tracks debt positions │
└─────────────────────────────────────────┘Contract Addresses
Mainnet
Contract
Address
Stagenet (Testnet)
Contract
Address
Supported Assets
Asset
Denom
Collateral Ratio
Lending Vault Receipt Token
Part 1: Lending Integration (Ghost Vault)
1.1 Query: Get Vault Status
1.2 Query: Get Vault Config
1.3 Calculate User Position Value
1.4 Execute: Deposit
1.5 Execute: Withdraw
Part 2: Borrowing Integration (Ghost Credit)
2.1 Query: Get Credit Config
2.2 Query: Get User's Credit Accounts
2.3 Query: Single Credit Account
2.4 Query: Predict Account Address
2.5 Execute: Create Credit Account
2.6 Execute: Deposit Collateral & Borrow
2.7 Execute: Repay Debt
2.8 Execute: Withdraw Collateral
2.9 Execute: Close Position (Repay All & Withdraw)
Part 3: Displaying Data in UI
3.1 Lending Position
3.2 Borrow Position
3.3 Risk Indicators
LTV Range
Health Status
Color
Part 4: Interest Rate Model
Example Calculation
Utilization
Borrow Rate
Supply Rate
Part 5: Fees
Protocol Fees
Fee Type
Rate
Distribution
Part 6: Error Handling
Common Errors
Error
Cause
Solution
Transaction Simulation
Part 7: Code Examples
Complete Lending Flow (TypeScript)
Complete Borrowing Flow (TypeScript)
Appendix A: Message Reference
Ghost Vault Execute Messages
Ghost Vault Query Messages
Ghost Credit Execute Messages
Ghost Credit Query Messages
Appendix B: Response Types
StatusResponse (Ghost Vault)
AccountResponse (Ghost Credit)
Last updated
