Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
07b688a0
Commit
07b688a0
authored
Sep 07, 2017
by
Francisco Giordano
Committed by
GitHub
Sep 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #430 from frangio/fix-unchecked-transfer
Use SafeERC20 to transfer tokens safely
parents
84be318c
20187f29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
CanReclaimToken.sol
contracts/ownership/CanReclaimToken.sol
+4
-3
TokenTimelock.sol
contracts/token/TokenTimelock.sol
+3
-1
No files found.
contracts/ownership/CanReclaimToken.sol
View file @
07b688a0
...
@@ -2,6 +2,7 @@ pragma solidity ^0.4.11;
...
@@ -2,6 +2,7 @@ pragma solidity ^0.4.11;
import "./Ownable.sol";
import "./Ownable.sol";
import "../token/ERC20Basic.sol";
import "../token/ERC20Basic.sol";
import "../token/SafeERC20.sol";
/**
/**
* @title Contracts that should be able to recover tokens
* @title Contracts that should be able to recover tokens
...
@@ -10,6 +11,7 @@ import "../token/ERC20Basic.sol";
...
@@ -10,6 +11,7 @@ import "../token/ERC20Basic.sol";
* This will prevent any accidental loss of tokens.
* This will prevent any accidental loss of tokens.
*/
*/
contract CanReclaimToken is Ownable {
contract CanReclaimToken is Ownable {
using SafeERC20 for ERC20Basic;
/**
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @dev Reclaim all ERC20Basic compatible tokens
...
@@ -17,7 +19,7 @@ contract CanReclaimToken is Ownable {
...
@@ -17,7 +19,7 @@ contract CanReclaimToken is Ownable {
*/
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
uint256 balance = token.balanceOf(this);
token.
t
ransfer(owner, balance);
token.
safeT
ransfer(owner, balance);
}
}
}
}
\ No newline at end of file
contracts/token/TokenTimelock.sol
View file @
07b688a0
...
@@ -2,6 +2,7 @@ pragma solidity ^0.4.11;
...
@@ -2,6 +2,7 @@ pragma solidity ^0.4.11;
import './ERC20Basic.sol';
import './ERC20Basic.sol';
import "../token/SafeERC20.sol";
/**
/**
* @title TokenTimelock
* @title TokenTimelock
...
@@ -9,6 +10,7 @@ import './ERC20Basic.sol';
...
@@ -9,6 +10,7 @@ import './ERC20Basic.sol';
* beneficiary to extract the tokens after a given release time
* beneficiary to extract the tokens after a given release time
*/
*/
contract TokenTimelock {
contract TokenTimelock {
using SafeERC20 for ERC20Basic;
// ERC20 basic token contract being held
// ERC20 basic token contract being held
ERC20Basic token;
ERC20Basic token;
...
@@ -44,6 +46,6 @@ contract TokenTimelock {
...
@@ -44,6 +46,6 @@ contract TokenTimelock {
uint256 amount = token.balanceOf(this);
uint256 amount = token.balanceOf(this);
require(amount > 0);
require(amount > 0);
token.
t
ransfer(beneficiary, amount);
token.
safeT
ransfer(beneficiary, amount);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment