Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ripcord display changes #1952

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions src/features/data/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface Docs {
porType?: string
productSubType?: string
productType?: string
ripcordApi?: string
shutdownDate?: string
}
export interface ChainMetadata {
Expand Down
12 changes: 0 additions & 12 deletions src/features/data/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export type FeedDataItem = {
[key: string]: string
}

export const priceFeedAddresses = {
btc: {
usd: {
Expand Down Expand Up @@ -37,11 +33,3 @@ export const registryAddresses = {
},
},
}

export const monitoredFeeds = {
mainnet: [
{
"0xBE456fd14720C3aCCc30A2013Bffd782c9Cb75D5": "TrueUSD",
},
],
}
20 changes: 0 additions & 20 deletions src/features/feeds/components/FeedPage.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,12 @@ export type Props = {
}
import { getServerSideChainMetadata } from "~/features/data/api/backend"
import { CHAINS, ALL_CHAINS } from "~/features/data/chains"
import { CheckHeartbeat } from "./pause-notice/CheckHeartbeat"
import { FeedDataItem, monitoredFeeds } from "~/features/data"

const { initialNetwork, ecosystem, dataFeedType } = Astro.props

const initialCache = await getServerSideChainMetadata([...CHAINS, ...ALL_CHAINS])
const feedItems: FeedDataItem[] = monitoredFeeds.mainnet
---

{
dataFeedType === "por"
? feedItems.map((feedItem: FeedDataItem) => {
const [feedAddress] = Object.keys(feedItem)
return (
<CheckHeartbeat
client:only="preact"
{feedAddress}
supportedChain="ETHEREUM_MAINNET"
feedName="TUSD Reserves"
currencyName={feedItem[feedAddress]}
/>
)
})
: ""
}

{
ecosystem === "deprecating" ? (
<>
Expand Down
32 changes: 15 additions & 17 deletions src/features/feeds/components/Tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { ChainNetwork } from "~/features/data/chains"
import tableStyles from "./Tables.module.css"
import button from "@chainlink/design-system/button.module.css"
import { CheckHeartbeat } from "./pause-notice/CheckHeartbeat"
import { monitoredFeeds, FeedDataItem } from "~/features/data"

const feedItems = monitoredFeeds.mainnet
const verifierProxies = new Map<string, string>([
["0x534a7FF707Bc862cAB0Dda546F1B817Be5235b66", "0x478Aa2aC9F6D65F84e09D9185d126c3a17c2a93C"],
["0xA403a4a521be034B4A0D54019aF469A207094246", "0x2ff010DEbC1297f19579B4246cad07bd24F2488A"],
])

const feedCategories = {
low: (
<span
Expand Down Expand Up @@ -210,21 +213,16 @@ const ProofOfReserveTHead = ({ showExtraDetails }: { showExtraDetails: boolean }
const ProofOfReserveTr = ({ network, proxy, showExtraDetails }) => (
<tr>
<td class={tableStyles.pairCol}>
{feedItems.map((feedItem: FeedDataItem) => {
const [feedAddress] = Object.keys(feedItem)
if (feedAddress === proxy.proxyAddress) {
return (
<CheckHeartbeat
feedAddress={proxy.proxyAddress}
supportedChain="ETHEREUM_MAINNET"
feedName="TUSD Reserves"
list
currencyName={feedItem[feedAddress]}
/>
)
}
return ""
})}
{proxy.docs.ripcordApi && (
<CheckHeartbeat
feedAddress={proxy.proxyAddress}
supportedChain={network.name.toUpperCase().replace(/ /g, "_")}
feedName={proxy.name}
heartbeat={proxy.heartbeat}
list
ripcordApi={proxy.docs.ripcordApi}
/>
)}
<div className={tableStyles.assetPair}>
{feedCategories[proxy.docs.feedCategory] || ""}
{proxy.name}
Expand Down
10 changes: 6 additions & 4 deletions src/features/feeds/components/pause-notice/CheckHeartbeat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ export const CheckHeartbeat = ({
feedAddress,
supportedChain,
feedName,
heartbeat,
list,
currencyName,
ripcordApi,
}: {
feedAddress: string
supportedChain: SupportedChain
feedName: string
heartbeat: number
list?: boolean
currencyName: string
ripcordApi: string
}) => {
const [latestUpdateTimestamp, setLatestUpdateTimestamp] = useState<number | undefined>(undefined)
const getLatestTimestamp = useCallback(async () => {
Expand Down Expand Up @@ -58,9 +60,9 @@ export const CheckHeartbeat = ({
type="alert"
feedName={feedName}
feedAddress={feedAddress}
heartbeat={86400}
heartbeat={heartbeat}
buffer={900}
currencyName={currencyName}
ripcordApi={ripcordApi}
/>
</div>
) : null
Expand Down
13 changes: 5 additions & 8 deletions src/features/feeds/components/pause-notice/PauseNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const PauseNotice = ({
value,
heartbeat,
buffer,
currencyName,
ripcordApi,
}: {
value: number
list?: boolean
Expand All @@ -27,7 +27,7 @@ export const PauseNotice = ({
feedAddress: string
heartbeat: number
buffer: number
currencyName: string
ripcordApi: string
}) => {
const [ripCord, setRipCord] = useState<boolean>(false)
const date = Math.floor(new Date().getTime() / 1000)
Expand All @@ -36,12 +36,9 @@ export const PauseNotice = ({

useEffect(() => {
const fetchRipCord = async () => {
const res = await fetch(
`https://api.real-time-reserves.verinumus.io/v1/chainlink/proof-of-reserves/${currencyName}`,
{
method: "GET",
}
)
const res = await fetch(ripcordApi, {
method: "GET",
})
const fecthedProofOfReserveData = await res.json()
setRipCord(fecthedProofOfReserveData.ripcord ?? false)
}
Expand Down
1 change: 1 addition & 0 deletions src/features/feeds/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface Proxy {
feedCategory: FeedCategory
feedType: ProxyFeedType
shutdownDate?: string
ripcordApi?: string
}

export interface Network {
Expand Down