0

Let's assume you just created 1,000 tokens at address 0x012345. You, the owner of 0x012345 sent by mistake all tokens and 1ETH to a smart contract with address 0x987654. This smart contract doesn't have a 'pay tokens' or 'send ethereum' function and it's pretty basic like that:

pragma solidity ^0.5.1;

contract simpleSmartContract{

 address public inventor;
 string public message;

 constructor() public
 {
     inventor = msg.sender;
 }

 function changeMessage(string memory message_) public returns(string memory)
 {
     message = message_;
     return message;
 }   

}

Can this contract use your tokens or Ethereum sent to it and maybe forward it to the owner? (assuming the smart contract has been already deployed and can't be modified)

1

Let’s say that reading your question I can underline that you did not described the smart contract deployed at address 0x0123 .

I can say that the ethers cannot be recovered. Full stop.

But if you are the owner of the 0x0123 AND you provided it of a forceTransfer function, I.e. a method that, if operated by the token contract owner, transfers token from any account to any other account, yes you can recover those token.

It is not so usual to have a similar function for a lot of good reasons, but in principle you can. It is something very simple, in principle something like:

function forceTransfer(address _from, address _to, uint _value) {
    require(msg.sender == owner);
    balances[_from] -= _value;
    balances[_to] += _value;
    emit Transfer(_from, _to, _value);
}

In that a case you can recover your tokens from everywhere (unfortunately even from the wallets of any of your users! 😂), from the smart contract 0x987654 as well...

On the other hand, if you DO NOT have any forceTransfer() like method, or equivalent, your token are gone for ever, like your ethers.

1

No, if the contract has not implemented functions for sending tokens or ether these will be forever locked in the contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.