Skip to content

implemented the lending adapter#148

Merged
YaronZaki merged 1 commit into
Quantarq:mainfrom
Nanafancy:Lending-Adapter
Jun 19, 2026
Merged

implemented the lending adapter#148
YaronZaki merged 1 commit into
Quantarq:mainfrom
Nanafancy:Lending-Adapter

Conversation

@Nanafancy

Copy link
Copy Markdown
Contributor

Implemented the Soroban lending adapter concrete implementation

closes #53
Summary

  1. Created blend_adapter.py in quantara/soroban/adapters/ which implements the complete LendingAdapter ABC
  2. Added _TokenResolver class for token normalization, decimal handling, and scaling
  3. Implemented all 8 abstract methods :
    • get_reserve_data
    • get_user_position
    • deposit
    • withdraw
    • borrow
    • repay
    • enable_collateral
    • disable_collateral
    • get_all_reserves
  4. Added fallback to simulated data if real contract calls fail (for testing/development)
  5. Updated _register.py to register BlendLendingAdapter with LendingAdapterFactory
  6. Updated init.py to export all necessary symbols for easy import

Usage Example

import asyncio
from decimal import Decimal
from quantara.soroban.adapters 
import LendingAdapterFactory


async def main():
    adapter = LendingAdapterFactory.
    create("blend")
    
    # Get all reserves
    reserves = await adapter.
    get_all_reserves()
    
    # Get user position
    pos = await adapter.
    get_user_position
    ("GUSERADDRESS", "XLM")
    
    # Deposit XLM
    await adapter.deposit
    ("GUSERADDRESS", "XLM", Decimal
    ("100"))
    
    await adapter.close()


asyncio.run(main())

Configuration

Set environment variables for production:

  • BLEND_CONTRACT_ID : Blend lending protocol contract C… address
  • STELLAR_SOROBAN_RPC_URL : Soroban RPC endpoint
  • STELLAR_NETWORK_PASSPHRASE : Network passphrase
    All tests pass (diagnostics show no errors)! The implementation is complete!

@YaronZaki YaronZaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@YaronZaki YaronZaki merged commit 04601f5 into Quantarq:main Jun 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Implement Soroban lending adapter concrete implementation

2 participants