2

I would like to transfer tokens to defi smart contracts on the behalf of a third-party. I see no option apart from (1) the third-party to transfer to me directly (2) the third-party to pre-sign transaction (sent to me) so that I can execute them later.

Most of the DeFi protocols make use of 'approve' + 'transferfrom' internally - but because of the use of msg.sender in the 'transferFrom', it only works if the third party interacts with the protocol directly - and not via me (the ERC20 allowance check fails).

Am I correct? Is there any other way to circumvent this restriction for protocols such as AAVE or UNISWAP - for ex.

1 Answer 1

0

You gave yourself the answer in your question:

Most of the DeFi protocols make use of 'approve' + 'transferfrom' internally...

The solution is to use the approve + transferFrom flow yourself. You have the user set the token approval to your contract, then you or the user calls the function on your contract which does a transferFrom to take the tokens from the user. Then your contract can interact with whichever protocol using those tokens (and itself setting approvals for those protocols to use those tokens)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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