@bananapus/suckers-v6 0.0.56 → 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 +1 -1
- package/src/JBArbitrumSucker.sol +7 -3
package/package.json
CHANGED
package/src/JBArbitrumSucker.sol
CHANGED
|
@@ -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
|
-
|
|
146
|
-
|
|
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;
|