Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed May 27, 2021
1 parent c93b20e commit 66ce471
Show file tree
Hide file tree
Showing 15 changed files with 3,880 additions and 162 deletions.
73 changes: 73 additions & 0 deletions core/app_config/app.go
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")
}
38 changes: 38 additions & 0 deletions core/app_config/app_config.go
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
}
Loading

0 comments on commit 66ce471

Please sign in to comment.