I made transactions on a simple EVM DEX contract.

I initially called the approve method which only triggered balances.withdraw event. I understand that this event is triggered as calling this write-method requires transaction fees. Events from calling approve method

I then triggered the addLiquidity method on the contract which is payable and thus should receive the native token while this method is executed. While executing this transaction, I see that there are both balances.withdraw and balances.deposit. I don't understand why it didn't just withdraw all the required transaction fee at once, instead of withdrawing a larger portion and then depositing back some later on. Events from calling addLiquidity method

What is the cause for this?

1 Answer 1


This has to do with how the balances pallet handles taking funds for gas vs taking funds THEN giving them to another account - your contract in this case.

When you deploy a contract you will see even more events related to balances where an account is created, funded with the storage deposit, etc, etc.

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.