Skip to content

Issue 318 flash loan repayment validation#367

Open
auracule007 wants to merge 5 commits into
SoroLabs:mainfrom
auracule007:issue-318-flash-loan-repayment-validation
Open

Issue 318 flash loan repayment validation#367
auracule007 wants to merge 5 commits into
SoroLabs:mainfrom
auracule007:issue-318-flash-loan-repayment-validation

Conversation

@auracule007
Copy link
Copy Markdown
Contributor

Summary #318

Implements flash loan repayment validation for the flash_loan_vault contract.

The vault now explicitly checks that, after the receiver callback completes, its token balance is at least the original pre-loan balance plus the required flash loan fee. If the callback fails to repay the borrowed principal plus fee, the contract returns Error::LoanNotRepaid.

Changes

  • Added an explicit required_balance = pre_balance + fee repayment check
  • Return Error::LoanNotRepaid when repayment is insufficient
  • Clarified contract docs around repayment expectations
  • Added test coverage for:
    • Receiver that does not repay the loan
    • Receiver that repays principal only but omits the required fee
  • Verified failed repayment does not leave the vault drained or inflate deposited totals

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked --all-targets --all-features -- -D warnings
  • cargo test --locked

Notes

The full test run generated unrelated snapshot updates as a side effect; those were reverted. The PR only modifies the flash loan vault contract and tests.

Closes #318

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@auracule007 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@auracule007
Copy link
Copy Markdown
Contributor Author

@EDOHWARES Please review this PR and check workflow

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.

Contracts: Implement flash loan repayment validation

1 participant