docs: add RBTC–USDT0 Cross-Chain Lending Starter Kit documentation#439
docs: add RBTC–USDT0 Cross-Chain Lending Starter Kit documentation#439entuziaz wants to merge 12 commits intorsksmart:mainfrom
Conversation
|
@entuziaz is attempting to deploy a commit to the IOV Labs Team on Vercel. A member of the Team first needs to authorize it. |
Removed project illustration diagram from the tutorial.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This guide shows how to deploy and use a cross-chain lending starter kit on Rootstock. It describes the architecture, setup, deployment, and how to use a frontend dApp. The guide is structured for developers who know EVM but are new to Rootstock or cross-chain protocols. Architecture diagrams and UI screenshots improve understanding. Still, the documentation could be better in terms of clarity, completeness, correct commands, and accurate code snippets. The code execution results point out that standalone JavaScript snippets lack context, which can confuse readers trying to run them. Review: Docs/02-developers/09-use-cases/defi/cross-chain-lending-rbtc.md (overall document)The document's overall structure is good. It begins with an introduction and moves through setup, core concepts, and advanced considerations. The Docusaurus-style metadata ( A small issue is that "starter kit" is used repeatedly in the title and description, which could be shortened. Active voice and imperative mood are used consistently, which is good. Review: table of contentsThe table of contents is clear, well-structured, and shows the document's sections accurately. It provides a good overview for readers to navigate the detailed content. Review: introductionThe introduction clearly states the tutorial's purpose and scope, explaining what readers will learn. The target audience is clear. A screenshot and architecture diagram early on are great visual aids to quickly understand the project's goal and structure. The alt text for the images is descriptive. Review: why build on rootstock?This section effectively points out the main benefits of building on Rootstock, which is important for convincing developers to use the platform. The points are short and apply to DeFi applications. Review: core architectureThis section breaks down the protocol into logical layers and describes key contract responsibilities. This is explained well and uses clear language. CodeThe Solidity excerpt from DiagramsFigure 3 showing the high-level contract interaction is useful, although its title could be more specific (e.g., "Contract Interaction Diagram"). Review: prerequisitesThe list of prerequisites is straightforward. It is good to specify minimum versions for Git and Node.js. Clarity
Review: cloning and initial setupThe instructions are clear and standard for repository cloning. Review: environment configurationThis section provides important information for setting up the SecurityThe Completeness
Review: installing dependenciesThe commands for installing dependencies are correct and clearly specify which directory each Review: compiling contracts and generating abisThe instruction Review: running the test suiteThis section clearly explains how to run tests and lists main test files. The command for running a single test file is also useful. TroubleshootingThe advice to delete Review: deployment walkthroughThis section explains the deployment script and its output. Command correctness
CompletenessThe "Addresses will vary; keep them for the frontend or explorer verification" note is important. Verifying on explorerThe verification command is provided, but it's important to clarify which address and constructor arguments to use. While it's implied that addresses come from the deployment output, a quick example using one of the deployed contracts would be clearer. Review: using the frontend dappThis section shows how to use the dApp. Command correctness
Prerequisites"Proper MetaMask configuration is important. Make sure an RSK testnet network entry exists and the current account holds at least 0.001 rBTC. Use the Rootstock faucet to top up if necessary." – This is well-placed and important information. Code execution results analysis (snippet 1)The CompletenessThe frontend folder structure diagram is a good addition for understanding the project layout. Review: protocol mechanicsThis section goes into the smart contract logic for borrowing, repayment, withdrawal, and solvency. Technical accuracyThe CodeThe Solidity snippets are accurate and help show the described mechanics. Review: oracle setup and pricing modelThis section clearly explains the oracle architecture, showing the difference between market assets and accounting units. Technical accuracyThe explanation of Code execution results analysis (snippet 2)The Review: cross-chain flow explainedThis section clearly explains the LayerZero cross-chain mechanism, describing user actions, receiver validation, and the deposit/borrow flow. ClarityThe clarification SecurityThe "Timing risk" explanation is a good point about security and design. Review: known limitationsThis is a good and honest section. Explicitly stating limitations, especially for a starter kit, is important for developers who want to extend it for production use. CompletenessIt covers testnet issues, mock behaviors, and missing core DeFi features (liquidations, interest, governance). Review: security considerationsThis section repeats the README's security section with added context, which is useful. ImportanceThe CompletenessIt covers role isolation, oracle staleness, bridge trust, lack of liquidations/interest, and owner privileges. This is a thorough list for a starter kit. Review: troubleshooting and tipsThis section is helpful, offering solutions to common issues during development and deployment. CompletenessIt addresses test failures, deployment errors, frontend issues, LayerZero configuration, and oracle problems. The tips are practical. Review: faq & next stepsThis section answers common questions and provides a roadmap for extending the project. ClarityThe answers are concise and practical. The "roadmap" provides good guidance for future development. Terminology"What is USDT0?" is a good question to answer, explaining its role as an accounting unit. Review: creditsProperly attributing the original creators and inspirations is a good practice and well-done here. Summary of code execution results:The errors from the JavaScript snippets are mostly because the execution environment is missing the needed context (e.g., Overall grammar and style:The documentation is mostly well-written with good grammar, following technical writing best practices.
The structured findings suggest some small grammar improvements or clarifications. Clarity and completeness:The document is clear and complete. The main areas to improve are:
Overall, this is good documentation that works well. 💬 Comment posted via Revue - Documentation Review Tool |
|
|
||
| > This document is the **comprehensive tutorial** for the rBTC-USDT0 cross‑chain lending starter kit. | ||
|
|
||
| ## Table of Contents |
There was a problem hiding this comment.
You can remove the table of content header here as the docs, already provides a way to navigate the content
| ```text | ||
| # .env | ||
| PRIVATE_KEY=0xYOUR_TESTNET_PRIVATE_KEY # account that will deploy contracts | ||
| ROOTSTOCK_RPC_URL=https://public-node.testnet.rsk.co |
There was a problem hiding this comment.
Kindly update the env to use the RPC API Testnet URL https://rpc.rootstock.io/ both on the starter kit and docs
There was a problem hiding this comment.
Okay. I'll do just that.
| LTV_BPS=7000 # 70% Loan-to-Value ratio (in basis points) | ||
| ``` | ||
|
|
||
| > ⚠️ Never commit this file. In production you would use a secrets manager or hardware wallet. |
There was a problem hiding this comment.
|
|
||
| 1. Open the URL in your browser. | ||
|
|
||
| 2. Connect MetaMask (make sure the network is set to RSK Testnet). |
There was a problem hiding this comment.
| 2. Connect MetaMask (make sure the network is set to RSK Testnet). | |
| 2. Connect MetaMask (make sure the network is set to Rootstock Testnet). |
| --- | ||
| sidebar_label: Cross-Chain RBTC Lending Starter Kit | ||
| sidebar_position: 3 | ||
| title: Cross-Chain rBTC-Backed Lending & USDT0 Stablecoin Starter Kit |
There was a problem hiding this comment.
| title: Cross-Chain rBTC-Backed Lending & USDT0 Stablecoin Starter Kit | |
| title: Build a Cross-Chain Lending dApp using rBTC & USDT0 on Rootstock |
| tags: [rsk, rootstock, lending, cross-chain, layerzero, umbrella, redstone, smart contracts, tutorials] | ||
| --- | ||
|
|
||
| # RBTC-USDT0 Cross‑Chain Starter‑Kit Guide |
There was a problem hiding this comment.
| # RBTC-USDT0 Cross‑Chain Starter‑Kit Guide |
| sidebar_position: 3 | ||
| title: Cross-Chain rBTC-Backed Lending & USDT0 Stablecoin Starter Kit | ||
| description: 'A minimal rBTC-collateralized lending starter kit for Rootstock. Includes mock oracle integration, USDT0 ERC-20 support, and guidance for extending the system with LayerZero and Umbrella/RedStone price feeds.' | ||
| tags: [rsk, rootstock, lending, cross-chain, layerzero, umbrella, redstone, smart contracts, tutorials] |
There was a problem hiding this comment.
| tags: [rsk, rootstock, lending, cross-chain, layerzero, umbrella, redstone, smart contracts, tutorials] | |
| tags: [rsk, rootstock, rbtc, usdt0, lending, cross-chain, layerzero, umbrella, redstone, smart contracts, tutorials] |
| * **Low fees & high throughput:** test cheaply and scale without congestion. | ||
| * **Open source tooling:** the entire stack is public and free to use. | ||
|
|
||
| This starter kit demonstrates a cross‑chain over‑collateralized lending flow that leverages RSK's features while remaining easy to understand. |
There was a problem hiding this comment.
| This starter kit demonstrates a cross‑chain over‑collateralized lending flow that leverages RSK's features while remaining easy to understand. | |
| This starter kit demonstrates a cross‑chain over‑collateralized lending flow that leverages Rootstock's features while remaining easy to understand. |
|
@owans, kindly check out the latest updates. Thanks for your review! |
|
|
||
| ## Cloning and initial setup | ||
|
|
||
| Start by cloning the repository and moving into it: |
There was a problem hiding this comment.
| Start by cloning the repository and moving into it: | |
| Clone the repository and cd into it: |
|
|
||
| ## Environment configuration | ||
|
|
||
| Create a `.env` file in the project root. This file is ignored by git and will store sensitive data such as keys and RPC URLs. |
There was a problem hiding this comment.
Here, you can refer the user to copy and paste the sample .env.example, makes it easier
There was a problem hiding this comment.
Yeah, makes sense.
| All addresses printed by the script are needed for the frontend. | ||
|
|
||
| ```bash | ||
| npx hardhat run scripts/deploy.js --network rsktest |
There was a problem hiding this comment.
| npx hardhat run scripts/deploy.js --network rsktest | |
| npx hardhat run scripts/deploy.js --network rootstock_testnet |
There was a problem hiding this comment.
Thanks for pointing that out.
|
|
||
| The protocol distinguishes between **market assets** (rBTC) and **accounting units** (USDT0). Only market assets require external price feeds. | ||
|
|
||
| ### Price sources |
There was a problem hiding this comment.
The table is broken, not rendering properly
There was a problem hiding this comment.
Oops! The blank lines.
|
|
||
| The README's security section is reproduced here with extra context: | ||
|
|
||
| * **Role isolation**: only `LZReceiver` may call `depositRBTC` thanks to the `onlyDepositor` modifier. Do **not** set this to an EOA. |
There was a problem hiding this comment.
| * **Role isolation**: only `LZReceiver` may call `depositRBTC` thanks to the `onlyDepositor` modifier. Do **not** set this to an EOA. | |
| * **Role isolation**: Only `LZReceiver` may call `depositRBTC`, made possible by the `onlyDepositor` modifier. Do **not** set this to an EOA. |
|
|
||
| 3. **Multi‑asset support:** enable multiple collateral tokens using the same router pattern. | ||
|
|
||
| 4. **Stargate/OFT integration:** explore LayerZero's Omnichain Fungible Token standard for asset bridging. |
There was a problem hiding this comment.
| 4. **Stargate/OFT integration:** explore LayerZero's Omnichain Fungible Token standard for asset bridging. | |
| 4. **Stargate/OFT integration:** Explore LayerZero's Omnichain Fungible Token standard for asset bridging. |
|
|
||
| :::info[Credit] | ||
|
|
||
| 1. This tutorial and [starter kit](https://github.com/entuziaz/rbtc-usdt0-crosschain-starter-kit) were originally created by [@entuziaz](https://github.com/entuziaz) during the Rootstock Hacktivator program. |
There was a problem hiding this comment.
| 1. This tutorial and [starter kit](https://github.com/entuziaz/rbtc-usdt0-crosschain-starter-kit) were originally created by [@entuziaz](https://github.com/entuziaz) during the Rootstock Hacktivator program. | |
| 1. This tutorial and [starter kit](https://github.com/rsksmart/rbtc-usdt0-crosschain-starter-kit) were originally created by [@entuziaz](https://github.com/entuziaz) during the Rootstock Hacktivator program. |
|
|
||
| No prior knowledge of LayerZero or cross‑chain protocols is required. We'll explain every architectural decision and code pattern, with a particular focus on the teleport‑style messaging model that powers collateral transfer, the oracle routing pattern that separates price feeds from lending logic, and the Loan‑to‑Value (LTV) solvency checks that protect the protocol. | ||
|
|
||
| By the end of this tutorial you will have: |
There was a problem hiding this comment.
| By the end of this tutorial you will have: | |
| By the end of this tutorial, you will have: |
|
|
||
| :::info[Info] | ||
|
|
||
| This is the **comprehensive tutorial** for the rBTC-USDT0 cross‑chain lending starter kit. |
There was a problem hiding this comment.
Please link the starter kit here, with rsksmart as the ref
There was a problem hiding this comment.
Okay. Done. But the rsksmart link is not available yet.
|
|
||
|
|
||
| ```bash | ||
| git clone https://github.com/entuziaz/rbtc-usdt0-crosschain-starter-kit.git |
There was a problem hiding this comment.
| git clone https://github.com/entuziaz/rbtc-usdt0-crosschain-starter-kit.git | |
| git clone https://github.com/rsksmart/rbtc-usdt0-crosschain-starter-kit.git |
Title
Complete documentation guide for the RBTC–USDT0 Lending Boilerplate (https://github.com/rsksmart/rbtc-usdt0-lending-boilerplate).
Description
This PR adds a complete documentation guide for the RBTC–USDT0 Lending Boilerplate. It expands the boilerplate into a cross-chain starter kit by providing:
No contract logic was modified. This PR adds documentation only.
anges.
Testing
N/A
Checklist
Refs