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