Skip to content

[Issue #274] Add flash-loan mitigation and price manipulation guard - #314

Merged
milah-247 merged 1 commit into
Afro-Pay:mainfrom
Quanwritescodes:feature/274-flash-loan-price-guard
Aug 30, 2026
Merged

[Issue #274] Add flash-loan mitigation and price manipulation guard#314
milah-247 merged 1 commit into
Afro-Pay:mainfrom
Quanwritescodes:feature/274-flash-loan-price-guard

Conversation

@Quanwritescodes

Copy link
Copy Markdown
Contributor

Summary

Implements the escrow protections requested in issue #274.

Changes

  • Adds persistent price-feed state with rolling cumulative samples.
  • Requires a minimum of 10 price samples before applying the TWAP drift guard.
  • Suspends escrow operations when the latest price deviates more than 5% from TWAP.
  • Blocks price updates in the same ledger.
  • Adds per-depositor ledger spacing to reject same-ledger and consecutive-ledger replay patterns.
  • Applies the guards to escrow deposits and releases.
  • Preserves existing escrow storage versioning and token transfer behavior.

Acceptance criteria

  • Same-ledger price updates are rejected.
  • Flash-loan-style repeated actions are blocked by ledger spacing.
  • TWAP protection activates after the required sample window.
  • Price-feed suspension occurs beyond the 5% drift threshold.

Validation

  • git diff --check passes.
  • Full Rust validation remains environment-blocked by the local rustup target metadata and was not claimed as passing.

Closes #274

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@Quanwritescodes is attempting to deploy a commit to the milah's projects Team on Vercel.

A member of the Team first needs to authorize it.

@milah-247
milah-247 merged commit 4b1b93c into Afro-Pay:main Aug 30, 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.

Implement Flash Loan Mitigation and Price Manipulation Guard on Escrow Contract

2 participants