From 638326d94ebe0e564da9e49fdb692ca558d3e19a Mon Sep 17 00:00:00 2001 From: Tomasz Kulik Date: Wed, 7 May 2025 11:59:04 +0200 Subject: [PATCH] docs: IBCv2 documentation structure --- src/pages/_meta.jsx | 1 + src/pages/ibc2/_meta.js | 6 +++ src/pages/ibc2/entrypoints.mdx | 66 ++++++++++++++++++++++++++++++ src/pages/ibc2/example.mdx | 7 ++++ src/pages/ibc2/getting-started.mdx | 21 ++++++++++ src/pages/ibc2/message-passing.mdx | 18 ++++++++ 6 files changed, 119 insertions(+) create mode 100644 src/pages/ibc2/_meta.js create mode 100644 src/pages/ibc2/entrypoints.mdx create mode 100644 src/pages/ibc2/example.mdx create mode 100644 src/pages/ibc2/getting-started.mdx create mode 100644 src/pages/ibc2/message-passing.mdx diff --git a/src/pages/_meta.jsx b/src/pages/_meta.jsx index d1623ea1..f8bff71b 100644 --- a/src/pages/_meta.jsx +++ b/src/pages/_meta.jsx @@ -5,6 +5,7 @@ export default { core: "CosmWasm Core", wasmd: "Wasmd", ibc: "IBC", + ibc2: "IBCv2", sylvia: "Sylvia", storey: "Storey", "cw-storage-plus": "StoragePlus", diff --git a/src/pages/ibc2/_meta.js b/src/pages/ibc2/_meta.js new file mode 100644 index 00000000..a198f59c --- /dev/null +++ b/src/pages/ibc2/_meta.js @@ -0,0 +1,6 @@ +export default { + "getting-started": "Getting started", + "entrypoints": "Entry points", + "message-passing": "Message passing", + "example": "Example contract", +}; diff --git a/src/pages/ibc2/entrypoints.mdx b/src/pages/ibc2/entrypoints.mdx new file mode 100644 index 00000000..d8e8a01e --- /dev/null +++ b/src/pages/ibc2/entrypoints.mdx @@ -0,0 +1,66 @@ +--- +tags: ["ibc"] +--- + +# Entry points in IBCv2 + +There are 4 entry points specified in the IBCv2 protocol. + +## Receive entry point +```rust template="core" +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn ibc2_packet_receive( + deps: DepsMut, + env: Env, + msg: Ibc2PacketReceiveMsg, +) -> StdResult { + // [...] +} +``` + + * TODO tkulik: Describe `Ibc2PacketReceiveMsg` + +## Time out entry point + +```rust template="core" +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn ibc2_packet_timeout( + deps: DepsMut, + env: Env, + msg: Ibc2PacketTimeoutMsg, +) -> StdResult { + // [...] +``` + +* TODO tkulik: Describe `Ibc2PacketTimeoutMsg` + +## Acknowledgement receive entry point + +```rust template="core" +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn ibc2_acknowledge_receive( + deps: DepsMut, + env: Env, + msg: Ibc2AcknowledgeMsg, +) -> StdResult { + // [...] +} +``` + +* TODO tkulik: Describe `Ibc2AcknowledgeMsg` + + +## Sent entry point + +```rust template="core" +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn ibc2_packet_sent( + deps: DepsMut, + env: Env, + msg: Ibc2PacketSentMsg, +) -> StdResult { + // [...] +} +``` + +* TODO tkulik: Describe `Ibc2SentMsg` \ No newline at end of file diff --git a/src/pages/ibc2/example.mdx b/src/pages/ibc2/example.mdx new file mode 100644 index 00000000..1e5b7b56 --- /dev/null +++ b/src/pages/ibc2/example.mdx @@ -0,0 +1,7 @@ +--- +tags: ["ibc"] +--- + +# Example contract + +* TODO tkulik: Example implementation of the ibc2 entry points \ No newline at end of file diff --git a/src/pages/ibc2/getting-started.mdx b/src/pages/ibc2/getting-started.mdx new file mode 100644 index 00000000..d30b581b --- /dev/null +++ b/src/pages/ibc2/getting-started.mdx @@ -0,0 +1,21 @@ +--- +tags: ["ibc"] +--- + +import { Callout } from "nextra/components"; + +# Getting started + +CosmWasm module uses [ibc-go](https://ibc.cosmos.network/main/) implementation to interact with other blockchains via IBC protocol. +Along with ibc-go version 10 a new protocol version was announced - [IBCv2](https://ibcprotocol.dev/blog/ibc-v2-announcement). +The new version allows interaction between Cosmos and non-Cosmos blockchains. To achieve this goal, +the protocol team decided to simplify the flow and reduce number of entry points. +Thanks to this update, now it's feasible to implement appropriate endpoints on chains like for e.g. Ethereum. +Side effect for the contract developers is the fact, that there are only few entry points to implement in smart contracts +in order to take full advantage of the blockchain interconnections. + + +This section of a documentation provides a basic information on how to set up contracts to use IBCv2 entry points and how +to communicate with services and contracts on different chains. To learn more about the IBC architecture we recommend +to visit the [official ibc-go documentation page](https://ibc.cosmos.network/main/). + diff --git a/src/pages/ibc2/message-passing.mdx b/src/pages/ibc2/message-passing.mdx new file mode 100644 index 00000000..a463df98 --- /dev/null +++ b/src/pages/ibc2/message-passing.mdx @@ -0,0 +1,18 @@ +--- +tags: ["ibc"] +--- + +# Message passing + +Smart contract can send IBCv2 messages from entry points we Message + +## Send IBCv2 messages + + + +## Entry point usage for sent messages + +The special entry point `ibc2_packet_sent` is called + +* TODO tkulik: How to send ibcv2 message +* TODO tkulik: How to send acknowledgement asynchronously \ No newline at end of file