Please help me make following process feasible
situation: A user wants to buy service(or product) at certain dapp but A has no token(even ETH) in his account so asks B for paying on behalf of.
- B call approve A to spend amount of price
- A call transferfrom B to Xcontract
- Xcontract delegatecall buy function in dapp contract
- dapp contract gives ownership of service to A
I put Xcontract here because dapp contract may check balance of msg.sender so X need to return as following to avoid revert:
msg.sender=A, balance is equal or greater than price
I am stucked here. If Xcontract does delegatecall then it returns msg.sender=A but 0 for balance(A has no token) right? eventually, dapp will revert. Is there any solution to return both msg.sender as A and enough balance in this case?
How can I do? is it absolutely impossible? token in this case is just erc20