Add IBC to basecoind
This commit is contained in:
parent
c409455150
commit
cd79574927
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/wire"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/examples/basecoin/x/cool"
|
||||
|
@ -55,10 +56,12 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB) *BasecoinApp {
|
|||
// add handlers
|
||||
coinKeeper := bank.NewCoinKeeper(app.accountMapper)
|
||||
coolMapper := cool.NewMapper(app.capKeyMainStore)
|
||||
ibcMapper := ibc.NewMapper(app.capKeyIBCStore)
|
||||
app.Router().
|
||||
AddRoute("bank", bank.NewHandler(coinKeeper)).
|
||||
AddRoute("cool", cool.NewHandler(coinKeeper, coolMapper)).
|
||||
AddRoute("sketchy", sketchy.NewHandler())
|
||||
AddRoute("sketchy", sketchy.NewHandler()).
|
||||
AddRoute("ibc", ibc.NewHandler(ibcMapper))
|
||||
|
||||
// initialize BaseApp
|
||||
app.SetTxDecoder(app.txDecoder)
|
||||
|
@ -83,12 +86,16 @@ func MakeCodec() *wire.Codec {
|
|||
const msgTypeIssue = 0x2
|
||||
const msgTypeQuiz = 0x3
|
||||
const msgTypeSetTrend = 0x4
|
||||
const msgTypeIBCTransferMsg = 0x5
|
||||
const msgTypeIBCReceiveMsg = 0x6
|
||||
var _ = oldwire.RegisterInterface(
|
||||
struct{ sdk.Msg }{},
|
||||
oldwire.ConcreteType{bank.SendMsg{}, msgTypeSend},
|
||||
oldwire.ConcreteType{bank.IssueMsg{}, msgTypeIssue},
|
||||
oldwire.ConcreteType{cool.QuizMsg{}, msgTypeQuiz},
|
||||
oldwire.ConcreteType{cool.SetTrendMsg{}, msgTypeSetTrend},
|
||||
oldwire.ConcreteType{ibc.IBCTransferMsg{}, msgTypeIBCTransferMsg},
|
||||
oldwire.ConcreteType{ibc.IBCReceiveMsg{}, msgTypeIBCReceiveMsg},
|
||||
)
|
||||
|
||||
const accTypeApp = 0x1
|
||||
|
|
|
@ -28,7 +28,7 @@ type IBCTransferMsg struct {
|
|||
}
|
||||
|
||||
func (msg IBCTransferMsg) Type() string {
|
||||
return "ibctransfer"
|
||||
return "ibc"
|
||||
}
|
||||
|
||||
func (msg IBCTransferMsg) Get(key interface{}) interface{} {
|
||||
|
@ -65,7 +65,7 @@ type IBCReceiveMsg struct {
|
|||
}
|
||||
|
||||
func (msg IBCReceiveMsg) Type() string {
|
||||
return "ibcreceive"
|
||||
return "ibc"
|
||||
}
|
||||
|
||||
func (msg IBCReceiveMsg) Get(key interface{}) interface{} {
|
||||
|
|
Loading…
Reference in New Issue