Skip to content

feat(escrow): enforce non-zero amount, set InvalidAmount=202 (#95)#223

Open
Mikkelnice wants to merge 1 commit into
DelegoLabs:mainfrom
Mikkelnice:feat/issue-95-escrow-non-zero-amount
Open

feat(escrow): enforce non-zero amount, set InvalidAmount=202 (#95)#223
Mikkelnice wants to merge 1 commit into
DelegoLabs:mainfrom
Mikkelnice:feat/issue-95-escrow-non-zero-amount

Conversation

@Mikkelnice

@Mikkelnice Mikkelnice commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

Test plan

  • pnpm typecheck
  • pnpm test
  • Manual testing (describe):

Checklist

  • Follows project code conventions
  • TODOs reference issues where applicable
  • No secrets or credentials committed

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation for escrow deposits so zero and negative amounts are rejected with a clear error.
    • Valid deposits now complete successfully, create an escrow record, and mark it as funded.
  • Tests

    • Added integration coverage for invalid deposit amounts and the successful deposit flow.

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

Hey @Mikkelnice! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#113 [Gateway] Add Delegation Status Filter Validation Link to this issue
#95 [Soroban/Escrow] Enforce Non-Zero Escrow Amount Link to this issue
#90 [Soroban/Escrow] Add Read-Only Escrow Summary View Link to this issue
#101 [Soroban/Permissions] Reject Permission Grants with Expired Ledger Link to this issue

ℹ️ Learn more about linking PRs to issues

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 88f80066-0341-4a0b-886b-c55577e639ce

📥 Commits

Reviewing files that changed from the base of the PR and between c6dd0d9 and 567ebff.

📒 Files selected for processing (2)
  • contracts/escrow/src/integration_tests.rs
  • contracts/escrow/src/lib.rs

📝 Walkthrough

Walkthrough

EscrowError::InvalidAmount is renumbered to 202, and escrow integration tests now cover zero-amount, negative-amount, and successful deposit cases with balance and escrow-record checks.

Changes

Escrow deposit validation

Layer / File(s) Summary
Error code update and deposit behavior checks
contracts/escrow/src/lib.rs, contracts/escrow/src/integration_tests.rs
EscrowError::InvalidAmount is renumbered to 202, and integration tests cover zero-amount, negative-amount, and successful deposit behavior with balance and escrow-record assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • DelegoLabs/Delego#41 — Touches the same EscrowError typing and deposit-failure assertions in escrow tests.
  • DelegoLabs/Delego#81 — Also changes EscrowError::InvalidAmount numbering and related escrow validation behavior.
  • DelegoLabs/Delego#144 — Shares the escrow deposit flow and record assertions exercised by the new integration tests.

Suggested labels

size/S

Poem

A bunny counted tokens bright,
Zero and minus took a flight.
One good hop made escrow bloom,
Funded, snug, in carrot room. 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the escrow amount validation change and the InvalidAmount code update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/issue-95-escrow-non-zero-amount

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

@ScriptedBro

Copy link
Copy Markdown
Contributor

Resolve conflicts

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.

2 participants