Skip to content
Allows the contract owner to recover any ERC20 token sent into the contract for error
JavaScript Shell Solidity
Branch: master
Clone or download
Latest commit 2bf335a Oct 17, 2019

README.md

ETH Token Recover

NPM Package Build Status Coverage Status MIT licensed

TokenRecover allows the contract owner to recover any ERC20 token sent into the contract for error.

Motivation

There are lots of tokens lost forever into Smart Contracts (see OMG token balances).
Each Ethereum contract is a potential token trap for ERC20 tokens. They can't be recovered so it means money losses for end users.

Install

npm install eth-token-recover

Usage

pragma solidity ^0.5.12;

import "eth-token-recover/contracts/TokenRecover.sol";

contract MyContract is TokenRecover {
  // your stuff
}

Code

This repo contains:

Contract has a recoverERC20 function that transfers a tokenAmount amount of tokenAddress token to the contract owner.

function recoverERC20(address tokenAddress, uint256 tokenAmount) public onlyOwner;

Note: only owner can call the recoverERC20 function so be careful when use on contracts generated from other contracts.

Development

Install dependencies

npm install

Linter

Use Solhint

npm run lint:sol

Use ESLint

npm run lint:js

Use Eslint and fix

npm run lint:fix

Usage (using Truffle)

Open the Truffle console

npm run console

Compile

npm run compile

Test

npm run test 

Usage (using Buidler)

Open the Buidler console

npm run buidler:console

Compile

npm run buidler:compile

Test

npm run buidler:test 

License

Code released under the MIT License.

You can’t perform that action at this time.