fill mvp1/2/3
This commit is contained in:
parent
927b869db9
commit
8b55006fca
|
@ -9,26 +9,32 @@ The initial implementation of IBC will include just enough for simple coin trans
|
||||||
### IBC Module
|
### IBC Module
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
type IBCOutMsg struct {
|
// User facing API
|
||||||
IBCTransfer
|
|
||||||
|
type IBCTransferPacket struct {
|
||||||
|
DestAddr sdk.Address
|
||||||
|
Coins sdk.Coins
|
||||||
}
|
}
|
||||||
|
|
||||||
type IBCInMsg struct {
|
type IBCTransferMsg struct {
|
||||||
IBCTransfer
|
IBCTransferPacket
|
||||||
|
DestChain string
|
||||||
}
|
}
|
||||||
|
|
||||||
type IBCTransfer struct {
|
type IBCReceiveMsg struct {
|
||||||
Destination sdk.Address
|
IBCTransferPacket
|
||||||
Coins sdk.Coins
|
SrcChain string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Internal API
|
||||||
|
|
||||||
type IBCMapper struct {
|
type IBCMapper struct {
|
||||||
ingressKey sdk.StoreKey // Source Chain ID => last income msg's sequence
|
ingressKey sdk.StoreKey // Source Chain ID => last income msg's sequence
|
||||||
egressKey sdk.StoreKey // (Dest chain ID, Msg index) => length / indexed msg
|
egressKey sdk.StoreKey // (Dest chain ID, Msg index) => length / indexed msg
|
||||||
}
|
}
|
||||||
|
|
||||||
type IngressKey struct {
|
type IngressKey struct {
|
||||||
SourceChain string
|
SrcChain string
|
||||||
}
|
}
|
||||||
|
|
||||||
type EgressKey struct {
|
type EgressKey struct {
|
||||||
|
|
|
@ -9,19 +9,34 @@ IBC module will store its own router for handling custom incoming msgs. `IBCPush
|
||||||
### IBC Module
|
### IBC Module
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
type IBCOutMsg struct {
|
// User facing API
|
||||||
IBCTransfer
|
|
||||||
|
type IBCTransferData struct {
|
||||||
|
SrcAddr sdk.Address
|
||||||
|
DestAddr sdk.Address
|
||||||
|
Coins sdk.Coins
|
||||||
}
|
}
|
||||||
|
|
||||||
type IBCInMsg struct {
|
// Implements sdk.Msg
|
||||||
IBCTransfer
|
type IBCTransferMsg struct {
|
||||||
|
IBCTransferData
|
||||||
}
|
}
|
||||||
|
|
||||||
type IBCTransfer struct {
|
// Implements sdk.Msg
|
||||||
Destination sdk.Address
|
type IBCReceiveMsg struct {
|
||||||
Coins sdk.Coins
|
IBCTransferData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IBCPacket struct {
|
||||||
|
Msg IBCMsg
|
||||||
|
SrcChain string
|
||||||
|
DestChain string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internal API
|
||||||
|
|
||||||
|
func NewHandler(router sdk.Router, ibcm IBCMapper) sdk.Handler
|
||||||
|
|
||||||
type IBCMapper struct {
|
type IBCMapper struct {
|
||||||
ingressKey sdk.StoreKey // Source Chain ID => last income msg's sequence
|
ingressKey sdk.StoreKey // Source Chain ID => last income msg's sequence
|
||||||
egressKey sdk.StoreKey // (Dest chain ID, Msg index) => length / indexed msg
|
egressKey sdk.StoreKey // (Dest chain ID, Msg index) => length / indexed msg
|
||||||
|
@ -36,6 +51,8 @@ type EgressKey struct {
|
||||||
Index int64
|
Index int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used by other modules
|
||||||
|
func (ibcm IBCMapper) PushPacket(ctx sdk.Context, dest string, packet IBCTransferPacket)
|
||||||
```
|
```
|
||||||
|
|
||||||
`egressKey` stores the outgoing `IBCTransfer`s as a list. Its getter takes an `EgressKey` and returns the length if `egressKey.Index == -1`, an element if `egressKey.Index > 0`.
|
`egressKey` stores the outgoing `IBCTransfer`s as a list. Its getter takes an `EgressKey` and returns the length if `egressKey.Index == -1`, an element if `egressKey.Index > 0`.
|
||||||
|
|
|
@ -2,10 +2,79 @@
|
||||||
|
|
||||||
## MVP3
|
## MVP3
|
||||||
|
|
||||||
`IBCOpen` is added to open the connection between two chains. Also, `IBCUpdate` is added, making it able to prove the header.
|
`IBCOpenMsg` is added to open the connection between two chains. Also, `IBCUpdateMsg` is added, making it able to prove the header.
|
||||||
|
|
||||||
### IBC Module
|
### IBC Module
|
||||||
|
|
||||||
|
```golang
|
||||||
|
// User facing API
|
||||||
|
|
||||||
|
type IBCTransferData struct {
|
||||||
|
SrcAddr sdk.Address
|
||||||
|
DestAddr sdk.Address
|
||||||
|
Coins sdk.Coins
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements sdk.Msg
|
||||||
|
type IBCTransferMsg struct {
|
||||||
|
IBCTransferData
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements sdk.Msg
|
||||||
|
type IBCReceiveMsg struct {
|
||||||
|
IBCTransferData
|
||||||
|
}
|
||||||
|
|
||||||
|
type IBCPacket struct {
|
||||||
|
Msg IBCMsg
|
||||||
|
SrcChain string
|
||||||
|
DestChain string
|
||||||
|
}
|
||||||
|
|
||||||
|
type RootOfTrust struct {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements sdk.Msg
|
||||||
|
type IBCOpenMsg struct {
|
||||||
|
ROT RootOfTrust
|
||||||
|
Chain string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements sdk.Msg
|
||||||
|
type IBCUpdateMsg struct {
|
||||||
|
Header tm.Header
|
||||||
|
Commit tm.Commit
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internal API
|
||||||
|
|
||||||
|
func NewHandler(router sdk.Router, ibcm IBCMapper) sdk.Handler
|
||||||
|
|
||||||
|
type IBCMapper struct {
|
||||||
|
ingressKey sdk.StoreKey // ChannelID => last income msg's sequence
|
||||||
|
egressKey sdk.StoreKey // (ChannelID, Msg index) => length / indexed msg
|
||||||
|
headerKey sdk.StoreKey // ChannelID => last known header
|
||||||
|
}
|
||||||
|
|
||||||
|
type IngressKey struct {
|
||||||
|
ChannelID uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type EgressKey struct {
|
||||||
|
ChannelID uint64
|
||||||
|
Index int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type HeaderKey struct {
|
||||||
|
ChannelID uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used by other modules
|
||||||
|
func (ibcm IBCMapper) PushPacket(ctx sdk.Context, dest string, packet IBCTransferPacket)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
```golang
|
```golang
|
||||||
type IBCOutMsg struct {
|
type IBCOutMsg struct {
|
||||||
IBCTransfer
|
IBCTransfer
|
||||||
|
|
Loading…
Reference in New Issue