[Ethereum] How to Convert ERC-20 tokens back to Ether[eum]

erc-20

From my understanding, Ether is converted to an ERC-20 token (like BAT), via a smart contract. Ether is assigned to that contract by sending Ether to the smart contract's address. Please correct me if I'm wrong in any of that.

My question though is, how does one convert an ERC-20 token (like BAT) back to Ether? If the smart contract holds the relationship between Ether that I sent to it, how do I convert the ERC-20 token back to Ether if I no longer want it? Instead, I'd just like Ether to use for other purposes.

Thank you for helping me understand this.

Best Answer

I think you have got it a bit wrong.

You are not converting ERC20 Tokens into ether or vice versa. You are mere exchanging it for ether.

Smart Contract works like this:

The amount of ether you sent in, returns the pre-specified amount of ERC20 tokens. This is based on the rate that is coded while contract creation itself.

For example, consider this:

uint256 token_per_wei = 1;

This will send you back 10^18 custom tokens (since 1 ether = 10^18 wei).

What happens to your ether?

Every contract has a funding recipient set. Your sent ether gets transferred to their account and now belongs to them.

Think of it this way:

You are buying their custom tokens using the ether.

How to get the ether back?

Every token has a rate once their ICO gets over. You need to sell at exchanges they are listed on.

Goodluck!

Related Topic