Skip to content

Clear related asset storage when asset is removed from omnipool #1151

@enthusiastmartin

Description

@enthusiastmartin

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)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions