Skip to content

Commit 0ef8ecc

Browse files
authored
Token Transaction Mutex Removed
1 parent 73ede6f commit 0ef8ecc

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

contracts/standard/arbitration/MultipleArbitrableTokenTransactionWithFee.sol

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,10 @@ contract MultipleArbitrableTokenTransactionWithFee is IArbitrable {
193193

194194
transaction.amount -= _amount;
195195
uint feeAmount = calculateFeeRecipientAmount(_amount);
196-
197-
uint tokenBalance = transaction.token.balanceOf(address(this)); // A token transaction mutex.
196+
197+
// Tokens should not reenter or allow recipients to refuse the transfer.
198198
transaction.token.transfer(feeRecipient, feeAmount); // It is the responsibility of the feeRecipient to accept Token.
199199
require(transaction.token.transfer(transaction.receiver, _amount - feeAmount), "The `transfer` function must not fail.");
200-
require(transaction.token.balanceOf(address(this)) >= tokenBalance - _amount, "Tried to transfer tokens more than allowed.");
201200

202201
emit Payment(_transactionID, _amount - feeAmount, msg.sender);
203202
emit FeeRecipientPaymentInToken(_transactionID, feeAmount, transaction.token);
@@ -231,10 +230,8 @@ contract MultipleArbitrableTokenTransactionWithFee is IArbitrable {
231230
transaction.status = Status.Resolved;
232231
uint feeAmount = calculateFeeRecipientAmount(amount);
233232

234-
uint tokenBalance = transaction.token.balanceOf(address(this));
235233
transaction.token.transfer(feeRecipient, feeAmount);
236234
require(transaction.token.transfer(transaction.receiver, amount - feeAmount), "The `transfer` function must not fail.");
237-
require(transaction.token.balanceOf(address(this)) >= tokenBalance - amount, "Tried to transfer tokens more than allowed.");
238235

239236
emit Payment(_transactionID, amount - feeAmount, transaction.sender);
240237
emit FeeRecipientPaymentInToken(_transactionID, feeAmount, transaction.token);
@@ -409,7 +406,6 @@ contract MultipleArbitrableTokenTransactionWithFee is IArbitrable {
409406

410407
uint feeAmount;
411408

412-
uint tokenBalance = transaction.token.balanceOf(address(this));
413409
// Give the arbitration fee back.
414410
// Note that we use `send` to prevent a party from blocking the execution.
415411
if (_ruling == uint(RulingOptions.SenderWins)) {
@@ -438,8 +434,6 @@ contract MultipleArbitrableTokenTransactionWithFee is IArbitrable {
438434

439435
emit FeeRecipientPaymentInToken(_transactionID, feeAmount, transaction.token);
440436
}
441-
// If there is uneven token amount, the current token Balance can be greater than tokenBalance - amount, thus >= instead of ==.
442-
require(transaction.token.balanceOf(address(this)) >= tokenBalance - amount, "Tried to transfer tokens more than allowed.");
443437
}
444438

445439
// **************************** //

0 commit comments

Comments
 (0)