@@ -191,15 +191,19 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
191
191
if (transaction.status != Status.NoDispute) revert TransactionDisputed ();
192
192
if (_amount > transaction.amount) revert MaximumPaymentAmountExceeded ();
193
193
194
+ emit Payment (_transactionID, _amount, msg .sender );
195
+
194
196
transaction.amount -= _amount;
197
+ if (transaction.amount == 0 ) {
198
+ transaction.status = Status.TransactionResolved;
199
+ emit TransactionResolved (_transactionID, Resolution.TransactionExecuted);
200
+ }
195
201
196
202
if (transaction.token == NATIVE) {
197
203
transaction.seller.send (_amount); // It is the user responsibility to accept ETH.
198
204
} else {
199
205
if (! transaction.token.safeTransfer (transaction.seller, _amount)) revert TokenTransferFailed ();
200
206
}
201
-
202
- emit Payment (_transactionID, _amount, msg .sender );
203
207
}
204
208
205
209
/// @inheritdoc IEscrow
@@ -209,15 +213,19 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
209
213
if (transaction.status != Status.NoDispute) revert TransactionDisputed ();
210
214
if (_amountReimbursed > transaction.amount) revert MaximumPaymentAmountExceeded ();
211
215
216
+ emit Payment (_transactionID, _amountReimbursed, msg .sender );
217
+
212
218
transaction.amount -= _amountReimbursed;
219
+ if (transaction.amount == 0 ) {
220
+ transaction.status = Status.TransactionResolved;
221
+ emit TransactionResolved (_transactionID, Resolution.TransactionExecuted);
222
+ }
213
223
214
224
if (transaction.token == NATIVE) {
215
225
transaction.buyer.send (_amountReimbursed); // It is the user responsibility to accept ETH.
216
226
} else {
217
227
if (! transaction.token.safeTransfer (transaction.buyer, _amountReimbursed)) revert TokenTransferFailed ();
218
228
}
219
-
220
- emit Payment (_transactionID, _amountReimbursed, msg .sender );
221
229
}
222
230
223
231
/// @inheritdoc IEscrow
@@ -228,15 +236,15 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
228
236
229
237
uint256 amount = transaction.amount;
230
238
transaction.amount = 0 ;
239
+ transaction.status = Status.TransactionResolved;
231
240
232
241
if (transaction.token == NATIVE) {
233
242
transaction.seller.send (amount); // It is the user responsibility to accept ETH.
234
243
} else {
235
244
if (! transaction.token.safeTransfer (transaction.seller, amount)) revert TokenTransferFailed ();
236
245
}
237
246
238
- transaction.status = Status.TransactionResolved;
239
-
247
+ emit Payment (_transactionID, amount, msg .sender );
240
248
emit TransactionResolved (_transactionID, Resolution.TransactionExecuted);
241
249
}
242
250
0 commit comments