@@ -64,6 +64,9 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
6464
6565 address public BLS_AGGREGATOR; // Trusted Aggregator for DVT Slash
6666
67+ // State Variables (Restored)
68+ uint256 public totalTrackedBalance;
69+ uint256 public protocolRevenue;
6770
6871 // V3.1: Credit & Reputation Events
6972 event UserReputationAccrued (address indexed user , uint256 aPNTsValue );
@@ -145,13 +148,15 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
145148 * @notice Set the APNTS Price in USD (Owner Only)
146149 */
147150 function setAPNTSPrice (uint256 newPrice ) external onlyOwner {
151+ if (newPrice == 0 ) revert InvalidConfiguration ();
148152 aPNTsPriceUSD = newPrice;
149153 }
150154
151155 /**
152156 * @notice Set the protocol fee basis points (Owner Only)
153157 */
154158 function setProtocolFee (uint256 newFeeBPS ) external onlyOwner {
159+ if (newFeeBPS > BPS_DENOMINATOR) revert InvalidConfiguration ();
155160 protocolFeeBPS = newFeeBPS;
156161 }
157162
@@ -169,6 +174,11 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
169174 */
170175 function setOperatorPaused (address operator , bool paused ) external onlyOwner {
171176 operators[operator].isPaused = paused;
177+ if (paused) {
178+ emit OperatorPaused (operator);
179+ } else {
180+ emit OperatorUnpaused (operator);
181+ }
172182 }
173183
174184 /**
@@ -187,9 +197,16 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
187197 IERC20 (APNTS_TOKEN).safeTransferFrom (msg .sender , address (this ), amount);
188198 operators[msg .sender ].aPNTsBalance += amount;
189199
200+ // Fix: Update tracked balance to prevent double counting in notifyDeposit
201+ totalTrackedBalance += amount;
202+
190203 emit OperatorDeposited (msg .sender , amount);
191204 }
192205
206+ // ====================================
207+ // Push Deposit & Views (Restored)
208+ // ====================================
209+
193210 /**
194211 * @notice Handle ERC1363 transferAndCall (Push Mode)
195212 * @dev Safe deposit mechanism for tokens blocking transferFrom
@@ -211,13 +228,6 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
211228 return this .onTransferReceived.selector ;
212229 }
213230
214-
215-
216- // Track total balance for notifyDeposit pattern
217- uint256 public totalTrackedBalance;
218- // Track total accumulated protocol revenue (burnt aPNTs from operators)
219- uint256 public protocolRevenue;
220-
221231 /**
222232 * @notice Notify contract of a direct transfer (Ad-hoc Push Mode)
223233 * @dev Fallback for tokens that don't support ERC1363.
@@ -240,7 +250,7 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
240250
241251 emit OperatorDeposited (msg .sender , amount);
242252 }
243-
253+
244254
245255
246256
@@ -252,6 +262,8 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
252262 revert InsufficientBalance ();
253263 }
254264 operators[msg .sender ].aPNTsBalance -= amount;
265+ // Fix: Reduce tracked balance to prevent underflow in notifyDeposit
266+ totalTrackedBalance -= amount;
255267
256268 IERC20 (APNTS_TOKEN).safeTransfer (msg .sender , amount);
257269
@@ -268,6 +280,8 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
268280 if (amount > protocolRevenue) revert InsufficientRevenue ();
269281
270282 protocolRevenue -= amount;
283+ // Fix: Reduce tracked balance
284+ totalTrackedBalance -= amount;
271285 IERC20 (APNTS_TOKEN).safeTransfer (to, amount);
272286
273287 // Note: No event needed for internal transfers? Or reuse Withdrawn?
@@ -318,12 +332,17 @@ contract SuperPaymasterV3 is BasePaymaster, ReentrancyGuard, ISuperPaymasterV3 {
318332 config.reputation = 0 ;
319333 }
320334
321- // Apply Financial Penalty (Burn aPNTs)
335+ // Apply Financial Penalty (Burn aPNTs to Protocol Revenue )
322336 if (penaltyAmount > 0 ) {
323337 if (config.aPNTsBalance >= penaltyAmount) {
324338 config.aPNTsBalance -= penaltyAmount;
339+ // Fix: Move slashed funds to Protocol Revenue
340+ protocolRevenue += penaltyAmount;
325341 } else {
342+ // Slash all remaining
343+ uint256 actualBurn = config.aPNTsBalance;
326344 config.aPNTsBalance = 0 ;
345+ protocolRevenue += actualBurn;
327346 }
328347 }
329348
0 commit comments