I'm having trouble getting a solidity contract method to transfer ERC20 tokens from address A to B assuming B has called approve
outside the contract and setup sufficient allowance
for A. The allowance
value prints fine inside the contract but the transferFrom
fails. I'm missing something in how the ownership and signatures are set up. I do have a workaround where the same transferFrom
works outside the contract but I'd like to do it inside.
I set up a sample repo with truffle tests and an issue to describe the problem further:
https://github.com/PulseBlockchain/oz-sample-app/issues/1
This is an excerpt from a larger project where I have a similar problem.
It looks similar to this question, ERC20 approve and transferFrom from a contract, except I'm doing approve
outside and want the contract to just do transferFrom
. It looks like there is a way to do transfer
from a contract like this Open Zeppelin CrowdSale
contract does and which I have working in my project. I like to be able to do either transfer
or transferFrom
from my own contract and like to better understand ownership and signature rules around it.