@@ -15,13 +15,15 @@ import (
1515 sdk "github.com/cosmos/cosmos-sdk/types"
1616 "github.com/cosmos/cosmos-sdk/types/module"
1717 "github.com/cosmos/cosmos-sdk/x/auth"
18- "github.com/cosmos/cosmos-sdk/x/auth/genaccounts"
1918 "github.com/cosmos/cosmos-sdk/x/bank"
2019 distr "github.com/cosmos/cosmos-sdk/x/distribution"
20+ "github.com/cosmos/cosmos-sdk/x/genaccounts"
2121 "github.com/cosmos/cosmos-sdk/x/genutil"
2222 "github.com/cosmos/cosmos-sdk/x/params"
2323 "github.com/cosmos/cosmos-sdk/x/slashing"
2424 "github.com/cosmos/cosmos-sdk/x/staking"
25+ "github.com/cosmos/cosmos-sdk/x/supply"
26+
2527 "github.com/cosmos/sdk-application-tutorial/x/nameservice"
2628)
2729
@@ -34,18 +36,27 @@ var (
3436 // DefaultNodeHome sets the folder where the applcation data and configuration will be stored
3537 DefaultNodeHome = os .ExpandEnv ("$HOME/.nsd" )
3638
37- // ModuleBasicManager is in charge of setting up basic module elemnets
39+ // NewBasicManager is in charge of setting up basic module elemnets
3840 ModuleBasics = module .NewBasicManager (
3941 genaccounts.AppModuleBasic {},
4042 genutil.AppModuleBasic {},
4143 auth.AppModuleBasic {},
4244 bank.AppModuleBasic {},
43- params.AppModuleBasic {},
44- nameservice.AppModule {},
4545 staking.AppModuleBasic {},
4646 distr.AppModuleBasic {},
47+ params.AppModuleBasic {},
4748 slashing.AppModuleBasic {},
49+ supply.AppModuleBasic {},
50+
51+ nameservice.AppModule {},
4852 )
53+ // account permissions
54+ maccPerms = map [string ][]string {
55+ auth .FeeCollectorName : nil ,
56+ distr .ModuleName : nil ,
57+ staking .BondedPoolName : []string {supply .Burner , supply .Staking },
58+ staking .NotBondedPoolName : []string {supply .Burner , supply .Staking },
59+ }
4960)
5061
5162// MakeCodec generates the necessary codecs for Amino
@@ -62,27 +73,27 @@ type nameServiceApp struct {
6273 cdc * codec.Codec
6374
6475 // Keys to access the substores
65- keyMain * sdk.KVStoreKey
66- keyAccount * sdk.KVStoreKey
67- keyFeeCollection * sdk.KVStoreKey
68- keyStaking * sdk.KVStoreKey
69- tkeyStaking * sdk.TransientStoreKey
70- keyDistr * sdk.KVStoreKey
71- tkeyDistr * sdk.TransientStoreKey
72- keyNS * sdk.KVStoreKey
73- keyParams * sdk.KVStoreKey
74- tkeyParams * sdk.TransientStoreKey
75- keySlashing * sdk.KVStoreKey
76+ keyMain * sdk.KVStoreKey
77+ keyAccount * sdk.KVStoreKey
78+ keySupply * sdk.KVStoreKey
79+ keyStaking * sdk.KVStoreKey
80+ tkeyStaking * sdk.TransientStoreKey
81+ keyDistr * sdk.KVStoreKey
82+ tkeyDistr * sdk.TransientStoreKey
83+ keyNS * sdk.KVStoreKey
84+ keyParams * sdk.KVStoreKey
85+ tkeyParams * sdk.TransientStoreKey
86+ keySlashing * sdk.KVStoreKey
7687
7788 // Keepers
78- accountKeeper auth.AccountKeeper
79- bankKeeper bank.Keeper
80- stakingKeeper staking.Keeper
81- slashingKeeper slashing.Keeper
82- distrKeeper distr.Keeper
83- feeCollectionKeeper auth. FeeCollectionKeeper
84- paramsKeeper params.Keeper
85- nsKeeper nameservice.Keeper
89+ accountKeeper auth.AccountKeeper
90+ bankKeeper bank.Keeper
91+ stakingKeeper staking.Keeper
92+ slashingKeeper slashing.Keeper
93+ distrKeeper distr.Keeper
94+ supplyKeeper supply. Keeper
95+ paramsKeeper params.Keeper
96+ nsKeeper nameservice.Keeper
8697
8798 // Module Manager
8899 mm * module.Manager
@@ -102,17 +113,17 @@ func NewNameServiceApp(logger log.Logger, db dbm.DB) *nameServiceApp {
102113 BaseApp : bApp ,
103114 cdc : cdc ,
104115
105- keyMain : sdk .NewKVStoreKey (bam .MainStoreKey ),
106- keyAccount : sdk .NewKVStoreKey (auth .StoreKey ),
107- keyFeeCollection : sdk .NewKVStoreKey (auth . FeeStoreKey ),
108- keyStaking : sdk .NewKVStoreKey (staking .StoreKey ),
109- tkeyStaking : sdk .NewTransientStoreKey (staking .TStoreKey ),
110- keyDistr : sdk .NewKVStoreKey (distr .StoreKey ),
111- tkeyDistr : sdk .NewTransientStoreKey (distr .TStoreKey ),
112- keyNS : sdk .NewKVStoreKey (nameservice .StoreKey ),
113- keyParams : sdk .NewKVStoreKey (params .StoreKey ),
114- tkeyParams : sdk .NewTransientStoreKey (params .TStoreKey ),
115- keySlashing : sdk .NewKVStoreKey (slashing .StoreKey ),
116+ keyMain : sdk .NewKVStoreKey (bam .MainStoreKey ),
117+ keyAccount : sdk .NewKVStoreKey (auth .StoreKey ),
118+ keySupply : sdk .NewKVStoreKey (supply . StoreKey ),
119+ keyStaking : sdk .NewKVStoreKey (staking .StoreKey ),
120+ tkeyStaking : sdk .NewTransientStoreKey (staking .TStoreKey ),
121+ keyDistr : sdk .NewKVStoreKey (distr .StoreKey ),
122+ tkeyDistr : sdk .NewTransientStoreKey (distr .TStoreKey ),
123+ keyNS : sdk .NewKVStoreKey (nameservice .StoreKey ),
124+ keyParams : sdk .NewKVStoreKey (params .StoreKey ),
125+ tkeyParams : sdk .NewTransientStoreKey (params .TStoreKey ),
126+ keySlashing : sdk .NewKVStoreKey (slashing .StoreKey ),
116127 }
117128
118129 // The ParamsKeeper handles parameter storage for the application
@@ -139,15 +150,21 @@ func NewNameServiceApp(logger log.Logger, db dbm.DB) *nameServiceApp {
139150 bank .DefaultCodespace ,
140151 )
141152
142- // The FeeCollectionKeeper collects transaction fees and renders them to the fee distribution module
143- app .feeCollectionKeeper = auth .NewFeeCollectionKeeper (cdc , app .keyFeeCollection )
153+ // The SupplyKeeper collects transaction fees and renders them to the fee distribution module
154+ app .supplyKeeper = supply .NewKeeper (
155+ app .cdc ,
156+ app .keySupply ,
157+ app .accountKeeper ,
158+ app .bankKeeper ,
159+ supply .DefaultCodespace ,
160+ maccPerms )
144161
145162 // The staking keeper
146163 stakingKeeper := staking .NewKeeper (
147164 app .cdc ,
148165 app .keyStaking ,
149166 app .tkeyStaking ,
150- app .bankKeeper ,
167+ app .supplyKeeper ,
151168 stakingSubspace ,
152169 staking .DefaultCodespace ,
153170 )
@@ -156,10 +173,10 @@ func NewNameServiceApp(logger log.Logger, db dbm.DB) *nameServiceApp {
156173 app .cdc ,
157174 app .keyDistr ,
158175 distrSubspace ,
159- app .bankKeeper ,
160176 & stakingKeeper ,
161- app .feeCollectionKeeper ,
177+ app .supplyKeeper ,
162178 distr .DefaultCodespace ,
179+ auth .FeeCollectorName ,
163180 )
164181
165182 app .slashingKeeper = slashing .NewKeeper (
@@ -189,12 +206,13 @@ func NewNameServiceApp(logger log.Logger, db dbm.DB) *nameServiceApp {
189206 app .mm = module .NewManager (
190207 genaccounts .NewAppModule (app .accountKeeper ),
191208 genutil .NewAppModule (app .accountKeeper , app .stakingKeeper , app .BaseApp .DeliverTx ),
192- auth .NewAppModule (app .accountKeeper , app . feeCollectionKeeper ),
209+ auth .NewAppModule (app .accountKeeper ),
193210 bank .NewAppModule (app .bankKeeper , app .accountKeeper ),
194211 nameservice .NewAppModule (app .nsKeeper , app .bankKeeper ),
195- distr .NewAppModule (app .distrKeeper ),
212+ supply .NewAppModule (app .supplyKeeper , app .accountKeeper ),
213+ distr .NewAppModule (app .distrKeeper , app .supplyKeeper ),
196214 slashing .NewAppModule (app .slashingKeeper , app .stakingKeeper ),
197- staking .NewAppModule (app .stakingKeeper , app .feeCollectionKeeper , app .distrKeeper , app .accountKeeper ),
215+ staking .NewAppModule (app .stakingKeeper , app .distrKeeper , app .accountKeeper , app .supplyKeeper ),
198216 )
199217
200218 app .mm .SetOrderBeginBlockers (distr .ModuleName , slashing .ModuleName )
@@ -224,15 +242,15 @@ func NewNameServiceApp(logger log.Logger, db dbm.DB) *nameServiceApp {
224242 app .SetAnteHandler (
225243 auth .NewAnteHandler (
226244 app .accountKeeper ,
227- app .feeCollectionKeeper ,
245+ app .supplyKeeper ,
228246 auth .DefaultSigVerificationGasConsumer ,
229247 ),
230248 )
231249
232250 app .MountStores (
233251 app .keyMain ,
234252 app .keyAccount ,
235- app .keyFeeCollection ,
253+ app .keySupply ,
236254 app .keyStaking ,
237255 app .tkeyStaking ,
238256 app .keyDistr ,
0 commit comments