Documentation
¶
Index ¶
- Constants
- func CreateUpgradeHandler(mm upgrades.ModuleManager, configurator module.Configurator, ...) upgradetypes.UpgradeHandler
- func ExecuteSlashEntries(ctx sdk.Context, bk bankkeeper.BaseKeeper, entries []SlashEntry) (totalBurned sdkmath.Int, success, skipped, errCount int)
- func FlushUValidatorToDistribution(ctx sdk.Context, bk bankkeeper.BaseKeeper) error
- func NewUpgrade() upgrades.Upgrade
- type SlashEntry
Constants ¶
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:
- Flush the entire uvalidator module balance to the distribution module, clearing coins that accumulated due to a prior BeginBlocker bug.
- 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.
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.