Farseen0/scar-pairs huggingface dataset:
MEDIUM severity: Vulnerable function: ```\nFile: blueberry-core\contracts\spell\CurveSpell.sol\n        // 2. Borrow s. ```\nFile: blueberry-core\contracts\spell\CurveSpell.sol\n        // 2. Borrow specific amounts\n        uint256 borrowBalance = _doBorrow(\n            param.borrowToken,\n            param.borrowAmount\n        );\n\n        // 3. Add liquidity on curve\n        address borrowToken = param.borrowT

Vulnerable code:
```\nFile: blueberry-core\contracts\spell\CurveSpell.sol\n        // 2. Borrow specific amounts\n        uint256 borrowBalance = _doBorrow(\n            param.borrowToken,\n            param.borrowAmount\n        );\n\n        // 3. Add liquidity on curve\n        address borrowToken = param.borrowToken;\n        _ensureApprove(param.borrowToken, pool, borrowBalance);\n        if (tokens.length == 2) {\n            uint256[2] memory suppliedAmts;\n            for (uint256 i = 0; i < 2; i++) {\n                     //this 'if' check is the fix from the previous contest\n110:->               if (tokens[i] == borrowToken) {\n                    suppliedAmts[i] = IERC20Upgradeable(tokens[i]).balanceOf(\n                        address(this)\n                    );\n                    break;\n                }\n            }\n            ICurvePool(pool).add_liquidity(suppliedAmts, minLPMint);\n        } else if (tokens.length == 3) {\n```\n
MEDIUM severity: Vulnerable function: ```\nuint256 \_amount1 = \_balance.mul(DEFAULT\_REWARD\_BUYBACK1\_SHARE) / 1e18;. ```\nuint256 \_amount1 = \_balance.mul(DEFAULT\_REWARD\_BUYBACK1\_SHARE) / 1e18;\nuint256 \_amount2 = \_balance.mul(DEFAULT\_REWARD\_BUYBACK2\_SHARE) / 1e18;\n```\n

Vulnerable code:
```\nuint256 \_amount1 = \_balance.mul(DEFAULT\_REWARD\_BUYBACK1\_SHARE) / 1e18;\nuint256 \_amount2 = \_balance.mul(DEFAULT\_REWARD\_BUYBACK2\_SHARE) / 1e18;\n```\n
MEDIUM severity: Vulnerable function: ```\nif (memoryData.shareOwed <= memoryData.shareOut) {\n    _repay(from, from, . ```\nif (memoryData.shareOwed <= memoryData.shareOut) {\n    _repay(from, from, memoryData.partOwed);\n} else {\n    //repay as much as we can\n    uint256 partOut = totalBorrow.toBase(amountOut, false);\n    _repay(from, from, partOut);\n}\n```\n

Vulnerable code:
```\nif (memoryData.shareOwed <= memoryData.shareOut) {\n    _repay(from, from, memoryData.partOwed);\n} else {\n    //repay as much as we can\n    uint256 partOut = totalBorrow.toBase(amountOut, false);\n    _repay(from, from, partOut);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n    function _verifyCall(address logicVerifier) internal virtual returns (bool verifyAfter) {\n. ```\n    function _verifyCall(address logicVerifier) internal virtual returns (bool verifyAfter) {\n        (bool success, bytes memory returnedData) = logicVerifier.call(\n            abi.encodeWithSelector(ILSP20.lsp20VerifyCall.selector, msg.sender, msg.value, msg.data)\n    );\n    if (!success)

Vulnerable code:
```\n    function _verifyCall(address logicVerifier) internal virtual returns (bool verifyAfter) {\n        (bool success, bytes memory returnedData) = logicVerifier.call(\n            abi.encodeWithSelector(ILSP20.lsp20VerifyCall.selector, msg.sender, msg.value, msg.data)\n    );\n    if (!success) _revert(false, returnedData);\n    if (returnedData.length < 32) revert \n      LSP20InvalidMagicValue(false, returnedData);\n        bytes32 magicValue = abi.decode(returnedData, (bytes32));\n    if (bytes3(magicValue) != \n      bytes3(ILSP20.lsp20VerifyCall.selector))\n        revert LSP20InvalidMagicValue(false, returnedData);\n    return bytes1(magicValue[3]) == 0x01 ? true : false;\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nadjustmentSize * (secondPrice - firstPrice) - (adjustmentSize * tradeFees *. ```\nadjustmentSize * (secondPrice - firstPrice) - (adjustmentSize * tradeFees * 2)\n```\n

Vulnerable code:
```\nadjustmentSize * (secondPrice - firstPrice) - (adjustmentSize * tradeFees * 2)\n```\n
MEDIUM severity: Vulnerable function: ```\n            (collateralBalance, currentFees) = _calculateCollateralBalance(. ```\n            (collateralBalance, currentFees) = _calculateCollateralBalance(\n                borrowing.borrowedAmount,\n                borrowing.accLoanRatePerSeconds,\n                borrowing.dailyRateCollateralBalance,\n                accLoanRatePerSeconds\n            );\n            // 

Vulnerable code:
```\n            (collateralBalance, currentFees) = _calculateCollateralBalance(\n                borrowing.borrowedAmount,\n                borrowing.accLoanRatePerSeconds,\n                borrowing.dailyRateCollateralBalance,\n                accLoanRatePerSeconds\n            );\n            // rest of code\n            if (collateralBalance > 0) {\n                // rest of code\n            } else {\n                currentFees = borrowing.dailyRateCollateralBalance; //entire collateral amount\n            }\n            // rest of code\n            borrowing.feesOwed += _pickUpPlatformFees(borrowing.holdToken, currentFees);\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction _calculateMinRepayUnits(uint256 _collateralRebalanceUnits, uint256 _slippageTolerance,. ```\nfunction _calculateMinRepayUnits(uint256 _collateralRebalanceUnits, uint256 _slippageTolerance, ActionInfo memory _actionInfo) internal pure returns (uint256) {\n    return _collateralRebalanceUnits\n        .preciseMul(_actionInfo.collateralPrice)\n        .preciseDiv(_actionInfo.borrowPrice)\

Vulnerable code:
```\nfunction _calculateMinRepayUnits(uint256 _collateralRebalanceUnits, uint256 _slippageTolerance, ActionInfo memory _actionInfo) internal pure returns (uint256) {\n    return _collateralRebalanceUnits\n        .preciseMul(_actionInfo.collateralPrice)\n        .preciseDiv(_actionInfo.borrowPrice)\n        .preciseMul(PreciseUnitMath.preciseUnit().sub(_slippageTolerance));\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n/\*\*\n \* @notice Receives approval of token transfer and stakes the approved amount.\n \* @de. ```\n/\*\*\n \* @notice Receives approval of token transfer and stakes the approved amount.\n \* @dev Makes sure provided token contract is the same one linked to this contract.\n \* @param \_from The owner of the tokens who approved them to transfer.\n \* @param \_value Approved amount for the tran

Vulnerable code:
```\n/\*\*\n \* @notice Receives approval of token transfer and stakes the approved amount.\n \* @dev Makes sure provided token contract is the same one linked to this contract.\n \* @param \_from The owner of the tokens who approved them to transfer.\n \* @param \_value Approved amount for the transfer and stake.\n \* @param \_token Token contract address.\n \* @param \_extraData Data for stake delegation. This byte array must have the\n \* following values concatenated: Magpie address (20 bytes) where the rewards for participation\n \* are sent, operator's (20 bytes) address, authorizer (20 bytes) address.\n \*/\nfunction receiveApproval(address \_from, uint256 \_value, address \_token, bytes memory \_extraData) public {\n    require(ERC20Burnable(\_token) == token, "Token contract must be the same one linked to this contract.");\n    require(\_value <= token.balanceOf(\_from), "Sender must have enough tokens.");\n    require(\_extraData.length == 60, "Stake delegation data must be provided.");\n\n    address payable magpie = address(uint160(\_extraData.toAddress(0)));\n    address operator = \_extraData.toAddress(20);\n    require(operators[operator].owner == address(0), "Operator address is already in use.");\n    address authorizer = \_extraData.toAddress(40);\n\n    // Transfer tokens to this contract.\n    token.transferFrom(\_from, address(this), \_value);\n\n    operators[operator] = Operator(\_value, block.number, 0, \_from, magpie, authorizer);\n    ownerOperators[\_from].push(operator);\n\n    emit Staked(operator, \_value);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n        uint256 collateralval = IERC20Upgradeable(collateral[i].token).bala. ```\n        uint256 collateralval = IERC20Upgradeable(collateral[i].token).balanceOf(USSD) * 1e18 / (10**IERC20MetadataUpgradeable(collateral[i].token).decimals()) * collateral[i].oracle.getPriceUSD() / 1e18;\n        if (collateralval > amountToBuyLeftUSD) {\n          // sell a portion of collate

Vulnerable code:
```\n        uint256 collateralval = IERC20Upgradeable(collateral[i].token).balanceOf(USSD) * 1e18 / (10**IERC20MetadataUpgradeable(collateral[i].token).decimals()) * collateral[i].oracle.getPriceUSD() / 1e18;\n        if (collateralval > amountToBuyLeftUSD) {\n          // sell a portion of collateral and exit\n          if (collateral[i].pathsell.length > 0) {\n            uint256 amountBefore = IERC20Upgradeable(baseAsset).balanceOf(USSD);\n            uint256 amountToSellUnits = IERC20Upgradeable(collateral[i].token).balanceOf(USSD) * ((amountToBuyLeftUSD * 1e18 / collateralval) / 1e18) / 1e18;\n            IUSSD(USSD).UniV3SwapInput(collateral[i].pathsell, amountToSellUnits);\n            amountToBuyLeftUSD -= (IERC20Upgradeable(baseAsset).balanceOf(USSD) - amountBefore);\n            DAItosell += (IERC20Upgradeable(baseAsset).balanceOf(USSD) - amountBefore);\n          } else {\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: SFrxETHAdapter.sol\n    function claimWithdrawal() external override {\n        uint256 _. ```\nFile: SFrxETHAdapter.sol\n    function claimWithdrawal() external override {\n        uint256 _requestId = requestId;\n        uint256 _withdrawalQueueEth = withdrawalQueueEth;\n        if (_requestId == 0) revert NoPendingWithdrawal();\n\n        /// WRITE ///\n        delete withdrawalQueueEt

Vulnerable code:
```\nFile: SFrxETHAdapter.sol\n    function claimWithdrawal() external override {\n        uint256 _requestId = requestId;\n        uint256 _withdrawalQueueEth = withdrawalQueueEth;\n        if (_requestId == 0) revert NoPendingWithdrawal();\n\n        /// WRITE ///\n        delete withdrawalQueueEth;\n        delete requestId;\n        bufferEth += _withdrawalQueueEth.toUint128();\n\n        /// INTERACT ///\n        uint256 balanceBefore = address(this).balance;\n        REDEMPTION_QUEUE.burnRedemptionTicketNft(_requestId, payable(this));\n        if (address(this).balance < balanceBefore + _withdrawalQueueEth) revert InvariantViolation();\n\n        IWETH9(Constants.WETH).deposit{value: _withdrawalQueueEth}();\n    }\n```\n
HIGH severity: Vulnerable function: ```\nfunction createBid(\n  uint256 parentId,\n  uint256 bidAmount,\n  string memory bidIPFSHash,\n . ```\nfunction createBid(\n  uint256 parentId,\n  uint256 bidAmount,\n  string memory bidIPFSHash,\n  string memory name\n) public pure returns(bytes32) {\n  return keccak256(abi.encode(parentId, bidAmount, bidIPFSHash, name));\n}\n```\n

Vulnerable code:
```\nfunction createBid(\n  uint256 parentId,\n  uint256 bidAmount,\n  string memory bidIPFSHash,\n  string memory name\n) public pure returns(bytes32) {\n  return keccak256(abi.encode(parentId, bidAmount, bidIPFSHash, name));\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction emergencyResume(\n    GMXTypes.Store storage self\n  ) external {\n    GMXChecks.befor. ```\nfunction emergencyResume(\n    GMXTypes.Store storage self\n  ) external {\n    GMXChecks.beforeEmergencyResumeChecks(self);\n\n    self.status = GMXTypes.Status.Resume;\n\n    self.refundee = payable(msg.sender);\n\n    GMXTypes.AddLiquidityParams memory _alp;\n\n    _alp.tokenAAmt = self.toke

Vulnerable code:
```\nfunction emergencyResume(\n    GMXTypes.Store storage self\n  ) external {\n    GMXChecks.beforeEmergencyResumeChecks(self);\n\n    self.status = GMXTypes.Status.Resume;\n\n    self.refundee = payable(msg.sender);\n\n    GMXTypes.AddLiquidityParams memory _alp;\n\n    _alp.tokenAAmt = self.tokenA.balanceOf(address(this));\n    _alp.tokenBAmt = self.tokenB.balanceOf(address(this));\n    _alp.executionFee = msg.value;\n\n    GMXManager.addLiquidity(\n      self,\n      _alp\n    );\n  }\n```\n
MEDIUM severity: Vulnerable function: ```\n(bool isMember, uint96 locked, uint96 stakedAmount) = userManager.stakers(u. ```\n(bool isMember, uint96 locked, uint96 stakedAmount) = userManager.stakers(user);\n```\n

Vulnerable code:
```\n(bool isMember, uint96 locked, uint96 stakedAmount) = userManager.stakers(user);\n```\n
HIGH severity: Vulnerable function: ```\n  function _vestingCheck(address user, uint256 amount) internal view returns (uint256) {\n    i. ```\n  function _vestingCheck(address user, uint256 amount) internal view returns (uint256) {\n    if(teamAllocations[user] > 0) return 0; //@audit return 0 for team members\n    uint256 initialAllocation = seedAllocations[user];\n    if(initialAllocation > 0) {\n      if(block.timestamp < vestingSt

Vulnerable code:
```\n  function _vestingCheck(address user, uint256 amount) internal view returns (uint256) {\n    if(teamAllocations[user] > 0) return 0; //@audit return 0 for team members\n    uint256 initialAllocation = seedAllocations[user];\n    if(initialAllocation > 0) {\n      if(block.timestamp < vestingStart) return 0;\n      uint256 vestPortion = FixedPointMathLib.divWad(block.timestamp - vestingStart, vestingEnd - vestingStart);\n      return FixedPointMathLib.mulWad(vestPortion, initialAllocation) - (initialAllocation - stakedLocks[user]);\n    }\n    else {\n      return amount;\n    }\n  }\n```\n
HIGH severity: Vulnerable function: ```\nFile: PartyBFacetImpl.sol\n    function openPosition(\n        uint256 quoteId,\n        uint25. ```\nFile: PartyBFacetImpl.sol\n    function openPosition(\n        uint256 quoteId,\n        uint256 filledAmount,\n        uint256 openedPrice,\n        PairUpnlAndPriceSig memory upnlSig\n    ) internal returns (uint256 currentId) {\n..SNIP..\n\n        LibQuote.removeFromPendingQuotes(quote);\n\

Vulnerable code:
```\nFile: PartyBFacetImpl.sol\n    function openPosition(\n        uint256 quoteId,\n        uint256 filledAmount,\n        uint256 openedPrice,\n        PairUpnlAndPriceSig memory upnlSig\n    ) internal returns (uint256 currentId) {\n..SNIP..\n\n        LibQuote.removeFromPendingQuotes(quote);\n\n..SNIP..\n            quoteLayout.quoteIdsOf[quote.partyA].push(currentId);\n..SNIP..\n            } else {\n                accountLayout.pendingLockedBalances[quote.partyA].sub(filledLockedValues);\n                accountLayout.partyBPendingLockedBalances[quote.partyB][quote.partyA].sub(\n                    filledLockedValues\n                );\n            }\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: VaultAccountAction.sol\n    require(vaultAccount.lastUpdateBlockTime . ```\nFile: VaultAccountAction.sol\n    require(vaultAccount.lastUpdateBlockTime + Constants.VAULT_ACCOUNT_MIN_TIME <= block.timestamp)\n```\n

Vulnerable code:
```\nFile: VaultAccountAction.sol\n    require(vaultAccount.lastUpdateBlockTime + Constants.VAULT_ACCOUNT_MIN_TIME <= block.timestamp)\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: GMXVaul.sol\n  /**\n    * @notice Repays all debt owed by vault and shut down vault, allo. ```\nFile: GMXVaul.sol\n  /**\n    * @notice Repays all debt owed by vault and shut down vault, allowing emergency withdrawals\n    * @dev Note that this is a one-way irreversible action\n    * @dev Should be called by approved Owner (Timelock + MultiSig)\n    * @param deadline Timestamp of swap dea

Vulnerable code:
```\nFile: GMXVaul.sol\n  /**\n    * @notice Repays all debt owed by vault and shut down vault, allowing emergency withdrawals\n    * @dev Note that this is a one-way irreversible action\n    * @dev Should be called by approved Owner (Timelock + MultiSig)\n    * @param deadline Timestamp of swap deadline\n  */\n  function emergencyClose(uint256 deadline) external onlyOwner {\n    GMXEmergency.emergencyClose(_store, deadline);\n  }\n```\n
HIGH severity: Vulnerable function: ```\nreturn epochPoolSize\n    .add(\_bountyWasPaidInCurrentEpoch)\n    .mul(\n . ```\nreturn epochPoolSize\n    .add(\_bountyWasPaidInCurrentEpoch)\n    .mul(\n        delegationController.getAndUpdateEffectiveDelegatedToValidator(\n            nodes.getValidatorId(nodeIndex),\n            currentMonth\n        )\n    )\n    .div(effectiveDelegatedSum);\n```\n

Vulnerable code:
```\nreturn epochPoolSize\n    .add(\_bountyWasPaidInCurrentEpoch)\n    .mul(\n        delegationController.getAndUpdateEffectiveDelegatedToValidator(\n            nodes.getValidatorId(nodeIndex),\n            currentMonth\n        )\n    )\n    .div(effectiveDelegatedSum);\n```\n
HIGH severity: Vulnerable function: ```\nfunction mint(address to, uint256 amount) public onlyRole(MINTER\_ROLE) {\n \_mint(to, amount);. ```\nfunction mint(address to, uint256 amount) public onlyRole(MINTER\_ROLE) {\n \_mint(to, amount);\n}\n```\n

Vulnerable code:
```\nfunction mint(address to, uint256 amount) public onlyRole(MINTER\_ROLE) {\n \_mint(to, amount);\n}\n```\n
HIGH severity: Vulnerable function: ```\n (uint256 amount0, uint256 amount1) = LiquidityAmounts.getAmountsForLiquidi. ```\n (uint256 amount0, uint256 amount1) = LiquidityAmounts.getAmountsForLiquidity(\n                slots[i].currentSqrtRatioX96,\n                TickMath.getSqrtRatioAtTick(position.lowerTick),\n                TickMath.getSqrtRatioAtTick(position.upperTick),\n                liquidity\n         

Vulnerable code:
```\n (uint256 amount0, uint256 amount1) = LiquidityAmounts.getAmountsForLiquidity(\n                slots[i].currentSqrtRatioX96,\n                TickMath.getSqrtRatioAtTick(position.lowerTick),\n                TickMath.getSqrtRatioAtTick(position.upperTick),\n                liquidity\n            );\n```\n
HIGH severity: Vulnerable function: ```\n   modifier claimExecutionFees(address _wallet) {\n     uint256 startGas = . ```\n   modifier claimExecutionFees(address _wallet) {\n     uint256 startGas = gasleft();\n  _;\n if (feeMultiplier > 0) {\n    address feeToken = FeePayer._feeToken(_wallet);\n      uint256 gasUsed = startGas -gasleft();\n       (uint256 feeAmount, address recipient, Types.Executable memory feeTra

Vulnerable code:
```\n   modifier claimExecutionFees(address _wallet) {\n     uint256 startGas = gasleft();\n  _;\n if (feeMultiplier > 0) {\n    address feeToken = FeePayer._feeToken(_wallet);\n      uint256 gasUsed = startGas -gasleft();\n       (uint256 feeAmount, address recipient, Types.Executable memory feeTransferTxn)=FeePayer._buildFeeExecutable\n         (gasUsed, feeToken);\n emit FeeClaimed(_wallet, feeToken, feeAmount);\n   if (feeToken != ETH) {uint256 initialBalance = IERC20(feeToken).balanceOf(recipient);_\n       executeSafeERC20Transfer(_wallet, feeTransferTxn);\n             if (IERC20(feeToken).balanceOf(recipient) -initialBalance < feeAmount){\n        revert UnsuccessfulFeeTransfer(_wallet, feeToken);}\n     } else {\n    uint256 initialBalance = recipient.balance;\n  Executor._executeOnWallet(_wallet, feeTransferTxn);\n if (recipient.balance -initialBalance < feeAmount) {\n      revert UnsuccessfulFeeTransfer(_wallet, feeToken);\n                }\n            }\n        }\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction calculateRewards(address to)\n public\n virtual\n override\n whenNotPaused\n returns (. ```\nfunction calculateRewards(address to)\n public\n virtual\n override\n whenNotPaused\n returns (bool success)\n{\n require(to == \_msgSender(), "ST5");\n uint256 reward = \_calculateRewards(to);\n emit TriggeredCalculateRewards(to, reward, block.timestamp);\n return true;\n}\n```\n

Vulnerable code:
```\nfunction calculateRewards(address to)\n public\n virtual\n override\n whenNotPaused\n returns (bool success)\n{\n require(to == \_msgSender(), "ST5");\n uint256 reward = \_calculateRewards(to);\n emit TriggeredCalculateRewards(to, reward, block.timestamp);\n return true;\n}\n```\n
HIGH severity: Vulnerable function: ```\n      if ((lockEndTime - oldUserPoint.ts) > (minLockDurationForReward)) {\n. ```\n      if ((lockEndTime - oldUserPoint.ts) > (minLockDurationForReward)) {\n        toDistribute +=\n          (balanceOf * tokensPerWeek[weekCursor]) / veSupply[weekCursor];\n      weekCursor += WEEK;\n      }\n```\n

Vulnerable code:
```\n      if ((lockEndTime - oldUserPoint.ts) > (minLockDurationForReward)) {\n        toDistribute +=\n          (balanceOf * tokensPerWeek[weekCursor]) / veSupply[weekCursor];\n      weekCursor += WEEK;\n      }\n```\n
HIGH severity: Vulnerable function: ```\nfunction setPeriod(uint64 \_period) external auth(OPEN\_ROLE) {\n    \_setPeriod(\_period);\n}\. ```\nfunction setPeriod(uint64 \_period) external auth(OPEN\_ROLE) {\n    \_setPeriod(\_period);\n}\n```\n

Vulnerable code:
```\nfunction setPeriod(uint64 \_period) external auth(OPEN\_ROLE) {\n    \_setPeriod(\_period);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nyieldBox.withdraw(collateralId, address(this), address(leverageExecutor), 0. ```\nyieldBox.withdraw(collateralId, address(this), address(leverageExecutor), 0, calldata_.share);\nuint256 leverageAmount = yieldBox.toAmount(collateralId, calldata_.share, false);\n\namountOut = leverageExecutor.getAsset(\n    assetId, address(collateral), address(asset), leverageAmount, calldata

Vulnerable code:
```\nyieldBox.withdraw(collateralId, address(this), address(leverageExecutor), 0, calldata_.share);\nuint256 leverageAmount = yieldBox.toAmount(collateralId, calldata_.share, false);\n\namountOut = leverageExecutor.getAsset(\n    assetId, address(collateral), address(asset), leverageAmount, calldata_.from, calldata_.data\n);\n```\n
MEDIUM severity: Vulnerable function: ```\n    function _lzCompose(address srcChainSender_, bytes32 _guid, bytes memory oftComposeMsg_) in. ```\n    function _lzCompose(address srcChainSender_, bytes32 _guid, bytes memory oftComposeMsg_) internal {\n        // Decode OFT compose message.\n        (uint16 msgType_,,, bytes memory tapComposeMsg_, bytes memory nextMsg_) =\n            TapiocaOmnichainEngineCodec.decodeToeComposeMsg(oftComp

Vulnerable code:
```\n    function _lzCompose(address srcChainSender_, bytes32 _guid, bytes memory oftComposeMsg_) internal {\n        // Decode OFT compose message.\n        (uint16 msgType_,,, bytes memory tapComposeMsg_, bytes memory nextMsg_) =\n            TapiocaOmnichainEngineCodec.decodeToeComposeMsg(oftComposeMsg_);\n\n        // Call Permits/approvals if the msg type is a permit/approval.\n        // If the msg type is not a permit/approval, it will call the other receivers.\n        if (msgType_ == MSG_REMOTE_TRANSFER) {\n            _remoteTransferReceiver(srcChainSender_, tapComposeMsg_);\n        } else if (!_extExec(msgType_, tapComposeMsg_)) {\n            // Check if the TOE extender is set and the msg type is valid. If so, call the TOE extender to handle msg.\n            if (\n                address(tapiocaOmnichainReceiveExtender) != address(0)\n                    && tapiocaOmnichainReceiveExtender.isMsgTypeValid(msgType_)\n            ) {\n                bytes memory callData = abi.encodeWithSelector(\n                    ITapiocaOmnichainReceiveExtender.toeComposeReceiver.selector,\n                    msgType_,\n                    srcChainSender_,\n                    tapComposeMsg_\n                );\n                (bool success, bytes memory returnData) =\n                    address(tapiocaOmnichainReceiveExtender).delegatecall(callData);\n                if (!success) {\n                    revert(_getTOEExtenderRevertMsg(returnData));\n                }\n            } else {\n                // If no TOE extender is set or msg type doesn't match extender, try to call the internal receiver.\n                if (!_toeComposeReceiver(msgType_, srcChainSender_, tapComposeMsg_)) {\n                  revert InvalidMsgType(msgType_);\n                }\n            }\n        }\n```\n