I've reviewed most all of the posts on this topic, but none of the answers are doing exactly what I need.
I have an application that allows users to submit their tokens from their contract into my "pool" at my own contract address. What I want to happen is that an outside address can request for my own contract to send them these new tokens after they pay an ETH fee. So the sequence is as follows, using random amounts for example:
- User A (contract owner) sends 100 tokens from their contract address to my pool address (I already have this working)
- User B (interested buyer) clicks a button on my application that will grant them 20 of these tokens from my pool address in exchange for ETH amount that is predetermined on the app.
I assume I will need to use a batch add function here to release the tokens and accept the ETH, but how do I get my pool address to approve the transaction automatically without my interference?
- Note: My pool address can hold multiple tokens, so I would also need to specify which token is being sent during the transaction.