/
auth.go
54 lines (47 loc) · 1.76 KB
/
auth.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
package keeper
import (
db "github.com/cometbft/cometbft-db"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/furyanprotocol/v4-chain/protocol/lib"
bridgetypes "github.com/furyanprotocol/v4-chain/protocol/x/bridge/types"
clobtypes "github.com/furyanprotocol/v4-chain/protocol/x/clob/types"
satypes "github.com/furyanprotocol/v4-chain/protocol/x/subaccounts/types"
)
func createAccountKeeper(
stateStore storetypes.CommitMultiStore,
db *db.MemDB,
cdc *codec.ProtoCodec,
registry codectypes.InterfaceRegistry,
) (*keeper.AccountKeeper, storetypes.StoreKey) {
types.RegisterInterfaces(registry)
storeKey := sdk.NewKVStoreKey(types.StoreKey)
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db)
paramKey := sdk.NewKVStoreKey(paramtypes.StoreKey)
stateStore.MountStoreWithDB(paramKey, storetypes.StoreTypeIAVL, db)
paramTKey := sdk.NewTransientStoreKey(paramtypes.TStoreKey)
stateStore.MountStoreWithDB(paramTKey, storetypes.StoreTypeTransient, db)
// Create default module account permissions for test.
maccPerms := map[string][]string{
minttypes.ModuleName: {types.Minter},
bridgetypes.ModuleName: {types.Minter},
types.FeeCollectorName: nil,
satypes.ModuleName: nil,
clobtypes.InsuranceFundName: nil,
}
k := keeper.NewAccountKeeper(
cdc,
storeKey,
types.ProtoBaseAccount,
maccPerms,
sdk.Bech32MainPrefix,
lib.GovModuleAddress.String(),
)
return &k, storeKey
}