Problem Statement
quantara/soroban/adapters/LendingAdapter.py defines a comprehensive abstract interface with 8 methods for lending protocol integration, but zero concrete implementations exist. The factory's _adapters dict is empty. The entire lending/borrowing flow is stubbed.
Evidence
# quantara/soroban/adapters/LendingAdapter.py
class LendingAdapterFactory:
_adapters: Dict[str, type] = {} # EMPTY — no implementations
@classmethod
def create(cls, name: str, **kwargs) -> LendingAdapter:
if name not in cls._adapters:
raise ValueError(f"Unknown lending adapter: {name}.") # Always raises!
The abstract interface defines: get_reserve_data, get_user_position, deposit, withdraw, borrow, repay, enable_collateral, disable_collateral, get_all_reserves — all unimplemented.
Impact
High — core feature gap. Users cannot: view lending APY rates, deposit collateral, borrow against collateral, repay loans, or view lending positions. The entire "borrow" side of the leverage protocol is missing.
Proposed Solution
Implement a concrete LendingAdapter for a Stellar-native lending protocol (e.g., Blend). Implement all 8 abstract methods with Soroban RPC calls. Register with LendingAdapterFactory for dynamic instantiation.
Technical Requirements
- Must implement ALL 8 abstract methods from
LendingAdapter ABC
- Must handle Stellar token decimals (7 decimal places)
- Must use async HTTP via
aiohttp (consistent with StellarClient in blockchain_call.py)
- Must register with
LendingAdapterFactory._adapters
Acceptance Criteria
Implementation Notes
Coordinate with team on which Stellar lending protocol to integrate (Blend, Aqua, or custom Soroban contract). Follow async patterns in StellarClient (quantara/web_app/contract_tools/blockchain_call.py). Methods will need to construct and submit Soroban contract invocations.
File Map
quantara/soroban/adapters/LendingAdapter.py — register concrete implementation in factory
quantara/soroban/adapters/blend_adapter.py — New: concrete Blend adapter (or similar)
quantara/soroban/adapters/__init__.py — export new adapter
quantara/web_app/contract_tools/ — wire adapter into contract tools layer
Dependencies
- Related: REPO-014 (AMM adapter needed for liquidation swaps)
- Related: REPO-039 (USDC issuer must be configured)
Testing Strategy
- Unit: Test each method with mocked Soroban RPC responses
- Integration: Test against Stellar testnet: deposit XLM, borrow USDC, verify position, repay, withdraw
- Manual: End-to-end flow through frontend: connect wallet → deposit → borrow → monitor → repay → withdraw
Security Considerations
Financial protocol — incorrect implementation could lead to fund loss. Test edge cases: insufficient collateral, liquidation scenarios, max borrow amounts, rounding errors. Use Decimal for all arithmetic. Validate all inputs before blockchain submission.
Definition of Done
Labels: feature, high-impact
Priority: High
Difficulty: Expert
Estimated Effort: 2w
Problem Statement
quantara/soroban/adapters/LendingAdapter.pydefines a comprehensive abstract interface with 8 methods for lending protocol integration, but zero concrete implementations exist. The factory's_adaptersdict is empty. The entire lending/borrowing flow is stubbed.Evidence
The abstract interface defines:
get_reserve_data,get_user_position,deposit,withdraw,borrow,repay,enable_collateral,disable_collateral,get_all_reserves— all unimplemented.Impact
High — core feature gap. Users cannot: view lending APY rates, deposit collateral, borrow against collateral, repay loans, or view lending positions. The entire "borrow" side of the leverage protocol is missing.
Proposed Solution
Implement a concrete
LendingAdapterfor a Stellar-native lending protocol (e.g., Blend). Implement all 8 abstract methods with Soroban RPC calls. Register withLendingAdapterFactoryfor dynamic instantiation.Technical Requirements
LendingAdapterABCaiohttp(consistent withStellarClientinblockchain_call.py)LendingAdapterFactory._adaptersAcceptance Criteria
LendingAdapterimplementation exists for a Stellar lending protocolLendingAdapterFactory.create("protocol_name")Implementation Notes
Coordinate with team on which Stellar lending protocol to integrate (Blend, Aqua, or custom Soroban contract). Follow async patterns in
StellarClient(quantara/web_app/contract_tools/blockchain_call.py). Methods will need to construct and submit Soroban contract invocations.File Map
quantara/soroban/adapters/LendingAdapter.py— register concrete implementation in factoryquantara/soroban/adapters/blend_adapter.py— New: concrete Blend adapter (or similar)quantara/soroban/adapters/__init__.py— export new adapterquantara/web_app/contract_tools/— wire adapter into contract tools layerDependencies
Testing Strategy
Security Considerations
Financial protocol — incorrect implementation could lead to fund loss. Test edge cases: insufficient collateral, liquidation scenarios, max borrow amounts, rounding errors. Use
Decimalfor all arithmetic. Validate all inputs before blockchain submission.Definition of Done
Labels: feature, high-impact
Priority: High
Difficulty: Expert
Estimated Effort: 2w