I want to make a simple smart contract, but I don't know if smart contracts are capable of what I desire. Please tell me if they are:
- a user can send ETH (or any ERC20 token) to the smart contract address and it will mint some of it's own token and send it back in exchange.
- a user can then send in the minted token at any time in the future and the smart contract will return the original assets that were sent in, to the sender.
I was told this couldn't be done because the smart contract would need to sign the transaction, and it can't sign it or else the private key would be viewable. Is this true? this behavior seems like such a simple thing, I'd be surprised if it's impossible for it to do this autonomously. But if so, I just don't understand what a smart contract really is.
Thank you for helping!