From bafdcf07016dcc4bf30bd132eb8bb50e3447f5d4 Mon Sep 17 00:00:00 2001 From: Leo Arias Date: Fri, 7 Sep 2018 11:01:37 -0600 Subject: [PATCH] Remove CanReclaimToken (#1306) --- contracts/ownership/CanReclaimToken.sol | 26 ---------------- test/ownership/CanReclaimToken.test.js | 40 ------------------------- 2 files changed, 66 deletions(-) delete mode 100644 contracts/ownership/CanReclaimToken.sol delete mode 100644 test/ownership/CanReclaimToken.test.js diff --git a/contracts/ownership/CanReclaimToken.sol b/contracts/ownership/CanReclaimToken.sol deleted file mode 100644 index cdbeb547b..000000000 --- a/contracts/ownership/CanReclaimToken.sol +++ /dev/null @@ -1,26 +0,0 @@ -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); - } - -} diff --git a/test/ownership/CanReclaimToken.test.js b/test/ownership/CanReclaimToken.test.js deleted file mode 100644 index dd3fef622..000000000 --- a/test/ownership/CanReclaimToken.test.js +++ /dev/null @@ -1,40 +0,0 @@ -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 }) - ); - }); -});