From 5e27033a65d6bb7823102c3ddfeacf2a19374b4e Mon Sep 17 00:00:00 2001 From: Shawn Rizo Date: Sat, 4 Oct 2025 14:42:22 -0400 Subject: [PATCH 1/2] feat: Add TradeFailed Event --- src/onchain/TestArbitrage.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/onchain/TestArbitrage.sol b/src/onchain/TestArbitrage.sol index 357d517..8b3401d 100644 --- a/src/onchain/TestArbitrage.sol +++ b/src/onchain/TestArbitrage.sol @@ -180,6 +180,8 @@ contract TestArbitrage is IFlashLoanRecipient, ReentrancyGuard, Ownable, Pausabl /// @param executionTime Time taken for execution (in seconds) event TradeCompleted(uint256 indexed tradeId, uint256 profit, uint256 gasUsed, uint256 executionTime); + event TradeFailed(uint256 indexed tradeId, string reason, uint8 step, uint256 gasUsed); + /// @notice Emitted when contract configuration is updated /// @param parameter Name of the parameter changed /// @param oldValue Previous value From 26c074eea276fdf12a432c95a23f9c726f6c909c Mon Sep 17 00:00:00 2001 From: Shawn Rizo Date: Sat, 4 Oct 2025 14:42:49 -0400 Subject: [PATCH 2/2] feat: Add TradeFailed Event Natspec Comments --- src/onchain/TestArbitrage.sol | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/onchain/TestArbitrage.sol b/src/onchain/TestArbitrage.sol index 8b3401d..2afa76c 100644 --- a/src/onchain/TestArbitrage.sol +++ b/src/onchain/TestArbitrage.sol @@ -180,6 +180,11 @@ contract TestArbitrage is IFlashLoanRecipient, ReentrancyGuard, Ownable, Pausabl /// @param executionTime Time taken for execution (in seconds) event TradeCompleted(uint256 indexed tradeId, uint256 profit, uint256 gasUsed, uint256 executionTime); + /// @notice Emitted when a trade fails with detailed error information + /// @param tradeId Unique identifier for this trade + /// @param reason Error message describing the failure + /// @param step Which step of the process failed (1=first swap, 2=second swap, 3=repayment) + /// @param gasUsed Gas consumed before failure event TradeFailed(uint256 indexed tradeId, string reason, uint8 step, uint256 gasUsed); /// @notice Emitted when contract configuration is updated