Remove requires for safeTransfer
This commit is contained in:
parent
9f58ab7b67
commit
b7e07eec8c
|
@ -93,7 +93,7 @@ contract Stakable is Ownable, SafeTransfer {
|
|||
(bool success, ) = s.owner.call.value(amount)("");
|
||||
require(success, "Transfer failed.");
|
||||
} else {
|
||||
require(_safeTransfer(ERC20Token(s.token), s.owner, amount), "Couldn't transfer funds");
|
||||
_safeTransfer(ERC20Token(s.token), s.owner, amount);
|
||||
}
|
||||
|
||||
emit Unstaked(_itemId, s.owner, amount);
|
||||
|
@ -117,7 +117,7 @@ contract Stakable is Ownable, SafeTransfer {
|
|||
(bool success, ) = burnAddress.call.value(amount)("");
|
||||
require(success, "Transfer failed.");
|
||||
} else {
|
||||
require(_safeTransfer(ERC20Token(s.token), burnAddress, amount), "Couldn't transfer funds");
|
||||
_safeTransfer(ERC20Token(s.token), burnAddress, amount);
|
||||
}
|
||||
|
||||
emit Slashed(
|
||||
|
@ -149,7 +149,7 @@ contract Stakable is Ownable, SafeTransfer {
|
|||
(bool success, ) = s.owner.call.value(amount)("");
|
||||
require(success, "Transfer failed.");
|
||||
} else {
|
||||
require(_safeTransfer(ERC20Token(s.token), s.owner, amount), "Couldn't transfer funds");
|
||||
_safeTransfer(ERC20Token(s.token), s.owner, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ contract KyberFeeBurner is Ownable, SafeTransfer {
|
|||
require(_amount <= t.balanceOf(address(this)), "Invalid amount");
|
||||
|
||||
if (_token == SNT) {
|
||||
require(_safeTransfer(t, burnAddress, _amount), "SNT transfer failure");
|
||||
_safeTransfer(t, burnAddress, _amount);
|
||||
emit Swap(msg.sender, SNT, SNT, _amount, _amount);
|
||||
return;
|
||||
} else {
|
||||
|
@ -175,7 +175,7 @@ contract KyberFeeBurner is Ownable, SafeTransfer {
|
|||
} else {
|
||||
ERC20Token t = ERC20Token(_token);
|
||||
uint tokenBalance = t.balanceOf(address(this));
|
||||
require(_safeTransfer(t, owner(), tokenBalance), "Token transfer error");
|
||||
_safeTransfer(t, owner(), tokenBalance);
|
||||
emit EscapeTriggered(msg.sender, _token, tokenBalance);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -452,7 +452,7 @@ contract Escrow is IEscrow, Pausable, MessageSigned, Fees, Arbitrable, Proxiable
|
|||
(bool success, ) = _trx.destination.call.value(_trx.tokenAmount)("");
|
||||
require(success, "Transfer failed.");
|
||||
} else {
|
||||
require(_safeTransfer(ERC20Token(token), _trx.destination, _trx.tokenAmount), "Couldn't transfer funds");
|
||||
_safeTransfer(ERC20Token(token), _trx.destination, _trx.tokenAmount);
|
||||
}
|
||||
|
||||
_releaseFee(_trx.arbitrator, _trx.tokenAmount, token, _isDispute);
|
||||
|
@ -537,7 +537,7 @@ contract Escrow is IEscrow, Pausable, MessageSigned, Fees, Arbitrable, Proxiable
|
|||
require(success, "Transfer failed.");
|
||||
} else {
|
||||
ERC20Token erc20token = ERC20Token(token);
|
||||
require(_safeTransfer(erc20token, trx.seller, amount), "Transfer failed");
|
||||
_safeTransfer(erc20token, trx.seller, amount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,9 +68,9 @@ contract Fees is Ownable, ReentrancyGuard, SafeTransfer {
|
|||
|
||||
if (_tokenAddress != address(0)) {
|
||||
ERC20Token tokenToPay = ERC20Token(_tokenAddress);
|
||||
require(_safeTransfer(tokenToPay, _arbitrator, arbitratorValue), "Unsuccessful token transfer - arbitrator");
|
||||
_safeTransfer(tokenToPay, _arbitrator, arbitratorValue);
|
||||
if (destinationValue > 0) {
|
||||
require(_safeTransfer(tokenToPay, feeDestination, destinationValue), "Unsuccessful token transfer - destination");
|
||||
_safeTransfer(tokenToPay, feeDestination, destinationValue);
|
||||
}
|
||||
} else {
|
||||
// EIP1884 fix
|
||||
|
@ -117,7 +117,7 @@ contract Fees is Ownable, ReentrancyGuard, SafeTransfer {
|
|||
require(msg.value == 0, "Cannot send ETH with token address different from 0");
|
||||
|
||||
ERC20Token tokenToPay = ERC20Token(_tokenAddress);
|
||||
require(_safeTransferFrom(tokenToPay, _from, address(this), feeAmount + _value), "Unsuccessful token transfer");
|
||||
_safeTransferFrom(tokenToPay, _from, address(this), feeAmount + _value);
|
||||
} else {
|
||||
require(msg.value == (_value + feeAmount), "ETH amount is required");
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ contract License is Ownable, ApproveAndCallFallBack, SafeTransfer, Proxiable {
|
|||
|
||||
emit Bought(_licenseOwner, price);
|
||||
|
||||
require(_safeTransferFrom(token, _licenseOwner, burnAddress, price), "Unsuccessful token transfer");
|
||||
_safeTransferFrom(token, _licenseOwner, burnAddress, price);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ contract("License", function () {
|
|||
await SNT.methods.approve(License.options.address, 5).send();
|
||||
await License.methods.buy().send({from: accounts[0]});
|
||||
} catch(error) {
|
||||
assert.strictEqual(error.message, "Returned error: VM Exception while processing transaction: revert Unsuccessful token transfer");
|
||||
assert.strictEqual(error.message, "Returned error: VM Exception while processing transaction: revert SafeTransfer: ERC20 operation did not succeed");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue