@bananapus/suckers-v6 0.0.55 → 0.0.57

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.55",
3
+ "version": "0.0.57",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -142,8 +142,10 @@ contract JBArbitrumSucker is JBSucker, IJBArbitrumSucker {
142
142
  /// @notice Approves the Arbitrum gateway to spend `amount` of `token`.
143
143
  /// @param token The ERC-20 token to approve.
144
144
  /// @param amount The amount to approve.
145
- function _approveGateway(address token, uint256 amount) internal {
146
- SafeERC20.forceApprove({token: IERC20(token), spender: GATEWAYROUTER.getGateway(token), value: amount});
145
+ /// @return gateway The gateway that was approved.
146
+ function _approveGateway(address token, uint256 amount) internal returns (address gateway) {
147
+ gateway = GATEWAYROUTER.getGateway(token);
148
+ SafeERC20.forceApprove({token: IERC20(token), spender: gateway, value: amount});
147
149
  }
148
150
 
149
151
  /// @notice Uses the L1/L2 gateway to send the root and assets over the bridge to the peer.
@@ -201,13 +203,15 @@ contract JBArbitrumSucker is JBSucker, IJBArbitrumSucker {
201
203
  // If the token is an ERC-20, bridge it to the peer.
202
204
  // If the amount is `0` then we do not need to bridge any ERC20.
203
205
  if (token != JBConstants.NATIVE_TOKEN && amount != 0) {
204
- _approveGateway({token: token, amount: amount});
206
+ address gateway = _approveGateway({token: token, amount: amount});
205
207
 
206
208
  // Convert bytes32 types to address at the Arbitrum bridge API boundary.
207
209
  IArbL2GatewayRouter(address(GATEWAYROUTER))
208
210
  .outboundTransfer({
209
211
  l1Token: _toAddress(remoteToken.addr), to: peerAddress, amount: amount, data: bytes("")
210
212
  });
213
+
214
+ SafeERC20.forceApprove({token: IERC20(token), spender: gateway, value: 0});
211
215
  } else {
212
216
  // Otherwise, the token is the native token, and the amount will be sent as `msg.value`.
213
217
  nativeValue = amount;
@@ -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});