I would like to have a new ERC20 token and one or two smart contracts to do automatic trade with specific cryptos.

Example: I can buy 1 token from the contract in exchange for 1 USDT. I can sell a token for a different price then in the first scenario, say 0.99 USDT, so the contract always "profit". I need to be able to get tokens or USDT out of the contract to any account wallet and I need to be able to add balace of USDT or tokens to the contract from any account wallet I own and decide to use.

Any tips on if andhow this can be achieved and code samples are much appreciated.

  • The question is too broad. Try dividing the problem in small ones that are easier to ask about. Start with a simple case.
    – Ismael
    Sep 2, 2023 at 4:29

1 Answer 1


in order to do this, you need to merge the deposit and claim functionality in one function. Depositing 1 USDT and receiving the token in exchange is what it means. Claim is for the user to transfer that Token to its EOA / Metamask Wallet. I would suggest you not automate this, as if you implement a price oracle for this, which will give you real-time price of the USDT and tokens . It can take some time to reflect the price and token can be exchanged for the wrong price.

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