-
Notifications
You must be signed in to change notification settings - Fork 291
/
codec.go
32 lines (26 loc) · 1 KB
/
codec.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
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/supply"
"github.com/cosmos/cosmos-sdk/x/supply/exported"
"github.com/terra-project/core/x/auth"
)
// RegisterCodec registers the account types and interface
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterInterface((*exported.ModuleAccountI)(nil), nil)
cdc.RegisterInterface((*exported.SupplyI)(nil), nil)
cdc.RegisterConcrete(&supply.ModuleAccount{}, "supply/ModuleAccount", nil)
cdc.RegisterConcrete(&supply.Supply{}, "supply/Supply", nil)
}
// ModuleCdc generic sealed codec to be used throughout module
var ModuleCdc *codec.Codec
func init() {
cdc := codec.New()
RegisterCodec(cdc)
codec.RegisterCrypto(cdc)
ModuleCdc = cdc.Seal()
// Register the ModuleAccount type as a GenesisAccount so that when no
// concrete GenesisAccount types exist and **default** genesis state is used,
// the genesis state will serialize correctly.
auth.RegisterAccountTypeCodec(&supply.ModuleAccount{}, "supply/ModuleAccount")
}