From 88bc15450e8827837b80d4eb6fbdbec6943633b4 Mon Sep 17 00:00:00 2001 From: wojciech-turek Date: Fri, 6 Sep 2024 16:07:58 +0200 Subject: [PATCH] Do not call same functons twice --- packages/marketplace/contracts/TransferManager.sol | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/marketplace/contracts/TransferManager.sol b/packages/marketplace/contracts/TransferManager.sol index 8b99253033..81bd4d54de 100644 --- a/packages/marketplace/contracts/TransferManager.sol +++ b/packages/marketplace/contracts/TransferManager.sol @@ -145,14 +145,17 @@ abstract contract TransferManager is Initializable, ITransferManager { DealSide memory paymentSide, DealSide memory nftSide ) internal pure returns (address paymentSideRecipient, address nftSideRecipient) { - if (LibAsset.decodeRecipient(paymentSide.asset.assetType) != address(0)) { - paymentSideRecipient = LibAsset.decodeRecipient(paymentSide.asset.assetType); + address decodedPaymentSideRecipient = LibAsset.decodeRecipient(paymentSide.asset.assetType); + address decodedNftSideRecipient = LibAsset.decodeRecipient(nftSide.asset.assetType); + + if (decodedPaymentSideRecipient != address(0)) { + paymentSideRecipient = decodedPaymentSideRecipient; } else { paymentSideRecipient = paymentSide.account; } - if (LibAsset.decodeRecipient(nftSide.asset.assetType) != address(0)) { - nftSideRecipient = LibAsset.decodeRecipient(nftSide.asset.assetType); + if (decodedNftSideRecipient != address(0)) { + nftSideRecipient = decodedNftSideRecipient; } else { nftSideRecipient = nftSide.account; }