Skip to content

Commit

Permalink
bring reference in line with optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Mar 6, 2024
1 parent 2a1db60 commit 8d42251
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions reference/lib/ReferenceFulfillmentApplier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ contract ReferenceFulfillmentApplier is

// Skip aggregating offer items if no consideration items are available.
if (considerationItem.amount == 0) {
// Set the offerer and recipient to null address and item type to a
// non-native item type if execution amount is zero. This will cause
// the execution item to be skipped.
execution.offerer = address(0);
execution.item.recipient = payable(0);
execution.item.itemType = ItemType.ERC20;
return execution;
}

Expand Down Expand Up @@ -141,11 +135,14 @@ contract ReferenceFulfillmentApplier is
}

// Reuse execution struct with consideration amount and recipient.
// Only set the recipient if the item amount is non-zero.
execution.item.amount = considerationItem.amount;
execution.item.recipient = considerationItem.recipient;
if (execution.item.amount != 0) {
execution.item.recipient = considerationItem.recipient;
}

// Return the final execution that will be triggered for relevant items.
return execution; // Execution(considerationItem, offerer, conduitKey);
return execution; // Execution(execution, offerer, conduitKey);
}

/**
Expand Down Expand Up @@ -380,12 +377,21 @@ contract ReferenceFulfillmentApplier is
)
);

// Return execution for aggregated items provided by the fulfiller.
execution = Execution(
receiveConsiderationItem,
msg.sender,
fulfillerConduitKey
);
if (receiveConsiderationItem.amount != 0) {
// Return execution for aggregated items provided by the fulfiller.
execution = Execution(
receiveConsiderationItem,
msg.sender,
fulfillerConduitKey
);
} else {
// Return an empty execution if the received item amount is zero.
execution = Execution(
receiveConsiderationItem,
address(0),
bytes32(0)
);
}
}

/**
Expand Down

0 comments on commit 8d42251

Please sign in to comment.