4

I just bought a scam token. The liquidity pool is still there but I couldn't sell because I couldn't approve the token in Uniswap. When I try to approve, the error "execution reverted: ERC20: approve from the zero address" appears on the javascript console. There may be something shady in the approve function. However, I found that a front-running bot was able to sell the token without approval. It seems the bot just calls the swap function and transfers the tokens. The sell transaction is this. Can I do the same with Etherscan's writeContract? Or can I do that with javascript SDK? Or should I deploy a contract like the front-running bot? Any input would be greatly appreciated.

0

You could deploy your own custom router contract. Easily fork one from the original Uniswap Router. Make every write function to be onlyOwner(). Then modify the swap function so instead of sending the token back to the sender wallet. The contract itself will receive and send the token.

Thus when selling you don't need any approval, because the contract is the owner of the token itself. For actual uses, you transfer WETH from your wallet to that contract first. Then use your custom function for swapping tokens. And don't forget to create a withdrawn function so you could call that and let the contract send WETH it has back to your wallet.

This is common practice use by bot. You can completely trade using this contract instead of Uniswap one unless the token only lets a specific address(eg. original router) call transfer.

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.