Skip to content

Commit

Permalink
Merge pull request #44 from sora-xor/7-substrate-bridge-documentation
Browse files Browse the repository at this point in the history
Substrate bridge documentation
  • Loading branch information
bgodlin authored Oct 30, 2023
2 parents 2aac0d7 + 8572595 commit 9bc381a
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 44 deletions.
56 changes: 35 additions & 21 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default withMermaid(
description: "Your Gateway to Knowledge about the SORA Network",
head: [
["meta", { name: "keywords", content: "SORA ecosystem" }],
['link', { rel: 'icon', href: '/favicon.ico', sizes: 'any' }],
['link', { rel: 'icon', href: '/icon.svg', sizes: 'image/svg+xml' }],
['link', { ref: 'apple-touch-icon', href: '/apple-touch-icon.png' }],
["link", { rel: "icon", href: "/favicon.ico", sizes: "any" }],
["link", { rel: "icon", href: "/icon.svg", sizes: "image/svg+xml" }],
["link", { ref: "apple-touch-icon", href: "/apple-touch-icon.png" }],
],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
Expand Down Expand Up @@ -144,10 +144,13 @@ export default withMermaid(
text: "Staking in Fearless Wallet",
link: "stake-in-fearless-wallet",
},
{ text: "Nominating Validators", link: "nominating-validators" },
{
text: "Nominating Validators",
link: "nominating-validators",
},
],
},

{
text: "DEX",
items: [
Expand All @@ -157,41 +160,46 @@ export default withMermaid(
link: "provide-liquidity-to-xyk-pools",
},
{ text: "Advanced Trading", link: "advanced-trading" },

{
text: "Other Polkaswap Features",
link: "polkaswap-other-features",
},
],
},
{
text: "Interoperability",
text: "Interoperability (HASHI)",
link: "interoperability",
items: [
{
text: "EVM",
link: "evm",
items: [
{
text: "HASHI",
text: "Ethereum",
items: [
{
text: "Adding a Token",
link: "adding-tokens-to-hashi-bridge",
},
{
text: "Become a Relayer",
},

{
text: "Fixing a Stuck Transaction",
link: "unstuck-bridge-tx",
},
],
},
{ text: "Trustless" },
],
},
{ text: "Substrate", items: [{ text: "Become a Relayer" }] },
{
text: "Substrate",
link: "substrate-bridge",
items: [
{
text: "Establishing HRMP channel",
link: "establishing-hrmp-channel",
},
],
},
],
},
{ text: "Referral System", link: "/referral" },
Expand All @@ -207,7 +215,10 @@ export default withMermaid(
items: [
{ text: "Overview", link: "polkaswap" },
{ text: "Connect Wallet", link: "polkaswap-connect-wallet" },
{ text: "Connect with Google", link: "polkaswap-connect-with-google" },
{
text: "Connect with Google",
link: "polkaswap-connect-with-google",
},
{
text: "Send & Receive",
link: "send-and-receive-polkaswap",
Expand All @@ -227,7 +238,7 @@ export default withMermaid(
{ text: "Demeter Staking", link: "demeter-staking-polkaswap" },
],
},

{
text: "DEX",
items: [
Expand All @@ -236,8 +247,11 @@ export default withMermaid(
text: "Provide Liquidity to XYK Pools",
link: "provide-liquidity-to-xyk-pools-polkaswap",
},
{ text: "Advanced Trading", link: "advanced-trading-polkaswap" },

{
text: "Advanced Trading",
link: "advanced-trading-polkaswap",
},

{
text: "Other Polkaswap Features",
link: "polkaswap-other-features",
Expand Down Expand Up @@ -285,7 +299,7 @@ export default withMermaid(
],
},
],

socialLinks: [
{ icon: "github", link: "https://github.com/sora-xor/sora-docs" },
],
Expand All @@ -300,8 +314,8 @@ export default withMermaid(
outlineTitle: "Page Contents",
docFooter: {
prev: false,
next: false
}
next: false,
},
},
srcDir: "./src",
lastUpdated: true,
Expand Down
2 changes: 1 addition & 1 deletion src/architecture/interoperability/evm.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This page was moved to [EVM](../../evm).
This page was moved to [EVM](../interoperability).
Binary file added src/assets/fundsReceivedOnParachain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sidechain-token-registration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/substrate-bridge-components.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/thischain-token-registration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/token-burn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/transfer-to-parachain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/xcmMessageDispatchedOnMainnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/xcmMessageSent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions src/establishing-hrmp-channel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Establish an HRMP channel

To establish communication between your parachain and SORA, you must create HRMP channels that go through the Relay Chain to transfer messages between parachains.

Remember that HRMP channels usually go in one direction. For two-way communication, you'll need to set up another channel going the opposite way. Therefore, the following is split into sub-sections:

## Your Parachain to SORA

1. Obtain the encoded call data of the `hrmp.hrmpInitOpenChannel` extrinsic on the relay chain.

This unique code includes a `recipient` detail telling the relay chain which parachain you want to connect to. The recipient changes depending on what environment you are planning to establish the channel in. For Kusama, look at [this list](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fksm-rpc.stakeworld.io#/parachains), and for Rococo, go to [this list](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-rpc.polkadot.io#/parachains).

Combine this parachain id with the other info from the documentation. For example, for Rococo you'll have something like this: `0x3c00db070000e803000000900100`.

2. Within your parachain, compose an XCM message that notifies the relay chain about the intent to open a channel with SORA. Refer to the [official documentation](https://docs.substrate.io/reference/how-to-guides/parachains/add-hrmp-channels/) for an illustrative example of the XCM message.

::: info

It is important to acknowledge that if your implementation of HRMP channel logic differs from the standard `polkadotXcm.send` pallet; you should modify this step accordingly.

:::

Once the extrinsic executes successfully, SORA needs to accept the channel establishment.

3. Subsequently, the SORA team will accept the channel by incorporating the encoded call data of `hrmp.hrmpAcceptOpenChannel`. This data will feature your parachain's ID as a parameter and will be executed via the `xcmApp.sudoSendXCM` call.

Upon successful execution, (an) HRMP channel(s) will be established from your parachain to SORA.

## SORA to Your Parachain

The steps here mirror those from the preceding sub-section. For steps (1) and (2) outlined earlier, SORA initiates an XCM message to propose channel establishment. Subsequently, it's your responsibility to encode `hrmp.hrmpAcceptOpenChannel` with SORA's parachain ID. For instance, in the case of Rococo, the encoded call data would be: `0x3c01db070000`. Execute an XCM message from your parachain in alignment with the [official guidelines](https://docs.substrate.io/reference/how-to-guides/parachains/add-hrmp-channels/), including the encoded call data containing SORA's parachain ID.

Upon successful execution of this process, your parachain will be set up to receive messages from the SORA parachain.

We will still need to register the assets to be transferred from one chain to another. On your parachain, you will need to register the SORA assets. On the SORA Mainnet, we will need to register your assets.
21 changes: 0 additions & 21 deletions src/evm.md

This file was deleted.

Loading

1 comment on commit 9bc381a

@vercel
Copy link

@vercel vercel bot commented on 9bc381a Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sora-docs – ./

sora-docs.vercel.app
sora-docs-sora-team.vercel.app
sora-docs-git-develop-sora-team.vercel.app

Please sign in to comment.