-
Notifications
You must be signed in to change notification settings - Fork 672
/
factory.go
83 lines (59 loc) · 2.23 KB
/
factory.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package platformvm
import (
"time"
"github.com/ava-labs/avalanchego/chains"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/validators"
)
// ID of the platform VM
var (
ID = ids.ID{'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', 'v', 'm'}
)
// Factory can create new instances of the Platform Chain
type Factory struct {
// The node's chain manager
Chains chains.Manager
// Node's validator set maps subnetID -> validators of the subnet
Validators validators.Manager
// True if the node is being run with staking enabled
StakingEnabled bool
// Set of subnets that this node is validating
WhitelistedSubnets ids.Set
// Fee that must be burned by every create staker transaction
AddStakerTxFee uint64
// Fee that is burned by every non-state creating transaction
TxFee uint64
// Fee that must be burned by every state creating transaction before AP3
CreateAssetTxFee uint64
// Fee that must be burned by every subnet creating transaction after AP3
CreateSubnetTxFee uint64
// Fee that must be burned by every blockchain creating transaction after AP3
CreateBlockchainTxFee uint64
// The minimum amount of tokens one must bond to be a validator
MinValidatorStake uint64
// The maximum amount of tokens that can be bonded on a validator
MaxValidatorStake uint64
// Minimum stake, in nAVAX, that can be delegated on the primary network
MinDelegatorStake uint64
// Minimum fee that can be charged for delegation
MinDelegationFee uint32
// UptimePercentage is the minimum uptime required to be rewarded for staking
UptimePercentage float64
// Minimum amount of time to allow a staker to stake
MinStakeDuration time.Duration
// Maximum amount of time to allow a staker to stake
MaxStakeDuration time.Duration
// Consumption period for the minting function
StakeMintingPeriod time.Duration
// Time of the AP3 network upgrade
ApricotPhase3Time time.Time
// Time of the AP4 network upgrade
ApricotPhase4Time time.Time
}
// New returns a new instance of the Platform Chain
func (f *Factory) New(*snow.Context) (interface{}, error) {
return &VM{Factory: *f}, nil
}