Safety Execution

Not configurable. Enabled by default.

Safety Execution — a module that guarantees that an arbitrage transaction will not result in a loss. If after execution the user's balance becomes less than the original — the transaction will fail, and only the fee will be deducted Priority Fee.


How it works

1

Context initialization

Before starting the arbitrage, the module records the user's initial balances in the PDA account.

2

Arbitrage execution

All swaps, transfers (tips), flashloans and other instructions are executed. You can take a FlashLoan of even 5000 SOL, set a processor tip of even 1 SOL — you don't need to recalculate the minimum profit each time.

3

Context check

At the end, the balances “before” and “after” are compared. If the final balance is less than the initial one — the transaction is marked as unsuccessful.

Thus, Safety Execution protects the user from unexpected changes within DeFi protocols (for example, fees), bugs and removes the need to manually calculate the minimum profit — the system itself guarantees that the transaction will be executed only if it is actually profitable.

Last updated