From a0b8dcd15f708b3539f3dd5cfd65c439d385f6f6 Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Thu, 7 Sep 2017 20:04:48 -0300 Subject: [PATCH] use SafeERC20#safeTransfer --- contracts/ownership/CanReclaimToken.sol | 6 ++++-- contracts/token/TokenTimelock.sol | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/contracts/ownership/CanReclaimToken.sol b/contracts/ownership/CanReclaimToken.sol index 4921b7c4945..2d03fab3099 100644 --- a/contracts/ownership/CanReclaimToken.sol +++ b/contracts/ownership/CanReclaimToken.sol @@ -2,6 +2,7 @@ pragma solidity ^0.4.11; import "./Ownable.sol"; import "../token/ERC20Basic.sol"; +import "../token/SafeERC20.sol"; /** * @title Contracts that should be able to recover tokens @@ -10,6 +11,7 @@ import "../token/ERC20Basic.sol"; * This will prevent any accidental loss of tokens. */ contract CanReclaimToken is Ownable { + using SafeERC20 for ERC20Basic; /** * @dev Reclaim all ERC20Basic compatible tokens @@ -17,7 +19,7 @@ contract CanReclaimToken is Ownable { */ function reclaimToken(ERC20Basic token) external onlyOwner { uint256 balance = token.balanceOf(this); - token.transfer(owner, balance); + token.safeTransfer(owner, balance); } -} \ No newline at end of file +} diff --git a/contracts/token/TokenTimelock.sol b/contracts/token/TokenTimelock.sol index 8250083d472..86dc3b260b2 100644 --- a/contracts/token/TokenTimelock.sol +++ b/contracts/token/TokenTimelock.sol @@ -2,6 +2,7 @@ pragma solidity ^0.4.11; import './ERC20Basic.sol'; +import "../token/SafeERC20.sol"; /** * @title TokenTimelock @@ -9,6 +10,7 @@ import './ERC20Basic.sol'; * beneficiary to extract the tokens after a given release time */ contract TokenTimelock { + using SafeERC20 for ERC20Basic; // ERC20 basic token contract being held ERC20Basic token; @@ -44,6 +46,6 @@ contract TokenTimelock { uint256 amount = token.balanceOf(this); require(amount > 0); - token.transfer(beneficiary, amount); + token.safeTransfer(beneficiary, amount); } }