Skip to content

Commit 902775a

Browse files
Merge pull request #3055 from pyth-network/add-dual-images-func
chore(developer-hub): dual image mode enable and use in OIS
2 parents 6b1d6c6 + d346f43 commit 902775a

File tree

5 files changed

+107
-8
lines changed

5 files changed

+107
-8
lines changed

apps/developer-hub/content/docs/oracle-integrity-staking/reward-examples.mdx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ description: >-
44
This reference page provides examples of various scenarios to illustrate the Mathematical Representations of OIS.
55
---
66

7+
import DualModeImage from "../../../src/components/DualModeImage";
8+
79
NOTE: All the symbols used in the examples are explained in the [Mathematical Representation](./mathematical-representation) section.
810

911
## Example 1: Only Publisher Stake
1012

1113
This example takes the case of one pool where the pool has stake from only the publisher.
1214

13-
![Example 1 - Only Publisher Stake](/images/ois/OIS_Rewards_Example_Light_1.png)
15+
<br />
16+
<DualModeImage
17+
darkSrc="/images/ois/OIS_Rewards_Example_Dark_1.png"
18+
lightSrc="/images/ois/OIS_Rewards_Example_Light_1.png"
19+
alt="Example 1 - Only Publisher Stake"
20+
/>
1421

1522
$$
1623
\begin{aligned}
@@ -33,7 +40,12 @@ $$
3340

3441
This example takes the case where the pool has stake from both the publisher and the delegator.
3542

36-
![Example 2 - Publisher and Delegator Stake](/images/ois/OIS_Rewards_Example_Light_2.png)
43+
<br />
44+
<DualModeImage
45+
darkSrc="/images/ois/OIS_Rewards_Example_Dark_2.png"
46+
lightSrc="/images/ois/OIS_Rewards_Example_Light_2.png"
47+
alt="Example 2 - Publisher and Delegator Stake"
48+
/>
3749

3850
$$
3951
\begin{aligned}
@@ -56,7 +68,12 @@ $$
5668

5769
This example takes the case where the combined stake of both the publisher and the delegator exceeds the cap.
5870

59-
![Example 3 - Stake Exceeding Cap](/images/ois/OIS_Rewards_Example_Light_3.png)
71+
<br />
72+
<DualModeImage
73+
darkSrc="/images/ois/OIS_Rewards_Example_Dark_3.png"
74+
lightSrc="/images/ois/OIS_Rewards_Example_Light_3.png"
75+
alt="Example 3 - Stake Exceeding Cap"
76+
/>
6077

6178
$$
6279
\begin{aligned}
@@ -79,7 +96,12 @@ $$
7996

8097
This example demonstrates how the delegation fee affect the reward distribution between the publisher and the delegator.
8198

82-
![Example 4 - Delegator Fees](/images/ois/OIS_Rewards_Example_Light_4.png)
99+
<br />
100+
<DualModeImage
101+
darkSrc="/images/ois/OIS_Rewards_Example_Dark_4.png"
102+
lightSrc="/images/ois/OIS_Rewards_Example_Light_4.png"
103+
alt="Example 4 - Delegator Fees"
104+
/>
83105

84106
$$
85107
\begin{aligned}

apps/developer-hub/content/docs/oracle-integrity-staking/slashing-rulebook.mdx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ description: >-
55
on the Pyth network.
66
---
77

8+
import DualModeImage from "../../../src/components/DualModeImage";
9+
810
# Purpose and Scope
911

1012
This Pyth Slashing Rulebook (this "Rulebook") outlines the Terms & Conditions for slashing PYTH that has been staked for price feed accuracy on the Pyth network. This document develops the rules that the DAO must adhere to when assessing conditions and amounts of slashing.
@@ -108,22 +110,34 @@ The Pythian councile identifies there were 9 active publishers for `FOO/USD` at
108110
It was found that 7 of the 9 publishers were influencing the price of `FOO/USD` at the time of the incident.
109111
The other 2 publishers were found publish price closely to the mediuan of the reference data.
110112

111-
![OIS Slashing Investigation](/images/ois/ois_slashing_investigation_light.png)
113+
<DualModeImage
114+
darkSrc="/images/ois/ois_slashing_investigation_dark.png"
115+
lightSrc="/images/ois/ois_slashing_investigation_light.png"
116+
alt="OIS Slashing Investigation"
117+
/>
112118

113119
### Pythian Council Process for Slashing
114120

115121
- Assume that the Pyth DAO has set the maximum slashable amount at 500 bps of the total stake of each responsible publisher's assigned pool, the maximum amount that can be slashed is $500 \text{ bps} \times 50\text{M} = 2.5\text{M PYTH}$.
116122
- From the investigation, \$200K of preventable liquidations were identified from on chain data, the Pythian Council could adjust the amount of stake slashed to 500K PYTH or 100bps (assuming PYTH/USD = $0.40).
117123

118-
![Pre Slashing Pool](/images/ois/ois_slashing_pool_pre_light.png)
124+
<DualModeImage
125+
darkSrc="/images/ois/ois_slashing_pool_pre_dark.png"
126+
lightSrc="/images/ois/ois_slashing_pool_pre_light.png"
127+
alt="Pre Slashing Pool"
128+
/>
119129

120130
- The 500K PYTH slashed is charged pro-rata to the 7 pools that constitute the stake subject to slashing (i.e. calculated according to the total stake in the 7 pools assigned to the 7 publishers found responsible for the misprint).
121131

122132
- Assume `pool_1` has 10M staked, made up of **6M self-staked and 4M delegated PYTH**.
123133
- The publisher assigned to `pool_1` would see its self-stake slashed 100bps of 6M PYTH, ie. 60K PYTH, resulting in **5.84M** residual self-stake.
124134
- Delegators to `pool_1` would see their stake slashed by 100bps of 4M PYTH, ie. 40K PYTH, resulting in **3.96M** residual delegated stake.
125135

126-
![Post Slashing Pool](/images/ois/ois_slashing_pool_post_light.png)
136+
<DualModeImage
137+
darkSrc="/images/ois/ois_slashing_pool_post_dark.png"
138+
lightSrc="/images/ois/ois_slashing_pool_post_light.png"
139+
alt="Post Slashing Pool"
140+
/>
127141

128142
- The total amount slashed in this example is 500K PYTH. This amount goes to the Pyth DAO treasury. The Pythian Council or the community can propose to the DAO to vote on means to distribute the slashed amount.
129143

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.lightImage {
2+
display: block;
3+
4+
:global(.dark) & {
5+
display: none;
6+
}
7+
}
8+
9+
.darkImage {
10+
display: none;
11+
12+
:global(.dark) & {
13+
display: block;
14+
}
15+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import clsx from "clsx";
2+
import { ImageZoom } from "fumadocs-ui/components/image-zoom";
3+
import Image from "next/image";
4+
import type { ComponentProps } from "react";
5+
6+
import styles from "./index.module.scss";
7+
8+
type ImageProps = ComponentProps<typeof Image>;
9+
type Props = Omit<ImageProps, "src"> & {
10+
darkSrc: string;
11+
lightSrc: string;
12+
};
13+
14+
const DualModeImage = ({
15+
darkSrc,
16+
lightSrc,
17+
className,
18+
alt,
19+
width = 800,
20+
height = 600,
21+
sizes = "100vw",
22+
...props
23+
}: Props) => {
24+
const commonProps = {
25+
alt,
26+
width,
27+
height,
28+
sizes,
29+
...props,
30+
};
31+
32+
return (
33+
<>
34+
<ImageZoom
35+
src={lightSrc}
36+
className={clsx(styles.lightImage, className)}
37+
{...commonProps}
38+
/>
39+
<ImageZoom
40+
src={darkSrc}
41+
className={clsx(styles.darkImage, className)}
42+
{...commonProps}
43+
/>
44+
</>
45+
);
46+
};
47+
48+
export default DualModeImage;

apps/developer-hub/src/config/layout.config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const baseOptions: BaseLayoutProps = {
88
enabled: true,
99
},
1010
themeSwitch: {
11-
enabled: false,
11+
enabled: false, // Keep this false as the theme switch is handled by the component library
1212
},
1313
searchToggle: {
1414
enabled: false,

0 commit comments

Comments
 (0)