-
Notifications
You must be signed in to change notification settings - Fork 6
/
kv.go
56 lines (43 loc) · 1.78 KB
/
kv.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
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package executor
import (
"fmt"
)
var (
tokenCreated = "mavl-token-"
tokenPreCreatedOT = "mavl-create-token-ot-"
tokenPreCreatedSTO = "mavl-create-token-sto-"
tokenPreCreatedOTNew = "mavl-token-create-ot-"
tokenPreCreatedSTONew = "mavl-token-create-sto-"
tokenPreCreatedSTONewLocal = "LODB-token-create-sto-"
)
func calcTokenKey(token string) (key []byte) {
return []byte(fmt.Sprintf(tokenCreated+"%s", token))
}
func calcTokenAddrKeyS(token string, owner string) (key []byte) {
return []byte(fmt.Sprintf(tokenPreCreatedOT+"%s-%s", owner, token))
}
func calcTokenStatusKey(token string, owner string, status int32) []byte {
return []byte(fmt.Sprintf(tokenPreCreatedSTO+"%d-%s-%s", status, token, owner))
}
func calcTokenAddrNewKeyS(token string, owner string) (key []byte) {
return []byte(fmt.Sprintf(tokenPreCreatedOTNew+"%s-%s", owner, token))
}
func calcTokenStatusNewKeyS(token string, owner string, status int32) []byte {
return []byte(fmt.Sprintf(tokenPreCreatedSTONew+"%d-%s-%s", status, token, owner))
}
func calcTokenStatusKeyLocal(token string, owner string, status int32) []byte {
return []byte(fmt.Sprintf(tokenPreCreatedSTONewLocal+"%d-%s-%s", status, token, owner))
}
func calcTokenStatusKeyPrefixLocal(status int32) []byte {
return []byte(fmt.Sprintf(tokenPreCreatedSTONewLocal+"%d", status))
}
func calcTokenStatusTokenKeyPrefixLocal(status int32, token string) []byte {
return []byte(fmt.Sprintf(tokenPreCreatedSTONewLocal+"%d-%s-", status, token))
}
//存储地址上收币的信息
func calcAddrKey(token string, addr string) []byte {
return []byte(fmt.Sprintf("LODB-token-%s-Addr:%s", token, addr))
}