substrate icon indicating copy to clipboard operation
substrate copied to clipboard

[Feature Request] Add Lock and Unlock events to pallet balances

Open sea212 opened this issue 2 years ago • 2 comments

What is requested? Whenever some balance is locked or unlocked, a corresponding event Locked or Unlocked should be emitted.

What problem would it solve? The events in the balances pallet already map any state change to an account very well, but they are not complete yet. Software that relies on the completeness of events (besides information in transactions), such as blockchain indexers and processors, cannot retrieve this information (lock changes) in an elegant way currently. Workarounds have to be applied in those environments to completely capture state changes to an account in the balance pallet.

Additional notes Since every public function in the balances pallet that modifies locks ultimately calls update_locks to apply the update, we only have to check in update_locks whether the new lock is smaller or greater to determine if it is a Locked or Unlocked event and to be able to determine how big the change is.

sea212 avatar Sep 15 '22 10:09 sea212

@sea212 do you want to make the PR that solves this?

shawntabrizi avatar Sep 15 '22 18:09 shawntabrizi

Sure, I'll prepare a PR soon.

sea212 avatar Sep 16 '22 08:09 sea212