HydraDX-node
HydraDX-node copied to clipboard
fix: clear dynamic fees and oracle storage when removing token from omnipool
Description
This PR adds storage cleanup functionality when removing a token from the omnipool.
When an asset is removed from the omnipool via remove_token extrinsic, the following related storage entries are now cleared:
-
Dynamic fees - Removes
AssetFeeandAssetFeeConfigurationentries - Oracle entries - Removes oracle data for all supported periods, accumulator entries, and whitelist entries
The implementation uses two new trait abstractions:
-
AssetFeesRemover- for clearing dynamic fee storage -
OracleAssetRemover- for clearing oracle-related storage
Related Issue
Closes #1151
Motivation and Context
Previously, when an asset was removed from the omnipool, related storage entries in other pallets (dynamic fees and oracle) were not being cleaned up. This could lead to stale data accumulating in storage.
How Has This Been Tested?
- Existing test
remove_token_should_clear_related_storagevalidates the removal functionality - Runtime adapters implement the cleanup logic for both dynamic fees and oracle entries
- Integration tests confirm proper cleanup of all related storage
Checklist
- [x] I have updated the documentation if necessary.
- [x] I have added tests to cover my changes, regression test if fixing an issue.
- [ ] This is a breaking change.