Skip to content

Commit d21baf1

Browse files
committed
add quoteid to cow orders for analytics
1 parent 9656993 commit d21baf1

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

src/components/transactions/Swap/actions/CollateralSwap/CollateralSwapActionsViaCoWAdapters.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { useSwapGasEstimation } from '../../hooks/useSwapGasEstimation';
2525
import {
2626
areActionsBlocked,
2727
ExpiryToSecondsMap,
28+
isCowProtocolRates,
2829
OrderType,
2930
SwapParams,
3031
SwapState,
@@ -188,6 +189,7 @@ export const CollateralSwapActionsViaCowAdapters = ({
188189
buyToken: state.buyAmountToken.underlyingAddress,
189190
buyTokenDecimals: state.buyAmountToken.decimals,
190191
sellAmount: sellAmountToSign.toString(),
192+
quoteId: isCowProtocolRates(state.swapRate) ? state.swapRate?.quoteId : undefined,
191193
buyAmount: state.buyAmountBigInt.toString(),
192194
kind: state.processedSide === 'buy' ? OrderKind.BUY : OrderKind.SELL,
193195
validTo,

src/components/transactions/Swap/actions/DebtSwap/DebtSwapActionsViaCoW.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { useSwapGasEstimation } from '../../hooks/useSwapGasEstimation';
3030
import {
3131
areActionsBlocked,
3232
ExpiryToSecondsMap,
33+
isCowProtocolRates,
3334
isProtocolSwapState,
3435
OrderType,
3536
SwapParams,
@@ -207,6 +208,7 @@ export const DebtSwapActionsViaCoW = ({
207208
sellAmount: sellAmountToSign.toString(),
208209
buyAmount: buyAmountWithMarginForDustProtection.toString(),
209210
kind: state.processedSide === 'buy' ? OrderKind.BUY : OrderKind.SELL,
211+
quoteId: isCowProtocolRates(state.swapRate) ? state.swapRate?.quoteId : undefined,
210212
validTo,
211213
slippageBps: state.orderType == OrderType.MARKET ? Number(state.slippage) * 100 : undefined,
212214
partnerFee: COW_PARTNER_FEE(state.sellAmountToken.symbol, state.buyAmountToken.symbol),

src/components/transactions/Swap/actions/RepayWithCollateral/RepayWithCollateralActionsViaCoW.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { useSwapGasEstimation } from '../../hooks/useSwapGasEstimation';
2929
import {
3030
areActionsBlocked,
3131
ExpiryToSecondsMap,
32+
isCowProtocolRates,
3233
OrderType,
3334
SwapParams,
3435
SwapState,
@@ -205,6 +206,7 @@ export const RepayWithCollateralActionsViaCoW = ({
205206
sellAmount: sellAmountToSign.toString(),
206207
buyAmount: buyAmountWithMarginForDustProtection.toString(),
207208
kind: state.processedSide === 'buy' ? OrderKind.BUY : OrderKind.SELL,
209+
quoteId: isCowProtocolRates(state.swapRate) ? state.swapRate?.quoteId : undefined,
208210
validTo,
209211
slippageBps: state.orderType == OrderType.MARKET ? Number(state.slippage) * 100 : undefined,
210212
partnerFee: COW_PARTNER_FEE(state.sellAmountToken.symbol, state.buyAmountToken.symbol),

src/components/transactions/Swap/helpers/cow/adapters.helpers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
DUST_PROTECTION_MULTIPLIER,
2121
FLASH_LOAN_FEE_BPS,
2222
} from '../../constants/cow.constants';
23-
import { OrderType, SwapProvider, SwapState, SwapType } from '../../types';
23+
import { isCowProtocolRates, OrderType, SwapProvider, SwapState, SwapType } from '../../types';
2424
import { getCowFlashLoanSdk } from './env.helpers';
2525

2626
export const calculateInstanceAddress = async ({
@@ -50,6 +50,7 @@ export const calculateInstanceAddress = async ({
5050
buyAmount,
5151
sellToken,
5252
buyToken,
53+
quoteId,
5354
side,
5455
slippageBps,
5556
partnerFee,
@@ -65,6 +66,7 @@ export const calculateInstanceAddress = async ({
6566
sellToken: state.sellAmountToken,
6667
buyAmount: state.buyAmountBigInt,
6768
buyToken: state.buyAmountToken,
69+
quoteId: isCowProtocolRates(state.swapRate) ? state.swapRate?.quoteId : undefined,
6870
side: state.processedSide,
6971
slippageBps: state.orderType == OrderType.MARKET ? Number(state.slippage) * 100 : undefined,
7072
partnerFee: COW_PARTNER_FEE(state.sellAmountToken.symbol, state.buyAmountToken.symbol),
@@ -83,6 +85,7 @@ export const calculateInstanceAddress = async ({
8385
sellAmount: sellAmountToSign.toString(),
8486
buyAmount: buyAmount.toString(),
8587
kind: side === 'buy' ? OrderKind.BUY : OrderKind.SELL,
88+
quoteId,
8689
validTo,
8790
slippageBps,
8891
partnerFee,

0 commit comments

Comments
 (0)