github.com/MetalBlockchain/metalgo@v1.11.9/vms/platformvm/reward/config.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package reward
     5  
     6  import (
     7  	"math/big"
     8  	"time"
     9  )
    10  
    11  // PercentDenominator is the denominator used to calculate percentages
    12  const PercentDenominator = 1_000_000
    13  
    14  // consumptionRateDenominator is the magnitude offset used to emulate
    15  // floating point fractions.
    16  var consumptionRateDenominator = new(big.Int).SetUint64(PercentDenominator)
    17  
    18  type Config struct {
    19  	// MaxConsumptionRate is the rate to allocate funds if the validator's stake
    20  	// duration is equal to [MintingPeriod]
    21  	MaxConsumptionRate uint64 `json:"maxConsumptionRate"`
    22  
    23  	// MinConsumptionRate is the rate to allocate funds if the validator's stake
    24  	// duration is 0.
    25  	MinConsumptionRate uint64 `json:"minConsumptionRate"`
    26  
    27  	// MintingPeriod is period that the staking calculator runs on. It is
    28  	// not valid for a validator's stake duration to be larger than this.
    29  	MintingPeriod time.Duration `json:"mintingPeriod"`
    30  
    31  	// SupplyCap is the target value that the reward calculation should be
    32  	// asymptotic to.
    33  	SupplyCap uint64 `json:"supplyCap"`
    34  }