Skip to content

Commit

Permalink
feat: make hooks use partially fillable by default (#5086)
Browse files Browse the repository at this point in the history
* feat: make hooks use partially fillable by default

* fix: fix broken yield

* fix: simplify implementation
  • Loading branch information
anxolin authored Nov 14, 2024
1 parent aa4467a commit 27a8d4d
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ import { useCloseModals } from 'legacy/state/application/hooks'
import { useAppData, useAppDataHooks } from 'modules/appData'
import { useGeneratePermitHook, useGetCachedPermit, usePermitInfo } from 'modules/permit'
import { useEnoughBalanceAndAllowance } from 'modules/tokens'
import { useDerivedTradeState, useReceiveAmountInfo, useTradeConfirmActions, useTradeTypeInfo } from 'modules/trade'
import {
useDerivedTradeState,
useIsHooksTradeType,
useReceiveAmountInfo,
useTradeConfirmActions,
useTradeTypeInfo,
} from 'modules/trade'
import { getOrderValidTo, useTradeQuote } from 'modules/tradeQuote'

import { useGP2SettlementContract } from 'common/hooks/useContract'

import { TradeTypeToUiOrderType } from '../../trade/const/common'
import { TradeFlowContext } from '../types/TradeFlowContext'
import { UiOrderType } from '@cowprotocol/types'

export interface TradeFlowParams {
deadline: number
Expand All @@ -34,6 +41,7 @@ export function useTradeFlowContext({ deadline }: TradeFlowParams): TradeFlowCon
const tradeTypeInfo = useTradeTypeInfo()
const tradeType = tradeTypeInfo?.tradeType
const uiOrderType = tradeType ? TradeTypeToUiOrderType[tradeType] : null
const isHooksTradeType = useIsHooksTradeType()

const sellCurrency = derivedTradeState?.inputCurrency
const inputAmount = receiveAmountInfo?.afterSlippage.sellAmount
Expand Down Expand Up @@ -194,7 +202,7 @@ export function useTradeFlowContext({ deadline }: TradeFlowParams): TradeFlowCon
allowsOffchainSigning,
appData,
class: OrderClass.MARKET,
partiallyFillable: false, // SWAP orders are always fill or kill - for now
partiallyFillable: isHooksTradeType,
quoteId: quoteResponse.id,
isSafeWallet,
},
Expand Down

0 comments on commit 27a8d4d

Please sign in to comment.