Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

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

Closed
sea212 opened this issue Sep 15, 2022 · 2 comments · Fixed by #12287
Closed

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

sea212 opened this issue Sep 15, 2022 · 2 comments · Fixed by #12287
Labels
J0-enhancement An additional feature request. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.

Comments

@sea212
Copy link
Contributor

sea212 commented Sep 15, 2022

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.

@github-actions github-actions bot added the J2-unconfirmed Issue might be valid, but it’s not yet known. label Sep 15, 2022
@shawntabrizi
Copy link
Member

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

@joepetrowski joepetrowski added J0-enhancement An additional feature request. Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder and removed J2-unconfirmed Issue might be valid, but it’s not yet known. labels Sep 16, 2022
@sea212
Copy link
Contributor Author

sea212 commented Sep 16, 2022

Sure, I'll prepare a PR soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants