1

I'm confused about this issue.

Description of approve function states

Allow _spender to withdraw from your account, multiple times, up to the _value amount.

If I'm understanding this correctly then it means that amount of what _spender is allowed to transfer will stay the same till this function is called again and _value changed.

But then description of allowance says

the amount which _spender is still allowed to withdraw from _owner

Which makes me think that allowance gets reduced after each transfer? Or it just mens that even if _spender is allowed to spend 1000, he actually will be able to spend only x if the x is current balance and it is less than 1000?

0

In reality the spendable amount of tokens for _spender from _owner is obviously min(balanceOf(address _owner),allowance(address _owner,address _spender)), where min denotes the minimum function.

The amount of allowance(address _owner,address _spender) changes at each successful calling of these two functions:

  1. _owner calls the approve(address _spender, uint _value) function or
  2. _spender calls the transferFrom(address _owner, address _to, uint _value) function.
  • In short, it means that allowance can be spent and needs to be renewed? – chba Sep 28 '17 at 15:20
  • Correct! Although not 100% sure what you mean by "needs to be renewed". If you mean that inside the approve or transferFrom functions your contract need to update the corresponding allowance value, then it is correct! – István András Seres Sep 28 '17 at 15:25
  • I mean that owner has to assign new allowance to spender. – chba Sep 28 '17 at 15:28
  • Yes, sure! exactly – István András Seres Sep 28 '17 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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