Skip to content

Commit

Permalink
feat: savers remove dangerous withdraw warning
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre committed Jun 12, 2024
1 parent 721fd87 commit 2d8cd1c
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ type ConfirmProps = { accountId: AccountId | undefined } & StepComponentProps
export const Confirm: React.FC<ConfirmProps> = ({ accountId, onNext }) => {
const [quoteLoading, setQuoteLoading] = useState(false)
const [quote, setQuote] = useState<ThorchainSaversWithdrawQuoteResponseSuccess | null>(null)
const [isDangerousWithdraw, setIsDangerousWithdraw] = useState(false)
const [expiry, setExpiry] = useState<string>('')
const [fromAddress, setfromAddress] = useState<string | null>(null)
const [protocolFeeCryptoBaseUnit, setProtocolFeeCryptoBaseUnit] = useState<string>('')
Expand Down Expand Up @@ -214,12 +213,7 @@ export const Confirm: React.FC<ConfirmProps> = ({ accountId, onNext }) => {

setExpiry(_expiry)

const _isDangerousWithdraw = bnOrZero(expected_amount_out).isZero()
setIsDangerousWithdraw(_isDangerousWithdraw)
// If there's nothing being withdrawn, then the protocol fee is the entire amount
const protocolFeeCryptoThorBaseUnit = _isDangerousWithdraw
? amountCryptoThorBaseUnit
: amountCryptoThorBaseUnit.minus(expected_amount_out)
const protocolFeeCryptoThorBaseUnit = amountCryptoThorBaseUnit.minus(expected_amount_out)
setProtocolFeeCryptoBaseUnit(
toBaseUnit(fromThorBaseUnit(protocolFeeCryptoThorBaseUnit), asset.precision),
)
Expand Down Expand Up @@ -249,7 +243,6 @@ export const Confirm: React.FC<ConfirmProps> = ({ accountId, onNext }) => {
opportunityData?.stakedAmountCryptoBaseUnit,
state?.withdraw.cryptoAmount,
protocolFeeCryptoBaseUnit,
isDangerousWithdraw,
expiry,
])

Expand Down Expand Up @@ -604,12 +597,6 @@ export const Confirm: React.FC<ConfirmProps> = ({ accountId, onNext }) => {
</Row.Value>
</Row>
)}
{isDangerousWithdraw && (
<Alert status='warning' borderRadius='lg'>
<AlertIcon />
<Text translation={'defi.modals.saversVaults.dangerousWithdrawWarning'} />
</Alert>
)}
{!hasEnoughBalanceForGas && (
<Alert status='error' borderRadius='lg'>
<AlertIcon />
Expand Down

0 comments on commit 2d8cd1c

Please sign in to comment.