How can we convert ( via smart contract coding ) any erc20 token like BAT back to ETH or USDC ? I am very new to smart contract programming and I want to write the smart contract for the conversion. Can anyone please help with the logic I should start with for the conversion?

  • what do you mean by "convert"? like get the price of your ERC20 token in ETH or USDC? or swap your token for eth or usdc?
    – Foxxxey
    Aug 2, 2021 at 12:35

1 Answer 1


You should use Uniswap in your contract, it's the most popular decentralized exchange, and you can view their documentation


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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