Skip to content

Commit

Permalink
docs: structure and content (#1)
Browse files Browse the repository at this point in the history
* docs: initial doc structure and content

* fix: broken link

* refactor: rename files to not contain unifi-rollup

* fix: remove unused dependencies

* docs: formatting; TODOs

* docs: format

* feat: icons and remove unnecessary sentence

---------

Co-authored-by: failfmi <[email protected]>
  • Loading branch information
vikinatora and failfmi authored Nov 21, 2024
1 parent 4cf34e6 commit 753c71f
Show file tree
Hide file tree
Showing 33 changed files with 21,261 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 21.x
cache: yarn
cache-dependency-path: ./package-lock.json
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Build
run: yarn run build

- name: Setup Pages
uses: actions/configure-pages@v1
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock

# JetBrains
.idea
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
# unifi-docs
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
49 changes: 49 additions & 0 deletions docs/bridge-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: How to use UniFi Bridge
slug: /bridge-ui
---

# Using the UniFi Bridge

In order to use the UniFi Rollup Bridge, you need to have a compatible wallet and some funds on the L1 network.
This guide will help you bridge your funds from the L1 network to the UniFi Rollup network.

## How to bridge (deposit) ETH to UniFi

1. Open the [UniFi Rollup Bridge UI](https://testnet-bridge.unifi.puffer.fi/).
2. Connect your preffered wallet.
![Connecting the wallet](/img/rollup/connect-wallet.png)
3. Switch your connected network to L1 (Holesky).

- This can be done manually from the top right corner of the page by clicking on your wallet address.

4. Select the token and the amount you want to bridge and press continue.
![Token selection](/img/rollup/select-token.png)
5. Review the transaction details and press confirm.
![Transaction confirmation](/img/rollup/confirm-transaction.png)
:::info
When bridging ERC20 tokens, you will have an additional transaction to approve the bridge contract to spend your tokens.
:::
6. Accept the transaction in your wallet.
7. Track the transaction in the Transactions tab.
![Transaction tab](/img/rollup/transaction-tab.png)
8. After a few minutes, the transaction will be confirmed and the status will change to Claimed.
![Claimed transaction](/img/rollup/claimed-transaction.png)
9. Once the transaction is confirmed, you can switch to the L2 network (UniFi) and see your bridged funds in your wallet.

### Claiming Manually (Optional)

If you want to claim your bridged funds manually, you can do so by following these steps:

1. Press the Claim button on the transaction.
![Claim button](/img/rollup/claim-button.png)
2. Review the transaction details and press confirm.
![Claim transaction](/img/rollup/claim-transaction.png)
3. After transaction confirmation, you will see your bridged funds in your wallet.

## How to bridge (withdraw) ETH from UniFi

1. Make sure that you've selected UniFi Testnet as your source chain
![Token Selection L2](/img/rollup/select-token-l2.png)

2. The next steps are the same as when depositing ETH.
14 changes: 14 additions & 0 deletions docs/developers/getting-started/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Getting Started
slug: /developers/getting-started/index
---

# Building on UniFi

UniFi is mostly EVM equivalent, which means that developers can use familiar EVM tools and frameworks,
such as Hardhat, Truffle, and Remix, to interact with and develop on UniFi.
This compatibility significantly reduces the learning curve, allowing developers to leverage existing skills and knowledge.

:::info
For exact differences between UniFi and EVM behaviour, see the [Opcodes](../reference/opcodes.md) page.
:::
33 changes: 33 additions & 0 deletions docs/developers/reference/contract-addresses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Smart Contract Addresses
slug: /developers/rollup/reference/contract-addresses
---

## Holesky Testnet

### L1 Addresses

| Contract | Address |
|---------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| UniFi L1 | [0x12d30f3584ee969C4131b7d5dCAEe763A378AfD9](https://holesky.etherscan.io/address/0x12d30f3584ee969C4131b7d5dCAEe763A378AfD9) |
| Rollup Address Manager | [0x540B8d82e6E11F0a9438fB19f33c85b2B53B49d8](https://holesky.etherscan.io/address/0x540B8d82e6E11F0a9438fB19f33c85b2B53B49d8) |
| Shared Address Manager | [0x0F3dD9461Ccf086cC32D38eC8673e541Fc86279d](https://holesky.etherscan.io/address/0x0F3dD9461Ccf086cC32D38eC8673e541Fc86279d) |
| Attestation Verifier | [0xCB848506bcB28C86Dd0CCb5905BaBD80CC0277E4](https://holesky.etherscan.io/address/0xCB848506bcB28C86Dd0CCb5905BaBD80CC0277E4) |
| Automata DCAP Attestation | [0x133303659F51d75ED216FD98a0B70CbCD75339b2](https://holesky.etherscan.io/address/0x133303659F51d75ED216FD98a0B70CbCD75339b2) |
| Bridge | [0x81bfCf0f7196C1772279846625F619f691755120](https://holesky.etherscan.io/address/0x81bfCf0f7196C1772279846625F619f691755120) |
| Prover Set | [0x3a4e7187720420FF208AfC4EA2602d3DE2C80E1d](https://holesky.etherscan.io/address/0x3a4e7187720420FF208AfC4EA2602d3DE2C80E1d) |
| Signal Service | [0x60646983250313B750D3657C648823d665305299](https://holesky.etherscan.io/address/0x60646983250313B750D3657C648823d665305299) |
| PUFFER Token | [0x4543168F4C5b3EcDdeF36E15DbCD6914e3f585BD](https://holesky.etherscan.io/address/0x4543168F4C5b3EcDdeF36E15DbCD6914e3f585BD) |
| TDXVerifier | [0x7c2B88Bb08467669e6ee3ed604f07aB0D5E78F1a](https://holesky.etherscan.io/address/0x7c2B88Bb08467669e6ee3ed604f07aB0D5E78F1a) |
| GuardianProver | [0xdE0e5FefE21af1C46F63c0Ee6381b512B95085F7](https://holesky.etherscan.io/address/0xdE0e5FefE21af1C46F63c0Ee6381b512B95085F7) |
| GuardianProverMinority | [0x51940246968853F696ab7761eA5Af86c542C0894](https://holesky.etherscan.io/address/0x51940246968853F696ab7761eA5Af86c542C0894) |

### L2 Addresses

| Contract | Address |
|-----------------------------|--------------------------------------------|
| UniFi L2 | 0x9A7fe8e9852c684DD03ce9caEa003F5Fc0a3135b |
| Bridge | 0x511a232eaef7aA4633BAc8E406a7886e46492AFC |
| Signal Service | 0x80d0AFe646Ba22e5E557F1dCC209e75b07e1b1BA |
| Rollup Address Manager | 0x91e75542D9da7C52089b71094e327307C51D6deD |
| Shared Address Manager | 0x251724F9AD5F23CdF8b9d63cb7c372462F834319 |
29 changes: 29 additions & 0 deletions docs/developers/reference/opcodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Opcodes

Since UniFi is based on Taiko, it inherits the same opcode behaviour as Taiko. Unless listed below,
all opcodes are supported in UniFi and are EVM equivalent.
The execution of some Opcodes is not verified by the circuits, and not part of the validity proofs.

# Unsupported Opcodes

:::warning
If an unsupported opcode is encountered during execution that is not supported in UniFi, the transaction will revert.
:::
The following opcodes are not supported in UniFi:

| Opcode | Name | Solidity Equivalent |
|--------|-------------|---------------------|
| 49 | BLOBHASH | blobhash(index) |
| 4A | BLOBBASEFEE | block.blobasefee |
| 5C | TLOAD | tload(key) |
| 5D | TSTORE | tstore(key, value) |
| 5E | MCOPY | mcopy() |

# Modified Opcodes

| Opcode | Name | Solidity Equivalent | Rollup Behaviour | Ethereum L1 Behaviour |
|--------|-----------|---------------------|----------------------------------------------|--------------------------------------|
| 41 | COINBASE | block.coinbase | Returns the address of the L2 block proposer | Gets the block’s beneficiary address |
| 42 | TIMESTAMP | block.timestamp | Timestamp of the L2 block | Timestamp of the L1 block |
| 43 | NUMBER | block.number | L2 block number | Gets the L1 block number |
| 48 | BASEFEE | block.basefee | Returns the L2 base fee | Returns the base fee |
15 changes: 15 additions & 0 deletions docs/developers/reference/rpc-endpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Network & RPC Endpoints
slug: /developers/rollup/reference/rpc-endpoints
---

## UniFi Testnet

| Parameter | Value |
|--------------------|-------------------------------------|
| Network Name | `UniFi Testnet` |
| Chain ID | `8787` |
| Currency Symbol | ETH |
| Block Explorer | TODO: |
| Sequencer URL | TODO: |
| Contract Addresses | See [here](./contract-addresses.md) |
89 changes: 89 additions & 0 deletions docs/developers/rollup/smart-contracts/deploy-foundry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Deploy a Smart Contract on UniFi using Foundry
slug: /developers/rollup/smart-contracts/foundry
---

## Prerequisite

Before you begin, ensure you've:

1. [Set up your wallet and have bridged UniFi tokens successfully](../../../move-funds.md).
2. Downloaded and installed Foundry:

```bash
curl -L https://foundry.paradigm.xyz | bash
```

Then, open a new terminal, and call `foundryup` to install the latest release.
:::info
Running `foundryup` will automatically install the latest (nightly) versions of the precompiled binaries: forge,
cast, anvil, and chisel. For additional options, such as installing a specific version or commit, run `foundryup --help`
:::

## Create a Foundry project

To create a Foundry project, run:

```bash
forge init unifi-smart-contract-tutorial
```

Running `forge init` sets up a sample contract, test, and script for `Counter.sol`.

Now change into the directory:

```bash
cd unifi-smart-contract-tutorial
```

## Deploy a smart contract

:::warning
Directly pasting your private key into the command line poses security risks. The examples below are instructional
and don't adhere to good security practices. To avoid exposing sensitive information such as wallet private keys,
use `.env` files to store private data. Create a `.env` file, then add the file to the `.gitignore` file to
prevent committing it. Populate the `.env` file with the private information.
:::

Deploy your contract using the following syntax:

```bash
forge create --rpc-url <rpc_https_endpoint> src/Counter.sol:Counter --private-key <your_private_key>
```

In the command:

- `rpc_https_endpoint` is a RPC Endpoint for the UniFi network. You can find the endpoints in the
[RPC Endpoints Reference](../../reference/rpc-endpoints.md).
- `your_private_key` is your wallet's private key.

Your output should look similar to:

```bash
Deployer: YOUR_WALLET_ADDRESS
Deployed to: 0xFCc25885bDcF17A0BF1C0E529100B6420e237Cbe
Transaction hash: 0x734c59643232b61b560da2c750d7ad808267fbc28331ee59102e431ec9559097
```

For more deployment options, see the [forge-create documentation](https://book.getfoundry.sh/reference/forge/forge-create).

## Verify your smart contract

Optionally, you can verify your contract on the network. This makes the source code publicly available.

### Deploy and verify a contract in one go

To deploy and verify a contract in a single command, run:

```bash
forge create --rpc-url <rpc_https_endpoint> --private-key <your_private_key> src/Counter.sol:Counter --verify --verifier blockscout --verifier-url <blockscout_homepage_explorer_url>/api
```

In the command:

- `rpc_https_endpoint` is a RPC Endpoint for the UniFi network. You can find the endpoints in the [RPC Endpoints Reference](../../reference/rpc-endpoints.md).
- `your_private_key` is your wallet's private key.
- `blockscout_homepage_explorer_url` is the URL of the block explorer explorer you're using. You can find the endpoints
in the [RPC Endpoints Reference](../../reference/rpc-endpoints.md).

For more contract verification options, see the [verify-contract documentation](https://book.getfoundry.sh/reference/forge/forge-verify-contract).
Loading

0 comments on commit 753c71f

Please sign in to comment.