Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ezynda3 committed Dec 24, 2024
1 parent ac43bb2 commit 80c68b1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/Facets/GasZipFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract GasZipFacet is ILiFi, ReentrancyGuard, SwapperV2, Validatable {
error TooManyChainIds();

/// State ///
address public constant NON_EVM_RECEIVER_IDENTIFIER =
address public constant NON_EVM_ADDRESS =
0x11f111f111f111F111f111f111F111f111f111F1;
IGasZip public immutable gasZipRouter;

Expand Down Expand Up @@ -106,7 +106,7 @@ contract GasZipFacet is ILiFi, ReentrancyGuard, SwapperV2, Validatable {

// validate that receiverAddress matches with bridgeData in case of EVM target chain
if (
_bridgeData.receiver != NON_EVM_RECEIVER_IDENTIFIER &&
_bridgeData.receiver != NON_EVM_ADDRESS &&
_gasZipData.receiverAddress !=
bytes32(uint256(uint160(_bridgeData.receiver)))
) revert InvalidCallData();
Expand Down
3 changes: 1 addition & 2 deletions src/Libraries/LibAsset.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ library LibAsset {
}

if (assetId.allowance(address(this), spender) < amount) {
SafeERC20.safeApprove(IERC20(assetId), spender, 0);
SafeERC20.safeApprove(IERC20(assetId), spender, MAX_UINT);
SafeERC20.forceApprove(IERC20(assetId), spender, MAX_UINT);
}
}

Expand Down
11 changes: 1 addition & 10 deletions src/Periphery/GasZipPeriphery.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,15 @@ import { IGasZip } from "../Interfaces/IGasZip.sol";
import { LibSwap } from "../Libraries/LibSwap.sol";
import { LibAsset, IERC20 } from "../Libraries/LibAsset.sol";
import { LibUtil } from "../Libraries/LibUtil.sol";
import { ReentrancyGuard } from "../Helpers/ReentrancyGuard.sol";
import { SwapperV2 } from "../Helpers/SwapperV2.sol";
import { WithdrawablePeriphery } from "../Helpers/WithdrawablePeriphery.sol";
import { Validatable } from "../Helpers/Validatable.sol";
import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol";
import { InvalidCallData } from "../Errors/GenericErrors.sol";

/// @title GasZipPeriphery
/// @author LI.FI (https://li.fi)
/// @notice Provides functionality to swap ERC20 tokens to use the gas.zip protocol as a pre-bridge step (https://www.gas.zip/)
/// @custom:version 1.0.0
contract GasZipPeriphery is
ILiFi,
ReentrancyGuard,
SwapperV2,
Validatable,
WithdrawablePeriphery
{
contract GasZipPeriphery is ILiFi, WithdrawablePeriphery {
using SafeTransferLib for address;

/// State ///
Expand Down
3 changes: 1 addition & 2 deletions src/Periphery/ReceiverAcrossV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ contract ReceiverAcrossV3 is ILiFi, TransferrableOwnership {
address payable receiver,
uint256 amount
) private {
assetId.safeApprove(address(executor), 0);
assetId.safeApprove(address(executor), amount);
assetId.safeApproveWithRetry(address(executor), amount);
try
executor.swapAndCompleteBridgeTokens(
_transactionId,
Expand Down

0 comments on commit 80c68b1

Please sign in to comment.