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
bafdcf07
Commit
bafdcf07
authored
Sep 07, 2018
by
Leo Arias
Committed by
Francisco Giordano
Sep 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CanReclaimToken (#1306)
parent
6cae0f45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
66 deletions
+0
-66
CanReclaimToken.sol
contracts/ownership/CanReclaimToken.sol
+0
-26
CanReclaimToken.test.js
test/ownership/CanReclaimToken.test.js
+0
-40
No files found.
contracts/ownership/CanReclaimToken.sol
deleted
100644 → 0
View file @
6cae0f45
pragma solidity ^0.4.24;
import "./Ownable.sol";
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/SafeERC20.sol";
/**
* @title Contracts that should be able to recover tokens
* @author SylTi
* @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.
* This will prevent any accidental loss of tokens.
*/
contract CanReclaimToken is Ownable {
using SafeERC20 for IERC20;
/**
* @dev Reclaim all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function reclaimToken(IERC20 token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.safeTransfer(owner(), balance);
}
}
test/ownership/CanReclaimToken.test.js
deleted
100644 → 0
View file @
6cae0f45
const
{
expectThrow
}
=
require
(
'../helpers/expectThrow'
);
const
CanReclaimToken
=
artifacts
.
require
(
'CanReclaimToken'
);
const
ERC20Mock
=
artifacts
.
require
(
'ERC20Mock'
);
const
BigNumber
=
web3
.
BigNumber
;
require
(
'chai'
)
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
contract
(
'CanReclaimToken'
,
function
([
_
,
owner
,
anyone
])
{
let
token
=
null
;
let
canReclaimToken
=
null
;
beforeEach
(
async
function
()
{
// Create contract and token
token
=
await
ERC20Mock
.
new
(
owner
,
100
,
{
from
:
owner
});
canReclaimToken
=
await
CanReclaimToken
.
new
({
from
:
owner
});
// Force token into contract
await
token
.
transfer
(
canReclaimToken
.
address
,
10
,
{
from
:
owner
});
(
await
token
.
balanceOf
(
canReclaimToken
.
address
)).
should
.
be
.
bignumber
.
equal
(
10
);
});
it
(
'should allow owner to reclaim tokens'
,
async
function
()
{
const
ownerStartBalance
=
await
token
.
balanceOf
(
owner
);
await
canReclaimToken
.
reclaimToken
(
token
.
address
,
{
from
:
owner
});
const
ownerFinalBalance
=
await
token
.
balanceOf
(
owner
);
ownerFinalBalance
.
sub
(
ownerStartBalance
).
should
.
be
.
bignumber
.
equal
(
10
);
(
await
token
.
balanceOf
(
canReclaimToken
.
address
)).
should
.
be
.
bignumber
.
equal
(
0
);
});
it
(
'should allow only owner to reclaim tokens'
,
async
function
()
{
await
expectThrow
(
canReclaimToken
.
reclaimToken
(
token
.
address
,
{
from
:
anyone
})
);
});
});
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