github.com/MetalBlockchain/metalgo@v1.11.9/genesis/params.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package genesis
     5  
     6  import (
     7  	"time"
     8  
     9  	"github.com/MetalBlockchain/metalgo/utils/constants"
    10  	"github.com/MetalBlockchain/metalgo/vms/platformvm/reward"
    11  	"github.com/MetalBlockchain/metalgo/vms/platformvm/txs/fee"
    12  )
    13  
    14  type StakingConfig struct {
    15  	// Staking uptime requirements
    16  	UptimeRequirement float64 `json:"uptimeRequirement"`
    17  	// Minimum stake, in nAVAX, required to validate the primary network
    18  	MinValidatorStake uint64 `json:"minValidatorStake"`
    19  	// Maximum stake, in nAVAX, allowed to be placed on a single validator in
    20  	// the primary network
    21  	MaxValidatorStake uint64 `json:"maxValidatorStake"`
    22  	// Minimum stake, in nAVAX, that can be delegated on the primary network
    23  	MinDelegatorStake uint64 `json:"minDelegatorStake"`
    24  	// Minimum delegation fee, in the range [0, 1000000], that can be charged
    25  	// for delegation on the primary network.
    26  	MinDelegationFee uint32 `json:"minDelegationFee"`
    27  	// MinStakeDuration is the minimum amount of time a validator can validate
    28  	// for in a single period.
    29  	MinStakeDuration time.Duration `json:"minStakeDuration"`
    30  	// MaxStakeDuration is the maximum amount of time a validator can validate
    31  	// for in a single period.
    32  	MaxStakeDuration time.Duration `json:"maxStakeDuration"`
    33  	// RewardConfig is the config for the reward function.
    34  	RewardConfig reward.Config `json:"rewardConfig"`
    35  }
    36  
    37  type Params struct {
    38  	StakingConfig
    39  	fee.StaticConfig
    40  }
    41  
    42  func GetTxFeeConfig(networkID uint32) fee.StaticConfig {
    43  	switch networkID {
    44  	case constants.MainnetID:
    45  		return MainnetParams.StaticConfig
    46  	case constants.TahoeID:
    47  		return TahoeParams.StaticConfig
    48  	case constants.LocalID:
    49  		return LocalParams.StaticConfig
    50  	default:
    51  		return LocalParams.StaticConfig
    52  	}
    53  }
    54  
    55  func GetStakingConfig(networkID uint32) StakingConfig {
    56  	switch networkID {
    57  	case constants.MainnetID:
    58  		return MainnetParams.StakingConfig
    59  	case constants.TahoeID:
    60  		return TahoeParams.StakingConfig
    61  	case constants.LocalID:
    62  		return LocalParams.StakingConfig
    63  	default:
    64  		return LocalParams.StakingConfig
    65  	}
    66  }