-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.go
31 lines (27 loc) · 844 Bytes
/
utils.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
package utxo
import (
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/go-amino"
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
dbm "github.com/tendermint/tendermint/libs/db"
)
func SetupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey, *sdk.KVStoreKey) {
db := dbm.NewMemDB()
capKey := sdk.NewKVStoreKey("capkey")
capKey2 := sdk.NewKVStoreKey("capkey2")
ms := store.NewCommitMultiStore(db)
ms.MountStoreWithDB(capKey, sdk.StoreTypeIAVL, db)
ms.MountStoreWithDB(capKey2, sdk.StoreTypeIAVL, db)
ms.LoadLatestVersion()
return ms, capKey, capKey2
}
func MakeCodec() *amino.Codec {
cdc := amino.NewCodec()
RegisterAmino(cdc)
cryptoAmino.RegisterAmino(cdc)
return cdc
}
func RegisterAmino(cdc *amino.Codec) {
cdc.RegisterInterface((*Position)(nil), nil)
}