forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genesis.go
37 lines (27 loc) · 814 Bytes
/
genesis.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
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package avm
import (
"sort"
"strings"
"github.com/ava-labs/gecko/utils"
)
// Genesis ...
type Genesis struct {
Txs []*GenesisAsset `serialize:"true"`
}
// Less ...
func (g *Genesis) Less(i, j int) bool { return strings.Compare(g.Txs[i].Alias, g.Txs[j].Alias) == -1 }
// Len ...
func (g *Genesis) Len() int { return len(g.Txs) }
// Swap ...
func (g *Genesis) Swap(i, j int) { g.Txs[j], g.Txs[i] = g.Txs[i], g.Txs[j] }
// Sort ...
func (g *Genesis) Sort() { sort.Sort(g) }
// IsSortedAndUnique ...
func (g *Genesis) IsSortedAndUnique() bool { return utils.IsSortedAndUnique(g) }
// GenesisAsset ...
type GenesisAsset struct {
Alias string `serialize:"true"`
CreateAssetTx `serialize:"true"`
}