@@ -333,36 +333,39 @@ abstract contract DealsRegistry is
333333 ) external {
334334 address buyer = _msgSender ();
335335
336- bytes32 offerHash = _hashTypedDataV4 (hash (offer));
337- Supplier storage supplier = suppliers[offer.supplierId];
338-
339- // Supplier who created an offer must be registered
340- if (supplier.signer == address (0 )) {
341- revert InvalidSupplier ();
342- }
336+ /// @dev variable scoping used to avoid stack too deep errors
337+ {
338+ bytes32 offerHash = _hashTypedDataV4 (hash (offer));
339+ Supplier storage supplier = suppliers[offer.supplierId];
340+
341+ // Supplier who created an offer must be registered
342+ if (supplier.signer == address (0 )) {
343+ revert InvalidSupplier ();
344+ }
343345
344- // Checking ECDSA/AA signature is valid
345- if (! supplier.signer.isValidSignatureNow (offerHash, signs[0 ])) {
346- revert InvalidOfferSignature ();
347- }
346+ // Checking ECDSA/AA signature is valid
347+ if (! supplier.signer.isValidSignatureNow (offerHash, signs[0 ])) {
348+ revert InvalidOfferSignature ();
349+ }
348350
349- // Not-enabled suppliers are not allowed to accept deals
350- // So, we cannot allow to create such a deal
351- if (! supplier.enabled) {
352- revert DisabledSupplier ();
353- }
351+ // Not-enabled suppliers are not allowed to accept deals
352+ // So, we cannot allow to create such a deal
353+ if (! supplier.enabled) {
354+ revert DisabledSupplier ();
355+ }
354356
355- // Deal can be created only once
356- if (deals[offer.id].offer.id == offer.id) {
357- revert DealExists ();
358- }
357+ // Deal can be created only once
358+ if (deals[offer.id].offer.id == offer.id) {
359+ revert DealExists ();
360+ }
359361
360- bytes32 paymentHash = hash (paymentOptions);
362+ bytes32 paymentHash = hash (paymentOptions);
361363
362- // payment options provided with argument must be the same
363- // as signed in the offer
364- if (paymentHash != offer.paymentHash) {
365- revert InvalidPaymentOptions ();
364+ // payment options provided with argument must be the same
365+ // as signed in the offer
366+ if (paymentHash != offer.paymentHash) {
367+ revert InvalidPaymentOptions ();
368+ }
366369 }
367370
368371 uint256 price;
0 commit comments