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