I am trying to accept ERC20 Tokens as payment in a contract. As I understand it the sender
will have to use the approve
function to give my contract an allowance
first. So far so good. What I do not understand is how does my contract call the transferFrom
function to credit itself.
Specifically I want to test if the 'allowance' approved for my contract is equal to a value and if the remaining balance of the sender is equal or greater than my contract's allowance. Conditionally to that I want to execute the 'transferFrom' function of the ERC20 Token.
I am trying to do the following:
if (
&& _Token.call(bytes4(sha3("allowance(owner, this)"))) = 100
&& _Token.call(bytes4(sha3("balanceOf(owner)"))) >= 100
)
{
_Token.call(bytes4(sha3("transferFrom(owner, this, 100)")));
But the Myst compiler says Expected primary expression.
&& _Token.call(bytes4(sha3("allowance(owner, this)"))) = 100
Many thanks.