Skip to content

[Contracts] Bond: add liquidation entrypoint for fully-slashed/expired bonds with event #366

@Baskarayelu

Description

@Baskarayelu

Description

The contract supports slashing (slash/slash_bond) and per-identity withdrawal, but there is no explicit liquidation path that finalizes a bond whose slashed_amount == bonded_amount or whose lock-up has long expired without renewal. The bond is described as the source of truth for liquidation, yet active is only ever set false inside withdraw_bond. We need a dedicated liquidate entrypoint that marks such bonds closed, sweeps residual slashed funds to the treasury, and emits a liquidation event the keeper/indexer can act on.

Requirements and context

  • Secure: liquidate(identity) callable by admin/keeper; only valid when fully slashed or expired-and-unrenewed; transfer residual to treasury (after token integration); set active = false.
  • Idempotent: re-liquidating an already-liquidated bond reverts cleanly.
  • Tested: liquidate fully-slashed bond, expired bond, reject healthy bond, idempotency.
  • Documented: add docs/liquidation.md referencing the existing paginated liquidation scanner work.

Suggested execution

  • git checkout -b feature/bond-liquidation-entrypoint
  • Add liquidate to ours.rs with eligibility checks and event.
  • Write eligibility and idempotency tests.
  • Add docs docs/liquidation.md.
  • Add /// doc comments on eligibility rules.
  • Validate only eligible bonds can be liquidated.

Test and commit

  • Run cargo test.
  • Cover edge cases: partially slashed (reject), expired rolling vs fixed, double-liquidate.
  • Include test output and security notes.

Example commit message

feat: add bond liquidation entrypoint for fully-slashed/expired bonds

Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programenhancementFeature enhancementsmart-contractSoroban/Rust smart contract worksorobanStellar Soroban specifictestingTests and coverage

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions