@bananapus/suckers-v6 0.0.54 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananapus/suckers-v6",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,7 +49,8 @@ contract JBCCIPSucker is JBSucker, IAny2EVMMessageReceiver {
49
49
  /// committing the bridge message.
50
50
  /// @param recipient The address that was supposed to receive the refund.
51
51
  /// @param amount The amount of the failed refund.
52
- event TransportPaymentRefundFailed(address indexed recipient, uint256 amount);
52
+ /// @param caller The address that triggered the CCIP send.
53
+ event TransportPaymentRefundFailed(address indexed recipient, uint256 amount, address caller);
53
54
 
54
55
  //*********************************************************************//
55
56
  // ----------------------- internal constants ------------------------ //
@@ -255,7 +256,7 @@ contract JBCCIPSucker is JBSucker, IAny2EVMMessageReceiver {
255
256
  if (refundFailed) {
256
257
  // Refund accounting is isolated per caller; reentry cannot increase the retained credit.
257
258
  _retainTransportPaymentRefund({account: _msgSender(), amount: refundAmount});
258
- emit TransportPaymentRefundFailed({recipient: _msgSender(), amount: refundAmount});
259
+ emit TransportPaymentRefundFailed({recipient: _msgSender(), amount: refundAmount, caller: _msgSender()});
259
260
  }
260
261
  }
261
262
 
package/src/JBSucker.sol CHANGED
@@ -446,7 +446,9 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
446
446
  } else {
447
447
  // Emit an event when a root is rejected due to a stale (non-increasing) nonce.
448
448
  // This aids off-chain monitoring in detecting out-of-order or duplicate deliveries.
449
- emit StaleRootRejected({token: localToken, receivedNonce: root.remoteRoot.nonce, currentNonce: inbox.nonce});
449
+ emit StaleRootRejected({
450
+ token: localToken, receivedNonce: root.remoteRoot.nonce, currentNonce: inbox.nonce, caller: _msgSender()
451
+ });
450
452
  }
451
453
 
452
454
  // --- Project-wide shared state update (gated by source freshness key) ---
@@ -1590,7 +1592,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
1590
1592
  function _retainToRemoteFee(address account, uint256 amount) internal {
1591
1593
  retainedToRemoteFeeOf[account] += amount;
1592
1594
  retainedToRemoteFeeBalance += amount;
1593
- emit RetainedToRemoteFee({account: account, amount: amount});
1595
+ emit RetainedToRemoteFee({account: account, amount: amount, caller: _msgSender()});
1594
1596
  }
1595
1597
 
1596
1598
  /// @notice Retains a failed transport-payment refund as account-scoped native credit.
@@ -1599,7 +1601,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
1599
1601
  function _retainTransportPaymentRefund(address account, uint256 amount) internal {
1600
1602
  retainedTransportPaymentRefundOf[account] += amount;
1601
1603
  retainedTransportPaymentRefundBalance += amount;
1602
- emit RetainedTransportPaymentRefund({account: account, amount: amount});
1604
+ emit RetainedTransportPaymentRefund({account: account, amount: amount, caller: _msgSender()});
1603
1605
  }
1604
1606
 
1605
1607
  /// @notice Returns the peer address as an EVM address.
@@ -106,7 +106,10 @@ contract JBSwapCCIPSucker is JBCCIPSucker, IUnlockCallback, IUniswapV3SwapCallba
106
106
  /// @param nonce The nonce of the batch whose swap was retried.
107
107
  /// @param bridgeAmount The amount of bridge tokens that were swapped.
108
108
  /// @param localAmount The amount of local tokens received from the retry swap.
109
- event SwapRetried(address indexed localToken, uint64 indexed nonce, uint256 bridgeAmount, uint256 localAmount);
109
+ /// @param caller The address that retried the swap.
110
+ event SwapRetried(
111
+ address indexed localToken, uint64 indexed nonce, uint256 bridgeAmount, uint256 localAmount, address caller
112
+ );
110
113
 
111
114
  //*********************************************************************//
112
115
  // --------------- public immutable stored properties ---------------- //
@@ -510,7 +513,11 @@ contract JBSwapCCIPSucker is JBCCIPSucker, IUnlockCallback, IUniswapV3SwapCallba
510
513
 
511
514
  _retrySwapLocked = false;
512
515
  emit SwapRetried({
513
- localToken: localToken, nonce: nonce, bridgeAmount: pending.bridgeAmount, localAmount: localAmount
516
+ localToken: localToken,
517
+ nonce: nonce,
518
+ bridgeAmount: pending.bridgeAmount,
519
+ localAmount: localAmount,
520
+ caller: _msgSender()
514
521
  });
515
522
  }
516
523
 
@@ -643,7 +650,7 @@ contract JBSwapCCIPSucker is JBCCIPSucker, IUnlockCallback, IUniswapV3SwapCallba
643
650
 
644
651
  if (refundFailed) {
645
652
  _retainTransportPaymentRefund({account: _msgSender(), amount: refundAmount});
646
- emit TransportPaymentRefundFailed({recipient: _msgSender(), amount: refundAmount});
653
+ emit TransportPaymentRefundFailed({recipient: _msgSender(), amount: refundAmount, caller: _msgSender()});
647
654
  }
648
655
  }
649
656
  }
@@ -74,7 +74,8 @@ interface IJBSucker is IERC165 {
74
74
  /// @param token The terminal token address.
75
75
  /// @param receivedNonce The nonce of the rejected root.
76
76
  /// @param currentNonce The current nonce that was expected.
77
- event StaleRootRejected(address indexed token, uint64 receivedNonce, uint64 currentNonce);
77
+ /// @param caller The address that relayed the stale root.
78
+ event StaleRootRejected(address indexed token, uint64 receivedNonce, uint64 currentNonce, address caller);
78
79
 
79
80
  // View functions
80
81
 
@@ -34,12 +34,14 @@ interface IJBSuckerExtended is IJBSucker {
34
34
  /// @notice Emitted when a failed `toRemoteFee` payment is retained for later refund.
35
35
  /// @param account The account that can reclaim the retained fee.
36
36
  /// @param amount The retained fee amount.
37
- event RetainedToRemoteFee(address indexed account, uint256 amount);
37
+ /// @param caller The address that caused the fee to be retained.
38
+ event RetainedToRemoteFee(address indexed account, uint256 amount, address caller);
38
39
 
39
40
  /// @notice Emitted when a failed transport-payment refund is retained for later refund.
40
41
  /// @param account The account that can reclaim the retained refund.
41
42
  /// @param amount The retained refund amount.
42
- event RetainedTransportPaymentRefund(address indexed account, uint256 amount);
43
+ /// @param caller The address that caused the refund to be retained.
44
+ event RetainedTransportPaymentRefund(address indexed account, uint256 amount, address caller);
43
45
 
44
46
  /// @notice Emitted when an account claims retained `toRemoteFee` ETH.
45
47
  /// @param account The account whose retained fee balance was claimed.
@@ -271,6 +271,13 @@ library JBSwapPoolLib {
271
271
  amountOut = uint256(uint128(delta0));
272
272
  }
273
273
 
274
+ // Exact-input V4 swaps are encoded with a negative amount.
275
+ // forge-lint: disable-next-line(unsafe-typecast)
276
+ uint256 requestedAmount = uint256(-amountSpecified);
277
+ if (amountIn < requestedAmount) {
278
+ revert JBSwapPoolLib_PartialFill({consumed: amountIn, requested: requestedAmount});
279
+ }
280
+
274
281
  // Enforce the minimum output from the TWAP quote.
275
282
  if (amountOut < minAmountOut) {
276
283
  revert JBSwapPoolLib_SlippageExceeded({amountOut: amountOut, minAmountOut: minAmountOut});