Skip to content

Feat/borrowing - #86

Merged
Nabeelahh merged 6 commits into
Vaulty-X:mainfrom
nafsonig:feat/borrowing
Jul 27, 2026
Merged

Feat/borrowing#86
Nabeelahh merged 6 commits into
Vaulty-X:mainfrom
nafsonig:feat/borrowing

Conversation

@nafsonig

Copy link
Copy Markdown
Contributor

Summary of Changes

The lending contract lending/src/lib.rs had several duplicate functions that would have caused compilation errors. I removed:

  1. The second duplicate get_pool_accounting function
  2. An outdated get_interest_rate function that incorrectly tried to read from a non-existent pool
  3. An outdated borrow function that had incomplete token transfer logic
  4. An incomplete/stray repay function that was cut off mid-implementation

Current State of Key Functions

The contract now maintains only the correct, single implementations of the required functions for the borrowing lifecycle:

  • get_interest_rate - Properly iterates through all pools to find the asset's pool and returns its interest rate
  • borrow - Validates inputs, accrues interest, checks liquidity, and updates pool accounting correctly
  • repay - Processes principal and interest payments, updates accounting properly
  • get_pool_accounting - Single implementation that accrues interest before returning accounting data

These functions are now ready to support the borrowing contract's cross-contract calls for the complete collateralized borrowing lifecycle implementation.

closes #78

@Nabeelahh
Nabeelahh merged commit ae0eac7 into Vaulty-X:main Jul 27, 2026
1 check failed
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.

[Contract] Implement collateralized borrowing and liquidation

2 participants