fc-pallet-black-hole

Crates.iofc-pallet-black-hole
lib.rsfc-pallet-black-hole
version1.0.0
created_at2025-07-05 06:26:26.75581+00
updated_at2025-07-05 06:26:26.75581+00
descriptionA pallet that periodically burns the balance on its account
homepage
repositoryhttps://github.com/virto-network/frame-contrib.git
max_upload_size
id1738787
size117,283
Daniel Olano (olanod)

documentation

README

๐Ÿ•ณ๏ธ Black Hole Pallet

The Black Hole pallet defines a sink account that receives token transfers and periodically burns its entire balance, removing tokens from circulation. This mechanism can be useful for implementing economic sinks or deflationary behaviors within a runtime.

โœจ Overview

  • The pallet owns an account known as the event horizon.
  • Any user or module can transfer tokens to this account.
  • Periodically (after a configurable number of blocks), the balance of the account is burned automatically.
  • Authorized origins can dispatch extrinsic calls as if signed by the event horizon account.

๐Ÿ”ง Features

  • Automated burning of all tokens in the event horizon account every BurnPeriod blocks.
  • Total burned balance tracking via BlackHoleMass.
  • Dispatch proxying to allow controlled usage of the event horizon identity.

โš™๏ธ Configuration

This pallet requires the following types and parameters to be configured in the runtime:

Type / Constant Description
RuntimeEvent Event type for this pallet
WeightInfo Weight cost functions
EventHorizonDispatchOrigin Origin authorized to proxy calls as the event horizon
Balances A fungible::Mutate implementation (e.g., native balances)
BlockNumberProvider Source of current block number
PalletId Unique identifier for deriving the event horizon account
BurnPeriod Number of blocks between automatic burns

๐Ÿง  Storage

Item Description
LastBurn Block number of the last burn event
BlackHoleMass Total amount of tokens burned by this pallet

๐Ÿ“ฆ Dispatchable Functions

dispatch_as_event_horizon

fn dispatch_as_event_horizon(origin, call)

Allows an authorized origin to dispatch a call on behalf of the event horizon account. This enables tightly controlled usage of the burn account in more complex workflows.

๐Ÿ” Runtime Hooks

  • The pallet implements on_idle, and will attempt to burn the balance in the event horizon account whenever sufficient weight is available.

๐Ÿ”’ Security Notes

  • The pallet does not restrict who can transfer funds to the event horizon account.
  • Only the EventHorizonDispatchOrigin can perform calls as the event horizon, preventing abuse.

๐Ÿงช Testing and Benchmarking

  • Includes unit tests and benchmarking support behind runtime-benchmarks.
Commit count: 0

cargo fmt