Skip to content

feat: Implement an Admin token sweep function for accidental transfers #74

@AlAfiz

Description

@AlAfiz

Description

Users frequently make the mistake of sending tokens directly to the smart contract address instead of using the proper swap function.
Because our contract doesn't have a way to access un-tracked balances, those tokens are permanently locked.
We need a sweep_tokens function that allows the Admin to rescue these accidentally transferred funds and return them to the users.
This function must explicitly calculate the difference between the pool's mathematical reserves and the actual contract balance.

Requirements

  • Create a sweep_tokens(token: Address, to: Address) function restricted to the Admin.
  • Read the mathematical reserve of the requested token from the pool state.
  • Read the actual Soroban token.balance() of the contract.
  • Allow the Admin to transfer the difference (actual_balance - reserve) to the specified recovery address.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions