Skip to content

Commit

Permalink
Rename coinKeeper -> bankKeeper
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon committed Sep 8, 2018
1 parent 2abc90e commit e812919
Show file tree
Hide file tree
Showing 25 changed files with 110 additions and 110 deletions.
12 changes: 6 additions & 6 deletions cmd/gaia/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type GaiaApp struct {
// Manage getting and setting accounts
accountMapper auth.AccountMapper
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
bankKeeper bank.Keeper
ibcMapper ibc.Mapper
stakeKeeper stake.Keeper
slashingKeeper slashing.Keeper
Expand Down Expand Up @@ -89,19 +89,19 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptio
)

// add handlers
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.bankKeeper = bank.NewKeeper(app.accountMapper)
app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace))
app.paramsKeeper = params.NewKeeper(app.cdc, app.keyParams)
app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.bankKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.paramsKeeper.Getter(), app.RegisterCodespace(slashing.DefaultCodespace))
app.stakeKeeper = app.stakeKeeper.WithValidatorHooks(app.slashingKeeper.ValidatorHooks())
app.govKeeper = gov.NewKeeper(app.cdc, app.keyGov, app.paramsKeeper.Setter(), app.coinKeeper, app.stakeKeeper, app.RegisterCodespace(gov.DefaultCodespace))
app.govKeeper = gov.NewKeeper(app.cdc, app.keyGov, app.paramsKeeper.Setter(), app.bankKeeper, app.stakeKeeper, app.RegisterCodespace(gov.DefaultCodespace))
app.feeCollectionKeeper = auth.NewFeeCollectionKeeper(app.cdc, app.keyFeeCollection)

// register message routes
app.Router().
AddRoute("bank", bank.NewHandler(app.coinKeeper)).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper)).
AddRoute("bank", bank.NewHandler(app.bankKeeper)).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.bankKeeper)).
AddRoute("stake", stake.NewHandler(app.stakeKeeper)).
AddRoute("slashing", slashing.NewHandler(app.slashingKeeper)).
AddRoute("gov", gov.NewHandler(app.govKeeper))
Expand Down
2 changes: 1 addition & 1 deletion cmd/gaia/app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func invariants(app *GaiaApp) []simulation.Invariant {
func(t *testing.T, baseapp *baseapp.BaseApp, log string) {
banksim.NonnegativeBalanceInvariant(app.accountMapper)(t, baseapp, log)
govsim.AllInvariants()(t, baseapp, log)
stakesim.AllInvariants(app.coinKeeper, app.stakeKeeper, app.accountMapper)(t, baseapp, log)
stakesim.AllInvariants(app.bankKeeper, app.stakeKeeper, app.accountMapper)(t, baseapp, log)
slashingsim.AllInvariants()(t, baseapp, log)
},
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/gaia/cmd/gaiadebug/hack.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ type GaiaApp struct {
// Manage getting and setting accounts
accountMapper auth.AccountMapper
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
bankKeeper bank.Keeper
ibcMapper ibc.Mapper
stakeKeeper stake.Keeper
slashingKeeper slashing.Keeper
Expand Down Expand Up @@ -173,16 +173,16 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.BaseAp
)

// add handlers
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.bankKeeper = bank.NewKeeper(app.accountMapper)
app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace))
app.paramsKeeper = params.NewKeeper(app.cdc, app.keyParams)
app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.coinKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.stakeKeeper = stake.NewKeeper(app.cdc, app.keyStake, app.bankKeeper, app.RegisterCodespace(stake.DefaultCodespace))
app.slashingKeeper = slashing.NewKeeper(app.cdc, app.keySlashing, app.stakeKeeper, app.paramsKeeper.Getter(), app.RegisterCodespace(slashing.DefaultCodespace))

// register message routes
app.Router().
AddRoute("bank", bank.NewHandler(app.coinKeeper)).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper)).
AddRoute("bank", bank.NewHandler(app.bankKeeper)).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.bankKeeper)).
AddRoute("stake", stake.NewHandler(app.stakeKeeper))

// initialize BaseApp
Expand Down
8 changes: 4 additions & 4 deletions docs/sdk/core/app3.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ it can't increment sequence numbers, change PubKeys, or otherwise.
A `bank.Keeper` is easily instantiated from an `AccountMapper`:

```go
coinKeeper = bank.NewKeeper(accountMapper)
bankKeeper = bank.NewKeeper(accountMapper)
```

We can then use it within a handler, instead of working directly with the
Expand All @@ -295,7 +295,7 @@ We can then use it within a handler, instead of working directly with the
// Finds account with addr in AccountMapper.
// Adds coins to account's coin array.
// Sets updated account in AccountMapper
app.coinKeeper.AddCoins(ctx, addr, coins)
app.bankKeeper.AddCoins(ctx, addr, coins)
```

See the [bank.Keeper API
Expand Down Expand Up @@ -336,15 +336,15 @@ func NewApp3(logger log.Logger, db dbm.DB) *bapp.BaseApp {

// Set various mappers/keepers to interact easily with underlying stores
accountMapper := auth.NewAccountMapper(cdc, keyAccount, auth.ProtoBaseAccount)
coinKeeper := bank.NewKeeper(accountMapper)
bankKeeper := bank.NewKeeper(accountMapper)
feeKeeper := auth.NewFeeCollectionKeeper(cdc, keyFees)

app.SetAnteHandler(auth.NewAnteHandler(accountMapper, feeKeeper))

// Register message routes.
// Note the handler gets access to
app.Router().
AddRoute("send", bank.NewHandler(coinKeeper))
AddRoute("send", bank.NewHandler(bankKeeper))

// Mount stores and load the latest state.
app.MountStoresIAVL(keyAccount, keyFees)
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/core/examples/app3.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ func NewApp3(logger log.Logger, db dbm.DB) *bapp.BaseApp {

// Set various mappers/keepers to interact easily with underlying stores
accountMapper := auth.NewAccountMapper(cdc, keyAccount, auth.ProtoBaseAccount)
coinKeeper := bank.NewKeeper(accountMapper)
bankKeeper := bank.NewKeeper(accountMapper)
feeKeeper := auth.NewFeeCollectionKeeper(cdc, keyFees)

app.SetAnteHandler(auth.NewAnteHandler(accountMapper, feeKeeper))

// Register message routes.
// Note the handler gets access to
app.Router().
AddRoute("bank", bank.NewHandler(coinKeeper))
AddRoute("bank", bank.NewHandler(bankKeeper))

// Mount stores and load the latest state.
app.MountStoresIAVL(keyAccount, keyFees)
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/core/examples/app4.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewApp4(logger log.Logger, db dbm.DB) *bapp.BaseApp {

// Set various mappers/keepers to interact easily with underlying stores
accountMapper := auth.NewAccountMapper(cdc, keyAccount, auth.ProtoBaseAccount)
coinKeeper := bank.NewKeeper(accountMapper)
bankKeeper := bank.NewKeeper(accountMapper)

// TODO
keyFees := sdk.NewKVStoreKey("fee")
Expand All @@ -43,7 +43,7 @@ func NewApp4(logger log.Logger, db dbm.DB) *bapp.BaseApp {
// Register message routes.
// Note the handler gets access to the account store.
app.Router().
AddRoute("bank", bank.NewHandler(coinKeeper))
AddRoute("bank", bank.NewHandler(bankKeeper))

// Mount stores and load the latest state.
app.MountStoresIAVL(keyAccount, keyFees)
Expand Down
8 changes: 4 additions & 4 deletions docs/sdk/sdk-by-examples/simple-governance/app-constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ var cdc = MakeCodec()
- Instantiate the keepers. Note that keepers generally need access to other module's keepers. In this case, make sure you only pass an instance of the keeper for the functionality that is needed. If a keeper only needs to read in another module's store, a read-only keeper should be passed to it.

```go
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.stakeKeeper = simplestake.NewKeeper(app.capKeyStakingStore, app.coinKeeper,app.RegisterCodespace(simplestake.DefaultCodespace))
app.simpleGovKeeper = simpleGov.NewKeeper(app.capKeySimpleGovStore, app.coinKeeper, app.stakeKeeper, app.RegisterCodespace(simpleGov.DefaultCodespace))
app.bankKeeper = bank.NewKeeper(app.accountMapper)
app.stakeKeeper = simplestake.NewKeeper(app.capKeyStakingStore, app.bankKeeper,app.RegisterCodespace(simplestake.DefaultCodespace))
app.simpleGovKeeper = simpleGov.NewKeeper(app.capKeySimpleGovStore, app.bankKeeper, app.stakeKeeper, app.RegisterCodespace(simpleGov.DefaultCodespace))
```

- Declare the handlers.

```go
app.Router().
AddRoute("bank", bank.NewHandler(app.coinKeeper)).
AddRoute("bank", bank.NewHandler(app.bankKeeper)).
AddRoute("simplestake", simplestake.NewHandler(app.stakeKeeper)).
AddRoute("simpleGov", simpleGov.NewHandler(app.simpleGovKeeper))
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type SimpleGovApp struct {

// keepers
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
bankKeeper bank.Keeper
stakeKeeper simplestake.Keeper
simpleGovKeeper simpleGov.Keeper

Expand Down
8 changes: 4 additions & 4 deletions examples/basecoin/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type BasecoinApp struct {
// manage getting and setting accounts
accountMapper auth.AccountMapper
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
bankKeeper bank.Keeper
ibcMapper ibc.Mapper
}

Expand Down Expand Up @@ -67,13 +67,13 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.Ba
return &types.AppAccount{}
},
)
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.bankKeeper = bank.NewKeeper(app.accountMapper)
app.ibcMapper = ibc.NewMapper(app.cdc, app.keyIBC, app.RegisterCodespace(ibc.DefaultCodespace))

// register message routes
app.Router().
AddRoute("bank", bank.NewHandler(app.coinKeeper)).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper))
AddRoute("bank", bank.NewHandler(app.bankKeeper)).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.bankKeeper))

// perform initialization logic
app.SetInitChainer(app.initChainer)
Expand Down
14 changes: 7 additions & 7 deletions examples/democoin/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type DemocoinApp struct {

// keepers
feeCollectionKeeper auth.FeeCollectionKeeper
coinKeeper bank.Keeper
bankKeeper bank.Keeper
coolKeeper cool.Keeper
powKeeper pow.Keeper
ibcMapper ibc.Mapper
Expand Down Expand Up @@ -75,17 +75,17 @@ func NewDemocoinApp(logger log.Logger, db dbm.DB) *DemocoinApp {
)

// Add handlers.
app.coinKeeper = bank.NewKeeper(app.accountMapper)
app.coolKeeper = cool.NewKeeper(app.capKeyMainStore, app.coinKeeper, app.RegisterCodespace(cool.DefaultCodespace))
app.powKeeper = pow.NewKeeper(app.capKeyPowStore, pow.NewConfig("pow", int64(1)), app.coinKeeper, app.RegisterCodespace(pow.DefaultCodespace))
app.bankKeeper = bank.NewKeeper(app.accountMapper)
app.coolKeeper = cool.NewKeeper(app.capKeyMainStore, app.bankKeeper, app.RegisterCodespace(cool.DefaultCodespace))
app.powKeeper = pow.NewKeeper(app.capKeyPowStore, pow.NewConfig("pow", int64(1)), app.bankKeeper, app.RegisterCodespace(pow.DefaultCodespace))
app.ibcMapper = ibc.NewMapper(app.cdc, app.capKeyIBCStore, app.RegisterCodespace(ibc.DefaultCodespace))
app.stakeKeeper = simplestake.NewKeeper(app.capKeyStakingStore, app.coinKeeper, app.RegisterCodespace(simplestake.DefaultCodespace))
app.stakeKeeper = simplestake.NewKeeper(app.capKeyStakingStore, app.bankKeeper, app.RegisterCodespace(simplestake.DefaultCodespace))
app.Router().
AddRoute("bank", bank.NewHandler(app.coinKeeper)).
AddRoute("bank", bank.NewHandler(app.bankKeeper)).
AddRoute("cool", cool.NewHandler(app.coolKeeper)).
AddRoute("pow", app.powKeeper.Handler).
AddRoute("sketchy", sketchy.NewHandler()).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.coinKeeper)).
AddRoute("ibc", ibc.NewHandler(app.ibcMapper, app.bankKeeper)).
AddRoute("simplestake", simplestake.NewHandler(app.stakeKeeper))

// Initialize BaseApp.
Expand Down
4 changes: 2 additions & 2 deletions examples/democoin/x/cool/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func getMockApp(t *testing.T) *mock.App {

RegisterWire(mapp.Cdc)
keyCool := sdk.NewKVStoreKey("cool")
coinKeeper := bank.NewKeeper(mapp.AccountMapper)
keeper := NewKeeper(keyCool, coinKeeper, mapp.RegisterCodespace(DefaultCodespace))
bankKeeper := bank.NewKeeper(mapp.AccountMapper)
keeper := NewKeeper(keyCool, bankKeeper, mapp.RegisterCodespace(DefaultCodespace))
mapp.Router().AddRoute("cool", NewHandler(keeper))

mapp.SetInitChainer(getInitChainer(mapp, keeper, "ice-cold"))
Expand Down
4 changes: 2 additions & 2 deletions examples/democoin/x/pow/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ func getMockApp(t *testing.T) *mock.App {

RegisterWire(mapp.Cdc)
keyPOW := sdk.NewKVStoreKey("pow")
coinKeeper := bank.NewKeeper(mapp.AccountMapper)
bankKeeper := bank.NewKeeper(mapp.AccountMapper)
config := Config{"pow", 1}
keeper := NewKeeper(keyPOW, config, coinKeeper, mapp.RegisterCodespace(DefaultCodespace))
keeper := NewKeeper(keyPOW, config, bankKeeper, mapp.RegisterCodespace(DefaultCodespace))
mapp.Router().AddRoute("pow", keeper.Handler)

mapp.SetInitChainer(getInitChainer(mapp, keeper))
Expand Down
4 changes: 2 additions & 2 deletions examples/democoin/x/simplestake/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ type Keeper struct {
codespace sdk.CodespaceType
}

func NewKeeper(key sdk.StoreKey, coinKeeper bank.Keeper, codespace sdk.CodespaceType) Keeper {
func NewKeeper(key sdk.StoreKey, bankKeeper bank.Keeper, codespace sdk.CodespaceType) Keeper {
cdc := wire.NewCodec()
wire.RegisterCrypto(cdc)
return Keeper{
key: key,
cdc: cdc,
ck: coinKeeper,
ck: bankKeeper,
codespace: codespace,
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/democoin/x/simplestake/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func TestBonding(t *testing.T) {
ctx := sdk.NewContext(ms, abci.Header{}, false, log.NewNopLogger())

accountMapper := auth.NewAccountMapper(cdc, authKey, auth.ProtoBaseAccount)
coinKeeper := bank.NewKeeper(accountMapper)
stakeKeeper := NewKeeper(capKey, coinKeeper, DefaultCodespace)
bankKeeper := bank.NewKeeper(accountMapper)
stakeKeeper := NewKeeper(capKey, bankKeeper, DefaultCodespace)
addr := sdk.AccAddress([]byte("some-address"))
privKey := ed25519.GenPrivKey()
pubKey := privKey.PubKey()
Expand Down
4 changes: 2 additions & 2 deletions x/bank/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ func getBenchmarkMockApp() (*mock.App, error) {
mapp := mock.NewApp()

RegisterWire(mapp.Cdc)
coinKeeper := NewKeeper(mapp.AccountMapper)
mapp.Router().AddRoute("bank", NewHandler(coinKeeper))
bankKeeper := NewKeeper(mapp.AccountMapper)
mapp.Router().AddRoute("bank", NewHandler(bankKeeper))

err := mapp.CompleteSetup([]*sdk.KVStoreKey{})
return mapp, err
Expand Down
Loading

0 comments on commit e812919

Please sign in to comment.