supplyslash

package
v0.0.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const UpgradeName = "supply-slash"

Variables

This section is empty.

Functions

func CreateUpgradeHandler

func CreateUpgradeHandler(
	mm upgrades.ModuleManager,
	configurator module.Configurator,
	ak *upgrades.AppKeepers,
) upgradetypes.UpgradeHandler

CreateUpgradeHandler runs two operations in order:

  1. Flush the entire uvalidator module balance to the distribution module, clearing coins that accumulated due to a prior BeginBlocker bug.
  2. Burn (AmountUPC - RebalancedTokens) * 10^18 upc from each address's liquid balance as specified in the embedded rebalance.json, reducing total supply to ~10B PC.

func ExecuteSlashEntries

func ExecuteSlashEntries(
	ctx sdk.Context,
	bk bankkeeper.BaseKeeper,
	entries []SlashEntry,
) (totalBurned sdkmath.Int, success, skipped, errCount int)

ExecuteSlashEntries burns (entry.AmountUPC - entry.RebalancedTokens) * 10^18 upc of liquid balance from each address. Returns total burned and per-outcome counts.

Entries are skipped (not counted as errors) when:

  • burn amount <= 0 (address already at or below target)
  • spendable balance < burn amount

Entries are counted as errors when:

  • address fails bech32 decoding

Panics if BurnCoins fails after SendCoinsFromAccountToModule succeeds, since that would leave supply accounting in an inconsistent state.

func FlushUValidatorToDistribution

func FlushUValidatorToDistribution(ctx sdk.Context, bk bankkeeper.BaseKeeper) error

FlushUValidatorToDistribution sends the entire uvalidator module balance to the distribution module. This clears coins that accumulated due to a prior BeginBlocker bug where extraCoins were retained in the uvalidator account instead of being forwarded to distribution.

Note: uvalidator has nil permissions in maccPerms, but SendCoinsFromModuleToModule does not require Burner permission — it performs a regular SendCoins between two module addresses.

func NewUpgrade

func NewUpgrade() upgrades.Upgrade

NewUpgrade constructs the upgrade definition.

Types

type SlashEntry

type SlashEntry struct {
	Address          string  `json:"address"`
	AmountUPC        float64 `json:"amount_upc"`        // current balance in whole PC
	RebalancedTokens float64 `json:"rebalanced_tokens"` // target balance in whole PC
}

SlashEntry represents one address/amount pair from rebalance.json. AmountUPC and RebalancedTokens are in whole PC tokens (already divided by 10^18). Burn amount per address = (AmountUPC - RebalancedTokens) * 10^18 upc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL