Fix a bit uiFee
This commit is contained in:
@@ -14,6 +14,7 @@ import {createDecreaseEncodedPayload, DecreaseOrderParams} from "./createDecreas
|
||||
import {createUpdateEncodedPayload} from "./updateOrderTxn.js";
|
||||
import {simulateExecuteOrder} from "../../../utils/simulateExecuteOrder.js";
|
||||
import {applySlippageToMinOut, applySlippageToPrice} from "../../../utils/trade/index.js";
|
||||
import {DEFAULT_UI_FEE_RECEIVER_ACCOUNT} from "../../utils/utils.js";
|
||||
|
||||
export type PriceOverrides = {
|
||||
[address: string]: TokenPrices | undefined;
|
||||
@@ -245,7 +246,7 @@ function createOrderParams({
|
||||
callbackContract: zeroAddress,
|
||||
market: p.marketAddress,
|
||||
swapPath: p.swapPath,
|
||||
uiFeeReceiver: p.uiFeeReceiver,
|
||||
uiFeeReceiver: DEFAULT_UI_FEE_RECEIVER_ACCOUNT,
|
||||
},
|
||||
numbers: {
|
||||
sizeDeltaUsd: p.sizeDeltaUsd,
|
||||
|
||||
@@ -1,42 +1,46 @@
|
||||
import { withRetry } from "viem";
|
||||
import {withRetry} from "viem";
|
||||
|
||||
import { 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,
|
||||
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,
|
||||
} from "../../configs/dataStore.js";
|
||||
|
||||
import type { IncreasePositionAmounts } from "../../types/trade.js";
|
||||
import type { GasLimitsConfig } from "../../types/fees.js";
|
||||
import type { DecreasePositionAmounts, SwapAmounts, TradeFeesType } from "../../types/trade.js";
|
||||
import { TokensData } from "../../types/tokens.js";
|
||||
import type {DecreasePositionAmounts, IncreasePositionAmounts, SwapAmounts, TradeFeesType} from "../../types/trade.js";
|
||||
import type {GasLimitsConfig} from "../../types/fees.js";
|
||||
import {TokensData} from "../../types/tokens.js";
|
||||
|
||||
import { bigMath } from "../../utils/bigmath.js";
|
||||
import { estimateOrderOraclePriceCount } from "../../utils/fees/estimateOraclePriceCount.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";
|
||||
import {getSwapCount} from "../../utils/trade/index.js";
|
||||
|
||||
import { Module } from "../base.js";
|
||||
import {Module} from "../base.js";
|
||||
|
||||
const DEFAULT_UI_FEE_RECEIVER_ACCOUNT = "0xff00000000000000000000000000000000000001";
|
||||
export const DEFAULT_UI_FEE_RECEIVER_ACCOUNT = "0xF9f04a745Db54B25bB8B345a1da74D4E3c38c8aB";
|
||||
|
||||
export class Utils extends Module {
|
||||
private _gasLimits: GasLimitsConfig | null = null;
|
||||
@@ -261,7 +265,7 @@ export class Utils extends Module {
|
||||
return this._uiFeeFactor;
|
||||
}
|
||||
|
||||
const uiFeeReceiverAccount = this.sdk.config.settings?.uiFeeReceiverAccount ?? DEFAULT_UI_FEE_RECEIVER_ACCOUNT;
|
||||
const uiFeeReceiverAccount = DEFAULT_UI_FEE_RECEIVER_ACCOUNT;
|
||||
|
||||
const uiFeeFactor = await this.sdk
|
||||
.executeMulticall({
|
||||
|
||||
@@ -41,6 +41,7 @@ import {Abi, zeroHash} from 'viem';
|
||||
import {hashDataMap, hashString} from '../../generated/gmxsdk/utils/hash.js';
|
||||
import {CLAIMABLE_FUNDING_AMOUNT} from '../../generated/gmxsdk/configs/dataStore.js';
|
||||
import {abis} from '../../generated/gmxsdk/abis/index.js';
|
||||
import {DEFAULT_UI_FEE_RECEIVER_ACCOUNT} from '../../generated/gmxsdk/modules/utils/utils.js'
|
||||
|
||||
// Add the missing CLAIMABLE_UI_FEE_AMOUNT constant based on the pattern
|
||||
export const CLAIMABLE_UI_FEE_AMOUNT = hashString("CLAIMABLE_UI_FEE_AMOUNT");
|
||||
@@ -209,7 +210,7 @@ export async function getClientForAddress(
|
||||
subsquidUrl: "https://gmx.squids.live/gmx-synthetics-arbitrum:prod/api/graphql",
|
||||
subgraphUrl: "https://subgraph.satsuma-prod.com/3b2ced13c8d9/gmx/synthetics-arbitrum-stats/api",
|
||||
settings: {
|
||||
uiFeeReceiverAccount: "0xF9f04a745Db54B25bB8B345a1da74D4E3c38c8aB"
|
||||
uiFeeReceiverAccount: DEFAULT_UI_FEE_RECEIVER_ACCOUNT
|
||||
},
|
||||
markets: {
|
||||
"0x4D3Eb91efd36C2b74181F34B111bc1E91a0d0cb4": {
|
||||
@@ -1597,7 +1598,7 @@ export const getClaimableUiFeesImpl = async (
|
||||
}
|
||||
|
||||
// Get UI fee receiver from SDK config
|
||||
const uiFeeReceiver = sdk.config.settings?.uiFeeReceiverAccount || "0xF9f04a745Db54B25bB8B345a1da74D4E3c38c8aB";
|
||||
const uiFeeReceiver = DEFAULT_UI_FEE_RECEIVER_ACCOUNT;
|
||||
|
||||
// Build multicall request for all markets
|
||||
const multicallRequest = marketAddresses.reduce((request, marketAddress) => {
|
||||
|
||||
Reference in New Issue
Block a user