Skip to content

Commit

Permalink
Remove requires for safeTransfer (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos authored Jul 28, 2020
1 parent 9f58ab7 commit b72ed06
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions contracts/common/Stakable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/fees/KyberFeeBurner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/teller-network/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/teller-network/Fees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/teller-network/License.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion test/license_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
});

Expand Down

0 comments on commit b72ed06

Please sign in to comment.