Skip to content

Commit

Permalink
Add alert emoji to Monitor tab if oracle guardian detects manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed Feb 6, 2024
1 parent c0cb6f6 commit 21e0ff4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions earn/src/components/lend/SupplyTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,24 @@ export default function SupplyTable(props: SupplyTableProps) {
</th>
<th className='px-4 py-2 text-start whitespace-nowrap'>
<SortButton onClick={() => requestSort('apy', sortConfig?.primaryKey)}>
<Text size='M' weight='bold'>
APY
</Text>
<SortArrow
isSorted={sortConfig?.primaryKey === 'apy' ?? false}
isSortedDesc={sortConfig?.direction === 'descending' ?? false}
/>
<Text size='M' weight='bold'>
APY
</Text>
</SortButton>
</th>
<th className='px-4 py-2 text-start whitespace-nowrap'>
<SortButton onClick={() => requestSort('totalSupplyUsd', sortConfig?.primaryKey)}>
<Text size='M' weight='bold'>
Total Supply
</Text>
<SortArrow
isSorted={sortConfig?.primaryKey === 'totalSupplyUsd' ?? false}
isSortedDesc={sortConfig?.direction === 'descending' ?? false}
/>
<Text size='M' weight='bold'>
Total Supply
</Text>
</SortButton>
</th>
<th className='px-4 py-2 text-end whitespace-nowrap'>
Expand Down
6 changes: 5 additions & 1 deletion earn/src/pages/MarketsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export default function MarketsPage() {
return poolInfoMap;
}, [lendingPairs]);

const doesGuardianSenseManipulation = useMemo(() => {
return lendingPairs.some((pair) => pair.oracleData.manipulationMetric > pair.manipulationThreshold);
}, [lendingPairs]);

// MARK: wagmi hooks
const { address: userAddress } = useAccount();
const provider = useProvider({ chainId: activeChain.id });
Expand Down Expand Up @@ -324,7 +328,7 @@ export default function MarketsPage() {
role='tab'
aria-selected={selectedHeaderOption === HeaderOptions.Monitor}
>
Monitor
Monitor{doesGuardianSenseManipulation ? ' 🚨' : ''}
</HeaderSegmentedControlOption>
</div>
<HeaderDividingLine />
Expand Down

0 comments on commit 21e0ff4

Please sign in to comment.