Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from AstarNetwork/docusaurus-upgrade-v2-v3
Browse files Browse the repository at this point in the history
upgrade docusaurus and dependencies to support v3.4.0
  • Loading branch information
meganskye authored Jun 13, 2024
2 parents 9e7b875 + 0bed1d2 commit e091182
Show file tree
Hide file tree
Showing 48 changed files with 4,191 additions and 2,298 deletions.
22 changes: 11 additions & 11 deletions docs/about/economics/Inflation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cycle will be 70,000 ASTR.

Cycle length is configurable, but in practice it will resemble a 'year' off-chain.

$inflation\_soft\_cap = inflation\_rate * total\_issuance$
`$inflation\_soft\_cap = inflation\_rate * total\_issuance$`

### Periods

Expand Down Expand Up @@ -68,21 +68,21 @@ Based on the calculated _soft-cap_, rewards for all network participants are adj
_Collators_ get a fixed amount of the cycle's _soft-capped_ inflation.
This amount is equally divided by the number of blocks in the cycle.

$collator\_reward\_per\_block = \frac{total\_collator\_cycle\_reward}{blocks\_per\_cycle}$
`$collator\_reward\_per\_block = \frac{total\_collator\_cycle\_reward}{blocks\_per\_cycle}$`

### Treasury

Similar to the _collators_, treasury gets a fixed amount of the cycle's _soft-capped_ inflation
distributed in equal amounts throughout all the blocks in the cycle.

$treasury\_reward\_per\_block = \frac{total\_treasury\_cycle\_reward}{blocks\_per\_cycle}$
`$treasury\_reward\_per\_block = \frac{total\_treasury\_cycle\_reward}{blocks\_per\_cycle}$`

### dApps

dApp reward are _assigned_ at the end of each era during `Build&Earn` subperiod.
This means that the total cycle's dApp reward amount has to be equally divided by the total number of `Build&Earn` eras in a cycle.

$dapp\_reward\_pool\_per\_era = \frac{total\_dapp\_cycle\_reward}{periods\_per\_cycle * eras\_per\_build\_and\_earn}$
`$dapp\_reward\_pool\_per\_era = \frac{total\_dapp\_cycle\_reward}{periods\_per\_cycle * eras\_per\_build\_and\_earn}$`

The dApp staking protocol will calculate how much each staked dApp should get.

Expand All @@ -97,27 +97,27 @@ These rewards have two components - the _base_ reward and the _adjustable_ rewar

Base reward is the amount assigned to the reward pool at the end of each era regardless of how much has been staked in total.

$base\_staker\_reward\_pool\_per\_era = \frac{total\_base\_staker\_cycle\_reward}{number\_of\_cycles * eras\_per\_build\_and\_earn}$
`$base\_staker\_reward\_pool\_per\_era = \frac{total\_base\_staker\_cycle\_reward}{number\_of\_cycles * eras\_per\_build\_and\_earn}$`

The adjustable part is the dynamic part, and depends on the _total value staked_ and the _target stake value_.
This amount linearly increases as the _total value staked_ increases, and then saturates once the amount is reached or exceeded.
With this component, _staker rewards_ are not a _zero-sum game_.

$max_\_adjustable\_staker\_reward\_pool\_per\_era = \frac{total\_adjustable\_staker\_cycle\_reward}{number\_of\_cycles * eras\_per\_build\_and\_earn}$
`$max_\_adjustable\_staker\_reward\_pool\_per\_era = \frac{total\_adjustable\_staker\_cycle\_reward}{number\_of\_cycles * eras\_per\_build\_and\_earn}$`

The adjustable part of the reward is calculated once an era ends, using the _total value staked_ at that point in time.

$adjustable\_factor = min(1, \frac{total\_value\_staked\_percent}{ideal\_staking\_percent})$
`$adjustable\_factor = min(1, \frac{total\_value\_staked\_percent}{ideal\_staking\_percent})$`

Using the _adjustable\_factor_, adjustable portion of the staker reward is:

$adjustable\_staker\_reward\_pool = max_\_adjustable\_staker\_reward\_pool\_per\_era * adjustable\_factor$
`$adjustable\_staker\_reward\_pool = max_\_adjustable\_staker\_reward\_pool\_per\_era * adjustable\_factor$`

When the _adjustable factor_ is less than **1**, it means the remainder is never minted, reducing the overall inflation.

With the above formulas, we can finally express how much staker _Alice_ earns in era **n**:

$staker\_reward\_per\_era_{Alice} = \frac{staked\_value_{Alice,n}}{total\_staked\_value_n} * (base\_staker\_reward\_pool\_per\_era_n + adjustable\_staker\_reward\_pool_n)$
`$staker\_reward\_per\_era_{Alice} = \frac{staked\_value_{Alice,n}}{total\_staked\_value_n} * (base\_staker\_reward\_pool\_per\_era_n + adjustable\_staker\_reward\_pool_n)$`

#### Bonus Rewards

Expand All @@ -126,11 +126,11 @@ was staked at the end of the `Voting` subperiod, it will make them eligible for

Bonus reward pool is assigned per period, and can be expressed as:

$bonus\_reward\_pool\_per\_period = \frac{total\_bonus\_cycle\_reward}{periods\_per\_cycle}$
`$bonus\_reward\_pool\_per\_period = \frac{total\_bonus\_cycle\_reward}{periods\_per\_cycle}$`

The bonus reward for a staker _Alice_ can then be expressed as:

$bonus\_staker\_reward_{Alice} = \frac{voting\_subperiod\_staked\_value_{Alice}}{total\_voting\_subperiod\_staked\_value} * (bonus\_reward\_pool\_per\_period)$
`$bonus\_staker\_reward_{Alice} = \frac{voting\_subperiod\_staked\_value_{Alice}}{total\_voting\_subperiod\_staked\_value} * (bonus\_reward\_pool\_per\_period)$`

## Lazy Minting

Expand Down
24 changes: 13 additions & 11 deletions docs/about/economics/legacy_inflation.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ TVL in this context does not consider non-ASTR tokens locked by other protocols
We're interested particularly in **TVL percentage**
- $total\_issuance$ - total amount of issued **ASTR** tokens
- $TVL$ - total amount of tokens locked in dApps-staking
- $TVL_{\%} = {TVL \over total}$
- `$TVL_{\%} = {TVL \over total}$`

In case **total_issuance** equals 1000 and **TVL** is 242, **TVL percentage** will be `24.2%`.

Expand All @@ -110,34 +110,36 @@ The amount received by stakers and the treasury is dynamic and depends on TVL. H
##### Adjustable Percent

Depending on the TVL, the **adjustable percent** of the block reward is split between stakers and the treasury.
$$

```js
\begin{aligned}
a&djustable_{staker} = min(1, {TVL_{\%} \over TVL_{ideal}}) * adjustable_{\%}
adjustable_{staker} = min(1, {TVL_{\%} \over TVL_{ideal}}) * adjustable_{\%}
\newline\newline
t&otal_{staker} = base_{staker} + adjustable_{staker}
total_{staker} = base_{staker} + adjustable_{staker}
\newline\newline
t&otal_{treasury} = base_{treasury} + (adjustable_{\%} - adjustable_{staker})
total_{treasury} = base_{treasury} + (adjustable_{\%} - adjustable_{staker})
\end{aligned}
$$
```

As more tokens are staked and TVL increases, the portion of staker rewards increases in proportion to the growth of the network. This approach helps to compensate for the *zero-sum* nature of staking and incentivize more users to participate in securing the network. It's important to note that this reward increase is linear up to a certain threshold, known as the $TVL_{ideal}$ point. Once this threshold is reached, the reward increase will saturate, meaning that any further increase in TVL will not result in an increase in staker rewards. This ensures a fair and sustainable reward system that benefits all members of the Astar community.
As more tokens are staked and TVL increases, the portion of staker rewards increases in proportion to the growth of the network. This approach helps to compensate for the *zero-sum* nature of staking and incentivize more users to participate in securing the network. It's important to note that this reward increase is linear up to a certain threshold, known as the `$TVL_{ideal}$` point. Once this threshold is reached, the reward increase will saturate, meaning that any further increase in TVL will not result in an increase in staker rewards. This ensures a fair and sustainable reward system that benefits all members of the Astar community.

Note that in Polkadot's model, when ideal TVL is reached, staker rewards drop exponentially. In our case, they only become saturated, making it a *zero-sum-game*. Motivation behind our approach is simplicity.

##### Interest Rate

Using the parameters from the previous chapters, we can express yearly interest rate for the stakers:
$$

```
i = {inflation_{annual} * total_{staker} \over TVL_{\%}}
$$
```

For example, in case $total_{staker} = 55\%$ and $TVL_{\%} = 40\%$, we end up with ${0.1 * 0.55 \over 0.4}$ which is `13.75%` annual interest rate.

However, inflation dilutes the interest rate so it's more precise to consider *inflation adjusted annual interest rate*.

$$
```
i_{adjusted} = {i + 1 \over inflation_{anual} + 1} - 1
$$
```

To follow up on the example above, *inflation adjusted* value would be ${0.1375 + 1 \over 0.1 + 1} - 1$ which is `3.4%`.

Expand Down
2 changes: 1 addition & 1 deletion docs/about/products/dapp-staking/dapp-staking-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ These are major remarks about the migration:
If any of the terms above are unclear to you (e.g. _staking_ vs _locking_) you can find detailed exaplanation the following sections:

- [Tokenomics 2.0](/docs/about/economics/index.md)
- [dApp Staking V3 Technical Overview](/docs/about/products/dapp-staking/dapp-staking-protocol.md/)
- [dApp Staking V3 Technical Overview](/docs/about/products/dapp-staking/dapp-staking-protocol.md)

### Practical explanation with an example:

Expand Down
14 changes: 8 additions & 6 deletions docs/about/products/dapp-staking/for-devs/register-dapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
sidebar_position: 2
---

import Figure from "/src/components/figure"
import Figure from '/src/components/figure';
import Details from '/src/components/Details.js';


# Register dApp

Expand All @@ -12,14 +14,14 @@ Once you have been approved by the Astar Council under Astar governance, you can

Before you can register your dApp or project, make sure you have :

#### 1. An [Astar Native developer wallet] (/docs/use/how-to-guides/layer-1/manage-wallets/create-wallet) with some tokens to cover gas fee. *No Ledger hardware wallet or EVM wallet.* **LINK TO UPDATE**
#### 1. An [Astar Native developer wallet](/docs/use/how-to-guides/layer-1/manage-wallets/create-wallet.md) with some tokens to cover gas fee. *No Ledger hardware wallet or EVM wallet.* **LINK TO UPDATE**

You can use one of the following wallets:

<details>
<summary>**[Polkadot.js](https://chrome.google.com/webstore/detail/polkadot%7Bjs%7D-extension/mopnmbcafieddcagagdcbnhejhlodfdd?hl=en)** *(Recommended)*</summary>

The Polkadot\{.js\} plugin provides a reasonable balance of security and usability. It provides a separate local mechanism to generate your address and interact with the Astar portal. We recommend users who are new to our ecosystem and want to create an Astar native address use this wallet. If you don't have the Polkadot JS extension you will receive a popup in our portal when you try to connect your wallet.
The Polkadot.js plugin provides a reasonable balance of security and usability. It provides a separate local mechanism to generate your address and interact with the Astar portal. We recommend users who are new to our ecosystem and want to create an Astar native address use this wallet. If you don't have the Polkadot JS extension you will receive a popup in our portal when you try to connect your wallet.

### Install the Browser Plugin

Expand All @@ -29,15 +31,15 @@ The browser plugin is available for both [Google Chrome](https://chrome.google.c

### Create Account

Open the Polkadot\{.js\} browser extension by clicking the logo on the top bar of your browser. You will see a browser popup.
Open the Polkadot.js browser extension by clicking the logo on the top bar of your browser. You will see a browser popup.

<Figure src={require('/docs/use/how-to-guides/layer-1/dapp-staking/for-devs/img/Polkadotjs_2.png').default } width="70%" />

Click the big plus button `Create new account`. The Polkadot\{.js\} plugin will then use system randomness to make a new seed for you and display it to you in the form of twelve words.
Click the big plus button `Create new account`. The Polkadot.js plugin will then use system randomness to make a new seed for you and display it to you in the form of twelve words.

<Figure src={require('/docs/use/how-to-guides/layer-1/dapp-staking/for-devs/img/Polkadotjs_3.png').default } width="70%" />

You should back up these words. Please, store the seed somewhere safe, secret, and secure. If you cannot access your account via Polkadot\{.js\} for some reason, you can re-enter your seed through the `Add account menu` by selecting `Import account from pre-existing seed`.
You should back up these words. Please, store the seed somewhere safe, secret, and secure. If you cannot access your account via Polkadot.js for some reason, you can re-enter your seed through the `Add account menu` by selecting `Import account from pre-existing seed`.

<Figure src={require('/docs/use/how-to-guides/layer-1/dapp-staking/for-devs/img/Polkadotjs_4.png').default } width="70%" />

Expand Down
2 changes: 1 addition & 1 deletion docs/about/products/dapp-staking/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ As an user or a dApp owner, you need to take the following parameters into consi
| Unlocking Period | 9 Eras (~9 days) | 4 Eras (~4 days) | 4 Eras (~1 day) |
| Minimum Amount to Stake | 500 ASTR | 50 SDN | 5 SBY |

For the full list of parameters, please check the [dApp staking parameters page](/docs/about/products/dapp-staking/protocol-parameters.md) and [Tokenomics 2.0 page](/docs/about/economics/Inflation.md#parameters).
For the full list of parameters, please check the [dApp staking parameters page](/docs/about/products/dapp-staking/protocol-parameters.md) and [Tokenomics 2.0 page](https://docs.astar.network/about/economics/inflation).

#### Tier System

Expand Down
2 changes: 1 addition & 1 deletion docs/about/products/dapp-staking/protocol-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: dApp Staking Parameters
## Overview

The following parameters are tightly tied to dApp staking, however, some parameters are shared with the _Tokenomics 2.0_ model.
To find out more, please check the documentation [here](/docs/about/economics/Inflation.md).
To find out more, please check the documentation [here](https://docs.astar.network/about/economics/inflation).

### Era Reward Span Length

Expand Down
2 changes: 1 addition & 1 deletion docs/build/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"label": "Build",
"label": "Builder Guides",
"position": 1
}
2 changes: 1 addition & 1 deletion docs/build/build-on-layer-1/environment/chopsticks.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ npx @acala-network/chopsticks@latest -c shiden
```

and simply examine the local setup by using PJS on it.
<https://polkadot.js.org/apps/?rpc=ws://localhost:8000#/explorer>
[Local setup](https://polkadot.js.org/apps/?rpc=ws://localhost:8000#/explorer)

### XCM mode

Expand Down
2 changes: 1 addition & 1 deletion docs/build/build-on-layer-1/environment/local-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ OK! Let's explore your local network now.

Visit the following URL:

<https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer>
[Local Network on PJS Apps Portal](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer)

There, you will see the following screen:

Expand Down
12 changes: 6 additions & 6 deletions docs/build/build-on-layer-1/integrations/api/gas_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Tips are used for native transaction. Tips are an optional transaction fee that

## GAS API

- Shibuya: <https://gas.astar.network/api/gasnow?network=shibuya&type=gas>
- Shiden: <https://gas.astar.network/api/gasnow?network=shiden&type=gas>
- Astar: <https://gas.astar.network/api/gasnow?network=astar&type=gas>
- Shibuya: [gas.astar.network/api/gasnow?network=shibuya&type=gas]
- Shiden: [https://gas.astar.network/api/gasnow?network=shiden&type=gas]
- Astar: [https://gas.astar.network/api/gasnow?network=astar&type=gas]

## Response

Expand Down Expand Up @@ -63,9 +63,9 @@ EIP-1559's purpose is essentially to make gas fees more transparent and predicta

### Tip API

- Shibuya: <https://gas.astar.network/api/gasnow?network=shibuya&type=tip>
- Shiden: <https://gas.astar.network/api/gasnow?network=shiden&type=tip>
- Astar: <https://gas.astar.network/api/gasnow?network=astar&type=tip>
- Shibuya: [https://gas.astar.network/api/gasnow?network=shibuya&type=tip]
- Shiden: [https://gas.astar.network/api/gasnow?network=shiden&type=tip]
- Astar: [https://gas.astar.network/api/gasnow?network=astar&type=tip]

Response
```
Expand Down
6 changes: 3 additions & 3 deletions docs/build/build-on-layer-1/integrations/bridges/cbridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ sidebar_position: 1

A guide on how to transfer assets from Ethereum & Binance Smart Chain to the Astar ecosystem. Make sure you have some ASTR to pay gas fees before bridging. You can buy ASTR token on exchanges.

<https://www.coingecko.com/en/coins/astar>
[https://www.coingecko.com/en/coins/astar]

## Product Page

<https://cbridge.celer.network/#/transfer>
[https://cbridge.celer.network/#/transfer]


## Contracts
Expand Down Expand Up @@ -48,7 +48,7 @@ This is the address that you should use when you withdraw ASTR tokens from excha

In this tutorial we will demonstrate how to bridge USDC from Ethereum to Astar. By doing so, you will be adding liquidity to our network, which benefits the ecosystem overall, and for which we convey our deepest gratitude.

Visit cBridge <https://cbridge.celer.network/#/transfer> and input a currency you would like to transfer.
Visit [cBridge](https://cbridge.celer.network/#/transfer) and input a currency you would like to transfer.

![3](img/3.png)

Expand Down
2 changes: 2 additions & 0 deletions docs/build/build-on-layer-1/integrations/indexers/bluez.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ First, obtain an API key [here](https://docs.google.com/forms/d/e/1FAIpQLSf5Fa3T

### Examples of GET queries available through this API:

```js
/nft/v3/{apiKey}/getNFTsForOwner

/nft/v3/{apiKey}/getNFTMetadata
Expand All @@ -28,3 +29,4 @@ First, obtain an API key [here](https://docs.google.com/forms/d/e/1FAIpQLSf5Fa3T
/nft/v3/{apiKey}/getOwnersForContract

/nft/v3/{apiKey}/getNFTSales
```
4 changes: 2 additions & 2 deletions docs/build/build-on-layer-1/integrations/indexers/subscan.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A Substrate ecological explorer that not only allows ordinary users to view WASM
## Prerequisites
- [Subscan WASM smart contract dashboard for Astar network](https://astar.subscan.io/wasm_contract_dashboard)
- Basic WASM smart contract knowledge
- polkadot{.js} extension (optional, it's used to call WASM smart contract)
- Polkadot\{.js\} extension (optional, it's used to call WASM smart contract)

## Getting started

Expand Down Expand Up @@ -48,7 +48,7 @@ After compiling contract in docker, you need to fill in the Contract Verificatio
![verified_contract](./img/subscan/verified_contract.png)

### Read/Call WASM Smart Contract
Visit [Contract tab in contract detail](https://astar.subscan.io/wasm_contract/aBmKPunRKt9VaW6AuMS8ZUhpSYZqHJHYKhvjdNb1M4VQgqS?tab=contract&contractTab=read). Please note that read/call features only apply to verified WASM smart contract, and you need to connect to polkadot{.js} extension before calling contract.
Visit [Contract tab in contract detail](https://astar.subscan.io/wasm_contract/aBmKPunRKt9VaW6AuMS8ZUhpSYZqHJHYKhvjdNb1M4VQgqS?tab=contract&contractTab=read). Please note that read/call features only apply to verified WASM smart contract, and you need to connect to Polkadot\{.js\} extension before calling contract.

![read_call](./img/subscan/read_call.png)

Expand Down
2 changes: 2 additions & 0 deletions docs/build/build-on-layer-1/integrations/indexers/subsquid.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
sidebar_position: 1
---

import Figure from '/src/components/figure'

# Subsquid

[Subsquid](https://subsquid.io) is an indexing framework supporting both [Substrate](/docs/build/build-on-layer-1/smart-contracts/wasm/index.md) and [EVM](/docs/build/build-on-layer-1/smart-contracts/EVM/index.md)-based chains. It is extremely flexible and offers [high syncing speeds](https://docs.subsquid.io/migrate/subsquid-vs-thegraph/). Subsquid comes with a set of code generation tools that make ready-to-use, customizable indexer projects ("squids") out of contracts' ABIs. WASM/ink! and EVM/Solidity contracts are supported. Once scraped, the contract data can be served over a GraphQL API or stored as a dataset.
Expand Down
18 changes: 9 additions & 9 deletions docs/build/build-on-layer-1/integrations/node-providers/blast.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ Users joining the platform will be able to use the APIs for free within certain

Here are two Public APIs, that include Astar / Shiden and Shibuya (+ one-click add network to MetaMask):

<https://blastapi.io/public-api/astar>
[https://blastapi.io/public-api/astar]

<https://blastapi.io/public-api/shiden>
[https://blastapi.io/public-api/shiden]

### Public RPC Endpoints

<https://astar.public.blastapi.io>
[https://astar.public.blastapi.io]

<https://shiden.public.blastapi.io>
[https://shiden.public.blastapi.io]

<https://shibuya.public.blastapi.io>
[https://shibuya.public.blastapi.io]

### Public WSS Endpoints

<wss://astar.public.blastapi.io>
[wss://astar.public.blastapi.io]

<wss://shiden.public.blastapi.io>
[wss://shiden.public.blastapi.io]

<wss://shibuya.public.blastapi.io>
[wss://shibuya.public.blastapi.io]

## Instructions

1. Launch the app on: <https://blastapi.io/login>
1. Launch the app on: [https://blastapi.io/login]
2. Connect the app to MetaMask. This is to prevent users from spamming the network. You will only need to connect MetaMask to create an account, and sign in to their app.
![2](img/2.png)

Expand Down
Loading

0 comments on commit e091182

Please sign in to comment.