Skip to content

Implement transaction simulation in VaultModule.withdraw #15

Description

@Code-Paragon

Problem

Similar to the deposit method, the withdraw method constructs and submits a transaction immediately without utilizing Soroban's simulation endpoint first to check for execution failures.

Expected behavior

The withdraw method simulates the transaction. If it fails (e.g., due to an insufficient ysToken balance), it throws a descriptive error protecting the user from paying a failed gas fee.

Files to update

  • src/modules/vault.ts

Project relevance

Ensures capital efficiency for Keepers and LPs by providing immediate, off-chain feedback before on-chain submission occurs.

Acceptance criteria

  • Feature works as described
  • Tests are added or updated where needed
  • Documentation is updated where needed
  • An explicit check for simulation failure is present before buildAndSubmit is invoked
  • No TypeScript, lint, test, or build errors

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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