Is is good practice if I have a custom-made ERC20 that takes its own tokens out of the user for doing other stuff?

I ask since doing it this way there's no need for the user to call approve() beforehand.

And in this way I can write other methods, inside my custom ERC20, that call _transfer() without going through allowance()


2 Answers 2


A token where someone else can deduct the balance of the user is not safe.

Any action that causes cost to the user must be initiated by the user.


It isn't a practice, as it wouldn't solve the issue of the contract who's method you are calling, (say a routers swap function) from being able to make the transferFrom call on behalf of the holder.

Imagine you want to make a swap. If your move function doesn't atomically transfer the tokens to the pool contract and call the low level swap function on the pool to receive the tokens, like the router does. Then having what is effectively another transfer function isn't very helpful.

The approved contract will be specific to the dapp implementation, it isn't realistic for your token to contain all those use cases.

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.