Skip to content

Commit

Permalink
Fix Maker auto sell form, turn off CM
Browse files Browse the repository at this point in the history
  • Loading branch information
piekczyk committed Sep 27, 2024
1 parent 80142be commit 2cc96cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
13 changes: 2 additions & 11 deletions components/vault/ProtectionControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,9 @@ function getZeroDebtProtectionBannerProps({

export interface ProtectionControlOverridesProps {
AutoSellDetailsView?: () => JSX.Element | null
AutoSellFormControl?: () => JSX.Element | null
}

export function ProtectionControl({
AutoSellDetailsView,
AutoSellFormControl,
}: ProtectionControlOverridesProps = {}) {
export function ProtectionControl({ AutoSellDetailsView }: ProtectionControlOverridesProps = {}) {
const { txHelpers$ } = useMainContext()
const {
positionData: { debt, debtFloor, debtToken },
Expand Down Expand Up @@ -162,12 +158,7 @@ export function ProtectionControl({
vaultHasActiveTrigger || (!debt.isZero() && debt.gt(debtFloor)) ? (
<DefaultVaultLayout
detailsViewControl={<ProtectionDetailsControl AutoSell={AutoSellDetailsView} />}
editForm={
<ProtectionFormControl
txHelpers={txHelpersData}
CustomAutoSellFormControl={AutoSellFormControl}
/>
}
editForm={<ProtectionFormControl txHelpers={txHelpersData} />}
/>
) : (
<Container
Expand Down
1 change: 0 additions & 1 deletion features/automation/common/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export const protocolAutomations = {
AutomationFeatures.STOP_LOSS,
AutomationFeatures.AUTO_SELL,
AutomationFeatures.AUTO_BUY,
AutomationFeatures.CONSTANT_MULTIPLE,
AutomationFeatures.AUTO_TAKE_PROFIT,
],
[VaultProtocol.Aave]: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ import React, { useEffect } from 'react'

interface ProtectionFormControlProps {
txHelpers?: TxHelpers
CustomAutoSellFormControl?: () => JSX.Element | null
}

export function ProtectionFormControl({
txHelpers,
CustomAutoSellFormControl,
}: ProtectionFormControlProps) {
export function ProtectionFormControl({ txHelpers }: ProtectionFormControlProps) {
const {
automationTriggersData,
protocol,
Expand Down Expand Up @@ -58,19 +54,6 @@ export function ProtectionFormControl({

const { isStopLossAvailable, isAutoSellAvailable } = getAvailableAutomation(protocol)

const AutoSellControl = () => {
if (CustomAutoSellFormControl) {
return <CustomAutoSellFormControl />
}
return (
<AutoSellFormControl
isAutoSellActive={isAutoSellActive}
shouldRemoveAllowance={shouldRemoveAllowance}
txHelpers={txHelpers}
/>
)
}

return (
<>
{stopLossWriteEnabled && isStopLossAvailable && (
Expand All @@ -80,7 +63,13 @@ export function ProtectionFormControl({
shouldRemoveAllowance={shouldRemoveAllowance}
/>
)}
{isAutoSellAvailable && <AutoSellControl />}
{isAutoSellAvailable && (
<AutoSellFormControl
isAutoSellActive={isAutoSellActive}
shouldRemoveAllowance={shouldRemoveAllowance}
txHelpers={txHelpers}
/>
)}
</>
)
}

0 comments on commit 2cc96cc

Please sign in to comment.