Skip to content

Commit c99b645

Browse files
committed
requested changes
1 parent 146f2df commit c99b645

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

components/StakingCapBar.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@ export default function StakingCapBar({
1919
secondFillLabel,
2020
totalLabel,
2121
}: StakingCapBarProps) {
22-
const clampedFillPercentage = useMemo(() => Math.min(100, Math.max(0, fillPercentage)), [fillPercentage]);
23-
const clampedSecondFillPercentage = useMemo(() => Math.min(
24-
100 - clampedFillPercentage,
25-
Math.max(0, secondFillPercentage)
26-
), [clampedFillPercentage, secondFillPercentage]);
27-
const totalFillPercentage =
28-
useMemo(() => clampedFillPercentage + clampedSecondFillPercentage, [clampedFillPercentage, clampedSecondFillPercentage]);
22+
const clampedFillPercentage = useMemo(
23+
() => Math.min(100, Math.max(0, fillPercentage)),
24+
[fillPercentage]
25+
);
26+
const clampedSecondFillPercentage = useMemo(
27+
() =>
28+
Math.min(100 - clampedFillPercentage, Math.max(0, secondFillPercentage)),
29+
[clampedFillPercentage, secondFillPercentage]
30+
);
31+
const totalFillPercentage = useMemo(
32+
() => clampedFillPercentage + clampedSecondFillPercentage,
33+
[clampedFillPercentage, clampedSecondFillPercentage]
34+
);
2935

3036
return (
3137
<div
@@ -56,7 +62,7 @@ type BarProps = {
5662
fillPercent: number;
5763
children?: ReactNode | undefined;
5864
color: string;
59-
}
65+
};
6066

6167
const Bar = ({ fillPercent, children, color }: BarProps) => (
6268
<div

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import StakingCapBar from "@/components/StakingCapBar";
21
import RewardSimulator from "@/components/RewardSimulator";
32

43
# Examples
@@ -9,7 +8,7 @@ NOTE: All the symbols used in the examples are explained in the [Mathematical Re
98

109
## Example 1: Only Publisher Stake
1110

12-
This example take the case one pool where the pool has stake from only the publisher.
11+
This example takes the case of one pool where the pool has stake from only the publisher.
1312

1413
$$
1514
\begin{aligned}
@@ -23,12 +22,14 @@ $$
2322
\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\
2423
\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\
2524
\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 10 - 10 = 0 \\
25+
\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{10}{100} = 10\% \\
26+
\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{0}{0} = 0\% \\
2627
\end{aligned}
2728
$$
2829

2930
## Example 2: Publisher and Delegator Stake
3031

31-
This example take the case where the pool has stake from both the publisher and the delegator.
32+
This example takes the case where the pool has stake from both the publisher and the delegator.
3233

3334
$$
3435
\begin{aligned}
@@ -42,12 +43,14 @@ $$
4243
\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\
4344
\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\
4445
\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 20 - 10 = 10 \\
46+
\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{10}{100} = 10\% \\
47+
\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{10}{100} = 10\% \\
4548
\end{aligned}
4649
$$
4750

4851
## Example 3: Publisher and Delegator Stake more than the Cap
4952

50-
This example take the case where the combined stake of both the publisher and the delegator exceeds the cap.
53+
This example takes the case where the combined stake of both the publisher and the delegator exceeds the cap.
5154

5255
$$
5356
\begin{aligned}
@@ -61,6 +64,8 @@ $$
6164
\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\
6265
\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 300 = 30 \\
6366
\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 30 = 20 \\
67+
\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{30}{300} = 10\% \\
68+
\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{20}{300} = 6.67\% \\
6469
\end{aligned}
6570
$$
6671

0 commit comments

Comments
 (0)