2020-03-10 12:20:34 -07:00
|
|
|
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
|
|
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
|
|
|
|
package platformvm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ava-labs/gecko/chains"
|
|
|
|
"github.com/ava-labs/gecko/ids"
|
2020-06-08 08:53:55 -07:00
|
|
|
"github.com/ava-labs/gecko/snow"
|
2020-03-10 12:20:34 -07:00
|
|
|
"github.com/ava-labs/gecko/snow/validators"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ID of the platform VM
|
|
|
|
var (
|
|
|
|
ID = ids.NewID([32]byte{'p', 'l', 'a', 't', 'f', 'o', 'r', 'm', 'v', 'm'})
|
|
|
|
)
|
|
|
|
|
|
|
|
// Factory can create new instances of the Platform Chain
|
|
|
|
type Factory struct {
|
2020-03-19 14:59:12 -07:00
|
|
|
ChainManager chains.Manager
|
|
|
|
Validators validators.Manager
|
|
|
|
StakingEnabled bool
|
2020-03-30 19:06:29 -07:00
|
|
|
AVA ids.ID
|
|
|
|
AVM ids.ID
|
2020-03-10 12:20:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// New returns a new instance of the Platform Chain
|
2020-06-08 08:53:55 -07:00
|
|
|
func (f *Factory) New(*snow.Context) (interface{}, error) {
|
2020-03-10 12:20:34 -07:00
|
|
|
return &VM{
|
2020-03-30 19:06:29 -07:00
|
|
|
chainManager: f.ChainManager,
|
|
|
|
validators: f.Validators,
|
|
|
|
stakingEnabled: f.StakingEnabled,
|
|
|
|
ava: f.AVA,
|
|
|
|
avm: f.AVM,
|
2020-04-16 08:39:20 -07:00
|
|
|
}, nil
|
2020-03-10 12:20:34 -07:00
|
|
|
}
|