-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
3,880 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package app_config | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/tendermint/tendermint/abci/types" | ||
|
||
"github.com/cosmos/cosmos-sdk/core/module/app" | ||
) | ||
|
||
type baseApp struct { | ||
ctx context.Context | ||
|
||
appModules map[string]app.Module | ||
beginBlockers []app.BeginBlocker | ||
endBlockers []app.EndBlocker | ||
} | ||
|
||
var _ types.Application = &baseApp{} | ||
|
||
func (a baseApp) Info(info types.RequestInfo) types.ResponseInfo { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) SetOption(option types.RequestSetOption) types.ResponseSetOption { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) Query(query types.RequestQuery) types.ResponseQuery { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) CheckTx(tx types.RequestCheckTx) types.ResponseCheckTx { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) InitChain(chain types.RequestInitChain) types.ResponseInitChain { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock { | ||
for _, bb := range a.beginBlockers { | ||
bb.BeginBlock(a.ctx, req) | ||
} | ||
} | ||
|
||
func (a baseApp) DeliverTx(tx types.RequestDeliverTx) types.ResponseDeliverTx { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) EndBlock(block types.RequestEndBlock) types.ResponseEndBlock { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) Commit() types.ResponseCommit { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) ListSnapshots(snapshots types.RequestListSnapshots) types.ResponseListSnapshots { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) OfferSnapshot(snapshot types.RequestOfferSnapshot) types.ResponseOfferSnapshot { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) LoadSnapshotChunk(chunk types.RequestLoadSnapshotChunk) types.ResponseLoadSnapshotChunk { | ||
panic("implement me") | ||
} | ||
|
||
func (a baseApp) ApplySnapshotChunk(chunk types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk { | ||
panic("implement me") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package app_config | ||
|
||
import ( | ||
"github.com/tendermint/tendermint/abci/types" | ||
|
||
"github.com/cosmos/cosmos-sdk/core/module" | ||
"github.com/cosmos/cosmos-sdk/core/module/app" | ||
) | ||
|
||
func Compose(config AppConfig) (types.Application, error) { | ||
moduleSet := module.NewModuleSet(config.Modules) | ||
|
||
appModules := make(map[string]app.Module) | ||
moduleSet.Each(func(name string, handler module.ModuleHandler) { | ||
// TODO | ||
}) | ||
|
||
bapp := &baseApp{} | ||
|
||
var beginBlockers []app.BeginBlocker | ||
for _, m := range config.Abci.BeginBlock { | ||
mod, ok := appModules[m] | ||
if !ok { | ||
panic("TODO") | ||
} | ||
|
||
beginBlocker, ok := mod.(app.BeginBlocker) | ||
if !ok { | ||
panic("TODO") | ||
} | ||
|
||
beginBlockers = append(beginBlockers, beginBlocker) | ||
} | ||
|
||
bapp.beginBlockers = beginBlockers | ||
|
||
return bapp, nil | ||
} |
Oops, something went wrong.