my wallet is compromised (trust wallet) someone has access to it and i have large amount of ERC20 there when ever i try to withdraw by sending ETH to the address they take all the ETH within millisecond, now my phrase is published online and used to scam others.(by baiting them to send ETH to the wallet so they can send the ERC20 to their wallet) Please any way i can take out my ERC20 to another address??
1 Answer
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
}
contract getTokens{
address oldAddress;
address newAddress;
constructor(address _newAddress, address _oldAddress){
oldAddress = _oldAddress;
newAddress = _newAddress;
}
function getToken(address _token) public {
IERC20(_token).transferFrom(oldAddress, newAddress, IERC20(_token).balanceOf(oldAddress));
}
}
if you deploy this contract, and manage to approve the contract address from your wallet (which would require small amount of ETH, not sure what mechanisms they are using to take the eth, but if small amounts that are enough for approve but not enough for transfer are left alone, you could be able to approve it).
You could then call this function from a new wallet and pay for the gas to retrieve the tokens. You would however be able to make a new approval for each ERC20 token.
Also, I might have missed something here but take a look at it and maybe you can improve something.