Skip to content
This repository was archived by the owner on Apr 10, 2026. It is now read-only.

Commit a702f54

Browse files
committed
Merge remote-tracking branch 'origin/master' into aayushijain23/add-new-msg-type-delete
Resolved merge conflicts in tutorial/cli.md
2 parents d39bb23 + 9edc26f commit a702f54

15 files changed

Lines changed: 249 additions & 172 deletions

File tree

app.go

Lines changed: 62 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

cmd/nscli/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func queryCmd(cdc *amino.Codec) *cobra.Command {
8383
client.LineBreak,
8484
rpc.ValidatorCommand(cdc),
8585
rpc.BlockCommand(),
86-
authcmd.QueryTxsByTagsCmd(cdc),
86+
authcmd.QueryTxsByEventsCmd(cdc),
8787
authcmd.QueryTxCmd(cdc),
8888
client.LineBreak,
8989
)

cmd/nsd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"io"
66

77
"github.com/cosmos/cosmos-sdk/server"
8-
"github.com/cosmos/cosmos-sdk/x/auth/genaccounts"
9-
genaccscli "github.com/cosmos/cosmos-sdk/x/auth/genaccounts/client/cli"
8+
"github.com/cosmos/cosmos-sdk/x/genaccounts"
9+
genaccscli "github.com/cosmos/cosmos-sdk/x/genaccounts/client/cli"
1010
"github.com/cosmos/cosmos-sdk/x/staking"
1111

1212
"github.com/spf13/cobra"

go.mod

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ module github.com/cosmos/sdk-application-tutorial
33
go 1.12
44

55
require (
6-
github.com/cosmos/cosmos-sdk v0.28.2-0.20190616100639-18415eedaf25
6+
github.com/cosmos/cosmos-sdk v0.36.0-rc1
77
github.com/gorilla/mux v1.7.0
88
github.com/mattn/go-isatty v0.0.7 // indirect
99
github.com/prometheus/procfs v0.0.0-20190328153300-af7bedc223fb // indirect
1010
github.com/spf13/afero v1.2.2 // indirect
11-
github.com/spf13/cobra v0.0.3
12-
github.com/spf13/viper v1.0.3
13-
github.com/syndtr/goleveldb v1.0.0 // indirect
11+
github.com/spf13/cobra v0.0.5
12+
github.com/spf13/viper v1.3.2
1413
github.com/tendermint/go-amino v0.15.0
15-
github.com/tendermint/tendermint v0.31.5
14+
github.com/tendermint/tendermint v0.32.1
1615
golang.org/x/sys v0.0.0-20190329044733-9eb1bfa1ce65 // indirect
16+
google.golang.org/appengine v1.4.0 // indirect
1717
google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d // indirect
1818
google.golang.org/grpc v1.19.1 // indirect
1919
)
20-
21-
replace golang.org/x/crypto => github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5

0 commit comments

Comments
 (0)