Interacting directly with an ERC20 token's contract for trading

I’m currently a complete beginner on Solidity with some experience on other coding languages and I’ve been checking out the tutorials on writing/deploying contracts.

I have a Uniswap-only ERC20 token and it’s not possible to sell via Uniswap because of its sell tax. Thus, I wanted to create a contract which would allow me to interact with that token’s contract directly so that I can sell that token to its contract and receive Eth in return.

Since I’m extremely new to this and there are real funds at stake, I wanted to ask for a specific guidance although there are some presets and tutorials available here.

So I apologize in advance if this had been asked here before or if it is actually easier/harder than I think it is, I would really appreciate a step-by-step roadmap; ultimately for writing a contract that would allow me to interact directly with an ERC20 token’s contract and sell that token back to its contract.

Thank you very much!

1 Like

Hi @tiger,

Welcome to the community :wave:.

I am not sure what you mean by a Uniswap-only token?

Do you want to create a Crowdsale? See https://docs.openzeppelin.com/contracts/2.x/crowdsales and Simple ERC20 Crowdsale

I recommend reading Points to consider when creating a fungible token (ERC20, ERC777). You didn’t cover what the purpose of your token was.

1 Like

Hello @abcoathup,

Actually I’m not trying to create a token. What I mean by saying a Uniswap-only token is that that token only has a liquidity pool in Uniswap. I am currently holding an ERC20 token in my eth wallet which is only tradable in Uniswap; meaning that I can’t trade it in any other DEX because there no any other liquidity pools for it.

The devs of that token put a sell-tax on the token to prevent sells (50% tax), thus I cannot sell the token via Uniswap even if I set the slippage to 49.99. I can send you the Uniswap link of the token from private but I don’t know if it’s allowed to do that here.

So what I basically want to do is; to write a contract which would allow my eth wallet to interact directly with that token’s contract address to sell that token back to its contract directly so that I can sell without using Uniswap.

It would be a really simple code as fas as I’m concerned since the only thing I want to do is to interact with its contract and sell its token back to it; in return of eth.

I hope I explained it clearly,
Thanks for your reply

1 Like

Hi @tiger,

Feel free to share the Solidity source code (e.g. a link to the source code on Etherscan or GitHub).

I am still not sure how you can transfer the token without a fee on transfer if that is what the developers have setup. Though someone in the community may be able to advise.

Hello @abcoathup,

I think I failed to define clearly what I was trying to do, nevertheless I solved it and made the transaction.

So I was basically trying to swap certain amount of an ERC20 token in return of ETH, via Uniswap. The devs implemented a selling fee which made the trade via Uniswap impossible with max. slippage. Thus, I wanted to find a way to interact with its contract address directly (bypassing Uniswap’s interface) in order to make the swap.

Here’s how I solved it:

From Etherscan, I made the transaction without using Uniswap’s interface. So there was no need for deploying a new smart contract for it.

Thank you.

1 Like

Hi @tiger,

I’m glad you were able to resolve. Thanks for sharing.

1 Like

I also have a token which is tradable only in uniswap. But can’t swap it to eth in uniswap. How can we do this via etherscan? Can you please guide or any link explains this will be helpful.

2 Likes

Hello @tiger ,

I have a similar problem with a broken smart contract…and i wanted to help me try the same …so if it’s possible can you break down a bit more how you can trade your erc20 tokens back to eth via etherscan??

Thans in advance!

3 Likes

Hello guys,

So I’m seeing that it is a common problem that a lot of people are struggling with.

The solution is actually something I have personally discovered with trial-error rather than something I’ve seen on the internet and the solution itself varies from contract to contract.

The contract of the token on Etherscan should tell us whether if there is a way to do it straight from the etherscan. Since there are real funds at stake, it would not be wise for me to hand out a single solution; as a single miscalculation or a wrong assumption can cause complete loss of funds. It must be dealt by case-by-case scenario, thus I cannot give a universal solution as I do not intend on assisting anyone into doing something wrong.

Although I would be more than happy to help and give you specific instructions one by one on how to make the transaction via Etherscan -given that the contract of the token you’re trying to swap allows it-.

You can personally contact me as well, if it makes a difference. I will try to reply in my free time other than my research.

Thanks, stay safe!

4 Likes

how can I get in contact

1 Like

Hi @vizboy,

Welcome to the community :wave:

If you are trying to contact someone you can try messaging them on the forum.

Hi, I am interested in learning about how to do swaps via Etherscan as a workaround to Uniswap.

Please let me know, thanks.

1 Like

As a matter of fact, call function on the etherscan is a little difficult, cause you have got to set parameter by your self, if possible, I would recommend you to operate what you want to do on the website.

1 Like

Hey, would you possibly be able to help me with a very similar situation to what you had. Im trying to swap my "scam" tokens back to eth. May not be possibly, i was just hoping to get someone who knows what they are looking at to check out the contract.

0xaf37d3c026bc6f58d37adf06b66d6e0d3192021b

Any help would be very much appreciated and thank you