-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IBC Ping Pong contract demo (#259)
* IBC callback redesign * Add ping pong ibc example * Cleanup some commented out code * Apply review feedback * Revert unintended renamings
- Loading branch information
Showing
20 changed files
with
892 additions
and
488 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
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
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
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
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 |
---|---|---|
@@ -1,42 +1,74 @@ | ||
package cosmwasm | ||
|
||
import ( | ||
wasmTypes "github.com/CosmWasm/go-cosmwasm/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
cosmwasmv1 "github.com/CosmWasm/go-cosmwasm/types" | ||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types" | ||
) | ||
|
||
type IBCEndpoint struct { | ||
Channel string `json:"channel"` | ||
Port string `json:"port"` | ||
} | ||
|
||
type IBCChannel struct { | ||
Endpoint IBCEndpoint | ||
CounterpartyEndpoint IBCEndpoint | ||
Order channeltypes.Order | ||
Version string | ||
// CounterpartyVersion can be nil when not known this context, yet | ||
CounterpartyVersion *string `json:"counterparty_version,omitempty"` | ||
} | ||
|
||
type IBCPacket struct { | ||
Data []byte | ||
// identifies the channel and port on the sending chain. | ||
Source IBCEndpoint | ||
// identifies the channel and port on the receiving chain. | ||
Destination IBCEndpoint | ||
Sequence uint64 | ||
// block height after which the packet times out | ||
TimeoutHeight uint64 | ||
// block timestamp (in nanoseconds) after which the packet times out | ||
TimeoutTimestamp uint64 | ||
} | ||
|
||
type IBCAcknowledgement struct { | ||
Acknowledgement []byte `json:"acknowledgement"` | ||
OriginalPacket IBCPacket `json:"original_packet"` | ||
} | ||
|
||
type IBCPacketReceiveResponse struct { | ||
// Acknowledgement contains the data to acknowledge the ibc packet execution | ||
Acknowledgement []byte `json:"acknowledgement"` | ||
// Messages comes directly from the contract and is it's request for action | ||
Messages []sdk.Msg `json:"messages,omitempty"` | ||
Messages []CosmosMsg `json:"messages,omitempty"` | ||
// Log contains event attributes to expose over abci interface | ||
Log []wasmTypes.LogAttribute `json:"log,omitempty"` | ||
Log []cosmwasmv1.LogAttribute `json:"log,omitempty"` | ||
} | ||
|
||
type IBCPacketAcknowledgementResponse struct { | ||
Messages []sdk.Msg `json:"messages"` | ||
Log []wasmTypes.LogAttribute `json:"log"` | ||
Messages []CosmosMsg `json:"messages"` | ||
Log []cosmwasmv1.LogAttribute `json:"log"` | ||
} | ||
|
||
type IBCPacketTimeoutResponse struct { | ||
Messages []sdk.Msg `json:"messages"` | ||
Log []wasmTypes.LogAttribute `json:"log"` | ||
Messages []CosmosMsg `json:"messages"` | ||
Log []cosmwasmv1.LogAttribute `json:"log"` | ||
} | ||
|
||
type IBCChannelOpenResponse struct { | ||
// Result contains a boolean if the channel would be accepted | ||
Result bool `json:"result"` | ||
// Success contains a boolean if the channel would be accepted | ||
Success bool `json:"result"` | ||
// Reason optional description why it was not accepted | ||
Reason string `json:"reason"` | ||
} | ||
|
||
type IBCChannelConnectResponse struct { | ||
Messages []sdk.Msg `json:"messages"` | ||
Log []wasmTypes.LogAttribute `json:"log"` | ||
Messages []CosmosMsg `json:"messages"` | ||
Log []cosmwasmv1.LogAttribute `json:"log"` | ||
} | ||
|
||
type IBCChannelCloseResponse struct { | ||
Messages []sdk.Msg `json:"messages"` | ||
Log []wasmTypes.LogAttribute `json:"log"` | ||
Messages []CosmosMsg `json:"messages"` | ||
Log []cosmwasmv1.LogAttribute `json:"log"` | ||
} |
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
Oops, something went wrong.