Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract fee event TransactionFeePaid from transaction-payment #493

Open
Chralt98 opened this issue Jan 25, 2024 · 1 comment
Open

Extract fee event TransactionFeePaid from transaction-payment #493

Chralt98 opened this issue Jan 25, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Chralt98
Copy link
Member

Currently I assume that transaction fees are stated for the Withdraw in historicalAccountBalances event. Is this correct?

{
  "dBalance": "-280001915",
  "event": "Withdraw",
  "timestamp": "2022-09-20T05:25:54.609000Z",
  "extrinsic": {
    "hash": "0x97ffcf9cd062412a44750f561c77170e29be697aa38998ac9484a299ccc0e76a",
    "name": "Utility.batch"
  },
  "id": "0001316033-bb6b4-000003-6vQ7o",
  "blockNumber": 1316033,
  "assetId": "Ztg",
  "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o"
},
{
  "dBalance": "-280000856",
  "event": "Withdraw",
  "timestamp": "2022-09-19T08:41:24.221000Z",
  "extrinsic": {
    "hash": "0x29936feb67961860a282b15d9b57c63761181994fadfb88f6b4fabab6ba05aae",
    "name": "ParachainStaking.delegator_bond_more"
  },
  "id": "0001310372-c7c6a-000003-6vQ7o",
  "blockNumber": 1310372,
  "assetId": "Ztg",
  "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o"
},
{
  "dBalance": "-232000283",
  "event": "Withdraw",
  "timestamp": "2022-09-17T20:24:12.310000Z",
  "extrinsic": {
    "hash": "0xb814d9678a96b640c0cffb4f2b9a54c9dda5706452f8553e6b9877daa72b545b",
    "name": "Vesting.vest"
  },
  "id": "0001300631-b5637-000003-6vQ7o",
  "blockNumber": 1300631,
  "assetId": "Ztg",
  "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o"
},

It would be cool to be more precise for what the withdraw actually was used. But I think it is okay how it is now, because the transaction-payment pallet does not emit an event directly here (only indirectly over withdraw and deposit (for a refund)). However there is indeed an event called TransactionFeePaid in the transaction payment pallet. But leave this for now, Withdraw events are sufficient for me to recognise transaction fees.

But we need to take a look at how pallet-asset-tx-payment handles this. It emits a different event AssetTxFeePaid, but does it also emit an Withdraw event?

We implement our own OnChargeAssetTransaction here. This means we call orml_tokens here, which ultimately means that we need to catch the events of orml-tokens Withdrawn and Deposited to have an equivalent to the pallet pallet-transaction-payment.

Or we go the other route to index the AssetTxFeePaid event and the TransactionFeePaid properly.

As a result of adding the AssetTxFeePaid and TransactionFeePaid events, the Withdraw, Deposit, Withdrawn and Deposited events are basically a double booking of fees then.

What would you suggest?

@Chralt98 Chralt98 added the enhancement New feature or request label Jan 25, 2024
@Chralt98
Copy link
Member Author

Oh, I see that we currently already got Withdrawn and Deposited events indexed from orml-tokens via historicalAccountBalances. I also see that AssetTxFeePaid was indexed. So, what do you think about adding TransactionFeePaid to have everything complete?

@Chralt98 Chralt98 changed the title Extract fees from transaction-payment and pallet-asset-tx-payment pallets Extract fee event TransactionFeePaid from transaction-payment Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants