Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
mstfash committed Oct 25, 2021
1 parent a98cf72 commit e849d04
Showing 1 changed file with 1 addition and 49 deletions.
50 changes: 1 addition & 49 deletions src/components/SafeOperations/SafeBody.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useCallback } from 'react'
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { BigNumber } from 'ethers'
import { utils as gebUtils } from 'geb.js'
Expand Down Expand Up @@ -26,8 +26,6 @@ import { DEFAULT_SAFE_STATE, COIN_TICKER } from '../../utils/constants'
import { Info } from 'react-feather'
import ReactTooltip from 'react-tooltip'
import { useIsOwner, useProxyAddress } from '../../hooks/useGeb'
import { useMinSaviourBalance, useSaviourData } from '../../hooks/useSaviour'
import AlertLabel from '../AlertLabel'

export const LIQUIDATION_RATIO = 135 // percent
interface Props {
Expand All @@ -37,8 +35,6 @@ interface Props {
const SafeBody = ({ isChecked }: Props) => {
const { t } = useTranslation()
const proxyAddress = useProxyAddress()
const { getMinSaviourBalance } = useMinSaviourBalance()
const saviourData = useSaviourData()
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [checkUniSwapPool, setCheckUniSwapPool] = useState(isChecked || false)
const [error, setError] = useState('')
Expand Down Expand Up @@ -68,10 +64,6 @@ const SafeBody = ({ isChecked }: Props) => {
globalDebtCeiling,
} = safeState.liquidationData

const raiPrice = singleSafe
? (formatNumber(currentRedemptionPrice, 3) as number)
: 0

const isOwner = useIsOwner(singleSafe?.id as string)
const raiBalance = connectWalletState.raiBalance[NETWORK_ID].toString()

Expand Down Expand Up @@ -168,13 +160,6 @@ const SafeBody = ({ isChecked }: Props) => {
Number(getAvailableRai()) > 0.01
? formatNumber(getAvailableRai(), 2)
: '< 0.01'
} ${
isCreate
? ''
: `≃ $${formatNumber(
String(Number(getAvailableRai()) * raiPrice),
2
)}`
})`
}
if (type === 'repay_withdraw' && isLeft) {
Expand Down Expand Up @@ -502,36 +487,9 @@ const SafeBody = ({ isChecked }: Props) => {
setUniSwapVal(uniSwapPool)
}, [safeData, uniSwapPool])

const returnStatus = useCallback(() => {
if (!saviourData) return 'none'
const minimumBalance = getMinSaviourBalance(
saviourData.saviourRescueRatio,
totalDebt,
totalCollateral
) as number
if (Number(saviourData.saviourBalance) >= minimumBalance) {
return 'Protected'
}
return 'Unprotected'
}, [getMinSaviourBalance, saviourData, totalCollateral, totalDebt])

return (
<>
<Body>
{saviourData && saviourData.hasSaviour ? (
<SaviourLabel>
<AlertLabel
text={`Status: ${returnStatus()}`}
type={
returnStatus() === 'Protected'
? 'success'
: returnStatus() === 'none'
? 'dimmed'
: 'danger'
}
/>
</SaviourLabel>
) : null}
<DoubleInput
className={type === 'repay_withdraw' ? 'reverse' : ''}
>
Expand Down Expand Up @@ -876,9 +834,3 @@ const Note = styled.div`
font-size: ${(props) => props.theme.font.extraSmall};
margin-top: 5px;
`

const SaviourLabel = styled.div`
position: absolute;
top: -53px;
right: 20px;
`

0 comments on commit e849d04

Please sign in to comment.