Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ description: >-
This reference page provides examples of various scenarios to illustrate the Mathematical Representations of OIS.
---

import DualModeImage from "../../../src/components/DualModeImage";

NOTE: All the symbols used in the examples are explained in the [Mathematical Representation](./mathematical-representation) section.

## Example 1: Only Publisher Stake

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

![Example 1 - Only Publisher Stake](/images/ois/OIS_Rewards_Example_Light_1.png)
<br />
<DualModeImage
darkSrc="/images/ois/OIS_Rewards_Example_Dark_1.png"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to import the images and pass the import here. Next can do some automatic image optimization when you import images which it cannot do when you use image urls. Also you can colocate the images with where they're used which is nice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I was using image URL as per the fuma docs https://fumadocs.dev/docs/headless/custom-source#images

If there would be optimization by using the import, lets do it.

lightSrc="/images/ois/OIS_Rewards_Example_Light_1.png"
alt="Example 1 - Only Publisher Stake"
Comment on lines +17 to +19
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the fuma docs, referencing Images with URL

/>

$$
\begin{aligned}
Expand All @@ -33,7 +40,12 @@ $$

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

![Example 2 - Publisher and Delegator Stake](/images/ois/OIS_Rewards_Example_Light_2.png)
<br />
<DualModeImage
darkSrc="/images/ois/OIS_Rewards_Example_Dark_2.png"
lightSrc="/images/ois/OIS_Rewards_Example_Light_2.png"
alt="Example 2 - Publisher and Delegator Stake"
/>

$$
\begin{aligned}
Expand All @@ -56,7 +68,12 @@ $$

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

![Example 3 - Stake Exceeding Cap](/images/ois/OIS_Rewards_Example_Light_3.png)
<br />
<DualModeImage
darkSrc="/images/ois/OIS_Rewards_Example_Dark_3.png"
lightSrc="/images/ois/OIS_Rewards_Example_Light_3.png"
alt="Example 3 - Stake Exceeding Cap"
/>

$$
\begin{aligned}
Expand All @@ -79,7 +96,12 @@ $$

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

![Example 4 - Delegator Fees](/images/ois/OIS_Rewards_Example_Light_4.png)
<br />
<DualModeImage
darkSrc="/images/ois/OIS_Rewards_Example_Dark_4.png"
lightSrc="/images/ois/OIS_Rewards_Example_Light_4.png"
alt="Example 4 - Delegator Fees"
/>

$$
\begin{aligned}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ description: >-
on the Pyth network.
---

import DualModeImage from "../../../src/components/DualModeImage";

# Purpose and Scope

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.
Expand Down Expand Up @@ -108,22 +110,34 @@ The Pythian councile identifies there were 9 active publishers for `FOO/USD` at
It was found that 7 of the 9 publishers were influencing the price of `FOO/USD` at the time of the incident.
The other 2 publishers were found publish price closely to the mediuan of the reference data.

![OIS Slashing Investigation](/images/ois/ois_slashing_investigation_light.png)
<DualModeImage
darkSrc="/images/ois/ois_slashing_investigation_dark.png"
lightSrc="/images/ois/ois_slashing_investigation_light.png"
alt="OIS Slashing Investigation"
/>

### Pythian Council Process for Slashing

- 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}$.
- 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).

![Pre Slashing Pool](/images/ois/ois_slashing_pool_pre_light.png)
<DualModeImage
darkSrc="/images/ois/ois_slashing_pool_pre_dark.png"
lightSrc="/images/ois/ois_slashing_pool_pre_light.png"
alt="Pre Slashing Pool"
/>

- 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).

- Assume `pool_1` has 10M staked, made up of **6M self-staked and 4M delegated PYTH**.
- 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.
- Delegators to `pool_1` would see their stake slashed by 100bps of 4M PYTH, ie. 40K PYTH, resulting in **3.96M** residual delegated stake.

![Post Slashing Pool](/images/ois/ois_slashing_pool_post_light.png)
<DualModeImage
darkSrc="/images/ois/ois_slashing_pool_post_dark.png"
lightSrc="/images/ois/ois_slashing_pool_post_light.png"
alt="Post Slashing Pool"
/>

- 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.

Expand Down
15 changes: 15 additions & 0 deletions apps/developer-hub/src/components/DualModeImage/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.lightImage {
display: block;

Comment on lines +1 to +3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created this module, and added them in a folder to follow the same pattern.

:global(.dark) & {
display: none;
}
}

.darkImage {
display: none;

:global(.dark) & {
display: block;
}
}
48 changes: 48 additions & 0 deletions apps/developer-hub/src/components/DualModeImage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import clsx from "clsx";
import { ImageZoom } from "fumadocs-ui/components/image-zoom";
import Image from "next/image";
import type { ComponentProps } from "react";

import styles from "./index.module.scss";

type ImageProps = ComponentProps<typeof Image>;
type Props = Omit<ImageProps, "src"> & {
darkSrc: string;
lightSrc: string;
};

const DualModeImage = ({
darkSrc,
lightSrc,
className,
alt,
width = 800,
height = 600,
sizes = "100vw",
...props
}: Props) => {
const commonProps = {
alt,
width,
height,
sizes,
...props,
};

return (
<>
<ImageZoom
src={lightSrc}
className={clsx(styles.lightImage, className)}
{...commonProps}
/>
<ImageZoom
src={darkSrc}
className={clsx(styles.darkImage, className)}
{...commonProps}
/>
</>
);
};

export default DualModeImage;
2 changes: 1 addition & 1 deletion apps/developer-hub/src/config/layout.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const baseOptions: BaseLayoutProps = {
enabled: true,
},
themeSwitch: {
enabled: false,
enabled: false, // Keep this false as the theme switch is handled by the component library
},
searchToggle: {
enabled: false,
Expand Down
Loading