Skip to content

feat(contracts): implement minimum borrow amount constraint to prevent spam dust loans - #303

Merged
thisisouvik merged 1 commit into
mainfrom
feat/issue-156-min-borrow-amount
Aug 29, 2026
Merged

feat(contracts): implement minimum borrow amount constraint to prevent spam dust loans#303
thisisouvik merged 1 commit into
mainfrom
feat/issue-156-min-borrow-amount

Conversation

@thisisouvik

Copy link
Copy Markdown
Owner

Description

Implements a MIN_BORROW_AMOUNT constraint (1 XLM = 10,000,000 stroops) on the lending smart contract and loan application endpoints to prevent malicious actors from spamming dust loans and bloating the contract state.

Acceptance Criteria & Changes

  • Defined MIN_BORROW_AMOUNT constant (10,000,000 stroops / 1 XLM) in contracts/lending/src/lib.rs
  • Enforced validation in create_loan_request to reject any loan below MIN_BORROW_AMOUNT
  • Exposed get_min_borrow_amount query in LendingContract
  • Enforced minimum borrow amount validation in /api/loans/apply endpoint
  • Added contract unit tests verifying dust rejection and boundary acceptance (102/102 tests passing)
  • Added API route unit tests in __tests__/api/loans/apply.test.ts

Closes #156

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deployment failed for project trustlend-stellar with the following error:

Hobby accounts are limited to daily cron jobs. This cron expression (* * * * *) would run more than once per day. Upgrade to the Pro plan to unlock all Cron Jobs features on Vercel.

Learn More: https://vercel.link/3Fpeeb1

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: baf68976-df3f-4339-805e-df7f9136ce5a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thisisouvik
thisisouvik merged commit d900f99 into main Aug 29, 2026
9 of 14 checks 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.

[Security] Implement a minimum borrow amount constraint to prevent spam dust loans

1 participant