Skip to content

Commit 466e9d7

Browse files
committed
edits and fixes to examples
1 parent 486245f commit 466e9d7

File tree

2 files changed

+41
-84
lines changed

2 files changed

+41
-84
lines changed

pages/home/oracle-integrity-staking/examples.mdx

Lines changed: 29 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,72 +8,72 @@ NOTE: All the symbols used in the examples are explained in the [Mathematical Re
88

99
## Example 1: Only Publisher Stake
1010

11-
This example take the case where only the publisher has staked PYTH tokens.
11+
This example take the case one pool assigned where the publisher assigned has staked PYTH tokens, while the pool has no tokens delegated to it.
1212

1313
$$
1414
\begin{aligned}
1515
{S^p_p} &= 100 \\
1616
{S^d_p} &= 0 \\
1717
{S^p} &= {S^p_p} + {S^d_p} = 100 + 0 = 100 \\
1818
{C}_p &= 500 \\
19-
\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 100) = 100 \\
20-
\text{Reward Rate} \quad{r} &= 10\% \\
19+
\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 100) = 100 \\
20+
\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\
2121
22-
\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\
22+
\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\
2323
\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\
2424
\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 10 - 10 = 0 \\
2525
\end{aligned}
2626
$$
2727

28-
2928
# Example 2: Publisher and Delegator Stake
3029

31-
This example take the case where both the publisher and the delegator have staked PYTH tokens.
30+
This example take the case where the pool has stake from both the publisher and the delegator.
3231

3332
$$
3433
\begin{aligned}
3534
{S^p_p} &= 100 \\
3635
{S^d_p} &= 100 \\
37-
{S^p} &= {S^p_p} + {S^d_p} = 100 + 100 = 200 \\
36+
{S_p} &= {S^p_p} + {S^d_p} = 100 + 100 = 200 \\
3837
{C}_p &= 500 \\
39-
\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 200) = 200 \\
40-
\text{Reward Rate} \quad{r} &= 10\% \\
41-
\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\
38+
\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 200) = 200 \\
39+
\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\
40+
41+
\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\
4242
\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\
4343
\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 20 - 10 = 10 \\
4444
\end{aligned}
4545
$$
4646

4747
# Example 3: Publisher and Delegator Stake more than the Cap
4848

49-
This example take the case where the combined stake of both the publisher and the delegator is more than the cap.
49+
This example take the case where the combined stake of both the publisher and the delegator exceeds the cap.
5050

5151
$$
5252
\begin{aligned}
5353
{S^p_p} &= 300 \\
5454
{S^d_p} &= 300 \\
55-
{S^p} &= {S^p_p} + {S^d_p} = 300 + 300 = 600 \\
55+
{S_p} &= {S^p_p} + {S^d_p} = 300 + 300 = 600 \\
5656
{C}_p &= 500 \\
57-
\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 600) = 500 \\
58-
\text{Reward Rate} \quad{r} &= 10\% \\
59-
\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\
57+
\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 600) = 500 \\
58+
\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\
59+
60+
\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\
6061
\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 300 = 30 \\
6162
\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 30 = 20 \\
6263
\end{aligned}
6364
$$
6465

65-
6666
# Example 4: Introducing Delegator Fees
6767

68-
This example demonstrates how delegator fees affect the reward distribution between publishers and delegators.
68+
This example demonstrates how the delegation fee affect the reward distribution between the publisher and the delegator.
6969

7070
$$
7171
\begin{aligned}
7272
\quad{S^p_p} &= 200 \\
7373
\quad{S^d_p} &= 300 \\
74-
\quad{S^p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\
74+
\quad{S_p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\
7575
\quad{C}_p &= 500 \\
76-
\quad{R_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\
76+
\quad{E_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\
7777
\quad{r} &= 10\% \\
7878
\quad{f} &= 2\% \\
7979
@@ -86,59 +86,26 @@ $$
8686
\end{aligned}
8787
$$
8888

89-
In this example, the delegator pays a 2% fee on their rewards to the publisher. This fee is deducted from the delegator's reward and added to the publisher's reward.
90-
89+
In the example, the delegator pays a 2\% fee on their rewards to the publisher. This fee is deducted from the delegator's reward and added to the publisher's reward.
9190

9291
# Example 5: Slashing event on the pool
9392

94-
This example demonstrates the impact of a slashing event on the staked PYTH tokens.
93+
This example demonstrates the impact of a slashing event on the staked PYTH tokens and rewards distributed to both the publisher and the delegator.
9594

9695
$$
9796
\begin{aligned}
98-
\quad{S^p_p} &= 200 \\
99-
\quad{S^d_p} &= 300 \\
100-
\quad{S^p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\
101-
\quad{C}_p &= 500 \\
102-
\quad{R_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\
103-
\quad{r} &= 10\% \\
104-
\quad{f} &= 2\% \\
105-
106-
\quad{R_p} &= {r} \times {R_p} = 10\% \times 500 = 50 \\
107-
\quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 200 = 20 \\
108-
\quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 20 = 30 \\
109-
\text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\
110-
\text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\
111-
\text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\
112-
\text{Slashed percentage}\quad{w} &=50\% \\
113-
\end{aligned}
114-
$$
97+
\quad{S^p_p} &= 300 \\
98+
\quad{S^d_p} &= 200 \\
99+
\quad{S_p} &= {S^p_p} + {S^d_p} = 300 + 200 = 500 \\
115100
101+
\text{Maximum slashing rate}\quad{z} &= 5\% \\
116102
117-
$$
118-
\begin{equation}
119-
\begin{split} \text{Net Publisher Stake} \quad{\Pi^p_p}
120-
& = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p \\
121-
& = (20 + 0.6) - 0.5 \cdot 200 \\
122-
& = 20.6 - 100 \\
123-
& = -79.4
124-
\end{split}
125-
\end{equation}
126-
$$
103+
\text{Publisher Stake post slashing}\quad{S^p_p_{ps}} &= (1 - 5\%) \times 300 = 285 \\
104+
\text{Delegator Stake post slashing}\quad{S^d_p_{ps}} &= (1 - 5\%) \times 200 = 190 \\
127105
128-
$$
129-
\begin{equation}
130-
\begin{split} \text{Net Deligator Stake} \quad{\Pi^d_p}
131-
& = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p ) \\
132-
& = 30 - ( 0.6 + 0.5 \cdot 300 ) \\
133-
& = 30 - 150.6 \\
134-
& = -120.6
135-
\end{split}
136-
\end{equation}
106+
\end{aligned}
137107
$$
138108

139-
In this example, the publisher's stake is slashed by 50%. This means that the publisher's stake is reduced by 79.4 PYTH tokens and the delegator's stake is reduced by 120.6 PYTH tokens.
140-
141-
109+
In this example, the stake is uniformly slashed by 5\%, affecting both the publisher and the delegator. Slashing impact the total stake into the pool, regardless of the Cap.
142110

143111
{/* <StakingCapBar fillPercentage={50} secondFillPercentage={20} labelText="100" /> */}
144-
Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,51 @@
11
# Mathematical Representation
22

3-
This section outlines the mathematical representation of the Oracle Integrity Staking (OIS) protocol.
3+
This section outlines the mathematical representation of the Oracle Integrity Staking (OIS) protocol.
44

5-
As explained in the [implementation](./implementation.mdx) section, every publisher is assigned a staking pool where they can self-stake and to which other stakers can delegate.
5+
As explained in the [implementation](./implementation.mdx) section, every publisher is assigned a staking pool where they can self-stake and to which other stakers can delegate.
66

77
## Pool Cap
88

99
The **pool cap** is calculated as follows:
1010

11-
1211
$$
1312
\large{\text{Pool Cap}: {\bold{C_p}} = M \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(n_s, Z)}}
1413
$$
1514

1615
Where:
1716

1817
- $M$ is a constant parameter representing the target stake per symbol.
19-
- $\text{Symbols\_p}$ is the number of symbols published by the publisher $p$.
18+
- $\text{Symbols\_p}$ is the set of symbols published by the publisher $p$.
2019
- $n_s$ be the number of publishers for symbol $s$.
2120
- $Z$ is a constant parameter to control cap contribution from symbols with a low number of publishers.
2221

23-
This formula actually ensures that symbols with a lower number of publishers contribute more to the overall cap, while symbols with a higher number of publishers contribute less. This is because the contribution of each symbol is inversely proportional to the number of publishers (or Z, whichever is larger).
24-
22+
This formula ensures that symbols with a lower number of publishers contribute more to the overall cap, while symbols with a higher number of publishers contribute less. This is because the contribution of each symbol is inversely proportional to the number of publishers (or Z, whichever is larger).
2523

2624
## Reward
2725

28-
The reward $R_p$ paid to each pool is calculated as follows:
26+
The reward $R_p$ distributed to each pool is calculated as follows:
2927

3028
$$
3129
\large{R_p = y \cdot \min(S_p, C_p)}
3230
$$
3331

3432
Where:
3533

36-
- $y$ is the yearly cap to the rate of rewards for any pool.
34+
- $y$ is the cap to the rate of rewards for any pool
3735
- $S_p$ be the stake assigned to the publisher p pool , made of self-staked amount $S^{p}_{p}$ and delegated stake $S^{d}_{p}$ , or $S_{p} = S^{p}_{p} + S^{d}_{p}$.
3836
- $C_p$ be the stake cap for the pool assigned to publisher p.
3937

40-
The reward is capped at the pool cap, $C_p$, to ensure that publishers and delegators are not over-rewarded. (I don't this this is necessary to mention, but it is a good sanity check)
41-
42-
43-
The total amount of rewards paid to all pools is bound the the same cap relative to the amount of rewards available to the OIS protocol.
38+
The total amount of rewards distributed to all pools is bound the the same cap relative to the amount of rewards available to the OIS protocol.
4439

4540
$$
4641
\large{\sum_{p \in \text{Publishers}} R_p \leq y \cdot \min(NumSymbols \cdot M, \sum_{p=1}^{P} S_p)}
4742
$$
4843

49-
Where:
44+
Where:
5045

5146
- $NumSymbols$ is the total number of symbols in the system.
5247
- $P$ is the total number of publishers in the system.
5348

54-
5549
Whereas the reward component relative to the amount self-staked by the publisher $p$ is defined as:
5650

5751
$$
@@ -62,10 +56,9 @@ Where:
6256

6357
- $R^d_p$ is the reward component relative to the amount delegated to the publisher $p$.
6458

65-
6659
## Slashing
6760

68-
Slashing is an important aspect of the OIS protocol to ensure the integrity of the system.
61+
Slashing is an important aspect of the OIS protocol to ensure the integrity of the system.
6962

7063
The slashed amount for each pool is calculated as follows:
7164

@@ -81,10 +74,7 @@ Where:
8174

8275
Here $SL_p$ is uniformly allocated to both the self-staking publisher and delegators in the pool, pro-rata to their respective stake.
8376

84-
85-
86-
87-
Subsequently, the rewards received by a publisher and delegators into a pool, net of any slashed amounts can be expressed as below:
77+
Subsequently, the rewards received by a publisher and delegators into a pool, net of any slashed amounts can be expressed as below:
8878

8979
$$
9080
\large{\Pi^p_p = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p}
@@ -94,11 +84,11 @@ $$
9484
\large{\Pi^d_p = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p )}
9585
$$
9686

97-
Where:
87+
Where:
9888

9989
- $\Pi^p_p$ is the net reward received by the publisher $p$ after slashing.
10090
- $\Pi^d_p$ is the net reward received by the delegators after slashing.
101-
- $f$ is the delegation fee charged by the publisher.
91+
- $f$ is the delegation fee charged by the pool.
10292
- $w$ is the slashing rate.
10393
- $S^p_p$ is the amount self-staked by the publisher $p$.
10494
- $S^d_p$ is the amount delegated to the publisher $p$.

0 commit comments

Comments
 (0)