working proxy?
This commit is contained in:
@@ -15,10 +15,10 @@ import {getOrderInfo, isOrderForPositionByData, isVisibleOrder} from "../../util
|
||||
import {createDecreaseOrderTxn} from "./transactions/createDecreaseOrderTxn.js";
|
||||
import {createIncreaseOrderTxn} from "./transactions/createIncreaseOrderTxn.js";
|
||||
import {
|
||||
buildGetOrdersMulticall,
|
||||
getExecutionFeeAmountForEntry,
|
||||
matchByMarket,
|
||||
parseGetOrdersResponse
|
||||
buildGetOrdersMulticall,
|
||||
getExecutionFeeAmountForEntry,
|
||||
matchByMarket,
|
||||
parseGetOrdersResponse
|
||||
} from "./utils.js";
|
||||
import {Module} from "../base.js";
|
||||
import {createSwapOrderTxn} from "./transactions/createSwapOrderTxn.js";
|
||||
|
||||
@@ -9,6 +9,7 @@ import {TokensData} from "../../../types/tokens.js";
|
||||
|
||||
import {isMarketOrderType} from "../../../utils/orders.js";
|
||||
import {applySlippageToMinOut} from "../../../utils/trade/index.js";
|
||||
import {simulateExecuteOrder} from "../../../utils/simulateExecuteOrder.js";
|
||||
|
||||
import type {GmxSdk} from "../../..";
|
||||
|
||||
@@ -30,7 +31,14 @@ export async function createSwapOrderTxn(sdk: GmxSdk, p: SwapOrderParams) {
|
||||
const { encodedPayload, totalWntAmount } = await getParams(sdk, p);
|
||||
const { encodedPayload: simulationEncodedPayload, totalWntAmount: sumaltionTotalWntAmount } = await getParams(sdk, p);
|
||||
|
||||
|
||||
if (p.orderType !== OrderType.LimitSwap) {
|
||||
await simulateExecuteOrder(sdk, {
|
||||
primaryPriceOverrides: {},
|
||||
createMulticallPayload: simulationEncodedPayload,
|
||||
value: sumaltionTotalWntAmount,
|
||||
tokensData: p.tokensData,
|
||||
});
|
||||
}
|
||||
|
||||
await sdk.callContract(
|
||||
getContract(sdk.chainId, "ExchangeRouter"),
|
||||
@@ -68,7 +76,7 @@ async function getParams(sdk: GmxSdk, p: SwapOrderParams) {
|
||||
callbackContract: zeroAddress,
|
||||
market: zeroAddress,
|
||||
swapPath: p.swapPath,
|
||||
uiFeeReceiver: sdk.config.settings?.uiFeeReceiverAccount ?? zeroAddress,
|
||||
uiFeeReceiver: zeroAddress,
|
||||
},
|
||||
numbers: {
|
||||
sizeDeltaUsd: 0n,
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import {withRetry} from "viem";
|
||||
|
||||
import {
|
||||
EXECUTION_FEE_CONFIG_V2,
|
||||
GAS_PRICE_PREMIUM_MAP,
|
||||
getChain,
|
||||
MAX_PRIORITY_FEE_PER_GAS_MAP
|
||||
EXECUTION_FEE_CONFIG_V2,
|
||||
GAS_PRICE_PREMIUM_MAP,
|
||||
getChain,
|
||||
MAX_PRIORITY_FEE_PER_GAS_MAP
|
||||
} from "../../configs/chains.js";
|
||||
import {getContract} from "../../configs/contracts.js";
|
||||
import {
|
||||
decreaseOrderGasLimitKey,
|
||||
depositGasLimitKey,
|
||||
ESTIMATED_GAS_FEE_BASE_AMOUNT_V2_1,
|
||||
ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR,
|
||||
ESTIMATED_GAS_FEE_PER_ORACLE_PRICE,
|
||||
GLV_DEPOSIT_GAS_LIMIT,
|
||||
GLV_PER_MARKET_GAS_LIMIT,
|
||||
GLV_WITHDRAWAL_GAS_LIMIT,
|
||||
increaseOrderGasLimitKey,
|
||||
shiftGasLimitKey,
|
||||
singleSwapGasLimitKey,
|
||||
swapOrderGasLimitKey,
|
||||
uiFeeFactorKey,
|
||||
withdrawalGasLimitKey,
|
||||
decreaseOrderGasLimitKey,
|
||||
depositGasLimitKey,
|
||||
ESTIMATED_GAS_FEE_BASE_AMOUNT_V2_1,
|
||||
ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR,
|
||||
ESTIMATED_GAS_FEE_PER_ORACLE_PRICE,
|
||||
GLV_DEPOSIT_GAS_LIMIT,
|
||||
GLV_PER_MARKET_GAS_LIMIT,
|
||||
GLV_WITHDRAWAL_GAS_LIMIT,
|
||||
increaseOrderGasLimitKey,
|
||||
shiftGasLimitKey,
|
||||
singleSwapGasLimitKey,
|
||||
swapOrderGasLimitKey,
|
||||
uiFeeFactorKey,
|
||||
withdrawalGasLimitKey,
|
||||
} from "../../configs/dataStore.js";
|
||||
|
||||
import type {DecreasePositionAmounts, IncreasePositionAmounts, SwapAmounts, TradeFeesType} from "../../types/trade.js";
|
||||
@@ -31,10 +31,10 @@ import {TokensData} from "../../types/tokens.js";
|
||||
import {bigMath} from "../../utils/bigmath.js";
|
||||
import {estimateOrderOraclePriceCount} from "../../utils/fees/estimateOraclePriceCount.js";
|
||||
import {
|
||||
estimateExecuteDecreaseOrderGasLimit,
|
||||
estimateExecuteIncreaseOrderGasLimit,
|
||||
estimateExecuteSwapOrderGasLimit,
|
||||
getExecutionFee,
|
||||
estimateExecuteDecreaseOrderGasLimit,
|
||||
estimateExecuteIncreaseOrderGasLimit,
|
||||
estimateExecuteSwapOrderGasLimit,
|
||||
getExecutionFee,
|
||||
} from "../../utils/fees/executionFee.js";
|
||||
import {getSwapCount} from "../../utils/trade/index.js";
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user