Skip to content

Commit

Permalink
Devportal auto implemlementation (#294)
Browse files Browse the repository at this point in the history
* feat adding settings for automation in devportal
  • Loading branch information
SebasGuaquetaRSK authored Dec 19, 2024
1 parent 3b67ce8 commit 90c3526
Show file tree
Hide file tree
Showing 21 changed files with 1,636 additions and 54 deletions.
266 changes: 266 additions & 0 deletions .github/workflows/devportal-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
name: Update Devportal Documentation

on:
push:
paths:
- 'README.md'
branches:
- main

permissions: read-all

jobs:
update-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

# Step 1: Clone the Devportal Repository
- name: Clone Devportal Repository
env:
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
run: |
TIMESTAMP=$(date +'%Y%m%d-%H%M%S')
BRANCH_NAME="update-from-rif-relay-${TIMESTAMP}"
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV
git clone https://github.com/rsksmart/devportal.git
cd devportal
git checkout -b ${BRANCH_NAME} || git checkout ${BRANCH_NAME}
cd ..
# Step 2: Transform Each File and Copy to Devportal Repository
- name: Transform Files for Devportal
run: |
mkdir -p transformed
# Remove the unwanted first lines from README.md
TEMP_FILE="temp_README.md"
tail -n +1 README.md > ${TEMP_FILE}
# Remove the unwanted lines between START and END comments
sed '/<!--START-->/,/<!--END-->/d' README.md > ${TEMP_FILE}
# Process main README.md
TRANSFORMED_FILE="transformed/README.md"
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Overview" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 100" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay - Overview" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay Overview." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, integrate, integration guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
echo ":::info[Note]" >> ${TRANSFORMED_FILE}
echo "If you wish to suggest changes on this document, please open a PR on the [Rif Relay Repository](https://github.com/rsksmart/rif-relay.git)" >> ${TRANSFORMED_FILE}
echo ":::" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/overview.md
# Process integrations section
TEMP_FILE="temp_integrate.md"
TRANSFORMED_FILE="transformed/integrate.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/integrate.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Integrations" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 200" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay Integration" >> ${TRANSFORMED_FILE}
echo "description: Integrating RIF Relay in a dApp." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, integration guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/integrate.md
# Process setup section
TEMP_FILE="temp_installation-requirements.md"
TRANSFORMED_FILE="transformed/installation-requirements.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/installation-requirements.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Setup" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 300" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay Installation Requirements" >> ${TRANSFORMED_FILE}
echo "description: Requirements for installing RIF Relay." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, user, guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/installation-requirements.md
# Process sample dapp section
TEMP_FILE="temp_sample-dapp.md"
TRANSFORMED_FILE="transformed/sample-dapp.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/sample-dapp.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: RIF Relay Sample dApp" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 400" >> ${TRANSFORMED_FILE}
echo "title: How to use the RIF Relay Sample dApp SDK" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay Sample dApp SDK Starter kit." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, integration guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/sample-dapp.md
# Process deployment section
TEMP_FILE="temp_deployment.md"
TRANSFORMED_FILE="transformed/deployment.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/deployment.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: RIF Relay Deployment" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 500" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay Deployment" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay deployment process." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, integration guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/deployment.md
# Process develop section
TEMP_FILE="temp_develop.md"
TRANSFORMED_FILE="transformed/develop.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/develop.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Develop" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 600" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay Develop" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay deployment process." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, user, guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/develop.md
# Process contracts section
TEMP_FILE="temp_contracts.md"
TRANSFORMED_FILE="transformed/contracts.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/contracts.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Contracts" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 700" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay - Contracts" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay Contracts." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, integrate]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/contracts.md
# Process smart wallets section
TEMP_FILE="temp_smart-wallets.md"
TRANSFORMED_FILE="transformed/smart-wallets.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/smart-wallets.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Smart Wallets" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 800" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay Smart Wallets" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay Smart Wallets." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, user, guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/smart-wallets.md
# Process versions section
TEMP_FILE="temp_versions.md"
TRANSFORMED_FILE="transformed/versions.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/versions.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Versions" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 900" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay Versions" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay Versions." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, rif relay, integration guide]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/versions.md
# Process gas costs section
TEMP_FILE="temp_gas-costs.md"
TRANSFORMED_FILE="transformed/gas-costs.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/gas-costs.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Gas Costs" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 950" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay - Gas Costs" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay Gas Costs." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, integrate]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/gas-costs.md
# Process architecture section
TEMP_FILE="temp_architecture.md"
TRANSFORMED_FILE="transformed/architecture.md"
# Remove the unwanted first lines from section (title)
tail -n +2 docs/architecture.md > ${TEMP_FILE}
echo "---" > ${TRANSFORMED_FILE}
echo "sidebar_label: Architecture" >> ${TRANSFORMED_FILE}
echo "sidebar_position: 980" >> ${TRANSFORMED_FILE}
echo "title: RIF Relay - Architecture" >> ${TRANSFORMED_FILE}
echo "description: RIF Relay Architeture." >> ${TRANSFORMED_FILE}
echo "tags: [rif, envelope, relay, integrate]" >> ${TRANSFORMED_FILE}
echo "---" >> ${TRANSFORMED_FILE}
echo "" >> ${TRANSFORMED_FILE}
cat ${TEMP_FILE} >> ${TRANSFORMED_FILE}
# Clean up temporary file
rm ${TEMP_FILE}
cp ${TRANSFORMED_FILE} devportal/docs/02-developers/06-integrate/01-rif-relay/architecture.md
# Step 3: Commit and Push Changes to Devportal Repository
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
run: |
cd devportal
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/02-developers/06-integrate/01-rif-relay/overview.md docs/02-developers/06-integrate/01-rif-relay/integrate.md docs/02-developers/06-integrate/01-rif-relay/installation-requirements.md docs/02-developers/06-integrate/01-rif-relay/sample-dapp.md docs/02-developers/06-integrate/01-rif-relay/deployment.md docs/02-developers/06-integrate/01-rif-relay/develop.md docs/02-developers/06-integrate/01-rif-relay/contracts.md docs/02-developers/06-integrate/01-rif-relay/smart-wallets.md docs/02-developers/06-integrate/01-rif-relay/versions.md docs/02-developers/06-integrate/01-rif-relay/gas-costs.md docs/02-developers/06-integrate/01-rif-relay/architecture.md
git commit -m "Automated update from repository"
# Configure the remote URL with the token for authentication
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/rsksmart/devportal.git
git push -f origin ${BRANCH_NAME}
# Step 4: Create a Pull Request in the Devportal Repository
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}
run: |
cd devportal
curl -L -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DEVPORTAL_DOCS_UPDATE_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/rsksmart/devportal/pulls \
-d "{\"title\":\"Rif-relay automated update of documentation ${BRANCH_NAME}\",\"body\":\"This PR updates the Devportal documentation with the latest changes from the original repository.\",\"head\":\"${BRANCH_NAME}\",\"base\":\"main\"}"
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# RIF Relay
Most blockchains have native cryptocurrency to pay for transaction fees and gas consumption; this simple design has many benefits. First, to bootstrap an economy, the native cryptocurrency model creates an initial demand for it. Second, it simplifies the interaction between users and miners because it forces them to use the same means of payment. Third, it reduces the complexity of the consensus rules. Finally, it provides Denial of Service (DoS) protection to the network as full nodes can pay what the miners expect to include a received transaction. This way nodes can decide to propagate a transaction or not, preventing the free consumption of network bandwidth, and stop spam transactions.

Cryptocurrencies tend to be associated with volatility and to counter measure this fact, Stablecoins were introduced. Stablecoins bridge the worlds of cryptocurrency and everyday fiat currency because their prices are pegged to a reserve asset like the U.S. dollar or gold.

But with the advent of Decentralized Finance (DeFi), several stable coins have become a preferred means of payment and savings for both users and miners, therefore, separate systems to facilitate alternative payment mechanisms. Transactions that enable paying transactions with any coin other than the native currency are named meta-transactions because in some systems the user transaction is embedded in a higher-level (or meta) transaction created by a third party. A more accessible term for these transactions is “envelopes” or, for the whole system, a relay system. A meta-transaction/relay system can serve at least two different use cases: 1) pay the transaction fees with tokens, where one new party receives the tokens (from the user) and pays the fees on behalf of the user, and 2) enable smart contract developers to subsidize the gas used to interact with their contracts.

With this in mind, the main goal of the RIF Relay Project is to **provide the Rootstock (RSK) ecosystem with the means to allow blockchain applications and end-users (wallet-apps) to transact without needing RBTC**. The system should allow Rootstock (RSK) users to pay transaction fees with methods of payment (i.e., tokens) other than RBTC while maintaining their accounts as transaction senders.

RIF Relay takes its inspiration from the [Gas Station Network (GSN) project](https://github.com/opengsn/gsn). GSN is a decentralized system that improves dApp usability without sacrificing security. In a nutshell, GSN abstracts away gas (used to pay transaction fees) to minimize onboarding and UX friction for dApps. With GSN, "gasless clients" can interact with smart contracts paying for gas with tokens instead of native-currency.

<!--START-->
<!--IMPORTANT NOTE: In this region here, the information is omited in the Devportal -->
## Index
The project information is divided into different sections, which you can explore through the following links:

- [RIF Relay Integration](./docs/integrate.md)
- [RIF Relay Installation Requirements](./docs/installation-requirements.md)
- [How to use the RIF Relay Sample dApp SDK](./docs/sample-dapp.md)
- [RIF Relay Deployment](./docs/deployment.md)
- [RIF Relay Develop](./docs/develop.md)
- [RIF Relay - Contracts](./docs/contracts.md)
- [RIF Relay Smart Wallets](./docs/smart-wallets.md)
- [RIF Relay Versions](./docs/versions.md)
- [RIF Relay - Gas Costs](./docs/gas-costs.md)
- [RIF Relay - Architecture](./docs/architecture.md)
<!--IMPORTANT NOTE: In this region here, the information is omited in the Devportal-->
<!--END-->

## Modules

RIF Relay is built in modules, the entire system is made up by 3 modules.

1. [RIF Relay Contracts](https://github.com/rsksmart/rif-relay-contracts) contains all the contracts used by the RIF Relay System.
2. [RIF Relay Client](https://github.com/rsksmart/rif-relay-client) contains a library to interact with the relay server.
3. [RIF Relay Server](https://github.com/rsksmart/rif-relay-server) has all the relay server code. You can run the server directly from there.

Each module has instructions for development and usage.

[Deprecated Docs](docs/README.md)


## Contribution Guidelines
* Please refer to the Rootstock Contribution Guidelines for more information on how to contribute to this project.

## License:
MIT License - Copyright (c) 2023 Rootstock
Loading

0 comments on commit 90c3526

Please sign in to comment.