diff --git a/contracts/Unicrow.sol b/contracts/Unicrow.sol index 9a10da1..c6f0f42 100644 --- a/contracts/Unicrow.sol +++ b/contracts/Unicrow.sol @@ -118,8 +118,8 @@ contract Unicrow is ReentrancyGuard, IUnicrow, Context { // Get current escrow id from the incremental counter uint256 escrowId = escrowIdCounter.current(); - // If the buyer was set to zero address in the input, set buyer to msg.sender - address buyer = input.buyer == address(0) ? msg.sender : input.buyer; + // Ensure a buyer address was set + address buyer = input.buyer; // Amount of the payment in ERC20 tokens uint amount = input.amount; @@ -154,7 +154,7 @@ contract Unicrow is ReentrancyGuard, IUnicrow, Context { // If the payment was made in ERC20 and not ETH, execute the transfer SafeERC20.safeTransferFrom( IERC20(input.currency), - msg.sender, + buyer, address(this), amount ); diff --git a/contracts/UnicrowTypes.sol b/contracts/UnicrowTypes.sol index ab25853..41a7f0f 100644 --- a/contracts/UnicrowTypes.sol +++ b/contracts/UnicrowTypes.sol @@ -74,7 +74,7 @@ struct Escrow { /// @dev Escrow parameters to be sent along with the deposit struct EscrowInput { - /// @dev who's the buyer, i.e. who can release the payment or whom should a refund be sent to. Normally this would be msg.sender but if Unicrow.pay() is called is called via another contract it should be set explicitly to user's EOA. If set to address(0), it defaults to msg.sender + /// @dev who's the buyer, i.e. who can release the payment or whom should a refund be sent to. It should be set explicitly to user's EOA in case Unicrow.pay() is called via another contract address buyer; /// @dev who should receive the payment