0

Perhaps, this is already possible, but when I approve someone to spend tokens on my behalf using the approve method, why can't they just delegate their spending authority to someone else?

2 Answers 2

1

You could certainly write a smart contract that worked that way.

I believe that spending such coins would require finding at least one path through an arbitrary DAG of approvals. In the best case, this is O(n) in the smart contract where the caller specifies a valid set of approvals that will allow the transfer. In the worst case, the smart contract has to attempt to find those approvals itself, which could be quite expensive.

So I imagine this isn't commonly done because it's computationally expensive.

Unless you're thinking of the second approval replacing the first, in which case this should be fairly trivial to do?

0

Although it is easily possible to write a contract which delegates the approval to spend tokens to a different address other than that was stated in the function parameter, I believe it would be a violation of ERC20 spec in which the algorythm of the approve function clearly states that namely the appointed address gets allowance to spend tokens.

And from the point of view of the function caller it is quite unexpected if someone else receives the allowance to spend tokens.

Your Answer

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

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