forked from lino-network/lino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
57 lines (43 loc) · 1.36 KB
/
common.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
package types
// AccountKey key format in KVStore
type AccountKey string
// Permlink key format in KVStore
type Permlink string
// ProposalKey key format in KVStore
type ProposalKey string
// user permission type to present different permission for different msg
type Permission int
// msg CapacityLevel, different level cost different user capacity
type CapacityLevel int
// indicates the current proposal status
type ProposalResult int
// indicates proposal type
type ProposalType int
// indicates donation type
type DonationType int
// indicates all possible balance behavior types
type TransferDetailType int
// indicates the type of punishment for oncall validators
type PunishType int
// GetPostKey try to generate PostKey from types.AccountKey and PostID
func GetPermlink(author AccountKey, postID string) Permlink {
return Permlink(string(author) + PermlinkSeparator + postID)
}
// Donation struct, only used in Donation
type IDToURLMapping struct {
Identifier string `json:"identifier"`
URL string `json:"url"`
}
// PenaltyList - get validator who doesn't vote for proposal
type PenaltyList struct {
PenaltyList []AccountKey `json:"penalty_list"`
}
// FindAccountInList - find AccountKey in given AccountKey list
func FindAccountInList(me AccountKey, lst []AccountKey) int {
for index, user := range lst {
if user == me {
return index
}
}
return -1
}