Skip to content

Issue 183: security: Create a Whitelist registry specifically for Flash Loan borrowers #110

@AlAfiz

Description

@AlAfiz

Description

While flash loans are powerful, allowing completely unknown, anonymous smart contracts to borrow millions of dollars of our liquidity introduces massive surface area for zero-day exploits.
Until TradeFlow is battle-tested, we should restrict flash loan borrowing strictly to verified arbitrage bots and trusted partner protocols.
We need to add a whitelist mapping that the Admin can update, ensuring only approved contract IDs can successfully call the flash_loan function.
This significantly reduces our risk profile for the Wave 3 Mainnet Beta.

Requirements

  • Add an approved_flash_borrowers: Map<Address, bool> to the contract's instance storage.
  • Create an Admin-only set_flash_borrower_status(borrower_address, is_approved) function.
  • At the top of the flash_loan execution flow, check if the caller's address is mapped to true.
  • If the caller is not on the whitelist, panic immediately with Error::UnauthorizedBorrower.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions