galacticcouncil / galacticcouncil/hydration-node

Clear related asset storage when asset is removed from omnipool

Open
#1,151 1 comment 0 reactions 1 assignee Claimed by @v9ai View on GitHub
good first issue
Dominant language
Rust
Stars
208
Forks
109
Avg merge
6d 3h
Merged PRs (30d)
3

Description

As part of remove-token call, we should also clear storage related to the asset being removed. those are:

- dynamic fess
- oracle entries - needs confirmation
- ??!

Suggested implementation:

Since omnipool is not aware of anything outside itself ( does not know that dynamic fees or oracles store something), it will just send an info out that an asset has been removed from omnipool.

- take advantage of existing OmnipoolHooks trait
- add a new method - on_asset_removed( asset Id ). It returns nothing. We dont want to fail, so no need an error.
- just call the hook when asset is removed from omnipool.
- runtime implementation will take care of cleanup
- this will allow us extending the cleanup of other stuff in future ( if necessary ) without making additional changes to the omnipool pallet.

Tests:
- needs a unit test to ensure the hook is called
- needs integration tests to ensure cleanup works as exepcted

Benchmarking
- need to benchmarks the cleanup implementation
- and add weight to the omnipool's extrinsic explicitly (similar to other hooks)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.