Failsafe external tokens

This commit is contained in:
Jordi Baylina 2017-08-04 10:14:04 +02:00
parent 891cd7da32
commit 8e46200213
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
4 changed files with 25 additions and 8 deletions

View File

@ -530,10 +530,30 @@ contract MiniMeToken is Controlled {
} }
} }
//////////
// Safety Methods
//////////
/// @notice This method can be used by the controller to extract mistakenly
/// sent tokens to this contract.
/// @param _token The address of the token contract that you want to recover
/// set to 0 in case you want to extract ether.
function claimTokens(address _token) onlyController {
if (_token == 0x0) {
controller.transfer(this.balance);
return;
}
MiniMeToken token = MiniMeToken(_token);
uint balance = token.balanceOf(this);
token.transfer(controller, balance);
ClaimedTokens(_token, controller, balance);
}
//////////////// ////////////////
// Events // Events
//////////////// ////////////////
event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount);
event Transfer(address indexed _from, address indexed _to, uint256 _amount); event Transfer(address indexed _from, address indexed _to, uint256 _amount);
event NewCloneToken(address indexed _cloneToken, uint _snapshotBlock); event NewCloneToken(address indexed _cloneToken, uint _snapshotBlock);
event Approval( event Approval(

File diff suppressed because one or more lines are too long

3
dist/minimetoken.js vendored
View File

@ -237,9 +237,7 @@ module.exports = function () {
async.series([function (cb1) { async.series([function (cb1) {
params.abi = MiniMeTokenFactoryAbi; params.abi = MiniMeTokenFactoryAbi;
params.byteCode = MiniMeTokenFactoryByteCode; params.byteCode = MiniMeTokenFactoryByteCode;
console.log("yyyy");
_deploy(web3, params, function (err, _tokenFactory) { _deploy(web3, params, function (err, _tokenFactory) {
console.log("ERROR2: ", err);
if (err) { if (err) {
cb1(err); cb1(err);
return; return;
@ -248,7 +246,6 @@ module.exports = function () {
cb1(); cb1();
}); });
}, function (cb1) { }, function (cb1) {
console.log("zzzz");
params.abi = MiniMeTokenAbi; params.abi = MiniMeTokenAbi;
params.byteCode = MiniMeTokenByteCode; params.byteCode = MiniMeTokenByteCode;
_deploy(web3, params, cb1); _deploy(web3, params, cb1);

View File

@ -1,6 +1,6 @@
{ {
"name": "minimetoken", "name": "minimetoken",
"version": "0.1.5", "version": "0.1.6",
"description": "MiniMe contract", "description": "MiniMe contract",
"main": "dist/minimetoken.js", "main": "dist/minimetoken.js",
"directories": { "directories": {