I am doing a decentralized market of tokens ERC 721 and I have the problem that if two people give to buy the token at the same time, I do not know what would happen.
Is there any way, without spending gas, to know if there is someone in the period of purchase of that token? Since it would be paid with FIAT money, once it receives the payment, it would call the transfer function. So I have the problem that if the two transfers are made in the same block, I do not know which of the two would be made. I have tried to set a variable that changes to HOLD while someone is in the buying process, but it would cost gas. It could be done from the server side, a queue for the purchase, but I would like to do it from the smart contract part directly.
In this question, someone says that all requests would be made and the last one would persist. But in my case, being a transaction, the first one who does it takes the token and the second one no longer has a token to receive.