diff --git a/docs/develop/README.mdx b/docs/develop/README.mdx index 310c4230..3dd7d102 100644 --- a/docs/develop/README.mdx +++ b/docs/develop/README.mdx @@ -30,9 +30,9 @@ import { # Introduction -The guides on this page will explain the process of developing on Router's CrossTalk and Voyager framework. The CrossTalk framework +The guides on this page will explain the process of developing via Router's CrossTalk and Nitro. The CrossTalk framework leverages Router's infrastructure to allow contracts on one chain to send intructions to contracts deployed on some other chain. On the other hand, -Voyager is the native cross-chain asset-transfer bridge built using Router. It acts as the gateway to the liquidity managed by Router Protocol and allows +Nitro is the native cross-chain asset-transfer bridge built using Router. It acts as the gateway to the liquidity managed by Router Protocol and allows projects to execute cross-chain transactions which involve both fund transfer and instruction transfer. If you're new here or you're not sure if CrossTalk is compatible with your requirements, check out [this guide](../overview/choosing-the-right-framework) to figure out @@ -113,19 +113,19 @@ the best cross-chain framework for your dApp.
} /> } /> } @@ -133,30 +133,31 @@ the best cross-chain framework for your dApp.
-## Asset Transfer +## Asset Transfer via Nitro
} /> - } + /> + {/* + } /> - } - /> - {/* } /> } /> } />
@@ -198,16 +199,16 @@ the best cross-chain framework for your dApp.
- } - /> } + /> + } />
@@ -219,7 +220,7 @@ the best cross-chain framework for your dApp.
} svgFile="/icons/api.svg" @@ -227,7 +228,7 @@ the best cross-chain framework for your dApp. } svgFile="/icons/api.svg" /> diff --git a/docs/develop/asset-transfer/README.md b/docs/develop/asset-transfer-via-nitro/README.md similarity index 82% rename from docs/develop/asset-transfer/README.md rename to docs/develop/asset-transfer-via-nitro/README.md index e0ea552d..c1d0be35 100644 --- a/docs/develop/asset-transfer/README.md +++ b/docs/develop/asset-transfer-via-nitro/README.md @@ -1,6 +1,6 @@ --- title: Overview -sidebar_position: 2 +sidebar_position: 1 description: Intro to Router's Asset Transfer Bridges --- @@ -11,10 +11,10 @@ Without a robust mechanism that promotes dynamic liquidity migration across vari ## About Router's Asset Transfer Bridges Both generation of Router's cross-chain swapping engines facilitate cross-chain asset transfers as well as sequenced cross-chain asset and instruction transfers. -### Voyager (1st Generation Asset Transfer Bridge) -Voyager uses lock/unlock and burn/mint mechanism to transfer funds from one chain to another. Before funds are unlocked/minted to a user's wallet on the destination chain, a set of nodes attest the validity of the user's source chain deposit. For example, if a user wants to transfer ROUTE from Avalanche to Arbitrum, Voyager would burn user's ROUTE on Arbitrum and mint an equivalent amount of ROUTE on Arbitrum. +### Voyager (1st Generation Bridge) +Voyager (now decommissioned) used lock/unlock and burn/mint mechanism to transfer funds from one chain to another. Before funds are unlocked/minted to a user's wallet on the destination chain, a set of nodes attested the validity of the user's source chain deposit. For example, if a user wanted to transfer ROUTE from Avalanche to Arbitrum, Voyager would burn user's ROUTE on Arbitrum and mint an equivalent amount of ROUTE on Arbitrum. -### Nitro (2nd Generation Asset Transfer Bridge) +### Nitro (2nd Generation Bridge) Nitro uses a trustless approach to handle cross-chain asset transfers. In this approach, an entity called the forwarder provides the user with the desired asset on the destination chain. Once the forwarder's settlement on the destination chain is verified, it can claim the funds deposited by the user on the source chain. This approach is highly optimized in terms of latency and cost involved (for smart contract operations). As mentioned above, in addition to asset transfers, both these bridges also allow users to perform operations after the transfer of tokens is executed on the destination chain without any external triggers. This opens up a multitude of possibilities for the emerging chain-agnostic future. diff --git a/docs/develop/asset-transfer/_category_.json b/docs/develop/asset-transfer-via-nitro/_category_.json similarity index 61% rename from docs/develop/asset-transfer/_category_.json rename to docs/develop/asset-transfer-via-nitro/_category_.json index 909fc3e1..d92f0943 100644 --- a/docs/develop/asset-transfer/_category_.json +++ b/docs/develop/asset-transfer-via-nitro/_category_.json @@ -1,9 +1,9 @@ { - "label": "Asset Transfer", + "label": "Asset Transfer via Nitro", "position": 4, "link": { "type": "generated-index", - "description": "This section of the documentation will provide an in-depth view of Router's asset transfer bridges." + "description": "This section of the documentation will provide an in-depth view of Router Nitro." } } \ No newline at end of file diff --git a/docs/develop/asset-transfer-via-nitro/assetbridge-contract-addresses.md b/docs/develop/asset-transfer-via-nitro/assetbridge-contract-addresses.md new file mode 100644 index 00000000..376edc50 --- /dev/null +++ b/docs/develop/asset-transfer-via-nitro/assetbridge-contract-addresses.md @@ -0,0 +1,30 @@ +--- +title: AssetBridge Contract Addresses +sidebar_position: 7 +--- + +## Mainet + + +| **Chain** | **Chain Id** | **AssetBridge Contract Address** +| ------------------- | ---------------------------------------------- | --------------------------- | +| Ethereum | 1 | `0xf9f4c3dc7ba8f56737a92d74fd67230c38af51f2` | +| Optimism | 10 | `0x21c1e74caadf990e237920d5515955a024031109` | +| Arthera | 10242 | `0x27902308573d4f21b4a98fa7121d04fa7e7bb20e` | +| Polygon zkEVM | 1101 | `0x958cae900315e85f6d00228c48e237822f9c22f8` | +| Polygon | 137 | `0xa62ec33abd6d7ebdf8ec98ce874820517ae71e4d` | +| Manta | 169 | `0xf3ad01cf8e4d3ef95f5d480ec534dd98caa0555f` | +| Boba ETH | 288 | `0x8c4acd74ff4385f3b7911432fa6787aa14406f8b` | +| Rootstock | 30 | `0x7bd616192fb2b364f9d29b2026165281a5f2ff2f` | +| zkSync | 324 | `0xca9e3756b9e20f9edb204523210af736839b07e9` | +| Mode | 34443 | `0xff13a7a12fd485bc9687ff88d8ae1a6b655ab469` | +| Arbitrum | 42161 | `0x0fa205c0446cd9eedcc7538c9e24bc55ad08207f` | +| Avalanche | 43114 | `0x8c4acd74ff4385f3b7911432fa6787aa14406f8b` | +| Mantle | 5000 | `0x97eec1c29f745dc7c267f90292aa663d997a601d` | +| Scroll | 534352 | `0x96cf38d1bf822f7ccd31f8a5dca1bdce968d7730` | +| BNB Chain | 56 | `0x21c1e74caadf990e237920d5515955a024031109` | +| Linea | 59144 | `0x01b4ce0d48ce91eb6bcaf5db33870c65d641b894` | +| Saakuru | 7225878 | `0x260687ebc6c55dadd578264260f9f6e968f7b2a5` | +| Tron | 728126428 | `0x02059ddcd0ed02e4eee4a050fddc200df4e8a37b` | +| Blast | 81457 | `0x67f6cf80f64b29d4a5c3b004b27d8057809e2820` | +| Base | 8453 | `0x21c1e74caadf990e237920d5515955a024031109` | diff --git a/docs/develop/asset-transfer/nitro/different-functions/README.md b/docs/develop/asset-transfer-via-nitro/different-flows/README.md similarity index 68% rename from docs/develop/asset-transfer/nitro/different-functions/README.md rename to docs/develop/asset-transfer-via-nitro/different-flows/README.md index b407687b..0a41417d 100644 --- a/docs/develop/asset-transfer/nitro/different-functions/README.md +++ b/docs/develop/asset-transfer-via-nitro/different-flows/README.md @@ -3,6 +3,6 @@ title: Different Functions --- The Nitro contract has three user facing functions which we will discuss in detail in this section: -- [Transfer of USDC via Circle's Burn and Mint Flow](./different-functions/transfer-usdc-via-circle) -- [Transfer of Tokens via the Reverse Verification Mechanism](./different-functions/transfer-tokens-via-reverse-verification) -- [Transfer of Tokens with an Arbitrary Instruction](./different-functions/transfer-token-with-arbitrary-instruction) +- [Transfer of USDC via Circle's Burn and Mint Flow](./different-flows/transfer-usdc-via-circle) +- [Transfer of Tokens via the Reverse Verification Mechanism](./different-flows/transfer-tokens-via-reverse-verification) +- [Transfer of Tokens with an Arbitrary Instruction](./different-flows/transfer-token-with-arbitrary-instruction) diff --git a/docs/develop/asset-transfer-via-nitro/different-flows/_category_.json b/docs/develop/asset-transfer-via-nitro/different-flows/_category_.json new file mode 100644 index 00000000..20e96b95 --- /dev/null +++ b/docs/develop/asset-transfer-via-nitro/different-flows/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Different Flows", + "position": 3 + } \ No newline at end of file diff --git a/docs/develop/asset-transfer/nitro/different-functions/transfer-token-with-arbitrary-instruction.md b/docs/develop/asset-transfer-via-nitro/different-flows/transfer-token-with-arbitrary-instruction.md similarity index 97% rename from docs/develop/asset-transfer/nitro/different-functions/transfer-token-with-arbitrary-instruction.md rename to docs/develop/asset-transfer-via-nitro/different-flows/transfer-token-with-arbitrary-instruction.md index b2a7dbbf..8c283c0e 100644 --- a/docs/develop/asset-transfer/nitro/different-functions/transfer-token-with-arbitrary-instruction.md +++ b/docs/develop/asset-transfer-via-nitro/different-flows/transfer-token-with-arbitrary-instruction.md @@ -22,7 +22,7 @@ The flow is just the same as that of the token transfer explained before. The on | partnerId | Unique ID for each partner who integrates this functionality and has a fee sharing model with Router. This helps them to track and analyze their cross-chain transactions easily. | | --------------- | -------------------------------------------------------------------------------------- | -| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens.md). | +| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens). | | recipient | Wallet address that will receive the tokens on the destination chain. | | srcToken | Address of the token that has to be transferred from the source chain. | | amount | Decimal-adjusted amount of the token that has to be transferred from the source chain. | diff --git a/docs/develop/asset-transfer/nitro/different-functions/transfer-tokens-via-reverse-verification.md b/docs/develop/asset-transfer-via-nitro/different-flows/transfer-tokens-via-reverse-verification.md similarity index 95% rename from docs/develop/asset-transfer/nitro/different-functions/transfer-tokens-via-reverse-verification.md rename to docs/develop/asset-transfer-via-nitro/different-flows/transfer-tokens-via-reverse-verification.md index a11cc32a..1d311359 100644 --- a/docs/develop/asset-transfer/nitro/different-functions/transfer-tokens-via-reverse-verification.md +++ b/docs/develop/asset-transfer-via-nitro/different-flows/transfer-tokens-via-reverse-verification.md @@ -21,7 +21,7 @@ Voyager enables cross-chain transfers of multiple tokens via this function. When | partnerId | Unique ID for each partner who integrates this functionality and has a fee sharing model with Router. This helps them to track and analyze their cross-chain transactions easily. | | --------------- | -------------------------------------------------------------------------------------- | -| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens.md). | +| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens). | | recipient | Wallet address that will receive the tokens on the destination chain. | | srcToken | Address of the token that has to be transferred from the source chain. | | amount | Decimal-adjusted amount of the token that has to be transferred from the source chain. | diff --git a/docs/develop/asset-transfer/nitro/different-functions/transfer-usdc-via-circle.md b/docs/develop/asset-transfer-via-nitro/different-flows/transfer-usdc-via-circle.md similarity index 89% rename from docs/develop/asset-transfer/nitro/different-functions/transfer-usdc-via-circle.md rename to docs/develop/asset-transfer-via-nitro/different-flows/transfer-usdc-via-circle.md index 523ac09d..c78b5a9e 100644 --- a/docs/develop/asset-transfer/nitro/different-functions/transfer-usdc-via-circle.md +++ b/docs/develop/asset-transfer-via-nitro/different-flows/transfer-usdc-via-circle.md @@ -2,7 +2,7 @@ title: Transfer of USDC via Circle's Burn and Mint Flow sidebar_position: 1 --- -import RelayerAPIData from '../../../../../src/utils/RelayerFees' +import RelayerAPIData from '../../../../src/utils/RelayerFees' ```javascript @@ -22,6 +22,6 @@ When a user wants to transfer USDC between the aforementioned chains, the `iDepo | partnerId | Unique ID for each partner who integrates this functionality and has a fee sharing model with Router. This helps them to track and analyze their cross-chain transactions easily. | | --------------- | -------------------------------------------------------------------------------------- | -| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens.md). | +| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens). | | recipient | Wallet address that will receive the tokens on the destination chain. | | amount | Decimal-adjusted amount of the USDC tokens that have to be transferred. | \ No newline at end of file diff --git a/docs/develop/asset-transfer/nitro/fee-management.md b/docs/develop/asset-transfer-via-nitro/fee-management.md similarity index 99% rename from docs/develop/asset-transfer/nitro/fee-management.md rename to docs/develop/asset-transfer-via-nitro/fee-management.md index 72a3e798..969945f3 100644 --- a/docs/develop/asset-transfer/nitro/fee-management.md +++ b/docs/develop/asset-transfer-via-nitro/fee-management.md @@ -1,6 +1,6 @@ --- title: Fee Management -sidebar_position: 7 +sidebar_position: 8 --- The total Nitro fee is composed of three parts: diff --git a/docs/develop/asset-transfer/voyager/guides/_category_.json b/docs/develop/asset-transfer-via-nitro/guides/_category_.json similarity index 60% rename from docs/develop/asset-transfer/voyager/guides/_category_.json rename to docs/develop/asset-transfer-via-nitro/guides/_category_.json index 1daa6f2c..c2af63bb 100644 --- a/docs/develop/asset-transfer/voyager/guides/_category_.json +++ b/docs/develop/asset-transfer-via-nitro/guides/_category_.json @@ -1,4 +1,4 @@ { "label": "Guides", - "position": 8 + "position": 5 } \ No newline at end of file diff --git a/docs/develop/asset-transfer/nitro/guides/crosschain-staking.md b/docs/develop/asset-transfer-via-nitro/guides/crosschain-staking.md similarity index 99% rename from docs/develop/asset-transfer/nitro/guides/crosschain-staking.md rename to docs/develop/asset-transfer-via-nitro/guides/crosschain-staking.md index 5ef79a74..68e5d5eb 100644 --- a/docs/develop/asset-transfer/nitro/guides/crosschain-staking.md +++ b/docs/develop/asset-transfer-via-nitro/guides/crosschain-staking.md @@ -195,7 +195,7 @@ It is the `iStake` function that: Let us understand the parameters of `iStake` function one by one: -| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens.md). | +| destChainIdBytes | Network IDs of the chains in bytes32 format. These can be found [here](../supported-chains-tokens). | | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | amount | Decimal-adjusted amount of the token that has to be transferred from the source chain. | | destAmount | Amount of tokens (in source chain decimals) expected to be received by the recipient on the destination chain. This can be calculated using the Nitro's PathFinder API. A small script has been added in the scripts folder of the [github repository](https://github.com/router-protocol/sequencer-staking/tree/main/scripts) to calculate the destination amount. Refer to the [**Fee Management**](../fee-management.md) section for more details. | diff --git a/docs/develop/asset-transfer/nitro/high-level-workflow.md b/docs/develop/asset-transfer-via-nitro/high-level-workflow.md similarity index 99% rename from docs/develop/asset-transfer/nitro/high-level-workflow.md rename to docs/develop/asset-transfer-via-nitro/high-level-workflow.md index e9893342..57ad0bd9 100644 --- a/docs/develop/asset-transfer/nitro/high-level-workflow.md +++ b/docs/develop/asset-transfer-via-nitro/high-level-workflow.md @@ -1,6 +1,6 @@ --- title: High-level Workflow -sidebar_position: 1 +sidebar_position: 2 --- ## Reverse Verification Flow diff --git a/docs/develop/asset-transfer/nitro/img/burn-and-mint.png b/docs/develop/asset-transfer-via-nitro/img/burn-and-mint.png similarity index 100% rename from docs/develop/asset-transfer/nitro/img/burn-and-mint.png rename to docs/develop/asset-transfer-via-nitro/img/burn-and-mint.png diff --git a/docs/develop/asset-transfer/nitro/img/trustless-nitro.png b/docs/develop/asset-transfer-via-nitro/img/trustless-nitro.png similarity index 100% rename from docs/develop/asset-transfer/nitro/img/trustless-nitro.png rename to docs/develop/asset-transfer-via-nitro/img/trustless-nitro.png diff --git a/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/_category_.json b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/_category_.json new file mode 100644 index 00000000..542d9fd7 --- /dev/null +++ b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Managing Cross-chain Tokens", + "position": 4 + } \ No newline at end of file diff --git a/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/building-a-cross-chain-token-using-router.md b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/building-a-cross-chain-token-using-router.md new file mode 100644 index 00000000..a78a9d1a --- /dev/null +++ b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/building-a-cross-chain-token-using-router.md @@ -0,0 +1,50 @@ +--- +title: 1) Building a Cross-chain Token using Router +sidebar_position: 1 +--- + +In this guide, we'll walk you through the process of building and deploying cross-chain tokens using Router Protocol. For this you have to first deploy a basic ERC20 token with access control roles, such as the minter role, enabled. You can take this contract as reference: + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; +import "@openzeppelin/contracts/access/AccessControl.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; + +contract ERC20Token is ERC20, ERC20Burnable, AccessControl, ERC20Permit { + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + + uint8 private decimal; + + constructor( + string memory name, + string memory symbol, + uint8 _decimal, + address minter + ) ERC20(name, symbol) ERC20Permit(name) { + _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); + _grantRole(MINTER_ROLE, minter); + decimal = _decimal; + } + + function decimals() public view virtual override returns (uint8) { + return decimal; + } + + function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { + _mint(to, amount); + } +} + +``` + +Once you have deployed the token on Chain A and you want to integrate this token with other chains where you have liquidity, follow these steps: + +1. Grant the Minter role to the Router AssetBridge contract on the chain where the original token in deployed. You can find the AssetBridge contract addresses [here](../assetbridge-contract-addresses). +2. Mint the required supply of the deployed token. +3. For each chain on which you want to integrate the token, create wrapped tokens or mirror tokens. +4. Whitelist the token on the source chain AssetBridge contract. +5. Reach out to the Router team [here](https://t.me/Alpie01). The Router team will handle the AssetBridge contract configuration on the Router chain. Additionally, the Router team will set up the pathfinder Nitro API configurations and update the user interface (UI) as well as the Router Explorer to incorporate the new token. \ No newline at end of file diff --git a/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/building-an-xerc20-compatible-cross-chain-token.md b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/building-an-xerc20-compatible-cross-chain-token.md new file mode 100644 index 00000000..4b547d03 --- /dev/null +++ b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/building-an-xerc20-compatible-cross-chain-token.md @@ -0,0 +1,15 @@ +--- +title: 3) Building an xERC20 compatible Cross-chain token +sidebar_position: 3 +--- + +xERC20 tokens are a variant of ERC20 tokens that come with modified minting capabilities. The xERC20 token contract is designed with a predefined minting power for each issuer. This minting power is set based on several factors, including the total volume of tokens intended to be issued and the level of trust associated with the token issuer. + + +Deploy an xERC20 contract on one chain (any chain based on your preference) and then follow these steps: + +1. Grant the Minter role to the Router AssetBridge contract on the chain where the original token in deployed. You can find the AssetBridge contract addresses [here](../assetbridge-contract-addresses). +2. Mint the required supply of the deployed token. +3. For each chain on which you want to integrate the token, create wrapped tokens or mirror tokens. +4. Whitelist the token on the source chain AssetBridge contract. +5. Reach out to the Router team [here](https://t.me/Alpie01). The Router team will handle the AssetBridge contract configuration on the Router chain. Additionally, the Router team will set up the pathfinder Nitro API configurations and update the user interface (UI) as well as the Router Explorer to incorporate the new token. \ No newline at end of file diff --git a/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/extending-an-existing-token-to-multiple-chains.md b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/extending-an-existing-token-to-multiple-chains.md new file mode 100644 index 00000000..35797137 --- /dev/null +++ b/docs/develop/asset-transfer-via-nitro/managing-cross-chain-tokens/extending-an-existing-token-to-multiple-chains.md @@ -0,0 +1,31 @@ +--- +title: 2) Extending an Existing Token to Multiple Chains +sidebar_position: 2 +--- + + +To integrate a new token that is already present on some blockchains, the following steps have to be followed: + +### 1. Granting Minter Role + +On the original token contract, grant Minter Role to the AssetBridge contract on the chains where the original token is present. You can find the AssetBridge contract addresses [here](../assetbridge-contract-addresses). + +### 2. Creating Wrapped Token Versions + +Wrapped tokens are versions of the original token that exist on different blockchains. These tokens maintain a 1:1 value ratio with the original token. + +- **Identify the Target Chains:** Determine which blockchains you want to extend the token to. +- **Develop Wrapped Token Contracts:** For each target chain, create a smart contract for the wrapped token. This contract should include functionality for minting and burning tokens, which will be tied to the locking and unlocking of the original tokens. + +### 3. Deploying rAsset Tokens [Only if the token existed on more than one chain] + +In cases where the token exists on more than one chain, the token will follow the "lock-and-mint" flow from multiple chains. In this scenario, there's a possibility that the user is trying to unlock X amount of tokens from one chain, but that chain doesn't have that amount of tokens. To handle this case, the developers need to deploy rAsset contract on each blockchain where the original token is present. rAsset tokens are a proof of liquidity that maintain a 1:1 mapping with their underlying assets. Each rAsset token can only be minted if an equivalent amount of the original asset is locked. + +For example, consider that ROUTE token is natively present on Ethereum and Polygon. A user locks 1000 ROUTE on Ethereum and 800 ROUTE on Polygon and mints 1800 ROUTE on Arbitrum. Now, let's say the user burns 1200 ROUTE tokens on Arbitrum and requests them on Polygon. Since only 800 ROUTE is locked on Polygon, only 800 ROUTE can be unlocked there. To make sure user doesn't face any losses, the user will be given 400 rROUTE which will serve as proof of liquidity. The user can redeem this rROUTE 1:1 for ROUTE whenever more ROUTE gets deposited on Polygon. + +### 4. Whitelisting the Token on Asset Bridge Contracts + +To facilitate the cross-chain transfer of the token, it must be whitelisted on the AssetBridge contracts. This will allow the bridge to recognize and handle the token transfer. + +### 5. Further Configurations +Reach out to the Router team [here](https://t.me/Alpie01). The Router team will handle the AssetBridge contract configuration on the Router chain. Additionally, the Router team will set up the pathfinder Nitro API configurations and update the user interface (UI) as well as the Router Explorer to incorporate the new token. \ No newline at end of file diff --git a/docs/develop/asset-transfer/nitro/migrating-from-voyager-to-nitro.md b/docs/develop/asset-transfer-via-nitro/migrating-from-voyager-to-nitro.md similarity index 99% rename from docs/develop/asset-transfer/nitro/migrating-from-voyager-to-nitro.md rename to docs/develop/asset-transfer-via-nitro/migrating-from-voyager-to-nitro.md index c88880e4..b14bf963 100644 --- a/docs/develop/asset-transfer/nitro/migrating-from-voyager-to-nitro.md +++ b/docs/develop/asset-transfer-via-nitro/migrating-from-voyager-to-nitro.md @@ -1,6 +1,6 @@ --- title: Migrating from Voyager to Nitro -sidebar_position: 5 +sidebar_position: 6 --- Migrating from Voyager to Nitro is a straightforward task and won't require more than 10 minutes of effort. Follow the steps given below to migrate your existing codebase from Voyager to Nitro: diff --git a/docs/develop/asset-transfer/nitro/supported-chains-tokens.mdx b/docs/develop/asset-transfer-via-nitro/supported-chains-tokens.mdx similarity index 97% rename from docs/develop/asset-transfer/nitro/supported-chains-tokens.mdx rename to docs/develop/asset-transfer-via-nitro/supported-chains-tokens.mdx index 8eb72c68..69d2f3f8 100644 --- a/docs/develop/asset-transfer/nitro/supported-chains-tokens.mdx +++ b/docs/develop/asset-transfer-via-nitro/supported-chains-tokens.mdx @@ -1,9 +1,9 @@ --- title: Supported Chains and Tokens -sidebar_position: 6 +sidebar_position: 7 --- -import APIData from '../../../../src/utils/GatewayAddressTable' ; +import APIData from '../../../src/utils/GatewayAddressTable' ; ## Mainnet For supported chains on mainnet, please refer below - diff --git a/docs/develop/asset-transfer/nitro/tools/_category_.json b/docs/develop/asset-transfer-via-nitro/tools/_category_.json similarity index 61% rename from docs/develop/asset-transfer/nitro/tools/_category_.json rename to docs/develop/asset-transfer-via-nitro/tools/_category_.json index 3676d53f..899b8111 100644 --- a/docs/develop/asset-transfer/nitro/tools/_category_.json +++ b/docs/develop/asset-transfer-via-nitro/tools/_category_.json @@ -1,6 +1,6 @@ { "label": "Tools", - "position": 4 + "position": 6 } diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/README.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/README.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/README.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/README.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/_category_.json b/docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/_category_.json similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/_category_.json rename to docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/_category_.json diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/check-status.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/check-status.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/check-status.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/check-status.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/execute-transaction.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/execute-transaction.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/execute-transaction.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/execute-transaction.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/installation-initialization.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/installation-initialization.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/installation-initialization.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/installation-initialization.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/request-quote.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/request-quote.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-js-sdk/request-quote.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-js-sdk/request-quote.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/_category_.json b/docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/_category_.json similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/_category_.json rename to docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/_category_.json diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/README.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/README.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/README.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/README.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/_category_.json b/docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/_category_.json similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/_category_.json rename to docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/_category_.json diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-set-allowance.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-set-allowance.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-set-allowance.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-set-allowance.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-status.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-status.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-status.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/check-status.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/execute-transaction.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/execute-transaction.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/execute-transaction.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/execute-transaction.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/request-quote.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/request-quote.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/request-quote.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-pathfinder-api/performing-cross-chain-transaction/request-quote.md diff --git a/docs/develop/asset-transfer/nitro/tools/nitro-widget/README.md b/docs/develop/asset-transfer-via-nitro/tools/nitro-widget/README.md similarity index 100% rename from docs/develop/asset-transfer/nitro/tools/nitro-widget/README.md rename to docs/develop/asset-transfer-via-nitro/tools/nitro-widget/README.md diff --git a/docs/develop/asset-transfer/nitro/_category_.json b/docs/develop/asset-transfer/nitro/_category_.json deleted file mode 100644 index 3da35810..00000000 --- a/docs/develop/asset-transfer/nitro/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Nitro", - "position": 4 -} \ No newline at end of file diff --git a/docs/develop/asset-transfer/nitro/different-functions/_category_.json b/docs/develop/asset-transfer/nitro/different-functions/_category_.json deleted file mode 100644 index a639a886..00000000 --- a/docs/develop/asset-transfer/nitro/different-functions/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Different Functions", - "position": 2 - } \ No newline at end of file diff --git a/docs/develop/asset-transfer/nitro/guides/_category_.json b/docs/develop/asset-transfer/nitro/guides/_category_.json deleted file mode 100644 index ef9efb80..00000000 --- a/docs/develop/asset-transfer/nitro/guides/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Guides", - "position": 3 -} \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/_category_.json b/docs/develop/asset-transfer/voyager/_category_.json deleted file mode 100644 index cdc54d92..00000000 --- a/docs/develop/asset-transfer/voyager/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Voyager", - "position": 3 -} \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/architecture.md b/docs/develop/asset-transfer/voyager/architecture.md deleted file mode 100644 index 34adccb4..00000000 --- a/docs/develop/asset-transfer/voyager/architecture.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Architecture -sidebar_position: 1 ---- - -Voyager consists of smart contracts that are deployed on all the blockchains that it supports and a middleware contract sitting on the Router Chain which forms the abstraction layer for many complexities of the cross-chain communication. - -The smart contracts include the Voyager Deposit Handler, the Voyager Execute Handler, the Voyager Utils contract etc. The Voyager Deposit Handler is responsible for handling the deposits from users on the source chain while the Voyager Execute Handler is responsible for execution of the transaction on the destination chain. \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/configurations/_category_.json b/docs/develop/asset-transfer/voyager/configurations/_category_.json deleted file mode 100644 index 8e87c739..00000000 --- a/docs/develop/asset-transfer/voyager/configurations/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Configurations", - "position": 4 -} \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/configurations/chain-id-identifiers.md b/docs/develop/asset-transfer/voyager/configurations/chain-id-identifiers.md deleted file mode 100644 index d0068133..00000000 --- a/docs/develop/asset-transfer/voyager/configurations/chain-id-identifiers.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Chain ID Identifiers (Bytes) -sidebar_position: 4 ---- - -# Chain ID Identifiers(Bytes) - -| Chain | Chain ID | Chain ID Identifier | -| -------------- | -------- | -------------------------------------------------------------------- | -| Polygon Mumbai | 80001 | `0x7b99390f1c6d918668693a36b96f7ae248a34f6c2c3f20f8c87e04efb118a3a5` | -| Avalanche Fuji | 43113 | `0xbeaa89a1abe3c361e015597858f91679d1af03bb442d2ee7cf0b07807c898339` | -| Goerli | 5 | `0x91cfcc4a139573b08646960be31b278152ef3480710ab15d9b39262be37038a1` | - - diff --git a/docs/develop/asset-transfer/voyager/configurations/list-reserve-lp-tokens.md b/docs/develop/asset-transfer/voyager/configurations/list-reserve-lp-tokens.md deleted file mode 100644 index 0608de5f..00000000 --- a/docs/develop/asset-transfer/voyager/configurations/list-reserve-lp-tokens.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: List of Reserve and LP Tokens -sidebar_position: 4 ---- - -## Testnet Addresses - -### Reserve Tokens - -| Chain | Chain ID | Token Name | Token Address | -| -------------- | -------- | ---------- | ------------------------------------------ | -| Avalanche Fuji | 43113 | USDC | 0x5425890298aed601595a70ab815c96711a31bc65 | -| Avalanche Fuji | 43113 | ROUTE | 0xcdec59a1a1a919fcb5aa814f8b2d636d1df2459e | -| Polygon Mumbai | 80001 | USDC | 0x0fa8781a83e46826621b3bc094ea2a0212e71b23 | -| Polygon Mumbai | 80001 | ROUTE | 0xfa457c226e86ec67ac6c7c62a4997a257f610175 | - -### LP Tokens - -| Chain | Chain ID | Token Name | Token Address | -| -------------- | -------- | ---------- | ------------------------------------------ | -| Avalanche Fuji | 43113 | RUSDC | 0x034d2e7fa19b453785aa25e758753b2d3b17111a | -| Polygon Mumbai | 80001 | RUSDC | 0xd5e279ab36aec7664fa73690345a30f5630223dc | diff --git a/docs/develop/asset-transfer/voyager/configurations/native-assets.md b/docs/develop/asset-transfer/voyager/configurations/native-assets.md deleted file mode 100644 index 129081be..00000000 --- a/docs/develop/asset-transfer/voyager/configurations/native-assets.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Native Assets -sidebar_position: 2 ---- - -# Native Assets - -## Testnet - -| Chain Name | Chain ID | Native Token Address | Wrapped token Address| -| -------- | -------- | -------- | -------- | -| Fuji | 43113 | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` | `0xd00ae08403B9bbb9124bB305C09058E32C39A48c` | -| Mumbai | 80001 | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` | `0x6373c962DCFfc21465973150993E19F56d8640a4`| - - -## Mainnet - -Coming soon... \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/configurations/supported-chains.md b/docs/develop/asset-transfer/voyager/configurations/supported-chains.md deleted file mode 100644 index 7df8eb0f..00000000 --- a/docs/develop/asset-transfer/voyager/configurations/supported-chains.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Supported Chains -sidebar_position: 1 ---- - -# Supported Chains - -## Testnet - -| Chain Name | Chain ID | -| ---------- | -------- | -| Fuji | 43113 | -| Mumbai | 80001 | - -## Mainnet - -Coming soon... diff --git a/docs/develop/asset-transfer/voyager/different-functions/README.md b/docs/develop/asset-transfer/voyager/different-functions/README.md deleted file mode 100644 index 848b88b0..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Different Functions ---- - -The Voyager Deposit Handler contract has six user facing functions which we will discuss in detail in this section: -- [Transfer of Reserve Tokens](./different-functions/transfer-reserve-token) -- [Transfer of Reserve Tokens along with an Arbitrary Instruction](./different-functions/transfer-reserve-token-arbitrary-instruction) -- [Transfer of Non-Reserve Tokens](./different-functions/transfer-non-reserve-token) -- [Transfer of Non-Reserve Tokens along with an Arbitrary Instruction](./different-functions/transfer-non-reserve-token-arbitrary-instruction) -- [Transfer of LP Tokens](./different-functions/transfer-lp-token) -- [Transfer of LP Tokens along with an Arbitrary Instruction](./different-functions/transfer-lp-token-arbitrary-instruction) - diff --git a/docs/develop/asset-transfer/voyager/different-functions/_category_.json b/docs/develop/asset-transfer/voyager/different-functions/_category_.json deleted file mode 100644 index 93c5a95a..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Different Functions", - "position": 3 - } \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/different-functions/transfer-lp-token-arbitrary-instruction.md b/docs/develop/asset-transfer/voyager/different-functions/transfer-lp-token-arbitrary-instruction.md deleted file mode 100644 index 0ed91f4f..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/transfer-lp-token-arbitrary-instruction.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Transfer of LP Tokens with Arbitrary Instruction -sidebar_position: 7 ---- - -```javascript -function depositLPTokenAndExecute( - bool isAppTokenPayer, - bytes calldata swapData, - bytes calldata executeData, - bytes calldata arbitraryData, - bytes calldata requestMetadata - ) external payable; -``` - -The flow is just the same as that of the LP token transfer explained above. The only difference here is the arbitrary data that you need to pass and state whether the tokens that need to be swapped are to be deducted from the user or the application for which the details can be found [here](./transfer-reserve-token-arbitrary-instruction#arbitrary-data). diff --git a/docs/develop/asset-transfer/voyager/different-functions/transfer-lp-token.md b/docs/develop/asset-transfer/voyager/different-functions/transfer-lp-token.md deleted file mode 100644 index 30ffba78..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/transfer-lp-token.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Transfer of LP Tokens -sidebar_position: 6 ---- - -```javascript -function depositLPToken( - bytes calldata swapData, - bytes calldata executeData, - bytes calldata requestMetadata - ) external payable; -``` - -LP tokens are the tokens for which wrapped versions were created by the Voyager. These tokens are received when a user provides liquidity to the Voyager. These are pegged one-to-one to the underlying asset and can be redeemed on the Voyager. - -When a user wants to transfer any of the LP tokens from the source chain to get any other token on the destination chain, this function is to be called. After this function is called, the Voyager’s infrastructure will handle the transfer of tokens to the other chain. - -The parameters swapData , executeData and requestMetadata and the functionality of this function are similar to those in the reserve token transfer which can be found [here](./transfer-reserve-token#swap-data). diff --git a/docs/develop/asset-transfer/voyager/different-functions/transfer-non-reserve-token-arbitrary-instruction.md b/docs/develop/asset-transfer/voyager/different-functions/transfer-non-reserve-token-arbitrary-instruction.md deleted file mode 100644 index 010b2a44..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/transfer-non-reserve-token-arbitrary-instruction.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Transfer of Non-Reserve Tokens with Arbitrary Instruction -sidebar_position: 5 ---- - -```javascript -function depositNonReserveTokenAndExecute( - bool isSourceNative, - bool isAppTokenPayer, - bytes calldata swapData, - bytes calldata executeData, - bytes calldata arbitraryData, - bytes calldata requestMetadata - ) external payable; -``` - -The flow is just the same as that of the Non-Reserve token transfer explained in previous section. The only difference here is the arbitrary data that you need to pass and state whether the tokens that need to be swapped are to be deducted from the user or the application for which the details can be found [here](./transfer-reserve-token-arbitrary-instruction#arbitrary-data). diff --git a/docs/develop/asset-transfer/voyager/different-functions/transfer-non-reserve-token.md b/docs/develop/asset-transfer/voyager/different-functions/transfer-non-reserve-token.md deleted file mode 100644 index f96f8b7e..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/transfer-non-reserve-token.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Transfer of Non-Reserve Tokens -sidebar_position: 4 ---- - -```javascript -function depositNonReserveToken( - bool isSourceNative, - bytes calldata swapData, - bytes calldata executeData, - bytes calldata requestMetadata - ) external payable; -``` - -Non-Reserve tokens include all those tokens which are not kept as reserve tokens for the Voyager and are not the LP tokens for any of these reserve tokens. These can be any random token. - -When a user wants to transfer any non-reserve token from source chain to any other token on the destination chain, this function is to be called. After this function is called, the Voyager’s infrastructure will handle the transfer of tokens to the other chain. - -**Parameters:** - -| isSourceNative | If the source token is the native token for that chain, this should be true. | -| --------------- | ---------------------------------------------------------------------------- | -| swapData | abi encoded data for the swap which is created by an API | -| executeData | abi encoded data for the destination chain which is created by an API | -| requestMetadata | | - -The **Swap Data** includes: - -1. **srcTokenAmount:** Amount of the non-reserve token the user wants to transfer to the other chain. -2. **srcStableTokenAmount:** Amount of the stable token equivalent to the amount of source token user wants to transfer. -3. **destChainIdBytes:** The Chain ID identifier for the destination chain. -4. **srcTokenAddress:** Address of the token the user wants to transfer to the other chain. -5. **srcStableTokenAddress:** Address of the stable token in which the stable amount (srcStableTokenAmount) equivalent to the srcTokenAmount is calculated. -6. **dataTx:** Data for the transaction for swap to convert the non-reserve token to the stable token on source chain (received from the API). -7. **path:** Data for the transaction for swap to convert the non-reserve token to the stable token on source chain (received from the API). -8. **flags:** The identifiers of DEXes that will be used for swap on source chain (received from the API). - -The details for the Execute Data can be found [here](./transfer-reserve-token#execute-data). - -The details for the Request Metadata can be found [here](./transfer-reserve-token.md) - -:::info -💡 Note: Swap data and Execute data will directly be generated by the API. You don’t need to worry about generating this data. -::: diff --git a/docs/develop/asset-transfer/voyager/different-functions/transfer-reserve-token-arbitrary-instruction.md b/docs/develop/asset-transfer/voyager/different-functions/transfer-reserve-token-arbitrary-instruction.md deleted file mode 100644 index 9c0a85e3..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/transfer-reserve-token-arbitrary-instruction.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Transfer of Reserve Tokens with Arbitrary Instruction -sidebar_position: 3 ---- - -```javascript -function depositReserveTokenAndExecute( - bool isSourceNative, - bool isAppTokenPayer, - bytes calldata swapData, - bytes calldata executeData, - bytes calldata arbitraryData, - bytes calldata requestMetadata - ) external payable; -``` - -The flow is just the same as that of the reserve token transfer explained before. The only difference here is the arbitrary data that you need to pass and state whether the tokens that need to be swapped are to be deducted from the user or the application. - -### Arbitrary Data - -**Arbitrary Data** is the abi encoded data that comprises of: - -1. **destContractAddress:** Address of the contract which will be called after the transfer is complete. This contract needs to implement the voyagerReceive function (details given below). -2. **data:** This is the abi encoded arguments that will be passed to the function that should be called on the destination contract address. The data should exclude the address and amount of tokens received as the amount may vary according to the fees. The address of the token and exact amount of tokens received by the user will be accessible into the handler function directly on the destination chain. -3. **gasLimit:** The gas limit required for your function to be executed on the destination chain. The fees that we deduct from you will depend on this. -4. **gasPrice:** Current gas price of the destination chain. The fees that we deduct from you will depend on this. - -### voyagerReceive - -The arbitrary instruction that you provide here will be executed on the destination chain on the contract address that you specify. That contract must implement the **voyagerReceive** function given below. - -```javascript -function voyagerReceive( - address sourceSenderAddress, - bytes32 srcChainIdBytes, - bytes memory data, - address settlementToken, - uint256 settlementAmount - ) external; -``` - -With this function, you will receive: - -1. **sourceSenderAddress:** the address of the sender of transaction from the source chain. -2. **srcChainIdBytes:** the identifier of the source chain. -3. **data:** Data for the params to the function for which the selector was received passed from the source chain. -4. **settlementToken:** Address of the token which was received to the recipient after the transfer. -5. **settlementAmount:** Amount of the settlement tokens received to the recipient after the transfer. - -Inside the **voyagerReceive** function on the destination chain, you will decode the data according to the requirements of the function selector and call that function which will complete the instruction execution. diff --git a/docs/develop/asset-transfer/voyager/different-functions/transfer-reserve-token.md b/docs/develop/asset-transfer/voyager/different-functions/transfer-reserve-token.md deleted file mode 100644 index e9ef4de7..00000000 --- a/docs/develop/asset-transfer/voyager/different-functions/transfer-reserve-token.md +++ /dev/null @@ -1,159 +0,0 @@ ---- -title: Transfer of Reserve Tokens -sidebar_position: 2 ---- -import RelayerAPIData from '../../../../../src/utils/RelayerFees' - - -```javascript -function depositReserveToken( - bool isSourceNative, - bytes calldata swapData, - bytes calldata executeData, - bytes calldata requestMetadata - ) external payable; -``` - -Reserve tokens are the tokens that have been kept in reserve by the Voyager protocol. The Voyager keeps reserves of some selected tokens on each chain so that it is able to provide fund transfers by locking funds on source chain and unlocking the funds on the destination chain. These include some stable tokens, wrapped native tokens for that chain as well as other tokens according to the needs as well as partnerships of projects with the Voyager . - -When a user wants to transfer any of these reserve tokens from source chain to any other token on the destination chain, this function is to be called. After this function is called, the Voyager’s infrastructure will handle the transfer of tokens to the other chain. - -**Parameters:** - -| isSourceNative | If the source token is the native token for that chain, this should be true. | -| --------------- | -------------------------------------------------------------------------------------- | -| swapData | abi encoded data for the required swap which is created by an API | -| executeData | abi encoded data for the execution on the destination chain which is created by an API | -| requestMetadata | abi encoded data | - -The **Swap Data** includes: - -1. **srcStableTokenAmount:** Amount of the reserve token the user wants to transfer to the other chain. -2. **srcStableTokenAddress:** Address of the reserve token the user wants to transfer to the other chain. -3. **srcTokenAddress:** Address of the token the user wants to transfer to the other chain. This will be the same as srcStableTokenAddress in case of reserve tokens. -4. **destChainIdBytes:** The Chain ID identifier for the destination chain. - -The **Execute Data** includes: - -1. **destTokenAmount:** Amount of destination tokens user will receive. This will be checked in the middleware and if this amount (USD Value) is larger than what user deposited, the transaction will be reverted. -2. **destTokenAddress:** Address of the token user will receive on the destination chain. -3. **isDestNative:** If the token to be received on the destination chain is native token for that chain, this is set to 1 else 0. -4. **destStableTokenAddress:** Address of the stable token in which USD value for the tokens to be received will be calculated on the middleware. -5. **recipient:** Address of the recipient on the destination chain. -6. **dataTx:** Data for the transaction for swap on destination chain received from the API. If the token to be received on the destination chain is a reserve token or an LP token for that chain, the dataTx will be an empty bytes array. -7. **path:** Path for the swap on destination chain received from the API. If the token to be received on the destination chain is a reserve token or an LP token for that chain, the path will be an empty address array. -8. **flags:** The identifiers of DEXes that will be used for swap on destination chain received from the API. If the token to be received on the destination chain is a reserve token or an LP token for that chain, the flags will be an empty uint256 array. -9. **partnerId:** An ID assigned to the partner who has integrated the Voyager Widget. If you are not a partner, you can pass uint256 0 as partnerId. - -:::info -Swap data and Execute data will directly be generated by the API. You don’t need to worry about generating this data. -::: - -The **Request Metadata** includes: - -1. **destGasLimit:** Gas limit required for execution of the request on the destination chain. This can be calculated using tools like [hardhat-gas-reporter](https://www.npmjs.com/package/hardhat-gas-reporter). - -2. **destGasPrice:** Gas price of the destination chain. This can be calculated using the RPC of destination chain. - -```jsx -// using ethers.js -const gasPrice = await provider.getGasPrice(); - -// using web3.js -const gasPrice = web3.eth.getGasPrice().then((result) => { - console.log(web3.utils.fromWei(result, 'ether')); -}); -``` - -To avoid the need for calculation, it can be passed as 0. The Router chain will then estimate the real-time gas price for them. - -3. **ackGasLimit:** Gas limit required for the execution of the acknowledgment on the source chain. This can be calculated using tools like [hardhat-gas-reporter](https://www.npmjs.com/package/hardhat-gas-reporter). - -4. **ackGasPrice:** Gas price of the source chain. This can be calculated using the RPC of source chain as shown in the above snippet. To avoid the need for calculation, it can be passed as 0. The Router chain will then estimate the real-time gas price for them. - -5. **relayerFees:** This parameter functions similarly to the priority fees on other blockchain networks. Since the Router chain relayers handle the execution of cross-chain requests on the destination chain, setting a higher `relayerFees` will increase the likelihood of your request being prioritized by relayers. If a very low `relayerFees` is provided, the Router chain will automatically adjust it to the minimum required amount to ensure that it is executed. If it is passed as 0, the Router chain will default it to the minimum set Relayer fee value. - - Minimum relayer fees based on network is as follows - - -

- - -6. **ackType:** When the contract calls have been executed on the destination chain, the destination chain Gateway contract sends an acknowledgent back to the Router chain. iDapps have the option to get this acknowledgment from the Router chain to the source chain and execute some operations based on the ack. - -- If `ackType` = 0, the user doesn't want the acknowledgment to be forwarded back to the source chain. -- If `ackType` = 1, the acknowledgment is expected to be received only if the calls were successfully executed on the destination chain, and the user intends to perform some operation on the source chain after receiving the ack. -- If `ackType` = 2, an acknowledgment is needed only in case of an error occurring on the destination chain. This options also allows for execution of certain operations after receiving the ack. -- If `ackType` = 3, an acknowledgment is needed from the destination chain regardless of whether the call succeeds or fails, and some operations need to be performed based on the ack. - -7. **isReadCall:** Router provides dApps an option to query a contract on another chain and receive the data back on the source chain as an acknowledgment. If the intention is only to query a contract on the destination chain and not perform any write operation there, then set this option to `true`. - -8. **asmAddress:** As part of Router's modular security framework, developers can integrate an ASM module to add an extra layer of security on top of the infra-level security provided by the Router Chain. These modules will be in the form of smart contracts on the destination chain, and their addresses should be passed as bytes in this variable. Documentation for ASM can be found [here](../../message-transfer-via-crosstalk/key-concepts/additional-security-modules.md). - -It can be achieved by adding the following function in your contract: - -```javascript -function getRequestMetadata( - uint64 destGasLimit, - uint64 destGasPrice, - uint64 ackGasLimit, - uint64 ackGasPrice, - uint128 relayerFees, - uint8 ackType, - bool isReadCall, - bytes memory asmAddress - ) public pure returns (bytes memory) { - bytes memory requestMetadata = abi.encodePacked( - destGasLimit, - destGasPrice, - ackGasLimit, - ackGasPrice, - relayerFees, - ackType, - isReadCall, - asmAddress - ); - return requestMetadata; - } -``` - -Alternatively, the `requestMetadata` parameter can be created in TypeScript or JavaScript using the following function: - -```javascript -function getRequestMetadata( - destGasLimit: number, - destGasPrice: number, - ackGasLimit: number, - ackGasPrice: number, - relayerFees: string, - ackType: number, - isReadCall: boolean, - asmAddress: string -): string { - return ethers.utils.solidityPack( - [ - 'uint64', - 'uint64', - 'uint64', - 'uint64', - 'uint128', - 'uint8', - 'bool', - 'string', - ], - [ - destGasLimit, - destGasPrice, - ackGasLimit, - ackGasPrice, - relayerFees, - ackType, - isReadCall, - asmAddress, - ] - ); -} -``` diff --git a/docs/develop/asset-transfer/voyager/different-use-cases/README.md b/docs/develop/asset-transfer/voyager/different-use-cases/README.md deleted file mode 100644 index 9b51cd76..00000000 --- a/docs/develop/asset-transfer/voyager/different-use-cases/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Building different use-cases using Voyager - -The Voyager can be used for cross-chain token transfers as well as sequencing the token transfers and arbitrary instructions. In this section, we will understand how to integrate the Voyager’s functionalities into your contracts and building these 2 different types of use-cases. - -- [Asset Transfers](./different-use-cases/asset-transfers) -- [Sequenced Transfers (Asset + Instruction)](./different-use-cases/sequenced-transfers) diff --git a/docs/develop/asset-transfer/voyager/different-use-cases/_category_.json b/docs/develop/asset-transfer/voyager/different-use-cases/_category_.json deleted file mode 100644 index 4ca69347..00000000 --- a/docs/develop/asset-transfer/voyager/different-use-cases/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Different Use-Cases", - "position": 5 -} \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/different-use-cases/asset-transfers.md b/docs/develop/asset-transfer/voyager/different-use-cases/asset-transfers.md deleted file mode 100644 index bee2e85b..00000000 --- a/docs/develop/asset-transfer/voyager/different-use-cases/asset-transfers.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: Asset Transfers -sidebar_position: 1 ---- - -As we discussed in the previous section, Voyager allows us to transfer/swap assets between chains. In this section, we will explore how you can integrate Voyager into your smart contracts for cross-chain token transfers. - -The functions that can be called on the Voyager for cross-chain token transfers are: - -1. depositReserveToken -2. depositLPToken -3. depositNonReserveToken - -While you can definitely integrate only one of these functionalities into your contracts according to your needs, we suggest you to use the call with the selector method to be able to call any of these functions from your contracts. - -### Getting the data for the token transfer - -We will provide an API for the developers which will provide the calldata for the swap directly. You can call the API, get the data, and call Voyager using that data. - -The params for the API call are: - -1. **fromTokenAddress:** Address of the token to be transferred from the source chain. -2. **toTokenAddress:** Address of the token to be received on the destination chain. -3. **fromChainId:** Chain ID of the source chain. -4. **fromChainType:** Chain type of the source chain. -5. **toChainId:** Chain ID of the destination chain. -6. **toChainType:** Chain type of the destination chain. -7. **isDestNative:** Whether the required token on the destination chain is the native token for that chain. -8. **recipientAddress:** Address of the recipient. -9. **isOnlyTokenTransfer:** This is a boolean value indicating whether the goal is token transfer only or do we want to execute an instruction along with token transfer. In this case, since we just want to transfer tokens, we will send true in its place. - -The data received from the API response can directly be fed into the contract for execution. - -```javascript -address public voyagerDepositHandler = "address of voyager deposit handler"; -// depositReserveToken(bool,bytes,bytes) -bytes4 public constant DEPOSIT_RESERVE_SELECTOR = 0x3a139384; -// depositNonReserveToken(bool,bytes,bytes) -bytes4 public constant DEPOSIT_NON_RESERVE_SELECTOR = 0x0ae79779; -// depositLPToken(bytes,bytes) -bytes4 public constant DEPOSIT_LP_SELECTOR = 0xb78802d9; - -function callVoyager(bytes4 depositFunctionSelector, bytes calldata data) public { - bool success; - bytes memory data; - if( - depositFunctionSelector == DEPOSIT_RESERVE_SELECTOR || - depositFunctionSelector == DEPOSIT_NON_RESERVE_SELECTOR - ) { - (bool isSourceNative, bytes memory swapData, bytes memory executeData) - = abi.decode(data, (bool, bytes, bytes)); - (success, data) = voyagerDepositHandler.call( - abi.encodeWithSelector( - depositFunctionSelector, - isSourceNative, - swapData, - executeData - ) - ); - } else if(depositFunctionSelector == DEPOSIT_LP_SELECTOR) { - (bytes memory swapData, bytes memory executeData) - = abi.decode(data, (bytes, bytes)); - (success, data) = voyagerDepositHandler.call( - abi.encodeWithSelector( - DEPOSIT_LP_SELECTOR, - swapData, - executeData - ) - ); - - } - - require(success == true, "Voyager deposit failed"); -} -``` - -:::info -💡 In the case of Reserve Token deposit or Non-Reserve Token deposit, if the isSourceNative parameter is true, then you need to send native tokens also with the call using the value method of solidity. -::: -```javascript -uint256 amountOfNativeTokens = abi.decode(swapData, (uint256)); -(success, data) = voyagerDepositHandler.call{value: amountOfNativeTokens}( - abi.encodeWithSelector( - depositFunctionSelector, - isSourceNative, - swapData, - executeData - ) - ); -``` - -:::caution -The Voyager deducts tokens to be transferred from the contract or the user which called the Voyager’s deposit function. Hence, in case your contract is the one calling the deposit function then before calling the deposit function on the Deposit Handler please make sure to - -1. Transfer the funds from user’s wallet to your contract -2. Approve the Voyager Deposit Handler contract from your contract to deduct those tokens from your contract -::: \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/different-use-cases/sequenced-transfers.md b/docs/develop/asset-transfer/voyager/different-use-cases/sequenced-transfers.md deleted file mode 100644 index 49b357f1..00000000 --- a/docs/develop/asset-transfer/voyager/different-use-cases/sequenced-transfers.md +++ /dev/null @@ -1,195 +0,0 @@ ---- -title: Sequenced Transfers (Asset + Instruction) -sidebar_position: 2 ---- - -As we discussed in the previous section, Voyager allows us to transfer assets and arbitrary instructions in a single sequenced request. In this section, we will explore how you can integrate Voyager into your smart contracts for sequencing cross-chain token and instruction transfers. - -The functions that can be called on Voyager for cross-chain sequencing are: - -1. depositReseveTokenAndExecute -2. depositLPTokenAndExecute -3. depositNonReserveTokenAndExecute - -While you can definitely integrate only one of these functionalities into your contracts according to your needs, we suggest you to use the call with selector method to be able to call any of these functions from your contracts. - -### Getting the data for the token transfer - -We will provide an API for the developers which will provide you the calldata for the swap directly. You won’t need to do anything, just call the API, get the data and call the Voyager using that data for token transfers. For the arbitrary instructions, we will demonstrate how you can create the arbitrary data too in this section. - -The params for the API call to get data for the swap are: - -1. **fromTokenAddress:** Address of the token to be transferred from the source chain. -2. **toTokenAddress:** Address of the token to be received on the destination chain. -3. **fromChainId:** Chain ID of the source chain. -4. **fromChainType:** Chain type of source chain. -5. **toTokenChainId:** Chain ID of the destination chain. -6. **toChainType:** Chain type of destination chain. -7. **isDestNative:** Whether the required token on the destination chain is the native token for that chain. -8. **recipientAddress:** Address of the recipient. -9. **isOnlyTokenTransfer:** This is a boolean value indicating whether the goal is token transfer only. In this case, since we don’t just want token transfers but the sequencing also, we will send false in its place. - -The data received from the API response will give you the function selector for deposit function that needs to be called on the Voyager Deposit Handler and the data pertaining to the swap. - -### Creating the data for the arbitrary instruction - -Arbitrary instructions are custom pieces of code which are executed on the destination chain after the token transfer is complete. The arbitrary data needs to be sent along with the token transfers on the source chain. This data is sent as it is to the destination chain without tampering with it. You can handle the execution of this data on your contract on the destination chain. - -Let’s start with a simple token transfer and stake functionality where user will call a function which will transfer the tokens to another chain and then call the stake function to stake the tokens received into the contract. - -Let’s say you want to create a function to transfer your funds and then stake it on another chain, then you will need to create a function to create that request on the source chain and a function to handle that request on the destination chain. - -Let’s create a function to create that request on the source chain. For the details regarding the Arbitrary Data that needs to be generated, please check [this](../different-functions/transfer-reserve-token-arbitrary-instruction#arbitrary-data). - -The arbitrary data consists of six fields: - -1. Destination contract address which will handle the request. -2. The selector to the function which has the logic for handling the request. -3. The data which contains the parameters for the function for which selector was passed. Note that this data won’t contain information regarding the token that will be received or the amount of tokens that will be received on the destination chain since this can vary in some cases depending on the fee and liquidity conditions. -4. The address which will get the gas refund if there is some gas left after the execution. -5. The gas limit that needs to be used while executing the call on the destination chain.. -6. The gas price that needs to be used while executing the call on the destination chain. - -Let’s consider that the handler function for the call on the destination chain is a stake function which looks like: - -```javascript -function stake(address user, address token, uint256 amount) internal -``` - -Then the selector that needs to be passed can be generated easily. So we generate the selector to the function and store it in the **STAKE_FUNCTION_SELECTOR** variable. We take the address of the recipient in whose address the stake will be registered, the refund address, the gas limit and the gas price for the destination chain in the parameters and return the arbitrary data. - -```javascript -address public destContractAddress; -// function stake(address user, address token, uint256 amount); -bytes4 public constant STAKE_FUNCTION_SELECTOR = bytes4(keccak256("stake(address,address,uint256)")); - -function createDataForStaking( - address recipient, - address refundAddress, - uint256 gasLimit, - uint256 gasPrice -) public returns (bytes memory) { - bytes memory data = abi.encode(recipient); - - return abi.encode( - destContractAddress, - STAKE_FUNCTION_SELECTOR, - data, - refundAddress, - gasLimit, - gasPrice - ); -} -``` - -This gives us the arbitrary data which can be used to call the functions of the Deposit Handler. - -### Calling the Voyager Deposit function - -```javascript -address public voyagerDepositHandler = "address of voyager deposit handler"; -// depositReserveTokenAndExecute(bool,bool,bytes,bytes,bytes) -bytes4 public constant DEPOSIT_RESERVE_AND_EXECUTE_SELECTOR = 0xf64d944a; -// depositNonReserveTokenAndExecute(bool,bool,bytes,bytes,bytes) -bytes4 public constant DEPOSIT_NON_RESERVE_AND_EXECUTE_SELECTOR = 0x79334b17; -// depositLPTokenAndExecute(bool,bytes,bytes,bytes) -bytes4 public constant DEPOSIT_LP_AND_EXECUTE_SELECTOR = 0xe18cfa35; - -function callVoyager( - bytes4 selector, - bool isSourceNative, - bool isAppTokenPayer, - bytes memory swapData, - bytes memory executeData, - bytes memory arbitraryData -) public -{ - bool success; - - if (selector == DEPOSIT_RESERVE_AND_EXECUTE_SELECTOR || selector == DEPOSIT_NON_RESERVE_AND_EXECUTE_SELECTOR) { - (success, ) = voyagerDepositHandler.call{ value: msg.value }( - abi.encodeWithSelector(selector, isSourceNative, isAppTokenPayer, swapData, executeData, arbitraryData) - ); - } else { - (success, ) = voyagerDepositHandler.call{ value: msg.value }( - abi.encodeWithSelector(selector, isAppTokenPayer, swapData, executeData, arbitraryData) - ); - } - - require(success == true, "Voyager deposit failed"); -} -``` - -### Handling the request on the destination chain contract - -The entry point of the cross-chain request for arbitrary instructions is the **voyagerReceive** function which needs to be implemented on each contract that wants to handle an arbitrary instruction from the Voyager. The detailed explanation for this function can be found [here](../different-functions/transfer-reserve-token-arbitrary-instruction#voyagerreceive). - -```javascript -function voyagerReceive( - address sourceSenderAddress, - bytes32 srcChainIdBytes, - bytes4 selector, - bytes memory data, - address settlementToken, - uint256 settlementAmount -) external; -``` - -This function is called by the Voyager Execute Handler, so make sure that only the Execute Handler can call this contract by using access control or a modifier otherwise the contract can be potentially exploited. Similarly also put a check on the source sender addresses so that only your contracts on different chains can call this function. - -The function receives the following parameters: - -1. The address of the contract which initiated the request on the source chain. -2. The identifier for the source chain. -3. The selector to the function passed to the contract from the source chain. -4. The data variable sent from the source chain. -5. The address of the token received by the recipient on the destination chain. -6. The amount of tokens received by the recipient on destination chain. - -Let’s implement a function on the destination chain to handle the request coming from another chain. - -```javascript -address sourceContractAddress; -address voyagerExecuteHandler; -// user address + token address => amount staked -mapping(address => mapping(address => uint256)) stakedBalance; - -function voyagerReceive( - address sourceSenderAddress, - bytes32 srcChainIdBytes, - bytes4 selector, - bytes memory data, - address settlementToken, - uint256 settlementAmount -) external { - // Checking if the sender is the voyager execute handler contract - require(msg.sender == voyagerExecuteHandler, "only voyager execute handler"); - // Checking if the request initiated by our contract only from the source chain - require( - sourceContractAddress == sourceSenderAddress, - "source sender does not match" - ); - - // Checking the selector that was passed from the source chain - if (selector == stake.selector) { - // decoding the data we sent from the source chain - address user = abi.decode(data, (address)); - // calling the stake function - stake(user, settlementToken, settlementAmount); - } -} - -// The handler function for the stake request -function stake( - address user, - address token, - address amount -) internal { - // Updating the staked balances mapping - stakedBalance[user][token] += amount; -} -``` - -In this way, you can handle cross-chain requests from the Voyager on the destination chain. - -- [Cross-chain Staking Dapp](../guides/crosschain-staking.md) diff --git a/docs/develop/asset-transfer/voyager/different-workflows/_category_.json b/docs/develop/asset-transfer/voyager/different-workflows/_category_.json deleted file mode 100644 index 95ebd46e..00000000 --- a/docs/develop/asset-transfer/voyager/different-workflows/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "Different Workflows", - "position": 2 - } \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/different-workflows/cross-chain-asset-transfer.md b/docs/develop/asset-transfer/voyager/different-workflows/cross-chain-asset-transfer.md deleted file mode 100644 index 7cd6b1e4..00000000 --- a/docs/develop/asset-transfer/voyager/different-workflows/cross-chain-asset-transfer.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Cross-chain Asset Transfer -sidebar_position: 1 ---- - -When a user calls a function to transfer funds to another chain, the Voyager Deposit Handler contract will process the transaction, deduct the funds from user’s wallet and create a cross-chain communication request to the Router Chain endpoint. After receiving data from the source chain, our bridge contract on the Router Chain will process the request, make some necessary checks and deduct the fees required for the transaction to be processed. Once this is complete, it will fire a transaction to the destination chain to complete the cross-chain transfer request. - -### Edge Cases - -#### 1. What if liquidity is not available for a token on the destination chain? -The user will get the Wrapped tokens for those tokens on the destination chain which can be redeemed as soon as the liquidity is available on the chain. - -#### 2. What if I end up getting lesser amount of tokens on the destination chain than the minimum amount promised to me? -This would never happen. The amount of destination tokens received depends on the DEX output while swapping the tokens. Maybe the output changed between the time that elapsed between when the amount was shown to you and the actual execution. In this case, the swap may result in lesser output for the user, but at Voyager, we have a policy of no loss to the user. So we provide you stable tokens equivalent to the minimum amount displayed to you instead of the token which was the output of the DEX so that you do not suffer any loss. \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/different-workflows/cross-chain-sequenced-transfer.md b/docs/develop/asset-transfer/voyager/different-workflows/cross-chain-sequenced-transfer.md deleted file mode 100644 index 05a07f8a..00000000 --- a/docs/develop/asset-transfer/voyager/different-workflows/cross-chain-sequenced-transfer.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: Cross-chain Sequenced Transfer -sidebar_position: 2 ---- - -The flow is very similar to that of cross-chain asset transfers. The main difference here is that the user also passes an arbitrary instructions from the source chain which is executed just after the token transfer is executed on the destination chain. The Voyager Execute Handler is responsible for calling the target contract on the destination chain. The target contract on the destination chain must implement the voyagerReceive function which is the entry point for the execution of the arbitrary instruction. An example to create send arbitrary instruction from a source chain and handling it on the destination chain is mentioned [here](../different-use-cases/sequenced-transfers). - -### Edge Cases - -#### 1. What if the token transfer is successful but the arbitrary instruction execution fails? -This would never happen as the transaction, by design, is atomic which means that either both will execute or none will execute. - -#### 2. What if my transaction fails on the destination chain due to some issues? What happens to my funds? -No need to worry. We provide a replay function on our bridge contract on the Router Chain which can be called by any user to replay a failed request. You can fix the issues and call this replay function to replay your transaction on the destination chain. Your funds are safe! - diff --git a/docs/develop/asset-transfer/voyager/fee-model.md b/docs/develop/asset-transfer/voyager/fee-model.md deleted file mode 100644 index 69d63016..00000000 --- a/docs/develop/asset-transfer/voyager/fee-model.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Fee Model -sidebar_position: 6 ---- - -## For an Asset Transfer Request - -For an asset transfer request, Voyager's bridge contract on the Router chain calculates the bps-based fee and subtracts it from the destination token amount. For example, if a user has deposited 10000 USDC on the source chain and the fee comes out to be 10 USDC, then the bridge contract will change the destination token amount to 9990. This means that even though a contract on the Router chain calculates the fee, it is maintained on Voyager's Reserve Handler contract on the source chain. - -```javascript -Fee = Min((baseFee + bps * txVolumeInUSD), maxFee) -``` - -:::info -If the fee required for transaction is greater than the amount being transferred and the cost of reverting it is lesser than the amount transferred, the transaction will be reverted back on the source chain by a request from the bridge contract on the Router Chain. -::: - -In this system, we need the price of the reserve tokens in USD as the fee has to be set in terms of USD. To get this price, we have two approaches: -1. **Using Band Protocol Oracles:** For most of the reserve tokens, we will get oracles from Band Protocol. -2. **Using Centralized Services:** If we are not able to source a reliable oracle for any reserve token, we will fetch its price from CoinGecko/CoinMarketCap. - - -## For a Sequenced Request - - - -There are two fees associated with a sequenced cross-chain request - one for the asset transfer call and one for the data transfer call. The fee associated with the asset transfer call is calculated in the same way as given above. The only change is that the fee is not actually subtracted from the destination chain amount, but it is deducted from Voyager's bridge contract address along with the fee for the data transfer call, which is calculated as per the token price and gas price oracle. Voyager's bridge contract will, in turn, deduct this fee from the bridge contract address of the original application that made the sequenced request. \ No newline at end of file diff --git a/docs/develop/asset-transfer/voyager/guides/crosschain-staking.md b/docs/develop/asset-transfer/voyager/guides/crosschain-staking.md deleted file mode 100644 index 03c9f5db..00000000 --- a/docs/develop/asset-transfer/voyager/guides/crosschain-staking.md +++ /dev/null @@ -1,597 +0,0 @@ ---- -title: Cross-chain Staking dApp -sidebar_position: 1 ---- - -In this section, we shall create a simple cross-chain staking dapp using the Voyager sequencer. We shall follow the instructions provided in the previous section to create the same. It consists of two smart contracts: **Vault** and **Stake**. - -**Vault** contract enables the user to first transfer his funds from chain A to chain B and then stake them on chain B. -**Stake** contract manages the staked tokens balance on the destination side. In other words, Stake contract is the fund and state manager of the Vault contract. - -
-Vault Contract - -#### Installing the dependencies - -Install the openzeppelin contracts by running the following command: -`yarn add @openzeppelin/contracts` or `npm install @openzeppelin/contracts` - -#### Instantiating the contract - -```javascript -//SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "@openzeppelin/contracts/access/AccessControl.sol"; -import "./IStake.sol"; - -contract Vault is AccessControl { -} -``` - -Import the `SafeERC20.sol`and `AccessControl.sol` from `@openzeppelin/contracts`and `IStake.sol`. - -Inherit the `AccessControl` contract into your `Vault contract`. - -For your information: - -1. `IStake.sol` is the interface of `Stake` contract which we need here for defining an instance of staking contract into our `Vault` contract. -2. `SafeERC20.sol` is the contract we shall use to access various functions of ERC20 tokens. -3. `AccessControl.sol` is the contract we shall use for putting admin controls over certain important functions. - -#### Creating state variables and the constructor - -```javascript -using SafeERC20 for IERC20; -IStake public stakingContract; - -address public voyagerDepositHandler; -address public voyagerExecuteHandler; - -mapping(bytes32 => address) public ourContractsOnChain; - -// depositReserveTokenAndExecute(bool,bool,bytes,bytes,bytes) -bytes4 public constant DEPOSIT_RESERVE_AND_EXECUTE_SELECTOR = 0xf64d944a; -// depositNonReserveTokenAndExecute(bool,bool,bytes,bytes,bytes) -bytes4 public constant DEPOSIT_NON_RESERVE_AND_EXECUTE_SELECTOR = 0x79334b17; -// depositLPTokenAndExecute(bool,bytes,bytes,bytes) -bytes4 public constant DEPOSIT_LP_AND_EXECUTE_SELECTOR = 0xe18cfa35; - -bytes4 public constant STAKE_FUNCTION_SELECTOR = - bytes4(keccak256("receiveStakeCrossChain(address,address,uint256)")); - -constructor(address _voyagerDepositHandler, address _voyagerExecuteHandler) -{ - voyagerDepositHandler = _voyagerDepositHandler; - voyagerExecuteHandler = _voyagerExecuteHandler; - _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); -} -``` - -1. `stakingContract`: This is the instance of our `Stake` contract which will manage the state and balance of funds in both kind of transfers: same chain as well as cross-chain. -2. `voyagerDeposithandler` & `voyagerExecuteHandler` : These are the variables created for storing the addresses of Deposit and Execute handlers. We will be using Deposit Handler for calling the voyager that initiates the cross-chain sequenced transfer on the source side using function selectors of `voyagerDeposithandler` and Execute Handler for validating if the transaction is triggered on the destination side by Execute Handler only. -3. `ourContractsOnChain` : This is the mapping that stores the address of the vault contract corresponding to the destination chain Id identifiers which can be found [here](../configurations/chain-id-identifiers). -4. `DEPOSIT_RESERVE_AND_EXECUTE_SELECTOR, DEPOSIT_NON_RESERVE_AND_EXECUTE_SELECTOR & DEPOSIT_LP_AND_EXECUTE_SELECTOR` : These are the selectors of various functions in `voyagerDeposithandler` which assist us to identify the type of token transfer(whether it is a reserve token, non-reserve token or a LP token). -5. `STAKE_FUNCTION_SELECTOR` : This is the selector of the function that is called whenever a cross-chain call is received on the destination chain. This is the function for your reference: - -```javascript -function receiveStakeCrossChain( - address _user, - address _token, - uint256 _amount - ) internal { - stakingContract.stake(_user, _token, _amount); - } -``` - -6. `Constructor` : Create the constructor with address of voyagerDepositHandler and voyagerExecuteHandler and set them into our state variables along with giving the `DEFAULT_ADMIN_ROLE` to the deployer. - -#### Function to set the Staking contract - -```javascript -function setStakingContract(address _stakingContract) - external - onlyRole(DEFAULT_ADMIN_ROLE) - { - stakingContract = IStake(_stakingContract); - } -``` - -Our Vault contract on every chain must know the address of its corresponding Stake contract on same chain to interact with it whenever a cross-chain call is received by Vault. Hence we create a function `setStakingContract` to store the address of Stake Contract on the same chain. - -#### Function to store the addresses of Vault contracts deployed on other chains - -```javascript -function setContractsOnChain(bytes32 chainIdBytes, address contractAddr) external onlyRole(DEFAULT_ADMIN_ROLE) { - ourContractsOnChain[chainIdBytes] = contractAddr; - } -``` - -Our Vault contract on every chain must know the addresses of its counterparts on every other chain to enable cross-chain transfers or cross-chain sequenced transfers. Hence we create a function `setContractsOnChain` that updates the mapping `ourContractsOnChain` about which we talked about earlier. - -#### Function to approve Stake contract to safely transfer funds from Vault - -```javascript -function approve(address token, address spender, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) { - IERC20(token).approve(spender, amount); - } -``` - -Whenever a cross-chain transfer happens and funds are received by Vault contract on the destination chain, they are directed to Stake contract after which the staked balance in the name of the user is updated. Vault contract on every chain must approve Stake contract on the same chain to be able to transfer a certain amount of tokens to itself from Vault. Thus we create a function `approve` to facilitate this. - -#### \*Function to convert a variable of type `address` to type `bytes` - -```javascript -function toBytes(address addr) internal pure returns (bytes memory b) { - assembly { - let m := mload(0x40) - addr := and(addr, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) - mstore(add(m, 20), xor(0x140000000000000000000000000000000000000000, addr)) - mstore(0x40, add(m, 52)) - b := m - } - } -``` - -\*this is just a supporting function. We shall use it as a converter whenever an address has to be passed as a parameter in the form of bytes. - -#### Function that enables cross-chain sequenced transfers - -```javascript -function stakeCrossChain( - bytes4 selector, - bool isSourceNative, - bool isAppTokenPayer, - address recipient, - address refundAddress, - uint256 gasLimit, - uint256 gasPrice, - bytes memory swapData, - bytes memory executeData - ) public payable { - bytes32 destChainIdBytes = abi.decode(swapData, (bytes32)); - bytes memory data = abi.encode(recipient); - - bytes memory arbitraryData = abi.encode( - toBytes(ourContractsOnChain[destChainIdBytes]), - STAKE_FUNCTION_SELECTOR, - data, - toBytes(refundAddress), - gasLimit, - gasPrice - ); - - bool success; - - if (selector == DEPOSIT_RESERVE_AND_EXECUTE_SELECTOR || selector == DEPOSIT_NON_RESERVE_AND_EXECUTE_SELECTOR) { - (success, ) = voyagerDepositHandler.call{ value: msg.value }( - abi.encodeWithSelector(selector, isSourceNative, isAppTokenPayer, swapData, executeData, arbitraryData) - ); - } else { - (success, ) = voyagerDepositHandler.call{ value: msg.value }( - abi.encodeWithSelector(selector, isAppTokenPayer, swapData, executeData, arbitraryData) - ); - } - - require(success, "unsuccessful"); - } -``` - -It is the `stakeCrossChain` function that: - -1. Encodes the data that we need on the destination chain whenever a cross-chain call is received. Here we need the recipient or user address to update the staked balance in user's name on destination chain. -2. Creates arbitrary instructions by encoding destination chain id identifier, selector of the function that needs to be called on destination chain, data that we encoded in previous step, address to be considered for refund in bytes format, gas limit and gas price. -3. Checks the selector for functions contained in Voyager deposit handler and calls it according to the data passed in the parameters. - -Let us understand the parameters of `stakeCrossChain` function one by one: - -1. `selector` : This is one of the selectors of various functions in `voyagerDeposithandler` which assist us to identify the type of token transfer (whether it is a reserve token, non-reserve token or a LP token) This shall be provided to you with the help of an API. -2. `isSourceNative` : This is a boolean that should be set true if the source token is native to source chain and false in other case. -3. `isAppTokenPayer` : This is a boolean that should be set true if the source contract is going to pay the tokens to the Voyager for transferring it to the destination chain. If you want the signer of the transaction to pay these tokens, set this to false. -4. `recipient` : This is the address of the user in whose name the staked balance would be updated on the destination chain. -5. `refundAddress` : This is the address to be considered for refund. -6. `gasLimit` : This is the gas limit for destination chain -7. `gasPrice` : This is the gas price for destination chain -8. `swapData` : This is the data required for token transfer on source chain. This shall be provided to you with the help of an API. -9. `executeData` : This is the data required for token transfer on destination chain. This shall be provided to you with the help of an API. - -#### Function that receives the cross-chain call and executes the Stake function on destination chain - -```javascript -function voyagerReceive( - address sourceSenderAddress, - bytes32 srcChainIdBytes, - bytes4 selector, - bytes memory data, - address settlementToken, - uint256 settlementAmount - ) external { - // Checking if the sender is the voyager execute handler contract - require( - msg.sender == voyagerExecuteHandler, - "only voyager execute handler" - ); - // Checking if the request initiated by our contract only from the source chain - require(sourceSenderAddress == ourContractsOnChain[srcChainIdBytes], "not our contract"); - - // Checking the selector that was passed from the source chain - if (selector == STAKE_FUNCTION_SELECTOR) { - // decoding the data we sent from the source chain - address user = abi.decode(data, (address)); - // calling the stake function - receiveStakeCrossChain(user, settlementToken, settlementAmount); - } - } -``` - -It is the `voyagerReceive` function that: - -1. Requires that the caller of the function is Voyager Execute Handler only. -2. Checks if the cross-chain request was initiated from our counterpart on the source chain or not. -3. Checks if the selector is of the same function that we need to call on destination chain. Here it is the selector of `receiveStakeCrossChain` function. -4. Decodes the data that we encoded (recipient address )at the time of initiating the cross-chain transfer. -5. Calls the `receiveStakeCrossChain` function with its parameters. - -
- -
-IStake - -It is the interface for our Stake contract. Find the code snippet below: - -```javascript -//SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.0; - -interface IStake { - function stake( - address user, - address token, - uint256 amount - ) external; - - function unstake( - address user, - address token, - uint256 amount - ) external; -} -``` - -
- -
-Stake Contract - -#### Installing the dependencies - -Install the openzeppelin contracts by running the following command: -`yarn add @openzeppelin/contracts` or `npm install @openzeppelin/contracts` - -#### Instantiating the contract - -```javascript -//SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "@openzeppelin/contracts/utils/math/SafeMath.sol"; -import "./IStake.sol"; - -contract Stake is IStake {} -``` - -Import the `SafeERC20.sol`and `SafeMath.sol` from `@openzeppelin/contracts`and `IStake.sol`. - -Inherit the `IStake` contract into your `Stake contract`. - -For your information: - -1. `IStake.sol` is the interface of `Stake` contract which we need here for defining an instance of staking contract into our `Vault` contract. -2. `SafeERC20.sol` is the contract we shall use to access various functions of ERC20 tokens. -3. `SafeMath.sol` is the wrapper contract over Solidity’s arithmetic operations with added overflow checks. - -#### Creating State variables and the constructor - -```javascript - using SafeERC20 for IERC20; - using SafeMath for uint256; - address public immutable vault; - - // user address => token address => staked amount - mapping(address => mapping(address => uint256)) public stakedBalance; - - constructor(address _vault) { - vault = _vault; - } -``` - -1. `vault`: This is the address of our Vault contract on the same chain. -2. `stakedBalance` : This is the mapping that stores the amount staked corresponding to the user and token address -3. `constructor` : Create the constructor with the address of the Vault contract and store it in the state variable `vault`. - -#### Modifier onlyVault() - -```javascript -modifier onlyVault() { - require(msg.sender == vault, "Only Vault"); - _; - } -``` - -We shall add this modifier to our main functions `stake` and `unstake` because we want only the Vault contract and no other account or contract to interact with Stake. - -#### Function to Stake - -```javascript -function stake( - address user, - address token, - uint256 amount - ) external override onlyVault { - uint256 balanceBefore = IERC20(token).balanceOf(address(this)); - IERC20(token).safeTransferFrom(msg.sender, address(this), amount); - uint256 balanceAfter = IERC20(token).balanceOf(address(this)); - uint256 _amount = balanceAfter.sub(balanceBefore, "No amount received"); - stakedBalance[user][token] += _amount; - } -``` - -This function: - -1. Checks the balance of token before transferring tokens to itself from Vault. -2. Transfers the tokens to itself. -3. Checks the balance of token after transferring them. -4. Calculates the amount actually staked -5. Updates the staked balance for the user. - -#### Function to Unstake - -```javascript -function unstake( - address user, - address token, - uint256 amount - ) external override onlyVault { - stakedBalance[user][token] = stakedBalance[user][token].sub( - amount, - "User balance too low" - ); - IERC20(token).safeTransfer(user, amount); - } -``` - -This function checks the staked balance of the user, subtracts the amount he wants to unstake from it and transfers the amount of tokens back to user. - -This is how we created a simple Cross-chain Staking Dapp using Router's Voyager. - -
- -
- End-to-end Vault Contract - -```javascript -//SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "@openzeppelin/contracts/access/AccessControl.sol"; -import "./IStake.sol"; - -contract Vault is AccessControl { - using SafeERC20 for IERC20; - IStake public stakingContract; - - address public voyagerDepositHandler; - address public voyagerExecuteHandler; - - mapping(bytes32 => address) public ourContractsOnChain; - - // depositReserveTokenAndExecute(bool,bool,bytes,bytes,bytes) - bytes4 public constant DEPOSIT_RESERVE_AND_EXECUTE_SELECTOR = 0xf64d944a; - // depositNonReserveTokenAndExecute(bool,bool,bytes,bytes,bytes) - bytes4 public constant DEPOSIT_NON_RESERVE_AND_EXECUTE_SELECTOR = 0x79334b17; - // depositLPTokenAndExecute(bool,bytes,bytes,bytes) - bytes4 public constant DEPOSIT_LP_AND_EXECUTE_SELECTOR = 0xe18cfa35; - - bytes4 public constant STAKE_FUNCTION_SELECTOR = - bytes4(keccak256("receiveStakeCrossChain(address,address,uint256)")); - - constructor(address _voyagerDepositHandler, address _voyagerExecuteHandler) - { - voyagerDepositHandler = _voyagerDepositHandler; - voyagerExecuteHandler = _voyagerExecuteHandler; - _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); - } - - function setStakingContract(address _stakingContract) - external - onlyRole(DEFAULT_ADMIN_ROLE) - { - stakingContract = IStake(_stakingContract); - } - - function setContractsOnChain(bytes32 chainIdBytes, address contractAddr) external onlyRole(DEFAULT_ADMIN_ROLE) { - ourContractsOnChain[chainIdBytes] = contractAddr; - } - - function stake(uint256 _amount, address _token) external { - IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); - stakingContract.stake(msg.sender, _token, _amount); - } - - function unstake(uint256 _amount, address _token) external { - stakingContract.unstake(msg.sender, _token, _amount); - } - - function stakeCrossChain( - bytes4 selector, - bool isSourceNative, - bool isAppTokenPayer, - address recipient, - address refundAddress, - uint256 gasLimit, - uint256 gasPrice, - bytes memory swapData, - bytes memory executeData - ) public payable { - bytes32 destChainIdBytes = abi.decode(swapData, (bytes32)); - bytes memory data = abi.encode(recipient); - - bytes memory arbitraryData = abi.encode( - toBytes(ourContractsOnChain[destChainIdBytes]), - STAKE_FUNCTION_SELECTOR, - data, - toBytes(refundAddress), - gasLimit, - gasPrice - ); - - bool success; - - if (selector == DEPOSIT_RESERVE_AND_EXECUTE_SELECTOR || selector == DEPOSIT_NON_RESERVE_AND_EXECUTE_SELECTOR) { - (success, ) = voyagerDepositHandler.call{ value: msg.value }( - abi.encodeWithSelector(selector, isSourceNative, isAppTokenPayer, swapData, executeData, arbitraryData) - ); - } else { - (success, ) = voyagerDepositHandler.call{ value: msg.value }( - abi.encodeWithSelector(selector, isAppTokenPayer, swapData, executeData, arbitraryData) - ); - } - - require(success, "unsuccessful"); - } - - function voyagerReceive( - address sourceSenderAddress, - bytes32 srcChainIdBytes, - bytes4 selector, - bytes memory data, - address settlementToken, - uint256 settlementAmount - ) external { - // Checking if the sender is the voyager execute handler contract - require( - msg.sender == voyagerExecuteHandler, - "only voyager execute handler" - ); - // Checking if the request initiated by our contract only from the source chain - require(sourceSenderAddress == ourContractsOnChain[srcChainIdBytes], "not our contract"); - - // Checking the selector that was passed from the source chain - if (selector == STAKE_FUNCTION_SELECTOR) { - // decoding the data we sent from the source chain - address user = abi.decode(data, (address)); - // calling the stake function - receiveStakeCrossChain(user, settlementToken, settlementAmount); - } - } - - function receiveStakeCrossChain( - address _user, - address _token, - uint256 _amount - ) internal { - stakingContract.stake(_user, _token, _amount); - } - - function approve(address token, address spender, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) { - IERC20(token).approve(spender, amount); - } - - function toBytes(address addr) internal pure returns (bytes memory b) { - assembly { - let m := mload(0x40) - addr := and(addr, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) - mstore(add(m, 20), xor(0x140000000000000000000000000000000000000000, addr)) - mstore(0x40, add(m, 52)) - b := m - } - } -} - -``` - -
- -
-End-to-end Stake Contract - -```javascript -//SPDX-License-Identifier: Unlicense -pragma solidity ^0.8.0; - -import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import "@openzeppelin/contracts/utils/math/SafeMath.sol"; -import "./IStake.sol"; - -contract Stake is IStake { - using SafeERC20 for IERC20; - using SafeMath for uint256; - address public immutable vault; - - // user address => token address => staked amount - mapping(address => mapping(address => uint256)) public stakedBalance; - - constructor(address _vault) { - vault = _vault; - } - - modifier onlyVault() { - require(msg.sender == vault, "Only Vault"); - _; - } - - function stake( - address user, - address token, - uint256 amount - ) external override onlyVault { - uint256 balanceBefore = IERC20(token).balanceOf(address(this)); - IERC20(token).safeTransferFrom(msg.sender, address(this), amount); - uint256 balanceAfter = IERC20(token).balanceOf(address(this)); - uint256 _amount = balanceAfter.sub(balanceBefore, "No amount received"); - stakedBalance[user][token] += _amount; - } - - function unstake( - address user, - address token, - uint256 amount - ) external override onlyVault { - stakedBalance[user][token] = stakedBalance[user][token].sub( - amount, - "User balance too low" - ); - IERC20(token).safeTransfer(user, amount); - } -} -``` - -
- -
-Deployed Contracts for Reference - -**Polygon Mumbai Testnet** - -Vault - -[https://mumbai.polygonscan.com/address/0x92c618b8e726d4645e2614959acd15eec3363076](https://mumbai.polygonscan.com/address/0x92c618b8e726d4645e2614959acd15eec3363076) - -Stake - -[https://mumbai.polygonscan.com/address/0xd5b007b13ed9ad0dc6cd41714ea71408c66ed28d](https://mumbai.polygonscan.com/address/0xd5b007b13ed9ad0dc6cd41714ea71408c66ed28d) - -**Avalanche Fuji Testnet** - -Vault - -[https://testnet.snowtrace.io/address/0xB3793af97Ef6BDF7b794F1Ed22B7A8bd056706C7](https://testnet.snowtrace.io/address/0xB3793af97Ef6BDF7b794F1Ed22B7A8bd056706C7) - -Stake - -[https://testnet.snowtrace.io/address/0x1c13a59ddaDb2deaBAf488e0bBFc9254DCe59F9b](https://testnet.snowtrace.io/address/0x1c13a59ddaDb2deaBAf488e0bBFc9254DCe59F9b) - -
diff --git a/docs/discover/README.mdx b/docs/discover/README.mdx index f0f379d3..6ecab218 100644 --- a/docs/discover/README.mdx +++ b/docs/discover/README.mdx @@ -21,7 +21,7 @@ import { Contribute, Guide, Network, - VoyagerIcon + NitroIcon } from '../../src/icons'; @@ -29,56 +29,56 @@ This section provides an overview of the different iDapps developed using Router ## iDapps
- } - /> + } + /> } - /> - } + to="https://app.routernitro.com" + icon={} /> + } + />
## Tools
- } - /> - } - /> - } - /> } - /> - } - /> + title="Router Explorer" + description="A block explorer to monitor cross-chain transactions." + to="https://routerscan.io/" + icon={} + /> + } + /> + } + /> + } + /> + } + />
\ No newline at end of file diff --git a/docs/overview/README.md b/docs/overview/README.md index 81acc5b6..33c5d5d7 100755 --- a/docs/overview/README.md +++ b/docs/overview/README.md @@ -26,8 +26,8 @@ CrossTalk supports both stateful and stateless bridging: - For dApps that do not require any custom bridging logic or any data aggregation layer in the middle, no middleware contract is required. -## Global Liquidity via Voyager -Voyager is a cross-chain swapping engine that allows for cross-chain asset transfers as well as cross-chain sequencing of asset transfers and arbitrary instruction transfers. Voyager has a whole development suite around it, which includes: +## Global Liquidity via Nitrp +Nitro is a cross-chain swapping engine that allows for cross-chain asset transfers as well as cross-chain sequencing of asset transfers and arbitrary instruction transfers. Nitro has a whole development suite around it, which includes: 1. a widget that can be used by other projects to give their users an option to perform cross-chain transactions directly from their UI; -2. an API and a SDK that abstracts Voyager's backend capabilities for projects that want to use their own UI/platform for offering the cross-chain asset swap functionality; +2. an API and a SDK that abstracts Nitro's backend capabilities for projects that want to use their own UI/platform for offering the cross-chain asset swap functionality; 3. most importantly, the sequencer library, which allows developers to build cross-chain applications that require both asset transfer and instruction transfer in a single cross-chain request. \ No newline at end of file diff --git a/docs/overview/choosing-the-right-framework.md b/docs/overview/choosing-the-right-framework.md index f1caf8b9..6b9cc765 100644 --- a/docs/overview/choosing-the-right-framework.md +++ b/docs/overview/choosing-the-right-framework.md @@ -22,4 +22,4 @@ If an application does not require any logic in the middle or does not need any ### Nitro -Nitro (previously Voyager) is the native cross-chain asset-transfer bridge built on Router. It acts as the gateway to the liquidity managed by Router Protocol. Developers can use Voyager to access this liquidity and build either (a) other asset-transfer applications or (b) applications requiring both an asset transfer and an instruction transfer in a single sequenced cross-chain request. A very good example of the latter is a cross-chain staking application that needs to transfer users' funds and an instruction to stake them in a particular contract, both in a single cross-chain request. +Nitro (previously Voyager) is the native cross-chain asset-transfer bridge built on Router. It acts as the gateway to the liquidity managed by Router Protocol. Developers can use Nitro to access this liquidity and build either (a) other asset-transfer applications or (b) applications requiring both an asset transfer and an instruction transfer in a single sequenced cross-chain request. A very good example of the latter is a cross-chain staking application that needs to transfer users' funds and an instruction to stake them in a particular contract, both in a single cross-chain request. diff --git a/docs/validators/running-a-validator/_category_.json b/docs/validators/running-a-validator/_category_.json index 73287251..6458f02d 100644 --- a/docs/validators/running-a-validator/_category_.json +++ b/docs/validators/running-a-validator/_category_.json @@ -1,6 +1,6 @@ { "label": "Running a Validator", - "position": 4, + "position": 5, "link": { "type": "generated-index", "description": "Learn how to run a validator on different chain instances:" diff --git a/docs/validators/running-a-validator/on-devnet/README.md b/docs/validators/running-a-validator/on-devnet/README.md deleted file mode 100644 index 69419db9..00000000 --- a/docs/validators/running-a-validator/on-devnet/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# On Devnet - -## Hardware Requirements -Validators should be able to host one or more data center locations with redundant power, networking, firewalls, HSMs, and servers. The initial minimum recommended hardware specifications are specified below. These may change as network usage increases. - -```jsx --> Ubuntu 22.04.x --> 4+ vCPU x64 2.0+ GHz --> 32+ GB RAM --> 1TB+ SSD -``` - -:::tip -To check you system configuration, run the following command on your terminal/command prompt: -- **On Linux:** `lshw` or `cat /proc/cpuinfo` -- **On macOS:** `system_profiler SPHardwareDataType` -- **On Windows:** `systeminfo`' -::: - -## Running a Validator on Router Devnet -To run a validator on Router chain's devnet, follow these 3 steps: -- [Run a Node on Devnet](./on-devnet/run-a-node) -- [Setup a Validator Account](./on-devnet/setup-a-validator-account) -- [Configure and Run an Orchestrator Instance](./on-devnet/configure-and-run-an-orchestrator-instance) - - - diff --git a/docs/validators/running-a-validator/on-devnet/_category_.json b/docs/validators/running-a-validator/on-devnet/_category_.json deleted file mode 100644 index 0ca2fb07..00000000 --- a/docs/validators/running-a-validator/on-devnet/_category_.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "label": "On Devnet", - "position": 2 -} \ No newline at end of file diff --git a/docs/validators/running-a-validator/on-devnet/configure-and-run-an-orchestrator-instance.md b/docs/validators/running-a-validator/on-devnet/configure-and-run-an-orchestrator-instance.md deleted file mode 100644 index c46207c6..00000000 --- a/docs/validators/running-a-validator/on-devnet/configure-and-run-an-orchestrator-instance.md +++ /dev/null @@ -1,140 +0,0 @@ ---- -title: Step 3) Configure and Run an Orchestrator Instance -sidebar_position: 3 ---- - -Before proceeding with this step, make sure that you are running a validator. If note, follow [this guide](./setup-a-validator-account) to become a validator. - -
-Step 3.1) Configure the orchestrator - -```bash -mkdir .router-orchestrator -cp network-config/devnet/10001/orchestrator-config.json ~/.router-orchestrator/config.json -cd ~/.router-orchestrator -``` - -Here is how the `config.json` file will look like: -```json -{ - "chains": [ - { - "chainId": "80001", - "chainType": " CHAIN_TYPE_EVM", - "chainName": "Mumbai", - "chainRpc": "", - "blocksToSearch": 1000, - "blockTime": "10s" - }, - { - "chainId": "43113", - "chainType": " CHAIN_TYPE_EVM", - "chainName": "Fuji", - "chainRpc": "", - "blocksToSearch": 1000, - "blockTime": "10s" - }, - { - "chainId": "534353", - "chainType": " CHAIN_TYPE_EVM", - "chainName": "scrollTestnet", - "chainRpc": "", - "blocksToSearch": 1000, - "blockTime": "5s" - }, - { - "chainId": "5001", - "chainType": " CHAIN_TYPE_EVM", - "chainName": "mantleTestnet", - "chainRpc": "", - "blocksToSearch": 1000, - "blockTime": "5s" - }, - { - "chainId": "421613", - "chainType": " CHAIN_TYPE_EVM", - "chainName": "ArbitrumGoerli", - "chainRpc": "", - "blocksToSearch": 1000, - "blockTime": "10s" - } - ], - "globalConfig": { - "mQEndpoint": "amqp://guest:guest@localhost", - "networkType": "testnet", - "routerChainTmRpc": "", //optional - "routerChainGRpc":"", //optional - "dbPath": "processedblock.db", - "evmAddress": "", - "cosmosAddress": "", - "ethPrivateKey": "", - "cosmosPrivateKey": "", - "batchSize": 100, - "batchWaitTime": 15 - } -} -``` - -Update the `chainRpc` in the `config.json` file with valid EVM RPC endpoints for all the chains. - -Orchestrator also requires access to the validator's Cosmos and Ethereum credentials to sign transactions for the corresponding networks. - -### Cosmos Keys - -There are two ways to provide the credential access - a keyring with encrypted keys, or just a private key in plaintext. - -**1. Cosmos Keyring** - -Update the `cosmosPrivateKey` to the validator key name (or account address). Please note that the default keyring backend is a password-encrypted `file` on the disk. - -The keyring path must be pointing to `homedir` of the `routerd` node, in case keys needs to be reused from there. - -**2. Cosmos Private Key (Unsafe)** - -Simply update the `cosmosPrivateKey` with the private key of the validator account. - -To obtain the validator's Cosmos private key, run `routerd keys unsafe-export-eth-key $VALIDATOR_KEY_NAME`. - -### Ethereum Keys - -To provide the credential access, a private key in plaintext needs to be provided. - -**Ethereum Private Key (Unsafe)** - -Simply update the `ethPrivateKey` with an Ethereum private key from a new account. - -### Connection with Router-chain - -To connect with router chain you can keep `networkType` as testnet, or if you are running your own node you can keep it as `local`. -If you need to customize the tmRpc or gRpc settings, you can specify the `routerChainTmRpc` and `routerChainGRpc` options. In this scenario, you should also specify the `networkType` as either "local" or "testnet" so that it can determine the chain ID from there. - -
- -
-Step 3.2) Register the Ethereum address - -Submit `set-orchestrator-address` tx to Routerchain with **orchestrator-router-address** and **orchestrator-eth-address.** - -This tx will register the orchestrator addresses on Routerchain - -```bash -routerd tx attestation set-orchestrator-address [orchestrator-router-address] [orchestrator-eth-address] - -Example: routerd tx attestation set-orchestrator-address router1emlu0gy7hju5pywvmkhy529f7s24ydtm49pwcl 0x1E5B81378a1D484169aB9b133FFD97003316e840 --from my-node --home ~/.routerd --keyring-backend file --chain-id router-1 --fees 100000000000000route -``` - -Successful registration can be verified by checking for Validator's mapped Ethereum address on [list of orchestrators](https://devnet.lcd.routerprotocol.com/router-protocol/router-chain/attestation/list_orchestrators). - -
- -
-Step 3.3) Start the Orchestrator - -```bash -cd ~/.router-orchestrator -router-orchestrator start --reset --config ~/.router-orchestrator/config.json -``` - -After executing the aforementioned commands, your orchestrator instance will start running. - -
\ No newline at end of file diff --git a/docs/validators/running-a-validator/on-devnet/run-a-node.md b/docs/validators/running-a-validator/on-devnet/run-a-node.md deleted file mode 100644 index 804b8dea..00000000 --- a/docs/validators/running-a-validator/on-devnet/run-a-node.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: Step 1) Run a Node -sidebar_position: 1 ---- - -
-Step 1.1) Clone routerd binary - -```bash -wget https://github.com/router-protocol/router-chain-releases -unzip linux-amd64.zip -sudo mv routerd /usr/bin -``` - -
- -
-Step 1.2) Initialize the chain config - -Before running the RouterChain node, it is very important to initialize the chain. - -```bash -# the argument is the custom username of your node, it should be human-readable. -export MONIKER= -# the Router devnet has a chain-id of "router_9603-1" -routerd init $MONIKER --chain-id router_9603-1 -``` - -Running the aforementioned commands will create `routerd` default configuration files at `~/.routerd`. - -
- -
-Step 1.3) Prepare configuration to join the devnet - -Validators need to update the default configuration using devnet's genesis file and application config file, as well as configure their persistent peers with a seed node. - -```bash -git clone https://github.com/router-protocol/network-config - -# copy genesis file to config directory -cp network-config/devnet/10001/genesis.json ~/.routerd/config/ - -# copy config file to config directory -cp network-config/devnet/10001/app.toml ~/.routerd/config/app.toml -cp network-config/devnet/10001/config.toml ~/.routerd/config/config.toml -``` - -Validators can also verify the checksum of the genesis file - `6df41f6f7ea0a3cfaee966b2e25b3a2585545cb676f633eda3b8ea1bedece902` - -```bash -sha256sum ~/.routerd/config/genesis.json -``` - -
- -
-Step 1.4) Configure systemd service for routerd - -Edit the config at `/etc/systemd/system/routerd.service` - -```bash -[Unit] -Description=routerd -After=network.target - -[Service] -User=ubuntu -Group=ubuntu -Type=simple -ExecStart=/usr/bin/routerd --log-level=debug start - -[Install] -``` - -After making these edits, restart the systemd service: - -```bash -# restarting the systemd service -sudo systemctl daemon-reload -sudo systemctl restart routerd -sudo systemctl status routerd - -# enable start on system boot -sudo systemctl enable routerd - -# to check Logs -journalctl -u routerd -f -``` - -
- -
-Step 1.5) Start the chain - -```bash -sudo systemctl stop routerd -sudo systemctl start routerd -``` -After executing these commands, syncing will begin. -
diff --git a/docs/validators/running-a-validator/on-devnet/setup-a-validator-account.md b/docs/validators/running-a-validator/on-devnet/setup-a-validator-account.md deleted file mode 100644 index 28ddd101..00000000 --- a/docs/validators/running-a-validator/on-devnet/setup-a-validator-account.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: Step 2) Setup a Validator Account -sidebar_position: 2 ---- - -Before creating a validator account, make sure you run a node as specified in this [guide](./run-a-node). - -
-Step 2.1) Create a validator account - -To setup a validator account, validators need to first run the keygen command with their desired validator key name. - -```bash -export VALIDATOR_KEY_NAME=[my-validator-key] -routerd keys add $VALIDATOR_KEY_NAME -``` - -This will derive a new private key and encrypt it to disk. - -:::caution -Remember the password used or store it in a safe place. -::: - -```bash -# example output - -- name: myvalidatorkey - type: local - address: router13cyxzsfvmfxsn23spl4nhu0xn307uvj2vju5q0 - pubkey: '{"@type":"/routerprotocol.routerchain.crypto.ethsecp256k1.PubKey", - mnemonic: "" - -**Important** write this mnemonic phrase in a safe place. -It is the only way to recover your account if you ever forget your password. - -usual husband better echo deputy same depart river ritual detail reveal window moon few health remember fortune awful custom fossil tired lake jealous sign -``` -:::tip -The mnemonic phrase is better backed up on a physical paper, storing it in cloud storage may compromise the validator later. -::: - -:::tip -Remember the address starting from `router`, this is the address of your Router chain validator account. -::: - -
- -
-Step 2.2) Obtain ROUTE tokens - -In order to proceed with the next step, validators will have to obtain ROUTE on the Router Chain. - -Funds can be requested from the [devnet faucet](https://devnet-faucet.routerprotocol.com/). - -After a few minutes, you can verify the deposit on the [explorer UI](https://devnet-explorer.routerprotocol.com). Alternatively, account balance can be queried using the `routerd` CLI with the following command: -```bash -routerd q bank balances -``` - -
- -
-Step 2.3) Set the staking parameters and run your validator account - -Obtain your node's tendermint validator Bech32 encoded PubKey consensus address. - -```bash -VALIDATOR_PUBKEY=$(routerd tendermint show-validator) -echo $VALIDATOR_PUBKEY - -# Example: {"@type":"/cosmos.crypto.ed25519.PubKey","key":"ayAh1DfEkV2r2tglb/yWKlk67Xc5VFPFLdWb2zfoR5o="} -``` - -Now, initialize new validator with a self-delegation of ROUTE tokens. Most critically, you will need to decide on the values of the validator's staking parameters. - -- `moniker` - Validator's name -- `amount` - Validator's initial amount of ROUTE to bond -- `commission-max-change-rate` - Validator's maximum commission change rate percentage (per day) -- `commission-max-rate` - Validator's maximum commission rate percentage -- `commission-rate` - Validator's initial commission rate percentage -- `min-self-delegation` - Validator's minimum required self delegation - -Once the parameters are decided, set them as follows - -```bash -MONIKER= -AMOUNT=100000000000000000000router # to delegate 100 ROUTE, as ROUTE is represented with 18 decimals. -COMMISSION_MAX_CHANGE_RATE=0.1 # e.g. for a 10% maximum change rate percentage per day -COMMISSION_MAX_RATE=0.1 # e.g. for a 10% maximum commission rate percentage -COMMISSION_RATE=0.1 # e.g. for a 10% initial commission rate percentage -MIN_SELF_DELEGATION_AMOUNT=50000000000000000000 # e.g. for a minimum 50 ROUTE self delegation required on the validator -``` - -Finally, run the following command to finish setting up your validator. - -```bash -routerd tx staking create-validator \ ---moniker=$MONIKER \ ---amount=$AMOUNT \ ---gas-prices=500000000route \ ---pubkey=$VALIDATOR_PUBKEY \ ---from=$VALIDATOR_KEY_NAME \ ---keyring-backend=file \ ---yes \ ---node=tcp://localhost:26657 \ ---chain-id=router-1 ---commission-max-change-rate=$COMMISSION_MAX_CHANGE_RATE \ ---commission-max-rate=$COMMISSION_MAX_RATE \ ---commission-rate=$COMMISSION_RATE \ ---min-self-delegation=$MIN_SELF_DELEGATION_AMOUNT -``` - -Extra `create-validator` options to consider: - -```bash ---identity= The optional identity signature (ex. UPort or Keybase) ---pubkey= The Bech32 encoded PubKey of the validator ---security-contact= Security contact email (optional) of the validator ---website= Website (optional) of the validator -``` - -Verify that the validator was successfully setup by checking the [staking dashboard](https://devnet-hub.routerprotocol.com/staking) or by entering the CLI command given below. - -```bash -routerd q staking validators -``` - -If you see your validator in the list of validators, then congratulations, you have officially joined the Router devnet as a staking validator! 🎉 - -
- - -After setting up the validator, immediately proceed to setup the orchestrator. This is a necessary step in order to prevent the validator from being slashed. \ No newline at end of file diff --git a/docs/validators/slashing-conditions.md b/docs/validators/slashing-conditions.md index 8aed7513..4de31f9d 100644 --- a/docs/validators/slashing-conditions.md +++ b/docs/validators/slashing-conditions.md @@ -1,6 +1,6 @@ --- title: Slashing Conditions -sidebar_position: 5 +sidebar_position: 6 --- ### Condition 1 - Failure to Submit a Vote or Publishing a Conflicting Vote for Events Emitted by the Gateway Contract diff --git a/docs/validators/supported-networks.md b/docs/validators/supported-networks.md new file mode 100644 index 00000000..f5a396da --- /dev/null +++ b/docs/validators/supported-networks.md @@ -0,0 +1,222 @@ +--- +title: Supported Networks +sidebar_position: 4 +--- + +## Overview +Chains supported by the Router chain are as follows: + +```json +{ + "chains": [ + { + "chainId": "137", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Polygon", + "chainRpc": "https://polygon-rpc.com", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "42161", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Arbitrum", + "chainRpc": "https://arbitrum-one.publicnode.com", + "blocksToSearch": 1000, + "blockTime": "3s" + }, + { + "chainId": "43114", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Avalanche", + "chainRpc": "https://avalanche.public-rpc.com", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "10", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Optimism", + "chainRpc": "https://mainnet.optimism.io", + "blocksToSearch": 1000, + "blockTime": "3s" + }, + { + "chainId": "56", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "BSC", + "chainRpc": "https://bsc-dataseed4.bnbchain.org", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "1101", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "polygonZkEvm", + "chainRpc": "https://zkevm-rpc.com", + "blocksToSearch": 1000, + "blockTime": "10s" + }, + { + "chainId": "324", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "zkSync", + "chainRpc": "https://mainnet.era.zksync.io", + "blocksToSearch": 1000, + "blockTime": "10s" + }, + { + "chainId": "1", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Ethereum", + "chainRpc": "https://eth-pokt.nodies.app", + "blocksToSearch": 1000, + "blockTime": "15s" + }, + { + "chainId": "728126428", + "chainType": "CHAIN_TYPE_TRON", + "chainName": "tron-mainnet", + "chainRpc": "https://api.trongrid.io/jsonrpc", + "chainGRpc": "grpc.trongrid.io:50051", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "8453", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Base", + "chainRpc": "https://base.publicnode.com", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "534352", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Scroll", + "chainRpc": "https://rpc.ankr.com/scroll", + "blocksToSearch": 1000, + "blockTime": "10s" + }, + { + "chainId": "169", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Manta", + "chainRpc": "https://pacific-rpc.manta.network/http", + "blocksToSearch": 1000, + "blockTime": "10s" + }, + { + "chainId": "5000", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Mantle", + "chainRpc": "https://rpc.mantle.xyz", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "34443", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Mode Network", + "chainRpc": "https://1rpc.io/mode", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "288", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "BOBA Network", + "chainRpc": "https://mainnet.boba.network", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "1088", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Metis Network", + "chainRpc": "https://andromeda.metis.io/?owner=1088", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "10242", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Arthera Mainnet", + "chainRpc": " https://rpc.arthera.net", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "30", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "RootStock", + "chainRpc": "https://public-node.rsk.co", + "blocksToSearch": 1000, + "blockTime": "3s" + }, + { + "chainId": "1313161554", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Aurora", + "chainRpc": "https://mainnet.aurora.dev", + "blocksToSearch": 1000, + "blockTime": "3s" + }, + { + "chainId": "59144", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Linea", + "chainRpc": "https://rpc.linea.build", + "blocksToSearch": 1000, + "blockTime": "2s" + }, + { + "chainId": "81457", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "BlastL2", + "chainRpc": "https://blast.blockpi.network/v1/rpc/public", + "blocksToSearch": 1000, + "blockTime": "2s" + }, + { + "chainId": "7225878", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Saakuru Mainnet", + "chainRpc": "https://rpc-mainnet.saakuru.network/", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "200901", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "bitlayer-mainnet", + "chainRpc": "https://rpc.bitlayer-rpc.com", + "blocksToSearch": 1000, + "blockTime": "5s" + }, + { + "chainId": "167000", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Taiko", + "chainRpc": "https://rpc.taiko.xyz", + "blocksToSearch": 1000, + "blockTime": "60s" + }, + { + "chainId": "near", + "chainType": "CHAIN_TYPE_NEAR", + "chainName": "near-mainnet", + "chainRpc": "https://rpc.mainnet.near.org", + "blocksToSearch": 10000, + "blockTime": "2s", + "useStreamerApi": true, + "nearStreamerApi": "http://13.233.000.00:6902/" + } + ] +} +``` + +:::info +1. For better performance, please use premium RPCs or self deployed nodes for the above supported networks. +2. For Near chain, please set up streamer before enabling it for orchestration. +::: diff --git a/docusaurus.config.js b/docusaurus.config.js index aca5c053..53132c60 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -199,6 +199,12 @@ const config = { position: 'left', // className: 'new-badge', }, + { + label: 'Audits', + to: 'https://github.com/router-protocol/audit-reports', + position: 'left', + // className: 'new-badge', + }, // { // label: 'Learn', // to: '/learn', @@ -220,17 +226,17 @@ const config = { // to: 'apis', // position: 'left', // }, - { - type: 'dropdown', - label: 'v2.0', - position: 'left', - items: [ - { - label: 'v1.0', - href: 'https://v1.docs.routerprotocol.com', - } - ], - }, + // { + // type: 'dropdown', + // label: 'v2.0', + // position: 'left', + // items: [ + // { + // label: 'v1.0', + // href: 'https://v1.docs.routerprotocol.com', + // } + // ], + // }, // { // href: 'https://github.com/router-protocol', // className: 'pseudo-icon github-icon', @@ -270,12 +276,12 @@ const config = { href: 'https://routerprotocol.com/', }, { - label: 'Voyager', - href: 'https://app.thevoyager.io/', + label: 'Nitro', + href: 'https://app.routernitro.com/', }, { - label: 'Explorer', - href: 'https://explorer.testnet.routerchain.dev', + label: 'Nitro Explorer', + href: 'https://explorer.routernitro.com', }, { label: 'Careers', @@ -291,8 +297,12 @@ const config = { title: 'Resources', items: [ { - label: 'Whitepaper', - href: 'https://global-uploads.webflow.com/61d1382fe0e915f2953f9500/63ecc619fa7285237ea184f3_Router%20Chain%20Whitepaper.pdf', + label: 'Router Chain Whitepaper', + href: 'https://www.routerprotocol.com/router-chain-whitepaper.pdf', + }, + { + label: 'Router CCIF Whitepaper', + href: 'https://www.routerprotocol.com/router-ccif-whitepaper.pdf' }, { label: 'Developer Portal', @@ -306,10 +316,10 @@ const config = { label: 'Medium', href: 'https://routerprotocol.medium.com/', }, - { - label: 'Community', - href: 'https://discord.com/invite/yjM2fUUHvN', - }, + // { + // label: 'Community', + // href: 'https://discord.com/invite/yjM2fUUHvN', + // }, ], }, { diff --git a/src/components/HomepageComponents.jsx b/src/components/HomepageComponents.jsx index 2fbda6dd..df81566b 100644 --- a/src/components/HomepageComponents.jsx +++ b/src/components/HomepageComponents.jsx @@ -31,7 +31,7 @@ export function DocVersion(){ return(
- The documentation provided below pertains to Router V2. If you require documentation for V1, please refer to the following link. + The documentation provided below pertains to Router Chain and Router Nitro. For documentation around Router Intents, please refer to the following link.
); } diff --git a/src/icons/NitroIcon.jsx b/src/icons/NitroIcon.jsx new file mode 100644 index 00000000..ebddf2cd --- /dev/null +++ b/src/icons/NitroIcon.jsx @@ -0,0 +1,20 @@ +import React from "react"; + +export default function NitroIcon(props) { + return ( + + + + ); +} + diff --git a/src/icons/index.jsx b/src/icons/index.jsx index 1737bde7..6a3e851e 100644 --- a/src/icons/index.jsx +++ b/src/icons/index.jsx @@ -9,6 +9,7 @@ export { default as VueIcon } from './VueIcon'; export { default as SwiftIcon } from './SwiftIcon'; export { default as KotlinIcon } from './KotlinIcon'; export { default as VoyagerIcon } from './VoyagerIcon'; +export { default as NitroIcon } from './NitroIcon'; export { default as NearIcon } from './NearIcon'; export { default as EthereumIcon } from './EthereumIcon'; export { default as RouterIcon } from './RouterIcon'; diff --git a/src/pages/index.jsx b/src/pages/index.jsx index b5251986..d3ca3c76 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -26,6 +26,7 @@ import { Contribute, Network, Omnichain, + NitroIcon, } from '../icons'; import GuidesSection from '../components/GuidesSection'; @@ -52,19 +53,19 @@ export default function Homepage() {
- Build your first iDapp (Interoperable dApp) using Router's crosstalk in 5 simple steps. + Build your first iDapp (Interoperable dApp) using Router's CrossTalk in 5 simple steps. } > } /> } /> @@ -99,27 +100,27 @@ export default function Homepage() {
-
+
} /> - {/* } + } /> } - /> */} + />
-
+
} /> } /> } + title="Router Intent Store" + description="A place where developers can add their own intent adapters or explore existing ones." + to="https://store.routerintents.com/" + icon={} />
@@ -164,14 +165,14 @@ export default function Homepage() { /> } />
-
+