Laina is a low fee, trustless, and easy-to-use decentralized loan platform.
We are focusing on making a simple and efficient DeFi product, where there is minimal need for token swapping or liquidity other than what is used for lending. Our vision is to change DeFi by making it accessible and understandable for everyone, regardless of their technical knowledge or financial status. By providing efficient single-token lending pools, we eliminate the complexities often associated with multi-token systems.
This repository uses the following structure:
.
├── contracts (Stellar Smart Contracts)
│ ├── loan_manager (Deploys pools and manages loans)
│ ├── loan_pool (Holds a single type of token for lending)
│ └── reflector_mock (Mock price oracle for testing)
├── liquidation-bot (Example bot for liquidating unhealthy loans)
├── public (assets)
├── scripts (scripts for deploying & updating Smart Contracts)
├── src (dApp)
│ ├── components (Reusable UI components)
│ ├── contexts (State Contexts)
│ ├── contracts (autogenerated RPC bindings for Smart Contracts)
│ ├── images (Static image assets)
│ ├── layouts (Astro layouts)
│ ├── lib
│ ├── pages
│ └── App.tsx
├── Cargo.toml
├── README.md
└── DEVELOPMENT.md
sequenceDiagram
box Front-end
participant UI
end
box Laina Contracts
participant LendingPool
participant LoanManager
end
box Oracle Contract
participant PriceOracle
end
UI->>LendingPool: get_balance()
LendingPool-->>UI: Balance
UI->>LoanManager: get_price()
LoanManager->>PriceOracle: last_price(Token)
PriceOracle-->>LoanManager: PriceData
LoanManager-->>UI: Price
UI->>LendingPool: get_interest_rate()
LendingPool->>LoanManager: get_interest_rate(Pool)
LoanManager-->>LendingPool: Interest rate
LendingPool-->>UI: Interest rate
UI->>LendingPool: deposit()
LendingPool-->>UI: OK/Error
sequenceDiagram
box Front-end
participant UI
end
box Laina Contracts
participant LendingPool
participant LoanManager
end
box Oracle Contracts
participant PriceOracle
end
UI->>LendingPool: get_available_balance()
LendingPool-->>UI: Available Balance
UI->>LendingPool: get_interest_rate()
LendingPool->>LoanManager: get_interest_rate(Pool)
LoanManager-->>UI: Interest rate
UI->>LoanManager: get_price()
LoanManager->>PriceOracle: last_price(Token)
PriceOracle-->>LoanManager: PriceData
LoanManager-->>UI: Price
UI->>LoanManager: init_loan(token_borrow, borrow_amount, token_collat, collat_amount)
loop calculate_health_factor()
LoanManager->>PriceOracle: last_price(token_borrow)
PriceOracle-->>LoanManager: PriceData
LoanManager->>PriceOracle: last_price(token_collat)
PriceOracle-->>LoanManager: PriceData
LoanManager->>LoanManager: Check that health-factor is over minimum threshold
end
LoanManager-->>LendingPool: deposit_collateral()
LoanManager-->>LendingPool: borrow()
LoanManager-->>UI: OK/Error