Disable ui fee
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Abi, Address, createPublicClient, createWalletClient, http, PublicClient, WalletClient } from "viem";
|
import {Abi, Address, createPublicClient, createWalletClient, http, PublicClient, WalletClient} from "viem";
|
||||||
|
|
||||||
import {Accounts} from "./modules/accounts/accounts.js";
|
import {Accounts} from "./modules/accounts/accounts.js";
|
||||||
import {BATCH_CONFIGS} from "./configs/batch.js";
|
import {BATCH_CONFIGS} from "./configs/batch.js";
|
||||||
@@ -45,7 +45,7 @@ export class GmxSdk {
|
|||||||
batch: BATCH_CONFIGS[this.config.chainId].client,
|
batch: BATCH_CONFIGS[this.config.chainId].client,
|
||||||
chain: getChain(this.config.chainId),
|
chain: getChain(this.config.chainId),
|
||||||
};
|
};
|
||||||
this.publicClient = createPublicClient(clientParams) as PublicClient;
|
this.publicClient = createPublicClient(clientParams) as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.walletClient =
|
this.walletClient =
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export function createDecreaseEncodedPayload({
|
|||||||
callbackContract: zeroAddress,
|
callbackContract: zeroAddress,
|
||||||
market: p.marketAddress,
|
market: p.marketAddress,
|
||||||
swapPath: p.swapPath,
|
swapPath: p.swapPath,
|
||||||
uiFeeReceiver: "0xF9f04a745Db54B25bB8B345a1da74D4E3c38c8aB",
|
uiFeeReceiver: process.env.GMX_UI_FEE_RECEIVER,
|
||||||
},
|
},
|
||||||
numbers: {
|
numbers: {
|
||||||
sizeDeltaUsd: p.sizeDeltaUsd,
|
sizeDeltaUsd: p.sizeDeltaUsd,
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ function createOrderParams({
|
|||||||
callbackContract: zeroAddress,
|
callbackContract: zeroAddress,
|
||||||
market: p.marketAddress,
|
market: p.marketAddress,
|
||||||
swapPath: p.swapPath,
|
swapPath: p.swapPath,
|
||||||
uiFeeReceiver: "0xF9f04a745Db54B25bB8B345a1da74D4E3c38c8aB",
|
uiFeeReceiver: process.env.GMX_UI_FEE_RECEIVER,
|
||||||
},
|
},
|
||||||
numbers: {
|
numbers: {
|
||||||
sizeDeltaUsd: p.sizeDeltaUsd,
|
sizeDeltaUsd: p.sizeDeltaUsd,
|
||||||
|
|||||||
@@ -185,6 +185,10 @@ export async function getClientForAddress(
|
|||||||
account: string,
|
account: string,
|
||||||
): Promise<GmxSdk> {
|
): Promise<GmxSdk> {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
console.log("GMX UI Fee Receiver:", process.env.GMX_UI_FEE_RECEIVER);
|
||||||
|
|
||||||
// Create SDK instance
|
// Create SDK instance
|
||||||
const arbitrumSdkConfig: GmxSdkConfig = {
|
const arbitrumSdkConfig: GmxSdkConfig = {
|
||||||
chainId: arbitrum.id,
|
chainId: arbitrum.id,
|
||||||
@@ -194,7 +198,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: process.env.GMX_UI_FEE_RECEIVER
|
||||||
},
|
},
|
||||||
markets: {
|
markets: {
|
||||||
"0x4D3Eb91efd36C2b74181F34B111bc1E91a0d0cb4": {
|
"0x4D3Eb91efd36C2b74181F34B111bc1E91a0d0cb4": {
|
||||||
@@ -943,6 +947,15 @@ export default fp(async (fastify) => {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const sdk = await getClientForAddress("0x0000000000000000000000000000000000000000");
|
||||||
|
fastify.log.info('GMX client initialized successfully');
|
||||||
|
fastify.log.info('GMX UI Fee Receiver:', sdk.config.settings.uiFeeReceiverAccount);
|
||||||
|
} catch (error) {
|
||||||
|
fastify.log.error('Failed to initialize GMX client:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export const getGmxRebateStatsImpl = async (
|
export const getGmxRebateStatsImpl = async (
|
||||||
@@ -1407,7 +1420,7 @@ export const getClaimableUiFeesImpl = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get UI fee receiver from SDK config
|
// Get UI fee receiver from SDK config
|
||||||
const uiFeeReceiver = "0xF9f04a745Db54B25bB8B345a1da74D4E3c38c8aB";
|
const uiFeeReceiver = sdk.config.settings?.uiFeeReceiverAccount;
|
||||||
|
|
||||||
// Build multicall request for all markets
|
// Build multicall request for all markets
|
||||||
const multicallRequest = marketAddresses.reduce((request, marketAddress) => {
|
const multicallRequest = marketAddresses.reduce((request, marketAddress) => {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ declare module 'fastify' {
|
|||||||
PRIVY_AUTHORIZATION_KEY: string;
|
PRIVY_AUTHORIZATION_KEY: string;
|
||||||
SENTRY_DSN: string;
|
SENTRY_DSN: string;
|
||||||
SENTRY_ENVIRONMENT: string;
|
SENTRY_ENVIRONMENT: string;
|
||||||
|
GMX_UI_FEE_RECEIVER: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,6 +52,9 @@ const schema = {
|
|||||||
SENTRY_ENVIRONMENT: {
|
SENTRY_ENVIRONMENT: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: 'development'
|
default: 'development'
|
||||||
|
},
|
||||||
|
GMX_UI_FEE_RECEIVER: {
|
||||||
|
type: 'string',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,6 +115,9 @@ export default fp(async (fastify) => {
|
|||||||
},
|
},
|
||||||
SENTRY_ENVIRONMENT: {
|
SENTRY_ENVIRONMENT: {
|
||||||
type: 'string'
|
type: 'string'
|
||||||
|
},
|
||||||
|
GMX_UI_FEE_RECEIVER: {
|
||||||
|
type: 'string',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -877,7 +877,7 @@ const UnifiedTradingModal: React.FC<UnifiedTradingModalProps> = ({
|
|||||||
<>
|
<>
|
||||||
{moneyManagements.map((item) => (
|
{moneyManagements.map((item) => (
|
||||||
<option key={item.name} value={item.name}>
|
<option key={item.name} value={item.name}>
|
||||||
{item.name}
|
{item.name} - SL: {(item.stopLoss * 100).toFixed(3)} - TP: {(item.takeProfit * 100).toFixed(3)} - x: {item.leverage}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user